multiversx / mx-sdk-py-cli

Python Command Line Tools and SDK for interacting with the MultiversX blockchain and dApps.
Other
48 stars 36 forks source link

Added suport for contract queries using abi file #436

Closed popenta closed 3 months ago

popenta commented 3 months ago

The same arguments as for contract calls have been added. The args are --abi and --arguments-file. Keep in mind the args should be placed inside a list like such:

[
    5,
    {
         { "bech32": "erd1..." }
    }
]

When performing queries without the abi file the response looks like this:

[
    "0e"
]

But when using the abi file the response is parsed, and it looks like this:

[
    14
]

There are small differences in how values are returned. For example, if an endpoint returns variadic<Address>, when querying without abi, the response looks like this:

[
    "3c35d7eacb1a99a4a0ccaa537ef0cc0ae109f41f6c2b402203e633bfbb071f5c",
    "0139472eff6886771a982f3083da5d421f24c29181e63888228dc81ca60d69e1"
]

But when the abi is used, the response looks like this:

[
    [
        "3c35d7eacb1a99a4a0ccaa537ef0cc0ae109f41f6c2b402203e633bfbb071f5c",
        "0139472eff6886771a982f3083da5d421f24c29181e63888228dc81ca60d69e1"
    ]
]