-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treat pair as comparable type #251
Comments
carte7000
added a commit
that referenced
this issue
Feb 11, 2020
Support pair for big map key Note: pair are still not supported for map and set re #251
Addressed in release [6.1.0-beta.0][https://github.com/ecadlabs/taquito/releases/tag/6.1.0-beta.0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: