forked from ethereum-optimism/ethereum-optimism.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschemas.ts
90 lines (87 loc) · 1.74 KB
/
schemas.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
export const ADDRESS_TYPE = {
type: 'string',
minLength: 42,
maxLength: 42,
}
export const TOKEN_SCHEMA = {
type: 'object',
properties: {
address: ADDRESS_TYPE,
overrides: {
bridge: ADDRESS_TYPE,
name: {
type: 'string',
},
symbol: {
type: 'string',
pattern: '^\\S+$' // allow unicode
},
decimals: {
type: 'integer',
},
},
},
additionalProperties: false,
required: ['address'],
}
export const TOKEN_DATA_SCHEMA = {
type: 'object',
properties: {
nonstandard: {
type: 'boolean',
},
nobridge: {
type: 'boolean',
},
name: {
type: 'string',
},
symbol: {
type: 'string',
},
decimals: {
type: 'integer',
},
description: {
type: 'string',
minLength: 1,
maxLength: 1000,
},
website: {
type: 'string',
format: 'uri',
},
twitter: {
type: 'string',
},
tokens: {
type: 'object',
properties: {
ethereum: TOKEN_SCHEMA,
optimism: TOKEN_SCHEMA,
base: TOKEN_SCHEMA,
mode: TOKEN_SCHEMA,
pgn: TOKEN_SCHEMA,
sepolia: TOKEN_SCHEMA,
'base-sepolia': TOKEN_SCHEMA,
'optimism-sepolia': TOKEN_SCHEMA,
},
additionalProperties: false,
anyOf: [
{ required: ['ethereum'] },
{ required: ['optimism'] },
{ required: ['base'] },
{ required: ['mode'] },
{ required: ['pgn'] },
{ required: ['sepolia'] },
{ required: ['base-sepolia'] },
{ required: ['optimism-sepolia'] },
],
},
},
additionalProperties: false,
required: ['name', 'symbol', 'decimals', 'tokens'],
}
export default {
TOKEN_DATA_SCHEMA,
}