1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

fetch datatoken symbol in transaction history

This commit is contained in:
Matthias Kretschmann 2020-10-05 17:05:21 +02:00
parent 55fad1ee92
commit 6eff6883af
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -16,15 +16,25 @@ function Empty() {
return <div className={styles.empty}>No results found</div> return <div className={styles.empty}>No results found</div>
} }
const columns = [ function Title({ row }: { row: PoolTransaction }) {
{ const { ocean } = useOcean()
name: 'Title', const [dtSymbol, setDtSymbol] = useState<string>()
selector: function getTitleRow(row: PoolTransaction) {
// TODO: replace hardcoded symbol with symbol fetching based
// on row.tonenIn & row.tokenOut
const title = row.tokenAmountIn const title = row.tokenAmountIn
? `Add ${row.tokenAmountIn} OCEAN` ? `Add ${row.tokenAmountIn} ${dtSymbol || 'OCEAN'}`
: `Remove ${row.tokenAmountOut} OCEAN` : `Remove ${row.tokenAmountOut} ${dtSymbol || 'OCEAN'}`
useEffect(() => {
if (!ocean) return
async function getSymbol() {
const symbol = await ocean.datatokens.getSymbol(
row.tokenIn || row.tokenOut
)
setDtSymbol(symbol)
}
getSymbol()
}, [ocean, row])
return ( return (
<EtherscanLink network="rinkeby" path={`/tx/${row.transactionHash}`}> <EtherscanLink network="rinkeby" path={`/tx/${row.transactionHash}`}>
@ -32,6 +42,13 @@ const columns = [
</EtherscanLink> </EtherscanLink>
) )
} }
const columns = [
{
name: 'Title',
selector: function getTitleRow(row: PoolTransaction) {
return <Title row={row} />
}
}, },
{ {
name: 'Data Set', name: 'Data Set',