From f9735d689dea20cf3bd6a7d603443e362dd4e44f Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 30 Sep 2020 12:50:59 +0200 Subject: [PATCH] refactor for new data structure --- .../pages/History/PoolTransactions.tsx | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/components/pages/History/PoolTransactions.tsx b/src/components/pages/History/PoolTransactions.tsx index d109abd5f..57dc53ade 100644 --- a/src/components/pages/History/PoolTransactions.tsx +++ b/src/components/pages/History/PoolTransactions.tsx @@ -1,46 +1,47 @@ -import { - PoolAction, - PoolLogs -} from '@oceanprotocol/lib/dist/node/balancer/OceanPool' +import { PoolTransaction } from '@oceanprotocol/lib/dist/node/balancer/OceanPool' import { useOcean } from '@oceanprotocol/react' import React, { ReactElement, useEffect, useState } from 'react' import DataTable from 'react-data-table-component' -const data: PoolLogs = { - joins: [ - { - poolAddress: '0xxxxx', - caller: '', - transactionHash: '0xxxxx', - blockNumber: 2, - tokenIn: 'OCEAN', - tokenAmountIn: '10' - } - ], - exits: [], - swaps: [] -} +const data: PoolTransaction[] = [ + { + poolAddress: '0xxxxx', + dtAddress: '0xxxxx', + caller: '0xxxxx', + transactionHash: '0xxxxx', + blockNumber: 2, + timestamp: 1, + tokenIn: 'OCEAN', + tokenAmountIn: '10', + type: 'join' + } +] const columns = [ { name: 'Title', - selector: (row: PoolAction) => `Add ${row.tokenAmountIn} ${row.tokenIn}` + selector: (row: PoolTransaction) => + `Add ${row.tokenAmountIn} ${row.tokenIn}` }, { name: 'Pool', selector: 'poolAddress' + }, + { + name: 'Account', + selector: 'caller' } ] export default function PoolTransactions(): ReactElement { const { ocean, accountId } = useOcean() - const [logs, setLogs] = useState() + const [logs, setLogs] = useState() useEffect(() => { async function getLogs() { if (!ocean || !accountId) return - const logs = await ocean.pool.getAllPoolLogs(accountId, true, true, true) + const logs = await ocean.pool.getAllPoolLogs(accountId) setLogs(logs) } getLogs() @@ -48,7 +49,7 @@ export default function PoolTransactions(): ReactElement { return (
- +
         {JSON.stringify(logs, null, 2)}