-
Notifications
You must be signed in to change notification settings - Fork 370
/
Copy pathtokenUtil.ts
54 lines (50 loc) · 1.07 KB
/
tokenUtil.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
export type EIP155Token = {
name: string
icon: string
assetAddress?: string
symbol: string
decimals: number
}
const ALL_TOKENS: EIP155Token[] = [
{
name: 'USDC',
icon: '/token-logos/USDC.png',
symbol: 'USDC',
decimals: 6
},
{
name: 'USDT',
icon: '/token-logos/USDT.png',
symbol: 'USDT',
decimals: 6
},
{
name: 'ETH',
icon: '/token-logos/ETH.png',
symbol: 'ETH',
decimals: 18
},
{
name: 'SOL',
icon: '/token-logos/SOL.png',
symbol: 'SOL',
decimals: 9
}
]
export function getTokenData(tokenSymbol: string) {
return Object.values(ALL_TOKENS).find(token => token.symbol === tokenSymbol)
}
const SOLANA_KNOWN_TOKENS = [
{
name: 'USDC',
icon: '/token-logos/USDC.png',
symbol: 'USDC',
decimals: 6,
assetAddress: [
'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1/token:4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU'
]
}
]
export function getSolanaTokenData(caip19AssetAddress: string) {
return SOLANA_KNOWN_TOKENS.find(token => token.assetAddress.includes(caip19AssetAddress))
}