Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 10 tasks
deuszx opened this issue Jan 5, 2023 · 8 comments
Closed
2 of 10 tasks
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.

Comments

@deuszx
Copy link

deuszx commented Jan 5, 2023

  • I'm submitting a ...
  • Bug report
  • Feature request
  • Support request
  • Other
  • What is the current behavior and expected behavior?

After upgrading network to WeightsV2, my frontend code started to fail with the following errors

Uncaught (in promise) Error: Your runtime does not expose the api.call.contractsApi.call runtime interfaces
    at new Base (Base.js:13:1)
    at new Contract (Contract.js:33:1)
    at new ContractPromise (index.js:18:1)
    at getPostsAuthors (getPostsAuthors.ts:18:1)
    at async getAllPostsAuthors (BulletinBoard.tsx:51:1)

link to the repository.

  • Please tell us about your environment:
  1. Network running ink3, contracts deployed, custom frontend (built with polkadot.js) working.
  2. Network migrated to ink4, contracts deployed, custom frontend (built with polkadot.js) not working.
  3. ContractsUI connected to that same network capable of interacting with the contracts and the chain.
  • Version:

  • Environment:

    • Node.js
    • Browser
    • Other (limited support for other environments)
  • Language:

    • JavaScript
    • TypeScript ("typescript": "^4.8.4")
    • Other
@jacogr
Copy link
Member

jacogr commented Jan 5, 2023

It literally means what it says - the chain you are connecting to does not expose the runtime interfaces required. See the explict check -

} else if (!api.call.contractsApi || !isFunction(api.call.contractsApi.call)) {
throw new Error('Your runtime does not expose the api.call.contractsApi.call runtime interfaces');
}

It either means -

(a) it is a non-contract chain (e.g. Polkadot/Kusama/etc - a chain explicitly needs to have the contracts pallet included in the on-chain runtime)
(b) it is an old version of the chain without the newer runtime interfaces (unlikely)
(c) runtime misconfiguration if the pallet is indeed meant to be exposed

@jacogr jacogr added the Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. label Jan 5, 2023
@deuszx
Copy link
Author

deuszx commented Jan 5, 2023

Yes, I saw the Base.ts but I don't think that's the problem I'm having.

My setup:

  1. The contracts and fronted (built with polkadotjs) were working correctly with ink3.
  2. Network has been migrated to ink4.
  3. Deployment and interactions with the contracts work through the ContractsUI.

Given that:

  • on ink3 it used to work with my frontend (built with polkadotjs) and ContractsUI
  • on ink4 it stopped working with my frontend and continues to work with ContractsUI

@deuszx
Copy link
Author

deuszx commented Jan 7, 2023

I think I've found the reason why it keeps working with ContractsUI paritytech/substrate#12358

@deuszx
Copy link
Author

deuszx commented Jan 7, 2023

@jacogr
Copy link
Member

jacogr commented Jan 10, 2023

Yes, the RPCs are completely unused since they are deprecated/removed in Substrate. So the API only uses the state call interfaces directly.

@deuszx
Copy link
Author

deuszx commented Jan 10, 2023

Tell me, please, if I get the exact same error when running substrate-contracts-node from https://github.com/paritytech/substrate-contracts-node/releases/tag/v0.22.1 and

"@polkadot/api": "^9.11.1",
"@polkadot/api-contract": "^9.11.1",

Wouldn't that mean it's not the problem with my chain but the library?

Error:

Uncaught (in promise) Error: Your runtime does not expose the api.call.contractsApi.call runtime interfaces
    at new Base (Base.js:13:1)
    at new Contract (Contract.js:33:1)
    at new ContractPromise (index.js:18:1)
    at getHighlightedPostsAuthors (getHighlightedPostsAuthors.ts:20:1)

@deuszx
Copy link
Author

deuszx commented Jan 11, 2023

@jacogr , turns out that the error was caused by invalid version of npm -- failed on npm @ 9.1.1 but is "working" on 8.19.3.

@deuszx deuszx closed this as completed Jan 11, 2023
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
None yet
Development

No branches or pull requests

3 participants