Skip to content

Commit

Permalink
fix: msgTransferCosmJs toAmino
Browse files Browse the repository at this point in the history
  • Loading branch information
shane-moore committed Jul 23, 2024
1 parent 8d538a9 commit 05b2182
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions packages/sdk-ts/src/core/modules/ibc/msgs/MsgTransferCosmjs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// import { MsgTransferEncodeObject } from '@cosmjs/stargate'
import snakecaseKeys, { SnakeCaseKeys } from 'snakecase-keys'
import { MsgTransfer as BaseMsgTransferCosmjs } from 'cosmjs-types/ibc/applications/transfer/v1/tx'
import {
CosmosBaseV1Beta1Coin,
Expand Down Expand Up @@ -77,16 +75,28 @@ export default class MsgTransferCosmjs {
}

public toAmino() {
const proto = this.toProto()
const message = {
...snakecaseKeys(proto),
}
const { params } = this

const message = BaseMsgTransferCosmjs.fromPartial({
sourcePort: params.port,
sourceChannel: params.channelId,
sender: params.sender,
receiver: params.receiver,
token: params.amount,
timeoutHeight: params.height
? {
revisionHeight: BigInt(params.height.revisionHeight),
revisionNumber: BigInt(params.height.revisionNumber),
}
: undefined,
timeoutTimestamp: params.timeout ? BigInt(params.timeout) : undefined,
})

return {
type: 'cosmos-sdk/MsgTransfer',
type: '/ibc.applications.transfer.v1.MsgTransfer',
value: {
...message,
} as unknown as SnakeCaseKeys<IbcApplicationsTransferV1Tx.MsgTransfer>,
},
}
}

Expand Down

0 comments on commit 05b2182

Please sign in to comment.