0
  • Problem

    • The following program does not work with pallet-contract "polkadot-v0.9.29".
    • "polkadot-v0.9.27" in pallet-contract works as expected.
    • Anyone know how to get around this issue?
  • Source Code

  const gasLimit = 100000 * 1000000;
  const storageDepositLimit = null;

  const deployContract = async () => {
    const { web3FromSource } = await import("@polkadot/extension-dapp");
    const wsProvider = new WsProvider(blockchainUrl);
    const api = await ApiPromise.create({ provider: wsProvider });
    const contractWasm = contract_file.source.wasm;
    const code = new CodePromise(api, abi, contractWasm);
    const initValue = false;
    const performingAccount = accounts[0];
    const injector = await web3FromSource(performingAccount.meta.source);
    
    const tx = code.tx.new({ value:0, gasLimit:gasLimit,storageDepositLimit }, initValue);
  • I get the following error:
Unhandled Runtime Error
Error: createType(Call):: Call: failed decoding contracts.instantiateWithCode:: Struct: failed on args: {"value":"Compact<u128>","gas_limit":"Compact<FrameSupportWeightsWeightV2Weight>","storage_deposit_limit":"Option<Compact<u128>>","code":"Bytes","data":"Bytes","salt":"Bytes"}:: Struct: failed on gas_limit: Compact<FrameSupportWeightsWeightV2Weight>:: Struct: Cannot decode value 100000000000 (typeof number), expected an input object, map or array

Somebody please help me. Thank you.

1 Answer 1

1

I was using "8.4.1" from "polkadot/api-contract". I solved it by just upgrading to the latest "9.6.1".

Your Answer

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

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