forked from ethereum-optimism/ethereum-optimism.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
71 lines (61 loc) · 1.58 KB
/
types.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
import { providers } from 'ethers'
export interface Token {
address: string
overrides?: {
// This is set to a string for l2 tokens and a map for
// l1 tokens in order to map from l1 to the appropriate
// l2 bridge.
bridge?: string | Partial<Record<L2Chain, string>>
name?: string
symbol?: string
decimals?: number
}
}
/*
* Supported chains for the tokenlist
* If adding a new chain consider keeping the name
* consistent with wagmi
* @see https://github.com/wagmi-dev/references/blob/main/packages/chains/src/optimismGoerli.ts
*/
export type Chain =
| 'ethereum'
| 'optimism'
| 'base'
| 'optimism-sepolia'
| 'base-sepolia'
| 'pgn'
| 'pgn-sepolia'
| 'sepolia'
| 'mode'
const l2Chains = ['optimism', 'optimism-sepolia', 'base', 'base-sepolia', 'pgn-sepolia', 'pgn', 'mode'] as const
export type L2Chain = typeof l2Chains[number]
export const isL2Chain = (chain: string): chain is L2Chain => {
return l2Chains.includes(chain as L2Chain)
}
export const isL1Chain = (chain: string): chain is L1Chain => !isL2Chain(chain)
export type L1Chain = 'ethereum' | 'sepolia'
export interface TokenData {
nonstandard?: boolean
nobridge?: boolean
twitter?: string
name: string
symbol: string
decimals: number
description: string
website: string
tokens: Partial<Record<Chain, Token>>
}
export interface ExpectedMismatches {
symbol?: string
name?: string
}
export interface ValidationResult {
type: 'error' | 'warning'
message: string
}
export interface Network {
id: number
name: string
provider: providers.BaseProvider
layer: number
}