forked from tahowallet/extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnfts.ts
93 lines (87 loc) · 1.94 KB
/
nfts.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import {
ETHEREUM,
POLYGON,
OPTIMISM,
ARBITRUM_ONE,
AVALANCHE,
BINANCE_SMART_CHAIN,
} from "./constants"
import { EVMNetwork } from "./networks"
// Networks that are not added to this struct will
// not have an in-wallet NFT tab
export const CHAIN_ID_TO_NFT_METADATA_PROVIDER: {
[chainID: string]: ("simplehash" | "poap")[]
} = {
[ETHEREUM.chainID]: ["simplehash", "poap"],
[POLYGON.chainID]: ["simplehash"],
[OPTIMISM.chainID]: ["simplehash"],
[ARBITRUM_ONE.chainID]: ["simplehash"],
[AVALANCHE.chainID]: ["simplehash"],
[BINANCE_SMART_CHAIN.chainID]: ["simplehash"],
}
export const NFT_PROVIDER_TO_CHAIN = {
poap: [ETHEREUM.chainID],
simplehash: [
ETHEREUM.chainID,
POLYGON.chainID,
OPTIMISM.chainID,
ARBITRUM_ONE.chainID,
AVALANCHE.chainID,
BINANCE_SMART_CHAIN.chainID,
],
}
export const NETWORKS_SUPPORTING_NFTS = new Set(
Object.keys(CHAIN_ID_TO_NFT_METADATA_PROVIDER)
)
export type NFTsWithPagesResponse = {
nfts: NFT[]
nextPageURL: string | null
}
export type NFT = {
id: string
tokenId: string
collectionID: string
name: string
description: string
thumbnailURL?: string
previewURL?: string
transferDate?: string
attributes: { trait: string; value: string }[]
rarity: {
rank?: number
score?: number
uniqueAttributes?: number
}
contract: string
owner: string
network: EVMNetwork
supply?: number // only for POAPs
isBadge: boolean // POAPs, Galxe NFTs and OATs
}
export type NFTCollection = {
id: string
name: string
owner: string
network: EVMNetwork
hasBadges: boolean
thumbnailURL?: string
nftCount?: number
totalNftCount?: number
floorPrice?: {
value: bigint
token: {
name: string
symbol: string
decimals: number
}
}
}
export type TransferredNFT = {
id: string
chainID: string
from: string | null
to: string | null
isKnownFromAddress: boolean
isKnownToAddress: boolean
collectionID: string | null
}