Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @taquito/michelson-encoder

pkgsign status

Taquito Michelson Encoder package

Our current smart contract abstraction feature is currently in preview. It's API is not final, and it may not cover every use case (yet). We will greatly appreciate any feedback on this feature.

@taquito/michelson-encoder converts michelson data and types into convenient JS/TS objects.

See the top-level project https://github.com/ecadlabs/taquito for details on reporting issues, contributing and versioning.

Example

Given the following michelson smart contract data, retrieved from a Tezos Nodes RPC:

{
  "storage": {
    "prim": "Pair",
    "args": [
      [],
      {
        "prim": "Pair",
        "args": [
          { "int": "1" },
          {
            "prim": "Pair",
            "args": [
              { "int": "1000" },
              {
                "prim": "Pair",
                "args": [
                  { "string": "Token B" },
                  {
                    "prim": "Pair",
                    "args": [
                      { "string": "B" },
                      { "string": "tz1ccqAEwfPgeoipnXtjAv1iucrpQv3DFmmS" }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

@taquito/michelson-encoder will give the caller this:

{
  accounts: {},
  version: '1',
  totalSupply: '1000',
  name: 'Token B',
  symbol: 'B',
  owner: 'tz1ccqAEwfPgeoipnXtjAv1iucrpQv3DFmmS' 
}

API Documentation

TypeDoc style documentation is available on-line here

Disclaimer

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

References

Classes

Interfaces

Type aliases

Variables

Functions

References

AddressValidationError

Re-exports AddressValidationError

AddressValidationError

Re-exports AddressValidationError

BigMapValidationError

Re-exports BigMapValidationError

BigMapValidationError

Re-exports BigMapValidationError

BytesValidationError

Re-exports BytesValidationError

BytesValidationError

Re-exports BytesValidationError

ChainIDValidationError

Re-exports ChainIDValidationError

ChainIDValidationError

Re-exports ChainIDValidationError

ContractValidationError

Re-exports ContractValidationError

ContractValidationError

Re-exports ContractValidationError

IntValidationError

Re-exports IntValidationError

IntValidationError

Re-exports IntValidationError

KeyHashValidationError

Re-exports KeyHashValidationError

KeyHashValidationError

Re-exports KeyHashValidationError

KeyValidationError

Re-exports KeyValidationError

KeyValidationError

Re-exports KeyValidationError

ListValidationError

Re-exports ListValidationError

ListValidationError

Re-exports ListValidationError

MapTypecheckError

Re-exports MapTypecheckError

MapValidationError

Re-exports MapValidationError

MapValidationError

Re-exports MapValidationError

MichelsonMap

Re-exports MichelsonMap

MichelsonMapKey

Re-exports MichelsonMapKey

MutezValidationError

Re-exports MutezValidationError

MutezValidationError

Re-exports MutezValidationError

NatValidationError

Re-exports NatValidationError

NatValidationError

Re-exports NatValidationError

ParameterSchema

Re-exports ParameterSchema

Schema

Re-exports Schema

Semantic

Re-exports Semantic

SetValidationError

Re-exports SetValidationError

SetValidationError

Re-exports SetValidationError

SignatureValidationError

Re-exports SignatureValidationError

SignatureValidationError

Re-exports SignatureValidationError

Type aliases

Falsy

Falsy<T>: T | undefined | false

Type parameters

  • T

MichelsonMapKey

MichelsonMapKey: Array<any> | Object | string | boolean | number

TokenFactory

TokenFactory: (val: any, idx: number) => Token

Type declaration

    • (val: any, idx: number): Token
    • Parameters

      • val: any
      • idx: number

      Returns Token

Variables

Const UnitValue

UnitValue: unique symbol = Symbol()

Const michelsonMapTypeSymbol

michelsonMapTypeSymbol: unique symbol = Symbol.for('taquito-michelson-map-type-symbol')

Const schemaTypeSymbol

schemaTypeSymbol: unique symbol = Symbol.for('taquito-schema-type-symbol')

Const tokens

tokens: (BigMapToken | PairToken | NatToken | StringToken | AddressToken | BoolToken | ContractToken | ListToken | MutezToken | BytesToken | TimestampToken | IntToken | UnitToken | KeyToken | KeyHashToken | SignatureToken | LambdaToken | OperationToken | SetToken | ChainIDToken | MapToken | OrToken | OptionToken)[] = [PairToken,NatToken,StringToken,BigMapToken,AddressToken,MapToken,BoolToken,OrToken,ContractToken,ListToken,MutezToken,BytesToken,OptionToken,TimestampToken,IntToken,UnitToken,KeyToken,KeyHashToken,SignatureToken,LambdaToken,OperationToken,SetToken,ChainIDToken,]

Functions

createToken

  • createToken(val: any, idx: number): Token

Const isMapType

Generated using TypeDoc