1

as the title suggest, Im trying to call PSP22 token contract and read balanceOf() function, but i get error that im passing a too big of a input (27 instead of 8) Im trying to invoke balanceOf() PSP22 ink! contract.

When i initializing the token it works correctly and i can see the abi:


alanceOf: function createQuery(origin, options)
​​​​​
length: 2
​​​​​
meta: Object { isMutating: false, isPayable: false, identifier: "balance_of", … }
​​​​​​
args: Array [ {…} ]
​​​​​​​
0: Object { name: "owner", type: {…} }
​​​​​​​​
name: "owner"
​​​​​​​​
type: Object { info: 10, type: "AccountId" }

Here is the code:

    const tokenContract = new ContractPromise(api, abiToken, "5FmJDyLBoYKfiaoPUcfR3WKh13HkwvXr2CYTNg5RLykNXY3A");
    dispatch(set_token_contract(tokenContract));
    const value = 0; // only useful on isPayable messages
    // NOTE the apps UI specified these in mega units
    const gasLimit = 3000n * 1000000n;

    // (We perform the send from an account, here using Alice's address)
    let alice = "5DaYseV9GSrGKrJYmKU5yymF9izPM2ZzG8f93xQK6hectHuo"
    const { gasConsumed, result, output } = await tokenContract.query.balanceOf(alice, { gasLimit }alice); 

here is the error:

  RPC-CORE: call(callRequest: ContractCallRequest, at?: BlockHash): ContractExecResult:: createType(ContractExecResult):: Struct: failed on result: {"_enum":{"Ok":"ContractExecResultOk","Err":"ContractExecResultErr"}}:: Enum(Err):: Enum(Module):: Struct: failed on error: u8:: u8: Input too large. Found input with 28 bits, expected 8
  • The community looking to support you on these issues is mostly over at https://substrate.stackexchange.com/ - have you tried asking this there? – Nuke May 21 '22 at 15:07

0 Answers0