0

while running the smart contract uisng polkadot api i get the following error

file:///Users/.../Documents/Study%20related/Learning-JS/ipfs_ink/node_modules/@polkadot/api-contract/base/Contract.js:81
    gasLimit = BN_ZERO,
    ^

TypeError: Cannot read properties of undefined (reading 'gasLimit')
    at ContractPromise.#read (file:///Users/.../Documents/Study%20related/Learning-JS/ipfs_ink/node_modules/@polkadot/api-contract/base/Contract.js:81:5)
    at file:///Users/.../Documents/Study%20related/Learning-JS/ipfs_ink/node_modules/@polkadot/api-contract/base/Contract.js:40:71
    at Object.addMaterialPassport (file:///Users/.../Documents/Study%20related/Learning-JS/ipfs_ink/node_modules/@polkadot/api-contract/base/Contract.js:14:57)
    at main (file:///Users/..../Documents/Study%20related/Learning-JS/ipfs_ink/index_1.js:409:78)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

i tried to give gasLimit in the program as 10000n * 1000000n and later i tried with -1;

but error remains the same. How to solve it

Using the developer node of substrate. Made the contract in Ink and trying to access it using metadata.json

I try to access it using a javascript program with @polkadot/api and @polkadot/api-contract packages.

4
  • What versions of the node and api?
    – Nuke
    Commented Nov 27, 2022 at 14:44
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Nov 27, 2022 at 14:45
  • node version is Node v0.20.0-8d76d04faca. Api @polkadot/api is latest. That is 9.9.1 Commented Nov 27, 2022 at 21:12
  • using the developer node of substrate. Made teh contract in Ink and trying to access it using metadata.json Commented Nov 27, 2022 at 21:15

1 Answer 1

1

You can estimate gas consumption by doing a query first and then passing the value in your tx

Have a look at this doc about how to use polkadotjs for WASM smart-contracts

Your Answer

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

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