diff --git a/packages/txwrapper-core/src/core/decode/decodeSigningPayload.ts b/packages/txwrapper-core/src/core/decode/decodeSigningPayload.ts index 3b80b670..c557b7c1 100644 --- a/packages/txwrapper-core/src/core/decode/decodeSigningPayload.ts +++ b/packages/txwrapper-core/src/core/decode/decodeSigningPayload.ts @@ -55,15 +55,18 @@ export function decodeSigningPayload( ? payload.era.asMortalEra.period.toNumber() : 0; - let assetId: number | undefined; + let assetId: number | object | undefined; if (payload.inner.assetId) { - assetId = payload.inner.assetId.isSome - ? parseInt(payload.inner.assetId.toString()) - : undefined; + assetId = payload.inner.assetId.isSome ? payload.inner.assetId : undefined; } return { - assetId, + assetId: + typeof assetId === 'object' + ? assetId + : typeof assetId === 'number' + ? parseInt(assetId.toString()) + : undefined, blockHash: payload.blockHash.toHex(), eraPeriod, genesisHash: payload.genesisHash.toHex(), diff --git a/packages/txwrapper-core/src/core/decode/decodeUnsignedTx.ts b/packages/txwrapper-core/src/core/decode/decodeUnsignedTx.ts index d7e92d69..df9b4ece 100644 --- a/packages/txwrapper-core/src/core/decode/decodeUnsignedTx.ts +++ b/packages/txwrapper-core/src/core/decode/decodeUnsignedTx.ts @@ -43,12 +43,13 @@ export function decodeUnsignedTx( const eraPeriod = isImmortalEra ? hexToNumber(registry.createType('ImmortalEra', unsigned.era).toHex()) : registry.createType('MortalEra', unsigned.era).period.toNumber(); - + const assetId = unsigned.assetId; return { address: unsigned.address, - assetId: registry - .createType('Compact', unsigned.assetId) - .toNumber(), + assetId: + typeof assetId === 'object' + ? registry.createType('MultiLocation', assetId) + : registry.createType('Compact', assetId).toNumber(), blockHash: unsigned.blockHash, blockNumber: registry .createType('BlockNumber', unsigned.blockNumber) diff --git a/packages/txwrapper-core/src/core/method/defineMethod.ts b/packages/txwrapper-core/src/core/method/defineMethod.ts index b6e8ce81..b0331a58 100644 --- a/packages/txwrapper-core/src/core/method/defineMethod.ts +++ b/packages/txwrapper-core/src/core/method/defineMethod.ts @@ -156,10 +156,14 @@ export function defineMethod( const extrinsicEra = createEra(registry, eraOptions); const blockHash = info.blockHash as `0x${string}`; const genesisHash = info.genesisHash as `0x${string}`; + const assetId = info.assetId; return { address: info.address, - assetId: registry.createType('Compact', info.assetId).toNumber(), + assetId: + typeof assetId === 'object' + ? registry.createType('MultiLocation', assetId) + : registry.createType('Compact', assetId).toNumber(), blockHash, blockNumber: registry.createType('BlockNumber', info.blockNumber).toHex(), era: extrinsicEra.toHex(), diff --git a/packages/txwrapper-core/src/types/method.ts b/packages/txwrapper-core/src/types/method.ts index a26ff5b2..829f9a08 100644 --- a/packages/txwrapper-core/src/types/method.ts +++ b/packages/txwrapper-core/src/types/method.ts @@ -69,9 +69,8 @@ export interface UnsignedTransaction extends SignerPayloadJSON { /** * The assetId used in ChargeAssetTxPayment * - * @default 0 */ - assetId?: number; + assetId?: number | object; /** * The SCALE-encoded metadata, as a hex string. Can be retrieved via the RPC * call `state_getMetadata`. @@ -90,9 +89,8 @@ export interface BaseTxInfo { /** * The assetId used in ChargeAssetTxPayment * - * @default 0 */ - assetId?: number; + assetId?: number | object; /** * The checkpoint hash of the block, in hex. */