Created a new route for pending transactions to live for now

This commit is contained in:
sam-keen 2022-03-02 14:37:44 +00:00 committed by Dexter Edwards
parent 4981b9fc4d
commit ac961b6058
3 changed files with 43 additions and 21 deletions

View File

@ -0,0 +1,29 @@
import React from 'react';
import { DATA_SOURCES } from '../../config';
import useFetch from '../../hooks/use-fetch';
import { TendermintUnconfirmedTransactionsResponse } from '../txs/tendermint-unconfirmed-transactions-response.d';
import { TxList } from '../../components/txs';
const PendingTxs = () => {
const {
state: { data: unconfirmedTransactions },
} = useFetch<TendermintUnconfirmedTransactionsResponse>(
`${DATA_SOURCES.tendermintUrl}/unconfirmed_txs`
);
return (
<section>
<h1>Unconfirmed transactions</h1>
https://lb.testnet.vega.xyz/tm/unconfirmed_txs
<br />
<div>Number: {unconfirmedTransactions?.result?.n_txs || 0}</div>
<br />
<div>
<br />
<TxList data={unconfirmedTransactions} />
</div>
</section>
);
};
export { PendingTxs };

View File

@ -14,10 +14,12 @@ import { Block } from './blocks/id';
import { Blocks } from './blocks/home'; import { Blocks } from './blocks/home';
import { Tx } from './txs/id'; import { Tx } from './txs/id';
import { Txs as TxHome } from './txs/home'; import { Txs as TxHome } from './txs/home';
import { PendingTxs } from './pending';
export const Routes = { export const Routes = {
HOME: '/', HOME: '/',
TX: 'txs', TX: 'txs',
PENDING: 'pending',
BLOCKS: 'blocks', BLOCKS: 'blocks',
PARTIES: 'parties', PARTIES: 'parties',
VALIDATORS: 'validators', VALIDATORS: 'validators',
@ -50,6 +52,17 @@ const routerConfig = [
}, },
], ],
}, },
{
path: Routes.PENDING,
name: 'Pending txs',
element: <Txs />,
children: [
{
index: true,
element: <PendingTxs />,
},
],
},
{ {
path: Routes.BLOCKS, path: Routes.BLOCKS,
name: 'Blocks', name: 'Blocks',

View File

@ -1,27 +1,7 @@
import React from 'react';
import { DATA_SOURCES } from '../../../config';
import useFetch from '../../../hooks/use-fetch';
import { TendermintUnconfirmedTransactionsResponse } from '../tendermint-unconfirmed-transactions-response.d';
import { TxList } from '../../../components/txs';
const Txs = () => { const Txs = () => {
const {
state: { data: unconfirmedTransactions },
} = useFetch<TendermintUnconfirmedTransactionsResponse>(
`${DATA_SOURCES.tendermintUrl}/unconfirmed_txs`
);
return ( return (
<section> <section>
<h1>Unconfirmed transactions</h1> <h1>Transactions</h1>
https://lb.testnet.vega.xyz/tm/unconfirmed_txs
<br />
<div>Number: {unconfirmedTransactions?.result?.n_txs || 0}</div>
<br />
<div>
<br />
<TxList data={unconfirmedTransactions} />
</div>
</section> </section>
); );
}; };