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.06k stars 342 forks source link

Unable to broadcast a tx on Kusama #5918

Closed goulinkh closed 6 days ago

goulinkh commented 6 days ago

Hey! When broadcasting a staking (pool nomination) tx for Kusama using the following code, The library throws an exception:

apiPromiseClient.rpc.author.submitExtrinsic(serializedTx)

The exception is:

error: findMetaCall: Unable to find Call with index [41, 0]/[41,0]
      at assert (/node_modules/@polkadot/util/assert.js:20:15)
      at assertReturn (/node_modules/@polkadot/util/assert.js:30:5)
      at decodeCallViaU8a (/node_modules/@polkadot/types/generic/Call.js:40:36)
      at new GenericCall (/node_modules/@polkadot/types/generic/Call.js:92:25)
      at new Type (:1:23)
      at initType (/node_modules/@polkadot/types-create/create/type.js:31:21)
      at createTypeUnsafe (/node_modules/@polkadot/types-create/create/type.js:48:16)
      at decodeExtrinsic (/node_modules/@polkadot/types/extrinsic/v4/Extrinsic.js:28:37)
      at new GenericExtrinsicV4 (/node_modules/@polkadot/types/extrinsic/v4/Extrinsic.js:15:31)
      at new Type (:1:23)
      at initType (/node_modules/@polkadot/types-create/create/type.js:31:21)
      at createTypeUnsafe (/node_modules/@polkadot/types-create/create/type.js:48:16)
      at new GenericExtrinsic (/node_modules/@polkadot/types/extrinsic/Extrinsic.js:195:25)
      at new Type (:1:23)
      at initType (/node_modules/@polkadot/types-create/create/type.js:31:21)
      at createTypeUnsafe (/node_modules/@polkadot/types-create/create/type.js:48:16)
      at _formatParams (/node_modules/@polkadot/rpc-core/bundle.js:295:34)
      at /node_modules/@polkadot/rpc-core/bundle.js:182:33
      at callWithRegistry (/node_modules/@polkadot/rpc-core/bundle.js:172:41)
      ...

It is worth mentioning that this script works fine with Polkadot and Westend however when trying on Kusama I get the error above.

goulinkh commented 6 days ago

The issue was fixed by using the correct RPC, where I was still using DOT RPC in some parts of my script instead of the KSM RPC.