How to encode List when deploying a smart contract through mxpy?

33 Views Asked by At

When using the MultiversX SDK, I can pass a list of typed values as a single Input argument to a smart contract deploy, with the method List.fromItems(arrayTypedValue).

How can I encode the same List input when deploying through the mxpy CLI?
Something like mxpy contract deploy ... --arguments <List>.
How do I encode the <List> here?

1

There are 1 best solutions below

0
On

You need to serialize each variable in the array (according to this documentation) and then send them as a continuous string preceded by 0x which should mark it as an encoded string. For example, the array [1, 1] becomes 0x0000000100000001 which has 3 parts:

  • 0x
  • 00000001
  • 00000001