mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 09:44:53 +01:00
refactor
This commit is contained in:
parent
fcc8bc2896
commit
9911c458a7
@ -7,11 +7,7 @@ import EtherscanLink from '../../atoms/EtherscanLink'
|
|||||||
import Time from '../../atoms/Time'
|
import Time from '../../atoms/Time'
|
||||||
import styles from './PoolTransactions.module.css'
|
import styles from './PoolTransactions.module.css'
|
||||||
|
|
||||||
export default function PoolTransactions(): ReactElement {
|
const columns = [
|
||||||
const { ocean, accountId } = useOcean()
|
|
||||||
const [logs, setLogs] = useState<PoolTransaction[]>()
|
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{
|
{
|
||||||
name: 'Title',
|
name: 'Title',
|
||||||
selector: function getTitleRow(row: PoolTransaction) {
|
selector: function getTitleRow(row: PoolTransaction) {
|
||||||
@ -44,23 +40,24 @@ export default function PoolTransactions(): ReactElement {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export default function PoolTransactions(): ReactElement {
|
||||||
|
const { ocean, accountId } = useOcean()
|
||||||
|
const [logs, setLogs] = useState<PoolTransaction[]>()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getLogs() {
|
async function getLogs() {
|
||||||
if (!ocean || !accountId) return
|
if (!ocean || !accountId) return
|
||||||
|
|
||||||
const logs = await ocean.pool.getAllPoolLogs(
|
const logs = await ocean.pool.getAllPoolLogs(accountId)
|
||||||
'0xe08A1dAe983BC701D05E492DB80e0144f8f4b909'
|
// limit to 100 latest transactions for now
|
||||||
)
|
setLogs(logs.slice(0, 99))
|
||||||
// limit to 20 latest transactions for now
|
|
||||||
setLogs(logs.slice(0, 19))
|
|
||||||
}
|
}
|
||||||
getLogs()
|
getLogs()
|
||||||
}, [ocean, accountId])
|
}, [ocean, accountId])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
|
||||||
<DataTable
|
<DataTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={logs}
|
data={logs}
|
||||||
@ -68,6 +65,5 @@ export default function PoolTransactions(): ReactElement {
|
|||||||
noHeader
|
noHeader
|
||||||
pagination
|
pagination
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user