@swapkit/helpers 1.0.0-rc.99 → 1.0.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.
@@ -41,6 +41,17 @@ describe("AssetValue", () => {
41
41
  });
42
42
 
43
43
  expect(atomDerived.toString()).toBe("THOR.ATOM");
44
+
45
+ const radixXWBTC = new AssetValue({
46
+ identifier:
47
+ "RADIX.XWBTC-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75",
48
+ decimal: 8,
49
+ value: 11112222,
50
+ });
51
+
52
+ expect(radixXWBTC.toString()).toBe(
53
+ "RADIX.XWBTC-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75",
54
+ );
44
55
  });
45
56
  });
46
57
 
@@ -56,7 +67,7 @@ describe("AssetValue", () => {
56
67
  "AVAX.USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
57
68
  );
58
69
 
59
- const thor = AssetValue.fromChainOrSignature("ETH.THOR");
70
+ const thor = AssetValue.from({ asset: "ETH.THOR" });
60
71
  expect(thor.toUrl()).toBe("ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044");
61
72
 
62
73
  const ethSynth = new AssetValue({
@@ -79,9 +90,9 @@ describe("AssetValue", () => {
79
90
 
80
91
  describe("eq", () => {
81
92
  test("checks if assets are same chain and symbol", () => {
82
- const firstThor = AssetValue.fromChainOrSignature("ETH.THOR");
83
- const secondThor = AssetValue.fromChainOrSignature("ETH.THOR");
84
- const vThor = AssetValue.fromChainOrSignature("ETH.vTHOR");
93
+ const firstThor = AssetValue.from({ asset: "ETH.THOR" });
94
+ const secondThor = AssetValue.from({ asset: "ETH.THOR" });
95
+ const vThor = AssetValue.from({ asset: "ETH.vTHOR" });
85
96
  const firstUsdc = new AssetValue({
86
97
  chain: Chain.Avalanche,
87
98
  symbol: "USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
@@ -95,26 +106,51 @@ describe("AssetValue", () => {
95
106
  value: 1234,
96
107
  });
97
108
 
109
+ expect(firstThor.eqAsset(firstThor)).toBe(true);
110
+ expect(firstThor.eqAsset(secondThor)).toBe(true);
111
+ expect(firstThor.eqAsset(vThor)).toBe(false);
112
+ expect(firstThor.eqAsset(firstUsdc)).toBe(false);
113
+ expect(firstThor.eqAsset(secondUsdc)).toBe(false);
114
+
115
+ expect(firstUsdc.eqAsset(firstThor)).toBe(false);
116
+ expect(firstUsdc.eqAsset(secondThor)).toBe(false);
117
+ expect(firstUsdc.eqAsset(vThor)).toBe(false);
118
+ expect(firstUsdc.eqAsset(firstUsdc)).toBe(true);
119
+ expect(firstUsdc.eqAsset(secondUsdc)).toBe(true);
120
+ });
121
+
122
+ test("check if assets have same value, even if not same asset", () => {
123
+ const firstThor = AssetValue.from({ asset: "ETH.THOR", value: "20" });
124
+ const secondThor = AssetValue.from({ asset: "ETH.THOR", value: "35" });
125
+ const thirdThor = AssetValue.from({ asset: "ETH.THOR", value: "35" });
126
+ const vThor = AssetValue.from({ asset: "ETH.vTHOR", value: "20" });
127
+
128
+ expect(firstThor.eqValue(firstThor)).toBe(true);
129
+ expect(firstThor.eqValue(secondThor)).toBe(false);
130
+ expect(secondThor.eqValue(thirdThor)).toBe(true);
131
+ expect(firstThor.eqValue(vThor)).toBe(true);
132
+ });
133
+
134
+ test("check if assets have identical asset and value", () => {
135
+ const firstThor = AssetValue.from({ asset: "ETH.THOR", value: "20" });
136
+ const secondThor = AssetValue.from({ asset: "ETH.THOR", value: "35" });
137
+ const thirdThor = AssetValue.from({ asset: "ETH.THOR", value: "35" });
138
+ const vThor = AssetValue.from({ asset: "ETH.vTHOR", value: "20" });
139
+
98
140
  expect(firstThor.eq(firstThor)).toBe(true);
99
- expect(firstThor.eq(secondThor)).toBe(true);
141
+ expect(firstThor.eq(secondThor)).toBe(false);
142
+ expect(secondThor.eq(thirdThor)).toBe(true);
100
143
  expect(firstThor.eq(vThor)).toBe(false);
101
- expect(firstThor.eq(firstUsdc)).toBe(false);
102
- expect(firstThor.eq(secondUsdc)).toBe(false);
103
-
104
- expect(firstUsdc.eq(firstThor)).toBe(false);
105
- expect(firstUsdc.eq(secondThor)).toBe(false);
106
- expect(firstUsdc.eq(vThor)).toBe(false);
107
- expect(firstUsdc.eq(firstUsdc)).toBe(true);
108
- expect(firstUsdc.eq(secondUsdc)).toBe(true);
109
144
  });
110
145
  });
111
146
 
112
147
  describe("from bigint", () => {
113
148
  test("returns asset value with correct decimal", async () => {
114
- const avaxUSDCAsset = await AssetValue.fromIdentifier(
115
- `${Chain.Avalanche}.USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e`,
116
- 1234567800n,
117
- );
149
+ const avaxUSDCAsset = await AssetValue.from({
150
+ asset: `${Chain.Avalanche}.USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e`,
151
+ value: 1234567800n,
152
+ asyncTokenLookup: true,
153
+ });
118
154
  expect(avaxUSDCAsset.getValue("string")).toBe("1234.5678");
119
155
  });
120
156
  });
@@ -129,19 +165,20 @@ describe("AssetValue", () => {
129
165
  });
130
166
  expect(avaxUSDCAsset.toString()).toBe("AVAX.USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e");
131
167
 
132
- const thor = AssetValue.fromChainOrSignature("ETH.THOR");
168
+ const thor = AssetValue.from({ asset: "ETH.THOR" });
133
169
  expect(thor.toString()).toBe("ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044");
134
170
 
135
- const ethSynth = await AssetValue.fromIdentifier("ETH/ETH");
171
+ const ethSynth = await AssetValue.from({ asset: "ETH/ETH", asyncTokenLookup: true });
136
172
  expect(ethSynth.toString()).toBe("ETH/ETH");
137
173
  });
138
174
  });
139
175
 
140
176
  describe("fromIdentifier", () => {
141
177
  test("creates AssetValue from string", async () => {
142
- const avaxUSDCAsset = await AssetValue.fromIdentifier(
143
- "AVAX.USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
144
- );
178
+ const avaxUSDCAsset = await AssetValue.from({
179
+ asset: "AVAX.USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
180
+ asyncTokenLookup: true,
181
+ });
145
182
 
146
183
  expect(avaxUSDCAsset).toEqual(
147
184
  expect.objectContaining({
@@ -155,8 +192,12 @@ describe("AssetValue", () => {
155
192
  }),
156
193
  );
157
194
  });
195
+
158
196
  test("creates AssetValue from string with multiple dashes", async () => {
159
- const ethPendleLptAsset = await AssetValue.fromIdentifier("ETH.PENDLE-LPT-0x1234");
197
+ const ethPendleLptAsset = await AssetValue.from({
198
+ asset: "ETH.PENDLE-LPT-0x1234",
199
+ asyncTokenLookup: true,
200
+ });
160
201
 
161
202
  expect(ethPendleLptAsset).toEqual(
162
203
  expect.objectContaining({
@@ -175,7 +216,10 @@ describe("AssetValue", () => {
175
216
  describe("fromString", () => {
176
217
  test("creates AssetValue from string", async () => {
177
218
  const fakeAvaxAssetString = "AVAX.ASDF-1234";
178
- const fakeAvaxAsset = await AssetValue.fromString(fakeAvaxAssetString);
219
+ const fakeAvaxAsset = await AssetValue.from({
220
+ asset: fakeAvaxAssetString,
221
+ asyncTokenLookup: true,
222
+ });
179
223
 
180
224
  expect(fakeAvaxAsset).toEqual(
181
225
  expect.objectContaining({
@@ -189,9 +233,13 @@ describe("AssetValue", () => {
189
233
  }),
190
234
  );
191
235
  });
236
+
192
237
  test("creates AssetValue from string with multiple dashes", async () => {
193
238
  const fakeAvaxAssetString = "AVAX.ASDF-LP-1234";
194
- const fakeAvaxAsset = await AssetValue.fromString(fakeAvaxAssetString);
239
+ const fakeAvaxAsset = await AssetValue.from({
240
+ asset: fakeAvaxAssetString,
241
+ asyncTokenLookup: true,
242
+ });
195
243
 
196
244
  expect(fakeAvaxAsset).toEqual(
197
245
  expect.objectContaining({
@@ -205,12 +253,36 @@ describe("AssetValue", () => {
205
253
  }),
206
254
  );
207
255
  });
256
+
257
+ test("creates AssetValue with _ symbol", async () => {
258
+ const radixXWBTC = await AssetValue.from({
259
+ asset: "XRD.XWBTC-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75",
260
+ asyncTokenLookup: true,
261
+ });
262
+
263
+ expect(radixXWBTC).toEqual(
264
+ expect.objectContaining({
265
+ address: "resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75",
266
+ chain: Chain.Radix,
267
+ decimal: 8,
268
+ isGasAsset: false,
269
+ isSynthetic: false,
270
+ symbol: "XWBTC-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75",
271
+ ticker: "XWBTC",
272
+ }),
273
+ );
274
+ });
208
275
  });
209
276
 
210
277
  describe("fromStringWithBase", () => {
211
278
  test("creates AssetValue from string with base", async () => {
212
279
  const fakeAvaxAssetString = "AVAX.ASDF-1234";
213
- const fakeAvaxAsset = await AssetValue.fromStringWithBase(fakeAvaxAssetString, 1, 8);
280
+ const fakeAvaxAsset = await AssetValue.from({
281
+ asset: fakeAvaxAssetString,
282
+ value: 1,
283
+ fromBaseDecimal: 8,
284
+ asyncTokenLookup: true,
285
+ });
214
286
 
215
287
  expect(fakeAvaxAsset).toEqual(
216
288
  expect.objectContaining({
@@ -223,24 +295,24 @@ describe("AssetValue", () => {
223
295
  ticker: "ASDF",
224
296
  }),
225
297
  );
226
- expect(fakeAvaxAsset.getValue("string")).toBe("100000000");
227
- expect(fakeAvaxAsset.getBaseValue("string")).toBe("100000000000000000000000000");
298
+ expect(fakeAvaxAsset.getValue("string")).toBe("0.00000001");
299
+ expect(fakeAvaxAsset.getBaseValue("string")).toBe("10000000000");
228
300
  });
229
301
  });
230
302
 
231
303
  describe("fromUrl", () => {
232
- test("creates AssetValue from url like format", async () => {
304
+ test("creates AssetValue from url like format", () => {
233
305
  const synthETHString = "THOR.ETH.ETH";
234
306
  const ethString = "ETH.ETH";
235
307
  const thorString = "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044";
236
308
  const synthThorString = "THOR.ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044";
237
309
  const synthDashesString = "THOR.ETH.PENDLE-LPT-0x1234";
238
310
 
239
- const synthETH = await AssetValue.fromUrl(synthETHString);
240
- const eth = await AssetValue.fromUrl(ethString);
241
- const thor = await AssetValue.fromUrl(thorString);
242
- const synthThor = await AssetValue.fromUrl(synthThorString);
243
- const synthDashes = await AssetValue.fromUrl(synthDashesString);
311
+ const synthETH = AssetValue.fromUrl(synthETHString);
312
+ const eth = AssetValue.fromUrl(ethString);
313
+ const thor = AssetValue.fromUrl(thorString);
314
+ const synthThor = AssetValue.fromUrl(synthThorString);
315
+ const synthDashes = AssetValue.fromUrl(synthDashesString);
244
316
 
245
317
  expect(synthETH.toString()).toBe("ETH/ETH");
246
318
  expect(eth.toString()).toBe("ETH.ETH");
@@ -253,9 +325,9 @@ describe("AssetValue", () => {
253
325
  describe("fromIdentifierSync", () => {
254
326
  test("(same as fromIdentifier) - creates AssetValue from string via `@swapkit/tokens` lists", async () => {
255
327
  await AssetValue.loadStaticAssets();
256
- const thor = AssetValue.fromIdentifierSync(
257
- "ARB.USDT-0XFD086BC7CD5C481DCC9C85EBE478A1C0B69FCBB9",
258
- );
328
+ const thor = AssetValue.from({
329
+ asset: "ARB.USDT-0XFD086BC7CD5C481DCC9C85EBE478A1C0B69FCBB9",
330
+ });
259
331
 
260
332
  expect(thor).toBeDefined();
261
333
  expect(thor).toEqual(
@@ -275,7 +347,9 @@ describe("AssetValue", () => {
275
347
  describe("fromStringSync", () => {
276
348
  test("creates AssetValue from string via `@swapkit/tokens` lists", async () => {
277
349
  await AssetValue.loadStaticAssets();
278
- const thor = AssetValue.fromStringSync("ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044");
350
+ const thor = AssetValue.from({
351
+ asset: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044",
352
+ });
279
353
 
280
354
  expect(thor).toBeDefined();
281
355
  expect(thor).toEqual(
@@ -290,7 +364,9 @@ describe("AssetValue", () => {
290
364
  }),
291
365
  );
292
366
 
293
- const usdc = AssetValue.fromStringSync("ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48");
367
+ const usdc = AssetValue.from({
368
+ asset: "ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48",
369
+ });
294
370
  expect(usdc).toBeDefined();
295
371
  expect(usdc).toEqual(
296
372
  expect.objectContaining({
@@ -308,7 +384,7 @@ describe("AssetValue", () => {
308
384
  test("returns safe decimals if string is not in `@swapkit/tokens` lists", async () => {
309
385
  await AssetValue.loadStaticAssets();
310
386
  const fakeAvaxUSDCAssetString = "AVAX.USDC-1234";
311
- const fakeAvaxUSDCAsset = AssetValue.fromStringSync(fakeAvaxUSDCAssetString);
387
+ const fakeAvaxUSDCAsset = AssetValue.from({ asset: fakeAvaxUSDCAssetString });
312
388
 
313
389
  expect(fakeAvaxUSDCAsset).toBeDefined();
314
390
  expect(fakeAvaxUSDCAsset).toEqual(
@@ -327,10 +403,10 @@ describe("AssetValue", () => {
327
403
  test("returns safe decimals if string is not in `@swapkit/tokens` lists with multiple dashes", async () => {
328
404
  await AssetValue.loadStaticAssets();
329
405
  const fakeAvaxUSDCAssetString = "AVAX.USDC-LPT-1234";
330
- const fakeAvaxUSDCAsset = AssetValue.fromStringSync(fakeAvaxUSDCAssetString);
406
+ const fakeAvaxUSDCAsset2 = AssetValue.from({ asset: fakeAvaxUSDCAssetString });
331
407
 
332
- expect(fakeAvaxUSDCAsset).toBeDefined();
333
- expect(fakeAvaxUSDCAsset).toEqual(
408
+ expect(fakeAvaxUSDCAsset2).toBeDefined();
409
+ expect(fakeAvaxUSDCAsset2).toEqual(
334
410
  expect.objectContaining({
335
411
  address: "1234",
336
412
  chain: Chain.Avalanche,
@@ -346,7 +422,7 @@ describe("AssetValue", () => {
346
422
  test("returns proper avax string with address from `@swapkit/tokens` lists", async () => {
347
423
  await AssetValue.loadStaticAssets();
348
424
  const avaxBTCb = "AVAX.BTC.b-0x152b9d0fdc40c096757f570a51e494bd4b943e50";
349
- const AvaxBTCb = AssetValue.fromStringSync(avaxBTCb);
425
+ const AvaxBTCb = AssetValue.from({ asset: avaxBTCb });
350
426
 
351
427
  expect(AvaxBTCb).toBeDefined();
352
428
  expect(AvaxBTCb).toEqual(
@@ -356,8 +432,8 @@ describe("AssetValue", () => {
356
432
  decimal: 8,
357
433
  isGasAsset: false,
358
434
  isSynthetic: false,
359
- symbol: "BTC.b-0x152b9d0fdc40c096757f570a51e494bd4b943e50",
360
- ticker: "BTC.b",
435
+ symbol: "BTC.B-0x152b9d0fdc40c096757f570a51e494bd4b943e50",
436
+ ticker: "BTC.B",
361
437
  }),
362
438
  );
363
439
  });
@@ -366,7 +442,11 @@ describe("AssetValue", () => {
366
442
  describe("fromStringWithBaseSync", () => {
367
443
  test("creates AssetValue from string with base decimals via `@swapkit/tokens` lists", async () => {
368
444
  await AssetValue.loadStaticAssets();
369
- const btc = AssetValue.fromStringWithBaseSync("BTC.BTC", 5200000000000, 8);
445
+ const btc = AssetValue.from({
446
+ asset: "BTC.BTC",
447
+ value: 5200000000000,
448
+ fromBaseDecimal: 8,
449
+ });
370
450
 
371
451
  expect(btc).toBeDefined();
372
452
  expect(btc).toEqual(
@@ -387,7 +467,11 @@ describe("AssetValue", () => {
387
467
  test("returns safe decimals if string is not in `@swapkit/tokens` lists", async () => {
388
468
  await AssetValue.loadStaticAssets();
389
469
  const fakeAvaxUSDCAssetString = "AVAX.USDC-1234";
390
- const fakeAvaxUSDCAsset = AssetValue.fromStringWithBaseSync(fakeAvaxUSDCAssetString, 1, 8);
470
+ const fakeAvaxUSDCAsset = AssetValue.from({
471
+ asset: fakeAvaxUSDCAssetString,
472
+ value: 1,
473
+ fromBaseDecimal: 8,
474
+ });
391
475
 
392
476
  expect(fakeAvaxUSDCAsset).toBeDefined();
393
477
  expect(fakeAvaxUSDCAsset).toEqual(
@@ -409,7 +493,11 @@ describe("AssetValue", () => {
409
493
  test("returns proper avax string with address from `@swapkit/tokens` lists", async () => {
410
494
  await AssetValue.loadStaticAssets();
411
495
  const avaxUSDC = "AVAX.USDC-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e";
412
- const AvaxUSDC = AssetValue.fromStringWithBaseSync(avaxUSDC, 100000000, 8);
496
+ const AvaxUSDC = AssetValue.from({
497
+ asset: avaxUSDC,
498
+ value: 100000000,
499
+ fromBaseDecimal: 8,
500
+ });
413
501
 
414
502
  expect(AvaxUSDC).toBeDefined();
415
503
  expect(AvaxUSDC).toEqual(
@@ -431,33 +519,7 @@ describe("AssetValue", () => {
431
519
 
432
520
  describe("fromChainOrSignature", () => {
433
521
  test("creates AssetValue from common asset string or chain", () => {
434
- const customBaseAsset = [
435
- Chain.Cosmos,
436
- Chain.BinanceSmartChain,
437
- Chain.THORChain,
438
- Chain.Maya,
439
- Chain.Arbitrum,
440
- Chain.Optimism,
441
- ];
442
- const filteredChains = Object.values(Chain).filter((c) => !customBaseAsset.includes(c));
443
-
444
- for (const chain of filteredChains) {
445
- const asset = AssetValue.fromChainOrSignature(chain);
446
- expect(asset).toEqual(
447
- expect.objectContaining({
448
- address: undefined,
449
- chain,
450
- decimal: BaseDecimal[chain],
451
- isGasAsset: true,
452
- isSynthetic: false,
453
- symbol: chain,
454
- ticker: chain,
455
- type: "Native",
456
- }),
457
- );
458
- }
459
-
460
- const cosmosAsset = AssetValue.fromChainOrSignature(Chain.Cosmos);
522
+ const cosmosAsset = AssetValue.from({ chain: Chain.Cosmos });
461
523
  expect(cosmosAsset).toEqual(
462
524
  expect.objectContaining({
463
525
  address: undefined,
@@ -471,7 +533,7 @@ describe("AssetValue", () => {
471
533
  }),
472
534
  );
473
535
 
474
- const bscAsset = AssetValue.fromChainOrSignature(Chain.BinanceSmartChain);
536
+ const bscAsset = AssetValue.from({ chain: Chain.BinanceSmartChain });
475
537
  expect(bscAsset).toEqual(
476
538
  expect.objectContaining({
477
539
  address: undefined,
@@ -485,7 +547,7 @@ describe("AssetValue", () => {
485
547
  }),
486
548
  );
487
549
 
488
- const thorAsset = AssetValue.fromChainOrSignature(Chain.THORChain);
550
+ const thorAsset = AssetValue.from({ chain: Chain.THORChain });
489
551
  expect(thorAsset).toEqual(
490
552
  expect.objectContaining({
491
553
  address: undefined,
@@ -499,7 +561,7 @@ describe("AssetValue", () => {
499
561
  }),
500
562
  );
501
563
 
502
- const cacaoAsset = AssetValue.fromChainOrSignature(Chain.Maya);
564
+ const cacaoAsset = AssetValue.from({ chain: Chain.Maya });
503
565
  expect(cacaoAsset).toEqual(
504
566
  expect.objectContaining({
505
567
  address: undefined,
@@ -513,33 +575,34 @@ describe("AssetValue", () => {
513
575
  }),
514
576
  );
515
577
 
516
- const thor = AssetValue.fromChainOrSignature("ETH.THOR");
517
- expect(thor).toEqual(
518
- expect.objectContaining({
519
- address: "0xa5f2211b9b8170f694421f2046281775e8468044",
520
- chain: Chain.Ethereum,
521
- decimal: 18,
522
- isGasAsset: false,
523
- isSynthetic: false,
524
- symbol: "THOR-0xa5f2211b9b8170f694421f2046281775e8468044",
525
- ticker: "THOR",
526
- }),
527
- );
528
-
529
- const vthor = AssetValue.fromChainOrSignature("ETH.vTHOR");
530
- expect(vthor).toEqual(
531
- expect.objectContaining({
532
- address: "0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",
533
- chain: Chain.Ethereum,
534
- decimal: 18,
535
- isGasAsset: false,
536
- isSynthetic: false,
537
- symbol: "vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",
538
- ticker: "vTHOR",
539
- }),
540
- );
541
-
542
- const arbAsset = AssetValue.fromChainOrSignature(Chain.Arbitrum);
578
+ // TODO enable when BE fixes case sensitivity
579
+ // const thor = AssetValue.from({ asset: "ETH.THOR" });
580
+ // expect(thor).toEqual(
581
+ // expect.objectContaining({
582
+ // address: "0xa5f2211b9b8170f694421f2046281775e8468044",
583
+ // chain: Chain.Ethereum,
584
+ // decimal: 18,
585
+ // isGasAsset: false,
586
+ // isSynthetic: false,
587
+ // symbol: "THOR-0xa5f2211b9b8170f694421f2046281775e8468044",
588
+ // ticker: "THOR",
589
+ // }),
590
+ // );
591
+
592
+ // const vthor = AssetValue.from({ asset: "ETH.vTHOR" });
593
+ // expect(vthor).toEqual(
594
+ // expect.objectContaining({
595
+ // address: "0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",
596
+ // chain: Chain.Ethereum,
597
+ // decimal: 18,
598
+ // isGasAsset: false,
599
+ // isSynthetic: false,
600
+ // symbol: "vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d",
601
+ // ticker: "vTHOR",
602
+ // }),
603
+ // );
604
+
605
+ const arbAsset = AssetValue.from({ chain: Chain.Arbitrum });
543
606
  expect(arbAsset).toEqual(
544
607
  expect.objectContaining({
545
608
  address: undefined,
@@ -553,7 +616,7 @@ describe("AssetValue", () => {
553
616
  }),
554
617
  );
555
618
 
556
- const opAsset = AssetValue.fromChainOrSignature(Chain.Optimism);
619
+ const opAsset = AssetValue.from({ chain: Chain.Optimism });
557
620
  expect(opAsset).toEqual(
558
621
  expect.objectContaining({
559
622
  address: undefined,
@@ -566,14 +629,20 @@ describe("AssetValue", () => {
566
629
  type: "Native",
567
630
  }),
568
631
  );
569
- });
570
- });
571
632
 
572
- describe("loadStaticAssets", () => {
573
- test("loads static assets from `@swapkit/tokens` lists", async () => {
574
- // Dummy test - think of sth more meaningful
575
- const { ok } = await AssetValue.loadStaticAssets();
576
- expect(ok).toBe(true);
633
+ const xrdAsset = AssetValue.from({ chain: Chain.Radix });
634
+ expect(xrdAsset).toEqual(
635
+ expect.objectContaining({
636
+ address: undefined,
637
+ chain: Chain.Radix,
638
+ decimal: BaseDecimal.XRD,
639
+ isGasAsset: true,
640
+ isSynthetic: false,
641
+ symbol: "XRD",
642
+ ticker: "XRD",
643
+ type: "Native",
644
+ }),
645
+ );
577
646
  });
578
647
  });
579
648
  });