@paraspell/sdk 1.1.10 → 1.1.12
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/README.md +1 -1
- package/dist/index.cjs +205 -173
- package/dist/index.d.ts +27 -4
- package/dist/index.mjs +206 -174
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,19 @@ import '@polkadot/api';
|
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import '@polkadot/apps-config/endpoints';
|
|
4
4
|
|
|
5
|
+
// derrived from https://github.com/kodadot/packages/blob/main/minimark/src/common/types.ts
|
|
6
|
+
var TType;
|
|
7
|
+
(function (TType) {
|
|
8
|
+
TType["CONSTS"] = "consts";
|
|
9
|
+
TType["QUERY"] = "query";
|
|
10
|
+
TType["TX"] = "tx";
|
|
11
|
+
})(TType || (TType = {}));
|
|
12
|
+
var Version;
|
|
13
|
+
(function (Version) {
|
|
14
|
+
Version[Version["V1"] = 0] = "V1";
|
|
15
|
+
Version[Version["V3"] = 1] = "V3";
|
|
16
|
+
})(Version || (Version = {}));
|
|
17
|
+
|
|
5
18
|
function _classCallCheck(instance, Constructor) {
|
|
6
19
|
if (!(instance instanceof Constructor)) {
|
|
7
20
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -3680,11 +3693,12 @@ var supportsPolkadotXCM = function supportsPolkadotXCM(obj) {
|
|
|
3680
3693
|
return 'transferPolkadotXCM' in obj;
|
|
3681
3694
|
};
|
|
3682
3695
|
var ParachainNode = /*#__PURE__*/function () {
|
|
3683
|
-
function ParachainNode(node, name, type) {
|
|
3696
|
+
function ParachainNode(node, name, type, version) {
|
|
3684
3697
|
_classCallCheck(this, ParachainNode);
|
|
3685
3698
|
this._name = name;
|
|
3686
3699
|
this._type = type;
|
|
3687
3700
|
this._node = node;
|
|
3701
|
+
this._version = version;
|
|
3688
3702
|
}
|
|
3689
3703
|
_createClass(ParachainNode, [{
|
|
3690
3704
|
key: "name",
|
|
@@ -3701,9 +3715,15 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3701
3715
|
get: function get() {
|
|
3702
3716
|
return this._node;
|
|
3703
3717
|
}
|
|
3718
|
+
}, {
|
|
3719
|
+
key: "version",
|
|
3720
|
+
get: function get() {
|
|
3721
|
+
return this._version;
|
|
3722
|
+
}
|
|
3704
3723
|
}, {
|
|
3705
3724
|
key: "transfer",
|
|
3706
3725
|
value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
|
|
3726
|
+
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
3707
3727
|
var scenario = destination ? 'ParaToPara' : 'ParaToRelay';
|
|
3708
3728
|
var paraId = destination ? getParaId(destination) : undefined;
|
|
3709
3729
|
if (supportsXTokens(this)) {
|
|
@@ -3712,16 +3732,18 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3712
3732
|
currency: currencySymbol,
|
|
3713
3733
|
currencyID: currencyId,
|
|
3714
3734
|
amount: amount,
|
|
3715
|
-
addressSelection: handleAddress(scenario, 'xTokens', api, to,
|
|
3716
|
-
fees: getFees(scenario)
|
|
3735
|
+
addressSelection: handleAddress(scenario, 'xTokens', api, to, this.version, paraId),
|
|
3736
|
+
fees: getFees(scenario),
|
|
3737
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
3717
3738
|
});
|
|
3718
3739
|
} else if (supportsPolkadotXCM(this)) {
|
|
3719
3740
|
return this.transferPolkadotXCM({
|
|
3720
3741
|
api: api,
|
|
3721
|
-
header: createHeaderPolkadotXCM(scenario,
|
|
3722
|
-
addressSelection: handleAddress(scenario, 'polkadotXCM', api, to,
|
|
3723
|
-
currencySelection: createCurrencySpecification(amount, scenario, this._node, currencyId),
|
|
3724
|
-
scenario: scenario
|
|
3742
|
+
header: createHeaderPolkadotXCM(scenario, this.version, paraId),
|
|
3743
|
+
addressSelection: handleAddress(scenario, 'polkadotXCM', api, to, this.version, paraId),
|
|
3744
|
+
currencySelection: createCurrencySpecification(amount, scenario, this.version, this._node, currencyId),
|
|
3745
|
+
scenario: scenario,
|
|
3746
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
3725
3747
|
});
|
|
3726
3748
|
} else {
|
|
3727
3749
|
throw new NoXCMSupportImplementedError(this._node);
|
|
@@ -3740,10 +3762,20 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
3740
3762
|
value: function transferXTokens(_ref, currencySelection) {
|
|
3741
3763
|
var api = _ref.api,
|
|
3742
3764
|
amount = _ref.amount,
|
|
3743
|
-
addressSelection = _ref.addressSelection
|
|
3765
|
+
addressSelection = _ref.addressSelection,
|
|
3766
|
+
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
3744
3767
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
|
|
3745
3768
|
var pallet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'XTokens';
|
|
3746
|
-
|
|
3769
|
+
var module = lowercaseFirstLetter(pallet.toString());
|
|
3770
|
+
if (serializedApiCallEnabled) {
|
|
3771
|
+
return {
|
|
3772
|
+
type: TType.TX,
|
|
3773
|
+
module: module,
|
|
3774
|
+
section: 'transfer',
|
|
3775
|
+
parameters: [currencySelection, amount, addressSelection, fees]
|
|
3776
|
+
};
|
|
3777
|
+
}
|
|
3778
|
+
return api.tx[module].transfer(currencySelection, amount, addressSelection, fees);
|
|
3747
3779
|
}
|
|
3748
3780
|
}]);
|
|
3749
3781
|
return XTokensTransferImpl;
|
|
@@ -3754,7 +3786,7 @@ var Acala$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3754
3786
|
var _super = _createSuper(Acala);
|
|
3755
3787
|
function Acala() {
|
|
3756
3788
|
_classCallCheck(this, Acala);
|
|
3757
|
-
return _super.call(this, 'Acala', 'acala', 'polkadot');
|
|
3789
|
+
return _super.call(this, 'Acala', 'acala', 'polkadot', Version.V1);
|
|
3758
3790
|
}
|
|
3759
3791
|
_createClass(Acala, [{
|
|
3760
3792
|
key: "transferXTokens",
|
|
@@ -3777,7 +3809,7 @@ var Unique$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3777
3809
|
var _super = _createSuper(Unique);
|
|
3778
3810
|
function Unique() {
|
|
3779
3811
|
_classCallCheck(this, Unique);
|
|
3780
|
-
return _super.call(this, 'Unique', 'unique', 'polkadot');
|
|
3812
|
+
return _super.call(this, 'Unique', 'unique', 'polkadot', Version.V3);
|
|
3781
3813
|
}
|
|
3782
3814
|
_createClass(Unique, [{
|
|
3783
3815
|
key: "transferXTokens",
|
|
@@ -3809,7 +3841,7 @@ var Crust$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3809
3841
|
var _super = _createSuper(Crust);
|
|
3810
3842
|
function Crust() {
|
|
3811
3843
|
_classCallCheck(this, Crust);
|
|
3812
|
-
return _super.call(this, 'Crust', 'crustParachain', 'polkadot');
|
|
3844
|
+
return _super.call(this, 'Crust', 'crustParachain', 'polkadot', Version.V1);
|
|
3813
3845
|
}
|
|
3814
3846
|
_createClass(Crust, [{
|
|
3815
3847
|
key: "getCurrencySelection",
|
|
@@ -3840,7 +3872,7 @@ var Efinity$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3840
3872
|
var _super = _createSuper(Efinity);
|
|
3841
3873
|
function Efinity() {
|
|
3842
3874
|
_classCallCheck(this, Efinity);
|
|
3843
|
-
return _super.call(this, 'Efinity', 'efinity', 'polkadot');
|
|
3875
|
+
return _super.call(this, 'Efinity', 'efinity', 'polkadot', Version.V3);
|
|
3844
3876
|
}
|
|
3845
3877
|
_createClass(Efinity, [{
|
|
3846
3878
|
key: "transferXTokens",
|
|
@@ -3859,7 +3891,7 @@ var BifrostPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3859
3891
|
var _super = _createSuper(BifrostPolkadot);
|
|
3860
3892
|
function BifrostPolkadot() {
|
|
3861
3893
|
_classCallCheck(this, BifrostPolkadot);
|
|
3862
|
-
return _super.call(this, 'BifrostPolkadot', 'bifrost', 'polkadot');
|
|
3894
|
+
return _super.call(this, 'BifrostPolkadot', 'bifrost', 'polkadot', Version.V3);
|
|
3863
3895
|
}
|
|
3864
3896
|
_createClass(BifrostPolkadot, [{
|
|
3865
3897
|
key: "transferXTokens",
|
|
@@ -3879,7 +3911,7 @@ var Bitgreen$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3879
3911
|
var _super = _createSuper(Bitgreen);
|
|
3880
3912
|
function Bitgreen() {
|
|
3881
3913
|
_classCallCheck(this, Bitgreen);
|
|
3882
|
-
return _super.call(this, 'Bitgreen', 'bitgreen', 'polkadot');
|
|
3914
|
+
return _super.call(this, 'Bitgreen', 'bitgreen', 'polkadot', Version.V1);
|
|
3883
3915
|
}
|
|
3884
3916
|
return _createClass(Bitgreen);
|
|
3885
3917
|
}(ParachainNode);
|
|
@@ -3889,7 +3921,7 @@ var Centrifuge$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3889
3921
|
var _super = _createSuper(Centrifuge);
|
|
3890
3922
|
function Centrifuge() {
|
|
3891
3923
|
_classCallCheck(this, Centrifuge);
|
|
3892
|
-
return _super.call(this, 'Centrifuge', 'centrifuge', 'polkadot');
|
|
3924
|
+
return _super.call(this, 'Centrifuge', 'centrifuge', 'polkadot', Version.V1);
|
|
3893
3925
|
}
|
|
3894
3926
|
_createClass(Centrifuge, [{
|
|
3895
3927
|
key: "transferXTokens",
|
|
@@ -3910,7 +3942,7 @@ var Clover$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3910
3942
|
var _super = _createSuper(Clover);
|
|
3911
3943
|
function Clover() {
|
|
3912
3944
|
_classCallCheck(this, Clover);
|
|
3913
|
-
return _super.call(this, 'Clover', 'clover', 'polkadot');
|
|
3945
|
+
return _super.call(this, 'Clover', 'clover', 'polkadot', Version.V1);
|
|
3914
3946
|
}
|
|
3915
3947
|
_createClass(Clover, [{
|
|
3916
3948
|
key: "getCurrencySelection",
|
|
@@ -3941,7 +3973,7 @@ var ComposableFinance$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3941
3973
|
var _super = _createSuper(ComposableFinance);
|
|
3942
3974
|
function ComposableFinance() {
|
|
3943
3975
|
_classCallCheck(this, ComposableFinance);
|
|
3944
|
-
return _super.call(this, 'ComposableFinance', 'composableFinance', 'polkadot');
|
|
3976
|
+
return _super.call(this, 'ComposableFinance', 'composableFinance', 'polkadot', Version.V3);
|
|
3945
3977
|
}
|
|
3946
3978
|
return _createClass(ComposableFinance);
|
|
3947
3979
|
}(ParachainNode);
|
|
@@ -3951,14 +3983,14 @@ var HydraDX$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3951
3983
|
var _super = _createSuper(HydraDX);
|
|
3952
3984
|
function HydraDX() {
|
|
3953
3985
|
_classCallCheck(this, HydraDX);
|
|
3954
|
-
return _super.call(this, 'HydraDX', 'hydra', 'polkadot');
|
|
3986
|
+
return _super.call(this, 'HydraDX', 'hydra', 'polkadot', Version.V3);
|
|
3955
3987
|
}
|
|
3956
3988
|
_createClass(HydraDX, [{
|
|
3957
3989
|
key: "transferXTokens",
|
|
3958
3990
|
value: function transferXTokens(input) {
|
|
3959
|
-
var currencyID = input.currencyID
|
|
3960
|
-
|
|
3961
|
-
return XTokensTransferImpl.transferXTokens(input, currencyID
|
|
3991
|
+
var currencyID = input.currencyID;
|
|
3992
|
+
input.fees;
|
|
3993
|
+
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
3962
3994
|
}
|
|
3963
3995
|
}]);
|
|
3964
3996
|
return HydraDX;
|
|
@@ -3969,7 +4001,7 @@ var Interlay$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3969
4001
|
var _super = _createSuper(Interlay);
|
|
3970
4002
|
function Interlay() {
|
|
3971
4003
|
_classCallCheck(this, Interlay);
|
|
3972
|
-
return _super.call(this, 'Interlay', 'interlay', 'polkadot');
|
|
4004
|
+
return _super.call(this, 'Interlay', 'interlay', 'polkadot', Version.V3);
|
|
3973
4005
|
}
|
|
3974
4006
|
_createClass(Interlay, [{
|
|
3975
4007
|
key: "transferXTokens",
|
|
@@ -3992,7 +4024,7 @@ var Kylin$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3992
4024
|
var _super = _createSuper(Kylin);
|
|
3993
4025
|
function Kylin() {
|
|
3994
4026
|
_classCallCheck(this, Kylin);
|
|
3995
|
-
return _super.call(this, 'Kylin', 'kylin', 'polkadot');
|
|
4027
|
+
return _super.call(this, 'Kylin', 'kylin', 'polkadot', Version.V1);
|
|
3996
4028
|
}
|
|
3997
4029
|
_createClass(Kylin, [{
|
|
3998
4030
|
key: "transferXTokens",
|
|
@@ -4010,7 +4042,7 @@ var Litentry$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4010
4042
|
var _super = _createSuper(Litentry);
|
|
4011
4043
|
function Litentry() {
|
|
4012
4044
|
_classCallCheck(this, Litentry);
|
|
4013
|
-
return _super.call(this, 'Litentry', 'litentry', 'polkadot');
|
|
4045
|
+
return _super.call(this, 'Litentry', 'litentry', 'polkadot', Version.V1);
|
|
4014
4046
|
}
|
|
4015
4047
|
_createClass(Litentry, [{
|
|
4016
4048
|
key: "transferXTokens",
|
|
@@ -4026,7 +4058,7 @@ var Moonbeam$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4026
4058
|
var _super = _createSuper(Moonbeam);
|
|
4027
4059
|
function Moonbeam() {
|
|
4028
4060
|
_classCallCheck(this, Moonbeam);
|
|
4029
|
-
return _super.call(this, 'Moonbeam', 'moonbeam', 'polkadot');
|
|
4061
|
+
return _super.call(this, 'Moonbeam', 'moonbeam', 'polkadot', Version.V3);
|
|
4030
4062
|
}
|
|
4031
4063
|
_createClass(Moonbeam, [{
|
|
4032
4064
|
key: "transferXTokens",
|
|
@@ -4047,7 +4079,7 @@ var Parallel$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4047
4079
|
var _super = _createSuper(Parallel);
|
|
4048
4080
|
function Parallel() {
|
|
4049
4081
|
_classCallCheck(this, Parallel);
|
|
4050
|
-
return _super.call(this, 'Parallel', 'parallel', 'polkadot');
|
|
4082
|
+
return _super.call(this, 'Parallel', 'parallel', 'polkadot', Version.V1);
|
|
4051
4083
|
}
|
|
4052
4084
|
_createClass(Parallel, [{
|
|
4053
4085
|
key: "transferXTokens",
|
|
@@ -4063,7 +4095,7 @@ var Altair$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4063
4095
|
var _super = _createSuper(Altair);
|
|
4064
4096
|
function Altair() {
|
|
4065
4097
|
_classCallCheck(this, Altair);
|
|
4066
|
-
return _super.call(this, 'Altair', 'altair', 'kusama');
|
|
4098
|
+
return _super.call(this, 'Altair', 'altair', 'kusama', Version.V1);
|
|
4067
4099
|
}
|
|
4068
4100
|
_createClass(Altair, [{
|
|
4069
4101
|
key: "transferXTokens",
|
|
@@ -4091,7 +4123,7 @@ var Amplitude$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4091
4123
|
var _super = _createSuper(Amplitude);
|
|
4092
4124
|
function Amplitude() {
|
|
4093
4125
|
_classCallCheck(this, Amplitude);
|
|
4094
|
-
return _super.call(this, 'Amplitude', 'amplitude', 'kusama');
|
|
4126
|
+
return _super.call(this, 'Amplitude', 'amplitude', 'kusama', Version.V1);
|
|
4095
4127
|
}
|
|
4096
4128
|
_createClass(Amplitude, [{
|
|
4097
4129
|
key: "transferXTokens",
|
|
@@ -4109,7 +4141,7 @@ var Bajun$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4109
4141
|
var _super = _createSuper(Bajun);
|
|
4110
4142
|
function Bajun() {
|
|
4111
4143
|
_classCallCheck(this, Bajun);
|
|
4112
|
-
return _super.call(this, 'Bajun', 'bajun', 'kusama');
|
|
4144
|
+
return _super.call(this, 'Bajun', 'bajun', 'kusama', Version.V1);
|
|
4113
4145
|
}
|
|
4114
4146
|
return _createClass(Bajun);
|
|
4115
4147
|
}(ParachainNode);
|
|
@@ -4119,14 +4151,13 @@ var Basilisk$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4119
4151
|
var _super = _createSuper(Basilisk);
|
|
4120
4152
|
function Basilisk() {
|
|
4121
4153
|
_classCallCheck(this, Basilisk);
|
|
4122
|
-
return _super.call(this, 'Basilisk', 'basilisk', 'kusama');
|
|
4154
|
+
return _super.call(this, 'Basilisk', 'basilisk', 'kusama', Version.V3);
|
|
4123
4155
|
}
|
|
4124
4156
|
_createClass(Basilisk, [{
|
|
4125
4157
|
key: "transferXTokens",
|
|
4126
4158
|
value: function transferXTokens(input) {
|
|
4127
|
-
var currencyID = input.currencyID
|
|
4128
|
-
|
|
4129
|
-
return XTokensTransferImpl.transferXTokens(input, currencyID, fees);
|
|
4159
|
+
var currencyID = input.currencyID;
|
|
4160
|
+
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
4130
4161
|
}
|
|
4131
4162
|
}]);
|
|
4132
4163
|
return Basilisk;
|
|
@@ -4137,7 +4168,7 @@ var BifrostKusama$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4137
4168
|
var _super = _createSuper(BifrostKusama);
|
|
4138
4169
|
function BifrostKusama() {
|
|
4139
4170
|
_classCallCheck(this, BifrostKusama);
|
|
4140
|
-
return _super.call(this, 'BifrostKusama', 'bifrost', 'kusama');
|
|
4171
|
+
return _super.call(this, 'BifrostKusama', 'bifrost', 'kusama', Version.V3);
|
|
4141
4172
|
}
|
|
4142
4173
|
_createClass(BifrostKusama, [{
|
|
4143
4174
|
key: "transferXTokens",
|
|
@@ -4156,7 +4187,7 @@ var Pioneer$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4156
4187
|
var _super = _createSuper(Pioneer);
|
|
4157
4188
|
function Pioneer() {
|
|
4158
4189
|
_classCallCheck(this, Pioneer);
|
|
4159
|
-
return _super.call(this, 'Pioneer', 'bitcountryPioneer', 'kusama');
|
|
4190
|
+
return _super.call(this, 'Pioneer', 'bitcountryPioneer', 'kusama', Version.V1);
|
|
4160
4191
|
}
|
|
4161
4192
|
_createClass(Pioneer, [{
|
|
4162
4193
|
key: "transferXTokens",
|
|
@@ -4173,14 +4204,14 @@ var Turing$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4173
4204
|
var _super = _createSuper(Turing);
|
|
4174
4205
|
function Turing() {
|
|
4175
4206
|
_classCallCheck(this, Turing);
|
|
4176
|
-
return _super.call(this, 'Turing', 'turing', 'kusama');
|
|
4207
|
+
return _super.call(this, 'Turing', 'turing', 'kusama', Version.V3);
|
|
4177
4208
|
}
|
|
4178
4209
|
_createClass(Turing, [{
|
|
4179
4210
|
key: "transferXTokens",
|
|
4180
4211
|
value: function transferXTokens(input) {
|
|
4181
|
-
var currencyID = input.currencyID
|
|
4182
|
-
|
|
4183
|
-
return XTokensTransferImpl.transferXTokens(input, currencyID
|
|
4212
|
+
var currencyID = input.currencyID;
|
|
4213
|
+
input.fees;
|
|
4214
|
+
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
4184
4215
|
}
|
|
4185
4216
|
}]);
|
|
4186
4217
|
return Turing;
|
|
@@ -4191,7 +4222,7 @@ var Pichiu$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4191
4222
|
var _super = _createSuper(Pichiu);
|
|
4192
4223
|
function Pichiu() {
|
|
4193
4224
|
_classCallCheck(this, Pichiu);
|
|
4194
|
-
return _super.call(this, 'Pichiu', 'pichiu', 'kusama');
|
|
4225
|
+
return _super.call(this, 'Pichiu', 'pichiu', 'kusama', Version.V1);
|
|
4195
4226
|
}
|
|
4196
4227
|
_createClass(Pichiu, [{
|
|
4197
4228
|
key: "transferXTokens",
|
|
@@ -4209,7 +4240,7 @@ var Picasso$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4209
4240
|
var _super = _createSuper(Picasso);
|
|
4210
4241
|
function Picasso() {
|
|
4211
4242
|
_classCallCheck(this, Picasso);
|
|
4212
|
-
return _super.call(this, 'Picasso', 'picasso', 'kusama');
|
|
4243
|
+
return _super.call(this, 'Picasso', 'picasso', 'kusama', Version.V3);
|
|
4213
4244
|
}
|
|
4214
4245
|
_createClass(Picasso, [{
|
|
4215
4246
|
key: "transferXTokens",
|
|
@@ -4225,7 +4256,7 @@ var ParallelHeiko$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4225
4256
|
var _super = _createSuper(ParallelHeiko);
|
|
4226
4257
|
function ParallelHeiko() {
|
|
4227
4258
|
_classCallCheck(this, ParallelHeiko);
|
|
4228
|
-
return _super.call(this, 'ParallelHeiko', 'heiko', 'kusama');
|
|
4259
|
+
return _super.call(this, 'ParallelHeiko', 'heiko', 'kusama', Version.V1);
|
|
4229
4260
|
}
|
|
4230
4261
|
_createClass(ParallelHeiko, [{
|
|
4231
4262
|
key: "transferXTokens",
|
|
@@ -4241,7 +4272,7 @@ var Moonriver$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4241
4272
|
var _super = _createSuper(Moonriver);
|
|
4242
4273
|
function Moonriver() {
|
|
4243
4274
|
_classCallCheck(this, Moonriver);
|
|
4244
|
-
return _super.call(this, 'Moonriver', 'moonriver', 'kusama');
|
|
4275
|
+
return _super.call(this, 'Moonriver', 'moonriver', 'kusama', Version.V3);
|
|
4245
4276
|
}
|
|
4246
4277
|
_createClass(Moonriver, [{
|
|
4247
4278
|
key: "transferXTokens",
|
|
@@ -4262,7 +4293,7 @@ var Mangata$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4262
4293
|
var _super = _createSuper(Mangata);
|
|
4263
4294
|
function Mangata() {
|
|
4264
4295
|
_classCallCheck(this, Mangata);
|
|
4265
|
-
return _super.call(this, 'Mangata', 'mangata', 'kusama');
|
|
4296
|
+
return _super.call(this, 'Mangata', 'mangata', 'kusama', Version.V3);
|
|
4266
4297
|
}
|
|
4267
4298
|
_createClass(Mangata, [{
|
|
4268
4299
|
key: "transferXTokens",
|
|
@@ -4278,7 +4309,7 @@ var Litmus$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4278
4309
|
var _super = _createSuper(Litmus);
|
|
4279
4310
|
function Litmus() {
|
|
4280
4311
|
_classCallCheck(this, Litmus);
|
|
4281
|
-
return _super.call(this, 'Litmus', 'litmus', 'kusama');
|
|
4312
|
+
return _super.call(this, 'Litmus', 'litmus', 'kusama', Version.V1);
|
|
4282
4313
|
}
|
|
4283
4314
|
_createClass(Litmus, [{
|
|
4284
4315
|
key: "transferXTokens",
|
|
@@ -4295,7 +4326,7 @@ var Kintsugi$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4295
4326
|
var _super = _createSuper(Kintsugi);
|
|
4296
4327
|
function Kintsugi() {
|
|
4297
4328
|
_classCallCheck(this, Kintsugi);
|
|
4298
|
-
return _super.call(this, 'Kintsugi', 'kintsugi', 'kusama');
|
|
4329
|
+
return _super.call(this, 'Kintsugi', 'kintsugi', 'kusama', Version.V3);
|
|
4299
4330
|
}
|
|
4300
4331
|
_createClass(Kintsugi, [{
|
|
4301
4332
|
key: "transferXTokens",
|
|
@@ -4318,7 +4349,7 @@ var Kico$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4318
4349
|
var _super = _createSuper(Kico);
|
|
4319
4350
|
function Kico() {
|
|
4320
4351
|
_classCallCheck(this, Kico);
|
|
4321
|
-
return _super.call(this, 'Kico', 'kico', 'kusama');
|
|
4352
|
+
return _super.call(this, 'Kico', 'kico', 'kusama', Version.V1);
|
|
4322
4353
|
}
|
|
4323
4354
|
_createClass(Kico, [{
|
|
4324
4355
|
key: "transferXTokens",
|
|
@@ -4336,7 +4367,7 @@ var Calamari$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4336
4367
|
var _super = _createSuper(Calamari);
|
|
4337
4368
|
function Calamari() {
|
|
4338
4369
|
_classCallCheck(this, Calamari);
|
|
4339
|
-
return _super.call(this, 'Calamari', 'calamari', 'kusama');
|
|
4370
|
+
return _super.call(this, 'Calamari', 'calamari', 'kusama', Version.V1);
|
|
4340
4371
|
}
|
|
4341
4372
|
_createClass(Calamari, [{
|
|
4342
4373
|
key: "transferXTokens",
|
|
@@ -4357,7 +4388,7 @@ var CrustShadow$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4357
4388
|
var _super = _createSuper(CrustShadow);
|
|
4358
4389
|
function CrustShadow() {
|
|
4359
4390
|
_classCallCheck(this, CrustShadow);
|
|
4360
|
-
return _super.call(this, 'CrustShadow', 'shadow', 'kusama');
|
|
4391
|
+
return _super.call(this, 'CrustShadow', 'shadow', 'kusama', Version.V1);
|
|
4361
4392
|
}
|
|
4362
4393
|
_createClass(CrustShadow, [{
|
|
4363
4394
|
key: "getCurrencySelection",
|
|
@@ -4388,7 +4419,7 @@ var Dorafactory$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4388
4419
|
var _super = _createSuper(Dorafactory);
|
|
4389
4420
|
function Dorafactory() {
|
|
4390
4421
|
_classCallCheck(this, Dorafactory);
|
|
4391
|
-
return _super.call(this, 'Dorafactory', 'dorafactory', 'kusama');
|
|
4422
|
+
return _super.call(this, 'Dorafactory', 'dorafactory', 'kusama', Version.V1);
|
|
4392
4423
|
}
|
|
4393
4424
|
_createClass(Dorafactory, [{
|
|
4394
4425
|
key: "transferXTokens",
|
|
@@ -4406,14 +4437,14 @@ var Imbue$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4406
4437
|
var _super = _createSuper(Imbue);
|
|
4407
4438
|
function Imbue() {
|
|
4408
4439
|
_classCallCheck(this, Imbue);
|
|
4409
|
-
return _super.call(this, 'Imbue', 'imbue', 'kusama');
|
|
4440
|
+
return _super.call(this, 'Imbue', 'imbue', 'kusama', Version.V3);
|
|
4410
4441
|
}
|
|
4411
4442
|
_createClass(Imbue, [{
|
|
4412
4443
|
key: "transferXTokens",
|
|
4413
4444
|
value: function transferXTokens(input) {
|
|
4414
|
-
var currency = input.currency
|
|
4415
|
-
|
|
4416
|
-
return XTokensTransferImpl.transferXTokens(input, currency
|
|
4445
|
+
var currency = input.currency;
|
|
4446
|
+
input.fees;
|
|
4447
|
+
return XTokensTransferImpl.transferXTokens(input, currency);
|
|
4417
4448
|
}
|
|
4418
4449
|
}]);
|
|
4419
4450
|
return Imbue;
|
|
@@ -4424,7 +4455,7 @@ var Integritee$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4424
4455
|
var _super = _createSuper(Integritee);
|
|
4425
4456
|
function Integritee() {
|
|
4426
4457
|
_classCallCheck(this, Integritee);
|
|
4427
|
-
return _super.call(this, 'Integritee', 'integritee', 'kusama');
|
|
4458
|
+
return _super.call(this, 'Integritee', 'integritee', 'kusama', Version.V1);
|
|
4428
4459
|
}
|
|
4429
4460
|
_createClass(Integritee, [{
|
|
4430
4461
|
key: "transferXTokens",
|
|
@@ -4440,7 +4471,7 @@ var InvArchTinker$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4440
4471
|
var _super = _createSuper(InvArchTinker);
|
|
4441
4472
|
function InvArchTinker() {
|
|
4442
4473
|
_classCallCheck(this, InvArchTinker);
|
|
4443
|
-
return _super.call(this, 'InvArchTinker', 'tinker', 'kusama');
|
|
4474
|
+
return _super.call(this, 'InvArchTinker', 'tinker', 'kusama', Version.V1);
|
|
4444
4475
|
}
|
|
4445
4476
|
_createClass(InvArchTinker, [{
|
|
4446
4477
|
key: "transferXTokens",
|
|
@@ -4458,7 +4489,7 @@ var Karura$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4458
4489
|
var _super = _createSuper(Karura);
|
|
4459
4490
|
function Karura() {
|
|
4460
4491
|
_classCallCheck(this, Karura);
|
|
4461
|
-
return _super.call(this, 'Karura', 'karura', 'kusama');
|
|
4492
|
+
return _super.call(this, 'Karura', 'karura', 'kusama', Version.V3);
|
|
4462
4493
|
}
|
|
4463
4494
|
_createClass(Karura, [{
|
|
4464
4495
|
key: "transferXTokens",
|
|
@@ -4476,7 +4507,6 @@ var Karura$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4476
4507
|
return Karura;
|
|
4477
4508
|
}(ParachainNode);
|
|
4478
4509
|
|
|
4479
|
-
// Contains basic structure of polkadotXCM call
|
|
4480
4510
|
var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
4481
4511
|
function PolkadotXCMTransferImpl() {
|
|
4482
4512
|
_classCallCheck(this, PolkadotXCMTransferImpl);
|
|
@@ -4487,8 +4517,17 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
|
4487
4517
|
var api = _ref.api,
|
|
4488
4518
|
header = _ref.header,
|
|
4489
4519
|
addressSelection = _ref.addressSelection,
|
|
4490
|
-
currencySelection = _ref.currencySelection
|
|
4520
|
+
currencySelection = _ref.currencySelection,
|
|
4521
|
+
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
4491
4522
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
4523
|
+
if (serializedApiCallEnabled) {
|
|
4524
|
+
return {
|
|
4525
|
+
type: TType.TX,
|
|
4526
|
+
module: 'polkadotXcm',
|
|
4527
|
+
section: method,
|
|
4528
|
+
parameters: [header, addressSelection, currencySelection, 0].concat(_toConsumableArray(fees ? [fees] : []))
|
|
4529
|
+
};
|
|
4530
|
+
}
|
|
4492
4531
|
return fees ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
4493
4532
|
}
|
|
4494
4533
|
}]);
|
|
@@ -4500,7 +4539,7 @@ var Statemint$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4500
4539
|
var _super = _createSuper(Statemint);
|
|
4501
4540
|
function Statemint() {
|
|
4502
4541
|
_classCallCheck(this, Statemint);
|
|
4503
|
-
return _super.call(this, 'Statemint', 'statemint', 'polkadot');
|
|
4542
|
+
return _super.call(this, 'Statemint', 'statemint', 'polkadot', Version.V3);
|
|
4504
4543
|
}
|
|
4505
4544
|
_createClass(Statemint, [{
|
|
4506
4545
|
key: "transferPolkadotXCM",
|
|
@@ -4519,7 +4558,7 @@ var Statemine$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4519
4558
|
var _super = _createSuper(Statemine);
|
|
4520
4559
|
function Statemine() {
|
|
4521
4560
|
_classCallCheck(this, Statemine);
|
|
4522
|
-
return _super.call(this, 'Statemine', 'statemine', 'kusama');
|
|
4561
|
+
return _super.call(this, 'Statemine', 'statemine', 'kusama', Version.V3);
|
|
4523
4562
|
}
|
|
4524
4563
|
_createClass(Statemine, [{
|
|
4525
4564
|
key: "transferPolkadotXCM",
|
|
@@ -4552,7 +4591,7 @@ var Encointer$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4552
4591
|
var _super = _createSuper(Encointer);
|
|
4553
4592
|
function Encointer() {
|
|
4554
4593
|
_classCallCheck(this, Encointer);
|
|
4555
|
-
return _super.call(this, 'Encointer', 'encointer', 'kusama');
|
|
4594
|
+
return _super.call(this, 'Encointer', 'encointer', 'kusama', Version.V1);
|
|
4556
4595
|
}
|
|
4557
4596
|
_createClass(Encointer, [{
|
|
4558
4597
|
key: "transferPolkadotXCM",
|
|
@@ -4573,7 +4612,7 @@ var Robonomics$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4573
4612
|
var _super = _createSuper(Robonomics);
|
|
4574
4613
|
function Robonomics() {
|
|
4575
4614
|
_classCallCheck(this, Robonomics);
|
|
4576
|
-
return _super.call(this, 'Robonomics', 'robonomics', 'kusama');
|
|
4615
|
+
return _super.call(this, 'Robonomics', 'robonomics', 'kusama', Version.V1);
|
|
4577
4616
|
}
|
|
4578
4617
|
_createClass(Robonomics, [{
|
|
4579
4618
|
key: "transferPolkadotXCM",
|
|
@@ -4597,7 +4636,7 @@ var Astar$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4597
4636
|
var _super = _createSuper(Astar);
|
|
4598
4637
|
function Astar() {
|
|
4599
4638
|
_classCallCheck(this, Astar);
|
|
4600
|
-
return _super.call(this, 'Astar', 'astar', 'polkadot');
|
|
4639
|
+
return _super.call(this, 'Astar', 'astar', 'polkadot', Version.V3);
|
|
4601
4640
|
}
|
|
4602
4641
|
_createClass(Astar, [{
|
|
4603
4642
|
key: "transferPolkadotXCM",
|
|
@@ -4615,7 +4654,7 @@ var Equilibrium$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4615
4654
|
var _super = _createSuper(Equilibrium);
|
|
4616
4655
|
function Equilibrium() {
|
|
4617
4656
|
_classCallCheck(this, Equilibrium);
|
|
4618
|
-
return _super.call(this, 'Equilibrium', 'equilibrium', 'polkadot');
|
|
4657
|
+
return _super.call(this, 'Equilibrium', 'equilibrium', 'polkadot', Version.V1);
|
|
4619
4658
|
}
|
|
4620
4659
|
_createClass(Equilibrium, [{
|
|
4621
4660
|
key: "transferPolkadotXCM",
|
|
@@ -4632,7 +4671,7 @@ var Darwinia$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4632
4671
|
var _super = _createSuper(Darwinia);
|
|
4633
4672
|
function Darwinia() {
|
|
4634
4673
|
_classCallCheck(this, Darwinia);
|
|
4635
|
-
return _super.call(this, 'Darwinia', 'darwinia', 'polkadot');
|
|
4674
|
+
return _super.call(this, 'Darwinia', 'darwinia', 'polkadot', Version.V3);
|
|
4636
4675
|
}
|
|
4637
4676
|
_createClass(Darwinia, [{
|
|
4638
4677
|
key: "transferPolkadotXCM",
|
|
@@ -4652,7 +4691,7 @@ var Crab$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4652
4691
|
var _super = _createSuper(Crab);
|
|
4653
4692
|
function Crab() {
|
|
4654
4693
|
_classCallCheck(this, Crab);
|
|
4655
|
-
return _super.call(this, 'Crab', 'crab', 'kusama');
|
|
4694
|
+
return _super.call(this, 'Crab', 'crab', 'kusama', Version.V3);
|
|
4656
4695
|
}
|
|
4657
4696
|
_createClass(Crab, [{
|
|
4658
4697
|
key: "transferPolkadotXCM",
|
|
@@ -4672,13 +4711,13 @@ var Ipci$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4672
4711
|
var _super = _createSuper(Ipci);
|
|
4673
4712
|
function Ipci() {
|
|
4674
4713
|
_classCallCheck(this, Ipci);
|
|
4675
|
-
return _super.call(this, 'Ipci', 'ipci', 'kusama');
|
|
4714
|
+
return _super.call(this, 'Ipci', 'ipci', 'kusama', Version.V1);
|
|
4676
4715
|
}
|
|
4677
4716
|
_createClass(Ipci, [{
|
|
4678
4717
|
key: "transferPolkadotXCM",
|
|
4679
4718
|
value: function transferPolkadotXCM(input) {
|
|
4680
4719
|
// UNTESTED, ONLY HAS CHANNELS W ROBONOMICS & 0 TRANSACTIONS
|
|
4681
|
-
if (input.scenario
|
|
4720
|
+
if (input.scenario === 'ParaToPara') {
|
|
4682
4721
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserveTransferAssets');
|
|
4683
4722
|
}
|
|
4684
4723
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
@@ -4692,7 +4731,7 @@ var Quartz$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4692
4731
|
var _super = _createSuper(Quartz);
|
|
4693
4732
|
function Quartz() {
|
|
4694
4733
|
_classCallCheck(this, Quartz);
|
|
4695
|
-
return _super.call(this, 'Quartz', 'quartz', 'kusama');
|
|
4734
|
+
return _super.call(this, 'Quartz', 'quartz', 'kusama', Version.V3);
|
|
4696
4735
|
}
|
|
4697
4736
|
_createClass(Quartz, [{
|
|
4698
4737
|
key: "transferPolkadotXCM",
|
|
@@ -4712,7 +4751,7 @@ var Shiden$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4712
4751
|
var _super = _createSuper(Shiden);
|
|
4713
4752
|
function Shiden() {
|
|
4714
4753
|
_classCallCheck(this, Shiden);
|
|
4715
|
-
return _super.call(this, 'Shiden', 'shiden', 'kusama');
|
|
4754
|
+
return _super.call(this, 'Shiden', 'shiden', 'kusama', Version.V3);
|
|
4716
4755
|
}
|
|
4717
4756
|
_createClass(Shiden, [{
|
|
4718
4757
|
key: "transferPolkadotXCM",
|
|
@@ -4794,10 +4833,10 @@ function getFees(scenario) {
|
|
|
4794
4833
|
}
|
|
4795
4834
|
throw new Error("Fees for scenario ".concat(scenario, " are not defined."));
|
|
4796
4835
|
}
|
|
4797
|
-
function handleAddress(scenario, pallet, api, to,
|
|
4836
|
+
function handleAddress(scenario, pallet, api, to, version, nodeId) {
|
|
4798
4837
|
if (scenario === 'ParaToRelay' && pallet === 'xTokens') {
|
|
4799
4838
|
console.log('AccountId32 transfer');
|
|
4800
|
-
if (
|
|
4839
|
+
if (version === Version.V3) {
|
|
4801
4840
|
return {
|
|
4802
4841
|
V3: {
|
|
4803
4842
|
parents: 1,
|
|
@@ -4828,10 +4867,10 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
4828
4867
|
if (scenario === 'ParaToPara' && pallet === 'xTokens') {
|
|
4829
4868
|
if (ethers.utils.isAddress(to)) {
|
|
4830
4869
|
console.log('AccountKey20 transfer');
|
|
4831
|
-
if (
|
|
4870
|
+
if (version === Version.V3) {
|
|
4832
4871
|
return {
|
|
4833
4872
|
V3: {
|
|
4834
|
-
parents:
|
|
4873
|
+
parents: 1,
|
|
4835
4874
|
interior: {
|
|
4836
4875
|
X2: [{
|
|
4837
4876
|
Parachain: nodeId
|
|
@@ -4861,6 +4900,22 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
4861
4900
|
};
|
|
4862
4901
|
} else {
|
|
4863
4902
|
console.log('AccountId32 transfer');
|
|
4903
|
+
if (version === Version.V3) {
|
|
4904
|
+
return {
|
|
4905
|
+
V3: {
|
|
4906
|
+
parents: 1,
|
|
4907
|
+
interior: {
|
|
4908
|
+
X2: [{
|
|
4909
|
+
Parachain: nodeId
|
|
4910
|
+
}, {
|
|
4911
|
+
AccountId32: {
|
|
4912
|
+
id: createAccID(api, to)
|
|
4913
|
+
}
|
|
4914
|
+
}]
|
|
4915
|
+
}
|
|
4916
|
+
}
|
|
4917
|
+
};
|
|
4918
|
+
}
|
|
4864
4919
|
return {
|
|
4865
4920
|
V1: {
|
|
4866
4921
|
parents: 1,
|
|
@@ -4880,7 +4935,7 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
4880
4935
|
}
|
|
4881
4936
|
if (scenario === 'ParaToRelay' && pallet === 'polkadotXCM') {
|
|
4882
4937
|
console.log('AccountId32 transfer');
|
|
4883
|
-
if (
|
|
4938
|
+
if (version === Version.V3) {
|
|
4884
4939
|
return {
|
|
4885
4940
|
V3: {
|
|
4886
4941
|
parents: 0,
|
|
@@ -4910,21 +4965,9 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
4910
4965
|
}
|
|
4911
4966
|
}
|
|
4912
4967
|
if (scenario === 'ParaToPara' && pallet === 'polkadotXCM') {
|
|
4913
|
-
if (node === 'Quartz') {
|
|
4914
|
-
return {
|
|
4915
|
-
V0: {
|
|
4916
|
-
X1: {
|
|
4917
|
-
AccountId32: {
|
|
4918
|
-
network: 'Any',
|
|
4919
|
-
id: createAccID(api, to)
|
|
4920
|
-
}
|
|
4921
|
-
}
|
|
4922
|
-
}
|
|
4923
|
-
};
|
|
4924
|
-
}
|
|
4925
4968
|
if (ethers.utils.isAddress(to)) {
|
|
4926
4969
|
console.log('AccountKey20 transfer');
|
|
4927
|
-
if (
|
|
4970
|
+
if (version === Version.V3) {
|
|
4928
4971
|
return {
|
|
4929
4972
|
V3: {
|
|
4930
4973
|
parents: 0,
|
|
@@ -4954,7 +4997,7 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
4954
4997
|
}
|
|
4955
4998
|
} else {
|
|
4956
4999
|
console.log('AccountId32 transfer');
|
|
4957
|
-
if (
|
|
5000
|
+
if (version === Version.V3) {
|
|
4958
5001
|
return {
|
|
4959
5002
|
V3: {
|
|
4960
5003
|
parents: 0,
|
|
@@ -5016,10 +5059,10 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
5016
5059
|
}
|
|
5017
5060
|
}
|
|
5018
5061
|
}
|
|
5019
|
-
function createCurrencySpecification(amount, scenario, node, cur) {
|
|
5062
|
+
function createCurrencySpecification(amount, scenario, version, node, cur) {
|
|
5020
5063
|
if (scenario === 'ParaToRelay') {
|
|
5021
5064
|
console.log('polkadotXCM transfer in native currency to Relay chain');
|
|
5022
|
-
if (
|
|
5065
|
+
if (version === Version.V3) {
|
|
5023
5066
|
return {
|
|
5024
5067
|
V3: [{
|
|
5025
5068
|
id: {
|
|
@@ -5051,20 +5094,10 @@ function createCurrencySpecification(amount, scenario, node, cur) {
|
|
|
5051
5094
|
}
|
|
5052
5095
|
if (scenario === 'RelayToPara' || scenario === 'ParaToPara') {
|
|
5053
5096
|
console.log('polkadotXCM Native currency to sender chain transfer');
|
|
5054
|
-
if (node === 'Quartz' && scenario === 'ParaToPara') {
|
|
5055
|
-
return {
|
|
5056
|
-
V0: [{
|
|
5057
|
-
ConcreteFungible: {
|
|
5058
|
-
id: null,
|
|
5059
|
-
amount: amount
|
|
5060
|
-
}
|
|
5061
|
-
}]
|
|
5062
|
-
};
|
|
5063
|
-
}
|
|
5064
5097
|
if ((node === 'Darwinia' || node === 'Crab') && scenario === 'ParaToPara') {
|
|
5065
5098
|
// Special case for Darwinia&Crab node
|
|
5066
5099
|
return {
|
|
5067
|
-
|
|
5100
|
+
V3: [{
|
|
5068
5101
|
id: {
|
|
5069
5102
|
Concrete: {
|
|
5070
5103
|
parents: 0,
|
|
@@ -5080,49 +5113,27 @@ function createCurrencySpecification(amount, scenario, node, cur) {
|
|
|
5080
5113
|
}
|
|
5081
5114
|
}]
|
|
5082
5115
|
};
|
|
5083
|
-
} else if ((node === '
|
|
5116
|
+
} else if ((node === 'Statemine' || node === 'Statemint') && scenario === 'ParaToPara') {
|
|
5084
5117
|
// Another specific case for Statemint & Statemine to send for example USDt
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
}]
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
},
|
|
5100
|
-
fun: {
|
|
5101
|
-
Fungible: amount
|
|
5102
|
-
}
|
|
5103
|
-
}]
|
|
5104
|
-
};
|
|
5105
|
-
} else {
|
|
5106
|
-
return {
|
|
5107
|
-
V1: [{
|
|
5108
|
-
id: {
|
|
5109
|
-
Concrete: {
|
|
5110
|
-
parents: 0,
|
|
5111
|
-
interior: {
|
|
5112
|
-
X2: [{
|
|
5113
|
-
PalletInstance: 50
|
|
5114
|
-
}, {
|
|
5115
|
-
GeneralIndex: cur
|
|
5116
|
-
}]
|
|
5117
|
-
}
|
|
5118
|
+
return {
|
|
5119
|
+
V3: [{
|
|
5120
|
+
id: {
|
|
5121
|
+
Concrete: {
|
|
5122
|
+
parents: 0,
|
|
5123
|
+
interior: {
|
|
5124
|
+
X2: [{
|
|
5125
|
+
PalletInstance: 50
|
|
5126
|
+
}, {
|
|
5127
|
+
GeneralIndex: cur
|
|
5128
|
+
}]
|
|
5118
5129
|
}
|
|
5119
|
-
},
|
|
5120
|
-
fun: {
|
|
5121
|
-
Fungible: amount
|
|
5122
5130
|
}
|
|
5123
|
-
}
|
|
5124
|
-
|
|
5125
|
-
|
|
5131
|
+
},
|
|
5132
|
+
fun: {
|
|
5133
|
+
Fungible: amount
|
|
5134
|
+
}
|
|
5135
|
+
}]
|
|
5136
|
+
};
|
|
5126
5137
|
}
|
|
5127
5138
|
// Otherwise
|
|
5128
5139
|
return {
|
|
@@ -5140,10 +5151,10 @@ function createCurrencySpecification(amount, scenario, node, cur) {
|
|
|
5140
5151
|
};
|
|
5141
5152
|
}
|
|
5142
5153
|
}
|
|
5143
|
-
function createHeaderPolkadotXCM(scenario,
|
|
5154
|
+
function createHeaderPolkadotXCM(scenario, version, nodeId) {
|
|
5144
5155
|
console.log('Generating header for polkadotXCM transfer');
|
|
5145
5156
|
if (scenario === 'ParaToRelay') {
|
|
5146
|
-
if (
|
|
5157
|
+
if (version === Version.V3) {
|
|
5147
5158
|
return {
|
|
5148
5159
|
V3: {
|
|
5149
5160
|
parents: 1,
|
|
@@ -5160,25 +5171,29 @@ function createHeaderPolkadotXCM(scenario, nodeId, node) {
|
|
|
5160
5171
|
}
|
|
5161
5172
|
}
|
|
5162
5173
|
if (scenario === 'ParaToPara') {
|
|
5163
|
-
if (
|
|
5174
|
+
if (version === Version.V3) {
|
|
5164
5175
|
return {
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5176
|
+
V3: {
|
|
5177
|
+
parents: 1,
|
|
5178
|
+
interior: {
|
|
5179
|
+
X1: {
|
|
5180
|
+
Parachain: nodeId
|
|
5181
|
+
}
|
|
5182
|
+
}
|
|
5169
5183
|
}
|
|
5170
5184
|
};
|
|
5171
|
-
}
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5185
|
+
} else {
|
|
5186
|
+
return {
|
|
5187
|
+
V1: {
|
|
5188
|
+
parents: 1,
|
|
5189
|
+
interior: {
|
|
5190
|
+
X1: {
|
|
5191
|
+
Parachain: nodeId
|
|
5192
|
+
}
|
|
5178
5193
|
}
|
|
5179
5194
|
}
|
|
5180
|
-
}
|
|
5181
|
-
}
|
|
5195
|
+
};
|
|
5196
|
+
}
|
|
5182
5197
|
}
|
|
5183
5198
|
if (scenario === 'RelayToPara') {
|
|
5184
5199
|
return {
|
|
@@ -5238,8 +5253,9 @@ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
|
5238
5253
|
return _createClass(NodeNotSupportedError);
|
|
5239
5254
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
5240
5255
|
|
|
5241
|
-
//Contains basic call formatting for different XCM Palletss
|
|
5242
|
-
function
|
|
5256
|
+
// Contains basic call formatting for different XCM Palletss
|
|
5257
|
+
var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5258
|
+
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
5243
5259
|
var asset = getAssetBySymbolOrId(origin, currencySymbolOrId.toString());
|
|
5244
5260
|
if (!asset) {
|
|
5245
5261
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
|
|
@@ -5249,23 +5265,32 @@ function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
|
5249
5265
|
}
|
|
5250
5266
|
var currencySymbol = asset.symbol,
|
|
5251
5267
|
currencyId = asset.assetId;
|
|
5252
|
-
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination);
|
|
5268
|
+
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination, serializedApiCallEnabled);
|
|
5269
|
+
};
|
|
5270
|
+
var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5271
|
+
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination, true);
|
|
5272
|
+
};
|
|
5273
|
+
function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5274
|
+
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination);
|
|
5253
5275
|
}
|
|
5254
5276
|
function transferRelayToPara(api, destination, amount, to) {
|
|
5255
5277
|
var paraId = getParaId(destination);
|
|
5256
|
-
if (destination === 'Statemint' || destination === 'Statemine'
|
|
5278
|
+
if (destination === 'Statemint' || destination === 'Statemine') {
|
|
5257
5279
|
// Same for Statemint, Statemine and Encoiter
|
|
5258
|
-
return api.tx.xcmPallet.limitedTeleportAssets(createHeaderPolkadotXCM('RelayToPara',
|
|
5259
|
-
} else if (destination === '
|
|
5260
|
-
|
|
5280
|
+
return api.tx.xcmPallet.limitedTeleportAssets(createHeaderPolkadotXCM('RelayToPara', Version.V3, paraId), handleAddress('RelayToPara', '', api, to, Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', Version.V3, destination), 0, 'Unlimited');
|
|
5281
|
+
} else if (destination === 'Encointer') {
|
|
5282
|
+
return api.tx.xcmPallet.limitedTeleportAssets(createHeaderPolkadotXCM('RelayToPara', Version.V1, paraId), handleAddress('RelayToPara', '', api, to, Version.V1, paraId), createCurrencySpecification(amount, 'RelayToPara', Version.V1, destination), 0, 'Unlimited');
|
|
5283
|
+
} else if (destination === 'Darwinia' || destination === 'Crab') {
|
|
5284
|
+
// Do not do anything because Darwinia and Crab does not have DOT and KSM registered
|
|
5261
5285
|
throw new NodeNotSupportedError('These nodes do not support XCM transfers from Relay / to Relay chain.');
|
|
5262
5286
|
}
|
|
5263
|
-
return api.tx.xcmPallet.reserveTransferAssets(createHeaderPolkadotXCM('RelayToPara',
|
|
5287
|
+
return api.tx.xcmPallet.reserveTransferAssets(createHeaderPolkadotXCM('RelayToPara', Version.V3, paraId), handleAddress('RelayToPara', '', api, to, Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', Version.V3, destination), 0);
|
|
5264
5288
|
}
|
|
5265
5289
|
|
|
5266
5290
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
5267
5291
|
__proto__: null,
|
|
5268
5292
|
send: send,
|
|
5293
|
+
sendSerializedApiCall: sendSerializedApiCall,
|
|
5269
5294
|
transferRelayToPara: transferRelayToPara
|
|
5270
5295
|
});
|
|
5271
5296
|
|
|
@@ -5658,6 +5683,11 @@ var SendBuilder = /*#__PURE__*/function () {
|
|
|
5658
5683
|
value: function build() {
|
|
5659
5684
|
return send(this.api, this.from, this.currency, this._amount, this._address, this.to);
|
|
5660
5685
|
}
|
|
5686
|
+
}, {
|
|
5687
|
+
key: "buildSerializedApiCall",
|
|
5688
|
+
value: function buildSerializedApiCall() {
|
|
5689
|
+
return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
|
|
5690
|
+
}
|
|
5661
5691
|
}], [{
|
|
5662
5692
|
key: "createParaToRelay",
|
|
5663
5693
|
value: function createParaToRelay(api, from, currency) {
|
|
@@ -5693,10 +5723,11 @@ var ToGeneralBuilder = /*#__PURE__*/function () {
|
|
|
5693
5723
|
return ToGeneralBuilder;
|
|
5694
5724
|
}();
|
|
5695
5725
|
var FromGeneralBuilder = /*#__PURE__*/function () {
|
|
5696
|
-
function FromGeneralBuilder(api, from) {
|
|
5726
|
+
function FromGeneralBuilder(api, from, version) {
|
|
5697
5727
|
_classCallCheck(this, FromGeneralBuilder);
|
|
5698
5728
|
this.api = api;
|
|
5699
5729
|
this.from = from;
|
|
5730
|
+
this.version = version;
|
|
5700
5731
|
}
|
|
5701
5732
|
_createClass(FromGeneralBuilder, [{
|
|
5702
5733
|
key: "to",
|
|
@@ -5724,7 +5755,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
5724
5755
|
_createClass(GeneralBuilder, [{
|
|
5725
5756
|
key: "from",
|
|
5726
5757
|
value: function from(node) {
|
|
5727
|
-
return new FromGeneralBuilder(this.api, node);
|
|
5758
|
+
return new FromGeneralBuilder(this.api, node, this.version);
|
|
5728
5759
|
}
|
|
5729
5760
|
}, {
|
|
5730
5761
|
key: "to",
|
|
@@ -5810,9 +5841,10 @@ var Clover = {
|
|
|
5810
5841
|
]
|
|
5811
5842
|
};
|
|
5812
5843
|
var ComposableFinance = {
|
|
5813
|
-
defaultPallet: "
|
|
5844
|
+
defaultPallet: "XTokens",
|
|
5814
5845
|
supportedPallets: [
|
|
5815
|
-
"
|
|
5846
|
+
"PolkadotXcm",
|
|
5847
|
+
"XTokens"
|
|
5816
5848
|
]
|
|
5817
5849
|
};
|
|
5818
5850
|
var Darwinia = {
|
|
@@ -6016,7 +6048,7 @@ var ParallelHeiko = {
|
|
|
6016
6048
|
var Picasso = {
|
|
6017
6049
|
defaultPallet: "XTokens",
|
|
6018
6050
|
supportedPallets: [
|
|
6019
|
-
"
|
|
6051
|
+
"PolkadotXcm",
|
|
6020
6052
|
"XTokens"
|
|
6021
6053
|
]
|
|
6022
6054
|
};
|
|
@@ -6199,4 +6231,4 @@ var getSupportedPallets = function getSupportedPallets(node) {
|
|
|
6199
6231
|
return palletsMap[node].supportedPallets;
|
|
6200
6232
|
};
|
|
6201
6233
|
|
|
6202
|
-
export { Builder, NODE_NAMES, SUPPORTED_PALLETS, index$4 as assets, index as closeChannels, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getNativeAssets, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };
|
|
6234
|
+
export { Builder, NODE_NAMES, SUPPORTED_PALLETS, TType, Version, index$4 as assets, index as closeChannels, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getNativeAssets, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };
|