|
|
@ -3,10 +3,13 @@ import React, { useEffect, useState } from "react"; |
|
|
|
import { getERC20TokenHolders } from "src/api/client"; |
|
|
|
import { getERC20TokenHolders } from "src/api/client"; |
|
|
|
import { IHoldersInfo, IUserERC721Assets } from "src/api/client.interface"; |
|
|
|
import { IHoldersInfo, IUserERC721Assets } from "src/api/client.interface"; |
|
|
|
import { TransactionsTable } from "src/components/tables/TransactionsTable"; |
|
|
|
import { TransactionsTable } from "src/components/tables/TransactionsTable"; |
|
|
|
import { Address } from "src/components/ui"; |
|
|
|
import { Address, TokenValue } from "src/components/ui"; |
|
|
|
|
|
|
|
import { useERC1155Pool } from "src/hooks/ERC1155_Pool"; |
|
|
|
|
|
|
|
import { useERC20Pool } from "src/hooks/ERC20_Pool"; |
|
|
|
|
|
|
|
import { useERC721Pool } from "src/hooks/ERC721_Pool"; |
|
|
|
import { Filter } from "src/types"; |
|
|
|
import { Filter } from "src/types"; |
|
|
|
|
|
|
|
|
|
|
|
const getColumns = (): ColumnConfig<IHoldersInfo>[] => { |
|
|
|
const getColumns = (id: string): ColumnConfig<IHoldersInfo>[] => { |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
property: "ownerAddres", |
|
|
|
property: "ownerAddres", |
|
|
@ -33,21 +36,8 @@ const getColumns = (): ColumnConfig<IHoldersInfo>[] => { |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
), |
|
|
|
), |
|
|
|
render: (data) => ( |
|
|
|
render: (data) => ( |
|
|
|
<Text size="small" style={{ width: "140px" }}> |
|
|
|
<Text size="small" style={{ width: "140px" }}>
|
|
|
|
{data.balance} |
|
|
|
<TokenValue value={data.balance} tokenAddress={id} />
|
|
|
|
</Text> |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
property: "Updated", |
|
|
|
|
|
|
|
header: ( |
|
|
|
|
|
|
|
<Text color="minorText" size="small" style={{ fontWeight: 300 }}> |
|
|
|
|
|
|
|
Updated |
|
|
|
|
|
|
|
</Text> |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
render: (data) => ( |
|
|
|
|
|
|
|
<Text size="12px"> |
|
|
|
|
|
|
|
{data.lastUpdateBlockNumber ? data.lastUpdateBlockNumber : "—"} |
|
|
|
|
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
), |
|
|
|
), |
|
|
|
}, |
|
|
|
}, |
|
|
@ -59,6 +49,16 @@ export function HoldersTab(props: { |
|
|
|
type: "erc20" | "erc721" | "erc1155"; |
|
|
|
type: "erc20" | "erc721" | "erc1155"; |
|
|
|
inventory?: IUserERC721Assets[]; |
|
|
|
inventory?: IUserERC721Assets[]; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const erc20Map = useERC20Pool(); |
|
|
|
|
|
|
|
const erc721Map = useERC721Pool(); |
|
|
|
|
|
|
|
const erc1155Map = useERC1155Pool(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const holdersTotal = |
|
|
|
|
|
|
|
erc20Map[props.id]?.holders || |
|
|
|
|
|
|
|
erc721Map[props.id]?.holders || |
|
|
|
|
|
|
|
erc1155Map[props.id]?.holders; |
|
|
|
|
|
|
|
|
|
|
|
const limitValue = localStorage.getItem("tableLimitValue"); |
|
|
|
const limitValue = localStorage.getItem("tableLimitValue"); |
|
|
|
|
|
|
|
|
|
|
|
const initFilter: Partial<Filter> = { |
|
|
|
const initFilter: Partial<Filter> = { |
|
|
@ -128,14 +128,17 @@ export function HoldersTab(props: { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Box style={{ padding: "10px" }}> |
|
|
|
<Box style={{ padding: "10px" }}> |
|
|
|
<TransactionsTable |
|
|
|
<TransactionsTable |
|
|
|
columns={getColumns()} |
|
|
|
columns={getColumns(props.id)} |
|
|
|
filter={filter} |
|
|
|
filter={filter} |
|
|
|
|
|
|
|
hideCounter={false} |
|
|
|
setFilter={setFilter} |
|
|
|
setFilter={setFilter} |
|
|
|
limit={filter.limit || 10} |
|
|
|
limit={filter.limit || 10} |
|
|
|
data={holders} |
|
|
|
data={holders} |
|
|
|
totalElements={filter.limit || 10} |
|
|
|
totalElements={+holdersTotal} |
|
|
|
noScrollTop |
|
|
|
noScrollTop |
|
|
|
minWidth="1266px" |
|
|
|
minWidth="1266px" |
|
|
|
|
|
|
|
showPages={true} |
|
|
|
|
|
|
|
textType={'holder'}
|
|
|
|
/> |
|
|
|
/> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
); |
|
|
|
); |
|
|
|