diff --git a/.changeset/red-nails-trade.md b/.changeset/red-nails-trade.md new file mode 100644 index 000000000..42981e08f --- /dev/null +++ b/.changeset/red-nails-trade.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/sdk': minor +--- + +Sorted cwNative funds by denom in transfer tx diff --git a/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts b/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts index e1b476520..10f32e5b0 100644 --- a/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts +++ b/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts @@ -394,6 +394,7 @@ export class CwHypNativeAdapter const { addressOrDenom: igpDenom, amount: igpAmount } = interchainGas; assert(igpDenom, 'Interchain gas denom required for Cosmos'); + // If more than one denom is used as funds, they must be sorted by the denom const funds: Coin[] = collateralDenom === igpDenom ? [ @@ -411,7 +412,7 @@ export class CwHypNativeAdapter amount: igpAmount.toString(), denom: igpDenom, }, - ]; + ].sort((a, b) => a.denom.localeCompare(b.denom)); return this.cw20adapter.prepareRouter( {