Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Variables

Functions BLS12-381

Functions Comparison

Functions Contract

Functions Crypto

Functions Equality

Functions Integer

Functions Logic

Functions Michelson

Functions Sapling

Functions Serialization

Functions | Block metadata

Functions | Concatenation

Functions | Container Literals

Functions | Lambda

Functions | List expressions

Functions | Map expressions

Functions | Math

Functions | Operations

Functions | Pair expressions

Functions | Set expressions

Functions | Singleton Literals

Functions | Size

Functions | Slicing

Functions | Ticket

Functions | Timestamp

Functions | Transaction metadata

Functions | Type Handling

Functions | Unary

Functions | Variable Accessors

Functions | Variant

Functions | View

Variables

Comparison: { GreaterThan: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>; GreaterThanOrEqual: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>; LessThan: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>; LessThanOrEqual: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool> } = ...

Type declaration

  • GreaterThan: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
      • Check if a value is greater than another value.

        GreaterThan(Nat(1), Nat(1)); // Bool(false)
        

        Parameters

        • left: IExpression<MichelsonType>

          An expression

        • right: IExpression<MichelsonType>

          An expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bool>

        An expression

  • GreaterThanOrEqual: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
      • Check if a value is greater than or equal another value.

        GreaterThanOrEqual(Nat(1), Nat(1)); // Bool(true)
        

        Parameters

        • left: IExpression<MichelsonType>

          An expression

        • right: IExpression<MichelsonType>

          An expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bool>

        An expression

  • LessThan: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
      • Check if a value is less than another value.

        LessThan(Nat(1), Nat(1)); // Bool(false)
        

        Parameters

        • left: IExpression<MichelsonType>

          An expression

        • right: IExpression<MichelsonType>

          An expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bool>

        An expression

  • LessThanOrEqual: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
      • Check if a value is less than or equal another value.

        LessThanOrEqual(Nat(1), Nat(1)); // Bool(true)
        

        Parameters

        • left: IExpression<MichelsonType>

          An expression

        • right: IExpression<MichelsonType>

          An expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bool>

        An expression

Crypto: { BLAKE2B: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>; CheckSignature: (key: IExpression<key>, signature: IExpression<signature>, bytes: IExpression<bytes>, line?: LineInfo) => Expression<bool>; HashKey: (key: IExpression<key>, line?: LineInfo) => IExpression<key_hash>; KECCAK: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>; SHA256: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>; SHA3: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>; SHA512: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes> } = ...

Type declaration

  • BLAKE2B: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>
      • (bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
      • Compute a Blake2B cryptographic hash

        BLAKE2B(Bytes("0x01"));
        

        Parameters

        • bytes: IExpression<bytes>

          An expression that evaluates to a bytes value.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bytes>

        An expression

  • CheckSignature: (key: IExpression<key>, signature: IExpression<signature>, bytes: IExpression<bytes>, line?: LineInfo) => Expression<bool>
      • (key: IExpression<key>, signature: IExpression<signature>, bytes: IExpression<bytes>, line?: LineInfo): Expression<bool>
      • Verifies that a given sequence of bytes has been signed with a given key.

        CheckSignature(Key("edpku3g7CeTEvSKhxipD4Q2B6EiEP8cR323u8PFmGFgKRVRvCneEmT"), Signature("sigsAujsNePapNNGsVotTvcKWMNNJja9B4a2FfAe8vExzFhEgEo1GTQStiif22uSA6iNxPGCGsXsRyeLHzeLbJL2y8CnYuNe"), Bytes("0x01"));
        

        Parameters

        • key: IExpression<key>

          The public key that signed the bytes.

        • signature: IExpression<signature>

          The bytes signature.

        • bytes: IExpression<bytes>

          The raw bytes that were signed.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bool>

        An expression of type TBool().

  • HashKey: (key: IExpression<key>, line?: LineInfo) => IExpression<key_hash>
      • (key: IExpression<key>, line?: LineInfo): IExpression<key_hash>
      • Hash public key.

        HashKey(Key("edpku3g7CeTEvSKhxipD4Q2B6EiEP8cR323u8PFmGFgKRVRvCneEmT"));
        

        Parameters

        • key: IExpression<key>

          An expression that evaluates to a public key value.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns IExpression<key_hash>

        An expression of type TContract(TUnit()).

  • KECCAK: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>
      • (bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
      • Compute a Keccak-256 cryptographic hash

        KECCAK(Bytes("0x01"));
        

        Parameters

        • bytes: IExpression<bytes>

          An expression that evaluates to a bytes value.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bytes>

        An expression

  • SHA256: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>
      • (bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
      • Compute a SHA-256 cryptographic hash

        SHA256(Bytes("0x01"));
        

        Parameters

        • bytes: IExpression<bytes>

          An expression that evaluates to a bytes value.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bytes>

        An expression

  • SHA3: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>
      • (bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
      • Compute a SHA3-256 cryptographic hash

        SHA3(Bytes("0x01"));
        

        Parameters

        • bytes: IExpression<bytes>

          An expression that evaluates to a bytes value.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bytes>

        An expression

  • SHA512: (bytes: IExpression<bytes>, line?: LineInfo) => Expression<bytes>
      • (bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
      • Compute a SHA-512 cryptographic hash

        SHA512(Bytes("0x01"));
        

        Parameters

        • bytes: IExpression<bytes>

          An expression that evaluates to a bytes value.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bytes>

        An expression

Equality: { Equal: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>; NotEqual: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool> } = ...

Type declaration

  • Equal: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
      • Checks if two expressions resolve to equal values

        Equal(Nat(1), Nat(1)); // Bool(true)
        

        Parameters

        • left: IExpression<MichelsonType>

          An expression

        • right: IExpression<MichelsonType>

          An expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bool>

        An expression

  • NotEqual: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<bool>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
      • Checks if two expressions resolve to a different values

        NotEqual(Nat(1), Nat(1)); // Bool(false)
        

        Parameters

        • left: IExpression<MichelsonType>

          An expression

        • right: IExpression<MichelsonType>

          An expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<bool>

        An expression

Literal: { Address: (address: string, line?: LineInfo) => LiteralExpression<address>; Big_map: (rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo) => MapLiteral<big_map>; Bls12_381_fr: (fr: string | number, line?: LineInfo) => LiteralExpression<bls12_381_fr>; Bls12_381_g1: (bytes: string, line?: LineInfo) => LiteralExpression<bls12_381_g1>; Bls12_381_g2: (bytes: string, line?: LineInfo) => LiteralExpression<bls12_381_g2>; Bool: (value: boolean, line?: LineInfo) => LiteralExpression<bool>; Bytes: (bytes: string, line?: LineInfo) => LiteralExpression<bytes>; Chain_id: (chainID: string, line?: LineInfo) => LiteralExpression<chain_id>; Int: (value: number, line?: LineInfo) => LiteralExpression<int>; Key: (key: string, line?: LineInfo) => LiteralExpression<key>; Key_hash: (key_hash: string, line?: LineInfo) => LiteralExpression<key_hash>; Lambda: (statements?: IToString[], inType?: IType<TypeAtom>, argumentName?: string, line?: LineInfo) => LambdaLiteral; Left: (value: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<or>; List: (items: IExpression<MichelsonType>[], line?: LineInfo) => LiteralExpression<list>; Map: (rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo) => MapLiteral<map>; Mutez: (value: number, line?: LineInfo) => LiteralExpression<mutez>; Nat: (value: number, line?: LineInfo) => LiteralExpression<nat>; None: (line?: LineInfo) => ILiteral<option>; Pair: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<pair>; Record: (fields: Record<string, IExpression<MichelsonType>>, line?: LineInfo) => RecordLiteral; Right: (value: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<or>; Sapling_state: (memo: number, line?: LineInfo) => LiteralExpression<sapling_state>; Set: (items: IExpression<MichelsonType>[], line?: LineInfo) => LiteralExpression<set>; Signature: (signature: string, line?: LineInfo) => LiteralExpression<signature>; Some: (value: IExpression<MichelsonType>, line?: LineInfo) => ILiteral<option>; String: (value: string, line?: LineInfo) => LiteralExpression<string>; Ticket: (content: IExpression<MichelsonType>, amount: LiteralExpression<nat>, line?: LineInfo) => LiteralExpression<ticket>; Timestamp: (timestamp: number, line?: LineInfo) => LiteralExpression<timestamp>; Unit: (line?: LineInfo) => LiteralExpression<unit>; Variant: (field: string, value: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<or> } = ...

Type declaration

  • Address: (address: string, line?: LineInfo) => LiteralExpression<address>
      • (address: string, line?: LineInfo): LiteralExpression<address>
      • Build a literal of type address.

        Address("KT1R9M3MDffw7qSVSnbJs46aMC9YzzZz3aGT");
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-address

        Parameters

        • address: string
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<address>

        An expression

  • Big_map: (rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo) => MapLiteral<big_map>
      • (rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo): MapLiteral<big_map>
      • Build a literal of type big_map.

        Big_map([
        [Nat(1), String('WORD1')],
        [Nat(2), String('WORD2')],
        ]);
        see

        https://tezos.gitlab.io/michelson-reference/#type-big_map

        Parameters

        • rows: IExpression<MichelsonType>[][] = []
        • keyType: IType<TypeAtom> = ...
        • valueType: IType<TypeAtom> = ...
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns MapLiteral<big_map>

        An expression

  • Bls12_381_fr: (fr: string | number, line?: LineInfo) => LiteralExpression<bls12_381_fr>
      • (fr: string | number, line?: LineInfo): LiteralExpression<bls12_381_fr>
  • Bls12_381_g1: (bytes: string, line?: LineInfo) => LiteralExpression<bls12_381_g1>
      • (bytes: string, line?: LineInfo): LiteralExpression<bls12_381_g1>
      • Build a literal of type bls12_381_g1.

        Bls12_381_g1("0x0572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28");
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-bls12_381_g1

        Parameters

        • bytes: string
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<bls12_381_g1>

        An expression

  • Bls12_381_g2: (bytes: string, line?: LineInfo) => LiteralExpression<bls12_381_g2>
      • (bytes: string, line?: LineInfo): LiteralExpression<bls12_381_g2>
      • Build a literal of type bls12_381_g2.

        Bls12_381_g2("0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb813fa4d4a0ad8b1ce186ed5061789213d993923066dddaf1040bc3ff59f825c78df74f2d75467e25e0f55f8a00fa030ed0d1b3cc2c7027888be51d9ef691d77bcb679afda66c73f17f9ee3837a55024f78c71363275a75d75d86bab79f74782aa");
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-bls12_381_g2

        Parameters

        • bytes: string
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<bls12_381_g2>

        An expression

  • Bool: (value: boolean, line?: LineInfo) => LiteralExpression<bool>
      • (value: boolean, line?: LineInfo): LiteralExpression<bool>
  • Bytes: (bytes: string, line?: LineInfo) => LiteralExpression<bytes>
      • (bytes: string, line?: LineInfo): LiteralExpression<bytes>
  • Chain_id: (chainID: string, line?: LineInfo) => LiteralExpression<chain_id>
      • (chainID: string, line?: LineInfo): LiteralExpression<chain_id>
      • Build a literal of type chain_id. (Represents a chain identifier)

        Chain_id("0x00");
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-chain_id

        Parameters

        • chainID: string
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<chain_id>

        An expression

  • Int: (value: number, line?: LineInfo) => LiteralExpression<int>
      • (value: number, line?: LineInfo): LiteralExpression<int>
  • Key: (key: string, line?: LineInfo) => LiteralExpression<key>
      • (key: string, line?: LineInfo): LiteralExpression<key>
      • Build a literal of type key.

        Key("edpku3g7CeTEvSKhxipD4Q2B6EiEP8cR323u8PFmGFgKRVRvCneEmT");
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-key

        Parameters

        • key: string
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<key>

        An expression

  • Key_hash: (key_hash: string, line?: LineInfo) => LiteralExpression<key_hash>
      • (key_hash: string, line?: LineInfo): LiteralExpression<key_hash>
      • Build a literal of type key_hash.

        Key_hash("tz28QJHLyqvaY2rXAoFZTbxrXeD88NA8wscC");
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-key_hash

        Parameters

        • key_hash: string
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<key_hash>

        An expression

  • Lambda: (statements?: IToString[], inType?: IType<TypeAtom>, argumentName?: string, line?: LineInfo) => LambdaLiteral
      • (statements?: IToString[], inType?: IType<TypeAtom>, argumentName?: string, line?: LineInfo): LambdaLiteral
      • Build a literal of type lambda.

        Lambda()
        .setInputType(TString())
        .code((arg) => [Return(arg)]);
        see

        https://tezos.gitlab.io/michelson-reference/#type-lambda

        Parameters

        • statements: IToString[] = []
        • inType: IType<TypeAtom> = ...
        • argumentName: string = 'lambda_arg'
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LambdaLiteral

        An expression

  • Left: (value: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<or>
      • (value: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<or>
      • Build a literal of type or. (Wrap a value in a union. It represents the left branch.)

        Left(Nat(1));
        
        see

        https://tezos.gitlab.io/michelson-reference/#instr-LEFT

        Parameters

        • value: IExpression<MichelsonType>
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<or>

        An expression

  • List: (items: IExpression<MichelsonType>[], line?: LineInfo) => LiteralExpression<list>
      • (items: IExpression<MichelsonType>[], line?: LineInfo): LiteralExpression<list>
      • Build a literal of type list.

        List([Nat(1)]);
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-list

        Parameters

        • items: IExpression<MichelsonType>[]
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<list>

        An expression

  • Map: (rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo) => MapLiteral<map>
      • (rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo): MapLiteral<map>
      • Build a literal of type map.

        Map([
        [Nat(1), String('WORD1')],
        [Nat(2), String('WORD2')],
        ]);
        see

        https://tezos.gitlab.io/michelson-reference/#type-map

        Parameters

        • rows: IExpression<MichelsonType>[][] = []
        • keyType: IType<TypeAtom> = ...
        • valueType: IType<TypeAtom> = ...
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns MapLiteral<map>

        An expression

  • Mutez: (value: number, line?: LineInfo) => LiteralExpression<mutez>
      • (value: number, line?: LineInfo): LiteralExpression<mutez>
  • Nat: (value: number, line?: LineInfo) => LiteralExpression<nat>
      • (value: number, line?: LineInfo): LiteralExpression<nat>
  • None: (line?: LineInfo) => ILiteral<option>
      • (line?: LineInfo): ILiteral<option>
  • Pair: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<pair>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<pair>
      • Build a literal of type pair. (A binary tuple of values)

        Pair(Nat(1), Bool(false));
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-pair

        Parameters

        • left: IExpression<MichelsonType>
        • right: IExpression<MichelsonType>
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<pair>

        An expression

  • Record: (fields: Record<string, IExpression<MichelsonType>>, line?: LineInfo) => RecordLiteral
      • (fields: Record<string, IExpression<MichelsonType>>, line?: LineInfo): RecordLiteral
      • An artificial literal of type pair. (Uses nested annotated pair's to simulate an object value)

        Record({
        field1: Nat(1),
        field2: Int(2),
        field3: Bytes('0x00'),
        });
        see

        https://tezos.gitlab.io/michelson-reference/#type-pair

        Parameters

        • fields: Record<string, IExpression<MichelsonType>>
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns RecordLiteral

        An expression

  • Right: (value: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<or>
      • (value: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<or>
      • Build a literal of type or. (Wrap a value in a union. It represents the right branch.)

        Right(Bool(false));
        
        see

        https://tezos.gitlab.io/michelson-reference/#instr-RIGHT

        Parameters

        • value: IExpression<MichelsonType>
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<or>

        An expression

  • Sapling_state: (memo: number, line?: LineInfo) => LiteralExpression<sapling_state>
      • (memo: number, line?: LineInfo): LiteralExpression<sapling_state>
  • Set: (items: IExpression<MichelsonType>[], line?: LineInfo) => LiteralExpression<set>
      • (items: IExpression<MichelsonType>[], line?: LineInfo): LiteralExpression<set>
      • Build a literal of type set.

        Set([Nat(1)]);
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-set

        Parameters

        • items: IExpression<MichelsonType>[]
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<set>

        An expression

  • Signature: (signature: string, line?: LineInfo) => LiteralExpression<signature>
      • (signature: string, line?: LineInfo): LiteralExpression<signature>
      • Build a literal of type signature.

        Signature("sigsAujsNePapNNGsVotTvcKWMNNJja9B4a2FfAe8vExzFhEgEo1GTQStiif22uSA6iNxPGCGsXsRyeLHzeLbJL2y8CnYuNe");
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-signature

        Parameters

        • signature: string
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<signature>

        An expression

  • Some: (value: IExpression<MichelsonType>, line?: LineInfo) => ILiteral<option>
      • (value: IExpression<MichelsonType>, line?: LineInfo): ILiteral<option>
      • Build a literal of type option. (Wraps an existing optional value)

        Some(Nat(1));
        
        see

        https://tezos.gitlab.io/michelson-reference/#instr-SOME

        Parameters

        • value: IExpression<MichelsonType>
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns ILiteral<option>

        An expression

  • String: (value: string, line?: LineInfo) => LiteralExpression<string>
      • (value: string, line?: LineInfo): LiteralExpression<string>
  • Ticket: (content: IExpression<MichelsonType>, amount: LiteralExpression<nat>, line?: LineInfo) => LiteralExpression<ticket>
      • (content: IExpression<MichelsonType>, amount: LiteralExpression<nat>, line?: LineInfo): LiteralExpression<ticket>
      • Build a literal of type ticket.

        Ticket(String('A Ticket'), Nat(1));
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-ticket

        Parameters

        • content: IExpression<MichelsonType>
        • amount: LiteralExpression<nat>
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<ticket>

        An expression

  • Timestamp: (timestamp: number, line?: LineInfo) => LiteralExpression<timestamp>
      • (timestamp: number, line?: LineInfo): LiteralExpression<timestamp>
      • Build a literal of type timestamp. (The input is the number of seconds since Epoch)

        Timestamp(1000);
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-timestamp

        Parameters

        • timestamp: number
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<timestamp>

        An expression

  • Unit: (line?: LineInfo) => LiteralExpression<unit>
  • Variant: (field: string, value: IExpression<MichelsonType>, line?: LineInfo) => LiteralExpression<or>
      • (field: string, value: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<or>
      • An artificial literal of type or. (Uses nested annotated or's)

        Variant('branch1', Int(1));
        
        see

        https://tezos.gitlab.io/michelson-reference/#type-or

        Parameters

        • field: string
        • value: IExpression<MichelsonType>
        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns LiteralExpression<or>

        An expression

Math: { Add: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<MichelsonType>; Divide: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<any>; EuclideanDivision: (left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo) => IExpression<option>; Median: (list: IExpression<list>, line?: LineInfo) => Proxied<Expression<MichelsonType>>; Mod: (left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo) => Expression<any>; Multiply: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<any>; ShiftLeft: (left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo) => Expression<nat>; ShiftRight: (left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo) => Expression<nat>; Subtract: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<any> } = ...

Type declaration

  • Add: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<MichelsonType>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
      • Add two numerical values

        Add(Nat(1), Nat(1)); // Nat(2)
        

        Parameters

        • left: IExpression<MichelsonType>

          Expression

        • right: IExpression<MichelsonType>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<MichelsonType>

        An expression

  • Divide: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<any>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<any>
      • Division operation.

        Divide(Nat(1), Nat(1)); // Nat(1)
        

        Parameters

        • left: IExpression<MichelsonType>

          Expression

        • right: IExpression<MichelsonType>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<any>

        An expression

  • EuclideanDivision: (left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo) => IExpression<option>
      • (left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo): IExpression<option>
      • Euclidean Division

        EuclideanDivision(Nat(13), Nat(3)); // Some(Pair(Nat(4), Nat(1)))
        

        Parameters

        • left: IExpression<nat | int | mutez>

          Expression

        • right: IExpression<nat | int | mutez>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns IExpression<option>

        An expression of type `TOption(TPair(@quotient_type, @remainder_type)))

  • Median: (list: IExpression<list>, line?: LineInfo) => Proxied<Expression<MichelsonType>>
      • (list: IExpression<list>, line?: LineInfo): Proxied<Expression<MichelsonType>>
      • Computes the median of a list of integers.

        Median(List([Nat(2), Nat(1), Nat(3)]); // Nat(2)
        

        Parameters

        • list: IExpression<list>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Proxied<Expression<MichelsonType>>

        An expression that evaluates to TNat() or TInt depending on the input type.

  • Mod: (left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo) => Expression<any>
      • (left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo): Expression<any>
      • Modulus

        Mod(Nat(13), Nat(3)); // Nat(1)
        

        Parameters

        • left: IExpression<nat | int | mutez>

          Expression

        • right: IExpression<nat | int | mutez>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<any>

        An expression.

  • Multiply: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<any>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<any>
      • Multiply two numerical values

        Multiply(Nat(1), Nat(1)); // Nat(1)
        

        Parameters

        • left: IExpression<MichelsonType>

          Expression

        • right: IExpression<MichelsonType>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<any>

        An expression

  • ShiftLeft: (left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo) => Expression<nat>
      • (left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo): Expression<nat>
      • Logical left shift

        ShiftLeft(Nat(2), Nat(1)); // Nat(1)
        

        Parameters

        • left: IExpression<nat>

          Expression

        • right: IExpression<nat>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<nat>

        An expression.

  • ShiftRight: (left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo) => Expression<nat>
      • (left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo): Expression<nat>
      • Logical right shift

        ShiftRight(Nat(2), Nat(1)); // Nat(1)
        

        Parameters

        • left: IExpression<nat>

          Expression

        • right: IExpression<nat>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<nat>

        An expression.

  • Subtract: (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo) => Expression<any>
      • (left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<any>
      • Subtract two numerical values

        Subtract(Nat(1), Nat(1)); // Nat(0)
        

        Parameters

        • left: IExpression<MichelsonType>

          Expression

        • right: IExpression<MichelsonType>

          Expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<any>

        An expression

Operation: { CreateContract: (contract: Contract, storage: IExpression<MichelsonType>, initial_balance?: IExpression<mutez>, delegate?: IExpression<option>, line?: LineInfo) => OriginationExpression; SetDelegate: (keyHash: IExpression<option>, line?: LineInfo) => OperationExpression; Transfer: (contract: IExpression<contract>, amount: IExpression<mutez>, argument?: IExpression<MichelsonType>, line?: LineInfo) => OperationExpression } = ...

Type declaration

  • CreateContract: (contract: Contract, storage: IExpression<MichelsonType>, initial_balance?: IExpression<mutez>, delegate?: IExpression<option>, line?: LineInfo) => OriginationExpression
      • (contract: Contract, storage: IExpression<MichelsonType>, initial_balance?: IExpression<mutez>, delegate?: IExpression<option>, line?: LineInfo): OriginationExpression
      • Build a origination operation.

         // Create a new contract (Simple)
        CreateContract(new Contract(), Unit()).send();
        // Create a new contract (Full)
        CreateContract(new Contract(), Nat(1), Mutez(100), Some(Key_hash("tz1gTnKMA65qaKVpp6x4cgMLU2UyKF2zjHYN"))).send();
        see

        https://tezos.gitlab.io/michelson-reference/#instr-CREATE_CONTRACT

        Parameters

        • contract: Contract

          Contract class

        • storage: IExpression<MichelsonType>

          Initial storage for the contract

        • initial_balance: IExpression<mutez> = ...

          Initial balance for the new contract

        • delegate: IExpression<option> = ...

          The address of the delegate implicit account

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns OriginationExpression

        An expression

  • SetDelegate: (keyHash: IExpression<option>, line?: LineInfo) => OperationExpression
      • (keyHash: IExpression<option>, line?: LineInfo): OperationExpression
      • Build a delegation operation.

         // Build and send a delegation operation
        SetDelegate(Some(Key_hash("tz1gTnKMA65qaKVpp6x4cgMLU2UyKF2zjHYN"))).send();
        // Clear Delegate
        SetDelegate(None()).send();
        see

        https://tezos.gitlab.io/michelson-reference/#instr-SET_DELEGATE

        Parameters

        • keyHash: IExpression<option>

          An optional implicit account to receive the delegation.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns OperationExpression

        An expression

  • Transfer: (contract: IExpression<contract>, amount: IExpression<mutez>, argument?: IExpression<MichelsonType>, line?: LineInfo) => OperationExpression
      • (contract: IExpression<contract>, amount: IExpression<mutez>, argument?: IExpression<MichelsonType>, line?: LineInfo): OperationExpression
      • Build a transaction operation.

         // Transfer 100 mutez to an implicit account
        Transfer(GetContract(Address('tz1gTnKMA65qaKVpp6x4cgMLU2UyKF2zjHYN')), Mutez(100)).send();
        // Call an originated contract
        Transfer(GetContract(Address('KT1R9M3MDffw7qSVSnbJs46aMC9YzzZz3aGT'), '<entrypoint>', TNat()), Mutez(100), Nat(1)).send();
        see

        https://tezos.gitlab.io/michelson-reference/#instr-TRANSFER_TOKENS

        Parameters

        • contract: IExpression<contract>

          Recipient contract

        • amount: IExpression<mutez>

          Transaction amount

        • argument: IExpression<MichelsonType> = ...

          Entrypoint argument

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns OperationExpression

        An expression

Serialization: { Pack: (expression: IExpression<MichelsonType>, line?: LineInfo) => Proxied<Expression<bytes>>; Unpack: (expression: IExpression<bytes>, type?: IType<TypeAtom>, line?: LineInfo) => Proxied<Expression<MichelsonType>> } = ...

Type declaration

  • Pack: (expression: IExpression<MichelsonType>, line?: LineInfo) => Proxied<Expression<bytes>>
      • (expression: IExpression<MichelsonType>, line?: LineInfo): Proxied<Expression<bytes>>
      • Serializes any value of packable type to its optimized binary representation, of type TBytes().

        Pack(Nat(1));
        

        Parameters

        • expression: IExpression<MichelsonType>

          An expression

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Proxied<Expression<bytes>>

        An expression of type TBytes().

  • Unpack: (expression: IExpression<bytes>, type?: IType<TypeAtom>, line?: LineInfo) => Proxied<Expression<MichelsonType>>
      • (expression: IExpression<bytes>, type?: IType<TypeAtom>, line?: LineInfo): Proxied<Expression<MichelsonType>>
      • Deserialize a value of type TBytes() into the corresponding Michelson value of type TOption(...).

        Unpack(Bytes("0x05070707070100000004746f746f020000000800030007000900010200000006000100020003"));
        

        Parameters

        • expression: IExpression<bytes>

          An expression that evaluates to type TBytes()

        • type: IType<TypeAtom> = ...

          The type of the deserialized value.

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Proxied<Expression<MichelsonType>>

        An expression of type TOption(<type>)

Unary: { Negate: (expression: IExpression<MichelsonType>, line?: LineInfo) => Expression<MichelsonType>; Not: (expression: IExpression<MichelsonType>, line?: LineInfo) => Expression<MichelsonType> } = ...

Type declaration

  • Negate: (expression: IExpression<MichelsonType>, line?: LineInfo) => Expression<MichelsonType>
      • (expression: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
      • Negate a numerical value.

        Negate(Int(1)); // Int(-1)
        
        see

        https://tezos.gitlab.io/michelson-reference/#instr-NEG

        Parameters

        • expression: IExpression<MichelsonType>

          An expression that evaluates to either TInt(), TNat(), TBls12_381_g2(), TBls12_381_g1() or TBls12_381_fr().

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<MichelsonType>

        An expression

  • Not: (expression: IExpression<MichelsonType>, line?: LineInfo) => Expression<MichelsonType>
      • (expression: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
      • Boolean negation and bitwise complement.

        Not(Bool(true)); // Bool(false)
        
        see

        https://tezos.gitlab.io/michelson-reference/#instr-NOT

        Parameters

        • expression: IExpression<MichelsonType>

          An expression that evaluates to either TBool(), TInt() or TNat().

        • line: LineInfo = ...

          Source code line information (Used in error messages)

        Returns Expression<MichelsonType>

        An expression

BLS12-381 Functions

  • PairingCheck(pairs: IExpression<list>, line?: LineInfo): Expression<bool>
  • Check a BLS12-381 pairing.

    PairingCheck(List([
    Pair(
    Bls12_381_g1("0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1"),
    Bls12_381_g2("0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801")
    ),
    Pair(
    Bls12_381_g1("0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1"),
    Bls12_381_g2("0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801")
    )
    ]));

    Parameters

    • pairs: IExpression<list>

      An expression that evaluates to a value of type TList(TPair(TBls12_381_g1(), TBls12_381_g2())).

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression of types TBool().

Comparison Functions

  • GreaterThan(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Check if a value is greater than another value.

    GreaterThan(Nat(1), Nat(1)); // Bool(false)
    

    Parameters

    • left: IExpression<MichelsonType>

      An expression

    • right: IExpression<MichelsonType>

      An expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression

  • GreaterThanOrEqual(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Check if a value is greater than or equal another value.

    GreaterThanOrEqual(Nat(1), Nat(1)); // Bool(true)
    

    Parameters

    • left: IExpression<MichelsonType>

      An expression

    • right: IExpression<MichelsonType>

      An expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression

  • LessThan(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Check if a value is less than another value.

    LessThan(Nat(1), Nat(1)); // Bool(false)
    

    Parameters

    • left: IExpression<MichelsonType>

      An expression

    • right: IExpression<MichelsonType>

      An expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression

  • LessThanOrEqual(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Check if a value is less than or equal another value.

    LessThanOrEqual(Nat(1), Nat(1)); // Bool(true)
    

    Parameters

    • left: IExpression<MichelsonType>

      An expression

    • right: IExpression<MichelsonType>

      An expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression

Contract Functions

  • GetContract(address: IExpression<address>, entrypoint?: string, argumentType?: IType<TypeAtom>, line?: LineInfo): IExpression<option>
  • Cast an address to a typed contract.

    GetContract(Address('KT1R9M3MDffw7qSVSnbJs46aMC9YzzZz3aGT'), 'some_entrypoint', TNat());
    

    Parameters

    • address: IExpression<address>

      An expression that resolves to an address value

    • entrypoint: string = ''

      Contract entrypoint

    • argumentType: IType<TypeAtom> = ...

      Entrypoint argument type

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<option>

    An expression of type TOption(TContract(@argumentType)).

  • HashKey(key: IExpression<key>, line?: LineInfo): IExpression<key_hash>
  • Hash public key.

    HashKey(Key("edpku3g7CeTEvSKhxipD4Q2B6EiEP8cR323u8PFmGFgKRVRvCneEmT"));
    

    Parameters

    • key: IExpression<key>

      An expression that evaluates to a public key value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<key_hash>

    An expression of type TContract(TUnit()).

  • ImplicitAccount(key_hash: IExpression<key_hash>, line?: LineInfo): IExpression<contract>
  • Create an implicit account.

    ImplicitAccount(Key_hash("tz1gTnKMA65qaKVpp6x4cgMLU2UyKF2zjHYN"));
    

    Parameters

    • key_hash: IExpression<key_hash>

      An expression that evaluates to a public key hash value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<contract>

    An expression of type TContract(TUnit()).

  • ToAddress(contract: IExpression<contract>, line?: LineInfo): IExpression<address>
  • Get the address of a contract value.

    ToAddress(GetSelf());
    

    Parameters

    • contract: IExpression<contract>

      An expression that evaluates to a contract value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<address>

    An expression of type TAddress().

  • ToContract(address: IExpression<address>, entrypoint?: string, argumentType?: IType<TypeAtom>, errorMsg?: IExpression<MichelsonType>, line?: LineInfo): IExpression<contract>
  • Cast an address to a typed contract.

    ToContract(Address('KT1R9M3MDffw7qSVSnbJs46aMC9YzzZz3aGT'), 'some_entrypoint', TNat());
    

    Parameters

    • address: IExpression<address>

      An expression that resolves to an address value

    • entrypoint: string = ''

      Contract entrypoint

    • argumentType: IType<TypeAtom> = ...

      Entrypoint argument type

    • errorMsg: IExpression<MichelsonType> = ...

      The value to be included in the error trace

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<contract>

    An expression of type TContract().

Crypto Functions

  • BLAKE2B(bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
  • Compute a Blake2B cryptographic hash

    BLAKE2B(Bytes("0x01"));
    

    Parameters

    • bytes: IExpression<bytes>

      An expression that evaluates to a bytes value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bytes>

    An expression

  • CheckSignature(key: IExpression<key>, signature: IExpression<signature>, bytes: IExpression<bytes>, line?: LineInfo): Expression<bool>
  • Verifies that a given sequence of bytes has been signed with a given key.

    CheckSignature(Key("edpku3g7CeTEvSKhxipD4Q2B6EiEP8cR323u8PFmGFgKRVRvCneEmT"), Signature("sigsAujsNePapNNGsVotTvcKWMNNJja9B4a2FfAe8vExzFhEgEo1GTQStiif22uSA6iNxPGCGsXsRyeLHzeLbJL2y8CnYuNe"), Bytes("0x01"));
    

    Parameters

    • key: IExpression<key>

      The public key that signed the bytes.

    • signature: IExpression<signature>

      The bytes signature.

    • bytes: IExpression<bytes>

      The raw bytes that were signed.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression of type TBool().

  • KECCAK(bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
  • Compute a Keccak-256 cryptographic hash

    KECCAK(Bytes("0x01"));
    

    Parameters

    • bytes: IExpression<bytes>

      An expression that evaluates to a bytes value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bytes>

    An expression

  • SHA256(bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
  • Compute a SHA-256 cryptographic hash

    SHA256(Bytes("0x01"));
    

    Parameters

    • bytes: IExpression<bytes>

      An expression that evaluates to a bytes value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bytes>

    An expression

  • SHA3(bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
  • Compute a SHA3-256 cryptographic hash

    SHA3(Bytes("0x01"));
    

    Parameters

    • bytes: IExpression<bytes>

      An expression that evaluates to a bytes value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bytes>

    An expression

  • SHA512(bytes: IExpression<bytes>, line?: LineInfo): Expression<bytes>
  • Compute a SHA-512 cryptographic hash

    SHA512(Bytes("0x01"));
    

    Parameters

    • bytes: IExpression<bytes>

      An expression that evaluates to a bytes value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bytes>

    An expression

Equality Functions

  • Equal(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Checks if two expressions resolve to equal values

    Equal(Nat(1), Nat(1)); // Bool(true)
    

    Parameters

    • left: IExpression<MichelsonType>

      An expression

    • right: IExpression<MichelsonType>

      An expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression

  • NotEqual(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Checks if two expressions resolve to a different values

    NotEqual(Nat(1), Nat(1)); // Bool(false)
    

    Parameters

    • left: IExpression<MichelsonType>

      An expression

    • right: IExpression<MichelsonType>

      An expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression

Integer Functions

  • ABS(expression: IExpression<int>, line?: LineInfo): Expression<nat>
  • Obtain the absolute value of an TInt() value.

    ABS(Int(-1)); // Nat(1)
    

    Parameters

    • expression: IExpression<int>

      An expression that evaluates to a value of type TInt().

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<nat>

    An expression that evaluates to TNat().

  • CastToInt(expression: IExpression<nat>, line?: LineInfo): Expression<int>
  • Convert a value of type TNat() to TInt()

    CastToInt(Nat(1)); // Int(1)
    

    Parameters

    • expression: IExpression<nat>

      An expression that evaluates to a value of type TInt().

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<int>

    An expression that evaluates to TNat().

  • CastToNat(expression: IExpression<MichelsonType>, errorMsg?: IExpression<MichelsonType>, line?: LineInfo): IExpression<nat>
  • Convert a value of type TInt() to TNat().

    CastToNat(Subtract(Nat(2), Nat(1))); // Nat(1)
    

    Parameters

    • expression: IExpression<MichelsonType>

      A non-negative integer expression.

    • errorMsg: IExpression<MichelsonType> = ...

      An optional value to be included in the error trace if the integer is negative.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<nat>

    An expression that evaluates to TNat().

  • IsNat(expression: IExpression<MichelsonType>, line?: LineInfo): Expression<option>
  • Convert a value of type TInt() to TOption(TNat()).

    IsNat(Subtract(Nat(2), Nat(1))); // Some(Nat(1))
    

    Parameters

    • expression: IExpression<MichelsonType>

      A non-negative integer expression.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<option>

    An expression that evaluates to TOption(TNat()).

Logic Functions

  • And<T>(left: IExpression<T>, right: IExpression<T>, line?: LineInfo): Expression<nat | bool>
  • Boolean AND. (The result is true only if both expressions are true)

    And(Bool(true), Bool(false)); // Bool(false)
    

    Type parameters

    • T: nat | int | bool

    Parameters

    • left: IExpression<T>

      Boolean expression

    • right: IExpression<T>

      Boolean expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<nat | bool>

    An expression

  • Or<T>(left: IExpression<T>, right: IExpression<T>, line?: LineInfo): Expression<T>
  • Boolean OR. (The result is true if at least one of the expressions is true)

    Or(Bool(true), Bool(false)); // Bool(true)
    

    Type parameters

    • T: nat | bool

    Parameters

    • left: IExpression<T>

      Boolean expression

    • right: IExpression<T>

      Boolean expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<T>

    An expression

  • Xor<T>(left: IExpression<T>, right: IExpression<T>, line?: LineInfo): Expression<T>
  • Boolean XOR.

    Xor(Bool(true), Bool(false)); // Bool(true)
    

    Type parameters

    • T: nat | bool

    Parameters

    • left: IExpression<T>

      Boolean expression

    • right: IExpression<T>

      Boolean expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<T>

    An expression

Michelson Functions

  • CallMichelson(inlinedMicheline: IExpression<MichelsonType>, line?: LineInfo, ...args: IExpression<MichelsonType>[]): Expression<MichelsonType>
  • Call inlined michelson.

    Parameters

    • inlinedMicheline: IExpression<MichelsonType>

      Inlined michelson

    • line: LineInfo = ...
    • Rest ...args: IExpression<MichelsonType>[]

      Arguments

    Returns Expression<MichelsonType>

    An expression

  • InlinedMichelson(micheline: string, inputTypes: IType<TypeAtom>[], outTypes: IType<TypeAtom>[]): IExpression<MichelsonType>
  • Inline michelson code.

    InlinedMichelson(
    `
    DUP;
    SIZE;
    DIG 2;
    SWAP;
    PUSH nat 0;
    SLICE;
    IF_NONE
    {
    DROP;
    PUSH bool False;
    }
    {
    COMPARE;
    EQ;
    };
    `,
    [TString(), TString()],
    [TBool()]
    )

    Parameters

    • micheline: string

      Micheline code

    • inputTypes: IType<TypeAtom>[]
    • outTypes: IType<TypeAtom>[]

    Returns IExpression<MichelsonType>

    An expression

Sapling Functions

  • ApplySaplingUpdate(state: IExpression<sapling_state>, transition: IExpression<sapling_transaction>, line?: LineInfo): IExpression<option>
  • Verify and apply a transaction on a Sapling state.

    ApplySaplingUpdate(ContractStorage().state, transition);
    

    Parameters

    • state: IExpression<sapling_state>

      A sapling state

    • transition: IExpression<sapling_transaction>

      A sapling transition

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<option>

    An expression of type TOption(TPair(TInt(), TSaplingState(@memo_size)))

  • EmptySaplingState(memo: number, line?: LineInfo): Expression<MichelsonType>
  • Creates an empty Sapling state.

    EmptySaplingState(8);
    

    Parameters

    • memo: number

      size

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression of type TSapling_state()

Serialization Functions

  • Pack(expression: IExpression<MichelsonType>, line?: LineInfo): Proxied<Expression<bytes>>
  • Serializes any value of packable type to its optimized binary representation, of type TBytes().

    Pack(Nat(1));
    

    Parameters

    • expression: IExpression<MichelsonType>

      An expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<bytes>>

    An expression of type TBytes().

  • Unpack(expression: IExpression<bytes>, type?: IType<TypeAtom>, line?: LineInfo): Proxied<Expression<MichelsonType>>
  • Deserialize a value of type TBytes() into the corresponding Michelson value of type TOption(...).

    Unpack(Bytes("0x05070707070100000004746f746f020000000800030007000900010200000006000100020003"));
    

    Parameters

    • expression: IExpression<bytes>

      An expression that evaluates to type TBytes()

    • type: IType<TypeAtom> = ...

      The type of the deserialized value.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<MichelsonType>>

    An expression of type TOption(<type>)

| Block metadata Functions

  • GetChain_id(): Expression<chain_id>
  • GetLevel(): Expression<nat>
  • GetTimestamp(): IExpression<MichelsonType>
  • GetTotalVotingPower(): Expression<nat>
  • GetVotingPower(key_hash: ILiteral<key_hash>, line?: LineInfo): Expression<nat>

| Concatenation Functions

  • Concat(list: IExpression<list>, line?: LineInfo): Expression<MichelsonType>
  • Concatenate a list with values of type TString() or TBytes().

    Concat([ String("Hello"), String(" "), String("World") ]);
    

    Parameters

    • list: IExpression<list>
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression.

| Container Literals Functions

  • Big_map(rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo): MapLiteral<big_map>
  • Build a literal of type big_map.

    Big_map([
    [Nat(1), String('WORD1')],
    [Nat(2), String('WORD2')],
    ]);
    see

    https://tezos.gitlab.io/michelson-reference/#type-big_map

    Parameters

    • rows: IExpression<MichelsonType>[][] = []
    • keyType: IType<TypeAtom> = ...
    • valueType: IType<TypeAtom> = ...
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns MapLiteral<big_map>

    An expression

  • Lambda(statements?: IToString[], inType?: IType<TypeAtom>, argumentName?: string, line?: LineInfo): LambdaLiteral
  • Left(value: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<or>
  • List(items: IExpression<MichelsonType>[], line?: LineInfo): LiteralExpression<list>
  • Map(rows?: IExpression<MichelsonType>[][], keyType?: IType<TypeAtom>, valueType?: IType<TypeAtom>, line?: LineInfo): MapLiteral<map>
  • Build a literal of type map.

    Map([
    [Nat(1), String('WORD1')],
    [Nat(2), String('WORD2')],
    ]);
    see

    https://tezos.gitlab.io/michelson-reference/#type-map

    Parameters

    • rows: IExpression<MichelsonType>[][] = []
    • keyType: IType<TypeAtom> = ...
    • valueType: IType<TypeAtom> = ...
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns MapLiteral<map>

    An expression

  • None(line?: LineInfo): ILiteral<option>
  • Pair(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<pair>
  • Record(fields: Record<string, IExpression<MichelsonType>>, line?: LineInfo): RecordLiteral
  • An artificial literal of type pair. (Uses nested annotated pair's to simulate an object value)

    Record({
    field1: Nat(1),
    field2: Int(2),
    field3: Bytes('0x00'),
    });
    see

    https://tezos.gitlab.io/michelson-reference/#type-pair

    Parameters

    • fields: Record<string, IExpression<MichelsonType>>
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns RecordLiteral

    An expression

  • Right(value: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<or>
  • Sapling_state(memo: number, line?: LineInfo): LiteralExpression<sapling_state>
  • Set(items: IExpression<MichelsonType>[], line?: LineInfo): LiteralExpression<set>
  • Some(value: IExpression<MichelsonType>, line?: LineInfo): ILiteral<option>
  • Ticket(content: IExpression<MichelsonType>, amount: LiteralExpression<nat>, line?: LineInfo): LiteralExpression<ticket>
  • Variant(field: string, value: IExpression<MichelsonType>, line?: LineInfo): LiteralExpression<or>

| Lambda Functions

  • CallLambda(expression: IExpression<lambda>, argument?: IExpression<MichelsonType>, line?: LineInfo): Proxied<Expression<MichelsonType>>
  • Call lambda.

    // Calling a lambda variable with a boolean as argument
    CallLambda(GetVariable("some_lambda"), Bool(true));

    Parameters

    • expression: IExpression<lambda>

      Lambda expression

    • argument: IExpression<MichelsonType> = ...

      Lambda argument

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<MichelsonType>>

    An expression.

| List expressions Functions

  • PrependToList(list: IExpression<list>, value: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
  • Prepend a value to a list. (Creates a new list)

    PrependToList(List([Nat(1)]), Nat(2));
    

    Parameters

    • list: IExpression<list>
    • value: IExpression<MichelsonType>

      The value to be appended to the list

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression

| Map expressions Functions

  • AccessMapByKey(source: IExpression<MichelsonType>, key: IExpression<MichelsonType>, default_value?: IExpression<MichelsonType>, error_message?: IExpression<MichelsonType>, line?: LineInfo): Proxied<Expression<MichelsonType>>
  • Accesss by key the value stored in a map or big map.

    AccessMapByKey(ContractStorage().metadata, String("key"))
    

    Parameters

    • source: IExpression<MichelsonType>

      Map expression

    • key: IExpression<MichelsonType>

      Map key.

    • Optional default_value: IExpression<MichelsonType>

      An optional default value when the key does not exist.

    • Optional error_message: IExpression<MichelsonType>

      An optional value to be included in the error trace.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<MichelsonType>>

    An expression

  • GetMapEntries(source: IExpression<map>, line?: LineInfo): Expression<list>
  • Get map entries.

    GetMapEntries(
    Map(
    [
    [String("some_key_a"), Nat(1)],
    [String("some_key_b"), Nat(2)]
    ]
    )
    );

    Parameters

    • source: IExpression<map>

      Map expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<list>

    An expression of type TList(TRecord({ key: ..., value: ... })).

  • GetMapKeys(source: IExpression<map>, line?: LineInfo): Expression<list>
  • Get map keys.

    GetMapKeys(
    Map(
    [
    [String("some_key_a"), Nat(1)],
    [String("some_key_b"), Nat(2)]
    ]
    )
    );

    Parameters

    • source: IExpression<map>

      Map expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<list>

    An expression of type TList().

  • GetMapValues(source: IExpression<map>, line?: LineInfo): Expression<list>
  • Get map values.

    GetMapValues(
    Map(
    [
    [String("some_key_a"), Nat(1)],
    [String("some_key_b"), Nat(2)]
    ]
    )
    );

    Parameters

    • source: IExpression<map>

      Map expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<list>

    An expression of type TList().

  • MapContainsKey(expression: IExpression<MichelsonType>, key: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Checks if a given key exists in map or big_map.

    MapContainsKey(ContractStorage().metadata, String("sone_key"))
    

    Parameters

    • expression: IExpression<MichelsonType>

      Map expression

    • key: IExpression<MichelsonType>

      Map key.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression that resolves to a boolean value.

  • UpdateMap(source: IExpression<MichelsonType>, key: IExpression<MichelsonType>, value: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
  • Update an entry on map or big map.

    // Update/Insert entry
    UpdateMap(ContractStorage().metadata, String("some_key"), Some(Nat(10)));
    // Remove entry
    UpdateMap(ContractStorage().metadata, String("some_key"), None());

    Parameters

    • source: IExpression<MichelsonType>

      A map expression.

    • key: IExpression<MichelsonType>

      The map key.

    • value: IExpression<MichelsonType>

      An optional value to be indexed by the given key. (The entry is removed if None() is provided as value)

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression

| Math Functions

  • Add(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
  • Add two numerical values

    Add(Nat(1), Nat(1)); // Nat(2)
    

    Parameters

    • left: IExpression<MichelsonType>

      Expression

    • right: IExpression<MichelsonType>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression

  • Divide(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<any>
  • Division operation.

    Divide(Nat(1), Nat(1)); // Nat(1)
    

    Parameters

    • left: IExpression<MichelsonType>

      Expression

    • right: IExpression<MichelsonType>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<any>

    An expression

  • EuclideanDivision(left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo): IExpression<option>
  • Euclidean Division

    EuclideanDivision(Nat(13), Nat(3)); // Some(Pair(Nat(4), Nat(1)))
    

    Parameters

    • left: IExpression<nat | int | mutez>

      Expression

    • right: IExpression<nat | int | mutez>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<option>

    An expression of type `TOption(TPair(@quotient_type, @remainder_type)))

  • Median(list: IExpression<list>, line?: LineInfo): Proxied<Expression<MichelsonType>>
  • Computes the median of a list of integers.

    Median(List([Nat(2), Nat(1), Nat(3)]); // Nat(2)
    

    Parameters

    • list: IExpression<list>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<MichelsonType>>

    An expression that evaluates to TNat() or TInt depending on the input type.

  • Mod(left: IExpression<nat | int | mutez>, right: IExpression<nat | int | mutez>, line?: LineInfo): Expression<any>
  • Modulus

    Mod(Nat(13), Nat(3)); // Nat(1)
    

    Parameters

    • left: IExpression<nat | int | mutez>

      Expression

    • right: IExpression<nat | int | mutez>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<any>

    An expression.

  • Multiply(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<any>
  • Multiply two numerical values

    Multiply(Nat(1), Nat(1)); // Nat(1)
    

    Parameters

    • left: IExpression<MichelsonType>

      Expression

    • right: IExpression<MichelsonType>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<any>

    An expression

  • ShiftLeft(left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo): Expression<nat>
  • Logical left shift

    ShiftLeft(Nat(2), Nat(1)); // Nat(1)
    

    Parameters

    • left: IExpression<nat>

      Expression

    • right: IExpression<nat>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<nat>

    An expression.

  • ShiftRight(left: IExpression<nat>, right: IExpression<nat>, line?: LineInfo): Expression<nat>
  • Logical right shift

    ShiftRight(Nat(2), Nat(1)); // Nat(1)
    

    Parameters

    • left: IExpression<nat>

      Expression

    • right: IExpression<nat>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<nat>

    An expression.

  • Subtract(left: IExpression<MichelsonType>, right: IExpression<MichelsonType>, line?: LineInfo): Expression<any>
  • Subtract two numerical values

    Subtract(Nat(1), Nat(1)); // Nat(0)
    

    Parameters

    • left: IExpression<MichelsonType>

      Expression

    • right: IExpression<MichelsonType>

      Expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<any>

    An expression

| Operations Functions

  • CreateContract(contract: Contract, storage: IExpression<MichelsonType>, initial_balance?: IExpression<mutez>, delegate?: IExpression<option>, line?: LineInfo): OriginationExpression
  • Build a origination operation.

     // Create a new contract (Simple)
    CreateContract(new Contract(), Unit()).send();
    // Create a new contract (Full)
    CreateContract(new Contract(), Nat(1), Mutez(100), Some(Key_hash("tz1gTnKMA65qaKVpp6x4cgMLU2UyKF2zjHYN"))).send();
    see

    https://tezos.gitlab.io/michelson-reference/#instr-CREATE_CONTRACT

    Parameters

    • contract: Contract

      Contract class

    • storage: IExpression<MichelsonType>

      Initial storage for the contract

    • initial_balance: IExpression<mutez> = ...

      Initial balance for the new contract

    • delegate: IExpression<option> = ...

      The address of the delegate implicit account

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns OriginationExpression

    An expression

  • SetDelegate(keyHash: IExpression<option>, line?: LineInfo): OperationExpression
  • Build a delegation operation.

     // Build and send a delegation operation
    SetDelegate(Some(Key_hash("tz1gTnKMA65qaKVpp6x4cgMLU2UyKF2zjHYN"))).send();
    // Clear Delegate
    SetDelegate(None()).send();
    see

    https://tezos.gitlab.io/michelson-reference/#instr-SET_DELEGATE

    Parameters

    • keyHash: IExpression<option>

      An optional implicit account to receive the delegation.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns OperationExpression

    An expression

  • Transfer(contract: IExpression<contract>, amount: IExpression<mutez>, argument?: IExpression<MichelsonType>, line?: LineInfo): OperationExpression
  • Build a transaction operation.

     // Transfer 100 mutez to an implicit account
    Transfer(GetContract(Address('tz1gTnKMA65qaKVpp6x4cgMLU2UyKF2zjHYN')), Mutez(100)).send();
    // Call an originated contract
    Transfer(GetContract(Address('KT1R9M3MDffw7qSVSnbJs46aMC9YzzZz3aGT'), '<entrypoint>', TNat()), Mutez(100), Nat(1)).send();
    see

    https://tezos.gitlab.io/michelson-reference/#instr-TRANSFER_TOKENS

    Parameters

    • contract: IExpression<contract>

      Recipient contract

    • amount: IExpression<mutez>

      Transaction amount

    • argument: IExpression<MichelsonType> = ...

      Entrypoint argument

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns OperationExpression

    An expression

| Pair expressions Functions

  • FirstElement(expression: IExpression<MichelsonType>, line?: LineInfo): Proxied<Expression<MichelsonType>>
  • Access the left part of a pair

    FirstElement(Pair(Nat(1), String("A String"))); // Nat(1)
    

    Parameters

    • expression: IExpression<MichelsonType>

      An expression that resolves to a value of type TPair(...);

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<MichelsonType>>

    An expression.

  • SecondElement(expression: IExpression<MichelsonType>, line?: LineInfo): Proxied<Expression<MichelsonType>>
  • Access the right part of a pair

    SecondElement(Pair(Nat(1), String("A String"))); // String("A String")
    

    Parameters

    • expression: IExpression<MichelsonType>

      An expression that resolves to a value of type TPair(...);

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<MichelsonType>>

    An expression.

| Set expressions Functions

  • GetElementsFromSet(set: IExpression<list>, line?: LineInfo): Expression<MichelsonType>
  • Get the sorted list of elements in a set.

    GetElementsFromSet(Set([Nat(1)]));
    

    Parameters

    • set: IExpression<list>

      An expression of type set.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression of type list.

  • SetContainsElement(set: IExpression<MichelsonType>, element: IExpression<MichelsonType>, line?: LineInfo): Expression<bool>
  • Checks if a given element exists in a Set.

    SetContainsElement(Set([Nat(2)]), Nat(2))
    

    Parameters

    • set: IExpression<MichelsonType>
    • element: IExpression<MichelsonType>
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<bool>

    An expression that resolves to a boolean value.

| Singleton Literals Functions

  • Address(address: string, line?: LineInfo): LiteralExpression<address>
  • Bls12_381_fr(fr: string | number, line?: LineInfo): LiteralExpression<bls12_381_fr>
  • Bls12_381_g1(bytes: string, line?: LineInfo): LiteralExpression<bls12_381_g1>
  • Build a literal of type bls12_381_g1.

    Bls12_381_g1("0x0572cbea904d67468808c8eb50a9450c9721db309128012543902d0ac358a62ae28f75bb8f1c7c42c39a8c5529bf0f4e166a9d8cabc673a322fda673779d8e3822ba3ecb8670e461f73bb9021d5fd76a4c56d9d4cd16bd1bba86881979749d28");
    
    see

    https://tezos.gitlab.io/michelson-reference/#type-bls12_381_g1

    Parameters

    • bytes: string
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns LiteralExpression<bls12_381_g1>

    An expression

  • Bls12_381_g2(bytes: string, line?: LineInfo): LiteralExpression<bls12_381_g2>
  • Build a literal of type bls12_381_g2.

    Bls12_381_g2("0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb813fa4d4a0ad8b1ce186ed5061789213d993923066dddaf1040bc3ff59f825c78df74f2d75467e25e0f55f8a00fa030ed0d1b3cc2c7027888be51d9ef691d77bcb679afda66c73f17f9ee3837a55024f78c71363275a75d75d86bab79f74782aa");
    
    see

    https://tezos.gitlab.io/michelson-reference/#type-bls12_381_g2

    Parameters

    • bytes: string
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns LiteralExpression<bls12_381_g2>

    An expression

  • Bool(value: boolean, line?: LineInfo): LiteralExpression<bool>
  • Bytes(bytes: string, line?: LineInfo): LiteralExpression<bytes>
  • Chain_id(chainID: string, line?: LineInfo): LiteralExpression<chain_id>
  • Int(value: number, line?: LineInfo): LiteralExpression<int>
  • Key(key: string, line?: LineInfo): LiteralExpression<key>
  • Key_hash(key_hash: string, line?: LineInfo): LiteralExpression<key_hash>
  • Mutez(value: number, line?: LineInfo): LiteralExpression<mutez>
  • Nat(value: number, line?: LineInfo): LiteralExpression<nat>
  • Signature(signature: string, line?: LineInfo): LiteralExpression<signature>
  • String(value: string, line?: LineInfo): LiteralExpression<string>
  • Timestamp(timestamp: number, line?: LineInfo): LiteralExpression<timestamp>
  • Unit(line?: LineInfo): LiteralExpression<unit>

| Size Functions

  • SizeOf(value: IExpression<string | bytes | list | set | map>, line?: LineInfo): Proxied<Expression<nat>>
  • Obtain size of values with type TString(), TBytes(), TList(...), TSet(...) and TMap().

    SizeOf(String("Hello")); // Nat(5)
    

    Parameters

    • value: IExpression<string | bytes | list | set | map>
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<nat>>

    An expression.

| Slicing Functions

  • Slice(bytes: IExpression<string | bytes>, offset: IExpression<nat>, length: IExpression<nat>, line?: LineInfo): Expression<option>
  • Slice a value of type TBytes() from offset for length characters.

    Slice(Bytes("0x0a1111"), Nat(1), Nat(2)); // 0x1111
    

    Parameters

    • bytes: IExpression<string | bytes>
    • offset: IExpression<nat>
    • length: IExpression<nat>
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<option>

    An expression of type TOption(TBytes()).

| Ticket Functions

  • CreateTicket(content: IExpression<any>, amount: IExpression<nat>, line?: LineInfo): Expression<MichelsonType>
  • Creates a ticket with some content and an amount. For a ticket with content of type t, the return type will be TTicket(t).

    CreateTicket(String("TEST"), Nat(10));
    

    Parameters

    • content: IExpression<any>

      The content to be wrapped in the ticket.

    • amount: IExpression<nat>

      The ticket amount.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    A value of type ticket.

  • JoinTicket(ticket1: IExpression<ticket>, ticket2: IExpression<ticket>, line?: LineInfo): Expression<MichelsonType>
  • Join two tickets into one.

    JoinTicket(some_ticket, some_other_ticket);
    

    Parameters

    • ticket1: IExpression<ticket>
    • ticket2: IExpression<ticket>
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    A value of type TTicket(t).

  • ReadTicket(ticket: IExpression<ticket>, line?: LineInfo): Expression<MichelsonType>
  • Retrieve the information stored in a ticket. Also return the ticket.

    ReadTicket(some_ticket);
    

    Parameters

    • ticket: IExpression<ticket>

      The ticket to be read.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    A value of type TPair(TPair(TAddress(), t, TNat()), TTicket(t)).

  • SplitTicket(ticket: IExpression<ticket>, qty1: IExpression<nat>, qty2: IExpression<nat>, line?: LineInfo): Expression<MichelsonType>
  • Splits a ticket in two.

    SplitTicket(some_ticket, Nat(1), Nat(1));
    

    Parameters

    • ticket: IExpression<ticket>

      The ticket to be split.

    • qty1: IExpression<nat>

      The quantity that the first new ticket will have.

    • qty2: IExpression<nat>

      The quantity that the second new ticket will have.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    A value of type TOption(TPair(TTicket(t), TTicket(t))).

| Timestamp Functions

  • AddHours(timestamp: IExpression<timestamp>, hours: IExpression<int>, line?: LineInfo): Expression<MichelsonType>
  • Add minutes to a timestamp.

    AddHours(Timestamp(), 10);
    

    Parameters

    • timestamp: IExpression<timestamp>
    • hours: IExpression<int>

      The minutes to be added.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    A value of type TTimestamp.

  • AddMinutes(timestamp: IExpression<timestamp>, minutes: IExpression<int>, line?: LineInfo): Expression<MichelsonType>
  • Add minutes to a timestamp.

    AddMinutes(Timestamp(), 10);
    

    Parameters

    • timestamp: IExpression<timestamp>
    • minutes: IExpression<int>

      The minutes to be added.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    A value of type TTimestamp.

  • AddSeconds(timestamp: IExpression<timestamp>, seconds: IExpression<int>, line?: LineInfo): Expression<MichelsonType>
  • Add seconds to a timestamp.

    AddSeconds(Timestamp(), Int(10));
    

    Parameters

    • timestamp: IExpression<timestamp>
    • seconds: IExpression<int>

      The seconds to be added.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    A value of type TTimestamp.

| Transaction metadata Functions

  • GetAmount(): Expression<mutez>
  • GetBalance(): Expression<mutez>
  • GetSelf(entry_point: string, line?: LineInfo): Expression<contract>
  • GetSelfAddress(): Expression<address>
  • GetSender(): Expression<address>
  • GetSource(): Expression<address>

| Type Handling Functions

  • AsType(expression: IExpression<MichelsonType>, type: IType<TypeAtom>, line?: LineInfo): IExpression<any>
  • Annotate an expression with type.

    AsType(GetVariable("some_variable"), TNat());
    

    Parameters

    • expression: IExpression<MichelsonType>
    • type: IType<TypeAtom>
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<any>

    An expression

| Unary Functions

  • Negate(expression: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
  • Negate a numerical value.

    Negate(Int(1)); // Int(-1)
    
    see

    https://tezos.gitlab.io/michelson-reference/#instr-NEG

    Parameters

    • expression: IExpression<MichelsonType>

      An expression that evaluates to either TInt(), TNat(), TBls12_381_g2(), TBls12_381_g1() or TBls12_381_fr().

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression

  • Not(expression: IExpression<MichelsonType>, line?: LineInfo): Expression<MichelsonType>
  • Boolean negation and bitwise complement.

    Not(Bool(true)); // Bool(false)
    
    see

    https://tezos.gitlab.io/michelson-reference/#instr-NOT

    Parameters

    • expression: IExpression<MichelsonType>

      An expression that evaluates to either TBool(), TInt() or TNat().

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<MichelsonType>

    An expression

| Variable Accessors Functions

  • ContractStorage(): Proxied<Expression<any>>
  • GetOperations(line?: LineInfo): Expression<list>
  • Get operations list from the stack or an empty list otherwise.

     // Get operations list from the stack or an empty list otherwise.
    GetOperations();

    Parameters

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Expression<list>

    An expression

  • GetProperty(recordExpression: IExpression<MichelsonType>, property: string, line?: LineInfo): Proxied<Expression<any>>
  • Access a property of a record value.

    GetProperty(ContractStorage(), "prop1")
    

    Parameters

    • recordExpression: IExpression<MichelsonType>

      An expression that resolves to a record value

    • property: string

      Property name

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<any>>

    An expression

  • GetVariable(name: string, line?: LineInfo): Proxied<Expression<any>>
  • Get variable value.

    GetVariable("some_variable")
    

    Parameters

    • name: string

      Variable name

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<any>>

    An expression

  • Iterator(name: string, line?: LineInfo): Proxied<Expression<any>>
  • Get iterator value. (Only used inside for loops)

    Iterator("some_iterator")
    

    Parameters

    • name: string

      iterator name

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<any>>

    An expression

  • LambdaArgument(name?: string, argumentType?: IType<TypeAtom>, id?: number, line?: LineInfo): Proxied<Expression<any>>
  • Get lambda argument.

    LambdaArgument()
    

    Parameters

    • name: string = 'lambda_arg'

      The name of the argument

    • argumentType: IType<TypeAtom> = ...
    • id: number = LambdaLiteral.idCounter
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<any>>

    An expression

  • MethodArgument(line?: LineInfo): Proxied<Expression<any>>
  • Get entrypoint/view argument.

    MethodArgument()
    

    Parameters

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<any>>

    An expression

  • VariantCaseArgument(name: string, line?: LineInfo): Proxied<Expression<any>>
  • Get the argument of a variant match case.

    VariantCaseArgument("action_1")
    

    Parameters

    • name: string

      The name of the argument

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<Expression<any>>

    An expression

| Variant Functions

  • GetSome(variant: IExpression<option>, errorMsg?: IExpression<MichelsonType>, line?: LineInfo): IExpression<any>
  • Unwrap a option value

    GetSome(Some(Nat(1)), String("COULD NOT UNWRAP OPTION"))
    

    Parameters

    • variant: IExpression<option>

      Variant expression

    • Optional errorMsg: IExpression<MichelsonType>

      The value to be included in the error trace.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<any>

    An expression

  • IsVariant(variant: IExpression<option | or>, branch: string, line?: LineInfo): IExpression<bool>
  • Check if a variant literal matches a given branch.

    IsVariant(Left(Nat(1)), "Left") // true
    IsVariant(Right(Nat(1)), "Left") // false

    Parameters

    • variant: IExpression<option | or>

      Variant expression

    • branch: string

      The branch name of the variant

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<bool>

    An expression

  • OpenVariant(variant: IExpression<option | or>, branch?: string, errorMsg?: IExpression<MichelsonType>, line?: LineInfo): IExpression<any>
  • Open a variant

    OpenVariant(Left(Nat(1)), "Left", String("COULD NOT OPEN VARIANT"))
    

    Parameters

    • variant: IExpression<option | or>

      Variant expression

    • branch: string = 'Some'

      The branch name of the variant

    • Optional errorMsg: IExpression<MichelsonType>

      The value to be included in the error trace.

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<any>

    An expression

  • isNone(variant: IExpression<option>, line?: LineInfo): IExpression<bool>
  • Checks if option variant is None.

    isNone(None())
    

    Parameters

    • variant: IExpression<option>

      Option expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<bool>

    An expression of type bool.

  • isSome(variant: IExpression<option>, line?: LineInfo): IExpression<bool>
  • Checks if option variant is Some.

    isSome(Some(Nat(1)))
    

    Parameters

    • variant: IExpression<option>

      Option expression

    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns IExpression<bool>

    An expression of type bool.

| View Functions

  • CallView(name: string, address: IExpression<MichelsonType>, argument?: IExpression<MichelsonType>, outputType?: IType<TypeAtom>, line?: LineInfo): Proxied<IExpression<option>>
  • Call a onchain view.

    CallView("some_view", Address("KT1R9M3MDffw7qSVSnbJs46aMC9YzzZz3aGT"), Nat(10), TNat());
    

    Parameters

    • name: string

      View name

    • address: IExpression<MichelsonType>

      Contract address that contains the view being called

    • argument: IExpression<MichelsonType> = ...

      View argument

    • outputType: IType<TypeAtom> = ...
    • line: LineInfo = ...

      Source code line information (Used in error messages)

    Returns Proxied<IExpression<option>>

    An expression.

Generated using TypeDoc