@swapkit/helpers 3.0.0-beta.16 → 3.0.0-beta.17
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 +3 -3
- package/dist/index.cjs.map +5 -5
- package/dist/index.js +3 -3
- package/dist/index.js.map +5 -5
- package/package.json +2 -2
- package/src/modules/assetValue.ts +9 -6
- package/src/types/chains.ts +25 -7
- package/src/types/derivationPath.ts +1 -0
package/src/types/chains.ts
CHANGED
|
@@ -26,6 +26,7 @@ export enum Chain {
|
|
|
26
26
|
THORChain = "THOR",
|
|
27
27
|
Solana = "SOL",
|
|
28
28
|
Tron = "TRX",
|
|
29
|
+
Zcash = "ZEC",
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export enum StagenetChain {
|
|
@@ -68,6 +69,7 @@ export enum ChainId {
|
|
|
68
69
|
Solana = "solana",
|
|
69
70
|
Tron = "728126428",
|
|
70
71
|
TronHex = "0x2b6653dc",
|
|
72
|
+
Zcash = "zcash",
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export const ChainIdToChain: Record<ChainId, Chain> = {
|
|
@@ -105,6 +107,7 @@ export const ChainIdToChain: Record<ChainId, Chain> = {
|
|
|
105
107
|
[ChainId.THORChain]: Chain.THORChain,
|
|
106
108
|
[ChainId.Tron]: Chain.Tron,
|
|
107
109
|
[ChainId.TronHex]: Chain.Tron,
|
|
110
|
+
[ChainId.Zcash]: Chain.Zcash,
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
type ChainNameType = keyof typeof Chain;
|
|
@@ -136,6 +139,7 @@ export const BaseDecimal: Record<Chain, number> = {
|
|
|
136
139
|
TRX: 6,
|
|
137
140
|
XRD: 18,
|
|
138
141
|
XRP: 6,
|
|
142
|
+
ZEC: 8,
|
|
139
143
|
};
|
|
140
144
|
|
|
141
145
|
export const BlockTimes: Record<Partial<Chain>, number> = {
|
|
@@ -163,6 +167,7 @@ export const BlockTimes: Record<Partial<Chain>, number> = {
|
|
|
163
167
|
[Chain.Solana]: 0.4,
|
|
164
168
|
[Chain.THORChain]: 6,
|
|
165
169
|
[Chain.Tron]: 3,
|
|
170
|
+
[Chain.Zcash]: 150,
|
|
166
171
|
};
|
|
167
172
|
|
|
168
173
|
export type SubstrateChain = Chain.Polkadot | Chain.Chainflip;
|
|
@@ -192,13 +197,15 @@ export type UTXOChain =
|
|
|
192
197
|
| Chain.BitcoinCash
|
|
193
198
|
| Chain.Dash
|
|
194
199
|
| Chain.Dogecoin
|
|
195
|
-
| Chain.Litecoin
|
|
200
|
+
| Chain.Litecoin
|
|
201
|
+
| Chain.Zcash;
|
|
196
202
|
export const UTXOChains = [
|
|
197
203
|
Chain.Bitcoin,
|
|
198
204
|
Chain.BitcoinCash,
|
|
199
205
|
Chain.Dash,
|
|
200
206
|
Chain.Dogecoin,
|
|
201
207
|
Chain.Litecoin,
|
|
208
|
+
Chain.Zcash,
|
|
202
209
|
] as const;
|
|
203
210
|
|
|
204
211
|
export type CosmosChain = Chain.Cosmos | Chain.THORChain | Chain.Maya | Chain.Kujira;
|
|
@@ -256,6 +263,7 @@ export const RPC_URLS: Record<Chain | StagenetChain, string> = {
|
|
|
256
263
|
[Chain.Solana]: "https://solana-rpc.publicnode.com",
|
|
257
264
|
[Chain.THORChain]: "https://rpc.thorswap.net",
|
|
258
265
|
[Chain.Tron]: "https://tron-rpc.publicnode.com",
|
|
266
|
+
[Chain.Zcash]: "https://api.blockchair.com/zcash",
|
|
259
267
|
[StagenetChain.Maya]: "https://stagenet.tendermint.mayachain.info",
|
|
260
268
|
[StagenetChain.THORChain]: "https://stagenet-rpc.ninerealms.com",
|
|
261
269
|
};
|
|
@@ -319,6 +327,7 @@ export const FALLBACK_URLS: Record<Chain | StagenetChain, string[]> = {
|
|
|
319
327
|
"https://solana-mainnet.rpc.extrnode.com",
|
|
320
328
|
],
|
|
321
329
|
[Chain.Tron]: ["https://api.tronstack.io", "https://api.tron.network"],
|
|
330
|
+
[Chain.Zcash]: ["https://api.blockchair.com/zcash"],
|
|
322
331
|
};
|
|
323
332
|
|
|
324
333
|
export const EXPLORER_URLS: Record<Chain, string> = {
|
|
@@ -346,6 +355,7 @@ export const EXPLORER_URLS: Record<Chain, string> = {
|
|
|
346
355
|
[Chain.THORChain]: "https://runescan.io",
|
|
347
356
|
[Chain.Solana]: "https://solscan.io",
|
|
348
357
|
[Chain.Tron]: "https://tronscan.org",
|
|
358
|
+
[Chain.Zcash]: "https://blockchair.com/zcash",
|
|
349
359
|
};
|
|
350
360
|
|
|
351
361
|
let RPCUrlsMerged = RPC_URLS;
|
|
@@ -363,12 +373,20 @@ const getRpcBody = (chain: Chain | StagenetChain) => {
|
|
|
363
373
|
Chain.Tron,
|
|
364
374
|
() => ({ id: 1, jsonrpc: "2.0", method: "eth_blockNumber", params: [] }),
|
|
365
375
|
)
|
|
366
|
-
.with(
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
376
|
+
.with(
|
|
377
|
+
Chain.Bitcoin,
|
|
378
|
+
Chain.Dogecoin,
|
|
379
|
+
Chain.BitcoinCash,
|
|
380
|
+
Chain.Dash,
|
|
381
|
+
Chain.Litecoin,
|
|
382
|
+
Chain.Zcash,
|
|
383
|
+
() => ({
|
|
384
|
+
id: "test",
|
|
385
|
+
jsonrpc: "1.0",
|
|
386
|
+
method: "getblockchaininfo",
|
|
387
|
+
params: [],
|
|
388
|
+
}),
|
|
389
|
+
)
|
|
372
390
|
.with(
|
|
373
391
|
Chain.Cosmos,
|
|
374
392
|
Chain.Kujira,
|
|
@@ -33,6 +33,7 @@ export const NetworkDerivationPath: Record<Chain, DerivationPathArray> = {
|
|
|
33
33
|
SOL: [44, 501, 0, 0, 0],
|
|
34
34
|
THOR: [44, 931, 0, 0, 0],
|
|
35
35
|
TRX: [44, 195, 0, 0, 0],
|
|
36
|
+
ZEC: [44, 133, 0, 0, 0],
|
|
36
37
|
|
|
37
38
|
// Polkadot and related network derivation path is not number based
|
|
38
39
|
DOT: [0, 0, 0, 0, 0],
|