@paraspell/sdk 5.2.1 → 5.3.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/README.md +22 -11
- package/dist/index.cjs +343 -45
- package/dist/index.d.ts +37 -12
- package/dist/index.mjs +343 -45
- package/package.json +1 -2
package/dist/index.mjs
CHANGED
|
@@ -2889,6 +2889,28 @@ var InvArchTinker$3 = {
|
|
|
2889
2889
|
otherAssets: [
|
|
2890
2890
|
]
|
|
2891
2891
|
};
|
|
2892
|
+
var Curio$3 = {
|
|
2893
|
+
paraId: 3339,
|
|
2894
|
+
relayChainAssetSymbol: "KSM",
|
|
2895
|
+
nativeAssetSymbol: "CGT",
|
|
2896
|
+
nativeAssets: [
|
|
2897
|
+
{
|
|
2898
|
+
symbol: "CGT",
|
|
2899
|
+
decimals: 18
|
|
2900
|
+
},
|
|
2901
|
+
{
|
|
2902
|
+
symbol: "KSM",
|
|
2903
|
+
decimals: 12
|
|
2904
|
+
}
|
|
2905
|
+
],
|
|
2906
|
+
otherAssets: [
|
|
2907
|
+
{
|
|
2908
|
+
assetId: "0",
|
|
2909
|
+
symbol: "BSX",
|
|
2910
|
+
decimals: 12
|
|
2911
|
+
}
|
|
2912
|
+
]
|
|
2913
|
+
};
|
|
2892
2914
|
var Karura$3 = {
|
|
2893
2915
|
paraId: 2000,
|
|
2894
2916
|
relayChainAssetSymbol: "KSM",
|
|
@@ -5789,6 +5811,7 @@ var assets = {
|
|
|
5789
5811
|
KiltSpiritnet: KiltSpiritnet$3,
|
|
5790
5812
|
Integritee: Integritee$3,
|
|
5791
5813
|
InvArchTinker: InvArchTinker$3,
|
|
5814
|
+
Curio: Curio$3,
|
|
5792
5815
|
Karura: Karura$3,
|
|
5793
5816
|
Kintsugi: Kintsugi$3,
|
|
5794
5817
|
Litmus: Litmus$3,
|
|
@@ -5837,6 +5860,7 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
|
|
|
5837
5860
|
Crab: Crab$3,
|
|
5838
5861
|
Crust: Crust$3,
|
|
5839
5862
|
CrustShadow: CrustShadow$3,
|
|
5863
|
+
Curio: Curio$3,
|
|
5840
5864
|
Darwinia: Darwinia$3,
|
|
5841
5865
|
Encointer: Encointer$3,
|
|
5842
5866
|
HydraDX: HydraDX$3,
|
|
@@ -5959,19 +5983,36 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
|
|
|
5959
5983
|
}
|
|
5960
5984
|
return parameters;
|
|
5961
5985
|
};
|
|
5962
|
-
var
|
|
5986
|
+
var isTMulti = function isTMulti(value) {
|
|
5987
|
+
return value && _typeof(value) === 'object' || Array.isArray(value);
|
|
5988
|
+
};
|
|
5989
|
+
var isTMultiLocation = function isTMultiLocation(value) {
|
|
5990
|
+
return value && typeof value.parents !== 'undefined' && typeof value.interior !== 'undefined';
|
|
5991
|
+
};
|
|
5992
|
+
var createCurrencySpec = function createCurrencySpec(amount, version, parents, overriddenCurrency) {
|
|
5963
5993
|
var interior = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'Here';
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5994
|
+
if (!overriddenCurrency) {
|
|
5995
|
+
return _defineProperty({}, version, [{
|
|
5996
|
+
id: {
|
|
5997
|
+
Concrete: {
|
|
5998
|
+
parents: parents,
|
|
5999
|
+
interior: interior
|
|
6000
|
+
}
|
|
6001
|
+
},
|
|
6002
|
+
fun: {
|
|
6003
|
+
Fungible: amount
|
|
5969
6004
|
}
|
|
6005
|
+
}]);
|
|
6006
|
+
}
|
|
6007
|
+
return isTMultiLocation(overriddenCurrency) ? _defineProperty({}, version, [{
|
|
6008
|
+
id: {
|
|
6009
|
+
Concrete: overriddenCurrency
|
|
5970
6010
|
},
|
|
5971
6011
|
fun: {
|
|
5972
6012
|
Fungible: amount
|
|
5973
6013
|
}
|
|
5974
|
-
}])
|
|
6014
|
+
}]) : // It must be TMultiAsset if not TMultiLocation
|
|
6015
|
+
_defineProperty({}, version, overriddenCurrency);
|
|
5975
6016
|
};
|
|
5976
6017
|
var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId) {
|
|
5977
6018
|
var parents = scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
|
|
@@ -7622,8 +7663,37 @@ var KiltSpiritnet$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7622
7663
|
}]);
|
|
7623
7664
|
}(ParachainNode);
|
|
7624
7665
|
|
|
7666
|
+
var Curio$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
7667
|
+
function Curio() {
|
|
7668
|
+
_classCallCheck(this, Curio);
|
|
7669
|
+
return _callSuper(this, Curio, ['Curio', 'curio', 'kusama', Version.V3]);
|
|
7670
|
+
}
|
|
7671
|
+
_inherits(Curio, _ParachainNode);
|
|
7672
|
+
return _createClass(Curio, [{
|
|
7673
|
+
key: "getCurrencySelection",
|
|
7674
|
+
value: function getCurrencySelection(_ref) {
|
|
7675
|
+
var currency = _ref.currency,
|
|
7676
|
+
currencyID = _ref.currencyID;
|
|
7677
|
+
if (currencyID) {
|
|
7678
|
+
return {
|
|
7679
|
+
ForeignAsset: currencyID
|
|
7680
|
+
};
|
|
7681
|
+
}
|
|
7682
|
+
return {
|
|
7683
|
+
Token: currency
|
|
7684
|
+
};
|
|
7685
|
+
}
|
|
7686
|
+
}, {
|
|
7687
|
+
key: "transferXTokens",
|
|
7688
|
+
value: function transferXTokens(input) {
|
|
7689
|
+
var currencySelection = this.getCurrencySelection(input);
|
|
7690
|
+
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
7691
|
+
}
|
|
7692
|
+
}]);
|
|
7693
|
+
}(ParachainNode);
|
|
7694
|
+
|
|
7625
7695
|
// Contains supported Parachains and exports supported XCM Pallets
|
|
7626
|
-
var NODE_NAMES = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet'];
|
|
7696
|
+
var NODE_NAMES = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio'];
|
|
7627
7697
|
var NODES_WITH_RELAY_CHAINS = [].concat(NODE_NAMES, ['Polkadot', 'Kusama']);
|
|
7628
7698
|
var nodes = {
|
|
7629
7699
|
AssetHubPolkadot: new AssetHubPolkadot$2(),
|
|
@@ -7677,7 +7747,8 @@ var nodes = {
|
|
|
7677
7747
|
Khala: new Khala$2(),
|
|
7678
7748
|
Phala: new Phala$2(),
|
|
7679
7749
|
Subsocial: new Subsocial$2(),
|
|
7680
|
-
KiltSpiritnet: new KiltSpiritnet$2()
|
|
7750
|
+
KiltSpiritnet: new KiltSpiritnet$2(),
|
|
7751
|
+
Curio: new Curio$2()
|
|
7681
7752
|
};
|
|
7682
7753
|
var SUPPORTED_PALLETS = ['XTokens', 'OrmlXTokens', 'PolkadotXcm', 'RelayerXcm', 'XTransfer'];
|
|
7683
7754
|
|
|
@@ -7862,9 +7933,12 @@ var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref8) {
|
|
|
7862
7933
|
var determineRelayChain = function determineRelayChain(node) {
|
|
7863
7934
|
return getRelayChainSymbol(node) === 'KSM' ? 'Kusama' : 'Polkadot';
|
|
7864
7935
|
};
|
|
7936
|
+
var isRelayChain = function isRelayChain(node) {
|
|
7937
|
+
return node === 'Polkadot' || node === 'Kusama';
|
|
7938
|
+
};
|
|
7865
7939
|
|
|
7866
7940
|
var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
|
|
7867
|
-
if (
|
|
7941
|
+
if (isTMulti(currency)) {
|
|
7868
7942
|
return null;
|
|
7869
7943
|
}
|
|
7870
7944
|
var currencyString = currency.toString();
|
|
@@ -7957,6 +8031,7 @@ var Khala$1 = "10000000000";
|
|
|
7957
8031
|
var Phala$1 = "10000000000";
|
|
7958
8032
|
var Subsocial$1 = "100000000";
|
|
7959
8033
|
var KiltSpiritnet$1 = "10000000000000";
|
|
8034
|
+
var Curio$1 = "10000000000000000";
|
|
7960
8035
|
var existentialDeposits = {
|
|
7961
8036
|
AssetHubPolkadot: AssetHubPolkadot$1,
|
|
7962
8037
|
Acala: Acala$1,
|
|
@@ -8011,7 +8086,8 @@ var existentialDeposits = {
|
|
|
8011
8086
|
Khala: Khala$1,
|
|
8012
8087
|
Phala: Phala$1,
|
|
8013
8088
|
Subsocial: Subsocial$1,
|
|
8014
|
-
KiltSpiritnet: KiltSpiritnet$1
|
|
8089
|
+
KiltSpiritnet: KiltSpiritnet$1,
|
|
8090
|
+
Curio: Curio$1
|
|
8015
8091
|
};
|
|
8016
8092
|
|
|
8017
8093
|
var edMapJson = /*#__PURE__*/Object.freeze({
|
|
@@ -8035,6 +8111,7 @@ var edMapJson = /*#__PURE__*/Object.freeze({
|
|
|
8035
8111
|
Crab: Crab$1,
|
|
8036
8112
|
Crust: Crust$1,
|
|
8037
8113
|
CrustShadow: CrustShadow$1,
|
|
8114
|
+
Curio: Curio$1,
|
|
8038
8115
|
Darwinia: Darwinia$1,
|
|
8039
8116
|
Encointer: Encointer$1,
|
|
8040
8117
|
HydraDX: HydraDX$1,
|
|
@@ -8451,6 +8528,9 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
|
|
|
8451
8528
|
}, {
|
|
8452
8529
|
key: "buildOptions",
|
|
8453
8530
|
value: function buildOptions() {
|
|
8531
|
+
if (this.amount === null) {
|
|
8532
|
+
throw new Error('Amount is required');
|
|
8533
|
+
}
|
|
8454
8534
|
var currency = getRelayChainSymbol(this.from);
|
|
8455
8535
|
return {
|
|
8456
8536
|
api: this.api,
|
|
@@ -8522,6 +8602,167 @@ var MissingApiPromiseError = /*#__PURE__*/function (_Error) {
|
|
|
8522
8602
|
return _createClass(MissingApiPromiseError);
|
|
8523
8603
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
8524
8604
|
|
|
8605
|
+
var buildBeneficiaryInput = function buildBeneficiaryInput(api, address) {
|
|
8606
|
+
if (isTMultiLocation(address)) {
|
|
8607
|
+
return address;
|
|
8608
|
+
}
|
|
8609
|
+
var isEthAddress = ethers.utils.isAddress(address);
|
|
8610
|
+
return {
|
|
8611
|
+
parents: Parents.ZERO,
|
|
8612
|
+
interior: {
|
|
8613
|
+
X1: isEthAddress ? {
|
|
8614
|
+
AccountKey20: {
|
|
8615
|
+
key: address
|
|
8616
|
+
}
|
|
8617
|
+
} : {
|
|
8618
|
+
AccountId32: {
|
|
8619
|
+
id: createAccID(api, address)
|
|
8620
|
+
}
|
|
8621
|
+
}
|
|
8622
|
+
}
|
|
8623
|
+
};
|
|
8624
|
+
};
|
|
8625
|
+
var buildClaimAssetsInput = function buildClaimAssetsInput(_ref) {
|
|
8626
|
+
var api = _ref.api,
|
|
8627
|
+
multiAssets = _ref.multiAssets,
|
|
8628
|
+
address = _ref.address,
|
|
8629
|
+
_ref$version = _ref.version,
|
|
8630
|
+
version = _ref$version === void 0 ? Version.V3 : _ref$version;
|
|
8631
|
+
return [_defineProperty({}, version, multiAssets), _defineProperty({}, version, buildBeneficiaryInput(api, address))];
|
|
8632
|
+
};
|
|
8633
|
+
var MODULE = 'polkadotXcm';
|
|
8634
|
+
var MODULE_RELAY = 'xcmPallet';
|
|
8635
|
+
var SECTION = 'claimAssets';
|
|
8636
|
+
var claimAssets = function claimAssets(options) {
|
|
8637
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8638
|
+
var _apiWithFallback$tx$m;
|
|
8639
|
+
var api, node, serializedApiCallEnabled, apiWithFallback, args, module;
|
|
8640
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8641
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8642
|
+
case 0:
|
|
8643
|
+
api = options.api, node = options.node, serializedApiCallEnabled = options.serializedApiCallEnabled;
|
|
8644
|
+
if (!(api !== null && api !== void 0)) {
|
|
8645
|
+
_context.next = 5;
|
|
8646
|
+
break;
|
|
8647
|
+
}
|
|
8648
|
+
_context.t0 = api;
|
|
8649
|
+
_context.next = 8;
|
|
8650
|
+
break;
|
|
8651
|
+
case 5:
|
|
8652
|
+
_context.next = 7;
|
|
8653
|
+
return createApiInstanceForNode(node);
|
|
8654
|
+
case 7:
|
|
8655
|
+
_context.t0 = _context.sent;
|
|
8656
|
+
case 8:
|
|
8657
|
+
apiWithFallback = _context.t0;
|
|
8658
|
+
args = buildClaimAssetsInput(Object.assign(Object.assign({}, options), {
|
|
8659
|
+
api: apiWithFallback
|
|
8660
|
+
}));
|
|
8661
|
+
module = isRelayChain(node) ? MODULE_RELAY : MODULE;
|
|
8662
|
+
if (!(serializedApiCallEnabled === true)) {
|
|
8663
|
+
_context.next = 13;
|
|
8664
|
+
break;
|
|
8665
|
+
}
|
|
8666
|
+
return _context.abrupt("return", {
|
|
8667
|
+
module: module,
|
|
8668
|
+
section: SECTION,
|
|
8669
|
+
parameters: args
|
|
8670
|
+
});
|
|
8671
|
+
case 13:
|
|
8672
|
+
return _context.abrupt("return", (_apiWithFallback$tx$m = apiWithFallback.tx[module])[SECTION].apply(_apiWithFallback$tx$m, _toConsumableArray(args)));
|
|
8673
|
+
case 14:
|
|
8674
|
+
case "end":
|
|
8675
|
+
return _context.stop();
|
|
8676
|
+
}
|
|
8677
|
+
}, _callee);
|
|
8678
|
+
}));
|
|
8679
|
+
};
|
|
8680
|
+
|
|
8681
|
+
var AssetClaimBuilder = /*#__PURE__*/function () {
|
|
8682
|
+
function AssetClaimBuilder(api, node) {
|
|
8683
|
+
_classCallCheck(this, AssetClaimBuilder);
|
|
8684
|
+
this.api = api;
|
|
8685
|
+
this.node = node;
|
|
8686
|
+
}
|
|
8687
|
+
return _createClass(AssetClaimBuilder, [{
|
|
8688
|
+
key: "fungible",
|
|
8689
|
+
value: function fungible(multiAssets) {
|
|
8690
|
+
this._multiAssets = multiAssets;
|
|
8691
|
+
return this;
|
|
8692
|
+
}
|
|
8693
|
+
}, {
|
|
8694
|
+
key: "account",
|
|
8695
|
+
value: function account(address) {
|
|
8696
|
+
this._address = address;
|
|
8697
|
+
return this;
|
|
8698
|
+
}
|
|
8699
|
+
}, {
|
|
8700
|
+
key: "xcmVersion",
|
|
8701
|
+
value: function xcmVersion(version) {
|
|
8702
|
+
this._version = version;
|
|
8703
|
+
return this;
|
|
8704
|
+
}
|
|
8705
|
+
}, {
|
|
8706
|
+
key: "buildOptions",
|
|
8707
|
+
value: function buildOptions() {
|
|
8708
|
+
return {
|
|
8709
|
+
api: this.api,
|
|
8710
|
+
node: this.node,
|
|
8711
|
+
multiAssets: this._multiAssets,
|
|
8712
|
+
address: this._address,
|
|
8713
|
+
version: this._version
|
|
8714
|
+
};
|
|
8715
|
+
}
|
|
8716
|
+
}, {
|
|
8717
|
+
key: "build",
|
|
8718
|
+
value: function build() {
|
|
8719
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8720
|
+
var options;
|
|
8721
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8722
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8723
|
+
case 0:
|
|
8724
|
+
options = this.buildOptions();
|
|
8725
|
+
_context.next = 3;
|
|
8726
|
+
return claimAssets(options);
|
|
8727
|
+
case 3:
|
|
8728
|
+
return _context.abrupt("return", _context.sent);
|
|
8729
|
+
case 4:
|
|
8730
|
+
case "end":
|
|
8731
|
+
return _context.stop();
|
|
8732
|
+
}
|
|
8733
|
+
}, _callee, this);
|
|
8734
|
+
}));
|
|
8735
|
+
}
|
|
8736
|
+
}, {
|
|
8737
|
+
key: "buildSerializedApiCall",
|
|
8738
|
+
value: function buildSerializedApiCall() {
|
|
8739
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8740
|
+
var options;
|
|
8741
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8742
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8743
|
+
case 0:
|
|
8744
|
+
options = this.buildOptions();
|
|
8745
|
+
_context2.next = 3;
|
|
8746
|
+
return claimAssets(Object.assign(Object.assign({}, options), {
|
|
8747
|
+
serializedApiCallEnabled: true
|
|
8748
|
+
}));
|
|
8749
|
+
case 3:
|
|
8750
|
+
return _context2.abrupt("return", _context2.sent);
|
|
8751
|
+
case 4:
|
|
8752
|
+
case "end":
|
|
8753
|
+
return _context2.stop();
|
|
8754
|
+
}
|
|
8755
|
+
}, _callee2, this);
|
|
8756
|
+
}));
|
|
8757
|
+
}
|
|
8758
|
+
}], [{
|
|
8759
|
+
key: "create",
|
|
8760
|
+
value: function create(api, node) {
|
|
8761
|
+
return new AssetClaimBuilder(api, node);
|
|
8762
|
+
}
|
|
8763
|
+
}]);
|
|
8764
|
+
}();
|
|
8765
|
+
|
|
8525
8766
|
var ToGeneralBuilder = /*#__PURE__*/function () {
|
|
8526
8767
|
function ToGeneralBuilder(api, from, to, paraIdTo) {
|
|
8527
8768
|
_classCallCheck(this, ToGeneralBuilder);
|
|
@@ -8592,6 +8833,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
8592
8833
|
value: function to(node, paraIdTo) {
|
|
8593
8834
|
return RelayToParaBuilder.create(this.api, node, paraIdTo);
|
|
8594
8835
|
}
|
|
8836
|
+
}, {
|
|
8837
|
+
key: "claimFrom",
|
|
8838
|
+
value: function claimFrom(node) {
|
|
8839
|
+
return AssetClaimBuilder.create(this.api, node);
|
|
8840
|
+
}
|
|
8595
8841
|
}]);
|
|
8596
8842
|
}();
|
|
8597
8843
|
var Builder = function Builder(api) {
|
|
@@ -8751,106 +8997,149 @@ var sendCommon = function sendCommon(options) {
|
|
|
8751
8997
|
while (1) switch (_context.prev = _context.next) {
|
|
8752
8998
|
case 0:
|
|
8753
8999
|
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, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
|
|
8754
|
-
if (!(
|
|
9000
|
+
if (!((!isTMulti(currency) || isTMultiLocation(currency)) && amount === null)) {
|
|
8755
9001
|
_context.next = 3;
|
|
8756
9002
|
break;
|
|
8757
9003
|
}
|
|
8758
|
-
throw new
|
|
9004
|
+
throw new Error('Amount is required');
|
|
8759
9005
|
case 3:
|
|
9006
|
+
if (!(typeof currency === 'number' && currency > Number.MAX_SAFE_INTEGER)) {
|
|
9007
|
+
_context.next = 5;
|
|
9008
|
+
break;
|
|
9009
|
+
}
|
|
9010
|
+
throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
|
|
9011
|
+
case 5:
|
|
9012
|
+
if (!(isTMultiLocation(currency) && (feeAsset === 0 || feeAsset !== undefined))) {
|
|
9013
|
+
_context.next = 7;
|
|
9014
|
+
break;
|
|
9015
|
+
}
|
|
9016
|
+
throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
|
|
9017
|
+
case 7:
|
|
9018
|
+
if (!(isTMulti(currency) && Array.isArray(currency))) {
|
|
9019
|
+
_context.next = 17;
|
|
9020
|
+
break;
|
|
9021
|
+
}
|
|
9022
|
+
if (amount !== null) {
|
|
9023
|
+
console.warn('Amount is ignored when using overriding currency using multiple multi locations. Please set it to null.');
|
|
9024
|
+
}
|
|
9025
|
+
if (!(currency.length === 0)) {
|
|
9026
|
+
_context.next = 11;
|
|
9027
|
+
break;
|
|
9028
|
+
}
|
|
9029
|
+
throw new InvalidCurrencyError('Overrided multi assets cannot be empty');
|
|
9030
|
+
case 11:
|
|
9031
|
+
if (!(currency.length === 1 && (feeAsset === 0 || feeAsset !== undefined))) {
|
|
9032
|
+
_context.next = 13;
|
|
9033
|
+
break;
|
|
9034
|
+
}
|
|
9035
|
+
throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
|
|
9036
|
+
case 13:
|
|
9037
|
+
if (!(currency.length > 1 && feeAsset === undefined)) {
|
|
9038
|
+
_context.next = 15;
|
|
9039
|
+
break;
|
|
9040
|
+
}
|
|
9041
|
+
throw new InvalidCurrencyError('Overrided multi assets cannot be used without specifying fee asset');
|
|
9042
|
+
case 15:
|
|
9043
|
+
if (!(currency.length > 1 && feeAsset !== undefined && (feeAsset < 0 || feeAsset >= currency.length))) {
|
|
9044
|
+
_context.next = 17;
|
|
9045
|
+
break;
|
|
9046
|
+
}
|
|
9047
|
+
throw new InvalidCurrencyError('Fee asset index is out of bounds. Please provide a valid index.');
|
|
9048
|
+
case 17:
|
|
8760
9049
|
asset = getAssetBySymbolOrId(origin, currency);
|
|
8761
9050
|
isMultiLocationDestination = _typeof(destination) === 'object';
|
|
8762
9051
|
isMultiLocationCurrency = _typeof(currency) === 'object';
|
|
8763
9052
|
if (!(destination !== undefined && !isMultiLocationDestination)) {
|
|
8764
|
-
_context.next =
|
|
9053
|
+
_context.next = 25;
|
|
8765
9054
|
break;
|
|
8766
9055
|
}
|
|
8767
9056
|
originRelayChainSymbol = getRelayChainSymbol(origin);
|
|
8768
9057
|
destinationRelayChainSymbol = getRelayChainSymbol(destination);
|
|
8769
9058
|
if (!(originRelayChainSymbol !== destinationRelayChainSymbol)) {
|
|
8770
|
-
_context.next =
|
|
9059
|
+
_context.next = 25;
|
|
8771
9060
|
break;
|
|
8772
9061
|
}
|
|
8773
9062
|
throw new IncompatibleNodesError();
|
|
8774
|
-
case
|
|
9063
|
+
case 25:
|
|
8775
9064
|
originNode = getNode(origin);
|
|
8776
9065
|
assetCheckEnabled = destination === 'AssetHubKusama' || destination === 'AssetHubPolkadot' || isMultiLocationCurrency ? false : originNode.assetCheckEnabled;
|
|
8777
9066
|
if (!(asset === null && assetCheckEnabled)) {
|
|
8778
|
-
_context.next =
|
|
9067
|
+
_context.next = 29;
|
|
8779
9068
|
break;
|
|
8780
9069
|
}
|
|
8781
9070
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
|
|
8782
|
-
case
|
|
9071
|
+
case 29:
|
|
8783
9072
|
if (!(destination !== undefined && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !hasSupportForAsset(destination, asset.symbol))) {
|
|
8784
|
-
_context.next =
|
|
9073
|
+
_context.next = 31;
|
|
8785
9074
|
break;
|
|
8786
9075
|
}
|
|
8787
9076
|
throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
|
|
8788
|
-
case
|
|
9077
|
+
case 31:
|
|
8789
9078
|
if (!(api !== null && api !== void 0)) {
|
|
8790
|
-
_context.next =
|
|
9079
|
+
_context.next = 35;
|
|
8791
9080
|
break;
|
|
8792
9081
|
}
|
|
8793
9082
|
_context.t0 = api;
|
|
8794
|
-
_context.next =
|
|
9083
|
+
_context.next = 38;
|
|
8795
9084
|
break;
|
|
8796
|
-
case
|
|
8797
|
-
_context.next =
|
|
9085
|
+
case 35:
|
|
9086
|
+
_context.next = 37;
|
|
8798
9087
|
return createApiInstanceForNode(origin);
|
|
8799
|
-
case
|
|
9088
|
+
case 37:
|
|
8800
9089
|
_context.t0 = _context.sent;
|
|
8801
|
-
case
|
|
9090
|
+
case 38:
|
|
8802
9091
|
apiWithFallback = _context.t0;
|
|
8803
|
-
amountStr = amount.toString();
|
|
8804
|
-
if (!(
|
|
8805
|
-
_context.next =
|
|
9092
|
+
amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
|
|
9093
|
+
if (!isTMulti(currency)) {
|
|
9094
|
+
_context.next = 44;
|
|
8806
9095
|
break;
|
|
8807
9096
|
}
|
|
8808
9097
|
console.warn('Keep alive check is not supported when using MultiLocation as currency.');
|
|
8809
|
-
_context.next =
|
|
9098
|
+
_context.next = 54;
|
|
8810
9099
|
break;
|
|
8811
|
-
case
|
|
9100
|
+
case 44:
|
|
8812
9101
|
if (!(_typeof(address) === 'object')) {
|
|
8813
|
-
_context.next =
|
|
9102
|
+
_context.next = 48;
|
|
8814
9103
|
break;
|
|
8815
9104
|
}
|
|
8816
9105
|
console.warn('Keep alive check is not supported when using MultiLocation as address.');
|
|
8817
|
-
_context.next =
|
|
9106
|
+
_context.next = 54;
|
|
8818
9107
|
break;
|
|
8819
|
-
case
|
|
9108
|
+
case 48:
|
|
8820
9109
|
if (!(_typeof(destination) === 'object')) {
|
|
8821
|
-
_context.next =
|
|
9110
|
+
_context.next = 52;
|
|
8822
9111
|
break;
|
|
8823
9112
|
}
|
|
8824
9113
|
console.warn('Keep alive check is not supported when using MultiLocation as destination.');
|
|
8825
|
-
_context.next =
|
|
9114
|
+
_context.next = 54;
|
|
8826
9115
|
break;
|
|
8827
|
-
case
|
|
8828
|
-
_context.next =
|
|
9116
|
+
case 52:
|
|
9117
|
+
_context.next = 54;
|
|
8829
9118
|
return checkKeepAlive({
|
|
8830
9119
|
originApi: apiWithFallback,
|
|
8831
9120
|
address: address,
|
|
8832
|
-
amount: amountStr,
|
|
9121
|
+
amount: amountStr !== null && amountStr !== void 0 ? amountStr : '',
|
|
8833
9122
|
originNode: origin,
|
|
8834
9123
|
destApi: destApiForKeepAlive,
|
|
8835
9124
|
currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : currency.toString(),
|
|
8836
9125
|
destNode: destination
|
|
8837
9126
|
});
|
|
8838
|
-
case
|
|
8839
|
-
currencyStr =
|
|
9127
|
+
case 54:
|
|
9128
|
+
currencyStr = isTMulti(currency) ? undefined : currency.toString();
|
|
8840
9129
|
currencyId = assetCheckEnabled ? asset === null || asset === void 0 ? void 0 : asset.assetId : currencyStr;
|
|
8841
9130
|
return _context.abrupt("return", originNode.transfer({
|
|
8842
9131
|
api: apiWithFallback,
|
|
8843
9132
|
currencySymbol: asset === null || asset === void 0 ? void 0 : asset.symbol,
|
|
8844
9133
|
currencyId: currencyId,
|
|
8845
|
-
amount: amountStr,
|
|
9134
|
+
amount: amountStr !== null && amountStr !== void 0 ? amountStr : '',
|
|
8846
9135
|
address: address,
|
|
8847
9136
|
destination: destination,
|
|
8848
9137
|
paraIdTo: paraIdTo,
|
|
8849
|
-
overridedCurrencyMultiLocation:
|
|
9138
|
+
overridedCurrencyMultiLocation: isTMulti(currency) ? currency : undefined,
|
|
8850
9139
|
feeAsset: feeAsset,
|
|
8851
9140
|
serializedApiCallEnabled: serializedApiCallEnabled
|
|
8852
9141
|
}));
|
|
8853
|
-
case
|
|
9142
|
+
case 57:
|
|
8854
9143
|
case "end":
|
|
8855
9144
|
return _context.stop();
|
|
8856
9145
|
}
|
|
@@ -9367,6 +9656,13 @@ var KiltSpiritnet = {
|
|
|
9367
9656
|
"PolkadotXcm"
|
|
9368
9657
|
]
|
|
9369
9658
|
};
|
|
9659
|
+
var Curio = {
|
|
9660
|
+
defaultPallet: "XTokens",
|
|
9661
|
+
supportedPallets: [
|
|
9662
|
+
"PolkadotXcm",
|
|
9663
|
+
"XTokens"
|
|
9664
|
+
]
|
|
9665
|
+
};
|
|
9370
9666
|
var pallets = {
|
|
9371
9667
|
AssetHubPolkadot: AssetHubPolkadot,
|
|
9372
9668
|
Acala: Acala,
|
|
@@ -9419,7 +9715,8 @@ var pallets = {
|
|
|
9419
9715
|
Khala: Khala,
|
|
9420
9716
|
Phala: Phala,
|
|
9421
9717
|
Subsocial: Subsocial,
|
|
9422
|
-
KiltSpiritnet: KiltSpiritnet
|
|
9718
|
+
KiltSpiritnet: KiltSpiritnet,
|
|
9719
|
+
Curio: Curio
|
|
9423
9720
|
};
|
|
9424
9721
|
|
|
9425
9722
|
var palletsMapJson = /*#__PURE__*/Object.freeze({
|
|
@@ -9443,6 +9740,7 @@ var palletsMapJson = /*#__PURE__*/Object.freeze({
|
|
|
9443
9740
|
Crab: Crab,
|
|
9444
9741
|
Crust: Crust,
|
|
9445
9742
|
CrustShadow: CrustShadow,
|
|
9743
|
+
Curio: Curio,
|
|
9446
9744
|
Darwinia: Darwinia,
|
|
9447
9745
|
Encointer: Encointer,
|
|
9448
9746
|
HydraDX: HydraDX,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": "@paraspell/sdk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"tslib": "^2.6.2",
|
|
55
55
|
"typescript": "5.2.2"
|
|
56
56
|
},
|
|
57
|
-
"packageManager": "pnpm@8.5.1",
|
|
58
57
|
"scripts": {
|
|
59
58
|
"compile": "tsc --noEmit",
|
|
60
59
|
"build": "rollup -c",
|