use-ink / contracts-ui

Web application for deploying wasm smart contracts on Substrate chains that include the FRAME contracts pallet
https://contracts-ui.substrate.io/
GNU General Public License v3.0
62 stars 47 forks source link

Issue with api runtime contexts #399

Closed EdinyangaOttoho closed 1 year ago

EdinyangaOttoho commented 1 year ago

Describe the bug When using the new ContractPromise for the Aleph Zero chain, I get an error:

Your runtime does not expose the api.call.contractsApi.call runtime interfaces

To Reproduce Steps to reproduce the behavior:

  1. Create an API provider:
    wsProvider = new WsProvider('wss://ws.test.azero.dev')
    api = await ApiPromise.create({ provider: wsProvider })
  2. Try using the metadata and address of a token to create an instance of a contract:
    const contract = new ContractPromise(api, contract_metadata, contract_address)
  3. Error shows up:
    Uncaught (in promise) Error: Your runtime does not expose the api.call.contractsApi.call runtime interfaces

Expected behavior It is supposed to create an instance of the contract that will allow for contract.tx and contract.query methods.

Screenshots image

Desktop (please complete the following information):

Environment (please complete the following information where it makes sense):

statictype commented 1 year ago

this is unrelated to Contracts UI. the error suggests you are connected to an older node that doesn't expose the contracts runtime api (which is not the case for Aleph Zero Testnet) or that your @polkadot/api version is too old perhaps. the bug is most likely in your code, i suggest posting a reproducible sample on Substrate StackExchange and get help from the community.

EdinyangaOttoho commented 1 year ago

My polkadot.js version was a newer one and wasn't compatible with the current release (with an older version). What I rather did was downgrade it to 9.11.x and the rest was history.

Also, I modified my code to support Weights V2 which has refTimeLimit, proofSize, storageDepositLimit etc, which are the new fields needed for Aleph Zero Testnet ink! 4