3

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
  • 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. Commented Sep 25, 2020 at 15:39

1 Answer 1

2

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

4
  • 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.
    – FFF
    Commented Sep 26, 2020 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
    Commented Sep 26, 2020 at 10:39
  • 1
    @ArthurB I’m more than looking forward to it.
    – FFF
    Commented Sep 26, 2020 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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