@chainflip/utils 2.1.4 → 2.1.7-tron-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.
@@ -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"
@@ -34,7 +36,8 @@ const chainflipChains = [
34
36
  ...chainflipEvmChains,
35
37
  "Bitcoin",
36
38
  "Solana",
37
- "Assethub"
39
+ "Assethub",
40
+ "Tron"
38
41
  ];
39
42
  const legacyChainflipChains = ["Polkadot"];
40
43
  const chainflipNetworks = [
@@ -48,7 +51,8 @@ const addressTypes = [
48
51
  "Btc",
49
52
  "Arb",
50
53
  "Sol",
51
- "Hub"
54
+ "Hub",
55
+ "Trx"
52
56
  ];
53
57
  const legacyAddressTypes = ["Dot"];
54
58
  function readAssetValue(map, asset) {
@@ -129,6 +133,16 @@ const assetConstants = {
129
133
  chain: "Assethub",
130
134
  symbol: "USDT",
131
135
  decimals: 6
136
+ },
137
+ Trx: {
138
+ chain: "Tron",
139
+ symbol: "TRX",
140
+ decimals: 6
141
+ },
142
+ TrxUsdt: {
143
+ chain: "Tron",
144
+ symbol: "USDT",
145
+ decimals: 6
132
146
  }
133
147
  };
134
148
  const anyAssetConstants = {
@@ -147,7 +161,8 @@ const assetSymbols = [
147
161
  "SOL",
148
162
  "USDC",
149
163
  "USDT",
150
- "WBTC"
164
+ "WBTC",
165
+ "TRX"
151
166
  ];
152
167
  const chainConstants = {
153
168
  Ethereum: {
@@ -220,6 +235,13 @@ const chainConstants = {
220
235
  gasAsset: "HubDot",
221
236
  addressType: "Hub",
222
237
  blockTimeSeconds: 3
238
+ },
239
+ Tron: {
240
+ chainflipAssets: ["Trx", "TrxUsdt"],
241
+ assets: ["TRX", "USDT"],
242
+ gasAsset: "Trx",
243
+ addressType: "Trx",
244
+ blockTimeSeconds: 3
223
245
  }
224
246
  };
225
247
  const anyChainConstants = {
@@ -292,6 +314,14 @@ const internalAssetToRpcAsset = {
292
314
  HubUsdc: {
293
315
  chain: "Assethub",
294
316
  asset: "USDC"
317
+ },
318
+ Trx: {
319
+ chain: "Tron",
320
+ asset: "TRX"
321
+ },
322
+ TrxUsdt: {
323
+ chain: "Tron",
324
+ asset: "USDT"
295
325
  }
296
326
  };
297
327
  const anyInternalAssetToRpcAsset = {
@@ -306,7 +336,8 @@ const chainContractId = {
306
336
  Bitcoin: 3,
307
337
  Arbitrum: 4,
308
338
  Solana: 5,
309
- Assethub: 6
339
+ Assethub: 6,
340
+ Tron: 8
310
341
  };
311
342
  const assetContractId = {
312
343
  Eth: 1,
@@ -323,7 +354,9 @@ const assetContractId = {
323
354
  HubUsdc: 13,
324
355
  Wbtc: 14,
325
356
  ArbUsdt: 15,
326
- SolUsdt: 16
357
+ SolUsdt: 16,
358
+ Trx: 17,
359
+ TrxUsdt: 18
327
360
  };
328
361
  function getInternalAsset(asset, assert = true) {
329
362
  const internalAsset = {
@@ -349,6 +382,10 @@ function getInternalAsset(asset, assert = true) {
349
382
  USDC: "HubUsdc",
350
383
  USDT: "HubUsdt",
351
384
  DOT: "HubDot"
385
+ },
386
+ Tron: {
387
+ TRX: "Trx",
388
+ USDT: "TrxUsdt"
352
389
  }
353
390
  }[asset.chain]?.[asset.asset];
354
391
  if (internalAsset) return internalAsset;
@@ -391,7 +428,9 @@ const chainflipAssetToPriceAssetMap = {
391
428
  HubUsdt: "Usdt",
392
429
  Flip: null,
393
430
  HubDot: null,
394
- Wbtc: "Btc"
431
+ Wbtc: "Btc",
432
+ Trx: null,
433
+ TrxUsdt: "Usdt"
395
434
  };
396
435
  function isChainflipAsset(asset) {
397
436
  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];
@@ -11,14 +11,14 @@ type AnyBaseChainflipAsset = Exclude<AnyChainflipAsset, 'Usdc'>;
11
11
  declare const baseChainflipAssets: BaseChainflipAsset[];
12
12
  declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum"];
13
13
  type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
14
- declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Solana", "Assethub"];
14
+ declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "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", "Trx"];
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: "Trx";
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: "Trx";
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];
@@ -11,14 +11,14 @@ type AnyBaseChainflipAsset = Exclude<AnyChainflipAsset, 'Usdc'>;
11
11
  declare const baseChainflipAssets: BaseChainflipAsset[];
12
12
  declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum"];
13
13
  type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
14
- declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Solana", "Assethub"];
14
+ declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "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", "Trx"];
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: "Trx";
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: "Trx";
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"
@@ -32,7 +34,8 @@ const chainflipChains = [
32
34
  ...chainflipEvmChains,
33
35
  "Bitcoin",
34
36
  "Solana",
35
- "Assethub"
37
+ "Assethub",
38
+ "Tron"
36
39
  ];
37
40
  const legacyChainflipChains = ["Polkadot"];
38
41
  const chainflipNetworks = [
@@ -46,7 +49,8 @@ const addressTypes = [
46
49
  "Btc",
47
50
  "Arb",
48
51
  "Sol",
49
- "Hub"
52
+ "Hub",
53
+ "Trx"
50
54
  ];
51
55
  const legacyAddressTypes = ["Dot"];
52
56
  function readAssetValue(map, asset) {
@@ -127,6 +131,16 @@ const assetConstants = {
127
131
  chain: "Assethub",
128
132
  symbol: "USDT",
129
133
  decimals: 6
134
+ },
135
+ Trx: {
136
+ chain: "Tron",
137
+ symbol: "TRX",
138
+ decimals: 6
139
+ },
140
+ TrxUsdt: {
141
+ chain: "Tron",
142
+ symbol: "USDT",
143
+ decimals: 6
130
144
  }
131
145
  };
132
146
  const anyAssetConstants = {
@@ -145,7 +159,8 @@ const assetSymbols = [
145
159
  "SOL",
146
160
  "USDC",
147
161
  "USDT",
148
- "WBTC"
162
+ "WBTC",
163
+ "TRX"
149
164
  ];
150
165
  const chainConstants = {
151
166
  Ethereum: {
@@ -218,6 +233,13 @@ const chainConstants = {
218
233
  gasAsset: "HubDot",
219
234
  addressType: "Hub",
220
235
  blockTimeSeconds: 3
236
+ },
237
+ Tron: {
238
+ chainflipAssets: ["Trx", "TrxUsdt"],
239
+ assets: ["TRX", "USDT"],
240
+ gasAsset: "Trx",
241
+ addressType: "Trx",
242
+ blockTimeSeconds: 3
221
243
  }
222
244
  };
223
245
  const anyChainConstants = {
@@ -290,6 +312,14 @@ const internalAssetToRpcAsset = {
290
312
  HubUsdc: {
291
313
  chain: "Assethub",
292
314
  asset: "USDC"
315
+ },
316
+ Trx: {
317
+ chain: "Tron",
318
+ asset: "TRX"
319
+ },
320
+ TrxUsdt: {
321
+ chain: "Tron",
322
+ asset: "USDT"
293
323
  }
294
324
  };
295
325
  const anyInternalAssetToRpcAsset = {
@@ -304,7 +334,8 @@ const chainContractId = {
304
334
  Bitcoin: 3,
305
335
  Arbitrum: 4,
306
336
  Solana: 5,
307
- Assethub: 6
337
+ Assethub: 6,
338
+ Tron: 8
308
339
  };
309
340
  const assetContractId = {
310
341
  Eth: 1,
@@ -321,7 +352,9 @@ const assetContractId = {
321
352
  HubUsdc: 13,
322
353
  Wbtc: 14,
323
354
  ArbUsdt: 15,
324
- SolUsdt: 16
355
+ SolUsdt: 16,
356
+ Trx: 17,
357
+ TrxUsdt: 18
325
358
  };
326
359
  function getInternalAsset(asset, assert = true) {
327
360
  const internalAsset = {
@@ -347,6 +380,10 @@ function getInternalAsset(asset, assert = true) {
347
380
  USDC: "HubUsdc",
348
381
  USDT: "HubUsdt",
349
382
  DOT: "HubDot"
383
+ },
384
+ Tron: {
385
+ TRX: "Trx",
386
+ USDT: "TrxUsdt"
350
387
  }
351
388
  }[asset.chain]?.[asset.asset];
352
389
  if (internalAsset) return internalAsset;
@@ -389,7 +426,9 @@ const chainflipAssetToPriceAssetMap = {
389
426
  HubUsdt: "Usdt",
390
427
  Flip: null,
391
428
  HubDot: null,
392
- Wbtc: "Btc"
429
+ Wbtc: "Btc",
430
+ Trx: null,
431
+ TrxUsdt: "Usdt"
393
432
  };
394
433
  function isChainflipAsset(asset) {
395
434
  return chainflipAssets.includes(asset);
package/dist/consts.cjs CHANGED
@@ -219,6 +219,10 @@ const brokerAliasMap = {
219
219
  cFJ3dosNpW1X2GniSPsUKzWMnJW7NBBcNbimUBDnxa1Cfb551: {
220
220
  name: "OrangeRock",
221
221
  twitter: "@orangerock.xyz"
222
+ },
223
+ cFLTrurprjV8jTV1yXop6Px8bG1hk4JKV6rgvQJU9nkneDYwg: {
224
+ name: "CoolWallet",
225
+ twitter: "@coolwallet"
222
226
  }
223
227
  };
224
228
  const lpAliasMap = {
@@ -313,7 +317,8 @@ const GENESIS_LP_ACCOUNT_IDS = [
313
317
  "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
314
318
  "cFMzM1G4He5k3Aa58X6d8yo8hRxiMVd92qrXMu1zKBXCqqTxi",
315
319
  "cFL8fmgKZcchhtLagBH2GKfsuWxBqUaD5CYE1m7DFb8DBSLJ1",
316
- "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK"
320
+ "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK",
321
+ "cFNyvsgnmKk3SyL1Z6PdVXk16wrFsEcQUq1owXefWQpvQJbxZ"
317
322
  ];
318
323
 
319
324
  //#endregion
package/dist/consts.mjs CHANGED
@@ -217,6 +217,10 @@ const brokerAliasMap = {
217
217
  cFJ3dosNpW1X2GniSPsUKzWMnJW7NBBcNbimUBDnxa1Cfb551: {
218
218
  name: "OrangeRock",
219
219
  twitter: "@orangerock.xyz"
220
+ },
221
+ cFLTrurprjV8jTV1yXop6Px8bG1hk4JKV6rgvQJU9nkneDYwg: {
222
+ name: "CoolWallet",
223
+ twitter: "@coolwallet"
220
224
  }
221
225
  };
222
226
  const lpAliasMap = {
@@ -311,7 +315,8 @@ const GENESIS_LP_ACCOUNT_IDS = [
311
315
  "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
312
316
  "cFMzM1G4He5k3Aa58X6d8yo8hRxiMVd92qrXMu1zKBXCqqTxi",
313
317
  "cFL8fmgKZcchhtLagBH2GKfsuWxBqUaD5CYE1m7DFb8DBSLJ1",
314
- "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK"
318
+ "cFJt3kyUdXvaoarfxJDLrFmHFqkXUgnVZ4zqqDLLTRjbJosmK",
319
+ "cFNyvsgnmKk3SyL1Z6PdVXk16wrFsEcQUq1owXefWQpvQJbxZ"
315
320
  ];
316
321
 
317
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.4",
3
+ "version": "2.1.7-tron-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": "^9.3.1",
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",