@paraspell/sdk 5.10.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.
package/dist/index.mjs CHANGED
@@ -2261,6 +2261,10 @@ var AssetHubPolkadot$3 = {
2261
2261
  {
2262
2262
  symbol: "DOT",
2263
2263
  decimals: 10
2264
+ },
2265
+ {
2266
+ symbol: "KSM",
2267
+ decimals: 12
2264
2268
  }
2265
2269
  ],
2266
2270
  otherAssets: [
@@ -2279,6 +2283,11 @@ var AssetHubPolkadot$3 = {
2279
2283
  symbol: "TOM",
2280
2284
  decimals: 10
2281
2285
  },
2286
+ {
2287
+ assetId: "22222087",
2288
+ symbol: "KAIBYO",
2289
+ decimals: 12
2290
+ },
2282
2291
  {
2283
2292
  assetId: "20090142",
2284
2293
  symbol: "ELONA",
@@ -2394,6 +2403,11 @@ var AssetHubPolkadot$3 = {
2394
2403
  symbol: "COKE",
2395
2404
  decimals: 12
2396
2405
  },
2406
+ {
2407
+ assetId: "22222079",
2408
+ symbol: "GR",
2409
+ decimals: 12
2410
+ },
2397
2411
  {
2398
2412
  assetId: "20090110",
2399
2413
  symbol: "test1",
@@ -2439,6 +2453,11 @@ var AssetHubPolkadot$3 = {
2439
2453
  symbol: "USDT",
2440
2454
  decimals: 16
2441
2455
  },
2456
+ {
2457
+ assetId: "22222084",
2458
+ symbol: "SOPHIA",
2459
+ decimals: 12
2460
+ },
2442
2461
  {
2443
2462
  assetId: "22222008",
2444
2463
  symbol: "ALIEN",
@@ -2709,6 +2728,11 @@ var AssetHubPolkadot$3 = {
2709
2728
  symbol: "china",
2710
2729
  decimals: 12
2711
2730
  },
2731
+ {
2732
+ assetId: "696969",
2733
+ symbol: "BRO",
2734
+ decimals: 18
2735
+ },
2712
2736
  {
2713
2737
  assetId: "14",
2714
2738
  symbol: "LEAP",
@@ -2954,6 +2978,16 @@ var AssetHubPolkadot$3 = {
2954
2978
  symbol: "PMATIC",
2955
2979
  decimals: 10
2956
2980
  },
2981
+ {
2982
+ assetId: "3164",
2983
+ symbol: "TTT",
2984
+ decimals: 3
2985
+ },
2986
+ {
2987
+ assetId: "1828",
2988
+ symbol: "CPLS",
2989
+ decimals: 10
2990
+ },
2957
2991
  {
2958
2992
  assetId: "20090116",
2959
2993
  symbol: "POO",
@@ -2969,6 +3003,11 @@ var AssetHubPolkadot$3 = {
2969
3003
  symbol: "GIT",
2970
3004
  decimals: 12
2971
3005
  },
3006
+ {
3007
+ assetId: "1810",
3008
+ symbol: "TSTD",
3009
+ decimals: 6
3010
+ },
2972
3011
  {
2973
3012
  assetId: "20090129",
2974
3013
  symbol: "FCD",
@@ -2999,11 +3038,6 @@ var AssetHubPolkadot$3 = {
2999
3038
  symbol: "HTG",
3000
3039
  decimals: 10
3001
3040
  },
3002
- {
3003
- assetId: "12746",
3004
- symbol: "TTTT",
3005
- decimals: 6
3006
- },
3007
3041
  {
3008
3042
  assetId: "32",
3009
3043
  symbol: "CLAY",
@@ -3075,9 +3109,9 @@ var AssetHubPolkadot$3 = {
3075
3109
  decimals: 9
3076
3110
  },
3077
3111
  {
3078
- assetId: "1994",
3079
- symbol: "CRT",
3080
- decimals: 4
3112
+ assetId: "5361",
3113
+ symbol: "NAT",
3114
+ decimals: 10
3081
3115
  },
3082
3116
  {
3083
3117
  assetId: "2829",
@@ -3199,6 +3233,11 @@ var AssetHubPolkadot$3 = {
3199
3233
  symbol: "DOTC",
3200
3234
  decimals: 10
3201
3235
  },
3236
+ {
3237
+ assetId: "22222082",
3238
+ symbol: "Ax",
3239
+ decimals: 12
3240
+ },
3202
3241
  {
3203
3242
  assetId: "20090103",
3204
3243
  symbol: "BTC",
@@ -3209,6 +3248,11 @@ var AssetHubPolkadot$3 = {
3209
3248
  symbol: "NOTDED",
3210
3249
  decimals: 10
3211
3250
  },
3251
+ {
3252
+ assetId: "22222085",
3253
+ symbol: "ANU",
3254
+ decimals: 12
3255
+ },
3212
3256
  {
3213
3257
  assetId: "20090124",
3214
3258
  symbol: "test1",
@@ -3299,6 +3343,11 @@ var AssetHubPolkadot$3 = {
3299
3343
  symbol: "LURPIS",
3300
3344
  decimals: 12
3301
3345
  },
3346
+ {
3347
+ assetId: "22222088",
3348
+ symbol: "KOYM",
3349
+ decimals: 12
3350
+ },
3302
3351
  {
3303
3352
  assetId: "22222066",
3304
3353
  symbol: "DUW",
@@ -3394,6 +3443,11 @@ var AssetHubPolkadot$3 = {
3394
3443
  symbol: "HYDRA",
3395
3444
  decimals: 10
3396
3445
  },
3446
+ {
3447
+ assetId: "22222080",
3448
+ symbol: "GREEN",
3449
+ decimals: 12
3450
+ },
3397
3451
  {
3398
3452
  assetId: "22222057",
3399
3453
  symbol: "DIO",
@@ -3404,6 +3458,11 @@ var AssetHubPolkadot$3 = {
3404
3458
  symbol: "DOGE",
3405
3459
  decimals: 6
3406
3460
  },
3461
+ {
3462
+ assetId: "8277",
3463
+ symbol: "KH5usdt",
3464
+ decimals: 20
3465
+ },
3407
3466
  {
3408
3467
  assetId: "59",
3409
3468
  symbol: "OK",
@@ -3414,6 +3473,11 @@ var AssetHubPolkadot$3 = {
3414
3473
  symbol: "HOOT",
3415
3474
  decimals: 6
3416
3475
  },
3476
+ {
3477
+ assetId: "22222083",
3478
+ symbol: "TAG",
3479
+ decimals: 12
3480
+ },
3417
3481
  {
3418
3482
  assetId: "20090125",
3419
3483
  symbol: "PP",
@@ -3429,11 +3493,6 @@ var AssetHubPolkadot$3 = {
3429
3493
  symbol: "NaCl",
3430
3494
  decimals: 12
3431
3495
  },
3432
- {
3433
- assetId: "2567",
3434
- symbol: "TSTRM",
3435
- decimals: 6
3436
- },
3437
3496
  {
3438
3497
  assetId: "51",
3439
3498
  symbol: "JAMA",
@@ -3494,6 +3553,11 @@ var AssetHubPolkadot$3 = {
3494
3553
  symbol: "PIGS",
3495
3554
  decimals: 12
3496
3555
  },
3556
+ {
3557
+ assetId: "22222086",
3558
+ symbol: "BIFF",
3559
+ decimals: 12
3560
+ },
3497
3561
  {
3498
3562
  assetId: "60",
3499
3563
  symbol: "ANT",
@@ -3631,7 +3695,7 @@ var AssetHubPolkadot$3 = {
3631
3695
  },
3632
3696
  {
3633
3697
  assetId: "112233",
3634
- symbol: "MTA",
3698
+ symbol: "MTC",
3635
3699
  decimals: 10
3636
3700
  },
3637
3701
  {
@@ -3649,6 +3713,11 @@ var AssetHubPolkadot$3 = {
3649
3713
  symbol: "KRAK",
3650
3714
  decimals: 10
3651
3715
  },
3716
+ {
3717
+ assetId: "1148",
3718
+ symbol: "NT2",
3719
+ decimals: 10
3720
+ },
3652
3721
  {
3653
3722
  assetId: "25",
3654
3723
  symbol: "T54",
@@ -3784,6 +3853,11 @@ var AssetHubPolkadot$3 = {
3784
3853
  symbol: "DDOT",
3785
3854
  decimals: 12
3786
3855
  },
3856
+ {
3857
+ assetId: "6594",
3858
+ symbol: "MVPW",
3859
+ decimals: 3
3860
+ },
3787
3861
  {
3788
3862
  assetId: "660301",
3789
3863
  symbol: "GRL",
@@ -3814,6 +3888,11 @@ var AssetHubPolkadot$3 = {
3814
3888
  symbol: "TATE",
3815
3889
  decimals: 12
3816
3890
  },
3891
+ {
3892
+ assetId: "22222081",
3893
+ symbol: "NAR",
3894
+ decimals: 12
3895
+ },
3817
3896
  {
3818
3897
  assetId: "22222011",
3819
3898
  symbol: "PM",
@@ -3864,6 +3943,356 @@ var AssetHubPolkadot$3 = {
3864
3943
  symbol: "PBTC",
3865
3944
  decimals: 10
3866
3945
  }
3946
+ ],
3947
+ multiLocations: [
3948
+ {
3949
+ parents: 1,
3950
+ interior: {
3951
+ x1: {
3952
+ parachain: 2011
3953
+ }
3954
+ }
3955
+ },
3956
+ {
3957
+ parents: 2,
3958
+ interior: {
3959
+ x2: [
3960
+ {
3961
+ globalConsensus: {
3962
+ ethereum: {
3963
+ chainId: 1
3964
+ }
3965
+ }
3966
+ },
3967
+ {
3968
+ accountKey20: {
3969
+ network: null,
3970
+ key: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
3971
+ }
3972
+ }
3973
+ ]
3974
+ }
3975
+ },
3976
+ {
3977
+ parents: 2,
3978
+ interior: {
3979
+ x2: [
3980
+ {
3981
+ globalConsensus: {
3982
+ ethereum: {
3983
+ chainId: 1
3984
+ }
3985
+ }
3986
+ },
3987
+ {
3988
+ accountKey20: {
3989
+ network: null,
3990
+ key: "0x6982508145454ce325ddbe47a25d4ec3d2311933"
3991
+ }
3992
+ }
3993
+ ]
3994
+ }
3995
+ },
3996
+ {
3997
+ parents: 2,
3998
+ interior: {
3999
+ x1: {
4000
+ globalConsensus: {
4001
+ kusama: null
4002
+ }
4003
+ }
4004
+ }
4005
+ },
4006
+ {
4007
+ parents: 1,
4008
+ interior: {
4009
+ x2: [
4010
+ {
4011
+ parachain: 2030
4012
+ },
4013
+ {
4014
+ generalKey: {
4015
+ length: 2,
4016
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
4017
+ }
4018
+ }
4019
+ ]
4020
+ }
4021
+ },
4022
+ {
4023
+ parents: 2,
4024
+ interior: {
4025
+ x2: [
4026
+ {
4027
+ globalConsensus: {
4028
+ ethereum: {
4029
+ chainId: 1
4030
+ }
4031
+ }
4032
+ },
4033
+ {
4034
+ accountKey20: {
4035
+ network: null,
4036
+ key: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
4037
+ }
4038
+ }
4039
+ ]
4040
+ }
4041
+ },
4042
+ {
4043
+ parents: 2,
4044
+ interior: {
4045
+ x2: [
4046
+ {
4047
+ globalConsensus: {
4048
+ ethereum: {
4049
+ chainId: 1
4050
+ }
4051
+ }
4052
+ },
4053
+ {
4054
+ accountKey20: {
4055
+ network: null,
4056
+ key: "0xba41ddf06b7ffd89d1267b5a93bfef2424eb2003"
4057
+ }
4058
+ }
4059
+ ]
4060
+ }
4061
+ },
4062
+ {
4063
+ parents: 2,
4064
+ interior: {
4065
+ x2: [
4066
+ {
4067
+ globalConsensus: {
4068
+ ethereum: {
4069
+ chainId: 1
4070
+ }
4071
+ }
4072
+ },
4073
+ {
4074
+ accountKey20: {
4075
+ network: null,
4076
+ key: "0x18084fba666a33d37592fa2633fd49a74dd93a88"
4077
+ }
4078
+ }
4079
+ ]
4080
+ }
4081
+ },
4082
+ {
4083
+ parents: 2,
4084
+ interior: {
4085
+ x2: [
4086
+ {
4087
+ globalConsensus: {
4088
+ ethereum: {
4089
+ chainId: 1
4090
+ }
4091
+ }
4092
+ },
4093
+ {
4094
+ accountKey20: {
4095
+ network: null,
4096
+ key: "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0"
4097
+ }
4098
+ }
4099
+ ]
4100
+ }
4101
+ },
4102
+ {
4103
+ parents: 2,
4104
+ interior: {
4105
+ x2: [
4106
+ {
4107
+ globalConsensus: {
4108
+ ethereum: {
4109
+ chainId: 1
4110
+ }
4111
+ }
4112
+ },
4113
+ {
4114
+ accountKey20: {
4115
+ network: null,
4116
+ key: "0x582d872a1b094fc48f5de31d3b73f2d9be47def1"
4117
+ }
4118
+ }
4119
+ ]
4120
+ }
4121
+ },
4122
+ {
4123
+ parents: 2,
4124
+ interior: {
4125
+ x2: [
4126
+ {
4127
+ globalConsensus: {
4128
+ ethereum: {
4129
+ chainId: 1
4130
+ }
4131
+ }
4132
+ },
4133
+ {
4134
+ accountKey20: {
4135
+ network: null,
4136
+ key: "0x6b175474e89094c44da98b954eedeac495271d0f"
4137
+ }
4138
+ }
4139
+ ]
4140
+ }
4141
+ },
4142
+ {
4143
+ parents: 2,
4144
+ interior: {
4145
+ x2: [
4146
+ {
4147
+ globalConsensus: {
4148
+ ethereum: {
4149
+ chainId: 1
4150
+ }
4151
+ }
4152
+ },
4153
+ {
4154
+ accountKey20: {
4155
+ network: null,
4156
+ key: "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce"
4157
+ }
4158
+ }
4159
+ ]
4160
+ }
4161
+ },
4162
+ {
4163
+ parents: 1,
4164
+ interior: {
4165
+ x2: [
4166
+ {
4167
+ parachain: 2011
4168
+ },
4169
+ {
4170
+ generalKey: {
4171
+ length: 3,
4172
+ data: "0x6571640000000000000000000000000000000000000000000000000000000000"
4173
+ }
4174
+ }
4175
+ ]
4176
+ }
4177
+ },
4178
+ {
4179
+ parents: 2,
4180
+ interior: {
4181
+ x2: [
4182
+ {
4183
+ globalConsensus: {
4184
+ ethereum: {
4185
+ chainId: 1
4186
+ }
4187
+ }
4188
+ },
4189
+ {
4190
+ accountKey20: {
4191
+ network: null,
4192
+ key: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
4193
+ }
4194
+ }
4195
+ ]
4196
+ }
4197
+ },
4198
+ {
4199
+ parents: 1,
4200
+ interior: {
4201
+ x2: [
4202
+ {
4203
+ parachain: 2004
4204
+ },
4205
+ {
4206
+ palletInstance: 10
4207
+ }
4208
+ ]
4209
+ }
4210
+ },
4211
+ {
4212
+ parents: 1,
4213
+ interior: {
4214
+ x1: {
4215
+ parachain: 3369
4216
+ }
4217
+ }
4218
+ },
4219
+ {
4220
+ parents: 1,
4221
+ interior: {
4222
+ x2: [
4223
+ {
4224
+ parachain: 2030
4225
+ },
4226
+ {
4227
+ generalKey: {
4228
+ length: 2,
4229
+ data: "0x0900000000000000000000000000000000000000000000000000000000000000"
4230
+ }
4231
+ }
4232
+ ]
4233
+ }
4234
+ },
4235
+ {
4236
+ parents: 2,
4237
+ interior: {
4238
+ x2: [
4239
+ {
4240
+ globalConsensus: {
4241
+ ethereum: {
4242
+ chainId: 1
4243
+ }
4244
+ }
4245
+ },
4246
+ {
4247
+ accountKey20: {
4248
+ network: null,
4249
+ key: "0x8daebade922df735c38c80c7ebd708af50815faa"
4250
+ }
4251
+ }
4252
+ ]
4253
+ }
4254
+ },
4255
+ {
4256
+ parents: 1,
4257
+ interior: {
4258
+ x2: [
4259
+ {
4260
+ parachain: 2034
4261
+ },
4262
+ {
4263
+ generalIndex: 0
4264
+ }
4265
+ ]
4266
+ }
4267
+ },
4268
+ {
4269
+ parents: 2,
4270
+ interior: {
4271
+ x2: [
4272
+ {
4273
+ globalConsensus: {
4274
+ ethereum: {
4275
+ chainId: 1
4276
+ }
4277
+ }
4278
+ },
4279
+ {
4280
+ accountKey20: {
4281
+ network: null,
4282
+ key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
4283
+ }
4284
+ }
4285
+ ]
4286
+ }
4287
+ },
4288
+ {
4289
+ parents: 1,
4290
+ interior: {
4291
+ x1: {
4292
+ parachain: 2051
4293
+ }
4294
+ }
4295
+ }
3867
4296
  ]
3868
4297
  };
3869
4298
  var Altair$3 = {
@@ -5523,6 +5952,10 @@ var AssetHubKusama$3 = {
5523
5952
  {
5524
5953
  symbol: "KSM",
5525
5954
  decimals: 12
5955
+ },
5956
+ {
5957
+ symbol: "DOT",
5958
+ decimals: 10
5526
5959
  }
5527
5960
  ],
5528
5961
  otherAssets: [
@@ -6421,6 +6854,60 @@ var AssetHubKusama$3 = {
6421
6854
  symbol: "RUEPP",
6422
6855
  decimals: 10
6423
6856
  }
6857
+ ],
6858
+ multiLocations: [
6859
+ {
6860
+ parents: 2,
6861
+ interior: {
6862
+ x1: {
6863
+ globalConsensus: {
6864
+ polkadot: null
6865
+ }
6866
+ }
6867
+ }
6868
+ },
6869
+ {
6870
+ parents: 1,
6871
+ interior: {
6872
+ x2: [
6873
+ {
6874
+ parachain: 2125
6875
+ },
6876
+ {
6877
+ generalIndex: 0
6878
+ }
6879
+ ]
6880
+ }
6881
+ },
6882
+ {
6883
+ parents: 1,
6884
+ interior: {
6885
+ x1: {
6886
+ parachain: 2123
6887
+ }
6888
+ }
6889
+ },
6890
+ {
6891
+ parents: 1,
6892
+ interior: {
6893
+ x2: [
6894
+ {
6895
+ parachain: 2023
6896
+ },
6897
+ {
6898
+ palletInstance: 10
6899
+ }
6900
+ ]
6901
+ }
6902
+ },
6903
+ {
6904
+ parents: 1,
6905
+ interior: {
6906
+ x1: {
6907
+ parachain: 2015
6908
+ }
6909
+ }
6910
+ }
6424
6911
  ]
6425
6912
  };
6426
6913
  var CoretimeKusama$3 = {
@@ -6436,6 +6923,21 @@ var CoretimeKusama$3 = {
6436
6923
  otherAssets: [
6437
6924
  ]
6438
6925
  };
6926
+ var CoretimePolkadot$3 = {
6927
+ paraId: 1005,
6928
+ relayChainAssetSymbol: "DOT",
6929
+ nativeAssetSymbol: "DOT",
6930
+ nativeAssets: [
6931
+ {
6932
+ symbol: "DOT",
6933
+ decimals: 10
6934
+ }
6935
+ ],
6936
+ otherAssets: [
6937
+ ],
6938
+ multiLocations: [
6939
+ ]
6940
+ };
6439
6941
  var Turing$3 = {
6440
6942
  paraId: 2114,
6441
6943
  relayChainAssetSymbol: "KSM",
@@ -7226,6 +7728,7 @@ var assets = {
7226
7728
  Shiden: Shiden$3,
7227
7729
  AssetHubKusama: AssetHubKusama$3,
7228
7730
  CoretimeKusama: CoretimeKusama$3,
7731
+ CoretimePolkadot: CoretimePolkadot$3,
7229
7732
  Turing: Turing$3,
7230
7733
  Unique: Unique$3,
7231
7734
  Crust: Crust$3,
@@ -7263,6 +7766,7 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
7263
7766
  Collectives: Collectives$3,
7264
7767
  ComposableFinance: ComposableFinance$3,
7265
7768
  CoretimeKusama: CoretimeKusama$3,
7769
+ CoretimePolkadot: CoretimePolkadot$3,
7266
7770
  Crab: Crab$3,
7267
7771
  Crust: Crust$3,
7268
7772
  CrustShadow: CrustShadow$3,
@@ -7370,409 +7874,66 @@ var DuplicateAssetError = /*#__PURE__*/function (_Error) {
7370
7874
  return _createClass(DuplicateAssetError);
7371
7875
  }(/*#__PURE__*/_wrapNativeSuper(Error));
7372
7876
 
7373
- var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
7374
- var api = _ref.api,
7375
- destination = _ref.destination,
7376
- address = _ref.address,
7377
- amount = _ref.amount,
7378
- paraIdTo = _ref.paraIdTo;
7379
- var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7380
- var paraId = destination !== undefined && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
7381
- var parameters = [createPolkadotXcmHeader('RelayToPara', version, destination, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpec(amount, version, Parents.ZERO), 0];
7382
- if (includeFee) {
7383
- parameters.push('Unlimited');
7384
- }
7385
- return parameters;
7877
+ var AssetHubPolkadot$2 = {
7878
+ defaultPallet: "PolkadotXcm",
7879
+ supportedPallets: [
7880
+ "PolkadotXcm"
7881
+ ]
7386
7882
  };
7387
- var isTMulti = function isTMulti(value) {
7388
- return value && _typeof(value) === 'object' || Array.isArray(value);
7883
+ var Acala$2 = {
7884
+ defaultPallet: "XTokens",
7885
+ supportedPallets: [
7886
+ "PolkadotXcm",
7887
+ "XTokens"
7888
+ ]
7389
7889
  };
7390
- var isTMultiLocation = function isTMultiLocation(value) {
7391
- return value && typeof value.parents !== 'undefined' && typeof value.interior !== 'undefined';
7890
+ var Astar$2 = {
7891
+ defaultPallet: "XTokens",
7892
+ supportedPallets: [
7893
+ "PolkadotXcm",
7894
+ "XTokens"
7895
+ ]
7392
7896
  };
7393
- var isTCurrencySpecifier = function isTCurrencySpecifier(value) {
7394
- if (_typeof(value) !== 'object' || value === null) {
7395
- return false;
7396
- }
7397
- return 'symbol' in value && typeof value.symbol === 'string' || 'id' in value && (typeof value.id === 'string' || typeof value.id === 'number' || typeof value.id === 'bigint');
7897
+ var BifrostPolkadot$2 = {
7898
+ defaultPallet: "XTokens",
7899
+ supportedPallets: [
7900
+ "PolkadotXcm",
7901
+ "XTokens"
7902
+ ]
7398
7903
  };
7399
- var createBridgeCurrencySpec = function createBridgeCurrencySpec(amount, ecosystem) {
7400
- return _defineProperty({}, Version.V4, [{
7401
- id: {
7402
- parents: Parents.TWO,
7403
- interior: {
7404
- X1: [{
7405
- GlobalConsensus: ecosystem
7406
- }]
7407
- }
7408
- },
7409
- fun: {
7410
- Fungible: amount
7411
- }
7412
- }]);
7904
+ var Bitgreen$2 = {
7905
+ defaultPallet: "PolkadotXcm",
7906
+ supportedPallets: [
7907
+ "PolkadotXcm"
7908
+ ]
7413
7909
  };
7414
- var createCurrencySpec = function createCurrencySpec(amount, version, parents, overriddenCurrency) {
7415
- var interior = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'Here';
7416
- if (!overriddenCurrency) {
7417
- return _defineProperty({}, version, [{
7418
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
7419
- id: version === Version.V4 ? {
7420
- parents: parents,
7421
- interior: interior
7422
- } : {
7423
- Concrete: {
7424
- parents: parents,
7425
- interior: interior
7426
- }
7427
- },
7428
- fun: {
7429
- Fungible: amount
7430
- }
7431
- }]);
7432
- }
7433
- return isTMultiLocation(overriddenCurrency) ? _defineProperty({}, version, [{
7434
- id: version === Version.V4 ? overriddenCurrency : {
7435
- Concrete: overriddenCurrency
7436
- },
7437
- fun: {
7438
- Fungible: amount
7439
- }
7440
- }]) : // It must be TMultiAsset if not TMultiLocation
7441
- _defineProperty({}, version, overriddenCurrency);
7910
+ var CoretimeKusama$2 = {
7911
+ defaultPallet: "PolkadotXcm",
7912
+ supportedPallets: [
7913
+ "PolkadotXcm"
7914
+ ]
7442
7915
  };
7443
- var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
7444
- var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
7445
- var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
7446
- Parachain: nodeId
7447
- });
7448
- var isMultiLocationDestination = _typeof(destination) === 'object';
7449
- return _defineProperty({}, version, isMultiLocationDestination ? destination : {
7450
- parents: parentsResolved,
7451
- interior: interior
7452
- });
7916
+ var Centrifuge$2 = {
7917
+ defaultPallet: "XTokens",
7918
+ supportedPallets: [
7919
+ "PolkadotXcm",
7920
+ "XTokens",
7921
+ "OrmlXTokens"
7922
+ ]
7453
7923
  };
7454
- var createBridgePolkadotXcmDest = function createBridgePolkadotXcmDest(version, ecosystem, destination, nodeId) {
7455
- var multiLocation = {
7456
- parents: Parents.TWO,
7457
- interior: {
7458
- X2: [{
7459
- GlobalConsensus: ecosystem
7460
- }, {
7461
- Parachain: nodeId
7462
- }]
7463
- }
7464
- };
7465
- var isMultiLocationDestination = _typeof(destination) === 'object';
7466
- return _defineProperty({}, version, isMultiLocationDestination ? destination : multiLocation);
7924
+ var ComposableFinance$2 = {
7925
+ defaultPallet: "XTokens",
7926
+ supportedPallets: [
7927
+ "PolkadotXcm",
7928
+ "XTokens"
7929
+ ]
7467
7930
  };
7468
- var calculateTransactionFee$1 = function calculateTransactionFee(tx, address) {
7469
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7470
- var _yield$tx$paymentInfo, partialFee;
7471
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7472
- while (1) switch (_context.prev = _context.next) {
7473
- case 0:
7474
- _context.next = 2;
7475
- return tx.paymentInfo(address);
7476
- case 2:
7477
- _yield$tx$paymentInfo = _context.sent;
7478
- partialFee = _yield$tx$paymentInfo.partialFee;
7479
- return _context.abrupt("return", partialFee.toBn());
7480
- case 5:
7481
- case "end":
7482
- return _context.stop();
7483
- }
7484
- }, _callee);
7485
- }));
7486
- };
7487
- // TODO: Refactor this function to eliminate the any type
7488
- var findParachainJunction = function findParachainJunction(multilocation) {
7489
- var interior = multilocation.interior;
7490
- for (var key in interior) {
7491
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
7492
- var junctions = interior[key];
7493
- if (Array.isArray(junctions)) {
7494
- var _iterator = _createForOfIteratorHelper(junctions),
7495
- _step;
7496
- try {
7497
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
7498
- var junction = _step.value;
7499
- if ('Parachain' in junction) {
7500
- return Number(junction.Parachain);
7501
- }
7502
- }
7503
- } catch (err) {
7504
- _iterator.e(err);
7505
- } finally {
7506
- _iterator.f();
7507
- }
7508
- } else if (junctions !== undefined && 'Parachain' in junctions) {
7509
- return Number(junctions.Parachain);
7510
- }
7511
- }
7512
- return null;
7513
- };
7514
- var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(multiLocation) {
7515
- var parachainId = findParachainJunction(multiLocation);
7516
- if (parachainId === null) {
7517
- throw new Error('Parachain ID not found in destination multi location.');
7518
- }
7519
- var node = getTNode(parachainId);
7520
- if (node === null) {
7521
- throw new Error('Node with specified paraId not found in destination multi location.');
7522
- }
7523
- return node;
7524
- };
7525
-
7526
- var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination, isSymbol) {
7527
- if (destination === 'Ethereum') {
7528
- return combinedAssets.find(function (_ref) {
7529
- var assetSymbol = _ref.symbol;
7530
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
7531
- });
7532
- }
7533
- var otherAssetsMatches = otherAssets.filter(function (_ref2) {
7534
- var assetSymbol = _ref2.symbol;
7535
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
7536
- });
7537
- var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
7538
- var assetSymbol = _ref3.symbol;
7539
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
7540
- });
7541
- if (node === 'Astar' || node === 'Shiden') {
7542
- return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
7543
- }
7544
- if (otherAssetsMatches.length > 1 && !isRelayDestination && isSymbol === undefined) {
7545
- throw new DuplicateAssetError(symbol);
7546
- }
7547
- return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
7548
- };
7549
- var findAssetById = function findAssetById(assets, assetId) {
7550
- return assets.find(function (_ref4) {
7551
- var currentAssetId = _ref4.assetId;
7552
- return currentAssetId === assetId;
7553
- });
7554
- };
7555
- var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
7556
- var isRelayDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7557
- var isSymbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
7558
- var destination = arguments.length > 4 ? arguments[4] : undefined;
7559
- if (isTMulti(currency)) {
7560
- return null;
7561
- }
7562
- var currencyString = currency.toString();
7563
- var _getAssetsObject = getAssetsObject(node),
7564
- otherAssets = _getAssetsObject.otherAssets,
7565
- nativeAssets = _getAssetsObject.nativeAssets,
7566
- relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol;
7567
- var combinedAssets = destination === 'Ethereum' ? _toConsumableArray(getOtherAssets('Ethereum')) : [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets));
7568
- var asset;
7569
- if (isSymbol === true) {
7570
- asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, currencyString, isRelayDestination, isSymbol);
7571
- } else if (isSymbol === false) {
7572
- asset = findAssetById(combinedAssets, currencyString);
7573
- } else {
7574
- asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, currencyString, isRelayDestination, isSymbol) || findAssetById(combinedAssets, currencyString);
7575
- }
7576
- if (asset) {
7577
- return asset;
7578
- }
7579
- if (relayChainAssetSymbol.toLowerCase() === currencyString.toLowerCase() && isSymbol !== false) {
7580
- var relayChainAsset = {
7581
- symbol: relayChainAssetSymbol,
7582
- decimals: getAssetDecimals(node, relayChainAssetSymbol)
7583
- };
7584
- return relayChainAsset;
7585
- }
7586
- return null;
7587
- };
7588
-
7589
- var assetsMap = assetsMapJson;
7590
- var getAssetsObject = function getAssetsObject(node) {
7591
- return assetsMap[node];
7592
- };
7593
- var getAssetId = function getAssetId(node, symbol) {
7594
- var info = getAssetsObject(node).otherAssets.find(function (o) {
7595
- return o.symbol === symbol;
7596
- });
7597
- return info != null ? info.assetId : null;
7598
- };
7599
- var getRelayChainSymbol = function getRelayChainSymbol(node) {
7600
- return getAssetsObject(node).relayChainAssetSymbol;
7601
- };
7602
- var getNativeAssets = function getNativeAssets(node) {
7603
- return getAssetsObject(node).nativeAssets;
7604
- };
7605
- var getOtherAssets = function getOtherAssets(node) {
7606
- return getAssetsObject(node).otherAssets;
7607
- };
7608
- var getAssets = function getAssets(node) {
7609
- var _getAssetsObject = getAssetsObject(node),
7610
- nativeAssets = _getAssetsObject.nativeAssets,
7611
- otherAssets = _getAssetsObject.otherAssets;
7612
- var relayChainAsset = getAssetBySymbolOrId(determineRelayChain(node), getRelayChainSymbol(node));
7613
- return [].concat(_toConsumableArray(relayChainAsset ? [relayChainAsset] : []), _toConsumableArray(nativeAssets), _toConsumableArray(otherAssets));
7614
- };
7615
- var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
7616
- var _getAssetsObject2 = getAssetsObject(node),
7617
- relayChainAssetSymbol = _getAssetsObject2.relayChainAssetSymbol,
7618
- nativeAssets = _getAssetsObject2.nativeAssets,
7619
- otherAssets = _getAssetsObject2.otherAssets;
7620
- var nativeAssetsSymbols = nativeAssets.map(function (_ref) {
7621
- var symbol = _ref.symbol;
7622
- return symbol;
7623
- });
7624
- var otherAssetsSymbols = otherAssets.filter(function (asset) {
7625
- return asset.symbol !== undefined;
7626
- }).map(function (_ref2) {
7627
- var symbol = _ref2.symbol;
7628
- return symbol;
7629
- });
7630
- return [relayChainAssetSymbol].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
7631
- };
7632
- var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
7633
- if (node === 'Polkadot') {
7634
- return 'DOT';
7635
- } else if (node === 'Kusama') {
7636
- return 'KSM';
7637
- }
7638
- return getAssetsObject(node).nativeAssetSymbol;
7639
- };
7640
- var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
7641
- return getAllAssetsSymbols(node).map(function (s) {
7642
- return s.toLowerCase();
7643
- }).includes(symbol.toLowerCase());
7644
- };
7645
- var getSupportedAssets = function getSupportedAssets(origin, destination) {
7646
- var originAssets = getAssets(origin);
7647
- var destinationAssets = getAssets(destination);
7648
- if (destination === 'Ethereum' || origin === 'Ethereum') {
7649
- return getOtherAssets('Ethereum');
7650
- }
7651
- if (origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot') {
7652
- var polkadotAsset = getAssetBySymbolOrId('Polkadot', 'DOT');
7653
- var kusamaAsset = getAssetBySymbolOrId('Kusama', 'KSM');
7654
- return [].concat(_toConsumableArray(polkadotAsset ? [polkadotAsset] : []), _toConsumableArray(kusamaAsset ? [kusamaAsset] : []));
7655
- }
7656
- return _toConsumableArray(originAssets.filter(function (asset) {
7657
- return destinationAssets.some(function (a) {
7658
- return a.symbol === asset.symbol;
7659
- });
7660
- }));
7661
- };
7662
- var getAssetDecimals = function getAssetDecimals(node, symbol) {
7663
- var _getAssetsObject3 = getAssetsObject(node),
7664
- otherAssets = _getAssetsObject3.otherAssets,
7665
- nativeAssets = _getAssetsObject3.nativeAssets;
7666
- var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (o) {
7667
- return o.symbol === symbol;
7668
- });
7669
- return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
7670
- };
7671
- var getParaId = function getParaId(node) {
7672
- return getAssetsObject(node).paraId;
7673
- };
7674
- var getTNode = function getTNode(paraId) {
7675
- var _a;
7676
- return (_a = NODE_NAMES.find(function (node) {
7677
- return getParaId(node) === paraId;
7678
- })) !== null && _a !== void 0 ? _a : null;
7679
- };
7680
-
7681
- var getBalanceNative = function getBalanceNative(address, node, api) {
7682
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7683
- var apiWithFallback, _yield$apiWithFallbac, data, balance;
7684
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7685
- while (1) switch (_context.prev = _context.next) {
7686
- case 0:
7687
- if (!(api !== null && api !== void 0)) {
7688
- _context.next = 4;
7689
- break;
7690
- }
7691
- _context.t0 = api;
7692
- _context.next = 7;
7693
- break;
7694
- case 4:
7695
- _context.next = 6;
7696
- return createApiInstanceForNode(node);
7697
- case 6:
7698
- _context.t0 = _context.sent;
7699
- case 7:
7700
- apiWithFallback = _context.t0;
7701
- _context.next = 10;
7702
- return apiWithFallback.query.system.account(address);
7703
- case 10:
7704
- _yield$apiWithFallbac = _context.sent;
7705
- data = _yield$apiWithFallbac.data;
7706
- balance = data.free.toBn();
7707
- return _context.abrupt("return", BigInt(balance.toString()));
7708
- case 14:
7709
- case "end":
7710
- return _context.stop();
7711
- }
7712
- }, _callee);
7713
- }));
7714
- };
7715
-
7716
- var AssetHubPolkadot$2 = {
7717
- defaultPallet: "PolkadotXcm",
7718
- supportedPallets: [
7719
- "PolkadotXcm"
7720
- ]
7721
- };
7722
- var Acala$2 = {
7723
- defaultPallet: "XTokens",
7724
- supportedPallets: [
7725
- "PolkadotXcm",
7726
- "XTokens"
7727
- ]
7728
- };
7729
- var Astar$2 = {
7730
- defaultPallet: "XTokens",
7731
- supportedPallets: [
7732
- "PolkadotXcm",
7733
- "XTokens"
7734
- ]
7735
- };
7736
- var BifrostPolkadot$2 = {
7737
- defaultPallet: "XTokens",
7738
- supportedPallets: [
7739
- "PolkadotXcm",
7740
- "XTokens"
7741
- ]
7742
- };
7743
- var Bitgreen$2 = {
7744
- defaultPallet: "PolkadotXcm",
7745
- supportedPallets: [
7746
- "PolkadotXcm"
7747
- ]
7748
- };
7749
- var CoretimeKusama$2 = {
7750
- defaultPallet: "PolkadotXcm",
7751
- supportedPallets: [
7752
- "PolkadotXcm"
7753
- ]
7754
- };
7755
- var Centrifuge$2 = {
7756
- defaultPallet: "XTokens",
7757
- supportedPallets: [
7758
- "PolkadotXcm",
7759
- "XTokens",
7760
- "OrmlXTokens"
7761
- ]
7762
- };
7763
- var ComposableFinance$2 = {
7764
- defaultPallet: "XTokens",
7765
- supportedPallets: [
7766
- "PolkadotXcm",
7767
- "XTokens"
7768
- ]
7769
- };
7770
- var Darwinia$2 = {
7771
- defaultPallet: "XTokens",
7772
- supportedPallets: [
7773
- "PolkadotXcm",
7774
- "XTokens"
7775
- ]
7931
+ var Darwinia$2 = {
7932
+ defaultPallet: "XTokens",
7933
+ supportedPallets: [
7934
+ "PolkadotXcm",
7935
+ "XTokens"
7936
+ ]
7776
7937
  };
7777
7938
  var Hydration$2 = {
7778
7939
  defaultPallet: "XTokens",
@@ -8093,6 +8254,12 @@ var Peaq$2 = {
8093
8254
  "XTokens"
8094
8255
  ]
8095
8256
  };
8257
+ var CoretimePolkadot$2 = {
8258
+ defaultPallet: "PolkadotXcm",
8259
+ supportedPallets: [
8260
+ "PolkadotXcm"
8261
+ ]
8262
+ };
8096
8263
  var pallets = {
8097
8264
  AssetHubPolkadot: AssetHubPolkadot$2,
8098
8265
  Acala: Acala$2,
@@ -8149,7 +8316,8 @@ var pallets = {
8149
8316
  BridgeHubPolkadot: BridgeHubPolkadot$2,
8150
8317
  BridgeHubKusama: BridgeHubKusama$2,
8151
8318
  Mythos: Mythos$2,
8152
- Peaq: Peaq$2
8319
+ Peaq: Peaq$2,
8320
+ CoretimePolkadot: CoretimePolkadot$2
8153
8321
  };
8154
8322
 
8155
8323
  var palletsMapJson = /*#__PURE__*/Object.freeze({
@@ -8172,6 +8340,7 @@ var palletsMapJson = /*#__PURE__*/Object.freeze({
8172
8340
  Collectives: Collectives$2,
8173
8341
  ComposableFinance: ComposableFinance$2,
8174
8342
  CoretimeKusama: CoretimeKusama$2,
8343
+ CoretimePolkadot: CoretimePolkadot$2,
8175
8344
  Crab: Crab$2,
8176
8345
  Crust: Crust$2,
8177
8346
  CrustShadow: CrustShadow$2,
@@ -8222,178 +8391,165 @@ var getSupportedPallets = function getSupportedPallets(node) {
8222
8391
  return palletsMap$1[node].supportedPallets;
8223
8392
  };
8224
8393
 
8225
- var getBalanceForeignXTokens = function getBalanceForeignXTokens(address, symbolOrId, symbol, id, api) {
8226
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8227
- var response, entry;
8228
- return _regeneratorRuntime().wrap(function _callee$(_context) {
8229
- while (1) switch (_context.prev = _context.next) {
8230
- case 0:
8231
- _context.next = 2;
8232
- return api.query.tokens.accounts.entries(address);
8233
- case 2:
8234
- response = _context.sent;
8235
- entry = response.find(function (_ref) {
8236
- var _ref2 = _slicedToArray(_ref, 2),
8237
- _ref2$0$args = _slicedToArray(_ref2[0].args, 2);
8238
- _ref2$0$args[0];
8239
- var asset = _ref2$0$args[1];
8240
- _ref2[1];
8241
- var _a, _b, _c;
8242
- 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;
8243
- });
8244
- return _context.abrupt("return", entry ? BigInt(entry[1].free.toString()) : null);
8245
- case 5:
8246
- case "end":
8247
- return _context.stop();
8248
- }
8249
- }, _callee);
8250
- }));
8251
- };
8252
- var getAssetHubMultiLocation = function getAssetHubMultiLocation(symbol) {
8253
- if (symbol === 'MYTH') {
8254
- return {
8255
- parents: 1,
8256
- interior: {
8257
- X1: {
8258
- Parachain: '3369'
8259
- }
8260
- }
8261
- };
8262
- } else if (symbol === 'KSM') {
8263
- return {
8264
- parents: 2,
8265
- interior: {
8266
- X1: {
8267
- GlobalConsensus: 'Kusama'
8268
- }
8269
- }
8270
- };
8394
+ // Contains function for getting Asset ID or Symbol used in XCM call creation
8395
+ var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination) {
8396
+ if (destination === 'Ethereum') {
8397
+ return combinedAssets.find(function (_ref) {
8398
+ var assetSymbol = _ref.symbol;
8399
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
8400
+ });
8271
8401
  }
8272
- var ethAssets = getOtherAssets('Ethereum');
8273
- var ethAsset = ethAssets.find(function (asset) {
8274
- return asset.symbol === symbol;
8402
+ var otherAssetsMatches = otherAssets.filter(function (_ref2) {
8403
+ var assetSymbol = _ref2.symbol;
8404
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
8275
8405
  });
8276
- if (ethAsset) {
8277
- return {
8278
- parents: 2,
8279
- interior: {
8280
- X2: [{
8281
- GlobalConsensus: {
8282
- Ethereum: {
8283
- chainId: 1
8284
- }
8285
- }
8286
- }, {
8287
- AccountKey20: {
8288
- network: null,
8289
- key: ethAsset.assetId
8290
- }
8291
- }]
8292
- }
8406
+ var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
8407
+ var assetSymbol = _ref3.symbol;
8408
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
8409
+ });
8410
+ var isPolkadotXcm = !isRelayChain(node) && node !== 'Ethereum' && getDefaultPallet(node) === 'PolkadotXcm';
8411
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
8412
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
8413
+ }
8414
+ if (otherAssetsMatches.length > 1 && !isRelayDestination) {
8415
+ throw new DuplicateAssetError(symbol);
8416
+ }
8417
+ return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
8418
+ };
8419
+
8420
+ var findAssetById = function findAssetById(assets, assetId) {
8421
+ return assets.find(function (_ref) {
8422
+ var currentAssetId = _ref.assetId;
8423
+ return currentAssetId === assetId;
8424
+ });
8425
+ };
8426
+ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
8427
+ var isRelayDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
8428
+ var destination = arguments.length > 3 ? arguments[3] : undefined;
8429
+ if ('multilocation' in currency || 'multiasset' in currency) {
8430
+ return null;
8431
+ }
8432
+ var _getAssetsObject = getAssetsObject(node),
8433
+ otherAssets = _getAssetsObject.otherAssets,
8434
+ nativeAssets = _getAssetsObject.nativeAssets,
8435
+ relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol;
8436
+ var combinedAssets = destination === 'Ethereum' ? _toConsumableArray(getOtherAssets('Ethereum')) : [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets));
8437
+ var asset;
8438
+ if ('symbol' in currency) {
8439
+ asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, currency.symbol, isRelayDestination);
8440
+ } else {
8441
+ asset = findAssetById(combinedAssets, currency.id);
8442
+ }
8443
+ if (asset) {
8444
+ return asset;
8445
+ }
8446
+ if ('symbol' in currency && relayChainAssetSymbol.toLowerCase() === currency.symbol.toLowerCase()) {
8447
+ var relayChainAsset = {
8448
+ symbol: relayChainAssetSymbol,
8449
+ decimals: getAssetDecimals(node, relayChainAssetSymbol)
8293
8450
  };
8451
+ return relayChainAsset;
8294
8452
  }
8295
8453
  return null;
8296
8454
  };
8297
- var getBalanceForeignPolkadotXcm = function getBalanceForeignPolkadotXcm(address, id, api, node, symbol) {
8298
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
8299
- var _response, _obj, multiLocation, _response2, _obj2, parsedId, response, obj;
8300
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
8301
- while (1) switch (_context2.prev = _context2.next) {
8302
- case 0:
8303
- _context2.prev = 0;
8304
- if (!(node === 'Mythos')) {
8305
- _context2.next = 7;
8306
- break;
8307
- }
8308
- _context2.next = 4;
8309
- return api.query.balances.account(address);
8310
- case 4:
8311
- _response = _context2.sent;
8312
- _obj = _response.toJSON();
8313
- return _context2.abrupt("return", BigInt(_obj.free));
8314
- case 7:
8315
- if (!(node === 'AssetHubPolkadot')) {
8316
- _context2.next = 15;
8317
- break;
8318
- }
8319
- multiLocation = getAssetHubMultiLocation(symbol !== null && symbol !== void 0 ? symbol : id);
8320
- if (!multiLocation) {
8321
- _context2.next = 15;
8322
- break;
8323
- }
8324
- _context2.next = 12;
8325
- return api.query.foreignAssets.account(multiLocation, address);
8326
- case 12:
8327
- _response2 = _context2.sent;
8328
- _obj2 = _response2.toJSON();
8329
- return _context2.abrupt("return", BigInt(_obj2 === null ? 0 : _obj2.balance));
8330
- case 15:
8331
- parsedId = new u32(api.registry, id);
8332
- _context2.next = 18;
8333
- return api.query.assets.account(parsedId, address);
8334
- case 18:
8335
- response = _context2.sent;
8336
- obj = response.toJSON();
8337
- return _context2.abrupt("return", BigInt(obj.balance));
8338
- case 23:
8339
- _context2.prev = 23;
8340
- _context2.t0 = _context2["catch"](0);
8341
- console.log('Error while fetching balance', _context2.t0);
8342
- return _context2.abrupt("return", null);
8343
- case 27:
8344
- case "end":
8345
- return _context2.stop();
8346
- }
8347
- }, _callee2, null, [[0, 23]]);
8348
- }));
8455
+
8456
+ var assetsMap = assetsMapJson;
8457
+ var getAssetsObject = function getAssetsObject(node) {
8458
+ return assetsMap[node];
8349
8459
  };
8350
- var getBalanceForeign = function getBalanceForeign(address, node, symbolOrId, api) {
8351
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
8352
- var _a, apiWithFallback, asset;
8353
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
8354
- while (1) switch (_context3.prev = _context3.next) {
8355
- case 0:
8356
- if (!(api !== null && api !== void 0)) {
8357
- _context3.next = 4;
8358
- break;
8359
- }
8360
- _context3.t0 = api;
8361
- _context3.next = 7;
8362
- break;
8363
- case 4:
8364
- _context3.next = 6;
8365
- return createApiInstanceForNode(node);
8366
- case 6:
8367
- _context3.t0 = _context3.sent;
8368
- case 7:
8369
- apiWithFallback = _context3.t0;
8370
- asset = getAssetBySymbolOrId(node, symbolOrId);
8371
- if (!(getDefaultPallet(node) === 'XTokens')) {
8372
- _context3.next = 15;
8373
- break;
8374
- }
8375
- _context3.next = 12;
8376
- return getBalanceForeignXTokens(address, symbolOrId, asset === null || asset === void 0 ? void 0 : asset.symbol, asset === null || asset === void 0 ? void 0 : asset.assetId, apiWithFallback);
8377
- case 12:
8378
- return _context3.abrupt("return", _context3.sent);
8379
- case 15:
8380
- if (!(getDefaultPallet(node) === 'PolkadotXcm')) {
8381
- _context3.next = 19;
8382
- break;
8383
- }
8384
- _context3.next = 18;
8385
- 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);
8386
- case 18:
8387
- return _context3.abrupt("return", _context3.sent);
8388
- case 19:
8389
- throw new Error('Unsupported pallet');
8390
- case 20:
8391
- case "end":
8392
- return _context3.stop();
8393
- }
8394
- }, _callee3);
8460
+ var getAssetId = function getAssetId(node, symbol) {
8461
+ var info = getAssetsObject(node).otherAssets.find(function (o) {
8462
+ return o.symbol === symbol;
8463
+ });
8464
+ return info != null ? info.assetId : null;
8465
+ };
8466
+ var getRelayChainSymbol = function getRelayChainSymbol(node) {
8467
+ return getAssetsObject(node).relayChainAssetSymbol;
8468
+ };
8469
+ var getNativeAssets = function getNativeAssets(node) {
8470
+ return getAssetsObject(node).nativeAssets;
8471
+ };
8472
+ var getOtherAssets = function getOtherAssets(node) {
8473
+ return getAssetsObject(node).otherAssets;
8474
+ };
8475
+ var getAssets = function getAssets(node) {
8476
+ var _getAssetsObject = getAssetsObject(node),
8477
+ nativeAssets = _getAssetsObject.nativeAssets,
8478
+ otherAssets = _getAssetsObject.otherAssets;
8479
+ var relayChainAsset = getAssetBySymbolOrId(determineRelayChain(node), {
8480
+ symbol: getRelayChainSymbol(node)
8481
+ });
8482
+ return [].concat(_toConsumableArray(relayChainAsset ? [relayChainAsset] : []), _toConsumableArray(nativeAssets), _toConsumableArray(otherAssets));
8483
+ };
8484
+ var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
8485
+ var _getAssetsObject2 = getAssetsObject(node),
8486
+ relayChainAssetSymbol = _getAssetsObject2.relayChainAssetSymbol,
8487
+ nativeAssets = _getAssetsObject2.nativeAssets,
8488
+ otherAssets = _getAssetsObject2.otherAssets;
8489
+ var nativeAssetsSymbols = nativeAssets.map(function (_ref) {
8490
+ var symbol = _ref.symbol;
8491
+ return symbol;
8492
+ });
8493
+ var otherAssetsSymbols = otherAssets.filter(function (asset) {
8494
+ return asset.symbol !== undefined;
8495
+ }).map(function (_ref2) {
8496
+ var symbol = _ref2.symbol;
8497
+ return symbol;
8498
+ });
8499
+ return [relayChainAssetSymbol].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
8500
+ };
8501
+ var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
8502
+ if (node === 'Polkadot') {
8503
+ return 'DOT';
8504
+ } else if (node === 'Kusama') {
8505
+ return 'KSM';
8506
+ }
8507
+ return getAssetsObject(node).nativeAssetSymbol;
8508
+ };
8509
+ var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
8510
+ return getAllAssetsSymbols(node).map(function (s) {
8511
+ return s.toLowerCase();
8512
+ }).includes(symbol.toLowerCase());
8513
+ };
8514
+ var getSupportedAssets = function getSupportedAssets(origin, destination) {
8515
+ var originAssets = getAssets(origin);
8516
+ var destinationAssets = getAssets(destination);
8517
+ if (destination === 'Ethereum' || origin === 'Ethereum') {
8518
+ return getOtherAssets('Ethereum');
8519
+ }
8520
+ if (origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot') {
8521
+ var polkadotAsset = getAssetBySymbolOrId('Polkadot', {
8522
+ symbol: 'DOT'
8523
+ });
8524
+ var kusamaAsset = getAssetBySymbolOrId('Kusama', {
8525
+ symbol: 'KSM'
8526
+ });
8527
+ return [].concat(_toConsumableArray(polkadotAsset ? [polkadotAsset] : []), _toConsumableArray(kusamaAsset ? [kusamaAsset] : []));
8528
+ }
8529
+ return _toConsumableArray(originAssets.filter(function (asset) {
8530
+ return destinationAssets.some(function (a) {
8531
+ return a.symbol === asset.symbol;
8532
+ });
8395
8533
  }));
8396
8534
  };
8535
+ var getAssetDecimals = function getAssetDecimals(node, symbol) {
8536
+ var _getAssetsObject3 = getAssetsObject(node),
8537
+ otherAssets = _getAssetsObject3.otherAssets,
8538
+ nativeAssets = _getAssetsObject3.nativeAssets;
8539
+ var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (o) {
8540
+ return o.symbol === symbol;
8541
+ });
8542
+ return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
8543
+ };
8544
+ var getParaId = function getParaId(node) {
8545
+ return getAssetsObject(node).paraId;
8546
+ };
8547
+ var getTNode = function getTNode(paraId) {
8548
+ var _a;
8549
+ return (_a = NODE_NAMES.find(function (node) {
8550
+ return getParaId(node) === paraId;
8551
+ })) !== null && _a !== void 0 ? _a : null;
8552
+ };
8397
8553
 
8398
8554
  var AssetHubPolkadot$1 = "100000000";
8399
8555
  var Acala$1 = "100000000000";
@@ -8453,6 +8609,7 @@ var BridgeHubPolkadot$1 = "1000000000";
8453
8609
  var BridgeHubKusama$1 = "33333333";
8454
8610
  var Mythos$1 = "10000000000000000";
8455
8611
  var Peaq$1 = "500";
8612
+ var CoretimePolkadot$1 = "1000000000";
8456
8613
  var existentialDeposits = {
8457
8614
  AssetHubPolkadot: AssetHubPolkadot$1,
8458
8615
  Acala: Acala$1,
@@ -8511,78 +8668,351 @@ var existentialDeposits = {
8511
8668
  BridgeHubPolkadot: BridgeHubPolkadot$1,
8512
8669
  BridgeHubKusama: BridgeHubKusama$1,
8513
8670
  Mythos: Mythos$1,
8514
- Peaq: Peaq$1
8671
+ Peaq: Peaq$1,
8672
+ CoretimePolkadot: CoretimePolkadot$1
8673
+ };
8674
+
8675
+ var edsMapJson = /*#__PURE__*/Object.freeze({
8676
+ __proto__: null,
8677
+ Acala: Acala$1,
8678
+ Altair: Altair$1,
8679
+ Amplitude: Amplitude$1,
8680
+ AssetHubKusama: AssetHubKusama$1,
8681
+ AssetHubPolkadot: AssetHubPolkadot$1,
8682
+ Astar: Astar$1,
8683
+ Bajun: Bajun$1,
8684
+ Basilisk: Basilisk$1,
8685
+ BifrostKusama: BifrostKusama$1,
8686
+ BifrostPolkadot: BifrostPolkadot$1,
8687
+ Bitgreen: Bitgreen$1,
8688
+ BridgeHubKusama: BridgeHubKusama$1,
8689
+ BridgeHubPolkadot: BridgeHubPolkadot$1,
8690
+ Calamari: Calamari$1,
8691
+ Centrifuge: Centrifuge$1,
8692
+ Collectives: Collectives$1,
8693
+ ComposableFinance: ComposableFinance$1,
8694
+ CoretimeKusama: CoretimeKusama$1,
8695
+ CoretimePolkadot: CoretimePolkadot$1,
8696
+ Crab: Crab$1,
8697
+ Crust: Crust$1,
8698
+ CrustShadow: CrustShadow$1,
8699
+ Curio: Curio$1,
8700
+ Darwinia: Darwinia$1,
8701
+ Encointer: Encointer$1,
8702
+ Hydration: Hydration$1,
8703
+ Imbue: Imbue$1,
8704
+ Integritee: Integritee$1,
8705
+ Interlay: Interlay$1,
8706
+ InvArchTinker: InvArchTinker$1,
8707
+ Karura: Karura$1,
8708
+ Khala: Khala$1,
8709
+ KiltSpiritnet: KiltSpiritnet$1,
8710
+ Kintsugi: Kintsugi$1,
8711
+ Kusama: Kusama,
8712
+ Litentry: Litentry$1,
8713
+ Litmus: Litmus$1,
8714
+ Manta: Manta$1,
8715
+ Moonbeam: Moonbeam$1,
8716
+ Moonriver: Moonriver$1,
8717
+ Mythos: Mythos$1,
8718
+ NeuroWeb: NeuroWeb$1,
8719
+ Nodle: Nodle$1,
8720
+ Parallel: Parallel$1,
8721
+ ParallelHeiko: ParallelHeiko$1,
8722
+ Peaq: Peaq$1,
8723
+ Pendulum: Pendulum$1,
8724
+ Phala: Phala$1,
8725
+ Picasso: Picasso$1,
8726
+ Pioneer: Pioneer$1,
8727
+ Polkadex: Polkadex$1,
8728
+ Polkadot: Polkadot,
8729
+ Quartz: Quartz$1,
8730
+ Robonomics: Robonomics$1,
8731
+ Shiden: Shiden$1,
8732
+ Subsocial: Subsocial$1,
8733
+ Turing: Turing$1,
8734
+ Unique: Unique$1,
8735
+ Zeitgeist: Zeitgeist$1,
8736
+ default: existentialDeposits
8737
+ });
8738
+
8739
+ var edMap = edsMapJson;
8740
+ var getExistentialDeposit$1 = function getExistentialDeposit(node) {
8741
+ return edMap[node];
8742
+ };
8743
+
8744
+ var getBalanceNative = function getBalanceNative(address, node, api) {
8745
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8746
+ var apiWithFallback, response, balance;
8747
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8748
+ while (1) switch (_context.prev = _context.next) {
8749
+ case 0:
8750
+ if (!(api !== null && api !== void 0)) {
8751
+ _context.next = 4;
8752
+ break;
8753
+ }
8754
+ _context.t0 = api;
8755
+ _context.next = 7;
8756
+ break;
8757
+ case 4:
8758
+ _context.next = 6;
8759
+ return createApiInstanceForNode(node);
8760
+ case 6:
8761
+ _context.t0 = _context.sent;
8762
+ case 7:
8763
+ apiWithFallback = _context.t0;
8764
+ _context.next = 10;
8765
+ return apiWithFallback.query.system.account(address);
8766
+ case 10:
8767
+ response = _context.sent;
8768
+ balance = response.data.free.toBn();
8769
+ return _context.abrupt("return", BigInt(balance.toString()));
8770
+ case 13:
8771
+ case "end":
8772
+ return _context.stop();
8773
+ }
8774
+ }, _callee);
8775
+ }));
8776
+ };
8777
+
8778
+ var getBalanceForeignXTokens = function getBalanceForeignXTokens(address, symbolOrId, symbol, id, api) {
8779
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8780
+ var response, entry, accountData;
8781
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8782
+ while (1) switch (_context.prev = _context.next) {
8783
+ case 0:
8784
+ _context.next = 2;
8785
+ return api.query.tokens.accounts.entries(address);
8786
+ case 2:
8787
+ response = _context.sent;
8788
+ entry = response.find(function (_ref) {
8789
+ var _ref2 = _slicedToArray(_ref, 2),
8790
+ _ref2$0$args = _slicedToArray(_ref2[0].args, 2);
8791
+ _ref2$0$args[0];
8792
+ var asset = _ref2$0$args[1];
8793
+ _ref2[1];
8794
+ var _a, _b, _c, _d;
8795
+ return 'symbol' in symbolOrId && asset.toString() === symbolOrId.symbol || 'id' in symbolOrId && asset.toString() === symbolOrId.id || asset.toString() === id || asset.toString() === symbol || 'symbol' in symbolOrId && Object.values((_a = asset.toHuman()) !== null && _a !== void 0 ? _a : {}).toString() === symbolOrId.symbol || 'id' in symbolOrId && Object.values((_b = asset.toHuman()) !== null && _b !== void 0 ? _b : {}).toString() === symbolOrId.id || Object.values((_c = asset.toHuman()) !== null && _c !== void 0 ? _c : {}).toString() === id || Object.values((_d = asset.toHuman()) !== null && _d !== void 0 ? _d : {}).toString() === symbol;
8796
+ });
8797
+ accountData = entry ? entry[1] : null;
8798
+ return _context.abrupt("return", accountData ? BigInt(accountData.free.toString()) : null);
8799
+ case 6:
8800
+ case "end":
8801
+ return _context.stop();
8802
+ }
8803
+ }, _callee);
8804
+ }));
8805
+ };
8806
+
8807
+ var getAssetHubMultiLocation = function getAssetHubMultiLocation(symbol) {
8808
+ if (symbol === 'MYTH') {
8809
+ return {
8810
+ parents: 1,
8811
+ interior: {
8812
+ X1: {
8813
+ Parachain: '3369'
8814
+ }
8815
+ }
8816
+ };
8817
+ } else if (symbol === 'KSM') {
8818
+ return {
8819
+ parents: 2,
8820
+ interior: {
8821
+ X1: {
8822
+ GlobalConsensus: 'Kusama'
8823
+ }
8824
+ }
8825
+ };
8826
+ }
8827
+ var ethAssets = getOtherAssets('Ethereum');
8828
+ var ethAsset = ethAssets.find(function (asset) {
8829
+ return asset.symbol === symbol;
8830
+ });
8831
+ if (ethAsset) {
8832
+ return {
8833
+ parents: 2,
8834
+ interior: {
8835
+ X2: [{
8836
+ GlobalConsensus: {
8837
+ Ethereum: {
8838
+ chainId: 1
8839
+ }
8840
+ }
8841
+ }, {
8842
+ AccountKey20: {
8843
+ network: null,
8844
+ key: ethAsset.assetId
8845
+ }
8846
+ }]
8847
+ }
8848
+ };
8849
+ }
8850
+ return null;
8851
+ };
8852
+
8853
+ var getBalanceForeignPolkadotXcm = function getBalanceForeignPolkadotXcm(address, id, api, node, symbol) {
8854
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8855
+ var _response, _obj, multiLocation, _response2, _obj2, parsedId, response, obj;
8856
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8857
+ while (1) switch (_context.prev = _context.next) {
8858
+ case 0:
8859
+ _context.prev = 0;
8860
+ if (!(node === 'Mythos')) {
8861
+ _context.next = 7;
8862
+ break;
8863
+ }
8864
+ _context.next = 4;
8865
+ return api.query.balances.account(address);
8866
+ case 4:
8867
+ _response = _context.sent;
8868
+ _obj = _response.toJSON();
8869
+ return _context.abrupt("return", _obj.free ? BigInt(_obj.free) : null);
8870
+ case 7:
8871
+ if (!(node === 'AssetHubPolkadot')) {
8872
+ _context.next = 15;
8873
+ break;
8874
+ }
8875
+ multiLocation = getAssetHubMultiLocation(symbol !== null && symbol !== void 0 ? symbol : id);
8876
+ if (!multiLocation) {
8877
+ _context.next = 15;
8878
+ break;
8879
+ }
8880
+ _context.next = 12;
8881
+ return api.query.foreignAssets.account(multiLocation, address);
8882
+ case 12:
8883
+ _response2 = _context.sent;
8884
+ _obj2 = _response2.toJSON();
8885
+ return _context.abrupt("return", BigInt(_obj2 === null || !_obj2.balance ? 0 : _obj2.balance));
8886
+ case 15:
8887
+ parsedId = new u32(api.registry, id);
8888
+ _context.next = 18;
8889
+ return api.query.assets.account(parsedId, address);
8890
+ case 18:
8891
+ response = _context.sent;
8892
+ obj = response.toJSON();
8893
+ return _context.abrupt("return", obj.balance ? BigInt(obj.balance) : null);
8894
+ case 23:
8895
+ _context.prev = 23;
8896
+ _context.t0 = _context["catch"](0);
8897
+ console.log('Error while fetching balance', _context.t0);
8898
+ return _context.abrupt("return", null);
8899
+ case 27:
8900
+ case "end":
8901
+ return _context.stop();
8902
+ }
8903
+ }, _callee, null, [[0, 23]]);
8904
+ }));
8905
+ };
8906
+
8907
+ var getBalanceForeign = function getBalanceForeign(address, node, symbolOrId, api) {
8908
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8909
+ var _a, apiWithFallback, asset, currencyStr;
8910
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8911
+ while (1) switch (_context.prev = _context.next) {
8912
+ case 0:
8913
+ if (!(api !== null && api !== void 0)) {
8914
+ _context.next = 4;
8915
+ break;
8916
+ }
8917
+ _context.t0 = api;
8918
+ _context.next = 7;
8919
+ break;
8920
+ case 4:
8921
+ _context.next = 6;
8922
+ return createApiInstanceForNode(node);
8923
+ case 6:
8924
+ _context.t0 = _context.sent;
8925
+ case 7:
8926
+ apiWithFallback = _context.t0;
8927
+ asset = getAssetBySymbolOrId(node, symbolOrId);
8928
+ if (!(getDefaultPallet(node) === 'XTokens')) {
8929
+ _context.next = 15;
8930
+ break;
8931
+ }
8932
+ _context.next = 12;
8933
+ return getBalanceForeignXTokens(address, symbolOrId, asset === null || asset === void 0 ? void 0 : asset.symbol, asset === null || asset === void 0 ? void 0 : asset.assetId, apiWithFallback);
8934
+ case 12:
8935
+ return _context.abrupt("return", _context.sent);
8936
+ case 15:
8937
+ if (!(getDefaultPallet(node) === 'PolkadotXcm')) {
8938
+ _context.next = 20;
8939
+ break;
8940
+ }
8941
+ currencyStr = 'symbol' in symbolOrId ? symbolOrId.symbol : 'id' in symbolOrId ? symbolOrId.id.toString() : undefined;
8942
+ _context.next = 19;
8943
+ return getBalanceForeignPolkadotXcm(address, (_a = asset === null || asset === void 0 ? void 0 : asset.assetId) !== null && _a !== void 0 ? _a : currencyStr, apiWithFallback, node, asset === null || asset === void 0 ? void 0 : asset.symbol);
8944
+ case 19:
8945
+ return _context.abrupt("return", _context.sent);
8946
+ case 20:
8947
+ throw new Error('Unsupported pallet');
8948
+ case 21:
8949
+ case "end":
8950
+ return _context.stop();
8951
+ }
8952
+ }, _callee);
8953
+ }));
8954
+ };
8955
+
8956
+ var getAssetBalance = function getAssetBalance(account, node, currency) {
8957
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8958
+ var _a, api, isNativeSymbol;
8959
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8960
+ while (1) switch (_context.prev = _context.next) {
8961
+ case 0:
8962
+ _context.next = 2;
8963
+ return createApiInstanceForNode(node);
8964
+ case 2:
8965
+ api = _context.sent;
8966
+ isNativeSymbol = 'symbol' in currency && getNativeAssetSymbol(node) === currency.symbol;
8967
+ if (!isNativeSymbol) {
8968
+ _context.next = 10;
8969
+ break;
8970
+ }
8971
+ _context.next = 7;
8972
+ return getBalanceNative(account, node, api);
8973
+ case 7:
8974
+ _context.t0 = _context.sent;
8975
+ _context.next = 22;
8976
+ break;
8977
+ case 10:
8978
+ _context.next = 12;
8979
+ return getBalanceForeign(account, node, currency, api);
8980
+ case 12:
8981
+ _context.t2 = _a = _context.sent;
8982
+ _context.t1 = _context.t2 !== null;
8983
+ if (!_context.t1) {
8984
+ _context.next = 16;
8985
+ break;
8986
+ }
8987
+ _context.t1 = _a !== void 0;
8988
+ case 16:
8989
+ if (!_context.t1) {
8990
+ _context.next = 20;
8991
+ break;
8992
+ }
8993
+ _context.t3 = _a;
8994
+ _context.next = 21;
8995
+ break;
8996
+ case 20:
8997
+ _context.t3 = BigInt(0);
8998
+ case 21:
8999
+ _context.t0 = _context.t3;
9000
+ case 22:
9001
+ return _context.abrupt("return", _context.t0);
9002
+ case 23:
9003
+ case "end":
9004
+ return _context.stop();
9005
+ }
9006
+ }, _callee);
9007
+ }));
8515
9008
  };
8516
9009
 
8517
- var edMapJson = /*#__PURE__*/Object.freeze({
8518
- __proto__: null,
8519
- Acala: Acala$1,
8520
- Altair: Altair$1,
8521
- Amplitude: Amplitude$1,
8522
- AssetHubKusama: AssetHubKusama$1,
8523
- AssetHubPolkadot: AssetHubPolkadot$1,
8524
- Astar: Astar$1,
8525
- Bajun: Bajun$1,
8526
- Basilisk: Basilisk$1,
8527
- BifrostKusama: BifrostKusama$1,
8528
- BifrostPolkadot: BifrostPolkadot$1,
8529
- Bitgreen: Bitgreen$1,
8530
- BridgeHubKusama: BridgeHubKusama$1,
8531
- BridgeHubPolkadot: BridgeHubPolkadot$1,
8532
- Calamari: Calamari$1,
8533
- Centrifuge: Centrifuge$1,
8534
- Collectives: Collectives$1,
8535
- ComposableFinance: ComposableFinance$1,
8536
- CoretimeKusama: CoretimeKusama$1,
8537
- Crab: Crab$1,
8538
- Crust: Crust$1,
8539
- CrustShadow: CrustShadow$1,
8540
- Curio: Curio$1,
8541
- Darwinia: Darwinia$1,
8542
- Encointer: Encointer$1,
8543
- Hydration: Hydration$1,
8544
- Imbue: Imbue$1,
8545
- Integritee: Integritee$1,
8546
- Interlay: Interlay$1,
8547
- InvArchTinker: InvArchTinker$1,
8548
- Karura: Karura$1,
8549
- Khala: Khala$1,
8550
- KiltSpiritnet: KiltSpiritnet$1,
8551
- Kintsugi: Kintsugi$1,
8552
- Kusama: Kusama,
8553
- Litentry: Litentry$1,
8554
- Litmus: Litmus$1,
8555
- Manta: Manta$1,
8556
- Moonbeam: Moonbeam$1,
8557
- Moonriver: Moonriver$1,
8558
- Mythos: Mythos$1,
8559
- NeuroWeb: NeuroWeb$1,
8560
- Nodle: Nodle$1,
8561
- Parallel: Parallel$1,
8562
- ParallelHeiko: ParallelHeiko$1,
8563
- Peaq: Peaq$1,
8564
- Pendulum: Pendulum$1,
8565
- Phala: Phala$1,
8566
- Picasso: Picasso$1,
8567
- Pioneer: Pioneer$1,
8568
- Polkadex: Polkadex$1,
8569
- Polkadot: Polkadot,
8570
- Quartz: Quartz$1,
8571
- Robonomics: Robonomics$1,
8572
- Shiden: Shiden$1,
8573
- Subsocial: Subsocial$1,
8574
- Turing: Turing$1,
8575
- Unique: Unique$1,
8576
- Zeitgeist: Zeitgeist$1,
8577
- default: existentialDeposits
8578
- });
8579
-
8580
- var palletsMap = edMapJson;
8581
- var getExistentialDeposit$1 = function getExistentialDeposit(node) {
9010
+ var palletsMap = edsMapJson;
9011
+ var getExistentialDeposit = function getExistentialDeposit(node) {
8582
9012
  return BigInt(palletsMap[node]);
8583
9013
  };
8584
9014
  var getMinNativeTransferableAmount = function getMinNativeTransferableAmount(node) {
8585
- var ed = getExistentialDeposit$1(node);
9015
+ var ed = getExistentialDeposit(node);
8586
9016
  var tenPercent = ed / BigInt(10);
8587
9017
  return ed + tenPercent;
8588
9018
  };
@@ -8592,7 +9022,7 @@ var getMaxNativeTransferableAmount = function getMaxNativeTransferableAmount(add
8592
9022
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8593
9023
  while (1) switch (_context.prev = _context.next) {
8594
9024
  case 0:
8595
- ed = getExistentialDeposit$1(node);
9025
+ ed = getExistentialDeposit(node);
8596
9026
  _context.next = 3;
8597
9027
  return getBalanceNative(address, node);
8598
9028
  case 3:
@@ -8607,180 +9037,6 @@ var getMaxNativeTransferableAmount = function getMaxNativeTransferableAmount(add
8607
9037
  }));
8608
9038
  };
8609
9039
 
8610
- // Contains call formatting for closing HRMP channels functionality
8611
- var closeChannelInternal = function closeChannelInternal(options) {
8612
- var _api$tx$module;
8613
- var api = options.api,
8614
- origin = options.origin,
8615
- inbound = options.inbound,
8616
- outbound = options.outbound,
8617
- _options$serializedAp = options.serializedApiCallEnabled,
8618
- serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
8619
- var module = 'hrmp';
8620
- var section = 'forceCleanHrmp';
8621
- var parameters = [getParaId(origin), inbound, outbound];
8622
- if (serializedApiCallEnabled) {
8623
- return {
8624
- module: module,
8625
- section: section,
8626
- parameters: parameters
8627
- };
8628
- }
8629
- return api.tx.sudo.sudo((_api$tx$module = api.tx[module])[section].apply(_api$tx$module, parameters));
8630
- };
8631
- var closeChannel = function closeChannel(options) {
8632
- return closeChannelInternal(options);
8633
- };
8634
- var closeChannelSerializedApiCall = function closeChannelSerializedApiCall(options) {
8635
- return closeChannelInternal(Object.assign(Object.assign({}, options), {
8636
- serializedApiCallEnabled: true
8637
- }));
8638
- };
8639
-
8640
- var index$3 = /*#__PURE__*/Object.freeze({
8641
- __proto__: null,
8642
- closeChannel: closeChannel,
8643
- closeChannelSerializedApiCall: closeChannelSerializedApiCall
8644
- });
8645
-
8646
- var CloseChannelBuilder = /*#__PURE__*/function () {
8647
- function CloseChannelBuilder(api, from) {
8648
- _classCallCheck(this, CloseChannelBuilder);
8649
- this.api = api;
8650
- this.from = from;
8651
- }
8652
- return _createClass(CloseChannelBuilder, [{
8653
- key: "inbound",
8654
- value: function inbound(_inbound) {
8655
- this._inbound = _inbound;
8656
- return this;
8657
- }
8658
- }, {
8659
- key: "outbound",
8660
- value: function outbound(_outbound) {
8661
- this._outbound = _outbound;
8662
- return this;
8663
- }
8664
- }, {
8665
- key: "buildOptions",
8666
- value: function buildOptions() {
8667
- return {
8668
- api: this.api,
8669
- origin: this.from,
8670
- inbound: this._inbound,
8671
- outbound: this._outbound
8672
- };
8673
- }
8674
- }, {
8675
- key: "build",
8676
- value: function build() {
8677
- var options = this.buildOptions();
8678
- return closeChannel(options);
8679
- }
8680
- }, {
8681
- key: "buildSerializedApiCall",
8682
- value: function buildSerializedApiCall() {
8683
- var options = this.buildOptions();
8684
- return closeChannelSerializedApiCall(options);
8685
- }
8686
- }], [{
8687
- key: "create",
8688
- value: function create(api, from) {
8689
- return new CloseChannelBuilder(api, from);
8690
- }
8691
- }]);
8692
- }();
8693
-
8694
- // Contains call formatting for opening HRMP channels functionality
8695
- var openChannelInternal = function openChannelInternal(options) {
8696
- var _api$tx$module;
8697
- var api = options.api,
8698
- origin = options.origin,
8699
- destination = options.destination,
8700
- maxSize = options.maxSize,
8701
- maxMessageSize = options.maxMessageSize,
8702
- _options$serializedAp = options.serializedApiCallEnabled,
8703
- serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
8704
- var module = 'parasSudoWrapper';
8705
- var section = 'sudoEstablishHrmpChannel';
8706
- var parameters = [getParaId(origin), getParaId(destination), maxSize, maxMessageSize];
8707
- if (serializedApiCallEnabled) {
8708
- return {
8709
- module: module,
8710
- section: section,
8711
- parameters: parameters
8712
- };
8713
- }
8714
- return api.tx.sudo.sudo((_api$tx$module = api.tx[module])[section].apply(_api$tx$module, parameters));
8715
- };
8716
- var openChannel = function openChannel(options) {
8717
- return openChannelInternal(options);
8718
- };
8719
- var openChannelSerializedApiCall = function openChannelSerializedApiCall(options) {
8720
- return openChannelInternal(Object.assign(Object.assign({}, options), {
8721
- serializedApiCallEnabled: true
8722
- }));
8723
- };
8724
-
8725
- var index$2 = /*#__PURE__*/Object.freeze({
8726
- __proto__: null,
8727
- openChannel: openChannel,
8728
- openChannelSerializedApiCall: openChannelSerializedApiCall
8729
- });
8730
-
8731
- var OpenChannelBuilder = /*#__PURE__*/function () {
8732
- function OpenChannelBuilder(api, from, to) {
8733
- _classCallCheck(this, OpenChannelBuilder);
8734
- this.api = api;
8735
- this.from = from;
8736
- this.to = to;
8737
- }
8738
- return _createClass(OpenChannelBuilder, [{
8739
- key: "maxSize",
8740
- value: function maxSize(size) {
8741
- this._maxSize = size;
8742
- return this;
8743
- }
8744
- }, {
8745
- key: "maxMessageSize",
8746
- value: function maxMessageSize(size) {
8747
- this._maxMessageSize = size;
8748
- return this;
8749
- }
8750
- }, {
8751
- key: "buildOptions",
8752
- value: function buildOptions() {
8753
- if (_typeof(this.to) === 'object') {
8754
- throw new Error('Channels do not support multi-location destinations');
8755
- }
8756
- return {
8757
- api: this.api,
8758
- origin: this.from,
8759
- destination: this.to,
8760
- maxSize: this._maxSize,
8761
- maxMessageSize: this._maxMessageSize
8762
- };
8763
- }
8764
- }, {
8765
- key: "build",
8766
- value: function build() {
8767
- var options = this.buildOptions();
8768
- return openChannel(options);
8769
- }
8770
- }, {
8771
- key: "buildSerializedApiCall",
8772
- value: function buildSerializedApiCall() {
8773
- var options = this.buildOptions();
8774
- return openChannelSerializedApiCall(options);
8775
- }
8776
- }], [{
8777
- key: "create",
8778
- value: function create(api, from, to) {
8779
- return new OpenChannelBuilder(api, from, to);
8780
- }
8781
- }]);
8782
- }();
8783
-
8784
9040
  var RelayToParaBuilder = /*#__PURE__*/function () {
8785
9041
  function RelayToParaBuilder(api, to, batchManager, paraIdTo) {
8786
9042
  _classCallCheck(this, RelayToParaBuilder);
@@ -9040,7 +9296,9 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
9040
9296
  return {
9041
9297
  api: this.api,
9042
9298
  origin: this.from,
9043
- currency: currency,
9299
+ currency: {
9300
+ symbol: currency
9301
+ },
9044
9302
  amount: this.amount,
9045
9303
  address: this._address,
9046
9304
  feeAsset: this.feeAsset,
@@ -9104,19 +9362,133 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
9104
9362
  return new ParaToRelayBuilder(api, from, amount, batchManager, feeAsset);
9105
9363
  }
9106
9364
  }]);
9107
- }();
9108
-
9109
- var MissingApiPromiseError = /*#__PURE__*/function (_Error) {
9110
- function MissingApiPromiseError() {
9111
- var _this;
9112
- _classCallCheck(this, MissingApiPromiseError);
9113
- _this = _callSuper(this, MissingApiPromiseError, ['Please provide ApiPromise instance.']);
9114
- _this.name = 'MissingApiPromise';
9115
- return _this;
9365
+ }();
9366
+
9367
+ var findParachainJunction = function findParachainJunction(multilocation) {
9368
+ var interior = multilocation.interior;
9369
+ if (interior === 'Here') {
9370
+ return null;
9371
+ }
9372
+ for (var key in interior) {
9373
+ var junctions = interior[key];
9374
+ if (Array.isArray(junctions)) {
9375
+ var _iterator = _createForOfIteratorHelper(junctions),
9376
+ _step;
9377
+ try {
9378
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
9379
+ var junction = _step.value;
9380
+ if ('Parachain' in junction) {
9381
+ return Number(junction.Parachain);
9382
+ }
9383
+ }
9384
+ } catch (err) {
9385
+ _iterator.e(err);
9386
+ } finally {
9387
+ _iterator.f();
9388
+ }
9389
+ } else if (_typeof(junctions) === 'object' && junctions !== null && 'Parachain' in junctions) {
9390
+ return Number(junctions.Parachain);
9391
+ }
9392
+ }
9393
+ return null;
9394
+ };
9395
+
9396
+ var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
9397
+ var api = _ref.api,
9398
+ destination = _ref.destination,
9399
+ address = _ref.address,
9400
+ amount = _ref.amount,
9401
+ paraIdTo = _ref.paraIdTo;
9402
+ var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9403
+ var paraId = destination !== undefined && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
9404
+ var parameters = [createPolkadotXcmHeader('RelayToPara', version, destination, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpec(amount, version, Parents.ZERO), 0];
9405
+ if (includeFee) {
9406
+ parameters.push('Unlimited');
9407
+ }
9408
+ return parameters;
9409
+ };
9410
+ var isTMultiLocation = function isTMultiLocation(value) {
9411
+ return _typeof(value) === 'object' && value !== null && 'parents' in value && 'interior' in value;
9412
+ };
9413
+ var createBridgeCurrencySpec = function createBridgeCurrencySpec(amount, ecosystem) {
9414
+ return _defineProperty({}, Version.V4, [{
9415
+ id: {
9416
+ parents: Parents.TWO,
9417
+ interior: {
9418
+ X1: [{
9419
+ GlobalConsensus: ecosystem
9420
+ }]
9421
+ }
9422
+ },
9423
+ fun: {
9424
+ Fungible: amount
9425
+ }
9426
+ }]);
9427
+ };
9428
+ var createCurrencySpec = function createCurrencySpec(amount, version, parents, overriddenCurrency) {
9429
+ var interior = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'Here';
9430
+ if (!overriddenCurrency) {
9431
+ return _defineProperty({}, version, [{
9432
+ id: version === Version.V4 ? {
9433
+ parents: parents,
9434
+ interior: interior
9435
+ } : {
9436
+ Concrete: {
9437
+ parents: parents,
9438
+ interior: interior
9439
+ }
9440
+ },
9441
+ fun: {
9442
+ Fungible: amount
9443
+ }
9444
+ }]);
9116
9445
  }
9117
- _inherits(MissingApiPromiseError, _Error);
9118
- return _createClass(MissingApiPromiseError);
9119
- }(/*#__PURE__*/_wrapNativeSuper(Error));
9446
+ return isTMultiLocation(overriddenCurrency) ? _defineProperty({}, version, [{
9447
+ id: version === Version.V4 ? overriddenCurrency : {
9448
+ Concrete: overriddenCurrency
9449
+ },
9450
+ fun: {
9451
+ Fungible: amount
9452
+ }
9453
+ }]) : // It must be TMultiAsset if not TMultiLocation
9454
+ _defineProperty({}, version, overriddenCurrency);
9455
+ };
9456
+ var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId, junction, parents) {
9457
+ var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
9458
+ var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
9459
+ Parachain: nodeId
9460
+ });
9461
+ var isMultiLocationDestination = _typeof(destination) === 'object';
9462
+ return _defineProperty({}, version, isMultiLocationDestination ? destination : {
9463
+ parents: parentsResolved,
9464
+ interior: interior
9465
+ });
9466
+ };
9467
+ var createBridgePolkadotXcmDest = function createBridgePolkadotXcmDest(version, ecosystem, destination, nodeId) {
9468
+ var multiLocation = {
9469
+ parents: Parents.TWO,
9470
+ interior: {
9471
+ X2: [{
9472
+ GlobalConsensus: ecosystem
9473
+ }, {
9474
+ Parachain: nodeId
9475
+ }]
9476
+ }
9477
+ };
9478
+ var isMultiLocationDestination = _typeof(destination) === 'object';
9479
+ return _defineProperty({}, version, isMultiLocationDestination ? destination : multiLocation);
9480
+ };
9481
+ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(multiLocation) {
9482
+ var parachainId = findParachainJunction(multiLocation);
9483
+ if (parachainId === null) {
9484
+ throw new Error('Parachain ID not found in destination multi location.');
9485
+ }
9486
+ var node = getTNode(parachainId);
9487
+ if (node === null) {
9488
+ throw new Error('Node with specified paraId not found in destination multi location.');
9489
+ }
9490
+ return node;
9491
+ };
9120
9492
 
9121
9493
  var buildBeneficiaryInput = function buildBeneficiaryInput(api, address) {
9122
9494
  if (isTMultiLocation(address)) {
@@ -9387,14 +9759,6 @@ var ToGeneralBuilder = /*#__PURE__*/function () {
9387
9759
  value: function currency(_currency) {
9388
9760
  return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency, this.batchManager, this.paraIdTo);
9389
9761
  }
9390
- }, {
9391
- key: "openChannel",
9392
- value: function openChannel() {
9393
- if (this.api === undefined) {
9394
- throw new MissingApiPromiseError();
9395
- }
9396
- return OpenChannelBuilder.create(this.api, this.from, this.to);
9397
- }
9398
9762
  }]);
9399
9763
  }();
9400
9764
  var FromGeneralBuilder = /*#__PURE__*/function () {
@@ -9420,14 +9784,6 @@ var FromGeneralBuilder = /*#__PURE__*/function () {
9420
9784
  value: function amount(_amount) {
9421
9785
  return ParaToRelayBuilder.create(this.api, this.from, _amount, this.batchManager, this._feeAsset);
9422
9786
  }
9423
- }, {
9424
- key: "closeChannel",
9425
- value: function closeChannel() {
9426
- if (this.api === undefined) {
9427
- throw new MissingApiPromiseError();
9428
- }
9429
- return CloseChannelBuilder.create(this.api, this.from);
9430
- }
9431
9787
  }]);
9432
9788
  }();
9433
9789
  var GeneralBuilder = /*#__PURE__*/function () {
@@ -9476,11 +9832,13 @@ var Builder = function Builder(api) {
9476
9832
 
9477
9833
  var findEthAsset = function findEthAsset(currency) {
9478
9834
  var ethAssets = getOtherAssets('Ethereum');
9479
- var ethAsset = ethAssets.find(function (asset) {
9480
- return asset.symbol === currency;
9835
+ var ethAsset = 'symbol' in currency ? ethAssets.find(function (asset) {
9836
+ return asset.symbol === currency.symbol;
9837
+ }) : ethAssets.find(function (asset) {
9838
+ return asset.assetId === currency.id;
9481
9839
  });
9482
9840
  if (!ethAsset) {
9483
- throw new InvalidCurrencyError("Currency ".concat(currency, " is not supported for Ethereum transfers"));
9841
+ throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " is not supported for Ethereum transfers"));
9484
9842
  }
9485
9843
  return ethAsset;
9486
9844
  };
@@ -9645,7 +10003,7 @@ var EvmBuilder = function EvmBuilder(provider) {
9645
10003
  return new EvmBuilderClass(provider);
9646
10004
  };
9647
10005
 
9648
- var createTx$1 = function createTx(originApi, address, amount, currencySymbol, originNode, destNode) {
10006
+ var createTx$1 = function createTx(originApi, address, amount, currency, originNode, destNode) {
9649
10007
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9650
10008
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9651
10009
  while (1) switch (_context.prev = _context.next) {
@@ -9669,7 +10027,7 @@ var createTx$1 = function createTx(originApi, address, amount, currencySymbol, o
9669
10027
  return _context.abrupt("return", _context.sent);
9670
10028
  case 12:
9671
10029
  _context.next = 14;
9672
- return Builder(originApi).from(originNode).to(destNode).currency(currencySymbol).amount(amount).address(address).build();
10030
+ return Builder(originApi).from(originNode).to(destNode).currency(currency).amount(amount).address(address).build();
9673
10031
  case 14:
9674
10032
  return _context.abrupt("return", _context.sent);
9675
10033
  case 15:
@@ -9679,7 +10037,7 @@ var createTx$1 = function createTx(originApi, address, amount, currencySymbol, o
9679
10037
  }, _callee);
9680
10038
  }));
9681
10039
  };
9682
- var calculateTransactionFee = function calculateTransactionFee(tx, address) {
10040
+ var calculateTransactionFee$1 = function calculateTransactionFee(tx, address) {
9683
10041
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9684
10042
  var _yield$tx$paymentInfo, partialFee;
9685
10043
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -9728,7 +10086,7 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin, destination, curr
9728
10086
  case 14:
9729
10087
  tx = _context3.sent;
9730
10088
  _context3.next = 17;
9731
- return calculateTransactionFee(tx, account);
10089
+ return calculateTransactionFee$1(tx, account);
9732
10090
  case 17:
9733
10091
  xcmFee = _context3.sent;
9734
10092
  xcmFeeBigInt = BigInt(xcmFee.toString());
@@ -9750,148 +10108,88 @@ var getOriginFeeDetails = function getOriginFeeDetails(origin, destination, curr
9750
10108
  }));
9751
10109
  };
9752
10110
 
9753
- var getAssetSymbol = function getAssetSymbol(node, assetId) {
9754
- if (node === 'Polkadot' || node === 'Kusama') {
9755
- return getNativeAssetSymbol(node);
9756
- }
9757
- var asset = getAssetBySymbolOrId(node, assetId, false, true);
9758
- return asset === null || asset === void 0 ? void 0 : asset.symbol;
9759
- };
9760
- var getAssetBalance = function getAssetBalance(account, node, assetSymbolOrId) {
10111
+ var getTransferInfo = function getTransferInfo(origin, destination, accountOrigin, accountDestination, currency, amount) {
9761
10112
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9762
- var _a, api, isNativeSymbol;
10113
+ var _a, _b, originApi, originBalance, _yield$getOriginFeeDe, destXcmFee, expectedBalanceAfterXCMDelivery, asset;
9763
10114
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9764
10115
  while (1) switch (_context.prev = _context.next) {
9765
10116
  case 0:
9766
10117
  _context.next = 2;
9767
- return createApiInstanceForNode(node);
9768
- case 2:
9769
- api = _context.sent;
9770
- isNativeSymbol = getNativeAssetSymbol(node) === assetSymbolOrId;
9771
- if (!isNativeSymbol) {
9772
- _context.next = 10;
9773
- break;
9774
- }
9775
- _context.next = 7;
9776
- return getBalanceNative(account, node, api);
9777
- case 7:
9778
- _context.t0 = _context.sent;
9779
- _context.next = 22;
9780
- break;
9781
- case 10:
9782
- _context.next = 12;
9783
- return getBalanceForeign(account, node, assetSymbolOrId, api);
9784
- case 12:
9785
- _context.t2 = _a = _context.sent;
9786
- _context.t1 = _context.t2 !== null;
9787
- if (!_context.t1) {
9788
- _context.next = 16;
9789
- break;
9790
- }
9791
- _context.t1 = _a !== void 0;
9792
- case 16:
9793
- if (!_context.t1) {
9794
- _context.next = 20;
9795
- break;
9796
- }
9797
- _context.t3 = _a;
9798
- _context.next = 21;
9799
- break;
9800
- case 20:
9801
- _context.t3 = BigInt(0);
9802
- case 21:
9803
- _context.t0 = _context.t3;
9804
- case 22:
9805
- return _context.abrupt("return", _context.t0);
9806
- case 23:
9807
- case "end":
9808
- return _context.stop();
9809
- }
9810
- }, _callee);
9811
- }));
9812
- };
9813
- var getTransferInfo = function getTransferInfo(origin, destination, accountOrigin, accountDestination, assetSymbolOrId, amount) {
9814
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9815
- var _a, originApi, originBalance, _yield$getOriginFeeDe, destXcmFee, expectedBalanceAfterXCMDelivery, asset;
9816
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9817
- while (1) switch (_context2.prev = _context2.next) {
9818
- case 0:
9819
- _context2.next = 2;
9820
10118
  return createApiInstanceForNode(origin);
9821
10119
  case 2:
9822
- originApi = _context2.sent;
9823
- _context2.next = 5;
10120
+ originApi = _context.sent;
10121
+ _context.next = 5;
9824
10122
  return getBalanceNative(accountOrigin, origin, originApi);
9825
10123
  case 5:
9826
- originBalance = _context2.sent;
9827
- _context2.next = 8;
9828
- return getOriginFeeDetails(origin, destination, assetSymbolOrId, amount, accountOrigin, originApi);
10124
+ originBalance = _context.sent;
10125
+ _context.next = 8;
10126
+ return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
9829
10127
  case 8:
9830
- _yield$getOriginFeeDe = _context2.sent;
10128
+ _yield$getOriginFeeDe = _context.sent;
9831
10129
  destXcmFee = _yield$getOriginFeeDe.xcmFee;
9832
10130
  expectedBalanceAfterXCMDelivery = originBalance - destXcmFee;
9833
- asset = getAssetSymbol(origin, assetSymbolOrId);
9834
- _context2.t0 = {
10131
+ asset = getAssetBySymbolOrId(origin, currency);
10132
+ _context.t0 = {
9835
10133
  origin: origin,
9836
10134
  destination: destination,
9837
10135
  ecosystem: determineRelayChainSymbol(origin)
9838
10136
  };
9839
- _context2.next = 15;
9840
- return getAssetBalance(accountOrigin, origin, assetSymbolOrId);
10137
+ _context.next = 15;
10138
+ return getAssetBalance(accountOrigin, origin, currency);
9841
10139
  case 15:
9842
- _context2.t1 = _context2.sent;
9843
- _context2.t2 = asset !== null && asset !== void 0 ? asset : '';
9844
- _context2.t3 = {
9845
- balance: _context2.t1,
9846
- currency: _context2.t2
10140
+ _context.t1 = _context.sent;
10141
+ _context.t2 = (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : '';
10142
+ _context.t3 = {
10143
+ balance: _context.t1,
10144
+ currency: _context.t2
9847
10145
  };
9848
- _context2.next = 20;
10146
+ _context.next = 20;
9849
10147
  return getBalanceNative(accountOrigin, origin, originApi);
9850
10148
  case 20:
9851
- _context2.t4 = _context2.sent;
9852
- _context2.t5 = expectedBalanceAfterXCMDelivery;
9853
- _context2.next = 24;
9854
- return getOriginFeeDetails(origin, destination, assetSymbolOrId, amount, accountOrigin, originApi);
10149
+ _context.t4 = _context.sent;
10150
+ _context.t5 = expectedBalanceAfterXCMDelivery;
10151
+ _context.next = 24;
10152
+ return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
9855
10153
  case 24:
9856
- _context2.t6 = _context2.sent;
9857
- _context2.t7 = BigInt((_a = getExistentialDeposit$1(origin)) !== null && _a !== void 0 ? _a : 0);
9858
- _context2.t8 = getNativeAssetSymbol(origin);
9859
- _context2.t9 = getMinNativeTransferableAmount(origin);
9860
- _context2.next = 30;
10154
+ _context.t6 = _context.sent;
10155
+ _context.t7 = BigInt((_b = getExistentialDeposit(origin)) !== null && _b !== void 0 ? _b : 0);
10156
+ _context.t8 = getNativeAssetSymbol(origin);
10157
+ _context.t9 = getMinNativeTransferableAmount(origin);
10158
+ _context.next = 30;
9861
10159
  return getMaxNativeTransferableAmount(accountOrigin, origin);
9862
10160
  case 30:
9863
- _context2.t10 = _context2.sent;
9864
- _context2.t11 = {
9865
- balance: _context2.t4,
9866
- expectedBalanceAfterXCMFee: _context2.t5,
9867
- xcmFee: _context2.t6,
9868
- existentialDeposit: _context2.t7,
9869
- asset: _context2.t8,
9870
- minNativeTransferableAmount: _context2.t9,
9871
- maxNativeTransferableAmount: _context2.t10
10161
+ _context.t10 = _context.sent;
10162
+ _context.t11 = {
10163
+ balance: _context.t4,
10164
+ expectedBalanceAfterXCMFee: _context.t5,
10165
+ xcmFee: _context.t6,
10166
+ existentialDeposit: _context.t7,
10167
+ asset: _context.t8,
10168
+ minNativeTransferableAmount: _context.t9,
10169
+ maxNativeTransferableAmount: _context.t10
9872
10170
  };
9873
- _context2.next = 34;
10171
+ _context.next = 34;
9874
10172
  return getBalanceNative(accountDestination, destination);
9875
10173
  case 34:
9876
- _context2.t12 = _context2.sent;
9877
- _context2.t13 = getNativeAssetSymbol(destination);
9878
- _context2.t14 = getExistentialDeposit$1(destination);
9879
- _context2.t15 = {
9880
- balance: _context2.t12,
9881
- currency: _context2.t13,
9882
- existentialDeposit: _context2.t14
10174
+ _context.t12 = _context.sent;
10175
+ _context.t13 = getNativeAssetSymbol(destination);
10176
+ _context.t14 = getExistentialDeposit(destination);
10177
+ _context.t15 = {
10178
+ balance: _context.t12,
10179
+ currency: _context.t13,
10180
+ existentialDeposit: _context.t14
9883
10181
  };
9884
- return _context2.abrupt("return", {
9885
- chain: _context2.t0,
9886
- currencyBalanceOrigin: _context2.t3,
9887
- originFeeBalance: _context2.t11,
9888
- destinationFeeBalance: _context2.t15
10182
+ return _context.abrupt("return", {
10183
+ chain: _context.t0,
10184
+ currencyBalanceOrigin: _context.t3,
10185
+ originFeeBalance: _context.t11,
10186
+ destinationFeeBalance: _context.t15
9889
10187
  });
9890
10188
  case 39:
9891
10189
  case "end":
9892
- return _context2.stop();
10190
+ return _context.stop();
9893
10191
  }
9894
- }, _callee2);
10192
+ }, _callee);
9895
10193
  }));
9896
10194
  };
9897
10195
 
@@ -9904,6 +10202,7 @@ var index$1 = /*#__PURE__*/Object.freeze({
9904
10202
  getAssetsObject: getAssetsObject,
9905
10203
  getBalanceForeign: getBalanceForeign,
9906
10204
  getBalanceNative: getBalanceNative,
10205
+ getExistentialDeposit: getExistentialDeposit$1,
9907
10206
  getNativeAssetSymbol: getNativeAssetSymbol,
9908
10207
  getNativeAssets: getNativeAssets,
9909
10208
  getOtherAssets: getOtherAssets,
@@ -9915,14 +10214,76 @@ var index$1 = /*#__PURE__*/Object.freeze({
9915
10214
  hasSupportForAsset: hasSupportForAsset
9916
10215
  });
9917
10216
 
10217
+ var isPrimitive = function isPrimitive(obj) {
10218
+ return obj !== Object(obj);
10219
+ };
10220
+ var _deepEqual = function deepEqual(obj1, obj2) {
10221
+ if (obj1 === obj2) return true;
10222
+ if (isPrimitive(obj1) && isPrimitive(obj2)) return obj1 === obj2;
10223
+ if (_typeof(obj1) !== 'object' || obj1 === null || _typeof(obj2) !== 'object' || obj2 === null) {
10224
+ return false;
10225
+ }
10226
+ if (Array.isArray(obj1) !== Array.isArray(obj2)) {
10227
+ return false;
10228
+ }
10229
+ var obj1Keys = Object.keys(obj1).map(function (key) {
10230
+ return key.toLowerCase();
10231
+ });
10232
+ var obj2Keys = Object.keys(obj2).map(function (key) {
10233
+ return key.toLowerCase();
10234
+ });
10235
+ if (obj1Keys.length !== obj2Keys.length) return false;
10236
+ var _iterator = _createForOfIteratorHelper(obj1Keys),
10237
+ _step;
10238
+ try {
10239
+ var _loop = function _loop() {
10240
+ var key = _step.value;
10241
+ var keyInObj2 = obj2Keys.find(function (k) {
10242
+ return k === key;
10243
+ });
10244
+ if (!keyInObj2) return {
10245
+ v: false
10246
+ };
10247
+ var obj1Value = obj1[Object.keys(obj1).find(function (k) {
10248
+ return k.toLowerCase() === key;
10249
+ })];
10250
+ var obj2Value = obj2[Object.keys(obj2).find(function (k) {
10251
+ return k.toLowerCase() === key;
10252
+ })];
10253
+ if (!_deepEqual(obj1Value, obj2Value)) return {
10254
+ v: false
10255
+ };
10256
+ },
10257
+ _ret;
10258
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
10259
+ _ret = _loop();
10260
+ if (_ret) return _ret.v;
10261
+ }
10262
+ } catch (err) {
10263
+ _iterator.e(err);
10264
+ } finally {
10265
+ _iterator.f();
10266
+ }
10267
+ return true;
10268
+ };
10269
+
10270
+ var verifyMultiLocation = function verifyMultiLocation(node, multiLocation) {
10271
+ var _getAssetsObject = getAssetsObject(node),
10272
+ multiLocations = _getAssetsObject.multiLocations;
10273
+ if (!multiLocations) return true;
10274
+ return multiLocations.some(function (location) {
10275
+ return _deepEqual(location, multiLocation);
10276
+ });
10277
+ };
10278
+
9918
10279
  var supportsXTokens = function supportsXTokens(obj) {
9919
- return 'transferXTokens' in obj;
10280
+ return _typeof(obj) === 'object' && obj !== null && 'transferXTokens' in obj;
9920
10281
  };
9921
10282
  var supportsXTransfer = function supportsXTransfer(obj) {
9922
- return 'transferXTransfer' in obj;
10283
+ return _typeof(obj) === 'object' && obj !== null && 'transferXTransfer' in obj;
9923
10284
  };
9924
10285
  var supportsPolkadotXCM = function supportsPolkadotXCM(obj) {
9925
- return 'transferPolkadotXCM' in obj;
10286
+ return _typeof(obj) === 'object' && obj !== null && 'transferPolkadotXCM' in obj;
9926
10287
  };
9927
10288
  var ParachainNode = /*#__PURE__*/function () {
9928
10289
  function ParachainNode(node, name, type, version) {
@@ -10011,6 +10372,9 @@ var ParachainNode = /*#__PURE__*/function () {
10011
10372
  serializedApiCallEnabled: serializedApiCallEnabled
10012
10373
  });
10013
10374
  } else if (supportsPolkadotXCM(this)) {
10375
+ if (isTMultiLocation(overridedCurrencyMultiLocation) && !verifyMultiLocation(this.node, overridedCurrencyMultiLocation)) {
10376
+ throw new InvalidCurrencyError('Provided Multi-location is not a valid currency.');
10377
+ }
10014
10378
  return this.transferPolkadotXCM({
10015
10379
  api: api,
10016
10380
  header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
@@ -10104,12 +10468,13 @@ var getModifiedCurrencySelection = function getModifiedCurrencySelection(version
10104
10468
  }
10105
10469
  });
10106
10470
  };
10107
- var getCurrencySelection = function getCurrencySelection(_ref2, isAssetHub, currencySelection) {
10108
- var origin = _ref2.origin,
10109
- amount = _ref2.amount,
10110
- currencyID = _ref2.currencyID,
10111
- paraIdTo = _ref2.paraIdTo,
10112
- overridedCurrencyMultiLocation = _ref2.overridedCurrencyMultiLocation;
10471
+
10472
+ var getCurrencySelection = function getCurrencySelection(_ref, isAssetHub, currencySelection) {
10473
+ var origin = _ref.origin,
10474
+ amount = _ref.amount,
10475
+ currencyID = _ref.currencyID,
10476
+ paraIdTo = _ref.paraIdTo,
10477
+ overridedCurrencyMultiLocation = _ref.overridedCurrencyMultiLocation;
10113
10478
  var _getNode = getNode(origin),
10114
10479
  version = _getNode.version;
10115
10480
  if (overridedCurrencyMultiLocation !== undefined) return _defineProperty({}, version, overridedCurrencyMultiLocation);
@@ -10118,14 +10483,14 @@ var getCurrencySelection = function getCurrencySelection(_ref2, isAssetHub, curr
10118
10483
  }
10119
10484
  return currencySelection;
10120
10485
  };
10121
- var getParameters = function getParameters(isAssetHub, currencySelection, addressSelection, amount, fees, feeAsset
10122
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10123
- ) {
10486
+
10487
+ var getParameters = function getParameters(isAssetHub, currencySelection, addressSelection, amount, fees, feeAsset) {
10124
10488
  if (isAssetHub) {
10125
10489
  return feeAsset !== undefined ? [currencySelection, feeAsset, addressSelection, fees] : [currencySelection, addressSelection, fees];
10126
10490
  }
10127
10491
  return [currencySelection, amount, addressSelection, fees];
10128
10492
  };
10493
+
10129
10494
  var XTokensTransferImpl = /*#__PURE__*/function () {
10130
10495
  function XTokensTransferImpl() {
10131
10496
  _classCallCheck(this, XTokensTransferImpl);
@@ -10135,7 +10500,6 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
10135
10500
  value: function transferXTokens(input, currencySelection) {
10136
10501
  var _api$tx$module;
10137
10502
  var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
10138
- var pallet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'XTokens';
10139
10503
  var api = input.api,
10140
10504
  amount = input.amount,
10141
10505
  addressSelection = input.addressSelection,
@@ -10146,9 +10510,9 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
10146
10510
  if (isMultiLocationDestination) {
10147
10511
  throw new Error('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
10148
10512
  }
10149
- var module = lowercaseFirstLetter(pallet.toString());
10150
10513
  var isAssetHub = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
10151
10514
  var modifiedCurrencySelection = getCurrencySelection(input, isAssetHub, currencySelection);
10515
+ var module = 'xTokens';
10152
10516
  var section = isAssetHub ? 'transferMultiasset' : 'transfer';
10153
10517
  var parameters = getParameters(isAssetHub, modifiedCurrencySelection, addressSelection, amount, fees, feeAsset);
10154
10518
  if (serializedApiCallEnabled === true) {
@@ -10744,7 +11108,7 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
10744
11108
  }
10745
11109
  return _createClass(PolkadotXCMTransferImpl, null, [{
10746
11110
  key: "transferPolkadotXCM",
10747
- value: function transferPolkadotXCM(_ref, method) {
11111
+ value: function transferPolkadotXCM(_ref, section) {
10748
11112
  var api = _ref.api,
10749
11113
  header = _ref.header,
10750
11114
  addressSelection = _ref.addressSelection,
@@ -10753,14 +11117,15 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
10753
11117
  feeAsset = _ref$feeAsset === void 0 ? DEFAULT_FEE_ASSET : _ref$feeAsset,
10754
11118
  serializedApiCallEnabled = _ref.serializedApiCallEnabled;
10755
11119
  var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
11120
+ var module = 'polkadotXcm';
10756
11121
  if (serializedApiCallEnabled === true) {
10757
11122
  return {
10758
- module: 'polkadotXcm',
10759
- section: method,
11123
+ module: module,
11124
+ section: section,
10760
11125
  parameters: [header, addressSelection, currencySelection, feeAsset].concat(_toConsumableArray(fees !== undefined ? [fees] : []))
10761
11126
  };
10762
11127
  }
10763
- return fees !== undefined ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, feeAsset, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, feeAsset);
11128
+ return fees !== undefined ? api.tx[module][section](header, addressSelection, currencySelection, feeAsset, fees) : api.tx[module][section](header, addressSelection, currencySelection, feeAsset);
10764
11129
  }
10765
11130
  }]);
10766
11131
  }();
@@ -10865,7 +11230,9 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
10865
11230
  }, {
10866
11231
  key: "transferPolkadotXCM",
10867
11232
  value: function transferPolkadotXCM(input) {
10868
- var scenario = input.scenario;
11233
+ var scenario = input.scenario,
11234
+ currencySymbol = input.currencySymbol,
11235
+ currencyId = input.currencyId;
10869
11236
  if (input.destination === 'AssetHubKusama') {
10870
11237
  return this.handleBridgeTransfer(input, 'Kusama');
10871
11238
  }
@@ -10875,8 +11242,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
10875
11242
  if (input.destination === 'Mythos') {
10876
11243
  return this.handleMythosTransfer(input);
10877
11244
  }
10878
- var method = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
10879
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11245
+ if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined) {
11246
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
11247
+ }
11248
+ if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
11249
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged KSM cannot currently be transfered from AssetHubPolkadot, if you are sending different KSM asset, please specify {id: <KSMID>}.');
11250
+ }
11251
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11252
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10880
11253
  }
10881
11254
  }, {
10882
11255
  key: "transferRelayToPara",
@@ -10897,7 +11270,8 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
10897
11270
  X2: [{
10898
11271
  PalletInstance: 50
10899
11272
  }, {
10900
- GeneralIndex: currencyId
11273
+ // TODO: Handle the case where currencyId is undefined
11274
+ GeneralIndex: currencyId !== null && currencyId !== void 0 ? currencyId : ''
10901
11275
  }]
10902
11276
  };
10903
11277
  return createCurrencySpec(amount, version, Parents.ZERO, overridedMultiLocation, interior);
@@ -10917,14 +11291,23 @@ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
10917
11291
  return _createClass(AssetHubKusama, [{
10918
11292
  key: "transferPolkadotXCM",
10919
11293
  value: function transferPolkadotXCM(input) {
11294
+ var destination = input.destination,
11295
+ currencySymbol = input.currencySymbol,
11296
+ currencyId = input.currencyId,
11297
+ scenario = input.scenario;
10920
11298
  // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
10921
11299
  // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
10922
- if (input.destination === 'AssetHubPolkadot') {
11300
+ if (destination === 'AssetHubPolkadot') {
10923
11301
  return getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot');
10924
11302
  }
10925
- var scenario = input.scenario;
10926
- var method = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
10927
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11303
+ if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
11304
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for KSM transfer from AssetHub are not supported, you have to transfer KSM to Relay chain and transfer to destination chain from Relay chain.');
11305
+ }
11306
+ if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined) {
11307
+ throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged DOT cannot currently be transfered from AssetHubKusama, if you are sending different DOT asset, please specify {id: <DOTID>}.');
11308
+ }
11309
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11310
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10928
11311
  }
10929
11312
  }, {
10930
11313
  key: "transferRelayToPara",
@@ -10959,8 +11342,8 @@ var CoretimeKusama = /*#__PURE__*/function (_ParachainNode) {
10959
11342
  value: function transferPolkadotXCM(input) {
10960
11343
  // TESTED block hash on Rococo: 0x78ace0f1bf7cac9a42e56143321b617d98327e2750f795efb0abb833025c9082
10961
11344
  var scenario = input.scenario;
10962
- var method = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
10963
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11345
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11346
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10964
11347
  }
10965
11348
  }, {
10966
11349
  key: "transferRelayToPara",
@@ -10978,6 +11361,42 @@ var CoretimeKusama = /*#__PURE__*/function (_ParachainNode) {
10978
11361
  }]);
10979
11362
  }(ParachainNode);
10980
11363
 
11364
+ var CoretimePolkadot = /*#__PURE__*/function (_ParachainNode) {
11365
+ function CoretimePolkadot() {
11366
+ var _this;
11367
+ _classCallCheck(this, CoretimePolkadot);
11368
+ _this = _callSuper(this, CoretimePolkadot, ['CoretimePolkadot', 'polkadotCoretime', 'polkadot', Version.V3]);
11369
+ _this._assetCheckEnabled = false;
11370
+ return _this;
11371
+ }
11372
+ _inherits(CoretimePolkadot, _ParachainNode);
11373
+ return _createClass(CoretimePolkadot, [{
11374
+ key: "transferPolkadotXCM",
11375
+ value: function transferPolkadotXCM(input) {
11376
+ var scenario = input.scenario;
11377
+ var section = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
11378
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
11379
+ }
11380
+ }, {
11381
+ key: "transferRelayToPara",
11382
+ value: function transferRelayToPara(options) {
11383
+ var _options$version = options.version,
11384
+ version = _options$version === void 0 ? Version.V3 : _options$version;
11385
+ return {
11386
+ module: 'xcmPallet',
11387
+ section: 'limitedTeleportAssets',
11388
+ parameters: constructRelayToParaParameters(options, version, true)
11389
+ };
11390
+ }
11391
+ }, {
11392
+ key: "getProvider",
11393
+ value: function getProvider() {
11394
+ // TODO: Temporary solution, will be solved after updating @polkadot/apps-config package
11395
+ return 'wss://polkadot-coretime-rpc.polkadot.io';
11396
+ }
11397
+ }]);
11398
+ }(ParachainNode);
11399
+
10981
11400
  var Encointer = /*#__PURE__*/function (_ParachainNode) {
10982
11401
  function Encointer() {
10983
11402
  _classCallCheck(this, Encointer);
@@ -11038,8 +11457,8 @@ var Astar = /*#__PURE__*/function (_ParachainNode) {
11038
11457
  key: "transferPolkadotXCM",
11039
11458
  value: function transferPolkadotXCM(input) {
11040
11459
  // TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
11041
- var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
11042
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
11460
+ var section = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
11461
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section);
11043
11462
  }
11044
11463
  }, {
11045
11464
  key: "transferXTokens",
@@ -11338,6 +11757,7 @@ var determineDestWeight = function determineDestWeight(destNode) {
11338
11757
  }
11339
11758
  throw new NodeNotSupportedError("Node ".concat(destNode, " is not supported"));
11340
11759
  };
11760
+
11341
11761
  var getDestination = function getDestination(_ref) {
11342
11762
  var recipientAddress = _ref.recipientAddress,
11343
11763
  paraId = _ref.paraId,
@@ -11365,6 +11785,7 @@ var getDestination = function getDestination(_ref) {
11365
11785
  }
11366
11786
  };
11367
11787
  };
11788
+
11368
11789
  var XTransferTransferImpl = /*#__PURE__*/function () {
11369
11790
  function XTransferTransferImpl() {
11370
11791
  _classCallCheck(this, XTransferTransferImpl);
@@ -11384,14 +11805,17 @@ var XTransferTransferImpl = /*#__PURE__*/function () {
11384
11805
  }
11385
11806
  var currencySpec = Object.values(createCurrencySpec(amount, Version.V1, Parents.ZERO, overridedCurrencyMultiLocation))[0][0];
11386
11807
  var dest = getDestination(input);
11808
+ var module = 'xTransfer';
11809
+ var section = 'transfer';
11810
+ var destWeight = origin === 'Khala' ? null : determineDestWeight(destination);
11387
11811
  if (serializedApiCallEnabled === true) {
11388
11812
  return {
11389
- module: 'xTransfer',
11390
- section: 'transfer',
11391
- parameters: [currencySpec, dest, origin === 'Khala' ? null : determineDestWeight(destination)]
11813
+ module: module,
11814
+ section: section,
11815
+ parameters: [currencySpec, dest, destWeight]
11392
11816
  };
11393
11817
  }
11394
- return api.tx.xTransfer.transfer(currencySpec, dest, origin === 'Khala' ? null : determineDestWeight(destination));
11818
+ return api.tx[module][section](currencySpec, dest, destWeight);
11395
11819
  }
11396
11820
  }]);
11397
11821
  }();
@@ -11508,8 +11932,8 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
11508
11932
  if (scenario === 'ParaToPara') {
11509
11933
  throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
11510
11934
  }
11511
- var method = 'limitedTeleportAssets';
11512
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11935
+ var section = 'limitedTeleportAssets';
11936
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
11513
11937
  }
11514
11938
  }, {
11515
11939
  key: "transferRelayToPara",
@@ -11541,8 +11965,8 @@ var BridgeHubKusama = /*#__PURE__*/function (_ParachainNode) {
11541
11965
  if (scenario === 'ParaToPara') {
11542
11966
  throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
11543
11967
  }
11544
- var method = 'limitedTeleportAssets';
11545
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
11968
+ var section = 'limitedTeleportAssets';
11969
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
11546
11970
  }
11547
11971
  }, {
11548
11972
  key: "transferRelayToPara",
@@ -11625,7 +12049,7 @@ var Peaq = /*#__PURE__*/function (_ParachainNode) {
11625
12049
  }]);
11626
12050
  }(ParachainNode);
11627
12051
 
11628
- var NODE_NAMES_DOT_KSM = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'Hydration', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq'];
12052
+ var NODE_NAMES_DOT_KSM = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'BridgeHubPolkadot', 'BridgeHubKusama', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'Hydration', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'CoretimePolkadot', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio', 'Mythos', 'Peaq'];
11629
12053
  var NODE_NAMES = [].concat(NODE_NAMES_DOT_KSM, ['Ethereum']);
11630
12054
  var NODES_WITH_RELAY_CHAINS = [].concat(_toConsumableArray(NODE_NAMES), ['Polkadot', 'Kusama']);
11631
12055
  var NODES_WITH_RELAY_CHAINS_DOT_KSM = [].concat(NODE_NAMES_DOT_KSM, ['Polkadot', 'Kusama']);
@@ -11649,6 +12073,7 @@ var nodes = {
11649
12073
  Parallel: new Parallel(),
11650
12074
  AssetHubKusama: new AssetHubKusama(),
11651
12075
  CoretimeKusama: new CoretimeKusama(),
12076
+ CoretimePolkadot: new CoretimePolkadot(),
11652
12077
  Encointer: new Encointer(),
11653
12078
  Altair: new Altair(),
11654
12079
  Amplitude: new Amplitude(),
@@ -11889,11 +12314,7 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
11889
12314
  }, _callee2);
11890
12315
  }));
11891
12316
  };
11892
- var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
11893
- return str.charAt(0).toLowerCase() + str.slice(1);
11894
- };
11895
- var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref10 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11896
- ) {
12317
+ var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref10) {
11897
12318
  var _api$tx$module;
11898
12319
  var module = _ref10.module,
11899
12320
  section = _ref10.section,
@@ -11928,10 +12349,26 @@ var KeepAliveError = /*#__PURE__*/function (_Error) {
11928
12349
  return _createClass(KeepAliveError);
11929
12350
  }(/*#__PURE__*/_wrapNativeSuper(Error));
11930
12351
 
11931
- var edMap = edMapJson;
11932
- var getExistentialDeposit = function getExistentialDeposit(node) {
11933
- return edMap[node];
12352
+ var calculateTransactionFee = function calculateTransactionFee(tx, address) {
12353
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12354
+ var _yield$tx$paymentInfo, partialFee;
12355
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12356
+ while (1) switch (_context.prev = _context.next) {
12357
+ case 0:
12358
+ _context.next = 2;
12359
+ return tx.paymentInfo(address);
12360
+ case 2:
12361
+ _yield$tx$paymentInfo = _context.sent;
12362
+ partialFee = _yield$tx$paymentInfo.partialFee;
12363
+ return _context.abrupt("return", partialFee.toBn());
12364
+ case 5:
12365
+ case "end":
12366
+ return _context.stop();
12367
+ }
12368
+ }, _callee);
12369
+ }));
11934
12370
  };
12371
+
11935
12372
  var createTx = function createTx(originApi, destApi, address, amount, currencySymbol, originNode, destNode) {
11936
12373
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11937
12374
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -11942,7 +12379,9 @@ var createTx = function createTx(originApi, destApi, address, amount, currencySy
11942
12379
  break;
11943
12380
  }
11944
12381
  _context.next = 3;
11945
- return Builder(destApi).from(destNode).to(originNode).currency(currencySymbol).amount(amount).address(address).build();
12382
+ return Builder(destApi).from(destNode).to(originNode).currency({
12383
+ symbol: currencySymbol
12384
+ }).amount(amount).address(address).build();
11946
12385
  case 3:
11947
12386
  return _context.abrupt("return", _context.sent);
11948
12387
  case 4:
@@ -11972,6 +12411,7 @@ var createTx = function createTx(originApi, destApi, address, amount, currencySy
11972
12411
  }, _callee);
11973
12412
  }));
11974
12413
  };
12414
+
11975
12415
  var checkKeepAlive = function checkKeepAlive(_a) {
11976
12416
  return __awaiter(void 0, [_a], void 0, function (_ref) {
11977
12417
  var originApi = _ref.originApi,
@@ -11981,66 +12421,66 @@ var checkKeepAlive = function checkKeepAlive(_a) {
11981
12421
  destApi = _ref.destApi,
11982
12422
  currencySymbol = _ref.currencySymbol,
11983
12423
  destNode = _ref.destNode;
11984
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
12424
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11985
12425
  var _yield$destApi$query$, data, balance, _yield$originApi$quer, originData, balanceOrigin, amountBN, ed, edOrigin, tx, xcmFee, amountBNWithoutFee, amountOriginBNWithoutFee;
11986
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11987
- while (1) switch (_context2.prev = _context2.next) {
12426
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
12427
+ while (1) switch (_context.prev = _context.next) {
11988
12428
  case 0:
11989
12429
  if (!(destApi === undefined)) {
11990
- _context2.next = 2;
12430
+ _context.next = 2;
11991
12431
  break;
11992
12432
  }
11993
- return _context2.abrupt("return");
12433
+ return _context.abrupt("return");
11994
12434
  case 2:
11995
12435
  if (!(currencySymbol === undefined)) {
11996
- _context2.next = 4;
12436
+ _context.next = 4;
11997
12437
  break;
11998
12438
  }
11999
12439
  throw new KeepAliveError('Currency symbol not found for this asset. Cannot check keep alive.');
12000
12440
  case 4:
12001
12441
  if (!(originNode !== undefined && destNode !== undefined && currencySymbol !== getAssetsObject(destNode).nativeAssetSymbol)) {
12002
- _context2.next = 6;
12442
+ _context.next = 6;
12003
12443
  break;
12004
12444
  }
12005
12445
  throw new KeepAliveError('Keep alive check is only supported when sending native asset of destination parachain.');
12006
12446
  case 6:
12007
- _context2.next = 8;
12447
+ _context.next = 8;
12008
12448
  return destApi.query.system.account(address);
12009
12449
  case 8:
12010
- _yield$destApi$query$ = _context2.sent;
12450
+ _yield$destApi$query$ = _context.sent;
12011
12451
  data = _yield$destApi$query$.data;
12012
12452
  balance = data.free.toBn();
12013
- _context2.next = 13;
12453
+ _context.next = 13;
12014
12454
  return originApi.query.system.account(address);
12015
12455
  case 13:
12016
- _yield$originApi$quer = _context2.sent;
12456
+ _yield$originApi$quer = _context.sent;
12017
12457
  originData = _yield$originApi$quer.data;
12018
12458
  balanceOrigin = originData.free.toBn();
12019
12459
  amountBN = new BN(amount);
12020
- ed = getExistentialDeposit(destNode !== null && destNode !== void 0 ? destNode : determineRelayChain(originNode));
12021
- edOrigin = getExistentialDeposit(originNode !== null && originNode !== void 0 ? originNode : determineRelayChain(destNode));
12022
- _context2.next = 21;
12460
+ ed = getExistentialDeposit$1(destNode !== null && destNode !== void 0 ? destNode : determineRelayChain(originNode));
12461
+ edOrigin = getExistentialDeposit$1(originNode !== null && originNode !== void 0 ? originNode : determineRelayChain(destNode));
12462
+ _context.next = 21;
12023
12463
  return createTx(originApi, destApi, address, amount, currencySymbol, originNode, destNode);
12024
12464
  case 21:
12025
- tx = _context2.sent;
12465
+ tx = _context.sent;
12026
12466
  if (!(tx === null)) {
12027
- _context2.next = 24;
12467
+ _context.next = 24;
12028
12468
  break;
12029
12469
  }
12030
12470
  throw new KeepAliveError('Transaction for XCM fee calculation could not be created.');
12031
12471
  case 24:
12032
- _context2.next = 26;
12033
- return calculateTransactionFee$1(tx, address);
12472
+ _context.next = 26;
12473
+ return calculateTransactionFee(tx, address);
12034
12474
  case 26:
12035
- xcmFee = _context2.sent;
12475
+ xcmFee = _context.sent;
12036
12476
  if (!(ed === null)) {
12037
- _context2.next = 29;
12477
+ _context.next = 29;
12038
12478
  break;
12039
12479
  }
12040
12480
  throw new KeepAliveError('Existential deposit not found for destination parachain.');
12041
12481
  case 29:
12042
12482
  if (!(edOrigin === null)) {
12043
- _context2.next = 31;
12483
+ _context.next = 31;
12044
12484
  break;
12045
12485
  }
12046
12486
  throw new KeepAliveError('Existential deposit not found for origin parachain.');
@@ -12056,98 +12496,77 @@ var checkKeepAlive = function checkKeepAlive(_a) {
12056
12496
  console.log('ORIGIN BALANCE - AMOUNT WITH FEE: ', balanceOrigin.sub(amountBN.sub(xcmFee.mul(new BN(1.5)))).toString());
12057
12497
  amountBNWithoutFee = amountBN.sub(xcmFee.mul(new BN(1.5)));
12058
12498
  if (!balance.add(amountBNWithoutFee).lt(new BN(ed))) {
12059
- _context2.next = 43;
12499
+ _context.next = 43;
12060
12500
  break;
12061
12501
  }
12062
- throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit.\n Please increase the amount to meet the minimum balance requirement of the destination chain."));
12502
+ throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit.\n Please increase the amount to meet the minimum balance requirement of the destination chain."));
12063
12503
  case 43:
12064
12504
  amountOriginBNWithoutFee = amountBN.sub(xcmFee.mul(new BN(1.5)));
12065
12505
  if (!((currencySymbol === 'DOT' || currencySymbol === 'KSM') && balanceOrigin.sub(amountOriginBNWithoutFee).lt(new BN(edOrigin)))) {
12066
- _context2.next = 46;
12506
+ _context.next = 46;
12067
12507
  break;
12068
12508
  }
12069
- throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit on origin.\n Please decrease the amount to meet the minimum balance requirement of the origin chain."));
12509
+ throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(currencySymbol, " to ").concat(destNode, " would result in an account balance below the required existential deposit on origin.\n Please decrease the amount to meet the minimum balance requirement of the origin chain."));
12070
12510
  case 46:
12071
12511
  case "end":
12072
- return _context2.stop();
12512
+ return _context.stop();
12073
12513
  }
12074
- }, _callee2);
12514
+ }, _callee);
12075
12515
  })();
12076
12516
  });
12077
12517
  };
12078
12518
 
12079
- var transformSendOptions = function transformSendOptions(options) {
12080
- var currency = options.currency;
12081
- if (isTCurrencySpecifier(currency)) {
12082
- if ('symbol' in currency) {
12083
- return Object.assign(Object.assign({}, options), {
12084
- currency: currency.symbol,
12085
- isSymbol: true
12086
- });
12087
- } else if ('id' in currency) {
12088
- return Object.assign(Object.assign({}, options), {
12089
- currency: currency.id,
12090
- isSymbol: false
12091
- });
12092
- }
12093
- }
12094
- return Object.assign(Object.assign({}, options), {
12095
- currency: currency,
12096
- isSymbol: undefined
12097
- });
12098
- };
12099
-
12100
12519
  var sendCommon = function sendCommon(options) {
12101
12520
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
12102
- var _a, _b, _transformSendOptions, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, isSymbol, _transformSendOptions2, serializedApiCallEnabled, isMultiLocationDestination, isMultiLocationCurrency, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, asset, apiWithFallback, amountStr, currencyStr;
12521
+ var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, _options$serializedAp, serializedApiCallEnabled, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, asset, apiWithFallback, amountStr, currencyStr;
12103
12522
  return _regeneratorRuntime().wrap(function _callee$(_context) {
12104
12523
  while (1) switch (_context.prev = _context.next) {
12105
12524
  case 0:
12106
- _transformSendOptions = transformSendOptions(options), api = _transformSendOptions.api, origin = _transformSendOptions.origin, currency = _transformSendOptions.currency, amount = _transformSendOptions.amount, address = _transformSendOptions.address, destination = _transformSendOptions.destination, paraIdTo = _transformSendOptions.paraIdTo, destApiForKeepAlive = _transformSendOptions.destApiForKeepAlive, feeAsset = _transformSendOptions.feeAsset, version = _transformSendOptions.version, isSymbol = _transformSendOptions.isSymbol, _transformSendOptions2 = _transformSendOptions.serializedApiCallEnabled, serializedApiCallEnabled = _transformSendOptions2 === void 0 ? false : _transformSendOptions2;
12107
- if (!((!isTMulti(currency) || isTMultiLocation(currency)) && amount === null)) {
12525
+ api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, version = options.version, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
12526
+ if (!((!('multiasset' in currency) || 'multilocation' in currency) && amount === null)) {
12108
12527
  _context.next = 3;
12109
12528
  break;
12110
12529
  }
12111
12530
  throw new Error('Amount is required');
12112
12531
  case 3:
12113
- if (!(typeof currency === 'number' && currency > Number.MAX_SAFE_INTEGER)) {
12532
+ if (!('id' in currency && typeof currency === 'number' && currency > Number.MAX_SAFE_INTEGER)) {
12114
12533
  _context.next = 5;
12115
12534
  break;
12116
12535
  }
12117
12536
  throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
12118
12537
  case 5:
12119
- if (!(isTMultiLocation(currency) && (feeAsset === 0 || feeAsset !== undefined))) {
12538
+ if (!('multilocation' in currency && (feeAsset === 0 || feeAsset !== undefined))) {
12120
12539
  _context.next = 7;
12121
12540
  break;
12122
12541
  }
12123
12542
  throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
12124
12543
  case 7:
12125
- if (!(isTMulti(currency) && Array.isArray(currency))) {
12544
+ if (!('multiasset' in currency)) {
12126
12545
  _context.next = 17;
12127
12546
  break;
12128
12547
  }
12129
12548
  if (amount !== null) {
12130
12549
  console.warn('Amount is ignored when using overriding currency using multiple multi locations. Please set it to null.');
12131
12550
  }
12132
- if (!(currency.length === 0)) {
12551
+ if (!(currency.multiasset.length === 0)) {
12133
12552
  _context.next = 11;
12134
12553
  break;
12135
12554
  }
12136
12555
  throw new InvalidCurrencyError('Overrided multi assets cannot be empty');
12137
12556
  case 11:
12138
- if (!(currency.length === 1 && (feeAsset === 0 || feeAsset !== undefined))) {
12557
+ if (!(currency.multiasset.length === 1 && (feeAsset === 0 || feeAsset !== undefined))) {
12139
12558
  _context.next = 13;
12140
12559
  break;
12141
12560
  }
12142
12561
  throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
12143
12562
  case 13:
12144
- if (!(currency.length > 1 && feeAsset === undefined)) {
12563
+ if (!(currency.multiasset.length > 1 && feeAsset === undefined)) {
12145
12564
  _context.next = 15;
12146
12565
  break;
12147
12566
  }
12148
12567
  throw new InvalidCurrencyError('Overrided multi assets cannot be used without specifying fee asset');
12149
12568
  case 15:
12150
- if (!(currency.length > 1 && feeAsset !== undefined && (feeAsset < 0 || feeAsset >= currency.length))) {
12569
+ if (!(currency.multiasset.length > 1 && feeAsset !== undefined && (feeAsset < 0 || feeAsset >= currency.multiasset.length))) {
12151
12570
  _context.next = 17;
12152
12571
  break;
12153
12572
  }
@@ -12160,95 +12579,94 @@ var sendCommon = function sendCommon(options) {
12160
12579
  throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot.');
12161
12580
  case 19:
12162
12581
  isMultiLocationDestination = _typeof(destination) === 'object';
12163
- isMultiLocationCurrency = _typeof(currency) === 'object';
12164
12582
  isBridge = origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
12165
12583
  isRelayDestination = destination === undefined;
12166
12584
  if (!(!isRelayDestination && !isMultiLocationDestination)) {
12167
- _context.next = 28;
12585
+ _context.next = 27;
12168
12586
  break;
12169
12587
  }
12170
12588
  originRelayChainSymbol = getRelayChainSymbol(origin);
12171
12589
  destinationRelayChainSymbol = getRelayChainSymbol(destination);
12172
12590
  if (!(!isBridge && originRelayChainSymbol !== destinationRelayChainSymbol)) {
12173
- _context.next = 28;
12591
+ _context.next = 27;
12174
12592
  break;
12175
12593
  }
12176
12594
  throw new IncompatibleNodesError();
12177
- case 28:
12595
+ case 27:
12178
12596
  originNode = getNode(origin);
12179
- assetCheckEnabled = isMultiLocationCurrency || isBridge ? false : originNode.assetCheckEnabled;
12180
- asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isSymbol, isTMultiLocation(destination) ? undefined : destination) : null;
12597
+ assetCheckEnabled = 'multilocation' in currency || 'multiasset' in currency || isBridge ? false : originNode.assetCheckEnabled;
12598
+ asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isTMultiLocation(destination) ? undefined : destination) : null;
12181
12599
  if (!(!isBridge && asset === null && assetCheckEnabled)) {
12182
- _context.next = 33;
12600
+ _context.next = 32;
12183
12601
  break;
12184
12602
  }
12185
- throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
12186
- case 33:
12187
- if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && isSymbol !== false && asset.assetId !== currency && !hasSupportForAsset(destination, asset.symbol))) {
12188
- _context.next = 35;
12603
+ throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency), "."));
12604
+ case 32:
12605
+ if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol))) {
12606
+ _context.next = 34;
12189
12607
  break;
12190
12608
  }
12191
- throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
12192
- case 35:
12609
+ throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
12610
+ case 34:
12193
12611
  if (!(api !== null && api !== void 0)) {
12194
- _context.next = 39;
12612
+ _context.next = 38;
12195
12613
  break;
12196
12614
  }
12197
12615
  _context.t0 = api;
12198
- _context.next = 42;
12199
- break;
12200
- case 39:
12201
12616
  _context.next = 41;
12617
+ break;
12618
+ case 38:
12619
+ _context.next = 40;
12202
12620
  return createApiInstanceForNode(origin);
12203
- case 41:
12621
+ case 40:
12204
12622
  _context.t0 = _context.sent;
12205
- case 42:
12623
+ case 41:
12206
12624
  apiWithFallback = _context.t0;
12207
12625
  amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
12208
- if (!isTMulti(currency)) {
12209
- _context.next = 48;
12626
+ if (!('multilocation' in currency || 'multiasset' in currency)) {
12627
+ _context.next = 47;
12210
12628
  break;
12211
12629
  }
12212
12630
  console.warn('Keep alive check is not supported when using MultiLocation as currency.');
12213
- _context.next = 62;
12631
+ _context.next = 61;
12214
12632
  break;
12215
- case 48:
12633
+ case 47:
12216
12634
  if (!(_typeof(address) === 'object')) {
12217
- _context.next = 52;
12635
+ _context.next = 51;
12218
12636
  break;
12219
12637
  }
12220
12638
  console.warn('Keep alive check is not supported when using MultiLocation as address.');
12221
- _context.next = 62;
12639
+ _context.next = 61;
12222
12640
  break;
12223
- case 52:
12641
+ case 51:
12224
12642
  if (!(_typeof(destination) === 'object')) {
12225
- _context.next = 56;
12643
+ _context.next = 55;
12226
12644
  break;
12227
12645
  }
12228
12646
  console.warn('Keep alive check is not supported when using MultiLocation as destination.');
12229
- _context.next = 62;
12647
+ _context.next = 61;
12230
12648
  break;
12231
- case 56:
12649
+ case 55:
12232
12650
  if (!(origin === 'Ethereum' || destination === 'Ethereum')) {
12233
- _context.next = 60;
12651
+ _context.next = 59;
12234
12652
  break;
12235
12653
  }
12236
12654
  console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
12237
- _context.next = 62;
12655
+ _context.next = 61;
12238
12656
  break;
12239
- case 60:
12240
- _context.next = 62;
12657
+ case 59:
12658
+ _context.next = 61;
12241
12659
  return checkKeepAlive({
12242
12660
  originApi: apiWithFallback,
12243
12661
  address: address,
12244
12662
  amount: amountStr !== null && amountStr !== void 0 ? amountStr : '',
12245
12663
  originNode: origin,
12246
12664
  destApi: destApiForKeepAlive,
12247
- currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : currency.toString(),
12665
+ currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : 'symbol' in currency ? currency.symbol : undefined,
12248
12666
  destNode: destination
12249
12667
  });
12250
- case 62:
12251
- currencyStr = isTMulti(currency) ? undefined : currency.toString();
12668
+ case 61:
12669
+ currencyStr = 'symbol' in currency ? currency.symbol : 'id' in currency ? currency.id.toString() : undefined;
12252
12670
  return _context.abrupt("return", originNode.transfer({
12253
12671
  api: apiWithFallback,
12254
12672
  currencySymbol: (_b = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _b !== void 0 ? _b : currencyStr,
@@ -12257,12 +12675,12 @@ var sendCommon = function sendCommon(options) {
12257
12675
  address: address,
12258
12676
  destination: destination,
12259
12677
  paraIdTo: paraIdTo,
12260
- overridedCurrencyMultiLocation: isTMulti(currency) ? currency : undefined,
12678
+ overridedCurrencyMultiLocation: 'multilocation' in currency ? currency.multilocation : 'multiasset' in currency ? currency.multiasset : undefined,
12261
12679
  feeAsset: feeAsset,
12262
12680
  version: version,
12263
12681
  serializedApiCallEnabled: serializedApiCallEnabled
12264
12682
  }));
12265
- case 64:
12683
+ case 63:
12266
12684
  case "end":
12267
12685
  return _context.stop();
12268
12686
  }
@@ -12299,11 +12717,11 @@ var send = function send(options) {
12299
12717
  };
12300
12718
  var transferRelayToParaCommon = function transferRelayToParaCommon(options) {
12301
12719
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
12302
- var api, destination, amount, address, paraIdTo, destApiForKeepAlive, version, _options$serializedAp, serializedApiCallEnabled, isMultiLocationDestination, isAddressMultiLocation, apiWithFallback, amountStr, serializedApiCall;
12720
+ var api, destination, amount, address, paraIdTo, destApiForKeepAlive, version, _options$serializedAp2, serializedApiCallEnabled, isMultiLocationDestination, isAddressMultiLocation, apiWithFallback, amountStr, serializedApiCall;
12303
12721
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
12304
12722
  while (1) switch (_context4.prev = _context4.next) {
12305
12723
  case 0:
12306
- api = options.api, destination = options.destination, amount = options.amount, address = options.address, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
12724
+ api = options.api, destination = options.destination, amount = options.amount, address = options.address, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, _options$serializedAp2 = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp2 === void 0 ? false : _options$serializedAp2;
12307
12725
  isMultiLocationDestination = _typeof(destination) === 'object';
12308
12726
  isAddressMultiLocation = _typeof(address) === 'object';
12309
12727
  if (!(api === undefined && isMultiLocationDestination)) {
@@ -12453,7 +12871,8 @@ var buildEthTransferOptions = function buildEthTransferOptions(_a) {
12453
12871
  token: plan.success.token,
12454
12872
  destinationParaId: plan.success.destinationParaId,
12455
12873
  destinationFee: plan.success.destinationFee,
12456
- amount: plan.success.amount
12874
+ amount: plan.success.amount,
12875
+ fee: plan.success.fee
12457
12876
  });
12458
12877
  case 15:
12459
12878
  case "end":
@@ -12474,4 +12893,4 @@ var index = /*#__PURE__*/Object.freeze({
12474
12893
  transferRelayToParaSerializedApiCall: transferRelayToParaSerializedApiCall
12475
12894
  });
12476
12895
 
12477
- export { BatchMode, Builder, CloseChannelBuilder, DuplicateAssetError, EvmBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, OpenChannelBuilder, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$1 as assets, buildEthTransferOptions, index$3 as closeChannels, createApiInstanceForNode, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, index$2 as openChannels, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index as xcmPallet };
12896
+ export { BatchMode, Builder, DuplicateAssetError, EvmBuilder, GeneralBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$1 as assets, buildEthTransferOptions, createApiInstanceForNode, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit$1 as getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index as xcmPallet };