You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Michelson supports the use of Pair as key for a map and big-map, however, Taquito smart contract abstraction currently throws an error when encoding contract storage that make use of Pair as key in a map
Michelson supports the use of Pair as key for a map and big-map, however, Taquito smart contract abstraction currently throws an error when encoding contract storage that make use of Pair as key in a map
For example
Given the following contract
Taquito will throw the following error while encoding the storage into the SC abstract:
this.KeySchema.ToKey is not a function
The problem will be the same for big-map, set and map. This is because Taquito does not treat
pair
as comparable value (which it is).A problem to consider while solving this issue:
The current implementation of the SC abstract produces a plain JS object for map. So a map is typically rendered as:
However, this approach is not suitable for Pair because a JS object would be serialized before use as a key leading to overriding the other.
A few solutions to consider:
Given the following Pair:
{ "prim": "Pair", args: [{ "string": "test2" }, { "string": "test3" }] }
Taquito could serialize pair using a well known format
test2_test3
leading to:Taquito could change how it abstracts Pair as key doing:
The text was updated successfully, but these errors were encountered: