@paraspell/sdk 5.9.0 → 6.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.
Files changed (5) hide show
  1. package/README.md +29 -47
  2. package/dist/index.cjs +2342 -1121
  3. package/dist/index.d.ts +229 -232
  4. package/dist/index.mjs +2334 -1118
  5. package/package.json +14 -12
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { ethers } from 'ethers';
3
3
  import { prodRelayPolkadot, prodRelayKusama } from '@polkadot/apps-config/endpoints';
4
4
  import { u32 } from '@polkadot/types';
5
5
  import { BN } from '@polkadot/util';
6
- import { toPolkadot, environment, contextFactory } from '@snowbridge/api';
6
+ import { contextFactory, toPolkadot, environment } from '@snowbridge/api';
7
7
 
8
8
  function _arrayLikeToArray(r, a) {
9
9
  (null == a || a > r.length) && (a = r.length);
@@ -568,7 +568,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
568
568
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
569
569
  PERFORMANCE OF THIS SOFTWARE.
570
570
  ***************************************************************************** */
571
- /* global Reflect, Promise, SuppressedError, Symbol */
571
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
572
572
 
573
573
 
574
574
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -600,6 +600,12 @@ var Parents;
600
600
  Parents[Parents["TWO"] = 2] = "TWO";
601
601
  })(Parents || (Parents = {}));
602
602
 
603
+ var BatchMode;
604
+ (function (BatchMode) {
605
+ BatchMode["BATCH_ALL"] = "BATCH_ALL";
606
+ BatchMode["BATCH"] = "BATCH";
607
+ })(BatchMode || (BatchMode = {}));
608
+
603
609
  // Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
604
610
  var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
605
611
  function NoXCMSupportImplementedError(node) {
@@ -611,7 +617,7 @@ var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
611
617
  }
612
618
  _inherits(NoXCMSupportImplementedError, _Error);
613
619
  return _createClass(NoXCMSupportImplementedError);
614
- }( /*#__PURE__*/_wrapNativeSuper(Error));
620
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
615
621
 
616
622
  var Polkadot$1 = {
617
623
  relayChainAssetSymbol: "DOT",
@@ -688,6 +694,11 @@ var Acala$3 = {
688
694
  symbol: "EQD",
689
695
  decimals: 9
690
696
  },
697
+ {
698
+ assetId: "16",
699
+ symbol: "PDEX",
700
+ decimals: 12
701
+ },
691
702
  {
692
703
  assetId: "4",
693
704
  symbol: "INTR",
@@ -748,6 +759,11 @@ var Acala$3 = {
748
759
  symbol: "LDO",
749
760
  decimals: 18
750
761
  },
762
+ {
763
+ assetId: "17",
764
+ symbol: "HDX",
765
+ decimals: 12
766
+ },
751
767
  {
752
768
  assetId: "0x54a37a01cd75b616d63e0ab665bffdb0143c52ae",
753
769
  symbol: "DAI",
@@ -813,6 +829,11 @@ var Acala$3 = {
813
829
  symbol: "WBTC",
814
830
  decimals: 8
815
831
  },
832
+ {
833
+ assetId: "15",
834
+ symbol: "CFG",
835
+ decimals: 18
836
+ },
816
837
  {
817
838
  assetId: "3",
818
839
  symbol: "IBTC",
@@ -1226,11 +1247,6 @@ var Centrifuge$3 = {
1226
1247
  symbol: "USDC",
1227
1248
  decimals: 6
1228
1249
  },
1229
- {
1230
- assetId: "N",
1231
- symbol: "CFG",
1232
- decimals: 18
1233
- },
1234
1250
  {
1235
1251
  assetId: "100002",
1236
1252
  symbol: "LpBaseUSDC",
@@ -1440,6 +1456,26 @@ var Darwinia$3 = {
1440
1456
  }
1441
1457
  ],
1442
1458
  otherAssets: [
1459
+ {
1460
+ assetId: "1027",
1461
+ symbol: "ahUSDT",
1462
+ decimals: 6
1463
+ },
1464
+ {
1465
+ assetId: "1026",
1466
+ symbol: "KTON",
1467
+ decimals: 18
1468
+ },
1469
+ {
1470
+ assetId: "1028",
1471
+ symbol: "ahPINK",
1472
+ decimals: 10
1473
+ },
1474
+ {
1475
+ assetId: "1029",
1476
+ symbol: "DOT",
1477
+ decimals: 10
1478
+ }
1443
1479
  ]
1444
1480
  };
1445
1481
  var Hydration$3 = {
@@ -1785,7 +1821,7 @@ var Litentry$3 = {
1785
1821
  nativeAssets: [
1786
1822
  {
1787
1823
  symbol: "LIT",
1788
- decimals: 12
1824
+ decimals: 18
1789
1825
  }
1790
1826
  ],
1791
1827
  otherAssets: [
@@ -2225,6 +2261,10 @@ var AssetHubPolkadot$3 = {
2225
2261
  {
2226
2262
  symbol: "DOT",
2227
2263
  decimals: 10
2264
+ },
2265
+ {
2266
+ symbol: "KSM",
2267
+ decimals: 12
2228
2268
  }
2229
2269
  ],
2230
2270
  otherAssets: [
@@ -2233,11 +2273,21 @@ var AssetHubPolkadot$3 = {
2233
2273
  symbol: "MYTH",
2234
2274
  decimals: 18
2235
2275
  },
2276
+ {
2277
+ assetId: "22222005",
2278
+ symbol: "love",
2279
+ decimals: 12
2280
+ },
2236
2281
  {
2237
2282
  assetId: "9999",
2238
2283
  symbol: "TOM",
2239
2284
  decimals: 10
2240
2285
  },
2286
+ {
2287
+ assetId: "22222087",
2288
+ symbol: "KAIBYO",
2289
+ decimals: 12
2290
+ },
2241
2291
  {
2242
2292
  assetId: "20090142",
2243
2293
  symbol: "ELONA",
@@ -2248,6 +2298,11 @@ var AssetHubPolkadot$3 = {
2248
2298
  symbol: "WETH",
2249
2299
  decimals: 18
2250
2300
  },
2301
+ {
2302
+ assetId: "22222041",
2303
+ symbol: "PAD",
2304
+ decimals: 12
2305
+ },
2251
2306
  {
2252
2307
  assetId: "56",
2253
2308
  symbol: "UNION",
@@ -2258,6 +2313,11 @@ var AssetHubPolkadot$3 = {
2258
2313
  symbol: "HUB",
2259
2314
  decimals: 10
2260
2315
  },
2316
+ {
2317
+ assetId: "22222025",
2318
+ symbol: "XCMS",
2319
+ decimals: 12
2320
+ },
2261
2321
  {
2262
2322
  assetId: "81",
2263
2323
  symbol: "GVN",
@@ -2288,6 +2348,11 @@ var AssetHubPolkadot$3 = {
2288
2348
  symbol: "DUCK",
2289
2349
  decimals: 10
2290
2350
  },
2351
+ {
2352
+ assetId: "58",
2353
+ symbol: "MDMA",
2354
+ decimals: 12
2355
+ },
2291
2356
  {
2292
2357
  assetId: "222",
2293
2358
  symbol: "SHL",
@@ -2333,21 +2398,51 @@ var AssetHubPolkadot$3 = {
2333
2398
  symbol: "NFLR",
2334
2399
  decimals: 10
2335
2400
  },
2401
+ {
2402
+ assetId: "22222028",
2403
+ symbol: "COKE",
2404
+ decimals: 12
2405
+ },
2406
+ {
2407
+ assetId: "22222079",
2408
+ symbol: "GR",
2409
+ decimals: 12
2410
+ },
2336
2411
  {
2337
2412
  assetId: "20090110",
2338
2413
  symbol: "test1",
2339
2414
  decimals: 10
2340
2415
  },
2416
+ {
2417
+ assetId: "22222024",
2418
+ symbol: "POLISD",
2419
+ decimals: 12
2420
+ },
2341
2421
  {
2342
2422
  assetId: "256",
2343
2423
  symbol: "ICE",
2344
2424
  decimals: 20
2345
2425
  },
2426
+ {
2427
+ assetId: "22222070",
2428
+ symbol: "Mill",
2429
+ decimals: 12
2430
+ },
2431
+ {
2432
+ assetId: "22222019",
2433
+ symbol: "PI",
2434
+ decimals: 12
2435
+ },
2346
2436
  {
2347
2437
  assetId: "20090130",
2348
2438
  symbol: "SUS",
2349
2439
  decimals: 10
2350
2440
  },
2441
+ {
2442
+ assetId: "108",
2443
+ symbol: "GAME",
2444
+ decimals: 10
2445
+ },
2351
2446
  {
2352
2447
  assetId: "1111",
2353
2448
  symbol: "TESTV2",
@@ -2358,21 +2453,46 @@ var AssetHubPolkadot$3 = {
2358
2453
  symbol: "USDT",
2359
2454
  decimals: 16
2360
2455
  },
2456
+ {
2457
+ assetId: "22222084",
2458
+ symbol: "SOPHIA",
2459
+ decimals: 12
2460
+ },
2461
+ {
2462
+ assetId: "22222008",
2463
+ symbol: "ALIEN",
2464
+ decimals: 12
2465
+ },
2361
2466
  {
2362
2467
  assetId: "300",
2363
2468
  symbol: "DOGE",
2364
2469
  decimals: 6
2365
2470
  },
2471
+ {
2472
+ assetId: "22222046",
2473
+ symbol: "$PGH",
2474
+ decimals: 12
2475
+ },
2366
2476
  {
2367
2477
  assetId: "4",
2368
2478
  symbol: "EFI",
2369
2479
  decimals: 18
2370
2480
  },
2481
+ {
2482
+ assetId: "22222043",
2483
+ symbol: "DDT",
2484
+ decimals: 12
2485
+ },
2371
2486
  {
2372
2487
  assetId: "48",
2373
2488
  symbol: "SAX",
2374
2489
  decimals: 2
2375
2490
  },
2491
+ {
2492
+ assetId: "22222064",
2493
+ symbol: "RIDEMY",
2494
+ decimals: 12
2495
+ },
2376
2496
  {
2377
2497
  assetId: "21",
2378
2498
  symbol: "WBTC",
@@ -2383,6 +2503,11 @@ var AssetHubPolkadot$3 = {
2383
2503
  symbol: "DOKA",
2384
2504
  decimals: 6
2385
2505
  },
2506
+ {
2507
+ assetId: "22222050",
2508
+ symbol: "SHIVER",
2509
+ decimals: 12
2510
+ },
2386
2511
  {
2387
2512
  assetId: "28",
2388
2513
  symbol: "BULL",
@@ -2448,6 +2573,11 @@ var AssetHubPolkadot$3 = {
2448
2573
  symbol: "SHIB",
2449
2574
  decimals: 6
2450
2575
  },
2576
+ {
2577
+ assetId: "20090147",
2578
+ symbol: "RVGAV",
2579
+ decimals: 10
2580
+ },
2451
2581
  {
2452
2582
  assetId: "46",
2453
2583
  symbol: "PEPE",
@@ -2458,6 +2588,11 @@ var AssetHubPolkadot$3 = {
2458
2588
  symbol: "BSOD",
2459
2589
  decimals: 10
2460
2590
  },
2591
+ {
2592
+ assetId: "22222036",
2593
+ symbol: "Shit",
2594
+ decimals: 12
2595
+ },
2461
2596
  {
2462
2597
  assetId: "99",
2463
2598
  symbol: "Cypress",
@@ -2469,9 +2604,14 @@ var AssetHubPolkadot$3 = {
2469
2604
  decimals: 12
2470
2605
  },
2471
2606
  {
2472
- assetId: "7777",
2473
- symbol: "FUM",
2474
- decimals: 10
2607
+ assetId: "22222058",
2608
+ symbol: "PLS",
2609
+ decimals: 12
2610
+ },
2611
+ {
2612
+ assetId: "22222002",
2613
+ symbol: "TeMeL",
2614
+ decimals: 12
2475
2615
  },
2476
2616
  {
2477
2617
  assetId: "20090114",
@@ -2488,6 +2628,26 @@ var AssetHubPolkadot$3 = {
2488
2628
  symbol: "web3",
2489
2629
  decimals: 18
2490
2630
  },
2631
+ {
2632
+ assetId: "22222051",
2633
+ symbol: "NIN",
2634
+ decimals: 12
2635
+ },
2636
+ {
2637
+ assetId: "22222020",
2638
+ symbol: "CDOG",
2639
+ decimals: 12
2640
+ },
2641
+ {
2642
+ assetId: "22222073",
2643
+ symbol: "0x4b61696279c58d",
2644
+ decimals: 12
2645
+ },
2646
+ {
2647
+ assetId: "22222074",
2648
+ symbol: "$JAM",
2649
+ decimals: 12
2650
+ },
2491
2651
  {
2492
2652
  assetId: "20090111",
2493
2653
  symbol: "txt",
@@ -2498,6 +2658,16 @@ var AssetHubPolkadot$3 = {
2498
2658
  symbol: "DED",
2499
2659
  decimals: 18
2500
2660
  },
2661
+ {
2662
+ assetId: "22222062",
2663
+ symbol: "ALPHA",
2664
+ decimals: 12
2665
+ },
2666
+ {
2667
+ assetId: "75",
2668
+ symbol: "TeMe14",
2669
+ decimals: 12
2670
+ },
2501
2671
  {
2502
2672
  assetId: "20090119",
2503
2673
  symbol: "MDGA",
@@ -2513,6 +2683,16 @@ var AssetHubPolkadot$3 = {
2513
2683
  symbol: "IBW",
2514
2684
  decimals: 10
2515
2685
  },
2686
+ {
2687
+ assetId: "22222075",
2688
+ symbol: "DUD",
2689
+ decimals: 12
2690
+ },
2691
+ {
2692
+ assetId: "22222022",
2693
+ symbol: "X",
2694
+ decimals: 12
2695
+ },
2516
2696
  {
2517
2697
  assetId: "122",
2518
2698
  symbol: "TESTING",
@@ -2533,6 +2713,26 @@ var AssetHubPolkadot$3 = {
2533
2713
  symbol: "JAMD",
2534
2714
  decimals: 10
2535
2715
  },
2716
+ {
2717
+ assetId: "57",
2718
+ symbol: "MCP",
2719
+ decimals: 12
2720
+ },
2721
+ {
2722
+ assetId: "22222021",
2723
+ symbol: "BBB",
2724
+ decimals: 12
2725
+ },
2726
+ {
2727
+ assetId: "22222009",
2728
+ symbol: "china",
2729
+ decimals: 12
2730
+ },
2731
+ {
2732
+ assetId: "696969",
2733
+ symbol: "BRO",
2734
+ decimals: 18
2735
+ },
2536
2736
  {
2537
2737
  assetId: "14",
2538
2738
  symbol: "LEAP",
@@ -2568,6 +2768,11 @@ var AssetHubPolkadot$3 = {
2568
2768
  symbol: "STINK",
2569
2769
  decimals: 10
2570
2770
  },
2771
+ {
2772
+ assetId: "22222068",
2773
+ symbol: "V",
2774
+ decimals: 12
2775
+ },
2571
2776
  {
2572
2777
  assetId: "20090143",
2573
2778
  symbol: "DMSTR",
@@ -2599,9 +2804,14 @@ var AssetHubPolkadot$3 = {
2599
2804
  decimals: 10
2600
2805
  },
2601
2806
  {
2602
- assetId: "323",
2603
- symbol: "DGNNNC",
2604
- decimals: 6
2807
+ assetId: "22222078",
2808
+ symbol: "JAMTON",
2809
+ decimals: 12
2810
+ },
2811
+ {
2812
+ assetId: "73",
2813
+ symbol: "TeMe12",
2814
+ decimals: 12
2605
2815
  },
2606
2816
  {
2607
2817
  assetId: "77",
@@ -2613,6 +2823,11 @@ var AssetHubPolkadot$3 = {
2613
2823
  symbol: "DOGE",
2614
2824
  decimals: 10
2615
2825
  },
2826
+ {
2827
+ assetId: "22222029",
2828
+ symbol: "dog",
2829
+ decimals: 12
2830
+ },
2616
2831
  {
2617
2832
  assetId: "9002",
2618
2833
  symbol: "TAPE",
@@ -2628,6 +2843,16 @@ var AssetHubPolkadot$3 = {
2628
2843
  symbol: "GIO",
2629
2844
  decimals: 10
2630
2845
  },
2846
+ {
2847
+ assetId: "22222053",
2848
+ symbol: "DOTZ",
2849
+ decimals: 12
2850
+ },
2851
+ {
2852
+ assetId: "1747",
2853
+ symbol: "EMR",
2854
+ decimals: 10
2855
+ },
2631
2856
  {
2632
2857
  assetId: "31",
2633
2858
  symbol: "WOOD",
@@ -2683,6 +2908,11 @@ var AssetHubPolkadot$3 = {
2683
2908
  symbol: "SKL",
2684
2909
  decimals: 6
2685
2910
  },
2911
+ {
2912
+ assetId: "22222077",
2913
+ symbol: "SAPIEN",
2914
+ decimals: 12
2915
+ },
2686
2916
  {
2687
2917
  assetId: "15",
2688
2918
  symbol: "Meme",
@@ -2693,6 +2923,21 @@ var AssetHubPolkadot$3 = {
2693
2923
  symbol: "BUG",
2694
2924
  decimals: 12
2695
2925
  },
2926
+ {
2927
+ assetId: "22222013",
2928
+ symbol: "TM",
2929
+ decimals: 12
2930
+ },
2931
+ {
2932
+ assetId: "22222010",
2933
+ symbol: "TP",
2934
+ decimals: 12
2935
+ },
2936
+ {
2937
+ assetId: "22222071",
2938
+ symbol: "WUDFUD",
2939
+ decimals: 12
2940
+ },
2696
2941
  {
2697
2942
  assetId: "78",
2698
2943
  symbol: "COCA",
@@ -2713,6 +2958,11 @@ var AssetHubPolkadot$3 = {
2713
2958
  symbol: "PEPE",
2714
2959
  decimals: 10
2715
2960
  },
2961
+ {
2962
+ assetId: "20090144",
2963
+ symbol: "CHUG",
2964
+ decimals: 10
2965
+ },
2716
2966
  {
2717
2967
  assetId: "2",
2718
2968
  symbol: "BTC",
@@ -2728,11 +2978,36 @@ var AssetHubPolkadot$3 = {
2728
2978
  symbol: "PMATIC",
2729
2979
  decimals: 10
2730
2980
  },
2981
+ {
2982
+ assetId: "3164",
2983
+ symbol: "TTT",
2984
+ decimals: 3
2985
+ },
2986
+ {
2987
+ assetId: "1828",
2988
+ symbol: "CPLS",
2989
+ decimals: 10
2990
+ },
2731
2991
  {
2732
2992
  assetId: "20090116",
2733
2993
  symbol: "POO",
2734
2994
  decimals: 10
2735
2995
  },
2996
+ {
2997
+ assetId: "22222031",
2998
+ symbol: "VRN",
2999
+ decimals: 12
3000
+ },
3001
+ {
3002
+ assetId: "22222014",
3003
+ symbol: "GIT",
3004
+ decimals: 12
3005
+ },
3006
+ {
3007
+ assetId: "1810",
3008
+ symbol: "TSTD",
3009
+ decimals: 6
3010
+ },
2736
3011
  {
2737
3012
  assetId: "20090129",
2738
3013
  symbol: "FCD",
@@ -2743,6 +3018,16 @@ var AssetHubPolkadot$3 = {
2743
3018
  symbol: "SATS",
2744
3019
  decimals: 6
2745
3020
  },
3021
+ {
3022
+ assetId: "22222034",
3023
+ symbol: "0xf09f9980",
3024
+ decimals: 12
3025
+ },
3026
+ {
3027
+ assetId: "74",
3028
+ symbol: "TeMe13",
3029
+ decimals: 12
3030
+ },
2746
3031
  {
2747
3032
  assetId: "70",
2748
3033
  symbol: "STEEBOR",
@@ -2758,6 +3043,21 @@ var AssetHubPolkadot$3 = {
2758
3043
  symbol: "CLAY",
2759
3044
  decimals: 10
2760
3045
  },
3046
+ {
3047
+ assetId: "22222035",
3048
+ symbol: ".WH",
3049
+ decimals: 12
3050
+ },
3051
+ {
3052
+ assetId: "82",
3053
+ symbol: "ANGRY",
3054
+ decimals: 12
3055
+ },
3056
+ {
3057
+ assetId: "22222065",
3058
+ symbol: "BBQ",
3059
+ decimals: 12
3060
+ },
2761
3061
  {
2762
3062
  assetId: "2106",
2763
3063
  symbol: "STREAK",
@@ -2778,26 +3078,51 @@ var AssetHubPolkadot$3 = {
2778
3078
  symbol: "STAR",
2779
3079
  decimals: 6
2780
3080
  },
3081
+ {
3082
+ assetId: "22222001",
3083
+ symbol: "OMG2",
3084
+ decimals: 12
3085
+ },
3086
+ {
3087
+ assetId: "22222042",
3088
+ symbol: "CORE",
3089
+ decimals: 12
3090
+ },
3091
+ {
3092
+ assetId: "22222018",
3093
+ symbol: "WOLF",
3094
+ decimals: 12
3095
+ },
2781
3096
  {
2782
3097
  assetId: "49",
2783
3098
  symbol: "TeMe7",
2784
3099
  decimals: 12
2785
3100
  },
3101
+ {
3102
+ assetId: "22222044",
3103
+ symbol: "DONUT",
3104
+ decimals: 12
3105
+ },
2786
3106
  {
2787
3107
  assetId: "868367",
2788
3108
  symbol: "VSC",
2789
3109
  decimals: 9
2790
3110
  },
2791
3111
  {
2792
- assetId: "1994",
2793
- symbol: "CRT",
2794
- decimals: 4
3112
+ assetId: "5361",
3113
+ symbol: "NAT",
3114
+ decimals: 10
2795
3115
  },
2796
3116
  {
2797
3117
  assetId: "2829",
2798
3118
  symbol: "JTO",
2799
3119
  decimals: 10
2800
3120
  },
3121
+ {
3122
+ assetId: "22222037",
3123
+ symbol: "KSM",
3124
+ decimals: 12
3125
+ },
2801
3126
  {
2802
3127
  assetId: "53",
2803
3128
  symbol: "TeMe9",
@@ -2818,6 +3143,11 @@ var AssetHubPolkadot$3 = {
2818
3143
  symbol: "GAVUN",
2819
3144
  decimals: 10
2820
3145
  },
3146
+ {
3147
+ assetId: "22222059",
3148
+ symbol: "GOOD",
3149
+ decimals: 12
3150
+ },
2821
3151
  {
2822
3152
  assetId: "43",
2823
3153
  symbol: "TeMe5",
@@ -2833,6 +3163,16 @@ var AssetHubPolkadot$3 = {
2833
3163
  symbol: "DOTA",
2834
3164
  decimals: 6
2835
3165
  },
3166
+ {
3167
+ assetId: "22222003",
3168
+ symbol: "TeMe2L",
3169
+ decimals: 12
3170
+ },
3171
+ {
3172
+ assetId: "22222039",
3173
+ symbol: "DTS",
3174
+ decimals: 12
3175
+ },
2836
3176
  {
2837
3177
  assetId: "5",
2838
3178
  symbol: "PLX",
@@ -2843,11 +3183,21 @@ var AssetHubPolkadot$3 = {
2843
3183
  symbol: "DOTA",
2844
3184
  decimals: 4
2845
3185
  },
3186
+ {
3187
+ assetId: "83",
3188
+ symbol: "BOYS",
3189
+ decimals: 12
3190
+ },
2846
3191
  {
2847
3192
  assetId: "7",
2848
3193
  symbol: "lucky7",
2849
3194
  decimals: 20
2850
3195
  },
3196
+ {
3197
+ assetId: "22222055",
3198
+ symbol: "TOP",
3199
+ decimals: 12
3200
+ },
2851
3201
  {
2852
3202
  assetId: "4242",
2853
3203
  symbol: "GAVUN",
@@ -2863,6 +3213,11 @@ var AssetHubPolkadot$3 = {
2863
3213
  symbol: "ETH",
2864
3214
  decimals: 10
2865
3215
  },
3216
+ {
3217
+ assetId: "22222072",
3218
+ symbol: "BNG",
3219
+ decimals: 12
3220
+ },
2866
3221
  {
2867
3222
  assetId: "201",
2868
3223
  symbol: "WUD",
@@ -2878,6 +3233,11 @@ var AssetHubPolkadot$3 = {
2878
3233
  symbol: "DOTC",
2879
3234
  decimals: 10
2880
3235
  },
3236
+ {
3237
+ assetId: "22222082",
3238
+ symbol: "Ax",
3239
+ decimals: 12
3240
+ },
2881
3241
  {
2882
3242
  assetId: "20090103",
2883
3243
  symbol: "BTC",
@@ -2888,6 +3248,11 @@ var AssetHubPolkadot$3 = {
2888
3248
  symbol: "NOTDED",
2889
3249
  decimals: 10
2890
3250
  },
3251
+ {
3252
+ assetId: "22222085",
3253
+ symbol: "ANU",
3254
+ decimals: 12
3255
+ },
2891
3256
  {
2892
3257
  assetId: "20090124",
2893
3258
  symbol: "test1",
@@ -2898,6 +3263,11 @@ var AssetHubPolkadot$3 = {
2898
3263
  symbol: "BORK",
2899
3264
  decimals: 10
2900
3265
  },
3266
+ {
3267
+ assetId: "22222048",
3268
+ symbol: "PKSK",
3269
+ decimals: 12
3270
+ },
2901
3271
  {
2902
3272
  assetId: "33441",
2903
3273
  symbol: "MPACT",
@@ -2923,6 +3293,11 @@ var AssetHubPolkadot$3 = {
2923
3293
  symbol: "PGOLD",
2924
3294
  decimals: 7
2925
3295
  },
3296
+ {
3297
+ assetId: "22222038",
3298
+ symbol: "VOR",
3299
+ decimals: 12
3300
+ },
2926
3301
  {
2927
3302
  assetId: "777",
2928
3303
  symbol: "777",
@@ -2939,15 +3314,45 @@ var AssetHubPolkadot$3 = {
2939
3314
  decimals: 10
2940
3315
  },
2941
3316
  {
2942
- assetId: "567",
2943
- symbol: "ANT",
3317
+ assetId: "22222076",
3318
+ symbol: "AAPL",
3319
+ decimals: 12
3320
+ },
3321
+ {
3322
+ assetId: "567",
3323
+ symbol: "ANT",
2944
3324
  decimals: 6
2945
3325
  },
3326
+ {
3327
+ assetId: "457",
3328
+ symbol: "HGVH",
3329
+ decimals: 10
3330
+ },
3331
+ {
3332
+ assetId: "68",
3333
+ symbol: "Coin68",
3334
+ decimals: 12
3335
+ },
2946
3336
  {
2947
3337
  assetId: "54",
2948
3338
  symbol: "TeMe10",
2949
3339
  decimals: 12
2950
3340
  },
3341
+ {
3342
+ assetId: "22222023",
3343
+ symbol: "LURPIS",
3344
+ decimals: 12
3345
+ },
3346
+ {
3347
+ assetId: "22222088",
3348
+ symbol: "KOYM",
3349
+ decimals: 12
3350
+ },
3351
+ {
3352
+ assetId: "22222066",
3353
+ symbol: "DUW",
3354
+ decimals: 12
3355
+ },
2951
3356
  {
2952
3357
  assetId: "1230",
2953
3358
  symbol: "HAM",
@@ -2958,11 +3363,21 @@ var AssetHubPolkadot$3 = {
2958
3363
  symbol: "RNET",
2959
3364
  decimals: 0
2960
3365
  },
3366
+ {
3367
+ assetId: "22222027",
3368
+ symbol: "TDC",
3369
+ decimals: 12
3370
+ },
2961
3371
  {
2962
3372
  assetId: "9003",
2963
3373
  symbol: "KTRL",
2964
3374
  decimals: 10
2965
3375
  },
3376
+ {
3377
+ assetId: "22222033",
3378
+ symbol: "H@SH",
3379
+ decimals: 12
3380
+ },
2966
3381
  {
2967
3382
  assetId: "1313",
2968
3383
  symbol: "GGI",
@@ -2988,11 +3403,21 @@ var AssetHubPolkadot$3 = {
2988
3403
  symbol: "dot",
2989
3404
  decimals: 0
2990
3405
  },
3406
+ {
3407
+ assetId: "22222067",
3408
+ symbol: "ZALUPA",
3409
+ decimals: 12
3410
+ },
2991
3411
  {
2992
3412
  assetId: "90",
2993
3413
  symbol: "ATC",
2994
3414
  decimals: 6
2995
3415
  },
3416
+ {
3417
+ assetId: "22222017",
3418
+ symbol: "SANTA",
3419
+ decimals: 12
3420
+ },
2996
3421
  {
2997
3422
  assetId: "80",
2998
3423
  symbol: "GOVD",
@@ -3018,21 +3443,56 @@ var AssetHubPolkadot$3 = {
3018
3443
  symbol: "HYDRA",
3019
3444
  decimals: 10
3020
3445
  },
3446
+ {
3447
+ assetId: "22222080",
3448
+ symbol: "GREEN",
3449
+ decimals: 12
3450
+ },
3451
+ {
3452
+ assetId: "22222057",
3453
+ symbol: "DIO",
3454
+ decimals: 12
3455
+ },
3021
3456
  {
3022
3457
  assetId: "10000",
3023
3458
  symbol: "DOGE",
3024
3459
  decimals: 6
3025
3460
  },
3461
+ {
3462
+ assetId: "8277",
3463
+ symbol: "KH5usdt",
3464
+ decimals: 20
3465
+ },
3466
+ {
3467
+ assetId: "59",
3468
+ symbol: "OK",
3469
+ decimals: 12
3470
+ },
3026
3471
  {
3027
3472
  assetId: "2820",
3028
3473
  symbol: "HOOT",
3029
3474
  decimals: 6
3030
3475
  },
3476
+ {
3477
+ assetId: "22222083",
3478
+ symbol: "TAG",
3479
+ decimals: 12
3480
+ },
3031
3481
  {
3032
3482
  assetId: "20090125",
3033
3483
  symbol: "PP",
3034
3484
  decimals: 10
3035
3485
  },
3486
+ {
3487
+ assetId: "22222069",
3488
+ symbol: "HELLO",
3489
+ decimals: 12
3490
+ },
3491
+ {
3492
+ assetId: "22222007",
3493
+ symbol: "NaCl",
3494
+ decimals: 12
3495
+ },
3036
3496
  {
3037
3497
  assetId: "51",
3038
3498
  symbol: "JAMA",
@@ -3053,6 +3513,11 @@ var AssetHubPolkadot$3 = {
3053
3513
  symbol: "clay",
3054
3514
  decimals: 20
3055
3515
  },
3516
+ {
3517
+ assetId: "22222016",
3518
+ symbol: "MRSHE",
3519
+ decimals: 12
3520
+ },
3056
3521
  {
3057
3522
  assetId: "20090134",
3058
3523
  symbol: "DOTCOIN",
@@ -3063,11 +3528,36 @@ var AssetHubPolkadot$3 = {
3063
3528
  symbol: "BRZ",
3064
3529
  decimals: 6
3065
3530
  },
3531
+ {
3532
+ assetId: "22222049",
3533
+ symbol: "LUCKY",
3534
+ decimals: 12
3535
+ },
3066
3536
  {
3067
3537
  assetId: "8008",
3068
3538
  symbol: "HOBO",
3069
3539
  decimals: 2
3070
3540
  },
3541
+ {
3542
+ assetId: "20090146",
3543
+ symbol: "DOPE ",
3544
+ decimals: 10
3545
+ },
3546
+ {
3547
+ assetId: "22222047",
3548
+ symbol: "GWIF",
3549
+ decimals: 12
3550
+ },
3551
+ {
3552
+ assetId: "22222030",
3553
+ symbol: "PIGS",
3554
+ decimals: 12
3555
+ },
3556
+ {
3557
+ assetId: "22222086",
3558
+ symbol: "BIFF",
3559
+ decimals: 12
3560
+ },
3071
3561
  {
3072
3562
  assetId: "60",
3073
3563
  symbol: "ANT",
@@ -3083,6 +3573,11 @@ var AssetHubPolkadot$3 = {
3083
3573
  symbol: "SITE",
3084
3574
  decimals: 10
3085
3575
  },
3576
+ {
3577
+ assetId: "20090145",
3578
+ symbol: "ROCK",
3579
+ decimals: 10
3580
+ },
3086
3581
  {
3087
3582
  assetId: "6666",
3088
3583
  symbol: "CHAOS",
@@ -3128,6 +3623,21 @@ var AssetHubPolkadot$3 = {
3128
3623
  symbol: "usdc",
3129
3624
  decimals: 10
3130
3625
  },
3626
+ {
3627
+ assetId: "22222000",
3628
+ symbol: "OMG",
3629
+ decimals: 12
3630
+ },
3631
+ {
3632
+ assetId: "20090149",
3633
+ symbol: "TOD",
3634
+ decimals: 10
3635
+ },
3636
+ {
3637
+ assetId: "22222045",
3638
+ symbol: "O",
3639
+ decimals: 12
3640
+ },
3131
3641
  {
3132
3642
  assetId: "2000",
3133
3643
  symbol: "DAO",
@@ -3138,6 +3648,11 @@ var AssetHubPolkadot$3 = {
3138
3648
  symbol: "DOT",
3139
3649
  decimals: 20
3140
3650
  },
3651
+ {
3652
+ assetId: "22222056",
3653
+ symbol: "KEK",
3654
+ decimals: 12
3655
+ },
3141
3656
  {
3142
3657
  assetId: "6969",
3143
3658
  symbol: "LEEMO",
@@ -3153,6 +3668,11 @@ var AssetHubPolkadot$3 = {
3153
3668
  symbol: "KAS",
3154
3669
  decimals: 12
3155
3670
  },
3671
+ {
3672
+ assetId: "22222054",
3673
+ symbol: "DON",
3674
+ decimals: 12
3675
+ },
3156
3676
  {
3157
3677
  assetId: "1337",
3158
3678
  symbol: "USDC",
@@ -3173,16 +3693,31 @@ var AssetHubPolkadot$3 = {
3173
3693
  symbol: "BOOTY",
3174
3694
  decimals: 10
3175
3695
  },
3696
+ {
3697
+ assetId: "112233",
3698
+ symbol: "MTC",
3699
+ decimals: 10
3700
+ },
3176
3701
  {
3177
3702
  assetId: "17",
3178
3703
  symbol: "WIFD",
3179
3704
  decimals: 10
3180
3705
  },
3706
+ {
3707
+ assetId: "63",
3708
+ symbol: "JBM",
3709
+ decimals: 12
3710
+ },
3181
3711
  {
3182
3712
  assetId: "1180",
3183
3713
  symbol: "KRAK",
3184
3714
  decimals: 10
3185
3715
  },
3716
+ {
3717
+ assetId: "1148",
3718
+ symbol: "NT2",
3719
+ decimals: 10
3720
+ },
3186
3721
  {
3187
3722
  assetId: "25",
3188
3723
  symbol: "T54",
@@ -3203,6 +3738,16 @@ var AssetHubPolkadot$3 = {
3203
3738
  symbol: "DAL",
3204
3739
  decimals: 18
3205
3740
  },
3741
+ {
3742
+ assetId: "22222032",
3743
+ symbol: "FKDC",
3744
+ decimals: 12
3745
+ },
3746
+ {
3747
+ assetId: "22222015",
3748
+ symbol: "B",
3749
+ decimals: 12
3750
+ },
3206
3751
  {
3207
3752
  assetId: "23",
3208
3753
  symbol: "PINK",
@@ -3228,6 +3773,11 @@ var AssetHubPolkadot$3 = {
3228
3773
  symbol: "HASH",
3229
3774
  decimals: 18
3230
3775
  },
3776
+ {
3777
+ assetId: "65",
3778
+ symbol: "TeMe11",
3779
+ decimals: 12
3780
+ },
3231
3781
  {
3232
3782
  assetId: "9001",
3233
3783
  symbol: "BOMB",
@@ -3268,11 +3818,46 @@ var AssetHubPolkadot$3 = {
3268
3818
  symbol: "ETH",
3269
3819
  decimals: 10
3270
3820
  },
3821
+ {
3822
+ assetId: "22222061",
3823
+ symbol: "MONAD",
3824
+ decimals: 12
3825
+ },
3826
+ {
3827
+ assetId: "22222006",
3828
+ symbol: "LFG",
3829
+ decimals: 12
3830
+ },
3831
+ {
3832
+ assetId: "64",
3833
+ symbol: "CPcoin",
3834
+ decimals: 12
3835
+ },
3271
3836
  {
3272
3837
  assetId: "4157",
3273
3838
  symbol: "PDOG",
3274
3839
  decimals: 10
3275
3840
  },
3841
+ {
3842
+ assetId: "20090148",
3843
+ symbol: "BOB",
3844
+ decimals: 10
3845
+ },
3846
+ {
3847
+ assetId: "22222040",
3848
+ symbol: "NOFUN",
3849
+ decimals: 12
3850
+ },
3851
+ {
3852
+ assetId: "22222026",
3853
+ symbol: "DDOT",
3854
+ decimals: 12
3855
+ },
3856
+ {
3857
+ assetId: "6594",
3858
+ symbol: "MVPW",
3859
+ decimals: 3
3860
+ },
3276
3861
  {
3277
3862
  assetId: "660301",
3278
3863
  symbol: "GRL",
@@ -3298,16 +3883,56 @@ var AssetHubPolkadot$3 = {
3298
3883
  symbol: "WOOD",
3299
3884
  decimals: 10
3300
3885
  },
3886
+ {
3887
+ assetId: "22222060",
3888
+ symbol: "TATE",
3889
+ decimals: 12
3890
+ },
3891
+ {
3892
+ assetId: "22222081",
3893
+ symbol: "NAR",
3894
+ decimals: 12
3895
+ },
3896
+ {
3897
+ assetId: "22222011",
3898
+ symbol: "PM",
3899
+ decimals: 12
3900
+ },
3301
3901
  {
3302
3902
  assetId: "20090127",
3303
3903
  symbol: "PAMPIT",
3304
3904
  decimals: 10
3305
3905
  },
3906
+ {
3907
+ assetId: "22222004",
3908
+ symbol: "TeMeL3",
3909
+ decimals: 12
3910
+ },
3911
+ {
3912
+ assetId: "62",
3913
+ symbol: "CPDOT",
3914
+ decimals: 12
3915
+ },
3916
+ {
3917
+ assetId: "22222012",
3918
+ symbol: "DAMN",
3919
+ decimals: 12
3920
+ },
3306
3921
  {
3307
3922
  assetId: "2230",
3308
3923
  symbol: "GBILL",
3309
3924
  decimals: 8
3310
3925
  },
3926
+ {
3927
+ assetId: "22222063",
3928
+ symbol: "MAXCAT",
3929
+ decimals: 12
3930
+ },
3931
+ {
3932
+ assetId: "22222052",
3933
+ symbol: "MODE",
3934
+ decimals: 12
3935
+ },
3311
3936
  {
3312
3937
  assetId: "92",
3313
3938
  symbol: "TeMe2",
@@ -3318,6 +3943,356 @@ var AssetHubPolkadot$3 = {
3318
3943
  symbol: "PBTC",
3319
3944
  decimals: 10
3320
3945
  }
3946
+ ],
3947
+ multiLocations: [
3948
+ {
3949
+ parents: 1,
3950
+ interior: {
3951
+ x1: {
3952
+ parachain: 2011
3953
+ }
3954
+ }
3955
+ },
3956
+ {
3957
+ parents: 2,
3958
+ interior: {
3959
+ x2: [
3960
+ {
3961
+ globalConsensus: {
3962
+ ethereum: {
3963
+ chainId: 1
3964
+ }
3965
+ }
3966
+ },
3967
+ {
3968
+ accountKey20: {
3969
+ network: null,
3970
+ key: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
3971
+ }
3972
+ }
3973
+ ]
3974
+ }
3975
+ },
3976
+ {
3977
+ parents: 2,
3978
+ interior: {
3979
+ x2: [
3980
+ {
3981
+ globalConsensus: {
3982
+ ethereum: {
3983
+ chainId: 1
3984
+ }
3985
+ }
3986
+ },
3987
+ {
3988
+ accountKey20: {
3989
+ network: null,
3990
+ key: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
3991
+ }
3992
+ }
3993
+ ]
3994
+ }
3995
+ },
3996
+ {
3997
+ parents: 2,
3998
+ interior: {
3999
+ x1: {
4000
+ globalConsensus: {
4001
+ kusama: null
4002
+ }
4003
+ }
4004
+ }
4005
+ },
4006
+ {
4007
+ parents: 1,
4008
+ interior: {
4009
+ x2: [
4010
+ {
4011
+ parachain: 2030
4012
+ },
4013
+ {
4014
+ generalKey: {
4015
+ length: 2,
4016
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
4017
+ }
4018
+ }
4019
+ ]
4020
+ }
4021
+ },
4022
+ {
4023
+ parents: 2,
4024
+ interior: {
4025
+ x2: [
4026
+ {
4027
+ globalConsensus: {
4028
+ ethereum: {
4029
+ chainId: 1
4030
+ }
4031
+ }
4032
+ },
4033
+ {
4034
+ accountKey20: {
4035
+ network: null,
4036
+ key: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
4037
+ }
4038
+ }
4039
+ ]
4040
+ }
4041
+ },
4042
+ {
4043
+ parents: 2,
4044
+ interior: {
4045
+ x2: [
4046
+ {
4047
+ globalConsensus: {
4048
+ ethereum: {
4049
+ chainId: 1
4050
+ }
4051
+ }
4052
+ },
4053
+ {
4054
+ accountKey20: {
4055
+ network: null,
4056
+ key: "0xba41ddf06b7ffd89d1267b5a93bfef2424eb2003"
4057
+ }
4058
+ }
4059
+ ]
4060
+ }
4061
+ },
4062
+ {
4063
+ parents: 2,
4064
+ interior: {
4065
+ x2: [
4066
+ {
4067
+ globalConsensus: {
4068
+ ethereum: {
4069
+ chainId: 1
4070
+ }
4071
+ }
4072
+ },
4073
+ {
4074
+ accountKey20: {
4075
+ network: null,
4076
+ key: "0x18084fba666a33d37592fa2633fd49a74dd93a88"
4077
+ }
4078
+ }
4079
+ ]
4080
+ }
4081
+ },
4082
+ {
4083
+ parents: 2,
4084
+ interior: {
4085
+ x2: [
4086
+ {
4087
+ globalConsensus: {
4088
+ ethereum: {
4089
+ chainId: 1
4090
+ }
4091
+ }
4092
+ },
4093
+ {
4094
+ accountKey20: {
4095
+ network: null,
4096
+ key: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0"
4097
+ }
4098
+ }
4099
+ ]
4100
+ }
4101
+ },
4102
+ {
4103
+ parents: 2,
4104
+ interior: {
4105
+ x2: [
4106
+ {
4107
+ globalConsensus: {
4108
+ ethereum: {
4109
+ chainId: 1
4110
+ }
4111
+ }
4112
+ },
4113
+ {
4114
+ accountKey20: {
4115
+ network: null,
4116
+ key: "0x582d872a1b094fc48f5de31d3b73f2d9be47def1"
4117
+ }
4118
+ }
4119
+ ]
4120
+ }
4121
+ },
4122
+ {
4123
+ parents: 2,
4124
+ interior: {
4125
+ x2: [
4126
+ {
4127
+ globalConsensus: {
4128
+ ethereum: {
4129
+ chainId: 1
4130
+ }
4131
+ }
4132
+ },
4133
+ {
4134
+ accountKey20: {
4135
+ network: null,
4136
+ key: "0x6b175474e89094c44da98b954eedeac495271d0f"
4137
+ }
4138
+ }
4139
+ ]
4140
+ }
4141
+ },
4142
+ {
4143
+ parents: 2,
4144
+ interior: {
4145
+ x2: [
4146
+ {
4147
+ globalConsensus: {
4148
+ ethereum: {
4149
+ chainId: 1
4150
+ }
4151
+ }
4152
+ },
4153
+ {
4154
+ accountKey20: {
4155
+ network: null,
4156
+ key: "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce"
4157
+ }
4158
+ }
4159
+ ]
4160
+ }
4161
+ },
4162
+ {
4163
+ parents: 1,
4164
+ interior: {
4165
+ x2: [
4166
+ {
4167
+ parachain: 2011
4168
+ },
4169
+ {
4170
+ generalKey: {
4171
+ length: 3,
4172
+ data: "0x6571640000000000000000000000000000000000000000000000000000000000"
4173
+ }
4174
+ }
4175
+ ]
4176
+ }
4177
+ },
4178
+ {
4179
+ parents: 2,
4180
+ interior: {
4181
+ x2: [
4182
+ {
4183
+ globalConsensus: {
4184
+ ethereum: {
4185
+ chainId: 1
4186
+ }
4187
+ }
4188
+ },
4189
+ {
4190
+ accountKey20: {
4191
+ network: null,
4192
+ key: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
4193
+ }
4194
+ }
4195
+ ]
4196
+ }
4197
+ },
4198
+ {
4199
+ parents: 1,
4200
+ interior: {
4201
+ x2: [
4202
+ {
4203
+ parachain: 2004
4204
+ },
4205
+ {
4206
+ palletInstance: 10
4207
+ }
4208
+ ]
4209
+ }
4210
+ },
4211
+ {
4212
+ parents: 1,
4213
+ interior: {
4214
+ x1: {
4215
+ parachain: 3369
4216
+ }
4217
+ }
4218
+ },
4219
+ {
4220
+ parents: 1,
4221
+ interior: {
4222
+ x2: [
4223
+ {
4224
+ parachain: 2030
4225
+ },
4226
+ {
4227
+ generalKey: {
4228
+ length: 2,
4229
+ data: "0x0900000000000000000000000000000000000000000000000000000000000000"
4230
+ }
4231
+ }
4232
+ ]
4233
+ }
4234
+ },
4235
+ {
4236
+ parents: 2,
4237
+ interior: {
4238
+ x2: [
4239
+ {
4240
+ globalConsensus: {
4241
+ ethereum: {
4242
+ chainId: 1
4243
+ }
4244
+ }
4245
+ },
4246
+ {
4247
+ accountKey20: {
4248
+ network: null,
4249
+ key: "0x8daebade922df735c38c80c7ebd708af50815faa"
4250
+ }
4251
+ }
4252
+ ]
4253
+ }
4254
+ },
4255
+ {
4256
+ parents: 1,
4257
+ interior: {
4258
+ x2: [
4259
+ {
4260
+ parachain: 2034
4261
+ },
4262
+ {
4263
+ generalIndex: 0
4264
+ }
4265
+ ]
4266
+ }
4267
+ },
4268
+ {
4269
+ parents: 2,
4270
+ interior: {
4271
+ x2: [
4272
+ {
4273
+ globalConsensus: {
4274
+ ethereum: {
4275
+ chainId: 1
4276
+ }
4277
+ }
4278
+ },
4279
+ {
4280
+ accountKey20: {
4281
+ network: null,
4282
+ key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
4283
+ }
4284
+ }
4285
+ ]
4286
+ }
4287
+ },
4288
+ {
4289
+ parents: 1,
4290
+ interior: {
4291
+ x1: {
4292
+ parachain: 2051
4293
+ }
4294
+ }
4295
+ }
3321
4296
  ]
3322
4297
  };
3323
4298
  var Altair$3 = {
@@ -3331,6 +4306,21 @@ var Altair$3 = {
3331
4306
  }
3332
4307
  ],
3333
4308
  otherAssets: [
4309
+ {
4310
+ assetId: "3",
4311
+ symbol: "KSM",
4312
+ decimals: 12
4313
+ },
4314
+ {
4315
+ assetId: "1",
4316
+ symbol: "USDT",
4317
+ decimals: 6
4318
+ },
4319
+ {
4320
+ assetId: "2",
4321
+ symbol: "aUSD",
4322
+ decimals: 12
4323
+ }
3334
4324
  ]
3335
4325
  };
3336
4326
  var Amplitude$3 = {
@@ -3344,6 +4334,21 @@ var Amplitude$3 = {
3344
4334
  }
3345
4335
  ],
3346
4336
  otherAssets: [
4337
+ {
4338
+ assetId: "2",
4339
+ symbol: "PICA",
4340
+ decimals: 12
4341
+ },
4342
+ {
4343
+ assetId: "1",
4344
+ symbol: "USDT",
4345
+ decimals: 6
4346
+ },
4347
+ {
4348
+ assetId: "0",
4349
+ symbol: "KSM",
4350
+ decimals: 12
4351
+ }
3347
4352
  ]
3348
4353
  };
3349
4354
  var Bajun$3 = {
@@ -3616,6 +4621,11 @@ var Crab$3 = {
3616
4621
  }
3617
4622
  ],
3618
4623
  otherAssets: [
4624
+ {
4625
+ assetId: "1026",
4626
+ symbol: "CKTON",
4627
+ decimals: 18
4628
+ }
3619
4629
  ]
3620
4630
  };
3621
4631
  var CrustShadow$3 = {
@@ -3750,6 +4760,16 @@ var Curio$3 = {
3750
4760
  assetId: "0",
3751
4761
  symbol: "BSX",
3752
4762
  decimals: 12
4763
+ },
4764
+ {
4765
+ assetId: "2",
4766
+ symbol: "VAL",
4767
+ decimals: 18
4768
+ },
4769
+ {
4770
+ assetId: "1",
4771
+ symbol: "XOR",
4772
+ decimals: 18
3753
4773
  }
3754
4774
  ]
3755
4775
  };
@@ -4082,7 +5102,7 @@ var Litmus$3 = {
4082
5102
  nativeAssets: [
4083
5103
  {
4084
5104
  symbol: "LIT",
4085
- decimals: 12
5105
+ decimals: 18
4086
5106
  }
4087
5107
  ],
4088
5108
  otherAssets: [
@@ -4932,6 +5952,10 @@ var AssetHubKusama$3 = {
4932
5952
  {
4933
5953
  symbol: "KSM",
4934
5954
  decimals: 12
5955
+ },
5956
+ {
5957
+ symbol: "DOT",
5958
+ decimals: 10
4935
5959
  }
4936
5960
  ],
4937
5961
  otherAssets: [
@@ -5505,11 +6529,6 @@ var AssetHubKusama$3 = {
5505
6529
  symbol: "XEN",
5506
6530
  decimals: 10
5507
6531
  },
5508
- {
5509
- assetId: "4294967291",
5510
- symbol: "PRIME",
5511
- decimals: 7
5512
- },
5513
6532
  {
5514
6533
  assetId: "777777",
5515
6534
  symbol: "DEFI",
@@ -5835,6 +6854,60 @@ var AssetHubKusama$3 = {
5835
6854
  symbol: "RUEPP",
5836
6855
  decimals: 10
5837
6856
  }
6857
+ ],
6858
+ multiLocations: [
6859
+ {
6860
+ parents: 2,
6861
+ interior: {
6862
+ x1: {
6863
+ globalConsensus: {
6864
+ polkadot: null
6865
+ }
6866
+ }
6867
+ }
6868
+ },
6869
+ {
6870
+ parents: 1,
6871
+ interior: {
6872
+ x2: [
6873
+ {
6874
+ parachain: 2125
6875
+ },
6876
+ {
6877
+ generalIndex: 0
6878
+ }
6879
+ ]
6880
+ }
6881
+ },
6882
+ {
6883
+ parents: 1,
6884
+ interior: {
6885
+ x1: {
6886
+ parachain: 2123
6887
+ }
6888
+ }
6889
+ },
6890
+ {
6891
+ parents: 1,
6892
+ interior: {
6893
+ x2: [
6894
+ {
6895
+ parachain: 2023
6896
+ },
6897
+ {
6898
+ palletInstance: 10
6899
+ }
6900
+ ]
6901
+ }
6902
+ },
6903
+ {
6904
+ parents: 1,
6905
+ interior: {
6906
+ x1: {
6907
+ parachain: 2015
6908
+ }
6909
+ }
6910
+ }
5838
6911
  ]
5839
6912
  };
5840
6913
  var CoretimeKusama$3 = {
@@ -5850,6 +6923,21 @@ var CoretimeKusama$3 = {
5850
6923
  otherAssets: [
5851
6924
  ]
5852
6925
  };
6926
+ var CoretimePolkadot$3 = {
6927
+ paraId: 1005,
6928
+ relayChainAssetSymbol: "DOT",
6929
+ nativeAssetSymbol: "DOT",
6930
+ nativeAssets: [
6931
+ {
6932
+ symbol: "DOT",
6933
+ decimals: 10
6934
+ }
6935
+ ],
6936
+ otherAssets: [
6937
+ ],
6938
+ multiLocations: [
6939
+ ]
6940
+ };
5853
6941
  var Turing$3 = {
5854
6942
  paraId: 2114,
5855
6943
  relayChainAssetSymbol: "KSM",
@@ -6640,6 +7728,7 @@ var assets = {
6640
7728
  Shiden: Shiden$3,
6641
7729
  AssetHubKusama: AssetHubKusama$3,
6642
7730
  CoretimeKusama: CoretimeKusama$3,
7731
+ CoretimePolkadot: CoretimePolkadot$3,
6643
7732
  Turing: Turing$3,
6644
7733
  Unique: Unique$3,
6645
7734
  Crust: Crust$3,
@@ -6677,6 +7766,7 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
6677
7766
  Collectives: Collectives$3,
6678
7767
  ComposableFinance: ComposableFinance$3,
6679
7768
  CoretimeKusama: CoretimeKusama$3,
7769
+ CoretimePolkadot: CoretimePolkadot$3,
6680
7770
  Crab: Crab$3,
6681
7771
  Crust: Crust$3,
6682
7772
  CrustShadow: CrustShadow$3,
@@ -6732,7 +7822,7 @@ var InvalidCurrencyError = /*#__PURE__*/function (_Error) {
6732
7822
  }
6733
7823
  _inherits(InvalidCurrencyError, _Error);
6734
7824
  return _createClass(InvalidCurrencyError);
6735
- }( /*#__PURE__*/_wrapNativeSuper(Error));
7825
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
6736
7826
 
6737
7827
  // Used to inform user, that Parachain they wish to use is not supported yet
6738
7828
  var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
@@ -6745,7 +7835,7 @@ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
6745
7835
  }
6746
7836
  _inherits(NodeNotSupportedError, _Error);
6747
7837
  return _createClass(NodeNotSupportedError);
6748
- }( /*#__PURE__*/_wrapNativeSuper(Error));
7838
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
6749
7839
 
6750
7840
  // Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
6751
7841
  var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
@@ -6758,7 +7848,7 @@ var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
6758
7848
  }
6759
7849
  _inherits(ScenarioNotSupportedError, _Error);
6760
7850
  return _createClass(ScenarioNotSupportedError);
6761
- }( /*#__PURE__*/_wrapNativeSuper(Error));
7851
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
6762
7852
 
6763
7853
  var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
6764
7854
  function IncompatibleNodesError(message) {
@@ -6770,7 +7860,7 @@ var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
6770
7860
  }
6771
7861
  _inherits(IncompatibleNodesError, _Error);
6772
7862
  return _createClass(IncompatibleNodesError);
6773
- }( /*#__PURE__*/_wrapNativeSuper(Error));
7863
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
6774
7864
 
6775
7865
  var DuplicateAssetError = /*#__PURE__*/function (_Error) {
6776
7866
  function DuplicateAssetError(symbol) {
@@ -6782,370 +7872,27 @@ var DuplicateAssetError = /*#__PURE__*/function (_Error) {
6782
7872
  }
6783
7873
  _inherits(DuplicateAssetError, _Error);
6784
7874
  return _createClass(DuplicateAssetError);
6785
- }( /*#__PURE__*/_wrapNativeSuper(Error));
7875
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
6786
7876
 
6787
- var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
6788
- var api = _ref.api,
6789
- destination = _ref.destination,
6790
- address = _ref.address,
6791
- amount = _ref.amount,
6792
- paraIdTo = _ref.paraIdTo;
6793
- var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6794
- var paraId = destination !== undefined && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
6795
- var parameters = [createPolkadotXcmHeader('RelayToPara', version, destination, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpec(amount, version, Parents.ZERO), 0];
6796
- if (includeFee) {
6797
- parameters.push('Unlimited');
6798
- }
6799
- return parameters;
7877
+ var AssetHubPolkadot$2 = {
7878
+ defaultPallet: "PolkadotXcm",
7879
+ supportedPallets: [
7880
+ "PolkadotXcm"
7881
+ ]
6800
7882
  };
6801
- var isTMulti = function isTMulti(value) {
6802
- return value && _typeof(value) === 'object' || Array.isArray(value);
7883
+ var Acala$2 = {
7884
+ defaultPallet: "XTokens",
7885
+ supportedPallets: [
7886
+ "PolkadotXcm",
7887
+ "XTokens"
7888
+ ]
6803
7889
  };
6804
- var isTMultiLocation = function isTMultiLocation(value) {
6805
- return value && typeof value.parents !== 'undefined' && typeof value.interior !== 'undefined';
6806
- };
6807
- var isTCurrencySpecifier = function isTCurrencySpecifier(value) {
6808
- if (_typeof(value) !== 'object' || value === null) {
6809
- return false;
6810
- }
6811
- return 'symbol' in value && typeof value.symbol === 'string' || 'id' in value && (typeof value.id === 'string' || typeof value.id === 'number' || typeof value.id === 'bigint');
6812
- };
6813
- var createBridgeCurrencySpec = function createBridgeCurrencySpec(amount, ecosystem) {
6814
- return _defineProperty({}, Version.V4, [{
6815
- id: {
6816
- parents: Parents.TWO,
6817
- interior: {
6818
- X1: [{
6819
- GlobalConsensus: ecosystem
6820
- }]
6821
- }
6822
- },
6823
- fun: {
6824
- Fungible: amount
6825
- }
6826
- }]);
6827
- };
6828
- var createCurrencySpec = function createCurrencySpec(amount, version, parents, overriddenCurrency) {
6829
- var interior = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'Here';
6830
- if (!overriddenCurrency) {
6831
- return _defineProperty({}, version, [{
6832
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6833
- id: version === Version.V4 ? {
6834
- parents: parents,
6835
- interior: interior
6836
- } : {
6837
- Concrete: {
6838
- parents: parents,
6839
- interior: interior
6840
- }
6841
- },
6842
- fun: {
6843
- Fungible: amount
6844
- }
6845
- }]);
6846
- }
6847
- return isTMultiLocation(overriddenCurrency) ? _defineProperty({}, version, [{
6848
- id: version === Version.V4 ? overriddenCurrency : {
6849
- Concrete: overriddenCurrency
6850
- },
6851
- fun: {
6852
- Fungible: amount
6853
- }
6854
- }]) : // It must be TMultiAsset if not TMultiLocation
6855
- _defineProperty({}, version, overriddenCurrency);
6856
- };
6857
- var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
6858
- var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
6859
- var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
6860
- Parachain: nodeId
6861
- });
6862
- var isMultiLocationDestination = _typeof(destination) === 'object';
6863
- return _defineProperty({}, version, isMultiLocationDestination ? destination : {
6864
- parents: parentsResolved,
6865
- interior: interior
6866
- });
6867
- };
6868
- var createBridgePolkadotXcmDest = function createBridgePolkadotXcmDest(version, ecosystem, destination, nodeId) {
6869
- var multiLocation = {
6870
- parents: Parents.TWO,
6871
- interior: {
6872
- X2: [{
6873
- GlobalConsensus: ecosystem
6874
- }, {
6875
- Parachain: nodeId
6876
- }]
6877
- }
6878
- };
6879
- var isMultiLocationDestination = _typeof(destination) === 'object';
6880
- return _defineProperty({}, version, isMultiLocationDestination ? destination : multiLocation);
6881
- };
6882
- var calculateTransactionFee$1 = function calculateTransactionFee(tx, address) {
6883
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6884
- var _yield$tx$paymentInfo, partialFee;
6885
- return _regeneratorRuntime().wrap(function _callee$(_context) {
6886
- while (1) switch (_context.prev = _context.next) {
6887
- case 0:
6888
- _context.next = 2;
6889
- return tx.paymentInfo(address);
6890
- case 2:
6891
- _yield$tx$paymentInfo = _context.sent;
6892
- partialFee = _yield$tx$paymentInfo.partialFee;
6893
- return _context.abrupt("return", partialFee.toBn());
6894
- case 5:
6895
- case "end":
6896
- return _context.stop();
6897
- }
6898
- }, _callee);
6899
- }));
6900
- };
6901
- // TODO: Refactor this function to eliminate the any type
6902
- var findParachainJunction = function findParachainJunction(multilocation) {
6903
- var interior = multilocation.interior;
6904
- for (var key in interior) {
6905
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6906
- var junctions = interior[key];
6907
- if (Array.isArray(junctions)) {
6908
- var _iterator = _createForOfIteratorHelper(junctions),
6909
- _step;
6910
- try {
6911
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6912
- var junction = _step.value;
6913
- if ('Parachain' in junction) {
6914
- return Number(junction.Parachain);
6915
- }
6916
- }
6917
- } catch (err) {
6918
- _iterator.e(err);
6919
- } finally {
6920
- _iterator.f();
6921
- }
6922
- } else if (junctions !== undefined && 'Parachain' in junctions) {
6923
- return Number(junctions.Parachain);
6924
- }
6925
- }
6926
- return null;
6927
- };
6928
- var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(multiLocation) {
6929
- var parachainId = findParachainJunction(multiLocation);
6930
- if (parachainId === null) {
6931
- throw new Error('Parachain ID not found in destination multi location.');
6932
- }
6933
- var node = getTNode(parachainId);
6934
- if (node === null) {
6935
- throw new Error('Node with specified paraId not found in destination multi location.');
6936
- }
6937
- return node;
6938
- };
6939
-
6940
- var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination, isSymbol) {
6941
- if (destination === 'Ethereum') {
6942
- return combinedAssets.find(function (_ref) {
6943
- var assetSymbol = _ref.symbol;
6944
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
6945
- });
6946
- }
6947
- var otherAssetsMatches = otherAssets.filter(function (_ref2) {
6948
- var assetSymbol = _ref2.symbol;
6949
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
6950
- });
6951
- var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
6952
- var assetSymbol = _ref3.symbol;
6953
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
6954
- });
6955
- if (otherAssetsMatches.length > 1 && !isRelayDestination && isSymbol === undefined) {
6956
- throw new DuplicateAssetError(symbol);
6957
- }
6958
- if (node === 'Astar' || node === 'Shiden') {
6959
- return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
6960
- }
6961
- return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
6962
- };
6963
- var findAssetById = function findAssetById(assets, assetId) {
6964
- return assets.find(function (_ref4) {
6965
- var currentAssetId = _ref4.assetId;
6966
- return currentAssetId === assetId;
6967
- });
6968
- };
6969
- var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
6970
- var isRelayDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6971
- var isSymbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
6972
- var destination = arguments.length > 4 ? arguments[4] : undefined;
6973
- if (isTMulti(currency)) {
6974
- return null;
6975
- }
6976
- var currencyString = currency.toString();
6977
- var _getAssetsObject = getAssetsObject(node),
6978
- otherAssets = _getAssetsObject.otherAssets,
6979
- nativeAssets = _getAssetsObject.nativeAssets,
6980
- relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol;
6981
- var combinedAssets = destination === 'Ethereum' ? _toConsumableArray(getOtherAssets('Ethereum')) : [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets));
6982
- var asset;
6983
- if (isSymbol === true) {
6984
- asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, currencyString, isRelayDestination, isSymbol);
6985
- } else if (isSymbol === false) {
6986
- asset = findAssetById(combinedAssets, currencyString);
6987
- } else {
6988
- asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, currencyString, isRelayDestination, isSymbol) || findAssetById(combinedAssets, currencyString);
6989
- }
6990
- if (asset) {
6991
- return asset;
6992
- }
6993
- if (relayChainAssetSymbol.toLowerCase() === currencyString.toLowerCase() && isSymbol !== false) {
6994
- var relayChainAsset = {
6995
- symbol: relayChainAssetSymbol,
6996
- decimals: getAssetDecimals(node, relayChainAssetSymbol)
6997
- };
6998
- return relayChainAsset;
6999
- }
7000
- return null;
7001
- };
7002
-
7003
- var assetsMap = assetsMapJson;
7004
- var getAssetsObject = function getAssetsObject(node) {
7005
- return assetsMap[node];
7006
- };
7007
- var getAssetId = function getAssetId(node, symbol) {
7008
- var info = getAssetsObject(node).otherAssets.find(function (o) {
7009
- return o.symbol === symbol;
7010
- });
7011
- return info != null ? info.assetId : null;
7012
- };
7013
- var getRelayChainSymbol = function getRelayChainSymbol(node) {
7014
- return getAssetsObject(node).relayChainAssetSymbol;
7015
- };
7016
- var getNativeAssets = function getNativeAssets(node) {
7017
- return getAssetsObject(node).nativeAssets;
7018
- };
7019
- var getOtherAssets = function getOtherAssets(node) {
7020
- return getAssetsObject(node).otherAssets;
7021
- };
7022
- var getAssets = function getAssets(node) {
7023
- var _getAssetsObject = getAssetsObject(node),
7024
- nativeAssets = _getAssetsObject.nativeAssets,
7025
- otherAssets = _getAssetsObject.otherAssets;
7026
- var relayChainAsset = getAssetBySymbolOrId(determineRelayChain(node), getRelayChainSymbol(node));
7027
- return [].concat(_toConsumableArray(relayChainAsset ? [relayChainAsset] : []), _toConsumableArray(nativeAssets), _toConsumableArray(otherAssets));
7028
- };
7029
- var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
7030
- var _getAssetsObject2 = getAssetsObject(node),
7031
- relayChainAssetSymbol = _getAssetsObject2.relayChainAssetSymbol,
7032
- nativeAssets = _getAssetsObject2.nativeAssets,
7033
- otherAssets = _getAssetsObject2.otherAssets;
7034
- var nativeAssetsSymbols = nativeAssets.map(function (_ref) {
7035
- var symbol = _ref.symbol;
7036
- return symbol;
7037
- });
7038
- var otherAssetsSymbols = otherAssets.filter(function (asset) {
7039
- return asset.symbol !== undefined;
7040
- }).map(function (_ref2) {
7041
- var symbol = _ref2.symbol;
7042
- return symbol;
7043
- });
7044
- return [relayChainAssetSymbol].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
7045
- };
7046
- var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
7047
- if (node === 'Polkadot') {
7048
- return 'DOT';
7049
- } else if (node === 'Kusama') {
7050
- return 'KSM';
7051
- }
7052
- return getAssetsObject(node).nativeAssetSymbol;
7053
- };
7054
- var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
7055
- return getAllAssetsSymbols(node).map(function (s) {
7056
- return s.toLowerCase();
7057
- }).includes(symbol.toLowerCase());
7058
- };
7059
- var getSupportedAssets = function getSupportedAssets(origin, destination) {
7060
- var originAssets = getAssets(origin);
7061
- var destinationAssets = getAssets(destination);
7062
- if (destination === 'Ethereum' || origin === 'Ethereum') {
7063
- return getOtherAssets('Ethereum');
7064
- }
7065
- if (origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot') {
7066
- var polkadotAsset = getAssetBySymbolOrId('Polkadot', 'DOT');
7067
- var kusamaAsset = getAssetBySymbolOrId('Kusama', 'KSM');
7068
- return [].concat(_toConsumableArray(polkadotAsset ? [polkadotAsset] : []), _toConsumableArray(kusamaAsset ? [kusamaAsset] : []));
7069
- }
7070
- return _toConsumableArray(originAssets.filter(function (asset) {
7071
- return destinationAssets.some(function (a) {
7072
- return a.symbol === asset.symbol;
7073
- });
7074
- }));
7075
- };
7076
- var getAssetDecimals = function getAssetDecimals(node, symbol) {
7077
- var _getAssetsObject3 = getAssetsObject(node),
7078
- otherAssets = _getAssetsObject3.otherAssets,
7079
- nativeAssets = _getAssetsObject3.nativeAssets;
7080
- var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (o) {
7081
- return o.symbol === symbol;
7082
- });
7083
- return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
7084
- };
7085
- var getParaId = function getParaId(node) {
7086
- return getAssetsObject(node).paraId;
7087
- };
7088
- var getTNode = function getTNode(paraId) {
7089
- var _a;
7090
- return (_a = NODE_NAMES.find(function (node) {
7091
- return getParaId(node) === paraId;
7092
- })) !== null && _a !== void 0 ? _a : null;
7093
- };
7094
-
7095
- var getBalanceNative = function getBalanceNative(address, node, api) {
7096
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7097
- var apiWithFallback, _yield$apiWithFallbac, data, balance;
7098
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7099
- while (1) switch (_context.prev = _context.next) {
7100
- case 0:
7101
- if (!(api !== null && api !== void 0)) {
7102
- _context.next = 4;
7103
- break;
7104
- }
7105
- _context.t0 = api;
7106
- _context.next = 7;
7107
- break;
7108
- case 4:
7109
- _context.next = 6;
7110
- return createApiInstanceForNode(node);
7111
- case 6:
7112
- _context.t0 = _context.sent;
7113
- case 7:
7114
- apiWithFallback = _context.t0;
7115
- _context.next = 10;
7116
- return apiWithFallback.query.system.account(address);
7117
- case 10:
7118
- _yield$apiWithFallbac = _context.sent;
7119
- data = _yield$apiWithFallbac.data;
7120
- balance = data.free.toBn();
7121
- return _context.abrupt("return", BigInt(balance.toString()));
7122
- case 14:
7123
- case "end":
7124
- return _context.stop();
7125
- }
7126
- }, _callee);
7127
- }));
7128
- };
7129
-
7130
- var AssetHubPolkadot$2 = {
7131
- defaultPallet: "PolkadotXcm",
7132
- supportedPallets: [
7133
- "PolkadotXcm"
7134
- ]
7135
- };
7136
- var Acala$2 = {
7137
- defaultPallet: "XTokens",
7138
- supportedPallets: [
7139
- "PolkadotXcm",
7140
- "XTokens"
7141
- ]
7142
- };
7143
- var Astar$2 = {
7144
- defaultPallet: "XTokens",
7145
- supportedPallets: [
7146
- "PolkadotXcm",
7147
- "XTokens"
7148
- ]
7890
+ var Astar$2 = {
7891
+ defaultPallet: "XTokens",
7892
+ supportedPallets: [
7893
+ "PolkadotXcm",
7894
+ "XTokens"
7895
+ ]
7149
7896
  };
7150
7897
  var BifrostPolkadot$2 = {
7151
7898
  defaultPallet: "XTokens",
@@ -7507,6 +8254,12 @@ var Peaq$2 = {
7507
8254
  "XTokens"
7508
8255
  ]
7509
8256
  };
8257
+ var CoretimePolkadot$2 = {
8258
+ defaultPallet: "PolkadotXcm",
8259
+ supportedPallets: [
8260
+ "PolkadotXcm"
8261
+ ]
8262
+ };
7510
8263
  var pallets = {
7511
8264
  AssetHubPolkadot: AssetHubPolkadot$2,
7512
8265
  Acala: Acala$2,
@@ -7563,7 +8316,8 @@ var pallets = {
7563
8316
  BridgeHubPolkadot: BridgeHubPolkadot$2,
7564
8317
  BridgeHubKusama: BridgeHubKusama$2,
7565
8318
  Mythos: Mythos$2,
7566
- Peaq: Peaq$2
8319
+ Peaq: Peaq$2,
8320
+ CoretimePolkadot: CoretimePolkadot$2
7567
8321
  };
7568
8322
 
7569
8323
  var palletsMapJson = /*#__PURE__*/Object.freeze({
@@ -7586,6 +8340,7 @@ var palletsMapJson = /*#__PURE__*/Object.freeze({
7586
8340
  Collectives: Collectives$2,
7587
8341
  ComposableFinance: ComposableFinance$2,
7588
8342
  CoretimeKusama: CoretimeKusama$2,
8343
+ CoretimePolkadot: CoretimePolkadot$2,
7589
8344
  Crab: Crab$2,
7590
8345
  Crust: Crust$2,
7591
8346
  CrustShadow: CrustShadow$2,
@@ -7636,178 +8391,165 @@ var getSupportedPallets = function getSupportedPallets(node) {
7636
8391
  return palletsMap$1[node].supportedPallets;
7637
8392
  };
7638
8393
 
7639
- var getBalanceForeignXTokens = function getBalanceForeignXTokens(address, symbolOrId, symbol, id, api) {
7640
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7641
- var response, entry;
7642
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7643
- while (1) switch (_context.prev = _context.next) {
7644
- case 0:
7645
- _context.next = 2;
7646
- return api.query.tokens.accounts.entries(address);
7647
- case 2:
7648
- response = _context.sent;
7649
- entry = response.find(function (_ref) {
7650
- var _ref2 = _slicedToArray(_ref, 2),
7651
- _ref2$0$args = _slicedToArray(_ref2[0].args, 2);
7652
- _ref2$0$args[0];
7653
- var asset = _ref2$0$args[1];
7654
- _ref2[1];
7655
- var _a, _b, _c;
7656
- return asset.toString() === symbolOrId || asset.toString() === id || asset.toString() === symbol || Object.values((_a = asset.toHuman()) !== null && _a !== void 0 ? _a : {}).toString() === symbolOrId || Object.values((_b = asset.toHuman()) !== null && _b !== void 0 ? _b : {}).toString() === id || Object.values((_c = asset.toHuman()) !== null && _c !== void 0 ? _c : {}).toString() === symbol;
7657
- });
7658
- return _context.abrupt("return", entry ? BigInt(entry[1].free.toString()) : null);
7659
- case 5:
7660
- case "end":
7661
- return _context.stop();
7662
- }
7663
- }, _callee);
7664
- }));
8394
+ // Contains function for getting Asset ID or Symbol used in XCM call creation
8395
+ var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination) {
8396
+ if (destination === 'Ethereum') {
8397
+ return combinedAssets.find(function (_ref) {
8398
+ var assetSymbol = _ref.symbol;
8399
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
8400
+ });
8401
+ }
8402
+ var otherAssetsMatches = otherAssets.filter(function (_ref2) {
8403
+ var assetSymbol = _ref2.symbol;
8404
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
8405
+ });
8406
+ var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
8407
+ var assetSymbol = _ref3.symbol;
8408
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
8409
+ });
8410
+ var isPolkadotXcm = !isRelayChain(node) && node !== 'Ethereum' && getDefaultPallet(node) === 'PolkadotXcm';
8411
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
8412
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
8413
+ }
8414
+ if (otherAssetsMatches.length > 1 && !isRelayDestination) {
8415
+ throw new DuplicateAssetError(symbol);
8416
+ }
8417
+ return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
8418
+ };
8419
+
8420
+ var findAssetById = function findAssetById(assets, assetId) {
8421
+ return assets.find(function (_ref) {
8422
+ var currentAssetId = _ref.assetId;
8423
+ return currentAssetId === assetId;
8424
+ });
7665
8425
  };
7666
- var getAssetHubMultiLocation = function getAssetHubMultiLocation(symbol) {
7667
- if (symbol === 'MYTH') {
7668
- return {
7669
- parents: 1,
7670
- interior: {
7671
- X1: {
7672
- Parachain: '3369'
7673
- }
7674
- }
7675
- };
7676
- } else if (symbol === 'KSM') {
7677
- return {
7678
- parents: 2,
7679
- interior: {
7680
- X1: {
7681
- GlobalConsensus: 'Kusama'
7682
- }
7683
- }
7684
- };
8426
+ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
8427
+ var isRelayDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8428
+ var destination = arguments.length > 3 ? arguments[3] : undefined;
8429
+ if ('multilocation' in currency || 'multiasset' in currency) {
8430
+ return null;
7685
8431
  }
7686
- var ethAssets = getOtherAssets('Ethereum');
7687
- var ethAsset = ethAssets.find(function (asset) {
7688
- return asset.symbol === symbol;
7689
- });
7690
- if (ethAsset) {
7691
- return {
7692
- parents: 2,
7693
- interior: {
7694
- X2: [{
7695
- GlobalConsensus: {
7696
- Ethereum: {
7697
- chainId: 1
7698
- }
7699
- }
7700
- }, {
7701
- AccountKey20: {
7702
- network: null,
7703
- key: ethAsset.assetId
7704
- }
7705
- }]
7706
- }
8432
+ var _getAssetsObject = getAssetsObject(node),
8433
+ otherAssets = _getAssetsObject.otherAssets,
8434
+ nativeAssets = _getAssetsObject.nativeAssets,
8435
+ relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol;
8436
+ var combinedAssets = destination === 'Ethereum' ? _toConsumableArray(getOtherAssets('Ethereum')) : [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets));
8437
+ var asset;
8438
+ if ('symbol' in currency) {
8439
+ asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, currency.symbol, isRelayDestination);
8440
+ } else {
8441
+ asset = findAssetById(combinedAssets, currency.id);
8442
+ }
8443
+ if (asset) {
8444
+ return asset;
8445
+ }
8446
+ if ('symbol' in currency && relayChainAssetSymbol.toLowerCase() === currency.symbol.toLowerCase()) {
8447
+ var relayChainAsset = {
8448
+ symbol: relayChainAssetSymbol,
8449
+ decimals: getAssetDecimals(node, relayChainAssetSymbol)
7707
8450
  };
8451
+ return relayChainAsset;
7708
8452
  }
7709
8453
  return null;
7710
8454
  };
7711
- var getBalanceForeignPolkadotXcm = function getBalanceForeignPolkadotXcm(address, id, api, node, symbol) {
7712
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
7713
- var _response, _obj, multiLocation, _response2, _obj2, parsedId, response, obj;
7714
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7715
- while (1) switch (_context2.prev = _context2.next) {
7716
- case 0:
7717
- _context2.prev = 0;
7718
- if (!(node === 'Mythos')) {
7719
- _context2.next = 7;
7720
- break;
7721
- }
7722
- _context2.next = 4;
7723
- return api.query.balances.account(address);
7724
- case 4:
7725
- _response = _context2.sent;
7726
- _obj = _response.toJSON();
7727
- return _context2.abrupt("return", BigInt(_obj.free));
7728
- case 7:
7729
- if (!(node === 'AssetHubPolkadot')) {
7730
- _context2.next = 15;
7731
- break;
7732
- }
7733
- multiLocation = getAssetHubMultiLocation(symbol !== null && symbol !== void 0 ? symbol : id);
7734
- if (!multiLocation) {
7735
- _context2.next = 15;
7736
- break;
7737
- }
7738
- _context2.next = 12;
7739
- return api.query.foreignAssets.account(multiLocation, address);
7740
- case 12:
7741
- _response2 = _context2.sent;
7742
- _obj2 = _response2.toJSON();
7743
- return _context2.abrupt("return", BigInt(_obj2 === null ? 0 : _obj2.balance));
7744
- case 15:
7745
- parsedId = new u32(api.registry, id);
7746
- _context2.next = 18;
7747
- return api.query.assets.account(parsedId, address);
7748
- case 18:
7749
- response = _context2.sent;
7750
- obj = response.toJSON();
7751
- return _context2.abrupt("return", BigInt(obj.balance));
7752
- case 23:
7753
- _context2.prev = 23;
7754
- _context2.t0 = _context2["catch"](0);
7755
- console.log('Error while fetching balance', _context2.t0);
7756
- return _context2.abrupt("return", null);
7757
- case 27:
7758
- case "end":
7759
- return _context2.stop();
7760
- }
7761
- }, _callee2, null, [[0, 23]]);
7762
- }));
8455
+
8456
+ var assetsMap = assetsMapJson;
8457
+ var getAssetsObject = function getAssetsObject(node) {
8458
+ return assetsMap[node];
7763
8459
  };
7764
- var getBalanceForeign = function getBalanceForeign(address, node, symbolOrId, api) {
7765
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
7766
- var _a, apiWithFallback, asset;
7767
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
7768
- while (1) switch (_context3.prev = _context3.next) {
7769
- case 0:
7770
- if (!(api !== null && api !== void 0)) {
7771
- _context3.next = 4;
7772
- break;
7773
- }
7774
- _context3.t0 = api;
7775
- _context3.next = 7;
7776
- break;
7777
- case 4:
7778
- _context3.next = 6;
7779
- return createApiInstanceForNode(node);
7780
- case 6:
7781
- _context3.t0 = _context3.sent;
7782
- case 7:
7783
- apiWithFallback = _context3.t0;
7784
- asset = getAssetBySymbolOrId(node, symbolOrId);
7785
- if (!(getDefaultPallet(node) === 'XTokens')) {
7786
- _context3.next = 15;
7787
- break;
7788
- }
7789
- _context3.next = 12;
7790
- return getBalanceForeignXTokens(address, symbolOrId, asset === null || asset === void 0 ? void 0 : asset.symbol, asset === null || asset === void 0 ? void 0 : asset.assetId, apiWithFallback);
7791
- case 12:
7792
- return _context3.abrupt("return", _context3.sent);
7793
- case 15:
7794
- if (!(getDefaultPallet(node) === 'PolkadotXcm')) {
7795
- _context3.next = 19;
7796
- break;
7797
- }
7798
- _context3.next = 18;
7799
- return getBalanceForeignPolkadotXcm(address, (_a = asset === null || asset === void 0 ? void 0 : asset.assetId) !== null && _a !== void 0 ? _a : symbolOrId, apiWithFallback, node, asset === null || asset === void 0 ? void 0 : asset.symbol);
7800
- case 18:
7801
- return _context3.abrupt("return", _context3.sent);
7802
- case 19:
7803
- throw new Error('Unsupported pallet');
7804
- case 20:
7805
- case "end":
7806
- return _context3.stop();
7807
- }
7808
- }, _callee3);
8460
+ var getAssetId = function getAssetId(node, symbol) {
8461
+ var info = getAssetsObject(node).otherAssets.find(function (o) {
8462
+ return o.symbol === symbol;
8463
+ });
8464
+ return info != null ? info.assetId : null;
8465
+ };
8466
+ var getRelayChainSymbol = function getRelayChainSymbol(node) {
8467
+ return getAssetsObject(node).relayChainAssetSymbol;
8468
+ };
8469
+ var getNativeAssets = function getNativeAssets(node) {
8470
+ return getAssetsObject(node).nativeAssets;
8471
+ };
8472
+ var getOtherAssets = function getOtherAssets(node) {
8473
+ return getAssetsObject(node).otherAssets;
8474
+ };
8475
+ var getAssets = function getAssets(node) {
8476
+ var _getAssetsObject = getAssetsObject(node),
8477
+ nativeAssets = _getAssetsObject.nativeAssets,
8478
+ otherAssets = _getAssetsObject.otherAssets;
8479
+ var relayChainAsset = getAssetBySymbolOrId(determineRelayChain(node), {
8480
+ symbol: getRelayChainSymbol(node)
8481
+ });
8482
+ return [].concat(_toConsumableArray(relayChainAsset ? [relayChainAsset] : []), _toConsumableArray(nativeAssets), _toConsumableArray(otherAssets));
8483
+ };
8484
+ var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
8485
+ var _getAssetsObject2 = getAssetsObject(node),
8486
+ relayChainAssetSymbol = _getAssetsObject2.relayChainAssetSymbol,
8487
+ nativeAssets = _getAssetsObject2.nativeAssets,
8488
+ otherAssets = _getAssetsObject2.otherAssets;
8489
+ var nativeAssetsSymbols = nativeAssets.map(function (_ref) {
8490
+ var symbol = _ref.symbol;
8491
+ return symbol;
8492
+ });
8493
+ var otherAssetsSymbols = otherAssets.filter(function (asset) {
8494
+ return asset.symbol !== undefined;
8495
+ }).map(function (_ref2) {
8496
+ var symbol = _ref2.symbol;
8497
+ return symbol;
8498
+ });
8499
+ return [relayChainAssetSymbol].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
8500
+ };
8501
+ var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
8502
+ if (node === 'Polkadot') {
8503
+ return 'DOT';
8504
+ } else if (node === 'Kusama') {
8505
+ return 'KSM';
8506
+ }
8507
+ return getAssetsObject(node).nativeAssetSymbol;
8508
+ };
8509
+ var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
8510
+ return getAllAssetsSymbols(node).map(function (s) {
8511
+ return s.toLowerCase();
8512
+ }).includes(symbol.toLowerCase());
8513
+ };
8514
+ var getSupportedAssets = function getSupportedAssets(origin, destination) {
8515
+ var originAssets = getAssets(origin);
8516
+ var destinationAssets = getAssets(destination);
8517
+ if (destination === 'Ethereum' || origin === 'Ethereum') {
8518
+ return getOtherAssets('Ethereum');
8519
+ }
8520
+ if (origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot') {
8521
+ var polkadotAsset = getAssetBySymbolOrId('Polkadot', {
8522
+ symbol: 'DOT'
8523
+ });
8524
+ var kusamaAsset = getAssetBySymbolOrId('Kusama', {
8525
+ symbol: 'KSM'
8526
+ });
8527
+ return [].concat(_toConsumableArray(polkadotAsset ? [polkadotAsset] : []), _toConsumableArray(kusamaAsset ? [kusamaAsset] : []));
8528
+ }
8529
+ return _toConsumableArray(originAssets.filter(function (asset) {
8530
+ return destinationAssets.some(function (a) {
8531
+ return a.symbol === asset.symbol;
8532
+ });
7809
8533
  }));
7810
8534
  };
8535
+ var getAssetDecimals = function getAssetDecimals(node, symbol) {
8536
+ var _getAssetsObject3 = getAssetsObject(node),
8537
+ otherAssets = _getAssetsObject3.otherAssets,
8538
+ nativeAssets = _getAssetsObject3.nativeAssets;
8539
+ var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (o) {
8540
+ return o.symbol === symbol;
8541
+ });
8542
+ return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
8543
+ };
8544
+ var getParaId = function getParaId(node) {
8545
+ return getAssetsObject(node).paraId;
8546
+ };
8547
+ var getTNode = function getTNode(paraId) {
8548
+ var _a;
8549
+ return (_a = NODE_NAMES.find(function (node) {
8550
+ return getParaId(node) === paraId;
8551
+ })) !== null && _a !== void 0 ? _a : null;
8552
+ };
7811
8553
 
7812
8554
  var AssetHubPolkadot$1 = "100000000";
7813
8555
  var Acala$1 = "100000000000";
@@ -7818,7 +8560,7 @@ var Centrifuge$1 = "1000000000000";
7818
8560
  var ComposableFinance$1 = "100000000000";
7819
8561
  var Darwinia$1 = "0";
7820
8562
  var Hydration$1 = "1000000000000";
7821
- var Litentry$1 = "100000000000";
8563
+ var Litentry$1 = "100000000000000000";
7822
8564
  var Moonbeam$1 = "0";
7823
8565
  var Parallel$1 = "100000000000";
7824
8566
  var AssetHubKusama$1 = "3333333";
@@ -7837,7 +8579,7 @@ var Imbue$1 = "1000000";
7837
8579
  var Integritee$1 = "1000000000";
7838
8580
  var InvArchTinker$1 = "1000000000";
7839
8581
  var Karura$1 = "100000000000";
7840
- var Litmus$1 = "100000000000";
8582
+ var Litmus$1 = "100000000000000000";
7841
8583
  var Moonriver$1 = "0";
7842
8584
  var ParallelHeiko$1 = "10000000000";
7843
8585
  var Picasso$1 = "100000000000";
@@ -7867,6 +8609,7 @@ var BridgeHubPolkadot$1 = "1000000000";
7867
8609
  var BridgeHubKusama$1 = "33333333";
7868
8610
  var Mythos$1 = "10000000000000000";
7869
8611
  var Peaq$1 = "500";
8612
+ var CoretimePolkadot$1 = "1000000000";
7870
8613
  var existentialDeposits = {
7871
8614
  AssetHubPolkadot: AssetHubPolkadot$1,
7872
8615
  Acala: Acala$1,
@@ -7925,10 +8668,11 @@ var existentialDeposits = {
7925
8668
  BridgeHubPolkadot: BridgeHubPolkadot$1,
7926
8669
  BridgeHubKusama: BridgeHubKusama$1,
7927
8670
  Mythos: Mythos$1,
7928
- Peaq: Peaq$1
8671
+ Peaq: Peaq$1,
8672
+ CoretimePolkadot: CoretimePolkadot$1
7929
8673
  };
7930
8674
 
7931
- var edMapJson = /*#__PURE__*/Object.freeze({
8675
+ var edsMapJson = /*#__PURE__*/Object.freeze({
7932
8676
  __proto__: null,
7933
8677
  Acala: Acala$1,
7934
8678
  Altair: Altair$1,
@@ -7948,6 +8692,7 @@ var edMapJson = /*#__PURE__*/Object.freeze({
7948
8692
  Collectives: Collectives$1,
7949
8693
  ComposableFinance: ComposableFinance$1,
7950
8694
  CoretimeKusama: CoretimeKusama$1,
8695
+ CoretimePolkadot: CoretimePolkadot$1,
7951
8696
  Crab: Crab$1,
7952
8697
  Crust: Crust$1,
7953
8698
  CrustShadow: CrustShadow$1,
@@ -7991,28 +8736,66 @@ var edMapJson = /*#__PURE__*/Object.freeze({
7991
8736
  default: existentialDeposits
7992
8737
  });
7993
8738
 
7994
- var palletsMap = edMapJson;
8739
+ var edMap = edsMapJson;
7995
8740
  var getExistentialDeposit$1 = function getExistentialDeposit(node) {
7996
- return BigInt(palletsMap[node]);
8741
+ return edMap[node];
7997
8742
  };
7998
- var getMinNativeTransferableAmount = function getMinNativeTransferableAmount(node) {
7999
- var ed = getExistentialDeposit$1(node);
8000
- var tenPercent = ed / BigInt(10);
8001
- return ed + tenPercent;
8743
+
8744
+ var getBalanceNative = function getBalanceNative(address, node, api) {
8745
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8746
+ var apiWithFallback, response, balance;
8747
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8748
+ while (1) switch (_context.prev = _context.next) {
8749
+ case 0:
8750
+ if (!(api !== null && api !== void 0)) {
8751
+ _context.next = 4;
8752
+ break;
8753
+ }
8754
+ _context.t0 = api;
8755
+ _context.next = 7;
8756
+ break;
8757
+ case 4:
8758
+ _context.next = 6;
8759
+ return createApiInstanceForNode(node);
8760
+ case 6:
8761
+ _context.t0 = _context.sent;
8762
+ case 7:
8763
+ apiWithFallback = _context.t0;
8764
+ _context.next = 10;
8765
+ return apiWithFallback.query.system.account(address);
8766
+ case 10:
8767
+ response = _context.sent;
8768
+ balance = response.data.free.toBn();
8769
+ return _context.abrupt("return", BigInt(balance.toString()));
8770
+ case 13:
8771
+ case "end":
8772
+ return _context.stop();
8773
+ }
8774
+ }, _callee);
8775
+ }));
8002
8776
  };
8003
- var getMaxNativeTransferableAmount = function getMaxNativeTransferableAmount(address, node) {
8777
+
8778
+ var getBalanceForeignXTokens = function getBalanceForeignXTokens(address, symbolOrId, symbol, id, api) {
8004
8779
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8005
- var ed, nativeBalance, maxTransferableAmount;
8780
+ var response, entry, accountData;
8006
8781
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8007
8782
  while (1) switch (_context.prev = _context.next) {
8008
8783
  case 0:
8009
- ed = getExistentialDeposit$1(node);
8010
- _context.next = 3;
8011
- return getBalanceNative(address, node);
8012
- case 3:
8013
- nativeBalance = _context.sent;
8014
- maxTransferableAmount = nativeBalance - ed - ed / BigInt(10);
8015
- return _context.abrupt("return", maxTransferableAmount > BigInt(0) ? maxTransferableAmount : BigInt(0));
8784
+ _context.next = 2;
8785
+ return api.query.tokens.accounts.entries(address);
8786
+ case 2:
8787
+ response = _context.sent;
8788
+ entry = response.find(function (_ref) {
8789
+ var _ref2 = _slicedToArray(_ref, 2),
8790
+ _ref2$0$args = _slicedToArray(_ref2[0].args, 2);
8791
+ _ref2$0$args[0];
8792
+ var asset = _ref2$0$args[1];
8793
+ _ref2[1];
8794
+ var _a, _b, _c, _d;
8795
+ return 'symbol' in symbolOrId && asset.toString() === symbolOrId.symbol || 'id' in symbolOrId && asset.toString() === symbolOrId.id || asset.toString() === id || asset.toString() === symbol || 'symbol' in symbolOrId && Object.values((_a = asset.toHuman()) !== null && _a !== void 0 ? _a : {}).toString() === symbolOrId.symbol || 'id' in symbolOrId && Object.values((_b = asset.toHuman()) !== null && _b !== void 0 ? _b : {}).toString() === symbolOrId.id || Object.values((_c = asset.toHuman()) !== null && _c !== void 0 ? _c : {}).toString() === id || Object.values((_d = asset.toHuman()) !== null && _d !== void 0 ? _d : {}).toString() === symbol;
8796
+ });
8797
+ accountData = entry ? entry[1] : null;
8798
+ return _context.abrupt("return", accountData ? BigInt(accountData.free.toString()) : null);
8016
8799
  case 6:
8017
8800
  case "end":
8018
8801
  return _context.stop();
@@ -8021,183 +8804,243 @@ var getMaxNativeTransferableAmount = function getMaxNativeTransferableAmount(add
8021
8804
  }));
8022
8805
  };
8023
8806
 
8024
- // Contains call formatting for closing HRMP channels functionality
8025
- var closeChannelInternal = function closeChannelInternal(options) {
8026
- var _api$tx$module;
8027
- var api = options.api,
8028
- origin = options.origin,
8029
- inbound = options.inbound,
8030
- outbound = options.outbound,
8031
- _options$serializedAp = options.serializedApiCallEnabled,
8032
- serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
8033
- var module = 'hrmp';
8034
- var section = 'forceCleanHrmp';
8035
- var parameters = [getParaId(origin), inbound, outbound];
8036
- if (serializedApiCallEnabled) {
8807
+ var getAssetHubMultiLocation = function getAssetHubMultiLocation(symbol) {
8808
+ if (symbol === 'MYTH') {
8037
8809
  return {
8038
- module: module,
8039
- section: section,
8040
- parameters: parameters
8810
+ parents: 1,
8811
+ interior: {
8812
+ X1: {
8813
+ Parachain: '3369'
8814
+ }
8815
+ }
8816
+ };
8817
+ } else if (symbol === 'KSM') {
8818
+ return {
8819
+ parents: 2,
8820
+ interior: {
8821
+ X1: {
8822
+ GlobalConsensus: 'Kusama'
8823
+ }
8824
+ }
8041
8825
  };
8042
8826
  }
8043
- return api.tx.sudo.sudo((_api$tx$module = api.tx[module])[section].apply(_api$tx$module, parameters));
8044
- };
8045
- var closeChannel = function closeChannel(options) {
8046
- return closeChannelInternal(options);
8047
- };
8048
- var closeChannelSerializedApiCall = function closeChannelSerializedApiCall(options) {
8049
- return closeChannelInternal(Object.assign(Object.assign({}, options), {
8050
- serializedApiCallEnabled: true
8051
- }));
8052
- };
8053
-
8054
- var index$3 = /*#__PURE__*/Object.freeze({
8055
- __proto__: null,
8056
- closeChannel: closeChannel,
8057
- closeChannelSerializedApiCall: closeChannelSerializedApiCall
8058
- });
8059
-
8060
- var CloseChannelBuilder = /*#__PURE__*/function () {
8061
- function CloseChannelBuilder(api, from) {
8062
- _classCallCheck(this, CloseChannelBuilder);
8063
- this.api = api;
8064
- this.from = from;
8065
- }
8066
- return _createClass(CloseChannelBuilder, [{
8067
- key: "inbound",
8068
- value: function inbound(_inbound) {
8069
- this._inbound = _inbound;
8070
- return this;
8071
- }
8072
- }, {
8073
- key: "outbound",
8074
- value: function outbound(_outbound) {
8075
- this._outbound = _outbound;
8076
- return this;
8077
- }
8078
- }, {
8079
- key: "buildOptions",
8080
- value: function buildOptions() {
8081
- return {
8082
- api: this.api,
8083
- origin: this.from,
8084
- inbound: this._inbound,
8085
- outbound: this._outbound
8086
- };
8087
- }
8088
- }, {
8089
- key: "build",
8090
- value: function build() {
8091
- var options = this.buildOptions();
8092
- return closeChannel(options);
8093
- }
8094
- }, {
8095
- key: "buildSerializedApiCall",
8096
- value: function buildSerializedApiCall() {
8097
- var options = this.buildOptions();
8098
- return closeChannelSerializedApiCall(options);
8099
- }
8100
- }], [{
8101
- key: "create",
8102
- value: function create(api, from) {
8103
- return new CloseChannelBuilder(api, from);
8104
- }
8105
- }]);
8106
- }();
8107
-
8108
- // Contains call formatting for opening HRMP channels functionality
8109
- var openChannelInternal = function openChannelInternal(options) {
8110
- var _api$tx$module;
8111
- var api = options.api,
8112
- origin = options.origin,
8113
- destination = options.destination,
8114
- maxSize = options.maxSize,
8115
- maxMessageSize = options.maxMessageSize,
8116
- _options$serializedAp = options.serializedApiCallEnabled,
8117
- serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
8118
- var module = 'parasSudoWrapper';
8119
- var section = 'sudoEstablishHrmpChannel';
8120
- var parameters = [getParaId(origin), getParaId(destination), maxSize, maxMessageSize];
8121
- if (serializedApiCallEnabled) {
8827
+ var ethAssets = getOtherAssets('Ethereum');
8828
+ var ethAsset = ethAssets.find(function (asset) {
8829
+ return asset.symbol === symbol;
8830
+ });
8831
+ if (ethAsset) {
8122
8832
  return {
8123
- module: module,
8124
- section: section,
8125
- parameters: parameters
8833
+ parents: 2,
8834
+ interior: {
8835
+ X2: [{
8836
+ GlobalConsensus: {
8837
+ Ethereum: {
8838
+ chainId: 1
8839
+ }
8840
+ }
8841
+ }, {
8842
+ AccountKey20: {
8843
+ network: null,
8844
+ key: ethAsset.assetId
8845
+ }
8846
+ }]
8847
+ }
8126
8848
  };
8127
8849
  }
8128
- return api.tx.sudo.sudo((_api$tx$module = api.tx[module])[section].apply(_api$tx$module, parameters));
8850
+ return null;
8851
+ };
8852
+
8853
+ var getBalanceForeignPolkadotXcm = function getBalanceForeignPolkadotXcm(address, id, api, node, symbol) {
8854
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8855
+ var _response, _obj, multiLocation, _response2, _obj2, parsedId, response, obj;
8856
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8857
+ while (1) switch (_context.prev = _context.next) {
8858
+ case 0:
8859
+ _context.prev = 0;
8860
+ if (!(node === 'Mythos')) {
8861
+ _context.next = 7;
8862
+ break;
8863
+ }
8864
+ _context.next = 4;
8865
+ return api.query.balances.account(address);
8866
+ case 4:
8867
+ _response = _context.sent;
8868
+ _obj = _response.toJSON();
8869
+ return _context.abrupt("return", _obj.free ? BigInt(_obj.free) : null);
8870
+ case 7:
8871
+ if (!(node === 'AssetHubPolkadot')) {
8872
+ _context.next = 15;
8873
+ break;
8874
+ }
8875
+ multiLocation = getAssetHubMultiLocation(symbol !== null && symbol !== void 0 ? symbol : id);
8876
+ if (!multiLocation) {
8877
+ _context.next = 15;
8878
+ break;
8879
+ }
8880
+ _context.next = 12;
8881
+ return api.query.foreignAssets.account(multiLocation, address);
8882
+ case 12:
8883
+ _response2 = _context.sent;
8884
+ _obj2 = _response2.toJSON();
8885
+ return _context.abrupt("return", BigInt(_obj2 === null || !_obj2.balance ? 0 : _obj2.balance));
8886
+ case 15:
8887
+ parsedId = new u32(api.registry, id);
8888
+ _context.next = 18;
8889
+ return api.query.assets.account(parsedId, address);
8890
+ case 18:
8891
+ response = _context.sent;
8892
+ obj = response.toJSON();
8893
+ return _context.abrupt("return", obj.balance ? BigInt(obj.balance) : null);
8894
+ case 23:
8895
+ _context.prev = 23;
8896
+ _context.t0 = _context["catch"](0);
8897
+ console.log('Error while fetching balance', _context.t0);
8898
+ return _context.abrupt("return", null);
8899
+ case 27:
8900
+ case "end":
8901
+ return _context.stop();
8902
+ }
8903
+ }, _callee, null, [[0, 23]]);
8904
+ }));
8129
8905
  };
8130
- var openChannel = function openChannel(options) {
8131
- return openChannelInternal(options);
8906
+
8907
+ var getBalanceForeign = function getBalanceForeign(address, node, symbolOrId, api) {
8908
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8909
+ var _a, apiWithFallback, asset, currencyStr;
8910
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8911
+ while (1) switch (_context.prev = _context.next) {
8912
+ case 0:
8913
+ if (!(api !== null && api !== void 0)) {
8914
+ _context.next = 4;
8915
+ break;
8916
+ }
8917
+ _context.t0 = api;
8918
+ _context.next = 7;
8919
+ break;
8920
+ case 4:
8921
+ _context.next = 6;
8922
+ return createApiInstanceForNode(node);
8923
+ case 6:
8924
+ _context.t0 = _context.sent;
8925
+ case 7:
8926
+ apiWithFallback = _context.t0;
8927
+ asset = getAssetBySymbolOrId(node, symbolOrId);
8928
+ if (!(getDefaultPallet(node) === 'XTokens')) {
8929
+ _context.next = 15;
8930
+ break;
8931
+ }
8932
+ _context.next = 12;
8933
+ return getBalanceForeignXTokens(address, symbolOrId, asset === null || asset === void 0 ? void 0 : asset.symbol, asset === null || asset === void 0 ? void 0 : asset.assetId, apiWithFallback);
8934
+ case 12:
8935
+ return _context.abrupt("return", _context.sent);
8936
+ case 15:
8937
+ if (!(getDefaultPallet(node) === 'PolkadotXcm')) {
8938
+ _context.next = 20;
8939
+ break;
8940
+ }
8941
+ currencyStr = 'symbol' in symbolOrId ? symbolOrId.symbol : 'id' in symbolOrId ? symbolOrId.id.toString() : undefined;
8942
+ _context.next = 19;
8943
+ return getBalanceForeignPolkadotXcm(address, (_a = asset === null || asset === void 0 ? void 0 : asset.assetId) !== null && _a !== void 0 ? _a : currencyStr, apiWithFallback, node, asset === null || asset === void 0 ? void 0 : asset.symbol);
8944
+ case 19:
8945
+ return _context.abrupt("return", _context.sent);
8946
+ case 20:
8947
+ throw new Error('Unsupported pallet');
8948
+ case 21:
8949
+ case "end":
8950
+ return _context.stop();
8951
+ }
8952
+ }, _callee);
8953
+ }));
8132
8954
  };
8133
- var openChannelSerializedApiCall = function openChannelSerializedApiCall(options) {
8134
- return openChannelInternal(Object.assign(Object.assign({}, options), {
8135
- serializedApiCallEnabled: true
8955
+
8956
+ var getAssetBalance = function getAssetBalance(account, node, currency) {
8957
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8958
+ var _a, api, isNativeSymbol;
8959
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8960
+ while (1) switch (_context.prev = _context.next) {
8961
+ case 0:
8962
+ _context.next = 2;
8963
+ return createApiInstanceForNode(node);
8964
+ case 2:
8965
+ api = _context.sent;
8966
+ isNativeSymbol = 'symbol' in currency && getNativeAssetSymbol(node) === currency.symbol;
8967
+ if (!isNativeSymbol) {
8968
+ _context.next = 10;
8969
+ break;
8970
+ }
8971
+ _context.next = 7;
8972
+ return getBalanceNative(account, node, api);
8973
+ case 7:
8974
+ _context.t0 = _context.sent;
8975
+ _context.next = 22;
8976
+ break;
8977
+ case 10:
8978
+ _context.next = 12;
8979
+ return getBalanceForeign(account, node, currency, api);
8980
+ case 12:
8981
+ _context.t2 = _a = _context.sent;
8982
+ _context.t1 = _context.t2 !== null;
8983
+ if (!_context.t1) {
8984
+ _context.next = 16;
8985
+ break;
8986
+ }
8987
+ _context.t1 = _a !== void 0;
8988
+ case 16:
8989
+ if (!_context.t1) {
8990
+ _context.next = 20;
8991
+ break;
8992
+ }
8993
+ _context.t3 = _a;
8994
+ _context.next = 21;
8995
+ break;
8996
+ case 20:
8997
+ _context.t3 = BigInt(0);
8998
+ case 21:
8999
+ _context.t0 = _context.t3;
9000
+ case 22:
9001
+ return _context.abrupt("return", _context.t0);
9002
+ case 23:
9003
+ case "end":
9004
+ return _context.stop();
9005
+ }
9006
+ }, _callee);
8136
9007
  }));
8137
9008
  };
8138
9009
 
8139
- var index$2 = /*#__PURE__*/Object.freeze({
8140
- __proto__: null,
8141
- openChannel: openChannel,
8142
- openChannelSerializedApiCall: openChannelSerializedApiCall
8143
- });
8144
-
8145
- var OpenChannelBuilder = /*#__PURE__*/function () {
8146
- function OpenChannelBuilder(api, from, to) {
8147
- _classCallCheck(this, OpenChannelBuilder);
8148
- this.api = api;
8149
- this.from = from;
8150
- this.to = to;
8151
- }
8152
- return _createClass(OpenChannelBuilder, [{
8153
- key: "maxSize",
8154
- value: function maxSize(size) {
8155
- this._maxSize = size;
8156
- return this;
8157
- }
8158
- }, {
8159
- key: "maxMessageSize",
8160
- value: function maxMessageSize(size) {
8161
- this._maxMessageSize = size;
8162
- return this;
8163
- }
8164
- }, {
8165
- key: "buildOptions",
8166
- value: function buildOptions() {
8167
- if (_typeof(this.to) === 'object') {
8168
- throw new Error('Channels do not support multi-location destinations');
9010
+ var palletsMap = edsMapJson;
9011
+ var getExistentialDeposit = function getExistentialDeposit(node) {
9012
+ return BigInt(palletsMap[node]);
9013
+ };
9014
+ var getMinNativeTransferableAmount = function getMinNativeTransferableAmount(node) {
9015
+ var ed = getExistentialDeposit(node);
9016
+ var tenPercent = ed / BigInt(10);
9017
+ return ed + tenPercent;
9018
+ };
9019
+ var getMaxNativeTransferableAmount = function getMaxNativeTransferableAmount(address, node) {
9020
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9021
+ var ed, nativeBalance, maxTransferableAmount;
9022
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9023
+ while (1) switch (_context.prev = _context.next) {
9024
+ case 0:
9025
+ ed = getExistentialDeposit(node);
9026
+ _context.next = 3;
9027
+ return getBalanceNative(address, node);
9028
+ case 3:
9029
+ nativeBalance = _context.sent;
9030
+ maxTransferableAmount = nativeBalance - ed - ed / BigInt(10);
9031
+ return _context.abrupt("return", maxTransferableAmount > BigInt(0) ? maxTransferableAmount : BigInt(0));
9032
+ case 6:
9033
+ case "end":
9034
+ return _context.stop();
8169
9035
  }
8170
- return {
8171
- api: this.api,
8172
- origin: this.from,
8173
- destination: this.to,
8174
- maxSize: this._maxSize,
8175
- maxMessageSize: this._maxMessageSize
8176
- };
8177
- }
8178
- }, {
8179
- key: "build",
8180
- value: function build() {
8181
- var options = this.buildOptions();
8182
- return openChannel(options);
8183
- }
8184
- }, {
8185
- key: "buildSerializedApiCall",
8186
- value: function buildSerializedApiCall() {
8187
- var options = this.buildOptions();
8188
- return openChannelSerializedApiCall(options);
8189
- }
8190
- }], [{
8191
- key: "create",
8192
- value: function create(api, from, to) {
8193
- return new OpenChannelBuilder(api, from, to);
8194
- }
8195
- }]);
8196
- }();
9036
+ }, _callee);
9037
+ }));
9038
+ };
8197
9039
 
8198
9040
  var RelayToParaBuilder = /*#__PURE__*/function () {
8199
- function RelayToParaBuilder(api, to, paraIdTo) {
9041
+ function RelayToParaBuilder(api, to, batchManager, paraIdTo) {
8200
9042
  _classCallCheck(this, RelayToParaBuilder);
9043
+ this.batchManager = batchManager;
8201
9044
  this.api = api;
8202
9045
  this.to = to;
8203
9046
  this.paraIdTo = paraIdTo;
@@ -8239,6 +9082,15 @@ var RelayToParaBuilder = /*#__PURE__*/function () {
8239
9082
  version: this._version
8240
9083
  };
8241
9084
  }
9085
+ }, {
9086
+ key: "addToBatch",
9087
+ value: function addToBatch() {
9088
+ this.batchManager.addTransaction({
9089
+ func: transferRelayToPara,
9090
+ options: this.buildOptions()
9091
+ });
9092
+ return new GeneralBuilder(this.batchManager, this.api, undefined, this.to);
9093
+ }
8242
9094
  }, {
8243
9095
  key: "build",
8244
9096
  value: function build() {
@@ -8281,15 +9133,16 @@ var RelayToParaBuilder = /*#__PURE__*/function () {
8281
9133
  }
8282
9134
  }], [{
8283
9135
  key: "create",
8284
- value: function create(api, to, paraIdTo) {
8285
- return new RelayToParaBuilder(api, to, paraIdTo);
9136
+ value: function create(api, to, batchManager, paraIdTo) {
9137
+ return new RelayToParaBuilder(api, to, batchManager, paraIdTo);
8286
9138
  }
8287
9139
  }]);
8288
9140
  }();
8289
9141
 
8290
9142
  var ParaToParaBuilder = /*#__PURE__*/function () {
8291
- function ParaToParaBuilder(api, from, to, currency, paraIdTo) {
9143
+ function ParaToParaBuilder(api, from, to, currency, batchManager, paraIdTo) {
8292
9144
  _classCallCheck(this, ParaToParaBuilder);
9145
+ this.batchManager = batchManager;
8293
9146
  this.api = api;
8294
9147
  this.from = from;
8295
9148
  this.to = to;
@@ -8342,6 +9195,16 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
8342
9195
  version: this._version
8343
9196
  };
8344
9197
  }
9198
+ }, {
9199
+ key: "addToBatch",
9200
+ value: function addToBatch() {
9201
+ var options = this.buildOptions();
9202
+ this.batchManager.addTransaction({
9203
+ func: send,
9204
+ options: options
9205
+ });
9206
+ return new GeneralBuilder(this.batchManager, this.api, this.from);
9207
+ }
8345
9208
  }, {
8346
9209
  key: "build",
8347
9210
  value: function build() {
@@ -8350,12 +9213,18 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
8350
9213
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8351
9214
  while (1) switch (_context.prev = _context.next) {
8352
9215
  case 0:
9216
+ if (this.batchManager.isEmpty()) {
9217
+ _context.next = 2;
9218
+ break;
9219
+ }
9220
+ throw new Error('Transaction manager contains batched items. Use buildBatch() to process them.');
9221
+ case 2:
8353
9222
  options = this.buildOptions();
8354
- _context.next = 3;
9223
+ _context.next = 5;
8355
9224
  return send(options);
8356
- case 3:
9225
+ case 5:
8357
9226
  return _context.abrupt("return", _context.sent);
8358
- case 4:
9227
+ case 6:
8359
9228
  case "end":
8360
9229
  return _context.stop();
8361
9230
  }
@@ -8384,15 +9253,16 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
8384
9253
  }
8385
9254
  }], [{
8386
9255
  key: "createParaToPara",
8387
- value: function createParaToPara(api, from, to, currency, paraIdTo) {
8388
- return new ParaToParaBuilder(api, from, to, currency, paraIdTo);
9256
+ value: function createParaToPara(api, from, to, currency, batchManager, paraIdTo) {
9257
+ return new ParaToParaBuilder(api, from, to, currency, batchManager, paraIdTo);
8389
9258
  }
8390
9259
  }]);
8391
9260
  }();
8392
9261
 
8393
9262
  var ParaToRelayBuilder = /*#__PURE__*/function () {
8394
- function ParaToRelayBuilder(api, from, amount, feeAsset) {
9263
+ function ParaToRelayBuilder(api, from, amount, batchManager, feeAsset) {
8395
9264
  _classCallCheck(this, ParaToRelayBuilder);
9265
+ this.batchManager = batchManager;
8396
9266
  this.api = api;
8397
9267
  this.from = from;
8398
9268
  this.amount = amount;
@@ -8426,7 +9296,9 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
8426
9296
  return {
8427
9297
  api: this.api,
8428
9298
  origin: this.from,
8429
- currency: currency,
9299
+ currency: {
9300
+ symbol: currency
9301
+ },
8430
9302
  amount: this.amount,
8431
9303
  address: this._address,
8432
9304
  feeAsset: this.feeAsset,
@@ -8434,6 +9306,16 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
8434
9306
  version: this._version
8435
9307
  };
8436
9308
  }
9309
+ }, {
9310
+ key: "addToBatch",
9311
+ value: function addToBatch() {
9312
+ var options = this.buildOptions();
9313
+ this.batchManager.addTransaction({
9314
+ func: send,
9315
+ options: options
9316
+ });
9317
+ return new GeneralBuilder(this.batchManager, this.api, this.from);
9318
+ }
8437
9319
  }, {
8438
9320
  key: "build",
8439
9321
  value: function build() {
@@ -8476,23 +9358,137 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
8476
9358
  }
8477
9359
  }], [{
8478
9360
  key: "create",
8479
- value: function create(api, from, amount, feeAsset) {
8480
- return new ParaToRelayBuilder(api, from, amount, feeAsset);
9361
+ value: function create(api, from, amount, batchManager, feeAsset) {
9362
+ return new ParaToRelayBuilder(api, from, amount, batchManager, feeAsset);
8481
9363
  }
8482
9364
  }]);
8483
9365
  }();
8484
9366
 
8485
- var MissingApiPromiseError = /*#__PURE__*/function (_Error) {
8486
- function MissingApiPromiseError() {
8487
- var _this;
8488
- _classCallCheck(this, MissingApiPromiseError);
8489
- _this = _callSuper(this, MissingApiPromiseError, ['Please provide ApiPromise instance.']);
8490
- _this.name = 'MissingApiPromise';
8491
- return _this;
9367
+ var findParachainJunction = function findParachainJunction(multilocation) {
9368
+ var interior = multilocation.interior;
9369
+ if (interior === 'Here') {
9370
+ return null;
9371
+ }
9372
+ for (var key in interior) {
9373
+ var junctions = interior[key];
9374
+ if (Array.isArray(junctions)) {
9375
+ var _iterator = _createForOfIteratorHelper(junctions),
9376
+ _step;
9377
+ try {
9378
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
9379
+ var junction = _step.value;
9380
+ if ('Parachain' in junction) {
9381
+ return Number(junction.Parachain);
9382
+ }
9383
+ }
9384
+ } catch (err) {
9385
+ _iterator.e(err);
9386
+ } finally {
9387
+ _iterator.f();
9388
+ }
9389
+ } else if (_typeof(junctions) === 'object' && junctions !== null && 'Parachain' in junctions) {
9390
+ return Number(junctions.Parachain);
9391
+ }
9392
+ }
9393
+ return null;
9394
+ };
9395
+
9396
+ var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
9397
+ var api = _ref.api,
9398
+ destination = _ref.destination,
9399
+ address = _ref.address,
9400
+ amount = _ref.amount,
9401
+ paraIdTo = _ref.paraIdTo;
9402
+ var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9403
+ var paraId = destination !== undefined && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
9404
+ var parameters = [createPolkadotXcmHeader('RelayToPara', version, destination, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpec(amount, version, Parents.ZERO), 0];
9405
+ if (includeFee) {
9406
+ parameters.push('Unlimited');
9407
+ }
9408
+ return parameters;
9409
+ };
9410
+ var isTMultiLocation = function isTMultiLocation(value) {
9411
+ return _typeof(value) === 'object' && value !== null && 'parents' in value && 'interior' in value;
9412
+ };
9413
+ var createBridgeCurrencySpec = function createBridgeCurrencySpec(amount, ecosystem) {
9414
+ return _defineProperty({}, Version.V4, [{
9415
+ id: {
9416
+ parents: Parents.TWO,
9417
+ interior: {
9418
+ X1: [{
9419
+ GlobalConsensus: ecosystem
9420
+ }]
9421
+ }
9422
+ },
9423
+ fun: {
9424
+ Fungible: amount
9425
+ }
9426
+ }]);
9427
+ };
9428
+ var createCurrencySpec = function createCurrencySpec(amount, version, parents, overriddenCurrency) {
9429
+ var interior = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'Here';
9430
+ if (!overriddenCurrency) {
9431
+ return _defineProperty({}, version, [{
9432
+ id: version === Version.V4 ? {
9433
+ parents: parents,
9434
+ interior: interior
9435
+ } : {
9436
+ Concrete: {
9437
+ parents: parents,
9438
+ interior: interior
9439
+ }
9440
+ },
9441
+ fun: {
9442
+ Fungible: amount
9443
+ }
9444
+ }]);
9445
+ }
9446
+ return isTMultiLocation(overriddenCurrency) ? _defineProperty({}, version, [{
9447
+ id: version === Version.V4 ? overriddenCurrency : {
9448
+ Concrete: overriddenCurrency
9449
+ },
9450
+ fun: {
9451
+ Fungible: amount
9452
+ }
9453
+ }]) : // It must be TMultiAsset if not TMultiLocation
9454
+ _defineProperty({}, version, overriddenCurrency);
9455
+ };
9456
+ var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
9457
+ var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
9458
+ var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
9459
+ Parachain: nodeId
9460
+ });
9461
+ var isMultiLocationDestination = _typeof(destination) === 'object';
9462
+ return _defineProperty({}, version, isMultiLocationDestination ? destination : {
9463
+ parents: parentsResolved,
9464
+ interior: interior
9465
+ });
9466
+ };
9467
+ var createBridgePolkadotXcmDest = function createBridgePolkadotXcmDest(version, ecosystem, destination, nodeId) {
9468
+ var multiLocation = {
9469
+ parents: Parents.TWO,
9470
+ interior: {
9471
+ X2: [{
9472
+ GlobalConsensus: ecosystem
9473
+ }, {
9474
+ Parachain: nodeId
9475
+ }]
9476
+ }
9477
+ };
9478
+ var isMultiLocationDestination = _typeof(destination) === 'object';
9479
+ return _defineProperty({}, version, isMultiLocationDestination ? destination : multiLocation);
9480
+ };
9481
+ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(multiLocation) {
9482
+ var parachainId = findParachainJunction(multiLocation);
9483
+ if (parachainId === null) {
9484
+ throw new Error('Parachain ID not found in destination multi location.');
9485
+ }
9486
+ var node = getTNode(parachainId);
9487
+ if (node === null) {
9488
+ throw new Error('Node with specified paraId not found in destination multi location.');
8492
9489
  }
8493
- _inherits(MissingApiPromiseError, _Error);
8494
- return _createClass(MissingApiPromiseError);
8495
- }( /*#__PURE__*/_wrapNativeSuper(Error));
9490
+ return node;
9491
+ };
8496
9492
 
8497
9493
  var buildBeneficiaryInput = function buildBeneficiaryInput(api, address) {
8498
9494
  if (isTMultiLocation(address)) {
@@ -8655,9 +9651,104 @@ var AssetClaimBuilder = /*#__PURE__*/function () {
8655
9651
  }]);
8656
9652
  }();
8657
9653
 
9654
+ var BatchTransactionManager = /*#__PURE__*/function () {
9655
+ function BatchTransactionManager() {
9656
+ _classCallCheck(this, BatchTransactionManager);
9657
+ this.transactions = [];
9658
+ }
9659
+ return _createClass(BatchTransactionManager, [{
9660
+ key: "addTransaction",
9661
+ value: function addTransaction(transaction) {
9662
+ this.transactions.push(transaction);
9663
+ }
9664
+ }, {
9665
+ key: "isEmpty",
9666
+ value: function isEmpty() {
9667
+ return this.transactions.length === 0;
9668
+ }
9669
+ }, {
9670
+ key: "buildBatch",
9671
+ value: function buildBatch(api_1, from_1, to_1) {
9672
+ return __awaiter(this, arguments, void 0, function (api, from, to) {
9673
+ var _this = this;
9674
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
9675
+ mode: BatchMode.BATCH_ALL
9676
+ };
9677
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9678
+ var apiWithFallback, mode, sameFrom, results, txs;
9679
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9680
+ while (1) switch (_context.prev = _context.next) {
9681
+ case 0:
9682
+ if (!(!from && !to)) {
9683
+ _context.next = 2;
9684
+ break;
9685
+ }
9686
+ throw new Error('From or to node is required');
9687
+ case 2:
9688
+ if (!(to && _typeof(to) === 'object')) {
9689
+ _context.next = 4;
9690
+ break;
9691
+ }
9692
+ throw new Error('Please provide ApiPromise instance.');
9693
+ case 4:
9694
+ if (!(api !== null && api !== void 0)) {
9695
+ _context.next = 8;
9696
+ break;
9697
+ }
9698
+ _context.t0 = api;
9699
+ _context.next = 11;
9700
+ break;
9701
+ case 8:
9702
+ _context.next = 10;
9703
+ return createApiInstanceForNode(from !== null && from !== void 0 ? from : determineRelayChain(to));
9704
+ case 10:
9705
+ _context.t0 = _context.sent;
9706
+ case 11:
9707
+ apiWithFallback = _context.t0;
9708
+ mode = options.mode;
9709
+ if (!(_this.transactions.length === 0)) {
9710
+ _context.next = 15;
9711
+ break;
9712
+ }
9713
+ throw new Error('No transactions to batch.');
9714
+ case 15:
9715
+ sameFrom = _this.transactions.every(function (tx) {
9716
+ if ('origin' in tx.options) {
9717
+ return tx.options.origin === from;
9718
+ }
9719
+ return true;
9720
+ });
9721
+ if (sameFrom) {
9722
+ _context.next = 18;
9723
+ break;
9724
+ }
9725
+ throw new Error('All transactions must have the same origin.');
9726
+ case 18:
9727
+ results = _this.transactions.map(function (options) {
9728
+ var func = options.func,
9729
+ txOptions = options.options;
9730
+ return func(txOptions);
9731
+ });
9732
+ _context.next = 21;
9733
+ return Promise.all(results);
9734
+ case 21:
9735
+ txs = _context.sent;
9736
+ return _context.abrupt("return", mode === BatchMode.BATCH_ALL ? apiWithFallback.tx.utility.batchAll(txs) : apiWithFallback.tx.utility.batch(txs));
9737
+ case 23:
9738
+ case "end":
9739
+ return _context.stop();
9740
+ }
9741
+ }, _callee);
9742
+ })();
9743
+ });
9744
+ }
9745
+ }]);
9746
+ }();
9747
+
8658
9748
  var ToGeneralBuilder = /*#__PURE__*/function () {
8659
- function ToGeneralBuilder(api, from, to, paraIdTo) {
9749
+ function ToGeneralBuilder(api, from, to, batchManager, paraIdTo) {
8660
9750
  _classCallCheck(this, ToGeneralBuilder);
9751
+ this.batchManager = batchManager;
8661
9752
  this.api = api;
8662
9753
  this.from = from;
8663
9754
  this.to = to;
@@ -8666,28 +9757,21 @@ var ToGeneralBuilder = /*#__PURE__*/function () {
8666
9757
  return _createClass(ToGeneralBuilder, [{
8667
9758
  key: "currency",
8668
9759
  value: function currency(_currency) {
8669
- return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency, this.paraIdTo);
8670
- }
8671
- }, {
8672
- key: "openChannel",
8673
- value: function openChannel() {
8674
- if (this.api === undefined) {
8675
- throw new MissingApiPromiseError();
8676
- }
8677
- return OpenChannelBuilder.create(this.api, this.from, this.to);
9760
+ return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency, this.batchManager, this.paraIdTo);
8678
9761
  }
8679
9762
  }]);
8680
9763
  }();
8681
9764
  var FromGeneralBuilder = /*#__PURE__*/function () {
8682
- function FromGeneralBuilder(api, from) {
9765
+ function FromGeneralBuilder(api, from, batchManager) {
8683
9766
  _classCallCheck(this, FromGeneralBuilder);
9767
+ this.batchManager = batchManager;
8684
9768
  this.api = api;
8685
9769
  this.from = from;
8686
9770
  }
8687
9771
  return _createClass(FromGeneralBuilder, [{
8688
9772
  key: "to",
8689
9773
  value: function to(node, paraIdTo) {
8690
- return new ToGeneralBuilder(this.api, this.from, node, paraIdTo);
9774
+ return new ToGeneralBuilder(this.api, this.from, node, this.batchManager, paraIdTo);
8691
9775
  }
8692
9776
  }, {
8693
9777
  key: "feeAsset",
@@ -8698,42 +9782,107 @@ var FromGeneralBuilder = /*#__PURE__*/function () {
8698
9782
  }, {
8699
9783
  key: "amount",
8700
9784
  value: function amount(_amount) {
8701
- return ParaToRelayBuilder.create(this.api, this.from, _amount, this._feeAsset);
8702
- }
8703
- }, {
8704
- key: "closeChannel",
8705
- value: function closeChannel() {
8706
- if (this.api === undefined) {
8707
- throw new MissingApiPromiseError();
8708
- }
8709
- return CloseChannelBuilder.create(this.api, this.from);
9785
+ return ParaToRelayBuilder.create(this.api, this.from, _amount, this.batchManager, this._feeAsset);
8710
9786
  }
8711
9787
  }]);
8712
9788
  }();
8713
9789
  var GeneralBuilder = /*#__PURE__*/function () {
8714
- function GeneralBuilder(api) {
9790
+ function GeneralBuilder(batchManager, api, _from, _to) {
8715
9791
  _classCallCheck(this, GeneralBuilder);
9792
+ this.batchManager = batchManager;
8716
9793
  this.api = api;
9794
+ this._from = _from;
9795
+ this._to = _to;
8717
9796
  }
8718
9797
  return _createClass(GeneralBuilder, [{
8719
9798
  key: "from",
8720
9799
  value: function from(node) {
8721
- return new FromGeneralBuilder(this.api, node);
9800
+ return new FromGeneralBuilder(this.api, node, this.batchManager);
8722
9801
  }
8723
9802
  }, {
8724
9803
  key: "to",
8725
9804
  value: function to(node, paraIdTo) {
8726
- return RelayToParaBuilder.create(this.api, node, paraIdTo);
9805
+ return RelayToParaBuilder.create(this.api, node, this.batchManager, paraIdTo);
8727
9806
  }
8728
9807
  }, {
8729
9808
  key: "claimFrom",
8730
9809
  value: function claimFrom(node) {
8731
9810
  return AssetClaimBuilder.create(this.api, node);
8732
9811
  }
9812
+ }, {
9813
+ key: "buildBatch",
9814
+ value: function buildBatch(options) {
9815
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9816
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9817
+ while (1) switch (_context.prev = _context.next) {
9818
+ case 0:
9819
+ return _context.abrupt("return", this.batchManager.buildBatch(this.api, this._from, this._to, options));
9820
+ case 1:
9821
+ case "end":
9822
+ return _context.stop();
9823
+ }
9824
+ }, _callee, this);
9825
+ }));
9826
+ }
8733
9827
  }]);
8734
9828
  }();
8735
9829
  var Builder = function Builder(api) {
8736
- return new GeneralBuilder(api);
9830
+ return new GeneralBuilder(new BatchTransactionManager(), api);
9831
+ };
9832
+
9833
+ var findEthAsset = function findEthAsset(currency) {
9834
+ var ethAssets = getOtherAssets('Ethereum');
9835
+ var ethAsset = 'symbol' in currency ? ethAssets.find(function (asset) {
9836
+ return asset.symbol === currency.symbol;
9837
+ }) : ethAssets.find(function (asset) {
9838
+ return asset.assetId === currency.id;
9839
+ });
9840
+ if (!ethAsset) {
9841
+ throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " is not supported for Ethereum transfers"));
9842
+ }
9843
+ return ethAsset;
9844
+ };
9845
+
9846
+ var createContext = function createContext(executionUrl, config) {
9847
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9848
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9849
+ while (1) switch (_context.prev = _context.next) {
9850
+ case 0:
9851
+ _context.next = 2;
9852
+ return contextFactory({
9853
+ ethereum: {
9854
+ execution_url: executionUrl,
9855
+ beacon_url: config.BEACON_HTTP_API
9856
+ },
9857
+ polkadot: {
9858
+ url: {
9859
+ bridgeHub: config.BRIDGE_HUB_URL,
9860
+ assetHub: config.ASSET_HUB_URL,
9861
+ relaychain: config.RELAY_CHAIN_URL,
9862
+ parachains: config.PARACHAINS
9863
+ }
9864
+ },
9865
+ appContracts: {
9866
+ gateway: config.GATEWAY_CONTRACT,
9867
+ beefy: config.BEEFY_CONTRACT
9868
+ }
9869
+ });
9870
+ case 2:
9871
+ return _context.abrupt("return", _context.sent);
9872
+ case 3:
9873
+ case "end":
9874
+ return _context.stop();
9875
+ }
9876
+ }, _callee);
9877
+ }));
9878
+ };
9879
+
9880
+ var checkPlanFailure = function checkPlanFailure(plan) {
9881
+ if (plan.failure) {
9882
+ throw new Error("Failed to validate send: ".concat(plan.failure.errors.map(function (e) {
9883
+ return e.message;
9884
+ }).join('\n\n')));
9885
+ }
8737
9886
  };
8738
9887
 
8739
9888
  var transferEthToPolkadot = function transferEthToPolkadot(provider_1, _a) {
@@ -8744,65 +9893,31 @@ var transferEthToPolkadot = function transferEthToPolkadot(provider_1, _a) {
8744
9893
  amount = _ref.amount,
8745
9894
  currency = _ref.currency;
8746
9895
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8747
- var ethAssets, ethAsset, env, config, context, destParaId, plan, result;
9896
+ var ethAsset, env, context, destParaId, plan, result;
8748
9897
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8749
9898
  while (1) switch (_context.prev = _context.next) {
8750
9899
  case 0:
8751
- ethAssets = getOtherAssets('Ethereum');
8752
- ethAsset = ethAssets.find(function (asset) {
8753
- return asset.symbol === currency;
8754
- });
8755
- if (ethAsset) {
8756
- _context.next = 4;
8757
- break;
8758
- }
8759
- throw new InvalidCurrencyError("Currency ".concat(currency, " is not supported for Ethereum transfers"));
8760
- case 4:
9900
+ ethAsset = findEthAsset(currency);
8761
9901
  env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
8762
- config = env.config;
8763
- _context.next = 8;
8764
- return contextFactory({
8765
- ethereum: {
8766
- execution_url: provider,
8767
- beacon_url: config.BEACON_HTTP_API
8768
- },
8769
- polkadot: {
8770
- url: {
8771
- bridgeHub: config.BRIDGE_HUB_URL,
8772
- assetHub: config.ASSET_HUB_URL,
8773
- relaychain: config.RELAY_CHAIN_URL,
8774
- parachains: config.PARACHAINS
8775
- }
8776
- },
8777
- appContracts: {
8778
- gateway: config.GATEWAY_CONTRACT,
8779
- beefy: config.BEEFY_CONTRACT
8780
- }
8781
- });
8782
- case 8:
9902
+ _context.next = 4;
9903
+ return createContext(provider, env.config);
9904
+ case 4:
8783
9905
  context = _context.sent;
8784
9906
  destParaId = getParaId(to);
8785
- _context.next = 12;
9907
+ _context.next = 8;
8786
9908
  return toPolkadot.validateSend(context, signer, address, ethAsset.assetId, destParaId, BigInt(amount), BigInt(0));
8787
- case 12:
9909
+ case 8:
8788
9910
  plan = _context.sent;
8789
- if (!plan.failure) {
8790
- _context.next = 15;
8791
- break;
8792
- }
8793
- throw new Error("Failed to validate send: ".concat(plan.failure.errors.map(function (e) {
8794
- return e.message;
8795
- }).join('\n\n')));
8796
- case 15:
8797
- _context.next = 17;
9911
+ checkPlanFailure(plan);
9912
+ _context.next = 12;
8798
9913
  return toPolkadot.send(context, signer, plan);
8799
- case 17:
9914
+ case 12:
8800
9915
  result = _context.sent;
8801
9916
  return _context.abrupt("return", {
8802
9917
  result: result,
8803
9918
  plan: plan
8804
9919
  });
8805
- case 19:
9920
+ case 14:
8806
9921
  case "end":
8807
9922
  return _context.stop();
8808
9923
  }
@@ -8888,7 +10003,7 @@ var EvmBuilder = function EvmBuilder(provider) {
8888
10003
  return new EvmBuilderClass(provider);
8889
10004
  };
8890
10005
 
8891
- var createTx$1 = function createTx(originApi, address, amount, currencySymbol, originNode, destNode) {
10006
+ var createTx$1 = function createTx(originApi, address, amount, currency, originNode, destNode) {
8892
10007
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8893
10008
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8894
10009
  while (1) switch (_context.prev = _context.next) {
@@ -8912,7 +10027,7 @@ var createTx$1 = function createTx(originApi, address, amount, currencySymbol, o
8912
10027
  return _context.abrupt("return", _context.sent);
8913
10028
  case 12:
8914
10029
  _context.next = 14;
8915
- return Builder(originApi).from(originNode).to(destNode).currency(currencySymbol).amount(amount).address(address).build();
10030
+ return Builder(originApi).from(originNode).to(destNode).currency(currency).amount(amount).address(address).build();
8916
10031
  case 14:
8917
10032
  return _context.abrupt("return", _context.sent);
8918
10033
  case 15:
@@ -8922,7 +10037,7 @@ var createTx$1 = function createTx(originApi, address, amount, currencySymbol, o
8922
10037
  }, _callee);
8923
10038
  }));
8924
10039
  };
8925
- var calculateTransactionFee = function calculateTransactionFee(tx, address) {
10040
+ var calculateTransactionFee$1 = function calculateTransactionFee(tx, address) {
8926
10041
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
8927
10042
  var _yield$tx$paymentInfo, partialFee;
8928
10043
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -8971,7 +10086,7 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin, destination, curr
8971
10086
  case 14:
8972
10087
  tx = _context3.sent;
8973
10088
  _context3.next = 17;
8974
- return calculateTransactionFee(tx, account);
10089
+ return calculateTransactionFee$1(tx, account);
8975
10090
  case 17:
8976
10091
  xcmFee = _context3.sent;
8977
10092
  xcmFeeBigInt = BigInt(xcmFee.toString());
@@ -8993,148 +10108,88 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin, destination, curr
8993
10108
  }));
8994
10109
  };
8995
10110
 
8996
- var getAssetSymbol = function getAssetSymbol(node, assetId) {
8997
- if (node === 'Polkadot' || node === 'Kusama') {
8998
- return getNativeAssetSymbol(node);
8999
- }
9000
- var asset = getAssetBySymbolOrId(node, assetId, false, true);
9001
- return asset === null || asset === void 0 ? void 0 : asset.symbol;
9002
- };
9003
- var getAssetBalance = function getAssetBalance(account, node, assetSymbolOrId) {
10111
+ var getTransferInfo = function getTransferInfo(origin, destination, accountOrigin, accountDestination, currency, amount) {
9004
10112
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9005
- var _a, api, isNativeSymbol;
10113
+ var _a, _b, originApi, originBalance, _yield$getOriginFeeDe, destXcmFee, expectedBalanceAfterXCMDelivery, asset;
9006
10114
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9007
10115
  while (1) switch (_context.prev = _context.next) {
9008
10116
  case 0:
9009
10117
  _context.next = 2;
9010
- return createApiInstanceForNode(node);
9011
- case 2:
9012
- api = _context.sent;
9013
- isNativeSymbol = getNativeAssetSymbol(node) === assetSymbolOrId;
9014
- if (!isNativeSymbol) {
9015
- _context.next = 10;
9016
- break;
9017
- }
9018
- _context.next = 7;
9019
- return getBalanceNative(account, node, api);
9020
- case 7:
9021
- _context.t0 = _context.sent;
9022
- _context.next = 22;
9023
- break;
9024
- case 10:
9025
- _context.next = 12;
9026
- return getBalanceForeign(account, node, assetSymbolOrId, api);
9027
- case 12:
9028
- _context.t2 = _a = _context.sent;
9029
- _context.t1 = _context.t2 !== null;
9030
- if (!_context.t1) {
9031
- _context.next = 16;
9032
- break;
9033
- }
9034
- _context.t1 = _a !== void 0;
9035
- case 16:
9036
- if (!_context.t1) {
9037
- _context.next = 20;
9038
- break;
9039
- }
9040
- _context.t3 = _a;
9041
- _context.next = 21;
9042
- break;
9043
- case 20:
9044
- _context.t3 = BigInt(0);
9045
- case 21:
9046
- _context.t0 = _context.t3;
9047
- case 22:
9048
- return _context.abrupt("return", _context.t0);
9049
- case 23:
9050
- case "end":
9051
- return _context.stop();
9052
- }
9053
- }, _callee);
9054
- }));
9055
- };
9056
- var getTransferInfo = function getTransferInfo(origin, destination, accountOrigin, accountDestination, assetSymbolOrId, amount) {
9057
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9058
- var _a, originApi, originBalance, _yield$getOriginFeeDe, destXcmFee, expectedBalanceAfterXCMDelivery, asset;
9059
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9060
- while (1) switch (_context2.prev = _context2.next) {
9061
- case 0:
9062
- _context2.next = 2;
9063
10118
  return createApiInstanceForNode(origin);
9064
10119
  case 2:
9065
- originApi = _context2.sent;
9066
- _context2.next = 5;
10120
+ originApi = _context.sent;
10121
+ _context.next = 5;
9067
10122
  return getBalanceNative(accountOrigin, origin, originApi);
9068
10123
  case 5:
9069
- originBalance = _context2.sent;
9070
- _context2.next = 8;
9071
- return getOriginFeeDetails(origin, destination, assetSymbolOrId, amount, accountOrigin, originApi);
10124
+ originBalance = _context.sent;
10125
+ _context.next = 8;
10126
+ return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
9072
10127
  case 8:
9073
- _yield$getOriginFeeDe = _context2.sent;
10128
+ _yield$getOriginFeeDe = _context.sent;
9074
10129
  destXcmFee = _yield$getOriginFeeDe.xcmFee;
9075
10130
  expectedBalanceAfterXCMDelivery = originBalance - destXcmFee;
9076
- asset = getAssetSymbol(origin, assetSymbolOrId);
9077
- _context2.t0 = {
10131
+ asset = getAssetBySymbolOrId(origin, currency);
10132
+ _context.t0 = {
9078
10133
  origin: origin,
9079
10134
  destination: destination,
9080
10135
  ecosystem: determineRelayChainSymbol(origin)
9081
10136
  };
9082
- _context2.next = 15;
9083
- return getAssetBalance(accountOrigin, origin, assetSymbolOrId);
10137
+ _context.next = 15;
10138
+ return getAssetBalance(accountOrigin, origin, currency);
9084
10139
  case 15:
9085
- _context2.t1 = _context2.sent;
9086
- _context2.t2 = asset !== null && asset !== void 0 ? asset : '';
9087
- _context2.t3 = {
9088
- balance: _context2.t1,
9089
- currency: _context2.t2
10140
+ _context.t1 = _context.sent;
10141
+ _context.t2 = (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : '';
10142
+ _context.t3 = {
10143
+ balance: _context.t1,
10144
+ currency: _context.t2
9090
10145
  };
9091
- _context2.next = 20;
10146
+ _context.next = 20;
9092
10147
  return getBalanceNative(accountOrigin, origin, originApi);
9093
10148
  case 20:
9094
- _context2.t4 = _context2.sent;
9095
- _context2.t5 = expectedBalanceAfterXCMDelivery;
9096
- _context2.next = 24;
9097
- return getOriginFeeDetails(origin, destination, assetSymbolOrId, amount, accountOrigin, originApi);
10149
+ _context.t4 = _context.sent;
10150
+ _context.t5 = expectedBalanceAfterXCMDelivery;
10151
+ _context.next = 24;
10152
+ return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
9098
10153
  case 24:
9099
- _context2.t6 = _context2.sent;
9100
- _context2.t7 = BigInt((_a = getExistentialDeposit$1(origin)) !== null && _a !== void 0 ? _a : 0);
9101
- _context2.t8 = getNativeAssetSymbol(origin);
9102
- _context2.t9 = getMinNativeTransferableAmount(origin);
9103
- _context2.next = 30;
10154
+ _context.t6 = _context.sent;
10155
+ _context.t7 = BigInt((_b = getExistentialDeposit(origin)) !== null && _b !== void 0 ? _b : 0);
10156
+ _context.t8 = getNativeAssetSymbol(origin);
10157
+ _context.t9 = getMinNativeTransferableAmount(origin);
10158
+ _context.next = 30;
9104
10159
  return getMaxNativeTransferableAmount(accountOrigin, origin);
9105
10160
  case 30:
9106
- _context2.t10 = _context2.sent;
9107
- _context2.t11 = {
9108
- balance: _context2.t4,
9109
- expectedBalanceAfterXCMFee: _context2.t5,
9110
- xcmFee: _context2.t6,
9111
- existentialDeposit: _context2.t7,
9112
- asset: _context2.t8,
9113
- minNativeTransferableAmount: _context2.t9,
9114
- maxNativeTransferableAmount: _context2.t10
10161
+ _context.t10 = _context.sent;
10162
+ _context.t11 = {
10163
+ balance: _context.t4,
10164
+ expectedBalanceAfterXCMFee: _context.t5,
10165
+ xcmFee: _context.t6,
10166
+ existentialDeposit: _context.t7,
10167
+ asset: _context.t8,
10168
+ minNativeTransferableAmount: _context.t9,
10169
+ maxNativeTransferableAmount: _context.t10
9115
10170
  };
9116
- _context2.next = 34;
10171
+ _context.next = 34;
9117
10172
  return getBalanceNative(accountDestination, destination);
9118
10173
  case 34:
9119
- _context2.t12 = _context2.sent;
9120
- _context2.t13 = getNativeAssetSymbol(destination);
9121
- _context2.t14 = getExistentialDeposit$1(destination);
9122
- _context2.t15 = {
9123
- balance: _context2.t12,
9124
- currency: _context2.t13,
9125
- existentialDeposit: _context2.t14
10174
+ _context.t12 = _context.sent;
10175
+ _context.t13 = getNativeAssetSymbol(destination);
10176
+ _context.t14 = getExistentialDeposit(destination);
10177
+ _context.t15 = {
10178
+ balance: _context.t12,
10179
+ currency: _context.t13,
10180
+ existentialDeposit: _context.t14
9126
10181
  };
9127
- return _context2.abrupt("return", {
9128
- chain: _context2.t0,
9129
- currencyBalanceOrigin: _context2.t3,
9130
- originFeeBalance: _context2.t11,
9131
- destinationFeeBalance: _context2.t15
10182
+ return _context.abrupt("return", {
10183
+ chain: _context.t0,
10184
+ currencyBalanceOrigin: _context.t3,
10185
+ originFeeBalance: _context.t11,
10186
+ destinationFeeBalance: _context.t15
9132
10187
  });
9133
10188
  case 39:
9134
10189
  case "end":
9135
- return _context2.stop();
10190
+ return _context.stop();
9136
10191
  }
9137
- }, _callee2);
10192
+ }, _callee);
9138
10193
  }));
9139
10194
  };
9140
10195
 
@@ -9147,6 +10202,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
9147
10202
  getAssetsObject: getAssetsObject,
9148
10203
  getBalanceForeign: getBalanceForeign,
9149
10204
  getBalanceNative: getBalanceNative,
10205
+ getExistentialDeposit: getExistentialDeposit$1,
9150
10206
  getNativeAssetSymbol: getNativeAssetSymbol,
9151
10207
  getNativeAssets: getNativeAssets,
9152
10208
  getOtherAssets: getOtherAssets,
@@ -9158,14 +10214,76 @@ var index$1 = /*#__PURE__*/Object.freeze({
9158
10214
  hasSupportForAsset: hasSupportForAsset
9159
10215
  });
9160
10216
 
10217
+ var isPrimitive = function isPrimitive(obj) {
10218
+ return obj !== Object(obj);
10219
+ };
10220
+ var _deepEqual = function deepEqual(obj1, obj2) {
10221
+ if (obj1 === obj2) return true;
10222
+ if (isPrimitive(obj1) && isPrimitive(obj2)) return obj1 === obj2;
10223
+ if (_typeof(obj1) !== 'object' || obj1 === null || _typeof(obj2) !== 'object' || obj2 === null) {
10224
+ return false;
10225
+ }
10226
+ if (Array.isArray(obj1) !== Array.isArray(obj2)) {
10227
+ return false;
10228
+ }
10229
+ var obj1Keys = Object.keys(obj1).map(function (key) {
10230
+ return key.toLowerCase();
10231
+ });
10232
+ var obj2Keys = Object.keys(obj2).map(function (key) {
10233
+ return key.toLowerCase();
10234
+ });
10235
+ if (obj1Keys.length !== obj2Keys.length) return false;
10236
+ var _iterator = _createForOfIteratorHelper(obj1Keys),
10237
+ _step;
10238
+ try {
10239
+ var _loop = function _loop() {
10240
+ var key = _step.value;
10241
+ var keyInObj2 = obj2Keys.find(function (k) {
10242
+ return k === key;
10243
+ });
10244
+ if (!keyInObj2) return {
10245
+ v: false
10246
+ };
10247
+ var obj1Value = obj1[Object.keys(obj1).find(function (k) {
10248
+ return k.toLowerCase() === key;
10249
+ })];
10250
+ var obj2Value = obj2[Object.keys(obj2).find(function (k) {
10251
+ return k.toLowerCase() === key;
10252
+ })];
10253
+ if (!_deepEqual(obj1Value, obj2Value)) return {
10254
+ v: false
10255
+ };
10256
+ },
10257
+ _ret;
10258
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
10259
+ _ret = _loop();
10260
+ if (_ret) return _ret.v;
10261
+ }
10262
+ } catch (err) {
10263
+ _iterator.e(err);
10264
+ } finally {
10265
+ _iterator.f();
10266
+ }
10267
+ return true;
10268
+ };
10269
+
10270
+ var verifyMultiLocation = function verifyMultiLocation(node, multiLocation) {
10271
+ var _getAssetsObject = getAssetsObject(node),
10272
+ multiLocations = _getAssetsObject.multiLocations;
10273
+ if (!multiLocations) return true;
10274
+ return multiLocations.some(function (location) {
10275
+ return _deepEqual(location, multiLocation);
10276
+ });
10277
+ };
10278
+
9161
10279
  var supportsXTokens = function supportsXTokens(obj) {
9162
- return 'transferXTokens' in obj;
10280
+ return _typeof(obj) === 'object' && obj !== null && 'transferXTokens' in obj;
9163
10281
  };
9164
10282
  var supportsXTransfer = function supportsXTransfer(obj) {
9165
- return 'transferXTransfer' in obj;
10283
+ return _typeof(obj) === 'object' && obj !== null && 'transferXTransfer' in obj;
9166
10284
  };
9167
10285
  var supportsPolkadotXCM = function supportsPolkadotXCM(obj) {
9168
- return 'transferPolkadotXCM' in obj;
10286
+ return _typeof(obj) === 'object' && obj !== null && 'transferPolkadotXCM' in obj;
9169
10287
  };
9170
10288
  var ParachainNode = /*#__PURE__*/function () {
9171
10289
  function ParachainNode(node, name, type, version) {
@@ -9254,6 +10372,9 @@ var ParachainNode = /*#__PURE__*/function () {
9254
10372
  serializedApiCallEnabled: serializedApiCallEnabled
9255
10373
  });
9256
10374
  } else if (supportsPolkadotXCM(this)) {
10375
+ if (isTMultiLocation(overridedCurrencyMultiLocation) && !verifyMultiLocation(this.node, overridedCurrencyMultiLocation)) {
10376
+ throw new InvalidCurrencyError('Provided Multi-location is not a valid currency.');
10377
+ }
9257
10378
  return this.transferPolkadotXCM({
9258
10379
  api: api,
9259
10380
  header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
@@ -9347,12 +10468,13 @@ var getModifiedCurrencySelection = function getModifiedCurrencySelection(version
9347
10468
  }
9348
10469
  });
9349
10470
  };
9350
- var getCurrencySelection = function getCurrencySelection(_ref2, isAssetHub, currencySelection) {
9351
- var origin = _ref2.origin,
9352
- amount = _ref2.amount,
9353
- currencyID = _ref2.currencyID,
9354
- paraIdTo = _ref2.paraIdTo,
9355
- overridedCurrencyMultiLocation = _ref2.overridedCurrencyMultiLocation;
10471
+
10472
+ var getCurrencySelection = function getCurrencySelection(_ref, isAssetHub, currencySelection) {
10473
+ var origin = _ref.origin,
10474
+ amount = _ref.amount,
10475
+ currencyID = _ref.currencyID,
10476
+ paraIdTo = _ref.paraIdTo,
10477
+ overridedCurrencyMultiLocation = _ref.overridedCurrencyMultiLocation;
9356
10478
  var _getNode = getNode(origin),
9357
10479
  version = _getNode.version;
9358
10480
  if (overridedCurrencyMultiLocation !== undefined) return _defineProperty({}, version, overridedCurrencyMultiLocation);
@@ -9361,14 +10483,14 @@ var getCurrencySelection = function getCurrencySelection(_ref2, isAssetHub, curr
9361
10483
  }
9362
10484
  return currencySelection;
9363
10485
  };
9364
- var getParameters = function getParameters(isAssetHub, currencySelection, addressSelection, amount, fees, feeAsset
9365
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9366
- ) {
10486
+
10487
+ var getParameters = function getParameters(isAssetHub, currencySelection, addressSelection, amount, fees, feeAsset) {
9367
10488
  if (isAssetHub) {
9368
10489
  return feeAsset !== undefined ? [currencySelection, feeAsset, addressSelection, fees] : [currencySelection, addressSelection, fees];
9369
10490
  }
9370
10491
  return [currencySelection, amount, addressSelection, fees];
9371
10492
  };
10493
+
9372
10494
  var XTokensTransferImpl = /*#__PURE__*/function () {
9373
10495
  function XTokensTransferImpl() {
9374
10496
  _classCallCheck(this, XTokensTransferImpl);
@@ -9378,7 +10500,6 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
9378
10500
  value: function transferXTokens(input, currencySelection) {
9379
10501
  var _api$tx$module;
9380
10502
  var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
9381
- var pallet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'XTokens';
9382
10503
  var api = input.api,
9383
10504
  amount = input.amount,
9384
10505
  addressSelection = input.addressSelection,
@@ -9389,9 +10510,9 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
9389
10510
  if (isMultiLocationDestination) {
9390
10511
  throw new Error('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
9391
10512
  }
9392
- var module = lowercaseFirstLetter(pallet.toString());
9393
10513
  var isAssetHub = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
9394
10514
  var modifiedCurrencySelection = getCurrencySelection(input, isAssetHub, currencySelection);
10515
+ var module = 'xTokens';
9395
10516
  var section = isAssetHub ? 'transferMultiasset' : 'transfer';
9396
10517
  var parameters = getParameters(isAssetHub, modifiedCurrencySelection, addressSelection, amount, fees, feeAsset);
9397
10518
  if (serializedApiCallEnabled === true) {
@@ -9401,7 +10522,6 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
9401
10522
  parameters: parameters
9402
10523
  };
9403
10524
  }
9404
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
9405
10525
  return (_api$tx$module = api.tx[module])[section].apply(_api$tx$module, _toConsumableArray(parameters));
9406
10526
  }
9407
10527
  }]);
@@ -9988,7 +11108,7 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
9988
11108
  }
9989
11109
  return _createClass(PolkadotXCMTransferImpl, null, [{
9990
11110
  key: "transferPolkadotXCM",
9991
- value: function transferPolkadotXCM(_ref, method) {
11111
+ value: function transferPolkadotXCM(_ref, section) {
9992
11112
  var api = _ref.api,
9993
11113
  header = _ref.header,
9994
11114
  addressSelection = _ref.addressSelection,
@@ -9997,14 +11117,15 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
9997
11117
  feeAsset = _ref$feeAsset === void 0 ? DEFAULT_FEE_ASSET : _ref$feeAsset,
9998
11118
  serializedApiCallEnabled = _ref.serializedApiCallEnabled;
9999
11119
  var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
11120
+ var module = 'polkadotXcm';
10000
11121
  if (serializedApiCallEnabled === true) {
10001
11122
  return {
10002
- module: 'polkadotXcm',
10003
- section: method,
11123
+ module: module,
11124
+ section: section,
10004
11125
  parameters: [header, addressSelection, currencySelection, feeAsset].concat(_toConsumableArray(fees !== undefined ? [fees] : []))
10005
11126
  };
10006
11127
  }
10007
- return fees !== undefined ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, feeAsset, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, feeAsset);
11128
+ return fees !== undefined ? api.tx[module][section](header, addressSelection, currencySelection, feeAsset, fees) : api.tx[module][section](header, addressSelection, currencySelection, feeAsset);
10008
11129
  }
10009
11130
  }]);
10010
11131
  }();
@@ -10109,7 +11230,9 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
10109
11230
  }, {
10110
11231
  key: "transferPolkadotXCM",
10111
11232
  value: function transferPolkadotXCM(input) {
10112
- var scenario = input.scenario;
11233
+ var scenario = input.scenario,
11234
+ currencySymbol = input.currencySymbol,
11235
+ currencyId = input.currencyId;
10113
11236
  if (input.destination === 'AssetHubKusama') {
10114
11237
  return this.handleBridgeTransfer(input, 'Kusama');
10115
11238
  }
@@ -10119,8 +11242,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
10119
11242
  if (input.destination === 'Mythos') {
10120
11243
  return this.handleMythosTransfer(input);
10121
11244
  }
10122
- var method = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
10123
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11245
+ if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined) {
11246
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
11247
+ }
11248
+ if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
11249
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged KSM cannot currently be transfered from AssetHubPolkadot, if you are sending different KSM asset, please specify {id: <KSMID>}.');
11250
+ }
11251
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11252
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10124
11253
  }
10125
11254
  }, {
10126
11255
  key: "transferRelayToPara",
@@ -10141,7 +11270,8 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
10141
11270
  X2: [{
10142
11271
  PalletInstance: 50
10143
11272
  }, {
10144
- GeneralIndex: currencyId
11273
+ // TODO: Handle the case where currencyId is undefined
11274
+ GeneralIndex: currencyId !== null && currencyId !== void 0 ? currencyId : ''
10145
11275
  }]
10146
11276
  };
10147
11277
  return createCurrencySpec(amount, version, Parents.ZERO, overridedMultiLocation, interior);
@@ -10161,14 +11291,23 @@ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
10161
11291
  return _createClass(AssetHubKusama, [{
10162
11292
  key: "transferPolkadotXCM",
10163
11293
  value: function transferPolkadotXCM(input) {
11294
+ var destination = input.destination,
11295
+ currencySymbol = input.currencySymbol,
11296
+ currencyId = input.currencyId,
11297
+ scenario = input.scenario;
10164
11298
  // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
10165
11299
  // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
10166
- if (input.destination === 'AssetHubPolkadot') {
11300
+ if (destination === 'AssetHubPolkadot') {
10167
11301
  return getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot');
10168
11302
  }
10169
- var scenario = input.scenario;
10170
- var method = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
10171
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11303
+ if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
11304
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for KSM transfer from AssetHub are not supported, you have to transfer KSM to Relay chain and transfer to destination chain from Relay chain.');
11305
+ }
11306
+ if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined) {
11307
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged DOT cannot currently be transfered from AssetHubKusama, if you are sending different DOT asset, please specify {id: <DOTID>}.');
11308
+ }
11309
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11310
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10172
11311
  }
10173
11312
  }, {
10174
11313
  key: "transferRelayToPara",
@@ -10203,8 +11342,8 @@ var CoretimeKusama = /*#__PURE__*/function (_ParachainNode) {
10203
11342
  value: function transferPolkadotXCM(input) {
10204
11343
  // TESTED block hash on Rococo: 0x78ace0f1bf7cac9a42e56143321b617d98327e2750f795efb0abb833025c9082
10205
11344
  var scenario = input.scenario;
10206
- var method = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
10207
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11345
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11346
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10208
11347
  }
10209
11348
  }, {
10210
11349
  key: "transferRelayToPara",
@@ -10222,6 +11361,42 @@ var CoretimeKusama = /*#__PURE__*/function (_ParachainNode) {
10222
11361
  }]);
10223
11362
  }(ParachainNode);
10224
11363
 
11364
+ var CoretimePolkadot = /*#__PURE__*/function (_ParachainNode) {
11365
+ function CoretimePolkadot() {
11366
+ var _this;
11367
+ _classCallCheck(this, CoretimePolkadot);
11368
+ _this = _callSuper(this, CoretimePolkadot, ['CoretimePolkadot', 'polkadotCoretime', 'polkadot', Version.V3]);
11369
+ _this._assetCheckEnabled = false;
11370
+ return _this;
11371
+ }
11372
+ _inherits(CoretimePolkadot, _ParachainNode);
11373
+ return _createClass(CoretimePolkadot, [{
11374
+ key: "transferPolkadotXCM",
11375
+ value: function transferPolkadotXCM(input) {
11376
+ var scenario = input.scenario;
11377
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11378
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
11379
+ }
11380
+ }, {
11381
+ key: "transferRelayToPara",
11382
+ value: function transferRelayToPara(options) {
11383
+ var _options$version = options.version,
11384
+ version = _options$version === void 0 ? Version.V3 : _options$version;
11385
+ return {
11386
+ module: 'xcmPallet',
11387
+ section: 'limitedTeleportAssets',
11388
+ parameters: constructRelayToParaParameters(options, version, true)
11389
+ };
11390
+ }
11391
+ }, {
11392
+ key: "getProvider",
11393
+ value: function getProvider() {
11394
+ // TODO: Temporary solution, will be solved after updating @polkadot/apps-config package
11395
+ return 'wss://polkadot-coretime-rpc.polkadot.io';
11396
+ }
11397
+ }]);
11398
+ }(ParachainNode);
11399
+
10225
11400
  var Encointer = /*#__PURE__*/function (_ParachainNode) {
10226
11401
  function Encointer() {
10227
11402
  _classCallCheck(this, Encointer);
@@ -10282,8 +11457,8 @@ var Astar = /*#__PURE__*/function (_ParachainNode) {
10282
11457
  key: "transferPolkadotXCM",
10283
11458
  value: function transferPolkadotXCM(input) {
10284
11459
  // TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
10285
- var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
10286
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
11460
+ var section = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
11461
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section);
10287
11462
  }
10288
11463
  }, {
10289
11464
  key: "transferXTokens",
@@ -10509,11 +11684,6 @@ var Polkadex = /*#__PURE__*/function (_ParachainNode) {
10509
11684
  var currencyID = input.currencyID;
10510
11685
  return XTokensTransferImpl.transferXTokens(input, currencyID);
10511
11686
  }
10512
- }, {
10513
- key: "getProvider",
10514
- value: function getProvider() {
10515
- return getAllNodeProviders(this.node)[1];
10516
- }
10517
11687
  }]);
10518
11688
  }(ParachainNode);
10519
11689
 
@@ -10587,6 +11757,7 @@ var determineDestWeight = function determineDestWeight(destNode) {
10587
11757
  }
10588
11758
  throw new NodeNotSupportedError("Node ".concat(destNode, " is not supported"));
10589
11759
  };
11760
+
10590
11761
  var getDestination = function getDestination(_ref) {
10591
11762
  var recipientAddress = _ref.recipientAddress,
10592
11763
  paraId = _ref.paraId,
@@ -10614,6 +11785,7 @@ var getDestination = function getDestination(_ref) {
10614
11785
  }
10615
11786
  };
10616
11787
  };
11788
+
10617
11789
  var XTransferTransferImpl = /*#__PURE__*/function () {
10618
11790
  function XTransferTransferImpl() {
10619
11791
  _classCallCheck(this, XTransferTransferImpl);
@@ -10633,14 +11805,17 @@ var XTransferTransferImpl = /*#__PURE__*/function () {
10633
11805
  }
10634
11806
  var currencySpec = Object.values(createCurrencySpec(amount, Version.V1, Parents.ZERO, overridedCurrencyMultiLocation))[0][0];
10635
11807
  var dest = getDestination(input);
11808
+ var module = 'xTransfer';
11809
+ var section = 'transfer';
11810
+ var destWeight = origin === 'Khala' ? null : determineDestWeight(destination);
10636
11811
  if (serializedApiCallEnabled === true) {
10637
11812
  return {
10638
- module: 'xTransfer',
10639
- section: 'transfer',
10640
- parameters: [currencySpec, dest, origin === 'Khala' ? null : determineDestWeight(destination)]
11813
+ module: module,
11814
+ section: section,
11815
+ parameters: [currencySpec, dest, destWeight]
10641
11816
  };
10642
11817
  }
10643
- return api.tx.xTransfer.transfer(currencySpec, dest, origin === 'Khala' ? null : determineDestWeight(destination));
11818
+ return api.tx[module][section](currencySpec, dest, destWeight);
10644
11819
  }
10645
11820
  }]);
10646
11821
  }();
@@ -10757,8 +11932,8 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
10757
11932
  if (scenario === 'ParaToPara') {
10758
11933
  throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
10759
11934
  }
10760
- var method = 'limitedTeleportAssets';
10761
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11935
+ var section = 'limitedTeleportAssets';
11936
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10762
11937
  }
10763
11938
  }, {
10764
11939
  key: "transferRelayToPara",
@@ -10790,8 +11965,8 @@ var BridgeHubKusama = /*#__PURE__*/function (_ParachainNode) {
10790
11965
  if (scenario === 'ParaToPara') {
10791
11966
  throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
10792
11967
  }
10793
- var method = 'limitedTeleportAssets';
10794
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11968
+ var section = 'limitedTeleportAssets';
11969
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10795
11970
  }
10796
11971
  }, {
10797
11972
  key: "transferRelayToPara",
@@ -10874,7 +12049,7 @@ var Peaq = /*#__PURE__*/function (_ParachainNode) {
10874
12049
  }]);
10875
12050
  }(ParachainNode);
10876
12051
 
10877
- var NODE_NAMES_DOT_KSM = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'Hydration', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq'];
12052
+ var NODE_NAMES_DOT_KSM = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'Hydration', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'CoretimePolkadot', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq'];
10878
12053
  var NODE_NAMES = [].concat(NODE_NAMES_DOT_KSM, ['Ethereum']);
10879
12054
  var NODES_WITH_RELAY_CHAINS = [].concat(_toConsumableArray(NODE_NAMES), ['Polkadot', 'Kusama']);
10880
12055
  var NODES_WITH_RELAY_CHAINS_DOT_KSM = [].concat(NODE_NAMES_DOT_KSM, ['Polkadot', 'Kusama']);
@@ -10898,6 +12073,7 @@ var nodes = {
10898
12073
  Parallel: new Parallel(),
10899
12074
  AssetHubKusama: new AssetHubKusama(),
10900
12075
  CoretimeKusama: new CoretimeKusama(),
12076
+ CoretimePolkadot: new CoretimePolkadot(),
10901
12077
  Encointer: new Encointer(),
10902
12078
  Altair: new Altair(),
10903
12079
  Amplitude: new Amplitude(),
@@ -11083,6 +12259,11 @@ var getAllNodeProviders = function getAllNodeProviders(node) {
11083
12259
  return Object.values(providers !== null && providers !== void 0 ? providers : []);
11084
12260
  };
11085
12261
  var getNodeProvider = function getNodeProvider(node) {
12262
+ if (node === 'Polkadot') {
12263
+ return prodRelayPolkadot.providers[0];
12264
+ } else if (node === 'Kusama') {
12265
+ return prodRelayKusama.providers[0];
12266
+ }
11086
12267
  return getNode(node).getProvider();
11087
12268
  };
11088
12269
  var createApiInstance = function createApiInstance(wsUrl) {
@@ -11133,11 +12314,7 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
11133
12314
  }, _callee2);
11134
12315
  }));
11135
12316
  };
11136
- var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
11137
- return str.charAt(0).toLowerCase() + str.slice(1);
11138
- };
11139
- var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref10 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11140
- ) {
12317
+ var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref10) {
11141
12318
  var _api$tx$module;
11142
12319
  var module = _ref10.module,
11143
12320
  section = _ref10.section,
@@ -11170,12 +12347,28 @@ var KeepAliveError = /*#__PURE__*/function (_Error) {
11170
12347
  }
11171
12348
  _inherits(KeepAliveError, _Error);
11172
12349
  return _createClass(KeepAliveError);
11173
- }( /*#__PURE__*/_wrapNativeSuper(Error));
12350
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
11174
12351
 
11175
- var edMap = edMapJson;
11176
- var getExistentialDeposit = function getExistentialDeposit(node) {
11177
- return edMap[node];
12352
+ var calculateTransactionFee = function calculateTransactionFee(tx, address) {
12353
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12354
+ var _yield$tx$paymentInfo, partialFee;
12355
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12356
+ while (1) switch (_context.prev = _context.next) {
12357
+ case 0:
12358
+ _context.next = 2;
12359
+ return tx.paymentInfo(address);
12360
+ case 2:
12361
+ _yield$tx$paymentInfo = _context.sent;
12362
+ partialFee = _yield$tx$paymentInfo.partialFee;
12363
+ return _context.abrupt("return", partialFee.toBn());
12364
+ case 5:
12365
+ case "end":
12366
+ return _context.stop();
12367
+ }
12368
+ }, _callee);
12369
+ }));
11178
12370
  };
12371
+
11179
12372
  var createTx = function createTx(originApi, destApi, address, amount, currencySymbol, originNode, destNode) {
11180
12373
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11181
12374
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -11186,7 +12379,9 @@ var createTx = function createTx(originApi, destApi, address, amount, currencySy
11186
12379
  break;
11187
12380
  }
11188
12381
  _context.next = 3;
11189
- return Builder(destApi).from(destNode).to(originNode).currency(currencySymbol).amount(amount).address(address).build();
12382
+ return Builder(destApi).from(destNode).to(originNode).currency({
12383
+ symbol: currencySymbol
12384
+ }).amount(amount).address(address).build();
11190
12385
  case 3:
11191
12386
  return _context.abrupt("return", _context.sent);
11192
12387
  case 4:
@@ -11216,6 +12411,7 @@ var createTx = function createTx(originApi, destApi, address, amount, currencySy
11216
12411
  }, _callee);
11217
12412
  }));
11218
12413
  };
12414
+
11219
12415
  var checkKeepAlive = function checkKeepAlive(_a) {
11220
12416
  return __awaiter(void 0, [_a], void 0, function (_ref) {
11221
12417
  var originApi = _ref.originApi,
@@ -11225,66 +12421,66 @@ var checkKeepAlive = function checkKeepAlive(_a) {
11225
12421
  destApi = _ref.destApi,
11226
12422
  currencySymbol = _ref.currencySymbol,
11227
12423
  destNode = _ref.destNode;
11228
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
12424
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11229
12425
  var _yield$destApi$query$, data, balance, _yield$originApi$quer, originData, balanceOrigin, amountBN, ed, edOrigin, tx, xcmFee, amountBNWithoutFee, amountOriginBNWithoutFee;
11230
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11231
- while (1) switch (_context2.prev = _context2.next) {
12426
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12427
+ while (1) switch (_context.prev = _context.next) {
11232
12428
  case 0:
11233
12429
  if (!(destApi === undefined)) {
11234
- _context2.next = 2;
12430
+ _context.next = 2;
11235
12431
  break;
11236
12432
  }
11237
- return _context2.abrupt("return");
12433
+ return _context.abrupt("return");
11238
12434
  case 2:
11239
12435
  if (!(currencySymbol === undefined)) {
11240
- _context2.next = 4;
12436
+ _context.next = 4;
11241
12437
  break;
11242
12438
  }
11243
12439
  throw new KeepAliveError('Currency symbol not found for this asset. Cannot check keep alive.');
11244
12440
  case 4:
11245
12441
  if (!(originNode !== undefined && destNode !== undefined && currencySymbol !== getAssetsObject(destNode).nativeAssetSymbol)) {
11246
- _context2.next = 6;
12442
+ _context.next = 6;
11247
12443
  break;
11248
12444
  }
11249
12445
  throw new KeepAliveError('Keep alive check is only supported when sending native asset of destination parachain.');
11250
12446
  case 6:
11251
- _context2.next = 8;
12447
+ _context.next = 8;
11252
12448
  return destApi.query.system.account(address);
11253
12449
  case 8:
11254
- _yield$destApi$query$ = _context2.sent;
12450
+ _yield$destApi$query$ = _context.sent;
11255
12451
  data = _yield$destApi$query$.data;
11256
12452
  balance = data.free.toBn();
11257
- _context2.next = 13;
12453
+ _context.next = 13;
11258
12454
  return originApi.query.system.account(address);
11259
12455
  case 13:
11260
- _yield$originApi$quer = _context2.sent;
12456
+ _yield$originApi$quer = _context.sent;
11261
12457
  originData = _yield$originApi$quer.data;
11262
12458
  balanceOrigin = originData.free.toBn();
11263
12459
  amountBN = new BN(amount);
11264
- ed = getExistentialDeposit(destNode !== null && destNode !== void 0 ? destNode : determineRelayChain(originNode));
11265
- edOrigin = getExistentialDeposit(originNode !== null && originNode !== void 0 ? originNode : determineRelayChain(destNode));
11266
- _context2.next = 21;
12460
+ ed = getExistentialDeposit$1(destNode !== null && destNode !== void 0 ? destNode : determineRelayChain(originNode));
12461
+ edOrigin = getExistentialDeposit$1(originNode !== null && originNode !== void 0 ? originNode : determineRelayChain(destNode));
12462
+ _context.next = 21;
11267
12463
  return createTx(originApi, destApi, address, amount, currencySymbol, originNode, destNode);
11268
12464
  case 21:
11269
- tx = _context2.sent;
12465
+ tx = _context.sent;
11270
12466
  if (!(tx === null)) {
11271
- _context2.next = 24;
12467
+ _context.next = 24;
11272
12468
  break;
11273
12469
  }
11274
12470
  throw new KeepAliveError('Transaction for XCM fee calculation could not be created.');
11275
12471
  case 24:
11276
- _context2.next = 26;
11277
- return calculateTransactionFee$1(tx, address);
12472
+ _context.next = 26;
12473
+ return calculateTransactionFee(tx, address);
11278
12474
  case 26:
11279
- xcmFee = _context2.sent;
12475
+ xcmFee = _context.sent;
11280
12476
  if (!(ed === null)) {
11281
- _context2.next = 29;
12477
+ _context.next = 29;
11282
12478
  break;
11283
12479
  }
11284
12480
  throw new KeepAliveError('Existential deposit not found for destination parachain.');
11285
12481
  case 29:
11286
12482
  if (!(edOrigin === null)) {
11287
- _context2.next = 31;
12483
+ _context.next = 31;
11288
12484
  break;
11289
12485
  }
11290
12486
  throw new KeepAliveError('Existential deposit not found for origin parachain.');
@@ -11300,97 +12496,77 @@ var checkKeepAlive = function checkKeepAlive(_a) {
11300
12496
  console.log('ORIGIN BALANCE - AMOUNT WITH FEE: ', balanceOrigin.sub(amountBN.sub(xcmFee.mul(new BN(1.5)))).toString());
11301
12497
  amountBNWithoutFee = amountBN.sub(xcmFee.mul(new BN(1.5)));
11302
12498
  if (!balance.add(amountBNWithoutFee).lt(new BN(ed))) {
11303
- _context2.next = 43;
12499
+ _context.next = 43;
11304
12500
  break;
11305
12501
  }
11306
- throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit.\n Please increase the amount to meet the minimum balance requirement of the destination chain."));
12502
+ throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit.\n Please increase the amount to meet the minimum balance requirement of the destination chain."));
11307
12503
  case 43:
11308
12504
  amountOriginBNWithoutFee = amountBN.sub(xcmFee.mul(new BN(1.5)));
11309
12505
  if (!((currencySymbol === 'DOT' || currencySymbol === 'KSM') && balanceOrigin.sub(amountOriginBNWithoutFee).lt(new BN(edOrigin)))) {
11310
- _context2.next = 46;
12506
+ _context.next = 46;
11311
12507
  break;
11312
12508
  }
11313
- throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit on origin.\n Please decrease the amount to meet the minimum balance requirement of the origin chain."));
12509
+ throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit on origin.\n Please decrease the amount to meet the minimum balance requirement of the origin chain."));
11314
12510
  case 46:
11315
12511
  case "end":
11316
- return _context2.stop();
12512
+ return _context.stop();
11317
12513
  }
11318
- }, _callee2);
12514
+ }, _callee);
11319
12515
  })();
11320
12516
  });
11321
12517
  };
11322
12518
 
11323
- var transformOptions = function transformOptions(options) {
11324
- var currency = options.currency;
11325
- if (isTCurrencySpecifier(currency)) {
11326
- if ('symbol' in currency) {
11327
- return Object.assign(Object.assign({}, options), {
11328
- currency: currency.symbol,
11329
- isSymbol: true
11330
- });
11331
- } else if ('id' in currency) {
11332
- return Object.assign(Object.assign({}, options), {
11333
- currency: currency.id,
11334
- isSymbol: false
11335
- });
11336
- }
11337
- }
11338
- return Object.assign(Object.assign({}, options), {
11339
- currency: currency,
11340
- isSymbol: undefined
11341
- });
11342
- };
11343
12519
  var sendCommon = function sendCommon(options) {
11344
12520
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11345
- var _a, _b, _transformOptions, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, isSymbol, _transformOptions$ser, serializedApiCallEnabled, isMultiLocationDestination, isMultiLocationCurrency, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, asset, apiWithFallback, amountStr, currencyStr;
12521
+ var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, _options$serializedAp, serializedApiCallEnabled, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, asset, apiWithFallback, amountStr, currencyStr;
11346
12522
  return _regeneratorRuntime().wrap(function _callee$(_context) {
11347
12523
  while (1) switch (_context.prev = _context.next) {
11348
12524
  case 0:
11349
- _transformOptions = transformOptions(options), api = _transformOptions.api, origin = _transformOptions.origin, currency = _transformOptions.currency, amount = _transformOptions.amount, address = _transformOptions.address, destination = _transformOptions.destination, paraIdTo = _transformOptions.paraIdTo, destApiForKeepAlive = _transformOptions.destApiForKeepAlive, feeAsset = _transformOptions.feeAsset, version = _transformOptions.version, isSymbol = _transformOptions.isSymbol, _transformOptions$ser = _transformOptions.serializedApiCallEnabled, serializedApiCallEnabled = _transformOptions$ser === void 0 ? false : _transformOptions$ser;
11350
- if (!((!isTMulti(currency) || isTMultiLocation(currency)) && amount === null)) {
12525
+ api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, version = options.version, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
12526
+ if (!((!('multiasset' in currency) || 'multilocation' in currency) && amount === null)) {
11351
12527
  _context.next = 3;
11352
12528
  break;
11353
12529
  }
11354
12530
  throw new Error('Amount is required');
11355
12531
  case 3:
11356
- if (!(typeof currency === 'number' && currency > Number.MAX_SAFE_INTEGER)) {
12532
+ if (!('id' in currency && typeof currency === 'number' && currency > Number.MAX_SAFE_INTEGER)) {
11357
12533
  _context.next = 5;
11358
12534
  break;
11359
12535
  }
11360
12536
  throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
11361
12537
  case 5:
11362
- if (!(isTMultiLocation(currency) && (feeAsset === 0 || feeAsset !== undefined))) {
12538
+ if (!('multilocation' in currency && (feeAsset === 0 || feeAsset !== undefined))) {
11363
12539
  _context.next = 7;
11364
12540
  break;
11365
12541
  }
11366
12542
  throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
11367
12543
  case 7:
11368
- if (!(isTMulti(currency) && Array.isArray(currency))) {
12544
+ if (!('multiasset' in currency)) {
11369
12545
  _context.next = 17;
11370
12546
  break;
11371
12547
  }
11372
12548
  if (amount !== null) {
11373
12549
  console.warn('Amount is ignored when using overriding currency using multiple multi locations. Please set it to null.');
11374
12550
  }
11375
- if (!(currency.length === 0)) {
12551
+ if (!(currency.multiasset.length === 0)) {
11376
12552
  _context.next = 11;
11377
12553
  break;
11378
12554
  }
11379
12555
  throw new InvalidCurrencyError('Overrided multi assets cannot be empty');
11380
12556
  case 11:
11381
- if (!(currency.length === 1 && (feeAsset === 0 || feeAsset !== undefined))) {
12557
+ if (!(currency.multiasset.length === 1 && (feeAsset === 0 || feeAsset !== undefined))) {
11382
12558
  _context.next = 13;
11383
12559
  break;
11384
12560
  }
11385
12561
  throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
11386
12562
  case 13:
11387
- if (!(currency.length > 1 && feeAsset === undefined)) {
12563
+ if (!(currency.multiasset.length > 1 && feeAsset === undefined)) {
11388
12564
  _context.next = 15;
11389
12565
  break;
11390
12566
  }
11391
12567
  throw new InvalidCurrencyError('Overrided multi assets cannot be used without specifying fee asset');
11392
12568
  case 15:
11393
- if (!(currency.length > 1 && feeAsset !== undefined && (feeAsset < 0 || feeAsset >= currency.length))) {
12569
+ if (!(currency.multiasset.length > 1 && feeAsset !== undefined && (feeAsset < 0 || feeAsset >= currency.multiasset.length))) {
11394
12570
  _context.next = 17;
11395
12571
  break;
11396
12572
  }
@@ -11403,95 +12579,94 @@ var sendCommon = function sendCommon(options) {
11403
12579
  throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot.');
11404
12580
  case 19:
11405
12581
  isMultiLocationDestination = _typeof(destination) === 'object';
11406
- isMultiLocationCurrency = _typeof(currency) === 'object';
11407
12582
  isBridge = origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
11408
12583
  isRelayDestination = destination === undefined;
11409
12584
  if (!(!isRelayDestination && !isMultiLocationDestination)) {
11410
- _context.next = 28;
12585
+ _context.next = 27;
11411
12586
  break;
11412
12587
  }
11413
12588
  originRelayChainSymbol = getRelayChainSymbol(origin);
11414
12589
  destinationRelayChainSymbol = getRelayChainSymbol(destination);
11415
12590
  if (!(!isBridge && originRelayChainSymbol !== destinationRelayChainSymbol)) {
11416
- _context.next = 28;
12591
+ _context.next = 27;
11417
12592
  break;
11418
12593
  }
11419
12594
  throw new IncompatibleNodesError();
11420
- case 28:
12595
+ case 27:
11421
12596
  originNode = getNode(origin);
11422
- assetCheckEnabled = isMultiLocationCurrency || isBridge ? false : originNode.assetCheckEnabled;
11423
- asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isSymbol, isTMultiLocation(destination) ? undefined : destination) : null;
12597
+ assetCheckEnabled = 'multilocation' in currency || 'multiasset' in currency || isBridge ? false : originNode.assetCheckEnabled;
12598
+ asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isTMultiLocation(destination) ? undefined : destination) : null;
11424
12599
  if (!(!isBridge && asset === null && assetCheckEnabled)) {
11425
- _context.next = 33;
12600
+ _context.next = 32;
11426
12601
  break;
11427
12602
  }
11428
- throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
11429
- case 33:
11430
- if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && isSymbol !== false && asset.assetId !== currency && !hasSupportForAsset(destination, asset.symbol))) {
11431
- _context.next = 35;
12603
+ throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency), "."));
12604
+ case 32:
12605
+ if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol))) {
12606
+ _context.next = 34;
11432
12607
  break;
11433
12608
  }
11434
- throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
11435
- case 35:
12609
+ throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
12610
+ case 34:
11436
12611
  if (!(api !== null && api !== void 0)) {
11437
- _context.next = 39;
12612
+ _context.next = 38;
11438
12613
  break;
11439
12614
  }
11440
12615
  _context.t0 = api;
11441
- _context.next = 42;
11442
- break;
11443
- case 39:
11444
12616
  _context.next = 41;
12617
+ break;
12618
+ case 38:
12619
+ _context.next = 40;
11445
12620
  return createApiInstanceForNode(origin);
11446
- case 41:
12621
+ case 40:
11447
12622
  _context.t0 = _context.sent;
11448
- case 42:
12623
+ case 41:
11449
12624
  apiWithFallback = _context.t0;
11450
12625
  amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
11451
- if (!isTMulti(currency)) {
11452
- _context.next = 48;
12626
+ if (!('multilocation' in currency || 'multiasset' in currency)) {
12627
+ _context.next = 47;
11453
12628
  break;
11454
12629
  }
11455
12630
  console.warn('Keep alive check is not supported when using MultiLocation as currency.');
11456
- _context.next = 62;
12631
+ _context.next = 61;
11457
12632
  break;
11458
- case 48:
12633
+ case 47:
11459
12634
  if (!(_typeof(address) === 'object')) {
11460
- _context.next = 52;
12635
+ _context.next = 51;
11461
12636
  break;
11462
12637
  }
11463
12638
  console.warn('Keep alive check is not supported when using MultiLocation as address.');
11464
- _context.next = 62;
12639
+ _context.next = 61;
11465
12640
  break;
11466
- case 52:
12641
+ case 51:
11467
12642
  if (!(_typeof(destination) === 'object')) {
11468
- _context.next = 56;
12643
+ _context.next = 55;
11469
12644
  break;
11470
12645
  }
11471
12646
  console.warn('Keep alive check is not supported when using MultiLocation as destination.');
11472
- _context.next = 62;
12647
+ _context.next = 61;
11473
12648
  break;
11474
- case 56:
12649
+ case 55:
11475
12650
  if (!(origin === 'Ethereum' || destination === 'Ethereum')) {
11476
- _context.next = 60;
12651
+ _context.next = 59;
11477
12652
  break;
11478
12653
  }
11479
12654
  console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
11480
- _context.next = 62;
12655
+ _context.next = 61;
11481
12656
  break;
11482
- case 60:
11483
- _context.next = 62;
12657
+ case 59:
12658
+ _context.next = 61;
11484
12659
  return checkKeepAlive({
11485
12660
  originApi: apiWithFallback,
11486
12661
  address: address,
11487
12662
  amount: amountStr !== null && amountStr !== void 0 ? amountStr : '',
11488
12663
  originNode: origin,
11489
12664
  destApi: destApiForKeepAlive,
11490
- currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : currency.toString(),
12665
+ currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : 'symbol' in currency ? currency.symbol : undefined,
11491
12666
  destNode: destination
11492
12667
  });
11493
- case 62:
11494
- currencyStr = isTMulti(currency) ? undefined : currency.toString();
12668
+ case 61:
12669
+ currencyStr = 'symbol' in currency ? currency.symbol : 'id' in currency ? currency.id.toString() : undefined;
11495
12670
  return _context.abrupt("return", originNode.transfer({
11496
12671
  api: apiWithFallback,
11497
12672
  currencySymbol: (_b = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _b !== void 0 ? _b : currencyStr,
@@ -11500,12 +12675,12 @@ var sendCommon = function sendCommon(options) {
11500
12675
  address: address,
11501
12676
  destination: destination,
11502
12677
  paraIdTo: paraIdTo,
11503
- overridedCurrencyMultiLocation: isTMulti(currency) ? currency : undefined,
12678
+ overridedCurrencyMultiLocation: 'multilocation' in currency ? currency.multilocation : 'multiasset' in currency ? currency.multiasset : undefined,
11504
12679
  feeAsset: feeAsset,
11505
12680
  version: version,
11506
12681
  serializedApiCallEnabled: serializedApiCallEnabled
11507
12682
  }));
11508
- case 64:
12683
+ case 63:
11509
12684
  case "end":
11510
12685
  return _context.stop();
11511
12686
  }
@@ -11517,13 +12692,10 @@ var sendSerializedApiCall = function sendSerializedApiCall(options) {
11517
12692
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11518
12693
  while (1) switch (_context2.prev = _context2.next) {
11519
12694
  case 0:
11520
- _context2.next = 2;
11521
- return sendCommon(Object.assign(Object.assign({}, options), {
12695
+ return _context2.abrupt("return", sendCommon(Object.assign(Object.assign({}, options), {
11522
12696
  serializedApiCallEnabled: true
11523
- }));
11524
- case 2:
11525
- return _context2.abrupt("return", _context2.sent);
11526
- case 3:
12697
+ })));
12698
+ case 1:
11527
12699
  case "end":
11528
12700
  return _context2.stop();
11529
12701
  }
@@ -11535,11 +12707,8 @@ var send = function send(options) {
11535
12707
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11536
12708
  while (1) switch (_context3.prev = _context3.next) {
11537
12709
  case 0:
11538
- _context3.next = 2;
11539
- return sendCommon(options);
11540
- case 2:
11541
- return _context3.abrupt("return", _context3.sent);
11542
- case 3:
12710
+ return _context3.abrupt("return", sendCommon(options));
12711
+ case 1:
11543
12712
  case "end":
11544
12713
  return _context3.stop();
11545
12714
  }
@@ -11548,11 +12717,11 @@ var send = function send(options) {
11548
12717
  };
11549
12718
  var transferRelayToParaCommon = function transferRelayToParaCommon(options) {
11550
12719
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
11551
- var api, destination, amount, address, paraIdTo, destApiForKeepAlive, version, _options$serializedAp, serializedApiCallEnabled, isMultiLocationDestination, isAddressMultiLocation, apiWithFallback, amountStr, serializedApiCall;
12720
+ var api, destination, amount, address, paraIdTo, destApiForKeepAlive, version, _options$serializedAp2, serializedApiCallEnabled, isMultiLocationDestination, isAddressMultiLocation, apiWithFallback, amountStr, serializedApiCall;
11552
12721
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
11553
12722
  while (1) switch (_context4.prev = _context4.next) {
11554
12723
  case 0:
11555
- api = options.api, destination = options.destination, amount = options.amount, address = options.address, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
12724
+ api = options.api, destination = options.destination, amount = options.amount, address = options.address, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, _options$serializedAp2 = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp2 === void 0 ? false : _options$serializedAp2;
11556
12725
  isMultiLocationDestination = _typeof(destination) === 'object';
11557
12726
  isAddressMultiLocation = _typeof(address) === 'object';
11558
12727
  if (!(api === undefined && isMultiLocationDestination)) {
@@ -11638,11 +12807,8 @@ var transferRelayToPara = function transferRelayToPara(options) {
11638
12807
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
11639
12808
  while (1) switch (_context5.prev = _context5.next) {
11640
12809
  case 0:
11641
- _context5.next = 2;
11642
- return transferRelayToParaCommon(options);
11643
- case 2:
11644
- return _context5.abrupt("return", _context5.sent);
11645
- case 3:
12810
+ return _context5.abrupt("return", transferRelayToParaCommon(options));
12811
+ case 1:
11646
12812
  case "end":
11647
12813
  return _context5.stop();
11648
12814
  }
@@ -11654,13 +12820,10 @@ var transferRelayToParaSerializedApiCall = function transferRelayToParaSerialize
11654
12820
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
11655
12821
  while (1) switch (_context6.prev = _context6.next) {
11656
12822
  case 0:
11657
- _context6.next = 2;
11658
- return transferRelayToParaCommon(Object.assign(Object.assign({}, options), {
12823
+ return _context6.abrupt("return", transferRelayToParaCommon(Object.assign(Object.assign({}, options), {
11659
12824
  serializedApiCallEnabled: true
11660
- }));
11661
- case 2:
11662
- return _context6.abrupt("return", _context6.sent);
11663
- case 3:
12825
+ })));
12826
+ case 1:
11664
12827
  case "end":
11665
12828
  return _context6.stop();
11666
12829
  }
@@ -11668,8 +12831,61 @@ var transferRelayToParaSerializedApiCall = function transferRelayToParaSerialize
11668
12831
  }));
11669
12832
  };
11670
12833
 
12834
+ var buildEthTransferOptions = function buildEthTransferOptions(_a) {
12835
+ return __awaiter(void 0, [_a], void 0, function (_ref) {
12836
+ var currency = _ref.currency,
12837
+ to = _ref.to,
12838
+ address = _ref.address,
12839
+ destAddress = _ref.destAddress,
12840
+ amount = _ref.amount;
12841
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12842
+ var ethAsset, env, EXECUTION_URL, context, destParaId, signer, plan;
12843
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12844
+ while (1) switch (_context.prev = _context.next) {
12845
+ case 0:
12846
+ ethAsset = findEthAsset(currency);
12847
+ env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
12848
+ EXECUTION_URL = 'https://eth.llamarpc.com';
12849
+ _context.next = 5;
12850
+ return createContext(EXECUTION_URL, env.config);
12851
+ case 5:
12852
+ context = _context.sent;
12853
+ destParaId = getParaId(to);
12854
+ signer = {
12855
+ getAddress: function getAddress() {
12856
+ return Promise.resolve(address);
12857
+ }
12858
+ };
12859
+ _context.next = 10;
12860
+ return toPolkadot.validateSend(context, signer, destAddress, ethAsset.assetId, destParaId, BigInt(amount), BigInt(0));
12861
+ case 10:
12862
+ plan = _context.sent;
12863
+ checkPlanFailure(plan);
12864
+ if (plan.success) {
12865
+ _context.next = 14;
12866
+ break;
12867
+ }
12868
+ throw new Error('Failed to validate send');
12869
+ case 14:
12870
+ return _context.abrupt("return", {
12871
+ token: plan.success.token,
12872
+ destinationParaId: plan.success.destinationParaId,
12873
+ destinationFee: plan.success.destinationFee,
12874
+ amount: plan.success.amount,
12875
+ fee: plan.success.fee
12876
+ });
12877
+ case 15:
12878
+ case "end":
12879
+ return _context.stop();
12880
+ }
12881
+ }, _callee);
12882
+ })();
12883
+ });
12884
+ };
12885
+
11671
12886
  var index = /*#__PURE__*/Object.freeze({
11672
12887
  __proto__: null,
12888
+ buildEthTransferOptions: buildEthTransferOptions,
11673
12889
  send: send,
11674
12890
  sendSerializedApiCall: sendSerializedApiCall,
11675
12891
  transferRelayToPara: transferRelayToPara,
@@ -11677,4 +12893,4 @@ var index = /*#__PURE__*/Object.freeze({
11677
12893
  transferRelayToParaSerializedApiCall: transferRelayToParaSerializedApiCall
11678
12894
  });
11679
12895
 
11680
- export { Builder, CloseChannelBuilder, DuplicateAssetError, EvmBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, OpenChannelBuilder, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$1 as assets, index$3 as closeChannels, createApiInstanceForNode, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, index$2 as openChannels, index as xcmPallet };
12896
+ export { BatchMode, Builder, DuplicateAssetError, EvmBuilder, GeneralBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$1 as assets, buildEthTransferOptions, createApiInstanceForNode, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit$1 as getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index as xcmPallet };