0

Does anyone know how to solve this error?

I am trying to pay transaction fees with sufficient tokens on Westend Asset Hub by passing an asset MultiLocation to the options in the signAndSend function.

const asset = {
  parents: 0,
  interior: {
    X2: [{ palletInstance: 50 }, { generalIndex: 8 }],
  },
};

const injector = await web3FromSource(account.meta.source);

    transferExtrinsic
      .signAndSend(
        account.address,
        {
          signer: injector.signer,
          assetId: asset,
        },
        ({ status }) => {
          if (status.isInBlock) {
            console.log(
              `Completed at block hash #${status.asInBlock.toString()}`
            );
          } else {
            console.log(`Current status: ${status.type}`);
          }
        }
      )
      .catch((error) => {
        console.log(":( transaction failed", error);
      });
  };

And I keep getting this console error regarding the asset MultiLocation format is incorrect when using Talisman Wallet

transaction failed Error: createType(SignerPayload):: Struct: failed on assetId: Option<AssetId>:: Unable to construct number from multi-key object

And here is the error message when using Polkadot.js extension

Something went wrong with the query and rendering of this component. createType(ExtrinsicPayload):: createType(ExtrinsicPayloadV4):: Struct: failed on assetId: Option<AssetId>:: Assertion failed

I am getting the same error when capitalizing PalletInstance and GeneralIndex like this

const asset = {
  parents: 0,
  interior: {
    X2: [{ PalletInstance: 50 }, { GeneralIndex: 8 }],
  },
};

1 Answer 1

0

You have to choose the XCM version for your asset MultiLocation

Try with:

const asset = { 
  v4: { 
    parents: 0,
    interior: { 
       x2: [{ PalletInstance: 50 }, { GeneralIndex: 8 }]
     }
  }
};

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.