paritytech / txwrapper-core

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.
https://paritytech.github.io/txwrapper-core/
Apache License 2.0
77 stars 28 forks source link

fix: set assetId to default to undefined instead of 0 #397

Closed bee344 closed 4 weeks ago

bee344 commented 1 month ago

Description

As reported on #393, when not specifying the assetId to pay for fees, the value defaulted to something other than undefined as it's supposed to.

Changed the assetId setting in decodeUnsignedTx.ts and defineMethod.ts in order to catch when the assetId is undefined and set it as so.

Previous:

assetId: typeof assetId === 'object'
                ? registry.createType('MultiLocation', assetId)
                : registry.createType('Compact<AssetId>', assetId).toNumber()

Current:

assetId: !assetId ? undefined
            : typeof assetId === 'object'
                ? registry.createType('MultiLocation', assetId)
                : registry.createType('Compact<AssetId>', assetId).toNumber()

Closes #393