1

I send the transaction using the substrate interface.

I get the key pair and call:

call_module = "Assets"
call_function = 'transfer'
call_params = {
    "id": asset_id,
    "target": target,
    'amount': amount,
 }

Then, I sign the transaction using substrate.create_signed_extrinsic, but I get an error:

raise ValueError('Element "{}" of struct is missing in given value'.format(key))
ValueError: Element "asset_id" of struct is missing in given value

1 Answer 1

3

Are you sure you have the latest version of packages substrate-interface==1.2.2 and scalecodec==1.0.34?

Because I can remember older versions of scalecodec don't have the 'signed_extensions' support that is included in the metadata and Statemine has the ChargeAssetTxPayment extension.

I was successfully able to transfer an asset on Statemine with the following code:

keypair = Keypair.create_from_mnemonic(mnemonic)
substrate = SubstrateInterface(
    url="wss://statemine-rpc.polkadot.io"
)

call = substrate.compose_call(
    call_module="Assets",
    call_function="transfer",
    call_params={'id': asset_id, 'target': account_id, 'amount': amount}
)

extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)

result = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)

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.