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