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