1

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. – Thorkil Værge Sep 25 at 15:39
2

Taquito has this functionality: the packData method in the RPC client package.

| improve this answer | |
  • Very nice. But is there a reason the calculation has to go through a node? – Thorkil Værge Sep 25 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 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 at 10:39
  • 1
    @ArthurB I’m more than looking forward to it. – FFF Sep 26 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.