Use new hook in dataViews
This commit is contained in:
parent
a26efde7d5
commit
166db9a758
@ -1,16 +1,16 @@
|
||||
import { useAppContext } from "../../context/AppContext";
|
||||
import { useChains } from "../../context/ChainsContext";
|
||||
import { explorerLinkTx } from "../../lib/displayHelpers";
|
||||
import Button from "../inputs/Button";
|
||||
import StackableContainer from "../layout/StackableContainer";
|
||||
import HashView from "./HashView";
|
||||
|
||||
interface Props {
|
||||
transactionHash: string;
|
||||
interface CompletedTransactionProps {
|
||||
readonly transactionHash: string;
|
||||
}
|
||||
|
||||
const CompletedTransaction = ({ transactionHash }: Props) => {
|
||||
const { state } = useAppContext();
|
||||
const baseURL = state.chain.explorerLink ? state.chain.explorerLink : "";
|
||||
const CompletedTransaction = ({ transactionHash }: CompletedTransactionProps) => {
|
||||
const { chain } = useChains();
|
||||
const baseURL = chain.explorerLink ? chain.explorerLink : "";
|
||||
const explorerLink = explorerLinkTx(baseURL, transactionHash);
|
||||
return (
|
||||
<StackableContainer lessPadding lessMargin>
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import { Coin } from "cosmjs-types/cosmos/base/v1beta1/coin";
|
||||
import { useAppContext } from "../../context/AppContext";
|
||||
import { useChains } from "../../context/ChainsContext";
|
||||
import { printableCoin } from "../../lib/displayHelpers";
|
||||
import StackableContainer from "../layout/StackableContainer";
|
||||
|
||||
interface Props {
|
||||
holdings: readonly Coin[];
|
||||
interface MultisigHoldingsProps {
|
||||
readonly holdings: readonly Coin[];
|
||||
}
|
||||
|
||||
const MultisigHoldings = (props: Props) => {
|
||||
const { state } = useAppContext();
|
||||
const MultisigHoldings = (props: MultisigHoldingsProps) => {
|
||||
const { chain } = useChains();
|
||||
return (
|
||||
<StackableContainer lessPadding fullHeight>
|
||||
<h2>Holdings</h2>
|
||||
@ -16,7 +16,7 @@ const MultisigHoldings = (props: Props) => {
|
||||
{props.holdings.length ? (
|
||||
props.holdings.map((holding) => (
|
||||
<StackableContainer key={holding.denom} lessPadding lessMargin>
|
||||
<span>{printableCoin(holding, state.chain)}</span>
|
||||
<span>{printableCoin(holding, chain)}</span>
|
||||
</StackableContainer>
|
||||
))
|
||||
) : (
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { MsgCreateVestingAccount } from "cosmjs-types/cosmos/vesting/v1beta1/tx";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { useChains } from "../../../context/ChainsContext";
|
||||
import { printableCoins } from "../../../lib/displayHelpers";
|
||||
import HashView from "../HashView";
|
||||
|
||||
@ -8,7 +8,7 @@ interface TxMsgCreateVestingAccountDetailsProps {
|
||||
}
|
||||
|
||||
const TxMsgCreateVestingAccountDetails = ({ msgValue }: TxMsgCreateVestingAccountDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
const { chain } = useChains();
|
||||
const endTimeDateObj = new Date(msgValue.endTime.multiply(1000).toNumber());
|
||||
const endTimeDate = endTimeDateObj.toLocaleDateString();
|
||||
const endTimeHours = endTimeDateObj.toLocaleTimeString().slice(0, -3);
|
||||
@ -20,7 +20,7 @@ const TxMsgCreateVestingAccountDetails = ({ msgValue }: TxMsgCreateVestingAccoun
|
||||
</li>
|
||||
<li>
|
||||
<label>Amount:</label>
|
||||
<div>{printableCoins(msgValue.amount, state.chain)}</div>
|
||||
<div>{printableCoins(msgValue.amount, chain)}</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>From:</label>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { useChains } from "../../../context/ChainsContext";
|
||||
import { printableCoin } from "../../../lib/displayHelpers";
|
||||
import HashView from "../HashView";
|
||||
|
||||
@ -9,7 +9,7 @@ interface TxMsgDelegateDetailsProps {
|
||||
}
|
||||
|
||||
const TxMsgDelegateDetails = ({ msgValue }: TxMsgDelegateDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
const { chain } = useChains();
|
||||
assert(
|
||||
msgValue.amount,
|
||||
"Amount must be set, see https://github.com/osmosis-labs/telescope/issues/386",
|
||||
@ -22,7 +22,7 @@ const TxMsgDelegateDetails = ({ msgValue }: TxMsgDelegateDetailsProps) => {
|
||||
</li>
|
||||
<li>
|
||||
<label>Amount:</label>
|
||||
<div>{printableCoin(msgValue.amount, state.chain)}</div>
|
||||
<div>{printableCoin(msgValue.amount, chain)}</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>Validator Address:</label>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import { MsgBeginRedelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { useChains } from "../../../context/ChainsContext";
|
||||
import { printableCoin } from "../../../lib/displayHelpers";
|
||||
import HashView from "../HashView";
|
||||
|
||||
@ -9,7 +9,7 @@ interface TxMsgRedelegateDetailsProps {
|
||||
}
|
||||
|
||||
const TxMsgRedelegateDetails = ({ msgValue }: TxMsgRedelegateDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
const { chain } = useChains();
|
||||
assert(
|
||||
msgValue.amount,
|
||||
"Amount must be set, same as https://github.com/osmosis-labs/telescope/issues/386",
|
||||
@ -22,7 +22,7 @@ const TxMsgRedelegateDetails = ({ msgValue }: TxMsgRedelegateDetailsProps) => {
|
||||
</li>
|
||||
<li>
|
||||
<label>Amount:</label>
|
||||
<div>{printableCoin(msgValue.amount, state.chain)}</div>
|
||||
<div>{printableCoin(msgValue.amount, chain)}</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>Src Validator Address:</label>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { useChains } from "../../../context/ChainsContext";
|
||||
import { printableCoins } from "../../../lib/displayHelpers";
|
||||
import HashView from "../HashView";
|
||||
|
||||
@ -8,7 +8,7 @@ interface TxMsgSendDetailsProps {
|
||||
}
|
||||
|
||||
const TxMsgSendDetails = ({ msgValue }: TxMsgSendDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
const { chain } = useChains();
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -17,7 +17,7 @@ const TxMsgSendDetails = ({ msgValue }: TxMsgSendDetailsProps) => {
|
||||
</li>
|
||||
<li>
|
||||
<label>Amount:</label>
|
||||
<div>{printableCoins(msgValue.amount, state.chain)}</div>
|
||||
<div>{printableCoins(msgValue.amount, chain)}</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>To:</label>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { assert } from "@cosmjs/utils";
|
||||
import { MsgUndelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { useChains } from "../../../context/ChainsContext";
|
||||
import { printableCoin } from "../../../lib/displayHelpers";
|
||||
import HashView from "../HashView";
|
||||
|
||||
@ -9,7 +9,7 @@ interface TxMsgUndelegateDetailsProps {
|
||||
}
|
||||
|
||||
const TxMsgUndelegateDetails = ({ msgValue: msg }: TxMsgUndelegateDetailsProps) => {
|
||||
const { state } = useAppContext();
|
||||
const { chain } = useChains();
|
||||
assert(
|
||||
msg.amount,
|
||||
"Amount must be set, same as https://github.com/osmosis-labs/telescope/issues/386",
|
||||
@ -22,7 +22,7 @@ const TxMsgUndelegateDetails = ({ msgValue: msg }: TxMsgUndelegateDetailsProps)
|
||||
</li>
|
||||
<li>
|
||||
<label>Amount:</label>
|
||||
<div>{printableCoin(msg.amount, state.chain)}</div>
|
||||
<div>{printableCoin(msg.amount, chain)}</div>
|
||||
</li>
|
||||
<li>
|
||||
<label>Validator Address:</label>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { EncodeObject } from "@cosmjs/proto-signing";
|
||||
import { useAppContext } from "../../../context/AppContext";
|
||||
import { useChains } from "../../../context/ChainsContext";
|
||||
import { printableCoins } from "../../../lib/displayHelpers";
|
||||
import { DbTransaction } from "../../../types";
|
||||
import { MsgTypeUrls } from "../../../types/txMsg";
|
||||
@ -41,7 +41,7 @@ interface TransactionInfoProps {
|
||||
}
|
||||
|
||||
const TransactionInfo = ({ tx }: TransactionInfoProps) => {
|
||||
const { state } = useAppContext();
|
||||
const { chain } = useChains();
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -56,7 +56,7 @@ const TransactionInfo = ({ tx }: TransactionInfoProps) => {
|
||||
</li>
|
||||
<li>
|
||||
<label>Fee:</label>
|
||||
<div>{printableCoins(tx.fee.amount, state.chain)}</div>
|
||||
<div>{printableCoins(tx.fee.amount, chain)}</div>
|
||||
</li>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user