Skip to main content

TS Types

This section presents types and functions exported by the @completium/archetype-ts-types package and used by contracts' bindings interface (storage, entry points, views).

A B

Address

Class for an address value that corresponds to Archetype/Michelson type address. Its contructor takes a string address value.

For example:

const a = new Address("tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb")

Fails with

"No matching prefix found."

When address prefix is not one of tz1, tz2, tz3, tz4, KT1


"Input is not b58 encoding compatible."

When address is not a b58 encoded value.


"The decoded output is the wrong length for the given prefix."

When address length does not match prefix.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Address, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Address value from the Micheline argument

annotated_mich_to_array(x, t)

Returns the annotated leafs of imbricated Pair nodes.

Parameters


Micheline input (likeky a Pair)


x's Micheline Type

Returns


Array<Micheline>

Array of annotated Pair's leafs

Fails with

Found an unannotated node that is not a pair

When a Pair's leaf is not annotated

Bls12_381_fr

Class for value that corresponds to Archetype/Michelson type bls12_381_fr. Its constructor takes a string value.

For example:

const bls_fr = new Bls12_381_fr("0x063bd6e11e2fcaac1dd8cf68c6b1925a73c3c583e298ed37c41c3715115cf96358a42dbe85a0228cbfd8a6c8a8c54cd015b5ae2860d1cc47f84698d951f14d9448d03f04df2ca0ffe609a2067d6f1a892163a5e05e541279134cae52b1f23c6b")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Bls12_381_fr, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Bls12_381_fr value from the Micheline argument

Bls12_381_g1

Class for value that corresponds to Archetype/Michelson type bls12_381_g1. Its constructor takes a string value.

For example:

const bls_g1 = new Bls12_381_g1("0x063bd6e11e2fcaac1dd8cf68c6b1925a73c3c583e298ed37c41c3715115cf96358a42dbe85a0228cbfd8a6c8a8c54cd015b5ae2860d1cc47f84698d951f14d9448d03f04df2ca0ffe609a2067d6f1a892163a5e05e541279134cae52b1f23c6b")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Bls12_381_g1, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Bls12_381_g1 value from the Micheline argument

Bls12_381_g2

Class for value that corresponds to Archetype/Michelson type bls12_381_g2. Its constructor takes a string value.

For example:

const bls_g2 = new Bls12_381_g2("0x063bd6e11e2fcaac1dd8cf68c6b1925a73c3c583e298ed37c41c3715115cf96358a42dbe85a0228cbfd8a6c8a8c54cd015b5ae2860d1cc47f84698d951f14d9448d03f04df2ca0ffe609a2067d6f1a892163a5e05e541279134cae52b1f23c6b")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Bls12_381_g2, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Bls12_381_g2 value from the Micheline argument

Bytes

Class for a bytes value that corresponds to Archetype/Michelson type bytes. Its constructor takes a string value.

For example:

const bls_g2 = new Bytes("0x050002")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Bytes, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Bytes value from the Micheline argument

hex_encode

Static method that converts a string to its hexadecimal bytes encoding.

hex_decode

Converts a bytes values from hexadecimal encoding to a string.

bool_to_mich(v)

Converts boolean value to Micheline.

Parameter


v :

boolean

Boolean value to convert.

Returns


Micheline encoding of v

Fails with

does not fail

C D

Chain_id

Class for a chain id value that corresponds to Archetype/Michelson type chain_id. Its constructor takes a string value.

For example:

const cid = new Chain_id("NetXdQprcVkpaWU")

Fails with

"No matching prefix found."

When chain id prefix is not Net


"Input is not b58 encoding compatible."

When chain id is not a b58 encoded value.


"The decoded output is the wrong length for the given prefix."

When chain id length does not match prefix.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Chain_id, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Chain_id value from the Micheline argument

CallParameter

Chest

Class for a chest value that corresponds to Archetype/Michelson type chest. Its constructor takes a string value.

For example:

const c = new Chest("0xc5ecdde89eb8c1e7aaeb85abb8f5e5cef3b4fa80c4aee2fccbf0a78ce0debaa5e9ddede3ddfbd9abdea28cc7dc99e6d3a9baf3cbae9adaaabc89cbc39e97e2c7a6cba99197d19ba09ddfd181afc997ffbcc5acb2d29ecbb698c2cacbdd83d1b4ced0bffe9cd78295b3fba4d9f9d5f4d4ec9ad3c7e1a8eeb9dba5cbd8a2dbf29af8e4a4c1e4b1edacf98fccefaef9fea4f0bacdd38ecbfe81c3f9839b9e9ab8fbf5f1eabac48a9f8ca7c588eefe94d1f18bd9bcee9aecde8dd285cf9098f4e1a7eec787f3a0e0ff9cd0ce8ec5a2a4e5ecb08fce899eb5baa397fabf90de9397cebc81bbdfb386e6b4da9fd8fdd19ed9f8d684c782b0aacfeebae4f6e7d1c5c1e6a093c68081cf83b991b4ecd7b38aee92deddcad79eb9abe0a0a0c6b5909dc58495f69445fff5ae9cefe8b8beb2fb86ccf5c9ad91989bdad8a3cfbedaffa2de8bf19dc6ac8cbc8a9584fa9f85f9ba958fc6bbc09ac8e7d5f0fdb98b86c1c7d59ad7c6dfc2d2cefaf5d9db909bf0e3acd3ccc792bc9bccbab4a4febda9b685dbc39ea2a4a7b69990d3abd8b9b3d7dbc581b984f3e08a98f7f7f0e697cc8dfd88edc8c3ca8dc3b2a9ccf6cdd6d0efcc848bc8ead5858bbabfcfc1c8ecea84fd9b96a5e4eabb8c918dafe6f78d83e8e1c2e5f8ee88a4ee8dcaeeafffebfcbbfda1e9eb86c582f2eedd9299cbc0a7fce083ced8c8ddb0e7eaacb696c1fccdadcdc8e3c6f7b9de84eece9bb7919094fef4fdf6efd8b1ba8bbecb9380add4f59ddbf9a19f95facc84e9d0a99bfa93f1fcc3a0fbde9b9ce0c7e8dec6e8d1dfa7dda6f490bb9580abfdbcc0e202e5ff731c3c17d080ee430edd30979a47aa653656e11e593800000015c2ca2a23b732a72932611618ad9ea324986377591e")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Chest, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Chest value from the Micheline argument

Chest_key

Class for a chest key value that corresponds to Archetype/Michelson type chest_key. Its constructor takes a string value.

For example:

const c = new Chest_key("0xa0aceddfb3c9fbe1b8c382c7d5a7dedbe2e5adf9edcfc3e9d084caa6aeb9818ff1e985cb9efe8fa089ceeaa0f5d0bcb583e2f29196f2d3908fffffdcda868faffcb78fb697e7eaf3e7dca9d4b5dda2c3e4f8adf8abf484ecae85f7d6e0f2d28cb69af1d7b19082e8d8d7ba96e7e1e0bb8ac9b9fcf0a9e5b7c1a499c4faf4c8a3a9c8e4d09aa780eac6cee1b78a97a3e983abf9a5f1e8d2a2a2b5e3bcb8c4effeb7a3a68a85a497cd91c9a2c096c3f596deb8d1aca3a5aff28effb8cfc9c7ced892e3a7c09deeb8c8ec9387a3b384b5c8bccaafc7a9a2c1cfd8c7becfd7d6828a9af8f4988fe4ead3b59ecfb8ff8cabf8be90d4c8bdbddfce9cd7c2bb81edc4b7ad80a59a978f8c9debe7aaf08cf0c588f3eaade6b9f4e4e6edf1ed9c9988e48d9ba0aa8f01d18bac92b886db9dd798b5f6fdc891a28da2c4c48da1918897a2b7c2dfa0b78ab8e291b68fb1a2bfa5e8b88e9cabb0b5b0feabcffc9cfeee888ac4afeed9dc8bf5a4eaa9ae89a3838cf6cfd4f8acff8fa7aef7a9889fbbc7d8f6dde4edf3e58096e580e299e5b082b9cf85f3fe8ac6c0998eb1bcbab9bfb8fba39faea7bce0f6fed9ea86dfdad58cf7cbc7fcc4ecf7e2e898d3b19582e38c8092b7e4a0cddc83eb8bc38d91fefed6be869496b8e4fc99d5fae5c6a2b2dcabe2a4ea85b68b87b182d7e8cac29fe0b9efd6d0eb999ffa98aaaf9bf09fe7c4b39d81db97e4e7bbaef0e3bfedd69d9089bc8d91b292afa6c8b389fc9fb7aaa8decab6d9b493a6eafaa5baffe8fb85f2d483ecd1f2d1e58f938df9d8d5e385fe96c5f58ae1e0b09bf2b3c2931f")

Methods


toString

Returns a string representation

equals

Takes a parameter of type chest_key, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a chest_key value from the Micheline argument

date_cmp(a, b)

Compares two dates at second precision, ie milliseconds are ignored. It is typically used to compare a TypesScript date with a date retrieved from the blockchain.

Parameters


a :

Date

Date to compare


b :

Date

Date to compare

Returns


boolean

true if a equals b (without milliseconds).

Fails with

does not fail

date_to_mich(v)

Converts a date to Micheline.

Parameter


v :

Date

Date to convert

Returns


Micheline encoding of v

Fails with

does not fail

Duration

Class for a duration value that corresponds to Archetype type duration. Its constructor takes a string value that is the Archetype literal.

For example, a duration of 10 seconds:

const d1 = new Duration("10s") // 10 seconds

A duration of 5 minutes:

const d2 = new Duration("5m") // 5 minutes

A duration of 18 hours:

const d3 = new Duration("18h") // 18 hours

A duration of one week:

const d4 = new Duration("1w") // 1 week

A duration of 5 minutes and 10 seconds:

const d5 = new Duration("5m10s")

A duration of 3 weeks, 8 days, 4 hours, 34 minutes and 18 seconds:

const d6 = new Duration("3w8d4h34m18s")

Fails with

"Invalid duration input"

When the duration format is invalid.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Duration, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Duration value from the Micheline argument

E F

elt_to_mich(a, b)

Makes a Micheline Elt node.

Parameters


Micheline element


Micheline element

Returns


Micheline Elt node of a and b

Fails with

does not fail

Entrypoint

Class for entry point value that corresponds to Archetype/Michelson type contract. Its constructor takes the contract's Address value and the entry point name as string.

For example:

const e = new Entrpoint(new Address("KT1QJSgFHZYsP8V8snXKmoKTqq2dDfTE626p"), "exec")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Duration, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Duration value from the Micheline argument

Enum

Abstract class from which binding's generated enum classes are derived. Its constructor takes the name of the enum as a string.

See here for an example.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Entrypoint, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

type

Returns the name of the enum as a string

I J

Int

Class for integer value that corresponds to Archetype/Michelson type int. It uses the bignumber.js package to support the arbitrary-precision feature of Tezos.

There are several ways to construct an Int value:

From number:

const i = new Int(-3)

From string:

const i = new Int("0987654323456789876543456789876543456789876543456789876543")

From bignumber:

const bn = new BigNumber("0987654323456789876543456789876543456789876543456789876543")
const i = new Int(bn)

Fails with

Not an Int value

when the constructor parameter does not represent a integer value

Methods


toString

Returns a string representation

equals

Takes a parameter of type Int, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Int value from the Micheline argument

to_big_number

Returns the bignumber.js value

to_number

Returns the number value. It is approximated if this is over number representation capacity.

plus

Takes a parameter of type Int, and returns the sum as an Int value

minus

Takes a parameter of type Int, and returns the subtraction as an Int value

times

Takes a parameter of type Int, and returns the multiplication as an Int value

div

Takes a parameter of type Int, and returns the division of this by the parameter as a Rational value

is_left(v)

Checks if v is a Left node.

Parameter


v :

Micheline

Micheline value

Returns


boolean

true if and only if v is Left

Fails with

does not fail

is_right(v)

Checks if v is a Right node.

Parameter


Micheline value

Returns


boolean

true if and only if v is Right

Fails with

does not fail

K L

Key

Class for key value that corresponds to Archetype/Michelson type key. Its constructor takes a string value.

For example:

const k = new Key("edpkurLzuFFL1XyP3fed4u7MsgeywQoQmHM45Bz91PBzDvUjQ9bvdn")

Fails with

"No matching prefix found."

When key prefix is not edpk, sppk, p2pk


"Input is not b58 encoding compatible."

When key is not a b58 encoded value.


"The decoded output is the wrong length for the given prefix."

When key length does not match prefix.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Key, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Key value from the Micheline argument

Key_hash

Class for key hash value that corresponds to Archetype/Michelson type key_hash. Its constructor takes a string value.

For example:

const k = new Key_hash("tz1Lc2qBKEWCBeDU8npG6zCeCqpmaegRi6Jg")

Fails with

"No matching prefix found."

When key hash prefix is not one of tz1, tz2, tz3, tz4, KT1


"Input is not b58 encoding compatible."

When key hash is not a b58 encoded value.


"The decoded output is the wrong length for the given prefix."

When key hash length does not match prefix.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Key_hash, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Key_hash value from the Micheline argument

left_to_mich(v)

Makes a Micheline Left value.

Parameter


v :

Micheline

Micheline argument to Left value

Returns


Micheline Left value

Fails with

does not fail

list_to_mich(l, toMich)

Applies function toMich to elements in l

Parameters


l :

Array<T>

Array of elements


toMich :

{ (a: T): Micheline }

Function to apply to elements of l

Returns


Array<Micheline>

Array of Micheline values

Fails with

does not fail

list_annots_to_mich_type(mt, annots)

Make an annotated Micheline type list of elements of type mt

Parameters


elements' Micheline type


annots :

Array<string>

List type annotations

Returns


list Micheline type

Fails with

does not fail

list_to_mich_type(mt)

Make a Micheline type list of elements of type mt

Parameter


elements' Micheline type

Returns


list Micheline type

Fails with

does not fail

M N

mich_array_to_mich(l)

Makes a right comb of Micheline elements l

Parameter


l :

Micheline[]

Micheline elements

Returns


right comb of l

Fails with

does not fail

mich_to_bool(x)

Converts Micheline to boolean value

Parameter


Value to convert

Returns


boolean

true if x's prim is True, false if False

Fails with

"Invalid prim"

if x's prim is not True nor false

mich_to_date(x)

Converts Micheline to Date value

Parameter


Value to convert

Returns


Date

Converted Date value

Fails with

Error

An error is thrown if x's prim does not represent a date

mich_to_map(l, f)

Applies f to Micheline Melt values of Marray x

Parameters


Marray Micheline values of elements


f :

(k: Micheline, v: Micheline): [K, V]

Function that returns a pair of values from a pair of Micheline values

Returns


Array<[K, V]>

Array of pairs

Micheline

Micheline refers here to the JSON format of a Michelson literal. It is in fine the format used to interact with the Tezos blockchain: entry point parameters, contract storage and so on, are exchanged in Micheline format.

The goal of the contract binding is to provide a native TypeScript interface that translates to Micheline values. Hence in most cases, thanks to contract binding, you should not deal with Micheline values.

The type provided here is a full-featured Typescript implementation of a Micheline value, such that a Micheline-typed value is ensured to be a valid Micheline value.

MichelineType

Micheline type refers here to the JSON format of a Michelson literal's type.

The type provided here is a full-featured Typescript implementation of a Micheline type value, such that a MichelineType-typed value is ensured to be a valid Micheline type value.

Nat

Class for natural value that corresponds to Archetype type nat. It uses the bignumber.js package to support the arbitrary-precision feature of Tezos.

There are several ways to construct an Nat value:

From number:

const n = new Int(42)

From string:

const n = new Int("0987654323456789876543456789876543456789876543456789876543")

From bignumber:

const bn = new BigNumber("0987654323456789876543456789876543456789876543456789876543")
const n = new Int(bn)

Fails with

Not a Nat value

when the constructor parameter does not represent a natural value

Methods


toString

Returns a string representation

equals

Takes a parameter of type Nat, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Nat value from the Micheline argument

to_big_number

Returns the bignumber.js value

to_number

Returns the number value. It is approximated if this is over number representation capacity.

plus

Takes a parameter of type Nat, and returns the sum as a Nat value

minus

Takes a parameter of type Nat, and returns the subtraction as an Int value

times

Takes a parameter of type Nat, and returns the multiplication as a Nat value

div

Takes a parameter of type Nat, and returns the division of this by the parameter as a Rational value

O P

Option

Generic class for an optional value that corresponds to Archetype/Michelson type option. The class is parameterized with the type of the optional value. Its constructor takes the optional value, null or undefined.

For example, an optional natural value:

const o1 = new Option<Int>(new Nat(42))

An optional string, using the Some static method:

const o2 = new Option.Some<string>("Hello Option!")

A none value of Int, using the None static method:

const o3 = new Option.None<Int>() // typed Option<Int>

Methods


toString

Returns a string representation

equals

Takes a parameter of type Option, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Option value from the Micheline argument

Some

Static method to make a none option.

None

Static method to make a some option of its argument.

get

Returns the value when is_some returns true, null otherwise.

is_some

Returns true if get does not return null, false otherwise.

is_none

Returns true if get does return null, false otherwise.

option_annot_to_mich_type(a, annots)

Makes an option Micheline type of a

Parameters


Micheline type


annots :

string[]

Annotations

Returns


option Micheline type

Fails with

does not fail

option_to_mich_type(a)

Makes an option Micheline type of a

Parameter


Micheline type

Returns


option Micheline type

Fails with

does not fail

Or

Generic class for value that corresponds to the Archetype/Micheline type or. The class is parameterized with left and right types. Its constructor takes an argument of type left or right and a boolean that is true if this is a left value.

Static methods Left and Right are rather used to make an Or value. For example:

const l = Or.Left<Nat, string>(new Nat(2))

To make a right value:

const r = Or.Right<Nat, string>("Hello Or!")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Or, and returns a true if it is equal to this value

from_mich

Static methods that returns an Or value. Its arguments are:
  • a Micheline value
  • a mich_to_left function that returns a left typed value
  • a mich_to_right function that returns a right typed value

to_mich

Returns a Micheline value from:
  • a l_left function that returns a Micheline for left typed value
  • a l_left function that returns a Micheline for right typed value

Left

Makes an Or value from a left typed value

Right

Makes an Or value from a right typed value

get

Returns a left or right typed value

is_left

Returns true if this is an Or of left value, false otherwise

is_right

Returns true if this is an Or of right value, false otherwise

or_to_mich_type(l, r, a)

Makes an or Micheline type of l and r

Parameters


Left Micheline type


Right Micheline type

Returns


or Micheline type

Fails with

does not fail

pair_to_mich(l)

Makes an or Micheline type of l and r

Parameters


Left Micheline type


Right Micheline type

Returns


or Micheline type

Fails with

does not fail

pair_annot_to_mich_type(p, a, b, annots)

Makes a Micheline node with prim p and arguments a and b

Parameters


p :

string

Prim value: one of "big_map" "lambda" "or"


First argument


Second argument


annots :

string[]

Annotations

Returns


Micheline value of prim p

Fails with

does not fail

pair_array_to_mich_type(l, annots)

Makes a pair Micheline type of types l

Parameters


l :

MichelineType[]

Array of Micheline Type values


annots :

string[]

Annotations

Returns


pair Micheline type

Fails with

does not fail

pair_to_mich_type(p, a, b)

Makes a Micheline node with prim p and arguments a and b

Parameters


p :

string

Prim value: one of "big_map" "lambda" "or"


First argument


Second argument

Returns


Micheline value of prim p

Fails with

does not fail

prim_annot_to_mich_type(p, a)

TODO

Parameters


p :

string

"prim" value (one of "address" "bls12_381_fr" "bls12_381_g1" "bls12_381_g2" "bool" "bytes" "chain_id" "chest" "chest_key" "int" "key" "key_hash" "mutez" "nat" "never" "operation" "signature" "string" "timestamp" "unit" )


a :

string[]

Annotations

Returns


Micheline Type with "prim" p

Fails with

does not fail

prim_to_mich_type(p)

Makes a Michelson type.

Parameter


p :

string

"prim" value (one of "address" "bls12_381_fr" "bls12_381_g1" "bls12_381_g2" "bool" "bytes" "chain_id" "chest" "chest_key" "int" "key" "key_hash" "mutez" "nat" "never" "operation" "signature" "string" "timestamp" "unit" )

Returns


Michelson type with "prim" p

Fails with

does not fail


Related

Q R

Rational

Class for a rational value that corresponds to the Archetype type rational. Its constructor takes an argument of type number, string or bignumber for aritrary precision arithmetic.

There are several ways to construct an Rational value:

From number:

const r = new Rational(-3.6)

From string:

const r = new Int("98.7654323456789876543456789876543456789876543456789876543")

From bignumber:

const bn = new BigNumber("98.7654323456789876543456789876543456789876543456789876543")
const r = new Rational(bn)

From two bignumber values (numerator and denominator):

const n = new BigNumber("567")
const d = new BigNumber("37")
const r = new Rational(n, d)

Fails with

"Rational error"

When the string value is not a number

Methods


toString

Returns a string representation

equals

Takes a parameter of type Rational, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Rational value from the Micheline argument

to_big_number

Returns the bignumber.js value

to_number

Returns the number value. It is approximated if this is over number representation capacity.

plus

Takes a parameter of type Rational, and returns the sum as an Rational value

minus

Takes a parameter of type Rational, and returns the subtraction as an Rational value

times

Takes a parameter of type Rational, and returns the multiplication as an Rational value

div

Takes a parameter of type Rational, and returns the division of this by the parameter as a Rational value

floor

Returns the Int floored value.

ceil

Returns the Int ceiled value.

right_to_mich(v)

Makes a Micheline Right value.

Parameter


v :

Micheline

Micheline argument to Right value

Returns


Micheline Right value

Fails with

does not fail

S T

Sapling_state

Class for a sapling state value that corresponds to Archetype/Michelson type sapling_state. Its constructor takes a string value.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Sapling_state, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Sapling_state value from the Micheline argument

Sapling_transaction

Class for a sapling transaction value that corresponds to Archetype/Michelson type sapling_transaction. Its constructor takes a string value.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Sapling_transaction, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Sapling_transaction value from the Micheline argument

set_annot_to_mich_type(mt, annots)

Makes a Micheline type set of elements of type mt

Parameters


Set element type


annots :

string[]

Annotations

Returns


set Micheline type

Fails with

does not fail

set_to_mich_type(mt)

Makes a Micheline type set of elements of type mt

Parameter


Set element type

Returns


set Micheline type

Fails with

does not fail

Signature

Class for a signature value that corresponds to Archetype/Michelson type signature. Its constructor takes a string value.

For example:

const s = new Signature("edsigtvwtJaiM7phNNkZjazqKtthDxc3WswYNL961GKgz7VxvPJmWJ8WEkmEZd9oFM1RvwABYW3uYgwGRP7nuBns5WrqyfYsUaB")

Methods


toString

Returns a string representation

equals

Takes a parameter of type Signature, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Signature value from the Micheline argument

string_cmp(a, b)

Compares two string values.

Parameters


a :

string

String to compare


b :

string

String to compare

Returns


boolean

true if a equals b

Fails with

does not fail

Tez

Class for a tez value that corresponds to Archetype type tez and Michelson type mutez. Its constructor takes a value of type string, number or bignumber, and an optional string value for unit that is either "tez" or "mutez" (defaulted to "tez" when not specified).

For example, five tez:

const amount = new Tez(5)

Again five tez from mutez value:

const amount = new Tez("5000000", "mutez")

Fails with

"Invalid Tez value"

When string value is not a number

Methods


toString

Returns a string representation

equals

Takes a parameter of type Tez, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Tez value from the Micheline argument

to_big_number

Returns the bignumber.js value

plus

Takes a parameter of type Tez, and returns the sum as an Tez value

times

Takes a parameter of type Tez, and returns the multiplication as an Tez value

Ticket

Class for a ticket value that corresponds to Archetype/Michelson type ticket. Its constructor takes a string value.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Ticket, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Ticket value from the Micheline argument

ticket_annots_to_mich_type(mt, annots)

Makes a ticket Micheline type of element of type mt

Parameters


Micheline type


annots :

string[]

Annotations

Returns


MichelineType

ticket Micheline type

Fails with

does not fail

ticket_to_mich_type(mt)

Makes a ticket Micheline type of element of type mt

Parameter


Micheline type

Returns


MichelineType

ticket Micheline type

Fails with

does not fail

U V

Unit

Class for a unit value that corresponds to Archetype/Michelson type unit.

Methods


toString

Returns a string representation

equals

Takes a parameter of type Unit, and returns a true if it is equal to this value

to_mich

Returns the Micheline typed value

from_mich

Static method that returns a Unit value from the Micheline argument

unit_to_mich()

Converts Unit value to Micheline.

Returns


Micheline Unit value

Fails with

does not fail