Skip to content

No staking pallet in generated metadata for 1.3.0 #339

@adelove-ledger

Description

@adelove-ledger

Hello

I'm trying to use tx-wrapper 7.1.1 with the polkadot docker parity/polkadot:v1.3.0 and it looks like it doesn't find the staking pallet in the metadata.

How to reproduce:
Launch polkadot image with docker run --rm -it -p 9933:9933 parity/polkadot:v1.3.0 --rpc-external --rpc-port 9933

Then with this code:

async function main () : Promise<void> {
	
	await cryptoWaitReady();

	const keyring = new Keyring();
	const alice = keyring.addFromUri('//Alice', { name: 'Alice' }, 'ed25519');
	const derived_address = deriveAddress(alice.publicKey, PolkadotSS58Format.westend)

	const { block } = await rpcToLocalNode('chain_getBlock');
	const blockHash = await rpcToLocalNode('chain_getBlockHash');
	const genesisHash = await rpcToLocalNode('chain_getBlockHash', [0]);
	const metadataRpc = await rpcToLocalNode('state_getMetadata');
	const { specVersion, transactionVersion, specName } = await rpcToLocalNode(
		'state_getRuntimeVersion'
	);
	const registry = getRegistry({
		chainName: "Polkadot",
		specName,
		specVersion,
		metadataRpc,
	});

	const unsigned = methods.staking.bond(
		{"value": 100000, "payee":"Staked"},
		{
			address: derived_address,
			blockHash,
			blockNumber: registry
				.createType('BlockNumber', block.header.number)
				.toNumber(),
			eraPeriod: 64,
			genesisHash,
			metadataRpc,
			nonce: 0,
			specVersion,
			tip: 0,
			transactionVersion,
		},
		{
			metadataRpc,
			registry,
		}
	);
	const extrinsicPayload = registry.createType('ExtrinsicPayload', unsigned, {version: unsigned.version,});
}

I have the following error:
Error: pallet or method not found in metadata
However it works for balances.

I had a look at txwrapper-core/lib/core/method/defineMethod.js and it looks like the staking pallet is missing from the generatedMetadata line 84 but I can't find the solution, has anyone tried this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions