@swapkit/types 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/types/chains/_enums.d.ts +13 -9
- package/dist/types/chains/_enums.d.ts.map +1 -1
- package/dist/types/chains/evm.d.ts +29 -1
- package/dist/types/chains/evm.d.ts.map +1 -1
- package/dist/types/chains/index.d.ts +29 -1
- package/dist/types/chains/index.d.ts.map +1 -1
- package/package.json +8 -3
- package/src/chains/_createChain.ts +22 -0
- package/src/chains/_enums.ts +105 -0
- package/src/chains/cosmos.ts +159 -0
- package/src/chains/evm.ts +346 -0
- package/src/chains/index.ts +149 -0
- package/src/chains/others.ts +130 -0
- package/src/chains/substrate.ts +51 -0
- package/src/chains/utxo.ts +93 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { createChain } from "./_createChain";
|
|
2
|
+
import { Chain, ChainId } from "./_enums";
|
|
3
|
+
|
|
4
|
+
const type = "evm";
|
|
5
|
+
const baseDecimal = 18;
|
|
6
|
+
const networkDerivationPath = [44, 60, 0, 0, 0] as [number, number, number, number, number];
|
|
7
|
+
|
|
8
|
+
const ETHConfig = createChain({
|
|
9
|
+
baseDecimal,
|
|
10
|
+
blockTime: 12.5,
|
|
11
|
+
chain: Chain.Ethereum,
|
|
12
|
+
chainId: ChainId.Ethereum,
|
|
13
|
+
chainIdHex: "0x1",
|
|
14
|
+
explorerUrl: "https://etherscan.io",
|
|
15
|
+
name: "Ethereum",
|
|
16
|
+
nativeCurrency: "ETH",
|
|
17
|
+
networkDerivationPath,
|
|
18
|
+
rpcUrls: ["https://ethereum-rpc.publicnode.com", "https://eth.llamarpc.com", "https://cloudflare-eth.com"],
|
|
19
|
+
type,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const BSCConfig = createChain({
|
|
23
|
+
baseDecimal,
|
|
24
|
+
blockTime: 1,
|
|
25
|
+
chain: Chain.BinanceSmartChain,
|
|
26
|
+
chainId: ChainId.BinanceSmartChain,
|
|
27
|
+
chainIdHex: "0x38",
|
|
28
|
+
explorerUrl: "https://bscscan.com",
|
|
29
|
+
name: "BinanceSmartChain",
|
|
30
|
+
nativeCurrency: "BNB",
|
|
31
|
+
networkDerivationPath,
|
|
32
|
+
rpcUrls: [
|
|
33
|
+
"https://bsc-dataseed.binance.org",
|
|
34
|
+
"https://bsc-rpc.gateway.pokt.network",
|
|
35
|
+
"https://bsc-dataseed2.binance.org",
|
|
36
|
+
],
|
|
37
|
+
type,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const AVAXConfig = createChain({
|
|
41
|
+
baseDecimal,
|
|
42
|
+
blockTime: 2,
|
|
43
|
+
chain: Chain.Avalanche,
|
|
44
|
+
chainId: ChainId.Avalanche,
|
|
45
|
+
chainIdHex: "0xa86a",
|
|
46
|
+
explorerUrl: "https://snowtrace.io",
|
|
47
|
+
name: "Avalanche",
|
|
48
|
+
nativeCurrency: "AVAX",
|
|
49
|
+
networkDerivationPath,
|
|
50
|
+
rpcUrls: [
|
|
51
|
+
"https://api.avax.network/ext/bc/C/rpc",
|
|
52
|
+
"https://api.avax.network/ext/bc/C/rpc",
|
|
53
|
+
"https://avalanche-c-chain-rpc.publicnode.com",
|
|
54
|
+
],
|
|
55
|
+
type,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const POLConfig = createChain({
|
|
59
|
+
baseDecimal,
|
|
60
|
+
blockTime: 2.1,
|
|
61
|
+
chain: Chain.Polygon,
|
|
62
|
+
chainId: ChainId.Polygon,
|
|
63
|
+
chainIdHex: "0x89",
|
|
64
|
+
explorerUrl: "https://polygonscan.com",
|
|
65
|
+
name: "Polygon",
|
|
66
|
+
nativeCurrency: "POL",
|
|
67
|
+
networkDerivationPath,
|
|
68
|
+
rpcUrls: ["https://polygon-rpc.com", "https://polygon.llamarpc.com", "https://polygon-bor-rpc.publicnode.com"],
|
|
69
|
+
type,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const ARBConfig = createChain({
|
|
73
|
+
baseDecimal,
|
|
74
|
+
blockTime: 0.3,
|
|
75
|
+
chain: Chain.Arbitrum,
|
|
76
|
+
chainId: ChainId.Arbitrum,
|
|
77
|
+
chainIdHex: "0xa4b1",
|
|
78
|
+
explorerUrl: "https://arbiscan.io",
|
|
79
|
+
name: "Arbitrum",
|
|
80
|
+
nativeCurrency: "ETH",
|
|
81
|
+
networkDerivationPath,
|
|
82
|
+
rpcUrls: [
|
|
83
|
+
"https://arb1.arbitrum.io/rpc",
|
|
84
|
+
"https://arb-mainnet.g.alchemy.com/v2/demo",
|
|
85
|
+
"https://arbitrum.blockpi.network/v1/rpc/public",
|
|
86
|
+
],
|
|
87
|
+
type,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const OPConfig = createChain({
|
|
91
|
+
baseDecimal,
|
|
92
|
+
blockTime: 2,
|
|
93
|
+
chain: Chain.Optimism,
|
|
94
|
+
chainId: ChainId.Optimism,
|
|
95
|
+
chainIdHex: "0xa",
|
|
96
|
+
explorerUrl: "https://optimistic.etherscan.io",
|
|
97
|
+
name: "Optimism",
|
|
98
|
+
nativeCurrency: "ETH",
|
|
99
|
+
networkDerivationPath,
|
|
100
|
+
rpcUrls: ["https://mainnet.optimism.io", "https://optimism.llamarpc.com", "https://1rpc.io/op"],
|
|
101
|
+
type,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const BASEConfig = createChain({
|
|
105
|
+
baseDecimal,
|
|
106
|
+
blockTime: 2,
|
|
107
|
+
chain: Chain.Base,
|
|
108
|
+
chainId: ChainId.Base,
|
|
109
|
+
chainIdHex: "0x2105",
|
|
110
|
+
explorerUrl: "https://basescan.org",
|
|
111
|
+
name: "Base",
|
|
112
|
+
nativeCurrency: "ETH",
|
|
113
|
+
networkDerivationPath,
|
|
114
|
+
rpcUrls: ["https://base-rpc.publicnode.com", "https://base.blockpi.network/v1/rpc/public", "https://1rpc.io/base"],
|
|
115
|
+
type,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const GNOConfig = createChain({
|
|
119
|
+
baseDecimal,
|
|
120
|
+
blockTime: 5.2,
|
|
121
|
+
chain: Chain.Gnosis,
|
|
122
|
+
chainId: ChainId.Gnosis,
|
|
123
|
+
chainIdHex: "0x64",
|
|
124
|
+
explorerUrl: "https://gnosisscan.io",
|
|
125
|
+
name: "Gnosis",
|
|
126
|
+
nativeCurrency: "xDAI",
|
|
127
|
+
networkDerivationPath,
|
|
128
|
+
rpcUrls: ["https://gnosis-rpc.publicnode.com", "https://gnosis.drpc.org", "https://rpc.ankr.com/gnosis"],
|
|
129
|
+
type,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const AURORAConfig = createChain({
|
|
133
|
+
baseDecimal,
|
|
134
|
+
blockTime: 1,
|
|
135
|
+
chain: Chain.Aurora,
|
|
136
|
+
chainId: ChainId.Aurora,
|
|
137
|
+
chainIdHex: "0x4e454152",
|
|
138
|
+
explorerUrl: "https://explorer.mainnet.aurora.dev",
|
|
139
|
+
name: "Aurora",
|
|
140
|
+
nativeCurrency: "ETH",
|
|
141
|
+
networkDerivationPath,
|
|
142
|
+
rpcUrls: ["https://aurora-rpc.publicnode.com", "https://1rpc.io/aurora", "https://mainnet.aurora.dev"],
|
|
143
|
+
type,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const BERAConfig = createChain({
|
|
147
|
+
baseDecimal,
|
|
148
|
+
blockTime: 2,
|
|
149
|
+
chain: Chain.Berachain,
|
|
150
|
+
chainId: ChainId.Berachain,
|
|
151
|
+
chainIdHex: "0x138de",
|
|
152
|
+
explorerUrl: "https://berascan.com",
|
|
153
|
+
name: "Berachain",
|
|
154
|
+
nativeCurrency: "BERA",
|
|
155
|
+
networkDerivationPath,
|
|
156
|
+
rpcUrls: ["https://berachain-rpc.publicnode.com", "https://rpc.berachain.com", "https://berachain.drpc.org"],
|
|
157
|
+
type,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
const HYPEREVMConfig = createChain({
|
|
161
|
+
baseDecimal,
|
|
162
|
+
blockTime: 1,
|
|
163
|
+
chain: Chain.Hyperevm,
|
|
164
|
+
chainId: ChainId.Hyperevm,
|
|
165
|
+
chainIdHex: "0x3e7",
|
|
166
|
+
explorerUrl: "https://app.hyperliquid.xyz/explorer",
|
|
167
|
+
name: "Hyperliquid",
|
|
168
|
+
nativeCurrency: "HYPE",
|
|
169
|
+
networkDerivationPath,
|
|
170
|
+
rpcUrls: ["https://rpc.hyperliquid.xyz/evm", "https://rpc.hypurrscan.io"],
|
|
171
|
+
type,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const UNIConfig = createChain({
|
|
175
|
+
baseDecimal,
|
|
176
|
+
blockTime: 2,
|
|
177
|
+
chain: Chain.Unichain,
|
|
178
|
+
chainId: ChainId.Unichain,
|
|
179
|
+
chainIdHex: "0x82",
|
|
180
|
+
explorerUrl: "https://unichain.blockscout.com",
|
|
181
|
+
name: "Unichain",
|
|
182
|
+
nativeCurrency: "ETH",
|
|
183
|
+
networkDerivationPath,
|
|
184
|
+
rpcUrls: ["https://unichain-rpc.publicnode.com", "https://unichain.drpc.org"],
|
|
185
|
+
type,
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const CORNConfig = createChain({
|
|
189
|
+
baseDecimal,
|
|
190
|
+
blockTime: 2,
|
|
191
|
+
chain: Chain.Corn,
|
|
192
|
+
chainId: ChainId.Corn,
|
|
193
|
+
chainIdHex: "0x1406f40",
|
|
194
|
+
explorerUrl: "https://cornscan.io",
|
|
195
|
+
name: "Corn",
|
|
196
|
+
nativeCurrency: "BTCN",
|
|
197
|
+
networkDerivationPath,
|
|
198
|
+
rpcUrls: ["https://mainnet.corn-rpc.com", "https://rpc.ankr.com/corn_maizenet"],
|
|
199
|
+
type,
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const COREConfig = createChain({
|
|
203
|
+
baseDecimal,
|
|
204
|
+
blockTime: 2,
|
|
205
|
+
chain: Chain.Core,
|
|
206
|
+
chainId: ChainId.Core,
|
|
207
|
+
chainIdHex: "0x45c",
|
|
208
|
+
explorerUrl: "https://corescan.io",
|
|
209
|
+
name: "Core",
|
|
210
|
+
nativeCurrency: "CORE",
|
|
211
|
+
networkDerivationPath,
|
|
212
|
+
rpcUrls: ["https://core-rpc.publicnode.com", "https://1rpc.io/core"],
|
|
213
|
+
type,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const BOTANIXConfig = createChain({
|
|
217
|
+
baseDecimal,
|
|
218
|
+
blockTime: 2,
|
|
219
|
+
chain: Chain.Botanix,
|
|
220
|
+
chainId: ChainId.Botanix,
|
|
221
|
+
chainIdHex: "0xe35",
|
|
222
|
+
explorerUrl: "https://botanixscan.io",
|
|
223
|
+
name: "Botanix",
|
|
224
|
+
nativeCurrency: "BTC",
|
|
225
|
+
networkDerivationPath,
|
|
226
|
+
rpcUrls: ["https://core.drpc.org", "https://1rpc.io/core"],
|
|
227
|
+
type,
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
const CROConfig = createChain({
|
|
231
|
+
baseDecimal,
|
|
232
|
+
blockTime: 2,
|
|
233
|
+
chain: Chain.Cronos,
|
|
234
|
+
chainId: ChainId.Cronos,
|
|
235
|
+
chainIdHex: "0x19",
|
|
236
|
+
explorerUrl: "https://croscan.io",
|
|
237
|
+
name: "Cronos",
|
|
238
|
+
nativeCurrency: "CRO",
|
|
239
|
+
networkDerivationPath,
|
|
240
|
+
rpcUrls: ["https://rpc.vvs.finance"],
|
|
241
|
+
type,
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const XLAYERConfig = createChain({
|
|
245
|
+
baseDecimal,
|
|
246
|
+
blockTime: 2,
|
|
247
|
+
chain: Chain.XLayer,
|
|
248
|
+
chainId: ChainId.XLayer,
|
|
249
|
+
chainIdHex: "0xc4",
|
|
250
|
+
explorerUrl: "https://www.oklink.com/x-layer",
|
|
251
|
+
name: "X Layer",
|
|
252
|
+
nativeCurrency: "OKB",
|
|
253
|
+
networkDerivationPath,
|
|
254
|
+
rpcUrls: ["https://xlayerrpc.okx.com"],
|
|
255
|
+
type,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
const SONICConfig = createChain({
|
|
259
|
+
baseDecimal,
|
|
260
|
+
blockTime: 2,
|
|
261
|
+
chain: Chain.Sonic,
|
|
262
|
+
chainId: ChainId.Sonic,
|
|
263
|
+
chainIdHex: "0x92",
|
|
264
|
+
explorerUrl: "https://sonicscan.io",
|
|
265
|
+
name: "Sonic",
|
|
266
|
+
nativeCurrency: "S",
|
|
267
|
+
networkDerivationPath,
|
|
268
|
+
rpcUrls: ["https://rpc.sonic.xyz"],
|
|
269
|
+
type,
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
const MONADConfig = createChain({
|
|
273
|
+
baseDecimal,
|
|
274
|
+
blockTime: 0.4,
|
|
275
|
+
chain: Chain.Monad,
|
|
276
|
+
chainId: ChainId.Monad,
|
|
277
|
+
chainIdHex: "0x8f",
|
|
278
|
+
explorerUrl: "https://monvision.io",
|
|
279
|
+
name: "Monad",
|
|
280
|
+
nativeCurrency: "MON",
|
|
281
|
+
networkDerivationPath,
|
|
282
|
+
rpcUrls: [],
|
|
283
|
+
type,
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
const MEGAETHConfig = createChain({
|
|
287
|
+
baseDecimal,
|
|
288
|
+
blockTime: 0.01,
|
|
289
|
+
chain: Chain.MegaETH,
|
|
290
|
+
chainId: ChainId.MegaETH,
|
|
291
|
+
chainIdHex: "0x10e6",
|
|
292
|
+
explorerUrl: "",
|
|
293
|
+
name: "MegaETH",
|
|
294
|
+
nativeCurrency: "ETH",
|
|
295
|
+
networkDerivationPath,
|
|
296
|
+
rpcUrls: [],
|
|
297
|
+
type,
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
export const EVMChainConfigs = [
|
|
301
|
+
ARBConfig,
|
|
302
|
+
AURORAConfig,
|
|
303
|
+
AVAXConfig,
|
|
304
|
+
BASEConfig,
|
|
305
|
+
BERAConfig,
|
|
306
|
+
BOTANIXConfig,
|
|
307
|
+
BSCConfig,
|
|
308
|
+
COREConfig,
|
|
309
|
+
CORNConfig,
|
|
310
|
+
CROConfig,
|
|
311
|
+
ETHConfig,
|
|
312
|
+
GNOConfig,
|
|
313
|
+
HYPEREVMConfig,
|
|
314
|
+
MEGAETHConfig,
|
|
315
|
+
MONADConfig,
|
|
316
|
+
OPConfig,
|
|
317
|
+
POLConfig,
|
|
318
|
+
SONICConfig,
|
|
319
|
+
UNIConfig,
|
|
320
|
+
XLAYERConfig,
|
|
321
|
+
] as const;
|
|
322
|
+
export const EVMChains = [
|
|
323
|
+
Chain.Arbitrum,
|
|
324
|
+
Chain.Aurora,
|
|
325
|
+
Chain.Avalanche,
|
|
326
|
+
Chain.Base,
|
|
327
|
+
Chain.Berachain,
|
|
328
|
+
Chain.BinanceSmartChain,
|
|
329
|
+
Chain.Botanix,
|
|
330
|
+
Chain.Core,
|
|
331
|
+
Chain.Corn,
|
|
332
|
+
Chain.Corn,
|
|
333
|
+
Chain.Cronos,
|
|
334
|
+
Chain.Ethereum,
|
|
335
|
+
Chain.Gnosis,
|
|
336
|
+
Chain.Hyperevm,
|
|
337
|
+
// TODO: Enable once live
|
|
338
|
+
// Chain.MegaETH,
|
|
339
|
+
// Chain.Monad,
|
|
340
|
+
Chain.Optimism,
|
|
341
|
+
Chain.Polygon,
|
|
342
|
+
Chain.Sonic,
|
|
343
|
+
Chain.Unichain,
|
|
344
|
+
Chain.XLayer,
|
|
345
|
+
] as const;
|
|
346
|
+
export type EVMChain = (typeof EVMChains)[number];
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Chain, type ChainId, StagenetChain } from "./_enums";
|
|
2
|
+
import { CosmosChainConfigs, StagenetMAYAConfig, StagenetTHORConfig } from "./cosmos";
|
|
3
|
+
import { EVMChainConfigs } from "./evm";
|
|
4
|
+
import { OtherChainConfigs } from "./others";
|
|
5
|
+
import { SubstrateChainConfigs } from "./substrate";
|
|
6
|
+
import { UTXOChainConfigs } from "./utxo";
|
|
7
|
+
|
|
8
|
+
export * from "./_enums";
|
|
9
|
+
export * from "./cosmos";
|
|
10
|
+
export * from "./evm";
|
|
11
|
+
export * from "./others";
|
|
12
|
+
export * from "./substrate";
|
|
13
|
+
export * from "./utxo";
|
|
14
|
+
|
|
15
|
+
export const AllChainConfigs = [
|
|
16
|
+
...UTXOChainConfigs,
|
|
17
|
+
...EVMChainConfigs,
|
|
18
|
+
...CosmosChainConfigs,
|
|
19
|
+
...SubstrateChainConfigs,
|
|
20
|
+
...OtherChainConfigs,
|
|
21
|
+
].sort((a, b) => a.chain.localeCompare(b.chain));
|
|
22
|
+
export type AllChainConfigs = typeof AllChainConfigs;
|
|
23
|
+
export type ChainConfig = AllChainConfigs[number];
|
|
24
|
+
|
|
25
|
+
export const AllChains = Object.values(Chain);
|
|
26
|
+
export const StagenetChains = [StagenetChain.THORChain, StagenetChain.Maya] as const;
|
|
27
|
+
|
|
28
|
+
type ChainConfigMap = {
|
|
29
|
+
[K in ChainConfig["chain"]]: Extract<ChainConfig, { chain: K }>;
|
|
30
|
+
} & {
|
|
31
|
+
[K in ChainConfig["chainId"]]: Extract<ChainConfig, { chainId: K }>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const chainConfigs = AllChainConfigs.reduce(
|
|
35
|
+
(acc, config) => {
|
|
36
|
+
acc[config.chain] = config;
|
|
37
|
+
acc[config.chainId] = config;
|
|
38
|
+
return acc;
|
|
39
|
+
},
|
|
40
|
+
{} as Record<ChainConfig["chain"] | ChainConfig["chainId"], ChainConfig>,
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export function getChainConfig<T extends keyof ChainConfigMap>(chainOrChainId: T): ChainConfigMap[T] {
|
|
44
|
+
const chainConfig = chainConfigs[chainOrChainId];
|
|
45
|
+
|
|
46
|
+
return (chainConfig || {}) as ChainConfigMap[T];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { chainIdToChain, chainToBaseDecimal, chainToBlockTime, explorerUrls, rpcUrls } = AllChains.reduce(
|
|
50
|
+
(acc, chain) => {
|
|
51
|
+
const { chainId, baseDecimal, blockTime, explorerUrl, rpcUrls } = getChainConfig(chain);
|
|
52
|
+
|
|
53
|
+
acc.chainIdToChain[chainId] = chain;
|
|
54
|
+
acc.chainToBaseDecimal[chain] = baseDecimal;
|
|
55
|
+
acc.chainToBlockTime[chain] = blockTime;
|
|
56
|
+
acc.explorerUrls[chain] = explorerUrl;
|
|
57
|
+
acc.rpcUrls[chain] = rpcUrls[0] || "";
|
|
58
|
+
return acc;
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
chainIdToChain: {},
|
|
62
|
+
chainToBaseDecimal: {},
|
|
63
|
+
chainToBlockTime: {},
|
|
64
|
+
explorerUrls: {},
|
|
65
|
+
rpcUrls: {
|
|
66
|
+
[StagenetChain.Maya]: StagenetMAYAConfig.rpcUrls[0],
|
|
67
|
+
[StagenetChain.THORChain]: StagenetTHORConfig.rpcUrls[0],
|
|
68
|
+
},
|
|
69
|
+
} as {
|
|
70
|
+
chainIdToChain: Record<ChainId, Chain>;
|
|
71
|
+
chainToBaseDecimal: Record<Chain, number>;
|
|
72
|
+
chainToBlockTime: Record<Chain, number>;
|
|
73
|
+
explorerUrls: Record<Chain, string>;
|
|
74
|
+
rpcUrls: Record<Chain | StagenetChain, string>;
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export const NODE_URLS = {
|
|
79
|
+
[Chain.THORChain]: "https://thornode.ninerealms.com",
|
|
80
|
+
[Chain.Maya]: "https://mayanode.mayachain.info",
|
|
81
|
+
[StagenetChain.THORChain]: "https://stagenet-thornode.ninerealms.com",
|
|
82
|
+
[StagenetChain.Maya]: "https://stagenet.mayanode.mayachain.info",
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @example
|
|
87
|
+
* ```diff
|
|
88
|
+
* -const rpcUrl = RPC_URLS[Chain.Ethereum];
|
|
89
|
+
* +const { rpcUrls: [rpcUrl] } = getChainConfig(Chain.Ethereum);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export const RPC_URLS: Record<Chain | StagenetChain, string> = rpcUrls;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @example
|
|
96
|
+
* ```diff
|
|
97
|
+
* -const explorerUrl = EXPLORER_URLS[Chain.Ethereum];
|
|
98
|
+
* +const { explorerUrl } = getChainConfig(Chain.Ethereum);
|
|
99
|
+
*/
|
|
100
|
+
export const EXPLORER_URLS: Record<Chain, string> = explorerUrls;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* Note: ChainIdToChain will be discontinued in future versions.
|
|
105
|
+
* Please use getChainConfig instead.
|
|
106
|
+
* @example
|
|
107
|
+
* ```diff
|
|
108
|
+
* -const chainId = ChainToChainId[Chain.Ethereum];
|
|
109
|
+
* +const { chainId } = getChainConfig(Chain.Ethereum);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export const ChainToChainId = Object.fromEntries(
|
|
113
|
+
AllChainConfigs.flatMap(({ chain, chainId }) => [[chain, chainId] as const]),
|
|
114
|
+
) as {
|
|
115
|
+
readonly [K in Chain | StagenetChain]: Extract<ChainConfig, { chain: K }>["chainId"];
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Note: ChainIdToChain will be discontinued in future versions.
|
|
120
|
+
* Please use getChainConfig instead.
|
|
121
|
+
* @example
|
|
122
|
+
* ```diff
|
|
123
|
+
* -const chain = ChainIdToChain[ChainId.Ethereum];
|
|
124
|
+
* +const { chain } = getChainConfig(ChainId.Ethereum);
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export const ChainIdToChain = chainIdToChain;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Note: BaseDecimal will be discontinued in future versions.
|
|
131
|
+
* Please use getChainConfig instead.
|
|
132
|
+
* @example
|
|
133
|
+
* ```diff
|
|
134
|
+
* -const baseDecimal = BaseDecimal[Chain.Ethereum];
|
|
135
|
+
* +const { baseDecimal } = getChainConfig(Chain.Ethereum);
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export const BaseDecimal = chainToBaseDecimal;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Note: BlockTimes will be discontinued in future versions.
|
|
142
|
+
* Please use getChainConfig instead.
|
|
143
|
+
* @example
|
|
144
|
+
* ```diff
|
|
145
|
+
* -const blockTime = BlockTimes[Chain.Ethereum];
|
|
146
|
+
* +const { blockTime } = getChainConfig(Chain.Ethereum);
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export const BlockTimes = chainToBlockTime;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { createChain } from "./_createChain";
|
|
2
|
+
import { Chain, ChainId } from "./_enums";
|
|
3
|
+
|
|
4
|
+
const type = "others";
|
|
5
|
+
|
|
6
|
+
const NEAR = createChain({
|
|
7
|
+
baseDecimal: 24,
|
|
8
|
+
blockTime: 1,
|
|
9
|
+
chain: Chain.Near,
|
|
10
|
+
chainId: ChainId.Near,
|
|
11
|
+
explorerUrl: "https://nearblocks.io",
|
|
12
|
+
name: "Near",
|
|
13
|
+
nativeCurrency: "NEAR",
|
|
14
|
+
networkDerivationPath: [44, 397, 0, 0, 0],
|
|
15
|
+
rpcUrls: [
|
|
16
|
+
"https://rpc.mainnet.near.org",
|
|
17
|
+
"https://1rpc.io/near",
|
|
18
|
+
"https://near.lava.build",
|
|
19
|
+
"https://near-mainnet.infura.io/v3/3cbfcafa5e1e48b7bb0ea41f2fbc4abf",
|
|
20
|
+
],
|
|
21
|
+
type,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const XRD = createChain({
|
|
25
|
+
baseDecimal: 18,
|
|
26
|
+
blockTime: 5,
|
|
27
|
+
chain: Chain.Radix,
|
|
28
|
+
chainId: ChainId.Radix,
|
|
29
|
+
explorerUrl: "https://dashboard.radixdlt.com",
|
|
30
|
+
name: "Radix",
|
|
31
|
+
nativeCurrency: "XRD",
|
|
32
|
+
networkDerivationPath: [0, 0, 0, 0, 0],
|
|
33
|
+
rpcUrls: [
|
|
34
|
+
"https://radix-mainnet.rpc.grove.city/v1/326002fc/core",
|
|
35
|
+
"https://mainnet.radixdlt.com",
|
|
36
|
+
"https://radix-mainnet.rpc.grove.city/v1",
|
|
37
|
+
],
|
|
38
|
+
type,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const XRP = createChain({
|
|
42
|
+
baseDecimal: 6,
|
|
43
|
+
blockTime: 5,
|
|
44
|
+
chain: Chain.Ripple,
|
|
45
|
+
chainId: ChainId.Ripple,
|
|
46
|
+
explorerUrl: "https://livenet.xrpl.org/",
|
|
47
|
+
name: "Ripple",
|
|
48
|
+
nativeCurrency: "XRP",
|
|
49
|
+
networkDerivationPath: [44, 144, 0, 0, 0],
|
|
50
|
+
rpcUrls: ["wss://xrpl.ws/", "wss://s1.ripple.com/", "wss://s2.ripple.com/"],
|
|
51
|
+
type,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const SOL = createChain({
|
|
55
|
+
baseDecimal: 9,
|
|
56
|
+
blockTime: 0.4,
|
|
57
|
+
chain: Chain.Solana,
|
|
58
|
+
chainId: ChainId.Solana,
|
|
59
|
+
explorerUrl: "https://solscan.io",
|
|
60
|
+
name: "Solana",
|
|
61
|
+
nativeCurrency: "SOL",
|
|
62
|
+
networkDerivationPath: [44, 501, 0, 0, 0],
|
|
63
|
+
rpcUrls: [
|
|
64
|
+
"https://solana-rpc.publicnode.com",
|
|
65
|
+
"https://api.mainnet-beta.solana.com",
|
|
66
|
+
"https://solana-mainnet.rpc.extrnode.com",
|
|
67
|
+
],
|
|
68
|
+
type,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const TON = createChain({
|
|
72
|
+
baseDecimal: 9,
|
|
73
|
+
blockTime: 5,
|
|
74
|
+
chain: Chain.Ton,
|
|
75
|
+
chainId: ChainId.Ton,
|
|
76
|
+
explorerUrl: "https://tonscan.org",
|
|
77
|
+
name: "Ton",
|
|
78
|
+
nativeCurrency: "TON",
|
|
79
|
+
networkDerivationPath: [44, 607, 0, 0, 0],
|
|
80
|
+
rpcUrls: [
|
|
81
|
+
"https://ton.api.onfinality.io/public",
|
|
82
|
+
"https://ton.drpc.org/rest/",
|
|
83
|
+
"https://toncenter.com/api/v2/jsonRPC",
|
|
84
|
+
],
|
|
85
|
+
type,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const TRON = createChain({
|
|
89
|
+
baseDecimal: 6,
|
|
90
|
+
blockTime: 3,
|
|
91
|
+
chain: Chain.Tron,
|
|
92
|
+
chainId: ChainId.Tron,
|
|
93
|
+
chainIdHex: "0x2b6653dc",
|
|
94
|
+
explorerUrl: "https://tronscan.org",
|
|
95
|
+
name: "Tron",
|
|
96
|
+
nativeCurrency: "TRX",
|
|
97
|
+
networkDerivationPath: [44, 195, 0, 0, 0],
|
|
98
|
+
rpcUrls: ["https://tron-rpc.publicnode.com", "https://api.tronstack.io", "https://api.tron.network"],
|
|
99
|
+
type,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const SUI = createChain({
|
|
103
|
+
baseDecimal: 9,
|
|
104
|
+
blockTime: 5,
|
|
105
|
+
chain: Chain.Sui,
|
|
106
|
+
chainId: ChainId.Sui,
|
|
107
|
+
explorerUrl: "https://suiscan.xyz",
|
|
108
|
+
name: "Sui",
|
|
109
|
+
nativeCurrency: "SUI",
|
|
110
|
+
networkDerivationPath: [44, 784, 0, 0, 0],
|
|
111
|
+
rpcUrls: ["https://fullnode.mainnet.sui.io:443"],
|
|
112
|
+
type,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const ADA = createChain({
|
|
116
|
+
baseDecimal: 6,
|
|
117
|
+
blockTime: 600,
|
|
118
|
+
chain: Chain.Cardano,
|
|
119
|
+
chainId: ChainId.Cardano,
|
|
120
|
+
explorerUrl: "https://cexplorer.io",
|
|
121
|
+
name: "Cardano",
|
|
122
|
+
nativeCurrency: "ADA",
|
|
123
|
+
networkDerivationPath: [1852, 1815, 0, 0, 0],
|
|
124
|
+
rpcUrls: ["https://api.koios.rest/api/v1", "https://cardano-mainnet.blockfrost.io/api/v0"],
|
|
125
|
+
type,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const OtherChainConfigs = [NEAR, XRD, XRP, SOL, TON, TRON, SUI, ADA] as const;
|
|
129
|
+
export const OtherChains = OtherChainConfigs.map((config) => config.chain);
|
|
130
|
+
export type OtherChain = (typeof OtherChains)[number];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createChain } from "./_createChain";
|
|
2
|
+
import { Chain, ChainId } from "./_enums";
|
|
3
|
+
|
|
4
|
+
const type = "substrate";
|
|
5
|
+
|
|
6
|
+
const DOT = createChain({
|
|
7
|
+
baseDecimal: 10,
|
|
8
|
+
blockTime: 6,
|
|
9
|
+
chain: Chain.Polkadot,
|
|
10
|
+
chainId: ChainId.Polkadot,
|
|
11
|
+
explorerUrl: "https://polkadot.subscan.io",
|
|
12
|
+
name: "Polkadot",
|
|
13
|
+
nativeCurrency: "DOT",
|
|
14
|
+
networkDerivationPath: [0, 0, 0, 0, 0],
|
|
15
|
+
rpcUrls: ["wss://rpc.polkadot.io", "wss://polkadot-rpc.dwellir.com", "wss://polkadot.api.onfinality.io/public-ws"],
|
|
16
|
+
type,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const FLIP = createChain({
|
|
20
|
+
baseDecimal: 18,
|
|
21
|
+
blockTime: 5,
|
|
22
|
+
chain: Chain.Chainflip,
|
|
23
|
+
chainId: ChainId.Chainflip,
|
|
24
|
+
explorerUrl: "https://explorer.polkascan.io/polkadot",
|
|
25
|
+
name: "Chainflip",
|
|
26
|
+
nativeCurrency: "FLIP",
|
|
27
|
+
networkDerivationPath: [0, 0, 0, 0, 0],
|
|
28
|
+
rpcUrls: [
|
|
29
|
+
"wss://mainnet-archive.chainflip.io",
|
|
30
|
+
"wss://archive-1.mainnet.chainflip.io",
|
|
31
|
+
"wss://archive-2.mainnet.chainflip.io",
|
|
32
|
+
],
|
|
33
|
+
type,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// const TAO = createChain({
|
|
37
|
+
// baseDecimal: 18,
|
|
38
|
+
// blockTime: 5,
|
|
39
|
+
// chain: Chain.TAO,
|
|
40
|
+
// chainId: ChainId.TAO,
|
|
41
|
+
// explorerUrl: "https://taoscan.io",
|
|
42
|
+
// name: "TAO",
|
|
43
|
+
// nativeCurrency: "TAO",
|
|
44
|
+
// networkDerivationPath: [0, 0, 0, 0, 0],
|
|
45
|
+
// rpcUrls: ["wss://rpc.tao.network"],
|
|
46
|
+
// type,
|
|
47
|
+
// });
|
|
48
|
+
|
|
49
|
+
export const SubstrateChainConfigs = [DOT, FLIP] as const;
|
|
50
|
+
export const SubstrateChains = [Chain.Polkadot, Chain.Chainflip] as const;
|
|
51
|
+
export type SubstrateChain = (typeof SubstrateChains)[number];
|