Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@tessellatedgeometry/conseiljs

Cryptonomic2Apache-2.05.0.6TypeScript support: included

Client-side library for Tezos dApp development.

tezos, conseil, blockchain analytics, blockchain reporting, blockchain data access, web3, dapp

readme

ConseilJS-core

npm version npm Build Status Coverage Status Quality Gate Status dependencies

A library for building decentralized applications in Typescript and Javascript, currently focused on the Tezos platform.

ConseilJS connects to Tezos nodes for live chain data and operations and to Conseil servers for high-performance analytics on blockchain data. Internally, Cryptonomic uses Nautilus for infrastructure deployments of these services. This is the library at the core of our products, Arronax, Mininax and certainly Galleon. There are ReasonML bindings as well.

Cryptonomic offers an infrastructure service - Nautilus Cloud which enables quick access to the Tezos platform along with products that make it easier build on it.

Sub-modules

As of version 5.0.0, ConseilJS has been split into three parts: this library, which is considered to be the core, ConseilJS-softsigner and ConseilJS-ledgersigner. This was done in an effort to make the library more portable across different environments. If neither of these additional modules meet your needs, the Signer and KeyStore interfaces can be implemented separately. In addition to a Signer and a KeyStore, fetch and logger objects are required to be provided, see below.

For more details on how to use these libraries see their respective readme files: ConseilJS-core, ConseilJS-softsigner, ConseilJS-ledgersigner.

Use with Nodejs

Add our NPM package to your project and a signing library.

npm i conseiljs
npm i conseiljs-softsigner
import fetch from 'node-fetch';
import * as log from 'loglevel';

import { registerFetch, registerLogger, Signer, TezosMessageUtils } from 'conseiljs';
import { KeyStoreUtils, SoftSigner } from 'conseiljs-softsigner';

const logger = log.getLogger('conseiljs');
logger.setLevel('debug', false);
registerLogger(logger);
registerFetch(fetch);

let signer: Signer;
const keyStore = await KeyStoreUtils.restoreIdentityFromSecretKey('edskRgu8wHxjwayvnmpLDDijzD3VZDoAH7ZLqJWuG4zg7LbxmSWZWhtkSyM5Uby41rGfsBGk4iPKWHSDniFyCRv3j7YFCknyHH');
signer = await SoftSigner.createSigner(TezosMessageUtils.writeKeyWithHint(keyStore.secretKey, 'edsk'), -1);

Use with React

We have a complete React application tutorial for you to check out.

Use with React Native

TBD

Use with Web

<html>
<head>
    <script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs/dist-web/conseiljs.min.js"
        integrity="sha384-DsZ98An5RJlEquKpG7VziukP7Zqae8IlsF9VmTnz41Ga8FvAx6Hvn0hMkpBj3pms"
        crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/gh/cryptonomic/conseiljs-softsigner/dist-web/conseiljs-softsigner.min.js"
        integrity="sha384-V1iaajn0x/SMFcZ9Y/xNQmqQSKyll6Dzt27U6OWiv8NdbHTVaHOGHdQ8g0G68HPd"
        crossorigin="anonymous"></script>
    <script>
        //conseiljssoftsigner.
    </script>
</head>
<body>
    ...
</body>
</html>

The web version sets fetch and logger internally to window.fetch and console respectively.

A fully functional sample html page is available too.

API Overview and Examples

We have ready-to-use examples to copy/paste.

Contribute

There are many ways to contribute to this project. You can develop applications or dApps with it. You can submit bug reports or feature requests. You can ask questions about it on r/Tezos or the Tezos StackExchange. We certainly welcome pull requests as well.

Other references

Developer Handbook

Smart Contract Development Syllabus

Wiki

Riot Dev Channel

Cryptonomic Reddit

The Cryptonomic Aperiodical

@CryptonomicTech

changelog

ConseilJS Change Log

5.0.3

The purpose of this release is to split ConseilJS into several parts to minimize the number of direct dependencies. ConseilJS is packaged as three components: ConseilJS-core, ConseilJS-softsigner and ConseilJS-ledgersigner.

Breaking Changes

  • New interfaces were introduced to support external signing and key storage: KeyStore, Signer.
  • Any function that previously took a required KeyStore-type parameter now also requires a Signer. This includes many changes in TezosNodeWriter, TezosOperationQueue, and the contract wrappers in src/chain/tezos/contracts/.
  • CryptoUtils has moved to ConseilJS-softsigner. This removes dependencies on crypto, libsodium and others.
  • What used to be in src/identity/tezos/ is not split between the ConseilJS-softsigner and ConseilJS-ledgersigner packages.
  • CryptoUtils.simpleHash was moved to TezosMessageUtil.simpleHash, smae with twoByteHex, fromByteHex

New Features

  • Added TZIP 0012 (FA2) multi-asset token contract interface chain/tezos/contracts/tzip12/MultiAssetTokenHelper.ts.
  • Added TZIP 0012 (FA2) single-asset token contract interface chain/tezos/contracts/tzip12/SingleAssetTokenHelper.ts.
  • Added ability to pick operation branch based on block age.
  • Added TezosConseilClient.getBigMapValueForKey
  • Added TezosLanguageUtil.hexToMichelson

Fixes

  • Michelson parser has several updates that should reduce memory footprint.

0.4.3

New Features

  • Improved operation cost estimation for nested operations, thank you @keefertaylor!
  • Added contract deployment cost estimation, thank you @keefertaylor!

Fixes

  • TezosNodeReader.getMempoolOperationsForAccount no longer throws a JSON parse error.
  • DUP n is now parsed correctly.
  • Ported Map parameter parsing from ConseilJS 5.0.x.

0.4.2

New Features

  • Support for the StakerDao token.
  • Support for the tzBTC token.
  • Added various functions in TezosWalletUtil & CryptoUtils for signing of and verifying signatures on arbitrary text.
  • Added preliminary support for the murbard multi-sig contract.
  • Added TezosConseilClient.getOperation().

Fixes

  • ConseilJS 265
  • ConseilJS 269
  • ConseilJS 270
  • WrapperWrapper.salt & WrapperWrapper.nonce were not loading libsodium correctly.
  • Fixed Michelson parser map, list and bytes handling.
  • Improved entry point parsing.
  • Improved data coming back from TezosNodeReader.getMempoolOperationsForAccount
  • Improved error reporting for account activation.
  • Increased test coverage.

0.4.1

Breaking Changes

  • TezosNodeWriter.testContractInvocationOperation no longer has the derivationPath argument.
  • TezosConseilClient.getBlockByLevel now returns a single item, not an array.
  • TCFBakerRegistryHelper.getFees was renamed to getSimpleStorage to match other contract interfaces.

New Features

  • added TezosConseilClient.getBigMapData that allows quick big_map queries against Conseil.
  • added mempool support with TezosNodeReader.getMempoolOperation and TezosNodeReader.getMempoolOperationsForAccount.
  • added CryptonomicNameServiceHelper.
  • support for complex bigmap keys.
  • TezosConseilClient.getBlock now supports 'head' as a hash value.

Fixes

0.4.0-beta

Breaking Changes

  • Moved chain/tezos/TezosProtocolHelper.ts to /chain/tezos/contracts/BabylonDelegationHelper.
  • TezosConseilClient.getBlockByLevel, TezosConseilClient.getAccount, TezosConseilClient.getOperationGroup now return single items, not arrays of 1.
  • EntryPoint.generateInvocationPair() now returns a tuple with entrypoint and parameters keys.
  • TezosConseilClient.awaitOperationConfirmation now returns a single item, not an array.
  • Removed CryptoUtils.getPasswordStrength() and the related zxcvbn dependency. This functionality should be added by the implementing application.
  • TezosNodeWriter.preapplyOperation(), testContractInvocationOperation() and injectOperation() now parse and report errors.
  • nodejs 12.14 is now a base requirement.

New Features

  • added Tezos Commons Baker Registry interface chain/tezos/contracts/TCFBakerRegistryHelper.
  • added TZIP 0007 (FA1.2) token contract interface chain/tezos/contracts/Tzip7ReferenceTokenHelper.
  • TezosMessageUtil can now pack key_hash value.

Fixes

  • Improved TezosNodeReader.getAccountManagerForBlock.
  • TezosNodeReader.isImplicitAndEmpty and TezosNodeReader.isManagerKeyRevealedForAccount now default to head by reference instead of query.
  • Added TezosNodeReader.getContractStorage.
  • Michelson parser support for D\[UI\]G n, D\[UI\]P n, DROP n.
  • Generally improved Michelson contract parser.
  • Improved TezosContractIntrospector parser.
  • Updated documentation.
  • Reduced and updated dependencies.

0.3.8-beta

  • updated various dependencies, importantly for Ledger device communication

0.3.7

Fixes

  • big_int encoding

0.3.6

Fixes

  • integer encoding issue introduced in 0.3.5-beta

0.3.5-beta

Breaking Changes

  • EntryPoint.generateParameter became EntryPoint.generateInvocationString.

Fixes

  • Improved entry point parser, this functionality is still experimental.
  • Added EntryPoint.generateInvocationPair to produce Protocol 005 style invocation parameters.
  • ConseilPredicate gained a group attribute for or queries.
  • removed base-n dependency.

0.3.4-beta

Fixes

  • basic big_map query support.
  • nodejs 10.17.x is now the minimum requirement.
  • all dependencies are now referenced with explicit versions.

0.3.3-beta

Breaking Changes

  • TezosNodeWriter.applyOperation was renamed to TezosNodeWriter.preapplyOperation
  • TezosNodeWriter.testOperation was renamed to TezosNodeWriter.testContractInvocationOperation and now estimates cost of contract invocation
  • TezosConseilClient.getBlock now returns a single item, not an array
  • TezosConseilClient.getAccount now returns a single item, not an array
  • TezosConseilClient.getOperationGroup now returns a single item, not an array

Fixes

  • custom entry point hex encoding, thanks to @elkesrio

Known issues

  • Michelson lambda parameter encoding is not yet supported
  • Michelson DIG, DUG, EMPTY_BIG_MAP, APPLY, CHAIN_ID operations are not supported

Future Breaking Changes

  • KeyStore now contains derivationPath, in a subsequent release, functions that accept a KeyStore parameter and a derivationPath parameter will be modified to take only the former.