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?

  • I am fine by implementing this self as a unit8 array or a hex string in JavaScript. If that is necessary, I would like a link to how PACK's serialization is implemented, though. Sep 25 '20 at 15:39

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? Sep 25 '20 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.
    – FFF
    Sep 26 '20 at 9:44
  • 2
    The 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 B
    Sep 26 '20 at 10:39
  • 1
    @ArthurB I’m more than looking forward to it.
    – FFF
    Sep 26 '20 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.