Use cosmjs-types types consistently
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { printableCoin } from "../../../lib/displayHelpers";
|
||||
import { TxMsgDelegate } from "../../../types/txMsg";
|
||||
@@ -9,6 +10,7 @@ interface TxMsgDelegateDetailsProps {
|
||||
|
||||
const TxMsgDelegateDetails = ({ msg }: TxMsgDelegateDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
assert(msg.value.amount, "Amount must be set, see https://github.com/osmosis-labs/telescope/issues/386");
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { printableCoin } from "../../../lib/displayHelpers";
|
||||
import { TxMsgRedelegate } from "../../../types/txMsg";
|
||||
@@ -9,6 +10,7 @@ interface TxMsgRedelegateDetailsProps {
|
||||
|
||||
const TxMsgRedelegateDetails = ({ msg }: TxMsgRedelegateDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
assert(msg.value.amount, "Amount must be set, same as https://github.com/osmosis-labs/telescope/issues/386");
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import { thinSpace } from "../../../lib/displayHelpers";
|
||||
import { TxMsgTransfer } from "../../../types/txMsg";
|
||||
import HashView from "../HashView";
|
||||
@@ -7,6 +8,7 @@ interface TxMsgTransferDetailsProps {
|
||||
}
|
||||
|
||||
const TxMsgTransferDetails = ({ msg }: TxMsgTransferDetailsProps) => {
|
||||
assert(msg.value.token, "Token must be set, same as https://github.com/osmosis-labs/telescope/issues/386");
|
||||
const timeoutDateObj = new Date(msg.value.timeoutTimestamp.divide(1_000_000).toNumber());
|
||||
const timeoutDate = timeoutDateObj.toLocaleDateString();
|
||||
const timeoutTime = timeoutDateObj.toLocaleTimeString();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { printableCoin } from "../../../lib/displayHelpers";
|
||||
import { TxMsgUndelegate } from "../../../types/txMsg";
|
||||
@@ -9,6 +10,7 @@ interface TxMsgUndelegateDetailsProps {
|
||||
|
||||
const TxMsgUndelegateDetails = ({ msg }: TxMsgUndelegateDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
assert(msg.value.amount, "Amount must be set, same as https://github.com/osmosis-labs/telescope/issues/386");
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
+14
-42
@@ -1,4 +1,7 @@
|
||||
import { Coin, MsgTransferEncodeObject } from "@cosmjs/stargate";
|
||||
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
|
||||
import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward } from "cosmjs-types/cosmos/distribution/v1beta1/tx";
|
||||
import { MsgBeginRedelegate, MsgDelegate, MsgUndelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
|
||||
import { MsgCreateVestingAccount } from "cosmjs-types/cosmos/vesting/v1beta1/tx";
|
||||
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
|
||||
|
||||
export type MsgType =
|
||||
@@ -23,71 +26,40 @@ export type TxMsg =
|
||||
|
||||
export interface TxMsgSend {
|
||||
readonly typeUrl: "/cosmos.bank.v1beta1.MsgSend";
|
||||
readonly value: {
|
||||
readonly fromAddress: string;
|
||||
readonly toAddress: string;
|
||||
readonly amount: readonly Readonly<Coin>[];
|
||||
};
|
||||
readonly value: MsgSend;
|
||||
}
|
||||
|
||||
export interface TxMsgDelegate {
|
||||
readonly typeUrl: "/cosmos.staking.v1beta1.MsgDelegate";
|
||||
readonly value: {
|
||||
readonly delegatorAddress: string;
|
||||
readonly validatorAddress: string;
|
||||
readonly amount: Readonly<Coin>;
|
||||
};
|
||||
readonly value: MsgDelegate;
|
||||
}
|
||||
|
||||
export interface TxMsgUndelegate {
|
||||
readonly typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate";
|
||||
readonly value: {
|
||||
readonly delegatorAddress: string;
|
||||
readonly validatorAddress: string;
|
||||
readonly amount: Readonly<Coin>;
|
||||
};
|
||||
readonly value: MsgUndelegate;
|
||||
}
|
||||
|
||||
export interface TxMsgRedelegate {
|
||||
readonly typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate";
|
||||
readonly value: {
|
||||
readonly delegatorAddress: string;
|
||||
readonly validatorSrcAddress: string;
|
||||
readonly validatorDstAddress: string;
|
||||
readonly amount: Readonly<Coin>;
|
||||
};
|
||||
readonly value: MsgBeginRedelegate;
|
||||
}
|
||||
|
||||
export interface TxMsgClaimRewards {
|
||||
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward";
|
||||
readonly value: {
|
||||
readonly delegatorAddress: string;
|
||||
readonly validatorAddress: string;
|
||||
};
|
||||
readonly value: MsgWithdrawDelegatorReward;
|
||||
}
|
||||
|
||||
export interface TxMsgSetWithdrawAddress {
|
||||
readonly typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress";
|
||||
readonly value: {
|
||||
readonly delegatorAddress: string;
|
||||
readonly withdrawAddress: string;
|
||||
};
|
||||
readonly value: MsgSetWithdrawAddress;
|
||||
}
|
||||
|
||||
export interface TxMsgCreateVestingAccount {
|
||||
readonly typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount";
|
||||
readonly value: {
|
||||
readonly fromAddress: string;
|
||||
readonly toAddress: string;
|
||||
readonly amount: readonly Readonly<Coin>[];
|
||||
readonly endTime: Long;
|
||||
readonly delayed: boolean;
|
||||
};
|
||||
readonly value: MsgCreateVestingAccount;
|
||||
}
|
||||
|
||||
type OmmitedMsgTransfer = Omit<MsgTransfer, "timeoutHeight">;
|
||||
type MsgTransferRequiredToken = OmmitedMsgTransfer & Required<Pick<OmmitedMsgTransfer, "token">>;
|
||||
|
||||
export interface TxMsgTransfer extends MsgTransferEncodeObject {
|
||||
readonly value: Readonly<MsgTransferRequiredToken>;
|
||||
export interface TxMsgTransfer {
|
||||
readonly typeUrl: "/ibc.applications.transfer.v1.MsgTransfer";
|
||||
readonly value: MsgTransfer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user