Skip to main content
Version: 16.0.0

Contract call parameters

The smart contracts on the Tezos blockchain only work with Michelson, so it can be sometimes complicated to write the correct JavaScript values that Taquito will translate to Michelson values for contract calls.

You will find below tables that match some of the most common values that smart contract receive through their entrypoints and the corresponding JavaScript value that Taquito expects.

You can find the tests used to check these values in this GitHub repo

Primitive types

Michelson typeMichelson valueTaquito
unitUnit[["unit"]]
boolTruetrue
int66
nat77
string"Tezos""Tezos"
mutez50000050000 / 50_000
timestamp"2022-12-19T15:53:26.055Z""2022-12-19T15:53:26.055Z"

Note: if you want to pass the current timestamp to a contract entrypoint, you can use new Date().toISOString() which will output the right format.

Option

Michelson typeMichelson valueTaquito
option natNonenull
option natSome 66
option stringSome "Tezos""Tezos"
option (list nat)Some { 6 ; 7 ; 8 ; 9 }[6, 7, 8, 9]
option (pair string nat)Some (Pair "Tezos" 8)"Tezos", 8
option (or string nat)Some (Left "Tezos")0, "Tezos"

There is nothing special to do to pass an option with Taquito, Taquito will assume that passing null means that you want to pass None and any other value will be Some. You can then pass the value following the format corresponding to its type.

Union

Michelson typeMichelson valueTaquito
or int stringLeft 50, 5
or int stringRight "Tezos1, "Tezos"
or (pair int nat) stringLeft (Pair 6 7)0, { 0: 6, 1: 7 }
or (or string (pair nat int) (or int nat))Left (Right (Pair 6 7))see below

For nested unions, Taquito will parse it as an entrypoint, so any nested union is going to be available under its index on the methods object. In non-nested unions, you target the Left side of the union with 0 and the Right side with 1.

List

Michelson typeMichelson valueTaquito
list nat{ 5 ; 6 ; 7 ; 8 }[5, 6, 7, 8]
list (pair int string){ (Pair 5 "Tezos") ; (Pair 6 "Taquito") }[ { 0: 5, 1: "Tezos" }, { 0: 6, 1: "Taquito" }]
list (list nat){ { 5 ; 6 ; 7 } ; { 8 ; 9 ; 10 } }[ [ 5, 6, 7 ], [ 8, 9, 10 ] ]
list (or (pair int nat) string){ Left (Pair 6 7) ; Right "Tezos" }[ { 0: { 0: 6, 1: 7 } }, { 1: "Tezos" } ]

In a list, pair and union values are always represented as objects: a pair is represented as an object with 2 properties (0 for the left field and 1 for the right field), while a union is represented as an object with a single property (0 for Left or 1 for Right).

Pair

Michelson typeMichelson valueTaquito methodsTaquito methodsObject
pair int natPair 6 76, 7{ 0: 6, 1: 7 }
pair %this (int nat)Pair 6 76, 7{ 0: 6, 1: 7 }
pair (int %one) (nat %two)Pair 6 76, 7{ "one": 6, "two": 7 }
pair (pair int nat) (pair string mutez)Pair (Pair 6 7) (Pair "Tezos" 500000)6, 7, "Tezos", 50_0000{ 0: 6, 1: 7, 2: "Tezos", 3: 50_000 }
pair (pair (int %one) (nat %two)) (pair (string %three) (mutez %four))Pair (Pair (6 %one) (7 %two)) (Pair ("Tezos" %three) (500000 %four))6, 7, "Tezos", 50_0000{ "one": 6, "two": 7, "three": "Tezos", "four": 50_000 }

The methodsObject method always takes a single object to represent the pair to be passed, while methods requires the pair fields to be spread. If annotations are present, they are used to identify the pair fielda in the corresponding properties of the JS object.

Map and big_map

See the documentation about creating and updating maps and big_maps

Provide detailed feedback