@chainflip/utils 2.1.5 → 2.1.7-tron-dev.2

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.
@@ -14,6 +14,8 @@ const chainflipAssets = [
14
14
  "Sol",
15
15
  "SolUsdc",
16
16
  "SolUsdt",
17
+ "Trx",
18
+ "TrxUsdt",
17
19
  "HubDot",
18
20
  "HubUsdt",
19
21
  "HubUsdc"
@@ -29,7 +31,11 @@ const priceAssets = [
29
31
  "Fine"
30
32
  ];
31
33
  const baseChainflipAssets = chainflipAssets.filter((asset) => asset !== "Usdc");
32
- const chainflipEvmChains = ["Ethereum", "Arbitrum"];
34
+ const chainflipEvmChains = [
35
+ "Ethereum",
36
+ "Arbitrum",
37
+ "Tron"
38
+ ];
33
39
  const chainflipChains = [
34
40
  ...chainflipEvmChains,
35
41
  "Bitcoin",
@@ -48,7 +54,8 @@ const addressTypes = [
48
54
  "Btc",
49
55
  "Arb",
50
56
  "Sol",
51
- "Hub"
57
+ "Hub",
58
+ "Tron"
52
59
  ];
53
60
  const legacyAddressTypes = ["Dot"];
54
61
  function readAssetValue(map, asset) {
@@ -129,6 +136,16 @@ const assetConstants = {
129
136
  chain: "Assethub",
130
137
  symbol: "USDT",
131
138
  decimals: 6
139
+ },
140
+ Trx: {
141
+ chain: "Tron",
142
+ symbol: "TRX",
143
+ decimals: 6
144
+ },
145
+ TrxUsdt: {
146
+ chain: "Tron",
147
+ symbol: "USDT",
148
+ decimals: 6
132
149
  }
133
150
  };
134
151
  const anyAssetConstants = {
@@ -147,7 +164,8 @@ const assetSymbols = [
147
164
  "SOL",
148
165
  "USDC",
149
166
  "USDT",
150
- "WBTC"
167
+ "WBTC",
168
+ "TRX"
151
169
  ];
152
170
  const chainConstants = {
153
171
  Ethereum: {
@@ -220,6 +238,13 @@ const chainConstants = {
220
238
  gasAsset: "HubDot",
221
239
  addressType: "Hub",
222
240
  blockTimeSeconds: 3
241
+ },
242
+ Tron: {
243
+ chainflipAssets: ["Trx", "TrxUsdt"],
244
+ assets: ["TRX", "USDT"],
245
+ gasAsset: "Trx",
246
+ addressType: "Tron",
247
+ blockTimeSeconds: 3
223
248
  }
224
249
  };
225
250
  const anyChainConstants = {
@@ -292,6 +317,14 @@ const internalAssetToRpcAsset = {
292
317
  HubUsdc: {
293
318
  chain: "Assethub",
294
319
  asset: "USDC"
320
+ },
321
+ Trx: {
322
+ chain: "Tron",
323
+ asset: "TRX"
324
+ },
325
+ TrxUsdt: {
326
+ chain: "Tron",
327
+ asset: "USDT"
295
328
  }
296
329
  };
297
330
  const anyInternalAssetToRpcAsset = {
@@ -306,7 +339,8 @@ const chainContractId = {
306
339
  Bitcoin: 3,
307
340
  Arbitrum: 4,
308
341
  Solana: 5,
309
- Assethub: 6
342
+ Assethub: 6,
343
+ Tron: 7
310
344
  };
311
345
  const assetContractId = {
312
346
  Eth: 1,
@@ -323,7 +357,9 @@ const assetContractId = {
323
357
  HubUsdc: 13,
324
358
  Wbtc: 14,
325
359
  ArbUsdt: 15,
326
- SolUsdt: 16
360
+ SolUsdt: 16,
361
+ Trx: 17,
362
+ TrxUsdt: 18
327
363
  };
328
364
  function getInternalAsset(asset, assert = true) {
329
365
  const internalAsset = {
@@ -349,6 +385,10 @@ function getInternalAsset(asset, assert = true) {
349
385
  USDC: "HubUsdc",
350
386
  USDT: "HubUsdt",
351
387
  DOT: "HubDot"
388
+ },
389
+ Tron: {
390
+ TRX: "Trx",
391
+ USDT: "TrxUsdt"
352
392
  }
353
393
  }[asset.chain]?.[asset.asset];
354
394
  if (internalAsset) return internalAsset;
@@ -391,7 +431,9 @@ const chainflipAssetToPriceAssetMap = {
391
431
  HubUsdt: "Usdt",
392
432
  Flip: null,
393
433
  HubDot: null,
394
- Wbtc: "Btc"
434
+ Wbtc: "Btc",
435
+ Trx: null,
436
+ TrxUsdt: "Usdt"
395
437
  };
396
438
  function isChainflipAsset(asset) {
397
439
  return chainflipAssets.includes(asset);
@@ -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", "Trx", "TrxUsdt", "HubDot", "HubUsdt", "HubUsdc"];
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", "Tron"];
13
13
  type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
14
- declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Solana", "Assethub"];
14
+ declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Tron", "Bitcoin", "Solana", "Assethub"];
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", "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,16 @@ declare const assetConstants: {
140
140
  readonly symbol: "USDT";
141
141
  readonly decimals: 6;
142
142
  };
143
+ readonly Trx: {
144
+ readonly chain: "Tron";
145
+ readonly symbol: "TRX";
146
+ readonly decimals: 6;
147
+ };
148
+ readonly TrxUsdt: {
149
+ readonly chain: "Tron";
150
+ readonly symbol: "USDT";
151
+ readonly decimals: 6;
152
+ };
143
153
  };
144
154
  declare const anyAssetConstants: {
145
155
  readonly Dot: {
@@ -222,8 +232,18 @@ declare const anyAssetConstants: {
222
232
  readonly symbol: "USDT";
223
233
  readonly decimals: 6;
224
234
  };
235
+ readonly Trx: {
236
+ readonly chain: "Tron";
237
+ readonly symbol: "TRX";
238
+ readonly decimals: 6;
239
+ };
240
+ readonly TrxUsdt: {
241
+ readonly chain: "Tron";
242
+ readonly symbol: "USDT";
243
+ readonly decimals: 6;
244
+ };
225
245
  };
226
- declare const assetSymbols: readonly ["BTC", "DOT", "ETH", "FLIP", "SOL", "USDC", "USDT", "WBTC"];
246
+ declare const assetSymbols: readonly ["BTC", "DOT", "ETH", "FLIP", "SOL", "USDC", "USDT", "WBTC", "TRX"];
227
247
  type AssetSymbol = (typeof assetSymbols)[number];
228
248
  declare const chainConstants: {
229
249
  readonly Ethereum: {
@@ -261,6 +281,13 @@ declare const chainConstants: {
261
281
  readonly addressType: "Hub";
262
282
  readonly blockTimeSeconds: 3;
263
283
  };
284
+ readonly Tron: {
285
+ readonly chainflipAssets: ["Trx", "TrxUsdt"];
286
+ readonly assets: ["TRX", "USDT"];
287
+ readonly gasAsset: "Trx";
288
+ readonly addressType: "Tron";
289
+ readonly blockTimeSeconds: 3;
290
+ };
264
291
  };
265
292
  declare const anyChainConstants: {
266
293
  readonly Polkadot: {
@@ -305,6 +332,13 @@ declare const anyChainConstants: {
305
332
  readonly addressType: "Hub";
306
333
  readonly blockTimeSeconds: 3;
307
334
  };
335
+ readonly Tron: {
336
+ readonly chainflipAssets: ["Trx", "TrxUsdt"];
337
+ readonly assets: ["TRX", "USDT"];
338
+ readonly gasAsset: "Trx";
339
+ readonly addressType: "Tron";
340
+ readonly blockTimeSeconds: 3;
341
+ };
308
342
  };
309
343
  declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain>;
310
344
  declare const anyInternalAssetToRpcAsset: AnyInternalAssetMap<AnyAssetAndChain>;
@@ -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", "Trx", "TrxUsdt", "HubDot", "HubUsdt", "HubUsdc"];
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", "Tron"];
13
13
  type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
14
- declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Solana", "Assethub"];
14
+ declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Tron", "Bitcoin", "Solana", "Assethub"];
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", "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,16 @@ declare const assetConstants: {
140
140
  readonly symbol: "USDT";
141
141
  readonly decimals: 6;
142
142
  };
143
+ readonly Trx: {
144
+ readonly chain: "Tron";
145
+ readonly symbol: "TRX";
146
+ readonly decimals: 6;
147
+ };
148
+ readonly TrxUsdt: {
149
+ readonly chain: "Tron";
150
+ readonly symbol: "USDT";
151
+ readonly decimals: 6;
152
+ };
143
153
  };
144
154
  declare const anyAssetConstants: {
145
155
  readonly Dot: {
@@ -222,8 +232,18 @@ declare const anyAssetConstants: {
222
232
  readonly symbol: "USDT";
223
233
  readonly decimals: 6;
224
234
  };
235
+ readonly Trx: {
236
+ readonly chain: "Tron";
237
+ readonly symbol: "TRX";
238
+ readonly decimals: 6;
239
+ };
240
+ readonly TrxUsdt: {
241
+ readonly chain: "Tron";
242
+ readonly symbol: "USDT";
243
+ readonly decimals: 6;
244
+ };
225
245
  };
226
- declare const assetSymbols: readonly ["BTC", "DOT", "ETH", "FLIP", "SOL", "USDC", "USDT", "WBTC"];
246
+ declare const assetSymbols: readonly ["BTC", "DOT", "ETH", "FLIP", "SOL", "USDC", "USDT", "WBTC", "TRX"];
227
247
  type AssetSymbol = (typeof assetSymbols)[number];
228
248
  declare const chainConstants: {
229
249
  readonly Ethereum: {
@@ -261,6 +281,13 @@ declare const chainConstants: {
261
281
  readonly addressType: "Hub";
262
282
  readonly blockTimeSeconds: 3;
263
283
  };
284
+ readonly Tron: {
285
+ readonly chainflipAssets: ["Trx", "TrxUsdt"];
286
+ readonly assets: ["TRX", "USDT"];
287
+ readonly gasAsset: "Trx";
288
+ readonly addressType: "Tron";
289
+ readonly blockTimeSeconds: 3;
290
+ };
264
291
  };
265
292
  declare const anyChainConstants: {
266
293
  readonly Polkadot: {
@@ -305,6 +332,13 @@ declare const anyChainConstants: {
305
332
  readonly addressType: "Hub";
306
333
  readonly blockTimeSeconds: 3;
307
334
  };
335
+ readonly Tron: {
336
+ readonly chainflipAssets: ["Trx", "TrxUsdt"];
337
+ readonly assets: ["TRX", "USDT"];
338
+ readonly gasAsset: "Trx";
339
+ readonly addressType: "Tron";
340
+ readonly blockTimeSeconds: 3;
341
+ };
308
342
  };
309
343
  declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain>;
310
344
  declare const anyInternalAssetToRpcAsset: AnyInternalAssetMap<AnyAssetAndChain>;
@@ -12,6 +12,8 @@ const chainflipAssets = [
12
12
  "Sol",
13
13
  "SolUsdc",
14
14
  "SolUsdt",
15
+ "Trx",
16
+ "TrxUsdt",
15
17
  "HubDot",
16
18
  "HubUsdt",
17
19
  "HubUsdc"
@@ -27,7 +29,11 @@ const priceAssets = [
27
29
  "Fine"
28
30
  ];
29
31
  const baseChainflipAssets = chainflipAssets.filter((asset) => asset !== "Usdc");
30
- const chainflipEvmChains = ["Ethereum", "Arbitrum"];
32
+ const chainflipEvmChains = [
33
+ "Ethereum",
34
+ "Arbitrum",
35
+ "Tron"
36
+ ];
31
37
  const chainflipChains = [
32
38
  ...chainflipEvmChains,
33
39
  "Bitcoin",
@@ -46,7 +52,8 @@ const addressTypes = [
46
52
  "Btc",
47
53
  "Arb",
48
54
  "Sol",
49
- "Hub"
55
+ "Hub",
56
+ "Tron"
50
57
  ];
51
58
  const legacyAddressTypes = ["Dot"];
52
59
  function readAssetValue(map, asset) {
@@ -127,6 +134,16 @@ const assetConstants = {
127
134
  chain: "Assethub",
128
135
  symbol: "USDT",
129
136
  decimals: 6
137
+ },
138
+ Trx: {
139
+ chain: "Tron",
140
+ symbol: "TRX",
141
+ decimals: 6
142
+ },
143
+ TrxUsdt: {
144
+ chain: "Tron",
145
+ symbol: "USDT",
146
+ decimals: 6
130
147
  }
131
148
  };
132
149
  const anyAssetConstants = {
@@ -145,7 +162,8 @@ const assetSymbols = [
145
162
  "SOL",
146
163
  "USDC",
147
164
  "USDT",
148
- "WBTC"
165
+ "WBTC",
166
+ "TRX"
149
167
  ];
150
168
  const chainConstants = {
151
169
  Ethereum: {
@@ -218,6 +236,13 @@ const chainConstants = {
218
236
  gasAsset: "HubDot",
219
237
  addressType: "Hub",
220
238
  blockTimeSeconds: 3
239
+ },
240
+ Tron: {
241
+ chainflipAssets: ["Trx", "TrxUsdt"],
242
+ assets: ["TRX", "USDT"],
243
+ gasAsset: "Trx",
244
+ addressType: "Tron",
245
+ blockTimeSeconds: 3
221
246
  }
222
247
  };
223
248
  const anyChainConstants = {
@@ -290,6 +315,14 @@ const internalAssetToRpcAsset = {
290
315
  HubUsdc: {
291
316
  chain: "Assethub",
292
317
  asset: "USDC"
318
+ },
319
+ Trx: {
320
+ chain: "Tron",
321
+ asset: "TRX"
322
+ },
323
+ TrxUsdt: {
324
+ chain: "Tron",
325
+ asset: "USDT"
293
326
  }
294
327
  };
295
328
  const anyInternalAssetToRpcAsset = {
@@ -304,7 +337,8 @@ const chainContractId = {
304
337
  Bitcoin: 3,
305
338
  Arbitrum: 4,
306
339
  Solana: 5,
307
- Assethub: 6
340
+ Assethub: 6,
341
+ Tron: 7
308
342
  };
309
343
  const assetContractId = {
310
344
  Eth: 1,
@@ -321,7 +355,9 @@ const assetContractId = {
321
355
  HubUsdc: 13,
322
356
  Wbtc: 14,
323
357
  ArbUsdt: 15,
324
- SolUsdt: 16
358
+ SolUsdt: 16,
359
+ Trx: 17,
360
+ TrxUsdt: 18
325
361
  };
326
362
  function getInternalAsset(asset, assert = true) {
327
363
  const internalAsset = {
@@ -347,6 +383,10 @@ function getInternalAsset(asset, assert = true) {
347
383
  USDC: "HubUsdc",
348
384
  USDT: "HubUsdt",
349
385
  DOT: "HubDot"
386
+ },
387
+ Tron: {
388
+ TRX: "Trx",
389
+ USDT: "TrxUsdt"
350
390
  }
351
391
  }[asset.chain]?.[asset.asset];
352
392
  if (internalAsset) return internalAsset;
@@ -389,7 +429,9 @@ const chainflipAssetToPriceAssetMap = {
389
429
  HubUsdt: "Usdt",
390
430
  Flip: null,
391
431
  HubDot: null,
392
- Wbtc: "Btc"
432
+ Wbtc: "Btc",
433
+ Trx: null,
434
+ TrxUsdt: "Usdt"
393
435
  };
394
436
  function isChainflipAsset(asset) {
395
437
  return chainflipAssets.includes(asset);
package/dist/consts.cjs CHANGED
@@ -317,7 +317,8 @@ const GENESIS_LP_ACCOUNT_IDS = [
317
317
  "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
318
318
  "cFMzM1G4He5k3Aa58X6d8yo8hRxiMVd92qrXMu1zKBXCqqTxi",
319
319
  "cFL8fmgKZcchhtLagBH2GKfsuWxBqUaD5CYE1m7DFb8DBSLJ1",
320
- "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK"
320
+ "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK",
321
+ "cFNyvsgnmKk3SyL1Z6PdVXk16wrFsEcQUq1owXefWQpvQJbxZ"
321
322
  ];
322
323
 
323
324
  //#endregion
package/dist/consts.mjs CHANGED
@@ -315,7 +315,8 @@ const GENESIS_LP_ACCOUNT_IDS = [
315
315
  "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
316
316
  "cFMzM1G4He5k3Aa58X6d8yo8hRxiMVd92qrXMu1zKBXCqqTxi",
317
317
  "cFL8fmgKZcchhtLagBH2GKfsuWxBqUaD5CYE1m7DFb8DBSLJ1",
318
- "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK"
318
+ "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK",
319
+ "cFNyvsgnmKk3SyL1Z6PdVXk16wrFsEcQUq1owXefWQpvQJbxZ"
319
320
  ];
320
321
 
321
322
  //#endregion
package/dist/tickMath.cjs CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_chainflip = require('./chainflip.cjs');
4
4
  let bignumber_js = require("bignumber.js");
5
- bignumber_js = require_runtime.__toESM(bignumber_js);
5
+ bignumber_js = require_runtime.__toESM(bignumber_js, 1);
6
6
 
7
7
  //#region src/tickMath.ts
8
8
  const MIN_TICK = -887272;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/utils",
3
- "version": "2.1.5",
3
+ "version": "2.1.7-tron-dev.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",