@chainflip/utils 2.1.2 → 2.1.4-bsc-dev.1
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/chainflip.cjs +124 -7
- package/dist/chainflip.d.cts +93 -5
- package/dist/chainflip.d.mts +93 -5
- package/dist/chainflip.mjs +124 -7
- package/dist/consts.cjs +8 -0
- package/dist/consts.mjs +8 -0
- package/package.json +2 -2
package/dist/chainflip.cjs
CHANGED
|
@@ -16,7 +16,13 @@ const chainflipAssets = [
|
|
|
16
16
|
"SolUsdt",
|
|
17
17
|
"HubDot",
|
|
18
18
|
"HubUsdt",
|
|
19
|
-
"HubUsdc"
|
|
19
|
+
"HubUsdc",
|
|
20
|
+
"Bnb",
|
|
21
|
+
"BscUsdc",
|
|
22
|
+
"BscUsdt",
|
|
23
|
+
"BscWbtc",
|
|
24
|
+
"Trx",
|
|
25
|
+
"TronUsdt"
|
|
20
26
|
];
|
|
21
27
|
const legacyChainflipAssets = ["Dot"];
|
|
22
28
|
const priceAssets = [
|
|
@@ -29,12 +35,17 @@ const priceAssets = [
|
|
|
29
35
|
"Fine"
|
|
30
36
|
];
|
|
31
37
|
const baseChainflipAssets = chainflipAssets.filter((asset) => asset !== "Usdc");
|
|
32
|
-
const chainflipEvmChains = [
|
|
38
|
+
const chainflipEvmChains = [
|
|
39
|
+
"Ethereum",
|
|
40
|
+
"Arbitrum",
|
|
41
|
+
"Bsc"
|
|
42
|
+
];
|
|
33
43
|
const chainflipChains = [
|
|
34
44
|
...chainflipEvmChains,
|
|
35
45
|
"Bitcoin",
|
|
36
46
|
"Solana",
|
|
37
|
-
"Assethub"
|
|
47
|
+
"Assethub",
|
|
48
|
+
"Tron"
|
|
38
49
|
];
|
|
39
50
|
const legacyChainflipChains = ["Polkadot"];
|
|
40
51
|
const chainflipNetworks = [
|
|
@@ -48,7 +59,9 @@ const addressTypes = [
|
|
|
48
59
|
"Btc",
|
|
49
60
|
"Arb",
|
|
50
61
|
"Sol",
|
|
51
|
-
"Hub"
|
|
62
|
+
"Hub",
|
|
63
|
+
"Bsc",
|
|
64
|
+
"Tron"
|
|
52
65
|
];
|
|
53
66
|
const legacyAddressTypes = ["Dot"];
|
|
54
67
|
function readAssetValue(map, asset) {
|
|
@@ -129,6 +142,36 @@ const assetConstants = {
|
|
|
129
142
|
chain: "Assethub",
|
|
130
143
|
symbol: "USDT",
|
|
131
144
|
decimals: 6
|
|
145
|
+
},
|
|
146
|
+
Bnb: {
|
|
147
|
+
chain: "Bsc",
|
|
148
|
+
symbol: "BNB",
|
|
149
|
+
decimals: 18
|
|
150
|
+
},
|
|
151
|
+
BscUsdc: {
|
|
152
|
+
chain: "Bsc",
|
|
153
|
+
symbol: "USDC",
|
|
154
|
+
decimals: 18
|
|
155
|
+
},
|
|
156
|
+
BscUsdt: {
|
|
157
|
+
chain: "Bsc",
|
|
158
|
+
symbol: "USDT",
|
|
159
|
+
decimals: 18
|
|
160
|
+
},
|
|
161
|
+
BscWbtc: {
|
|
162
|
+
chain: "Bsc",
|
|
163
|
+
symbol: "WBTC",
|
|
164
|
+
decimals: 18
|
|
165
|
+
},
|
|
166
|
+
Trx: {
|
|
167
|
+
chain: "Tron",
|
|
168
|
+
symbol: "TRX",
|
|
169
|
+
decimals: 6
|
|
170
|
+
},
|
|
171
|
+
TronUsdt: {
|
|
172
|
+
chain: "Tron",
|
|
173
|
+
symbol: "USDT",
|
|
174
|
+
decimals: 6
|
|
132
175
|
}
|
|
133
176
|
};
|
|
134
177
|
const anyAssetConstants = {
|
|
@@ -140,11 +183,13 @@ const anyAssetConstants = {
|
|
|
140
183
|
}
|
|
141
184
|
};
|
|
142
185
|
const assetSymbols = [
|
|
186
|
+
"BNB",
|
|
143
187
|
"BTC",
|
|
144
188
|
"DOT",
|
|
145
189
|
"ETH",
|
|
146
190
|
"FLIP",
|
|
147
191
|
"SOL",
|
|
192
|
+
"TRX",
|
|
148
193
|
"USDC",
|
|
149
194
|
"USDT",
|
|
150
195
|
"WBTC"
|
|
@@ -220,6 +265,30 @@ const chainConstants = {
|
|
|
220
265
|
gasAsset: "HubDot",
|
|
221
266
|
addressType: "Hub",
|
|
222
267
|
blockTimeSeconds: 3
|
|
268
|
+
},
|
|
269
|
+
Bsc: {
|
|
270
|
+
chainflipAssets: [
|
|
271
|
+
"Bnb",
|
|
272
|
+
"BscUsdc",
|
|
273
|
+
"BscUsdt",
|
|
274
|
+
"BscWbtc"
|
|
275
|
+
],
|
|
276
|
+
assets: [
|
|
277
|
+
"BNB",
|
|
278
|
+
"USDC",
|
|
279
|
+
"USDT",
|
|
280
|
+
"WBTC"
|
|
281
|
+
],
|
|
282
|
+
gasAsset: "Bnb",
|
|
283
|
+
addressType: "Bsc",
|
|
284
|
+
blockTimeSeconds: .45
|
|
285
|
+
},
|
|
286
|
+
Tron: {
|
|
287
|
+
chainflipAssets: ["Trx", "TronUsdt"],
|
|
288
|
+
assets: ["TRX", "USDT"],
|
|
289
|
+
gasAsset: "Trx",
|
|
290
|
+
addressType: "Tron",
|
|
291
|
+
blockTimeSeconds: 3
|
|
223
292
|
}
|
|
224
293
|
};
|
|
225
294
|
const anyChainConstants = {
|
|
@@ -292,6 +361,30 @@ const internalAssetToRpcAsset = {
|
|
|
292
361
|
HubUsdc: {
|
|
293
362
|
chain: "Assethub",
|
|
294
363
|
asset: "USDC"
|
|
364
|
+
},
|
|
365
|
+
Bnb: {
|
|
366
|
+
chain: "Bsc",
|
|
367
|
+
asset: "BNB"
|
|
368
|
+
},
|
|
369
|
+
BscUsdc: {
|
|
370
|
+
chain: "Bsc",
|
|
371
|
+
asset: "USDC"
|
|
372
|
+
},
|
|
373
|
+
BscUsdt: {
|
|
374
|
+
chain: "Bsc",
|
|
375
|
+
asset: "USDT"
|
|
376
|
+
},
|
|
377
|
+
BscWbtc: {
|
|
378
|
+
chain: "Bsc",
|
|
379
|
+
asset: "WBTC"
|
|
380
|
+
},
|
|
381
|
+
Trx: {
|
|
382
|
+
chain: "Tron",
|
|
383
|
+
asset: "TRX"
|
|
384
|
+
},
|
|
385
|
+
TronUsdt: {
|
|
386
|
+
chain: "Tron",
|
|
387
|
+
asset: "USDT"
|
|
295
388
|
}
|
|
296
389
|
};
|
|
297
390
|
const anyInternalAssetToRpcAsset = {
|
|
@@ -306,7 +399,9 @@ const chainContractId = {
|
|
|
306
399
|
Bitcoin: 3,
|
|
307
400
|
Arbitrum: 4,
|
|
308
401
|
Solana: 5,
|
|
309
|
-
Assethub: 6
|
|
402
|
+
Assethub: 6,
|
|
403
|
+
Bsc: 7,
|
|
404
|
+
Tron: 8
|
|
310
405
|
};
|
|
311
406
|
const assetContractId = {
|
|
312
407
|
Eth: 1,
|
|
@@ -323,7 +418,13 @@ const assetContractId = {
|
|
|
323
418
|
HubUsdc: 13,
|
|
324
419
|
Wbtc: 14,
|
|
325
420
|
ArbUsdt: 15,
|
|
326
|
-
SolUsdt: 16
|
|
421
|
+
SolUsdt: 16,
|
|
422
|
+
Bnb: 17,
|
|
423
|
+
BscUsdt: 18,
|
|
424
|
+
BscUsdc: 21,
|
|
425
|
+
BscWbtc: 22,
|
|
426
|
+
Trx: 19,
|
|
427
|
+
TronUsdt: 20
|
|
327
428
|
};
|
|
328
429
|
function getInternalAsset(asset, assert = true) {
|
|
329
430
|
const internalAsset = {
|
|
@@ -349,6 +450,16 @@ function getInternalAsset(asset, assert = true) {
|
|
|
349
450
|
USDC: "HubUsdc",
|
|
350
451
|
USDT: "HubUsdt",
|
|
351
452
|
DOT: "HubDot"
|
|
453
|
+
},
|
|
454
|
+
Bsc: {
|
|
455
|
+
BNB: "Bnb",
|
|
456
|
+
USDC: "BscUsdc",
|
|
457
|
+
USDT: "BscUsdt",
|
|
458
|
+
WBTC: "BscWbtc"
|
|
459
|
+
},
|
|
460
|
+
Tron: {
|
|
461
|
+
TRX: "Trx",
|
|
462
|
+
USDT: "TronUsdt"
|
|
352
463
|
}
|
|
353
464
|
}[asset.chain]?.[asset.asset];
|
|
354
465
|
if (internalAsset) return internalAsset;
|
|
@@ -391,7 +502,13 @@ const chainflipAssetToPriceAssetMap = {
|
|
|
391
502
|
HubUsdt: "Usdt",
|
|
392
503
|
Flip: null,
|
|
393
504
|
HubDot: null,
|
|
394
|
-
Wbtc: "Btc"
|
|
505
|
+
Wbtc: "Btc",
|
|
506
|
+
Bnb: null,
|
|
507
|
+
BscUsdc: "Usdc",
|
|
508
|
+
BscUsdt: "Usdt",
|
|
509
|
+
BscWbtc: "Btc",
|
|
510
|
+
Trx: null,
|
|
511
|
+
TronUsdt: "Usdt"
|
|
395
512
|
};
|
|
396
513
|
function isChainflipAsset(asset) {
|
|
397
514
|
return chainflipAssets.includes(asset);
|
package/dist/chainflip.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/chainflip.d.ts
|
|
2
|
-
declare const chainflipAssets: readonly ["Usdc", "Usdt", "Wbtc", "Flip", "Eth", "Btc", "ArbUsdc", "ArbUsdt", "ArbEth", "Sol", "SolUsdc", "SolUsdt", "HubDot", "HubUsdt", "HubUsdc"];
|
|
2
|
+
declare const chainflipAssets: readonly ["Usdc", "Usdt", "Wbtc", "Flip", "Eth", "Btc", "ArbUsdc", "ArbUsdt", "ArbEth", "Sol", "SolUsdc", "SolUsdt", "HubDot", "HubUsdt", "HubUsdc", "Bnb", "BscUsdc", "BscUsdt", "BscWbtc", "Trx", "TronUsdt"];
|
|
3
3
|
declare const legacyChainflipAssets: readonly ["Dot"];
|
|
4
4
|
type ChainflipAsset = (typeof chainflipAssets)[number];
|
|
5
5
|
type LegacyChainflipAsset = (typeof legacyChainflipAssets)[number];
|
|
@@ -9,16 +9,16 @@ type PriceAsset = (typeof priceAssets)[number];
|
|
|
9
9
|
type BaseChainflipAsset = Exclude<ChainflipAsset, 'Usdc'>;
|
|
10
10
|
type AnyBaseChainflipAsset = Exclude<AnyChainflipAsset, 'Usdc'>;
|
|
11
11
|
declare const baseChainflipAssets: BaseChainflipAsset[];
|
|
12
|
-
declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum"];
|
|
12
|
+
declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum", "Bsc"];
|
|
13
13
|
type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
|
|
14
|
-
declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Solana", "Assethub"];
|
|
14
|
+
declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bsc", "Bitcoin", "Solana", "Assethub", "Tron"];
|
|
15
15
|
type ChainflipChain = (typeof chainflipChains)[number];
|
|
16
16
|
declare const legacyChainflipChains: readonly ["Polkadot"];
|
|
17
17
|
type LegacyChainflipChain = (typeof legacyChainflipChains)[number];
|
|
18
18
|
type AnyChainflipChain = ChainflipChain | LegacyChainflipChain;
|
|
19
19
|
declare const chainflipNetworks: readonly ["backspin", "sisyphos", "perseverance", "mainnet"];
|
|
20
20
|
type ChainflipNetwork = (typeof chainflipNetworks)[number];
|
|
21
|
-
declare const addressTypes: readonly ["Eth", "Btc", "Arb", "Sol", "Hub"];
|
|
21
|
+
declare const addressTypes: readonly ["Eth", "Btc", "Arb", "Sol", "Hub", "Bsc", "Tron"];
|
|
22
22
|
type AddressType = (typeof addressTypes)[number];
|
|
23
23
|
declare const legacyAddressTypes: readonly ["Dot"];
|
|
24
24
|
type LegacyAddressType = (typeof legacyAddressTypes)[number];
|
|
@@ -140,6 +140,36 @@ declare const assetConstants: {
|
|
|
140
140
|
readonly symbol: "USDT";
|
|
141
141
|
readonly decimals: 6;
|
|
142
142
|
};
|
|
143
|
+
readonly Bnb: {
|
|
144
|
+
readonly chain: "Bsc";
|
|
145
|
+
readonly symbol: "BNB";
|
|
146
|
+
readonly decimals: 18;
|
|
147
|
+
};
|
|
148
|
+
readonly BscUsdc: {
|
|
149
|
+
readonly chain: "Bsc";
|
|
150
|
+
readonly symbol: "USDC";
|
|
151
|
+
readonly decimals: 18;
|
|
152
|
+
};
|
|
153
|
+
readonly BscUsdt: {
|
|
154
|
+
readonly chain: "Bsc";
|
|
155
|
+
readonly symbol: "USDT";
|
|
156
|
+
readonly decimals: 18;
|
|
157
|
+
};
|
|
158
|
+
readonly BscWbtc: {
|
|
159
|
+
readonly chain: "Bsc";
|
|
160
|
+
readonly symbol: "WBTC";
|
|
161
|
+
readonly decimals: 18;
|
|
162
|
+
};
|
|
163
|
+
readonly Trx: {
|
|
164
|
+
readonly chain: "Tron";
|
|
165
|
+
readonly symbol: "TRX";
|
|
166
|
+
readonly decimals: 6;
|
|
167
|
+
};
|
|
168
|
+
readonly TronUsdt: {
|
|
169
|
+
readonly chain: "Tron";
|
|
170
|
+
readonly symbol: "USDT";
|
|
171
|
+
readonly decimals: 6;
|
|
172
|
+
};
|
|
143
173
|
};
|
|
144
174
|
declare const anyAssetConstants: {
|
|
145
175
|
readonly Dot: {
|
|
@@ -222,8 +252,38 @@ declare const anyAssetConstants: {
|
|
|
222
252
|
readonly symbol: "USDT";
|
|
223
253
|
readonly decimals: 6;
|
|
224
254
|
};
|
|
255
|
+
readonly Bnb: {
|
|
256
|
+
readonly chain: "Bsc";
|
|
257
|
+
readonly symbol: "BNB";
|
|
258
|
+
readonly decimals: 18;
|
|
259
|
+
};
|
|
260
|
+
readonly BscUsdc: {
|
|
261
|
+
readonly chain: "Bsc";
|
|
262
|
+
readonly symbol: "USDC";
|
|
263
|
+
readonly decimals: 18;
|
|
264
|
+
};
|
|
265
|
+
readonly BscUsdt: {
|
|
266
|
+
readonly chain: "Bsc";
|
|
267
|
+
readonly symbol: "USDT";
|
|
268
|
+
readonly decimals: 18;
|
|
269
|
+
};
|
|
270
|
+
readonly BscWbtc: {
|
|
271
|
+
readonly chain: "Bsc";
|
|
272
|
+
readonly symbol: "WBTC";
|
|
273
|
+
readonly decimals: 18;
|
|
274
|
+
};
|
|
275
|
+
readonly Trx: {
|
|
276
|
+
readonly chain: "Tron";
|
|
277
|
+
readonly symbol: "TRX";
|
|
278
|
+
readonly decimals: 6;
|
|
279
|
+
};
|
|
280
|
+
readonly TronUsdt: {
|
|
281
|
+
readonly chain: "Tron";
|
|
282
|
+
readonly symbol: "USDT";
|
|
283
|
+
readonly decimals: 6;
|
|
284
|
+
};
|
|
225
285
|
};
|
|
226
|
-
declare const assetSymbols: readonly ["BTC", "DOT", "ETH", "FLIP", "SOL", "USDC", "USDT", "WBTC"];
|
|
286
|
+
declare const assetSymbols: readonly ["BNB", "BTC", "DOT", "ETH", "FLIP", "SOL", "TRX", "USDC", "USDT", "WBTC"];
|
|
227
287
|
type AssetSymbol = (typeof assetSymbols)[number];
|
|
228
288
|
declare const chainConstants: {
|
|
229
289
|
readonly Ethereum: {
|
|
@@ -261,6 +321,20 @@ declare const chainConstants: {
|
|
|
261
321
|
readonly addressType: "Hub";
|
|
262
322
|
readonly blockTimeSeconds: 3;
|
|
263
323
|
};
|
|
324
|
+
readonly Bsc: {
|
|
325
|
+
readonly chainflipAssets: ["Bnb", "BscUsdc", "BscUsdt", "BscWbtc"];
|
|
326
|
+
readonly assets: ["BNB", "USDC", "USDT", "WBTC"];
|
|
327
|
+
readonly gasAsset: "Bnb";
|
|
328
|
+
readonly addressType: "Bsc";
|
|
329
|
+
readonly blockTimeSeconds: 0.45;
|
|
330
|
+
};
|
|
331
|
+
readonly Tron: {
|
|
332
|
+
readonly chainflipAssets: ["Trx", "TronUsdt"];
|
|
333
|
+
readonly assets: ["TRX", "USDT"];
|
|
334
|
+
readonly gasAsset: "Trx";
|
|
335
|
+
readonly addressType: "Tron";
|
|
336
|
+
readonly blockTimeSeconds: 3;
|
|
337
|
+
};
|
|
264
338
|
};
|
|
265
339
|
declare const anyChainConstants: {
|
|
266
340
|
readonly Polkadot: {
|
|
@@ -305,6 +379,20 @@ declare const anyChainConstants: {
|
|
|
305
379
|
readonly addressType: "Hub";
|
|
306
380
|
readonly blockTimeSeconds: 3;
|
|
307
381
|
};
|
|
382
|
+
readonly Bsc: {
|
|
383
|
+
readonly chainflipAssets: ["Bnb", "BscUsdc", "BscUsdt", "BscWbtc"];
|
|
384
|
+
readonly assets: ["BNB", "USDC", "USDT", "WBTC"];
|
|
385
|
+
readonly gasAsset: "Bnb";
|
|
386
|
+
readonly addressType: "Bsc";
|
|
387
|
+
readonly blockTimeSeconds: 0.45;
|
|
388
|
+
};
|
|
389
|
+
readonly Tron: {
|
|
390
|
+
readonly chainflipAssets: ["Trx", "TronUsdt"];
|
|
391
|
+
readonly assets: ["TRX", "USDT"];
|
|
392
|
+
readonly gasAsset: "Trx";
|
|
393
|
+
readonly addressType: "Tron";
|
|
394
|
+
readonly blockTimeSeconds: 3;
|
|
395
|
+
};
|
|
308
396
|
};
|
|
309
397
|
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain>;
|
|
310
398
|
declare const anyInternalAssetToRpcAsset: AnyInternalAssetMap<AnyAssetAndChain>;
|
package/dist/chainflip.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/chainflip.d.ts
|
|
2
|
-
declare const chainflipAssets: readonly ["Usdc", "Usdt", "Wbtc", "Flip", "Eth", "Btc", "ArbUsdc", "ArbUsdt", "ArbEth", "Sol", "SolUsdc", "SolUsdt", "HubDot", "HubUsdt", "HubUsdc"];
|
|
2
|
+
declare const chainflipAssets: readonly ["Usdc", "Usdt", "Wbtc", "Flip", "Eth", "Btc", "ArbUsdc", "ArbUsdt", "ArbEth", "Sol", "SolUsdc", "SolUsdt", "HubDot", "HubUsdt", "HubUsdc", "Bnb", "BscUsdc", "BscUsdt", "BscWbtc", "Trx", "TronUsdt"];
|
|
3
3
|
declare const legacyChainflipAssets: readonly ["Dot"];
|
|
4
4
|
type ChainflipAsset = (typeof chainflipAssets)[number];
|
|
5
5
|
type LegacyChainflipAsset = (typeof legacyChainflipAssets)[number];
|
|
@@ -9,16 +9,16 @@ type PriceAsset = (typeof priceAssets)[number];
|
|
|
9
9
|
type BaseChainflipAsset = Exclude<ChainflipAsset, 'Usdc'>;
|
|
10
10
|
type AnyBaseChainflipAsset = Exclude<AnyChainflipAsset, 'Usdc'>;
|
|
11
11
|
declare const baseChainflipAssets: BaseChainflipAsset[];
|
|
12
|
-
declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum"];
|
|
12
|
+
declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum", "Bsc"];
|
|
13
13
|
type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
|
|
14
|
-
declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Solana", "Assethub"];
|
|
14
|
+
declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bsc", "Bitcoin", "Solana", "Assethub", "Tron"];
|
|
15
15
|
type ChainflipChain = (typeof chainflipChains)[number];
|
|
16
16
|
declare const legacyChainflipChains: readonly ["Polkadot"];
|
|
17
17
|
type LegacyChainflipChain = (typeof legacyChainflipChains)[number];
|
|
18
18
|
type AnyChainflipChain = ChainflipChain | LegacyChainflipChain;
|
|
19
19
|
declare const chainflipNetworks: readonly ["backspin", "sisyphos", "perseverance", "mainnet"];
|
|
20
20
|
type ChainflipNetwork = (typeof chainflipNetworks)[number];
|
|
21
|
-
declare const addressTypes: readonly ["Eth", "Btc", "Arb", "Sol", "Hub"];
|
|
21
|
+
declare const addressTypes: readonly ["Eth", "Btc", "Arb", "Sol", "Hub", "Bsc", "Tron"];
|
|
22
22
|
type AddressType = (typeof addressTypes)[number];
|
|
23
23
|
declare const legacyAddressTypes: readonly ["Dot"];
|
|
24
24
|
type LegacyAddressType = (typeof legacyAddressTypes)[number];
|
|
@@ -140,6 +140,36 @@ declare const assetConstants: {
|
|
|
140
140
|
readonly symbol: "USDT";
|
|
141
141
|
readonly decimals: 6;
|
|
142
142
|
};
|
|
143
|
+
readonly Bnb: {
|
|
144
|
+
readonly chain: "Bsc";
|
|
145
|
+
readonly symbol: "BNB";
|
|
146
|
+
readonly decimals: 18;
|
|
147
|
+
};
|
|
148
|
+
readonly BscUsdc: {
|
|
149
|
+
readonly chain: "Bsc";
|
|
150
|
+
readonly symbol: "USDC";
|
|
151
|
+
readonly decimals: 18;
|
|
152
|
+
};
|
|
153
|
+
readonly BscUsdt: {
|
|
154
|
+
readonly chain: "Bsc";
|
|
155
|
+
readonly symbol: "USDT";
|
|
156
|
+
readonly decimals: 18;
|
|
157
|
+
};
|
|
158
|
+
readonly BscWbtc: {
|
|
159
|
+
readonly chain: "Bsc";
|
|
160
|
+
readonly symbol: "WBTC";
|
|
161
|
+
readonly decimals: 18;
|
|
162
|
+
};
|
|
163
|
+
readonly Trx: {
|
|
164
|
+
readonly chain: "Tron";
|
|
165
|
+
readonly symbol: "TRX";
|
|
166
|
+
readonly decimals: 6;
|
|
167
|
+
};
|
|
168
|
+
readonly TronUsdt: {
|
|
169
|
+
readonly chain: "Tron";
|
|
170
|
+
readonly symbol: "USDT";
|
|
171
|
+
readonly decimals: 6;
|
|
172
|
+
};
|
|
143
173
|
};
|
|
144
174
|
declare const anyAssetConstants: {
|
|
145
175
|
readonly Dot: {
|
|
@@ -222,8 +252,38 @@ declare const anyAssetConstants: {
|
|
|
222
252
|
readonly symbol: "USDT";
|
|
223
253
|
readonly decimals: 6;
|
|
224
254
|
};
|
|
255
|
+
readonly Bnb: {
|
|
256
|
+
readonly chain: "Bsc";
|
|
257
|
+
readonly symbol: "BNB";
|
|
258
|
+
readonly decimals: 18;
|
|
259
|
+
};
|
|
260
|
+
readonly BscUsdc: {
|
|
261
|
+
readonly chain: "Bsc";
|
|
262
|
+
readonly symbol: "USDC";
|
|
263
|
+
readonly decimals: 18;
|
|
264
|
+
};
|
|
265
|
+
readonly BscUsdt: {
|
|
266
|
+
readonly chain: "Bsc";
|
|
267
|
+
readonly symbol: "USDT";
|
|
268
|
+
readonly decimals: 18;
|
|
269
|
+
};
|
|
270
|
+
readonly BscWbtc: {
|
|
271
|
+
readonly chain: "Bsc";
|
|
272
|
+
readonly symbol: "WBTC";
|
|
273
|
+
readonly decimals: 18;
|
|
274
|
+
};
|
|
275
|
+
readonly Trx: {
|
|
276
|
+
readonly chain: "Tron";
|
|
277
|
+
readonly symbol: "TRX";
|
|
278
|
+
readonly decimals: 6;
|
|
279
|
+
};
|
|
280
|
+
readonly TronUsdt: {
|
|
281
|
+
readonly chain: "Tron";
|
|
282
|
+
readonly symbol: "USDT";
|
|
283
|
+
readonly decimals: 6;
|
|
284
|
+
};
|
|
225
285
|
};
|
|
226
|
-
declare const assetSymbols: readonly ["BTC", "DOT", "ETH", "FLIP", "SOL", "USDC", "USDT", "WBTC"];
|
|
286
|
+
declare const assetSymbols: readonly ["BNB", "BTC", "DOT", "ETH", "FLIP", "SOL", "TRX", "USDC", "USDT", "WBTC"];
|
|
227
287
|
type AssetSymbol = (typeof assetSymbols)[number];
|
|
228
288
|
declare const chainConstants: {
|
|
229
289
|
readonly Ethereum: {
|
|
@@ -261,6 +321,20 @@ declare const chainConstants: {
|
|
|
261
321
|
readonly addressType: "Hub";
|
|
262
322
|
readonly blockTimeSeconds: 3;
|
|
263
323
|
};
|
|
324
|
+
readonly Bsc: {
|
|
325
|
+
readonly chainflipAssets: ["Bnb", "BscUsdc", "BscUsdt", "BscWbtc"];
|
|
326
|
+
readonly assets: ["BNB", "USDC", "USDT", "WBTC"];
|
|
327
|
+
readonly gasAsset: "Bnb";
|
|
328
|
+
readonly addressType: "Bsc";
|
|
329
|
+
readonly blockTimeSeconds: 0.45;
|
|
330
|
+
};
|
|
331
|
+
readonly Tron: {
|
|
332
|
+
readonly chainflipAssets: ["Trx", "TronUsdt"];
|
|
333
|
+
readonly assets: ["TRX", "USDT"];
|
|
334
|
+
readonly gasAsset: "Trx";
|
|
335
|
+
readonly addressType: "Tron";
|
|
336
|
+
readonly blockTimeSeconds: 3;
|
|
337
|
+
};
|
|
264
338
|
};
|
|
265
339
|
declare const anyChainConstants: {
|
|
266
340
|
readonly Polkadot: {
|
|
@@ -305,6 +379,20 @@ declare const anyChainConstants: {
|
|
|
305
379
|
readonly addressType: "Hub";
|
|
306
380
|
readonly blockTimeSeconds: 3;
|
|
307
381
|
};
|
|
382
|
+
readonly Bsc: {
|
|
383
|
+
readonly chainflipAssets: ["Bnb", "BscUsdc", "BscUsdt", "BscWbtc"];
|
|
384
|
+
readonly assets: ["BNB", "USDC", "USDT", "WBTC"];
|
|
385
|
+
readonly gasAsset: "Bnb";
|
|
386
|
+
readonly addressType: "Bsc";
|
|
387
|
+
readonly blockTimeSeconds: 0.45;
|
|
388
|
+
};
|
|
389
|
+
readonly Tron: {
|
|
390
|
+
readonly chainflipAssets: ["Trx", "TronUsdt"];
|
|
391
|
+
readonly assets: ["TRX", "USDT"];
|
|
392
|
+
readonly gasAsset: "Trx";
|
|
393
|
+
readonly addressType: "Tron";
|
|
394
|
+
readonly blockTimeSeconds: 3;
|
|
395
|
+
};
|
|
308
396
|
};
|
|
309
397
|
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain>;
|
|
310
398
|
declare const anyInternalAssetToRpcAsset: AnyInternalAssetMap<AnyAssetAndChain>;
|
package/dist/chainflip.mjs
CHANGED
|
@@ -14,7 +14,13 @@ const chainflipAssets = [
|
|
|
14
14
|
"SolUsdt",
|
|
15
15
|
"HubDot",
|
|
16
16
|
"HubUsdt",
|
|
17
|
-
"HubUsdc"
|
|
17
|
+
"HubUsdc",
|
|
18
|
+
"Bnb",
|
|
19
|
+
"BscUsdc",
|
|
20
|
+
"BscUsdt",
|
|
21
|
+
"BscWbtc",
|
|
22
|
+
"Trx",
|
|
23
|
+
"TronUsdt"
|
|
18
24
|
];
|
|
19
25
|
const legacyChainflipAssets = ["Dot"];
|
|
20
26
|
const priceAssets = [
|
|
@@ -27,12 +33,17 @@ const priceAssets = [
|
|
|
27
33
|
"Fine"
|
|
28
34
|
];
|
|
29
35
|
const baseChainflipAssets = chainflipAssets.filter((asset) => asset !== "Usdc");
|
|
30
|
-
const chainflipEvmChains = [
|
|
36
|
+
const chainflipEvmChains = [
|
|
37
|
+
"Ethereum",
|
|
38
|
+
"Arbitrum",
|
|
39
|
+
"Bsc"
|
|
40
|
+
];
|
|
31
41
|
const chainflipChains = [
|
|
32
42
|
...chainflipEvmChains,
|
|
33
43
|
"Bitcoin",
|
|
34
44
|
"Solana",
|
|
35
|
-
"Assethub"
|
|
45
|
+
"Assethub",
|
|
46
|
+
"Tron"
|
|
36
47
|
];
|
|
37
48
|
const legacyChainflipChains = ["Polkadot"];
|
|
38
49
|
const chainflipNetworks = [
|
|
@@ -46,7 +57,9 @@ const addressTypes = [
|
|
|
46
57
|
"Btc",
|
|
47
58
|
"Arb",
|
|
48
59
|
"Sol",
|
|
49
|
-
"Hub"
|
|
60
|
+
"Hub",
|
|
61
|
+
"Bsc",
|
|
62
|
+
"Tron"
|
|
50
63
|
];
|
|
51
64
|
const legacyAddressTypes = ["Dot"];
|
|
52
65
|
function readAssetValue(map, asset) {
|
|
@@ -127,6 +140,36 @@ const assetConstants = {
|
|
|
127
140
|
chain: "Assethub",
|
|
128
141
|
symbol: "USDT",
|
|
129
142
|
decimals: 6
|
|
143
|
+
},
|
|
144
|
+
Bnb: {
|
|
145
|
+
chain: "Bsc",
|
|
146
|
+
symbol: "BNB",
|
|
147
|
+
decimals: 18
|
|
148
|
+
},
|
|
149
|
+
BscUsdc: {
|
|
150
|
+
chain: "Bsc",
|
|
151
|
+
symbol: "USDC",
|
|
152
|
+
decimals: 18
|
|
153
|
+
},
|
|
154
|
+
BscUsdt: {
|
|
155
|
+
chain: "Bsc",
|
|
156
|
+
symbol: "USDT",
|
|
157
|
+
decimals: 18
|
|
158
|
+
},
|
|
159
|
+
BscWbtc: {
|
|
160
|
+
chain: "Bsc",
|
|
161
|
+
symbol: "WBTC",
|
|
162
|
+
decimals: 18
|
|
163
|
+
},
|
|
164
|
+
Trx: {
|
|
165
|
+
chain: "Tron",
|
|
166
|
+
symbol: "TRX",
|
|
167
|
+
decimals: 6
|
|
168
|
+
},
|
|
169
|
+
TronUsdt: {
|
|
170
|
+
chain: "Tron",
|
|
171
|
+
symbol: "USDT",
|
|
172
|
+
decimals: 6
|
|
130
173
|
}
|
|
131
174
|
};
|
|
132
175
|
const anyAssetConstants = {
|
|
@@ -138,11 +181,13 @@ const anyAssetConstants = {
|
|
|
138
181
|
}
|
|
139
182
|
};
|
|
140
183
|
const assetSymbols = [
|
|
184
|
+
"BNB",
|
|
141
185
|
"BTC",
|
|
142
186
|
"DOT",
|
|
143
187
|
"ETH",
|
|
144
188
|
"FLIP",
|
|
145
189
|
"SOL",
|
|
190
|
+
"TRX",
|
|
146
191
|
"USDC",
|
|
147
192
|
"USDT",
|
|
148
193
|
"WBTC"
|
|
@@ -218,6 +263,30 @@ const chainConstants = {
|
|
|
218
263
|
gasAsset: "HubDot",
|
|
219
264
|
addressType: "Hub",
|
|
220
265
|
blockTimeSeconds: 3
|
|
266
|
+
},
|
|
267
|
+
Bsc: {
|
|
268
|
+
chainflipAssets: [
|
|
269
|
+
"Bnb",
|
|
270
|
+
"BscUsdc",
|
|
271
|
+
"BscUsdt",
|
|
272
|
+
"BscWbtc"
|
|
273
|
+
],
|
|
274
|
+
assets: [
|
|
275
|
+
"BNB",
|
|
276
|
+
"USDC",
|
|
277
|
+
"USDT",
|
|
278
|
+
"WBTC"
|
|
279
|
+
],
|
|
280
|
+
gasAsset: "Bnb",
|
|
281
|
+
addressType: "Bsc",
|
|
282
|
+
blockTimeSeconds: .45
|
|
283
|
+
},
|
|
284
|
+
Tron: {
|
|
285
|
+
chainflipAssets: ["Trx", "TronUsdt"],
|
|
286
|
+
assets: ["TRX", "USDT"],
|
|
287
|
+
gasAsset: "Trx",
|
|
288
|
+
addressType: "Tron",
|
|
289
|
+
blockTimeSeconds: 3
|
|
221
290
|
}
|
|
222
291
|
};
|
|
223
292
|
const anyChainConstants = {
|
|
@@ -290,6 +359,30 @@ const internalAssetToRpcAsset = {
|
|
|
290
359
|
HubUsdc: {
|
|
291
360
|
chain: "Assethub",
|
|
292
361
|
asset: "USDC"
|
|
362
|
+
},
|
|
363
|
+
Bnb: {
|
|
364
|
+
chain: "Bsc",
|
|
365
|
+
asset: "BNB"
|
|
366
|
+
},
|
|
367
|
+
BscUsdc: {
|
|
368
|
+
chain: "Bsc",
|
|
369
|
+
asset: "USDC"
|
|
370
|
+
},
|
|
371
|
+
BscUsdt: {
|
|
372
|
+
chain: "Bsc",
|
|
373
|
+
asset: "USDT"
|
|
374
|
+
},
|
|
375
|
+
BscWbtc: {
|
|
376
|
+
chain: "Bsc",
|
|
377
|
+
asset: "WBTC"
|
|
378
|
+
},
|
|
379
|
+
Trx: {
|
|
380
|
+
chain: "Tron",
|
|
381
|
+
asset: "TRX"
|
|
382
|
+
},
|
|
383
|
+
TronUsdt: {
|
|
384
|
+
chain: "Tron",
|
|
385
|
+
asset: "USDT"
|
|
293
386
|
}
|
|
294
387
|
};
|
|
295
388
|
const anyInternalAssetToRpcAsset = {
|
|
@@ -304,7 +397,9 @@ const chainContractId = {
|
|
|
304
397
|
Bitcoin: 3,
|
|
305
398
|
Arbitrum: 4,
|
|
306
399
|
Solana: 5,
|
|
307
|
-
Assethub: 6
|
|
400
|
+
Assethub: 6,
|
|
401
|
+
Bsc: 7,
|
|
402
|
+
Tron: 8
|
|
308
403
|
};
|
|
309
404
|
const assetContractId = {
|
|
310
405
|
Eth: 1,
|
|
@@ -321,7 +416,13 @@ const assetContractId = {
|
|
|
321
416
|
HubUsdc: 13,
|
|
322
417
|
Wbtc: 14,
|
|
323
418
|
ArbUsdt: 15,
|
|
324
|
-
SolUsdt: 16
|
|
419
|
+
SolUsdt: 16,
|
|
420
|
+
Bnb: 17,
|
|
421
|
+
BscUsdt: 18,
|
|
422
|
+
BscUsdc: 21,
|
|
423
|
+
BscWbtc: 22,
|
|
424
|
+
Trx: 19,
|
|
425
|
+
TronUsdt: 20
|
|
325
426
|
};
|
|
326
427
|
function getInternalAsset(asset, assert = true) {
|
|
327
428
|
const internalAsset = {
|
|
@@ -347,6 +448,16 @@ function getInternalAsset(asset, assert = true) {
|
|
|
347
448
|
USDC: "HubUsdc",
|
|
348
449
|
USDT: "HubUsdt",
|
|
349
450
|
DOT: "HubDot"
|
|
451
|
+
},
|
|
452
|
+
Bsc: {
|
|
453
|
+
BNB: "Bnb",
|
|
454
|
+
USDC: "BscUsdc",
|
|
455
|
+
USDT: "BscUsdt",
|
|
456
|
+
WBTC: "BscWbtc"
|
|
457
|
+
},
|
|
458
|
+
Tron: {
|
|
459
|
+
TRX: "Trx",
|
|
460
|
+
USDT: "TronUsdt"
|
|
350
461
|
}
|
|
351
462
|
}[asset.chain]?.[asset.asset];
|
|
352
463
|
if (internalAsset) return internalAsset;
|
|
@@ -389,7 +500,13 @@ const chainflipAssetToPriceAssetMap = {
|
|
|
389
500
|
HubUsdt: "Usdt",
|
|
390
501
|
Flip: null,
|
|
391
502
|
HubDot: null,
|
|
392
|
-
Wbtc: "Btc"
|
|
503
|
+
Wbtc: "Btc",
|
|
504
|
+
Bnb: null,
|
|
505
|
+
BscUsdc: "Usdc",
|
|
506
|
+
BscUsdt: "Usdt",
|
|
507
|
+
BscWbtc: "Btc",
|
|
508
|
+
Trx: null,
|
|
509
|
+
TronUsdt: "Usdt"
|
|
393
510
|
};
|
|
394
511
|
function isChainflipAsset(asset) {
|
|
395
512
|
return chainflipAssets.includes(asset);
|
package/dist/consts.cjs
CHANGED
|
@@ -211,6 +211,14 @@ const brokerAliasMap = {
|
|
|
211
211
|
cFNqDaZ9apGKt9uXaGQGucWuizVeTms2cXq8hnYM8g7y99Cpy: {
|
|
212
212
|
name: "Trocador",
|
|
213
213
|
twitter: "@TrocadorApp"
|
|
214
|
+
},
|
|
215
|
+
cFMDwBJmeivhWdYp6wSjDUdzqDV64A4efceRYHyHWTPHfQUZX: {
|
|
216
|
+
name: "Xverse",
|
|
217
|
+
twitter: "@xverse"
|
|
218
|
+
},
|
|
219
|
+
cFJ3dosNpW1X2GniSPsUKzWMnJW7NBBcNbimUBDnxa1Cfb551: {
|
|
220
|
+
name: "OrangeRock",
|
|
221
|
+
twitter: "@orangerock.xyz"
|
|
214
222
|
}
|
|
215
223
|
};
|
|
216
224
|
const lpAliasMap = {
|
package/dist/consts.mjs
CHANGED
|
@@ -209,6 +209,14 @@ const brokerAliasMap = {
|
|
|
209
209
|
cFNqDaZ9apGKt9uXaGQGucWuizVeTms2cXq8hnYM8g7y99Cpy: {
|
|
210
210
|
name: "Trocador",
|
|
211
211
|
twitter: "@TrocadorApp"
|
|
212
|
+
},
|
|
213
|
+
cFMDwBJmeivhWdYp6wSjDUdzqDV64A4efceRYHyHWTPHfQUZX: {
|
|
214
|
+
name: "Xverse",
|
|
215
|
+
twitter: "@xverse"
|
|
216
|
+
},
|
|
217
|
+
cFJ3dosNpW1X2GniSPsUKzWMnJW7NBBcNbimUBDnxa1Cfb551: {
|
|
218
|
+
name: "OrangeRock",
|
|
219
|
+
twitter: "@orangerock.xyz"
|
|
212
220
|
}
|
|
213
221
|
};
|
|
214
222
|
const lpAliasMap = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainflip/utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4-bsc-dev.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@date-fns/utc": "^2.1.1",
|
|
26
26
|
"@noble/hashes": "^2.0.1",
|
|
27
|
-
"bignumber.js": "^
|
|
27
|
+
"bignumber.js": "^10.0.2",
|
|
28
28
|
"date-fns": "4.1.0"
|
|
29
29
|
},
|
|
30
30
|
"repository": "https://github.com/chainflip-io/chainflip-product-toolkit.git",
|