polkadot-js / api

Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
Apache License 2.0
1.07k stars 354 forks source link

Error: findMetaCall: Unable to find Call with index [0, 0]/[0,0] #4793

Closed CertainLach closed 2 years ago

CertainLach commented 2 years ago

Running

polkadot-types-from-chain --endpoint metadata.json --output src/ --package .

Using polkadot.js v8.3.1 (fails with same error on older versions)

With this metadata (Also can be obtained from https://quartz.unique.network): https://gist.githubusercontent.com/CertainLach/a1fef8a3d48a6ba899d205a7420be5b2/raw/5e55bd6a7f75a3e3d10d73d049b55ff84c008db7/metadata.json

Fails with this error:

Error: findMetaCall: Unable to find Call with index [0, 0]/[0,0]
    at assert (node_modules/@polkadot/util/cjs/assert.js:37:11)
    at assertReturn (node_modules/@polkadot/util/cjs/assert.js:47:3)
    at TypeRegistry.findMetaCall (node_modules/@polkadot/types/cjs/create/registry.js:329:35)
    at decodeCallViaU8a (node_modules/@polkadot/types/cjs/generic/Call.js:62:34)
    at decodeCall (node_modules/@polkadot/types/cjs/generic/Call.js:90:12)
    at new GenericCall (node_modules/@polkadot/types/cjs/generic/Call.js:121:21)
    at new Type (node_modules/@polkadot/types/cjs/create/registry.js:368:16)
    at getSimilarTypes (node_modules/@polkadot/typegen/cjs/util/derived.js:102:15)
    at node_modules/@polkadot/typegen/cjs/generate/tx.js:94:59
    at Array.map (<anonymous>)
jacogr commented 2 years ago

This is something that needs investigation as to "why". (However did spot an issue with the types-from-defs, where BTreeSet is incorrectly handled, this addresses that issue - https://github.com/polkadot-js/api/pull/4794)

jacogr commented 2 years ago

This happens in the cases where an index 0/0 is not available (this is generally the system pallet in Substrate chains) - since indexes can be specified at any value, relying on the default is probably not great... as seen here.

polkadot-js-bot commented 2 years ago

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.