diff --git a/components/dataViews/TransactionInfo/TxMsgTransferDetails.tsx b/components/dataViews/TransactionInfo/TxMsgTransferDetails.tsx index 66f8e829..2e33484f 100644 --- a/components/dataViews/TransactionInfo/TxMsgTransferDetails.tsx +++ b/components/dataViews/TransactionInfo/TxMsgTransferDetails.tsx @@ -10,7 +10,7 @@ interface TxMsgTransferDetailsProps { const TxMsgTransferDetails = ({ msg }: TxMsgTransferDetailsProps) => { const { state } = useAppContext(); - const timeoutDateObj = new Date(msg.value.timeoutTimestamp / 1000000); + const timeoutDateObj = new Date(msg.value.timeoutTimestamp.divide(1_000_000).toNumber()); const timeoutDate = timeoutDateObj.toLocaleDateString(); const timeoutTime = timeoutDateObj.toLocaleTimeString(); diff --git a/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx index 605c5131..ddf54fe3 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgTransferForm.tsx @@ -1,4 +1,5 @@ import { assert } from "@cosmjs/utils"; +import Long from "long"; import { useEffect, useState } from "react"; import { MsgGetter } from ".."; import { useAppContext } from "../../../../context/AppContext"; @@ -106,8 +107,8 @@ const MsgTransferForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgTransferFo const timeoutTimestamp = selectedTimestamp.label === "custom" - ? Number(customTimestamp) - : (Date.now() + selectedTimestamp.value) * 1000000; // In nanoseconds + ? Long.fromString(customTimestamp) + : Long.fromNumber(Date.now() + selectedTimestamp.value, true).multiply(1_000_000); // In nanoseconds const msg: TxMsgTransfer = { typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", diff --git a/types/txMsg.ts b/types/txMsg.ts index 3308fd3b..cc0decbc 100644 --- a/types/txMsg.ts +++ b/types/txMsg.ts @@ -1,4 +1,5 @@ -import { Coin } from "@cosmjs/amino"; +import { MsgTransferEncodeObject } from "@cosmjs/stargate"; +import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx"; export type MsgType = | "send" @@ -71,15 +72,12 @@ export interface TxMsgSetWithdrawAddress { }; } -export interface TxMsgTransfer { - readonly typeUrl: "/ibc.applications.transfer.v1.MsgTransfer"; - readonly value: { - readonly sourcePort: string; - readonly sourceChannel: string; - readonly token: Coin; - readonly sender: string; - readonly receiver: string; - readonly timeoutTimestamp: number; - readonly memo: string; - }; +type OmmitedMsgTransfer = Omit; +type MsgTransferRequiredToken = OmmitedMsgTransfer & Required>; +interface MsgTransferOptionalMemo extends MsgTransferRequiredToken { + readonly memo?: string; +} + +export interface TxMsgTransfer extends MsgTransferEncodeObject { + readonly value: Readonly; }