In my smart contract in LIGO I serialize some data using Bytes.pack
which calls the underlying PACK
Michelson instruction. In my case, the function signature is (nat, address, nat) -> bytes
. Does any JavaScript/TypeScript library like Taquito have a functionality to emulate this LIGO instruction or do I have to implement that myself?
1 Answer
Taquito has this functionality: the packData method in the RPC client package.
-
Very nice. But is there a reason the calculation has to go through a node? Commented Sep 25, 2020 at 22:59
-
1@ThorkilVærge there are no obligations. It’s simply easier to implement it like that. ConseilJS has this functionality and I’m surprised Taquito doesn’t (maybe it does elsewhere?). There are other implementations that I know of (pytezos, SmartPy) that don’t fully answer your question (easily callable from JavaScript) but prove that it’s quite possible.– FFFCommented Sep 26, 2020 at 9:44
-
2The other thing with the SmartPy and ConseilJS implementation is that we don't know yet for sure if they are 100% identical to the protocol's implementation. Extracting it as a library would be safest.– Arthur BCommented Sep 26, 2020 at 10:39
-
1
PACK
's serialization is implemented, though.