@paraspell/sdk-core 8.9.0 → 8.9.1
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 +160 -90
- package/dist/index.d.ts +14 -3
- package/dist/index.mjs +159 -90
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var assets = require('@paraspell/assets');
|
|
4
4
|
var sdkCommon = require('@paraspell/sdk-common');
|
|
5
|
-
var pallets = require('@paraspell/pallets');
|
|
6
5
|
var ethers = require('ethers');
|
|
6
|
+
var pallets = require('@paraspell/pallets');
|
|
7
7
|
var viem = require('viem');
|
|
8
8
|
|
|
9
9
|
function _arrayLikeToArray(r, a) {
|
|
@@ -2165,7 +2165,14 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
|
|
|
2165
2165
|
var paraId = resolveParaId(paraIdTo, destination);
|
|
2166
2166
|
return _objectSpread2({
|
|
2167
2167
|
dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
|
|
2168
|
-
beneficiary:
|
|
2168
|
+
beneficiary: createVersionedBeneficiary({
|
|
2169
|
+
api: api,
|
|
2170
|
+
scenario: 'RelayToPara',
|
|
2171
|
+
pallet: null,
|
|
2172
|
+
recipientAddress: address,
|
|
2173
|
+
version: version,
|
|
2174
|
+
paraId: paraId
|
|
2175
|
+
}),
|
|
2169
2176
|
assets: createVersionedMultiAssets(version, asset.amount, {
|
|
2170
2177
|
parents: sdkCommon.Parents.ZERO,
|
|
2171
2178
|
interior: 'Here'
|
|
@@ -2688,76 +2695,89 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
2688
2695
|
};
|
|
2689
2696
|
}();
|
|
2690
2697
|
|
|
2691
|
-
var
|
|
2692
|
-
var
|
|
2693
|
-
|
|
2694
|
-
|
|
2698
|
+
var createBeneficiaryMultiLocation = function createBeneficiaryMultiLocation(_ref) {
|
|
2699
|
+
var api = _ref.api,
|
|
2700
|
+
scenario = _ref.scenario,
|
|
2701
|
+
pallet = _ref.pallet,
|
|
2702
|
+
recipientAddress = _ref.recipientAddress,
|
|
2703
|
+
version = _ref.version,
|
|
2704
|
+
paraId = _ref.paraId;
|
|
2705
|
+
if (sdkCommon.isTMultiLocation(recipientAddress)) {
|
|
2706
|
+
return recipientAddress;
|
|
2695
2707
|
}
|
|
2696
2708
|
var isEthAddress = ethers.ethers.isAddress(recipientAddress);
|
|
2709
|
+
var getAccountPayload = function getAccountPayload(allowNetwork) {
|
|
2710
|
+
if (isEthAddress) {
|
|
2711
|
+
return {
|
|
2712
|
+
AccountKey20: _objectSpread2({
|
|
2713
|
+
key: recipientAddress
|
|
2714
|
+
}, allowNetwork ? {
|
|
2715
|
+
network: 'any'
|
|
2716
|
+
} : {})
|
|
2717
|
+
};
|
|
2718
|
+
}
|
|
2719
|
+
return {
|
|
2720
|
+
AccountId32: _objectSpread2({
|
|
2721
|
+
id: api.accountToHex(recipientAddress)
|
|
2722
|
+
}, allowNetwork ? {
|
|
2723
|
+
network: 'any'
|
|
2724
|
+
} : {})
|
|
2725
|
+
};
|
|
2726
|
+
};
|
|
2697
2727
|
if (scenario === 'ParaToRelay') {
|
|
2698
|
-
return
|
|
2728
|
+
return {
|
|
2699
2729
|
parents: pallet === 'XTokens' ? sdkCommon.Parents.ONE : sdkCommon.Parents.ZERO,
|
|
2700
2730
|
interior: createX1Payload(version, {
|
|
2701
|
-
AccountId32: _objectSpread2(
|
|
2702
|
-
network: 'any'
|
|
2703
|
-
}), {}, {
|
|
2731
|
+
AccountId32: _objectSpread2({
|
|
2704
2732
|
id: api.accountToHex(recipientAddress)
|
|
2705
|
-
}
|
|
2733
|
+
}, version === exports.Version.V1 ? {
|
|
2734
|
+
network: 'any'
|
|
2735
|
+
} : {})
|
|
2706
2736
|
})
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
|
|
2710
|
-
return addXcmVersionHeader({
|
|
2737
|
+
};
|
|
2738
|
+
} else if (scenario === 'ParaToPara' && pallet === 'XTokens') {
|
|
2739
|
+
return {
|
|
2711
2740
|
parents: sdkCommon.Parents.ONE,
|
|
2712
2741
|
interior: {
|
|
2713
2742
|
X2: [{
|
|
2714
|
-
Parachain:
|
|
2715
|
-
},
|
|
2716
|
-
AccountKey20: _objectSpread2(_objectSpread2({}, (version === exports.Version.V1 || version === exports.Version.V2) && {
|
|
2717
|
-
network: 'any'
|
|
2718
|
-
}), {}, {
|
|
2719
|
-
key: recipientAddress
|
|
2720
|
-
})
|
|
2721
|
-
} : {
|
|
2722
|
-
AccountId32: _objectSpread2(_objectSpread2({}, (version === exports.Version.V1 || version === exports.Version.V2) && {
|
|
2723
|
-
network: 'any'
|
|
2724
|
-
}), {}, {
|
|
2725
|
-
id: api.accountToHex(recipientAddress)
|
|
2726
|
-
})
|
|
2727
|
-
}]
|
|
2743
|
+
Parachain: paraId
|
|
2744
|
+
}, getAccountPayload(version === exports.Version.V1 || version === exports.Version.V2)]
|
|
2728
2745
|
}
|
|
2729
|
-
}
|
|
2730
|
-
}
|
|
2731
|
-
|
|
2732
|
-
return addXcmVersionHeader({
|
|
2746
|
+
};
|
|
2747
|
+
} else if (scenario === 'ParaToPara' && pallet === 'PolkadotXcm') {
|
|
2748
|
+
return {
|
|
2733
2749
|
parents: sdkCommon.Parents.ZERO,
|
|
2734
|
-
interior: createX1Payload(version,
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
AccountId32: _objectSpread2(_objectSpread2({}, (version === exports.Version.V1 || version === exports.Version.V2) && {
|
|
2742
|
-
network: 'any'
|
|
2743
|
-
}), {}, {
|
|
2744
|
-
id: api.accountToHex(recipientAddress)
|
|
2745
|
-
})
|
|
2746
|
-
})
|
|
2747
|
-
}, version);
|
|
2750
|
+
interior: createX1Payload(version, getAccountPayload(version === exports.Version.V1 || version === exports.Version.V2))
|
|
2751
|
+
};
|
|
2752
|
+
} else {
|
|
2753
|
+
return {
|
|
2754
|
+
parents: sdkCommon.Parents.ZERO,
|
|
2755
|
+
interior: createX1Payload(version, getAccountPayload(false))
|
|
2756
|
+
};
|
|
2748
2757
|
}
|
|
2749
|
-
|
|
2758
|
+
};
|
|
2759
|
+
|
|
2760
|
+
var transformMultiLocation = function transformMultiLocation(multiLocation) {
|
|
2761
|
+
var newInterior;
|
|
2762
|
+
if (multiLocation.interior === 'Here') {
|
|
2763
|
+
newInterior = 'Here';
|
|
2764
|
+
} else {
|
|
2765
|
+
var junctions = Object.values(multiLocation.interior).flat().filter(function (junction) {
|
|
2766
|
+
return _typeof(junction) === 'object' && junction !== null;
|
|
2767
|
+
});
|
|
2768
|
+
var filteredJunctions = junctions.filter(function (junction) {
|
|
2769
|
+
return !('Parachain' in junction);
|
|
2770
|
+
});
|
|
2771
|
+
if (filteredJunctions.length === 0) {
|
|
2772
|
+
newInterior = 'Here';
|
|
2773
|
+
} else {
|
|
2774
|
+
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
return _objectSpread2(_objectSpread2({}, multiLocation), {}, {
|
|
2750
2778
|
parents: sdkCommon.Parents.ZERO,
|
|
2751
|
-
interior:
|
|
2752
|
-
|
|
2753
|
-
key: recipientAddress
|
|
2754
|
-
}
|
|
2755
|
-
} : {
|
|
2756
|
-
AccountId32: {
|
|
2757
|
-
id: api.accountToHex(recipientAddress)
|
|
2758
|
-
}
|
|
2759
|
-
})
|
|
2760
|
-
}, version);
|
|
2779
|
+
interior: newInterior
|
|
2780
|
+
});
|
|
2761
2781
|
};
|
|
2762
2782
|
|
|
2763
2783
|
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messageId) {
|
|
@@ -2785,7 +2805,13 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
|
|
|
2785
2805
|
assets: {
|
|
2786
2806
|
Wild: 'All'
|
|
2787
2807
|
},
|
|
2788
|
-
beneficiary:
|
|
2808
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
2809
|
+
api: api,
|
|
2810
|
+
scenario: scenario,
|
|
2811
|
+
pallet: 'PolkadotXcm',
|
|
2812
|
+
recipientAddress: senderAddress,
|
|
2813
|
+
version: version
|
|
2814
|
+
})
|
|
2789
2815
|
}
|
|
2790
2816
|
}]
|
|
2791
2817
|
}, {
|
|
@@ -3599,7 +3625,14 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3599
3625
|
input = {
|
|
3600
3626
|
api: api,
|
|
3601
3627
|
asset: asset,
|
|
3602
|
-
addressSelection:
|
|
3628
|
+
addressSelection: createVersionedBeneficiary({
|
|
3629
|
+
api: api,
|
|
3630
|
+
scenario: scenario,
|
|
3631
|
+
pallet: 'XTokens',
|
|
3632
|
+
recipientAddress: address,
|
|
3633
|
+
version: versionOrDefault,
|
|
3634
|
+
paraId: paraId
|
|
3635
|
+
}),
|
|
3603
3636
|
fees: getFees(scenario),
|
|
3604
3637
|
origin: this.node,
|
|
3605
3638
|
scenario: scenario,
|
|
@@ -3640,7 +3673,14 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3640
3673
|
return _context.abrupt("return", this.transferPolkadotXCM({
|
|
3641
3674
|
api: api,
|
|
3642
3675
|
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraId),
|
|
3643
|
-
addressSelection:
|
|
3676
|
+
addressSelection: createVersionedBeneficiary({
|
|
3677
|
+
api: api,
|
|
3678
|
+
scenario: scenario,
|
|
3679
|
+
pallet: 'PolkadotXcm',
|
|
3680
|
+
recipientAddress: address,
|
|
3681
|
+
version: versionOrDefault,
|
|
3682
|
+
paraId: paraId
|
|
3683
|
+
}),
|
|
3644
3684
|
address: address,
|
|
3645
3685
|
currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset),
|
|
3646
3686
|
overriddenAsset: overriddenAsset,
|
|
@@ -3946,27 +3986,10 @@ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3946
3986
|
}]);
|
|
3947
3987
|
}(ParachainNode);
|
|
3948
3988
|
|
|
3949
|
-
var
|
|
3950
|
-
var
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
} else {
|
|
3954
|
-
var junctions = Object.values(multiLocation.interior).flat().filter(function (junction) {
|
|
3955
|
-
return _typeof(junction) === 'object' && junction !== null;
|
|
3956
|
-
});
|
|
3957
|
-
var filteredJunctions = junctions.filter(function (junction) {
|
|
3958
|
-
return !('Parachain' in junction);
|
|
3959
|
-
});
|
|
3960
|
-
if (filteredJunctions.length === 0) {
|
|
3961
|
-
newInterior = 'Here';
|
|
3962
|
-
} else {
|
|
3963
|
-
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
3964
|
-
}
|
|
3965
|
-
}
|
|
3966
|
-
return _objectSpread2(_objectSpread2({}, multiLocation), {}, {
|
|
3967
|
-
parents: sdkCommon.Parents.ZERO,
|
|
3968
|
-
interior: newInterior
|
|
3969
|
-
});
|
|
3989
|
+
var createVersionedBeneficiary = function createVersionedBeneficiary(options) {
|
|
3990
|
+
var version = options.version;
|
|
3991
|
+
var multiLocation = createBeneficiaryMultiLocation(options);
|
|
3992
|
+
return addXcmVersionHeader(multiLocation, version);
|
|
3970
3993
|
};
|
|
3971
3994
|
|
|
3972
3995
|
var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
@@ -3983,7 +4006,14 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
|
3983
4006
|
_extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2);
|
|
3984
4007
|
_extractVersionFromHe2[0];
|
|
3985
4008
|
var dest = _extractVersionFromHe2[1];
|
|
3986
|
-
var beneficiaryWithHeader =
|
|
4009
|
+
var beneficiaryWithHeader = createVersionedBeneficiary({
|
|
4010
|
+
api: api,
|
|
4011
|
+
scenario: scenario,
|
|
4012
|
+
pallet: 'PolkadotXcm',
|
|
4013
|
+
recipientAddress: address,
|
|
4014
|
+
version: version,
|
|
4015
|
+
paraId: paraIdTo
|
|
4016
|
+
});
|
|
3987
4017
|
var _extractVersionFromHe3 = extractVersionFromHeader(beneficiaryWithHeader),
|
|
3988
4018
|
_extractVersionFromHe4 = _slicedToArray(_extractVersionFromHe3, 2);
|
|
3989
4019
|
_extractVersionFromHe4[0];
|
|
@@ -4093,7 +4123,13 @@ var createCustomXcmToBifrost = function createCustomXcmToBifrost(_ref, version)
|
|
|
4093
4123
|
assets: {
|
|
4094
4124
|
Wild: 'All'
|
|
4095
4125
|
},
|
|
4096
|
-
beneficiary:
|
|
4126
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
4127
|
+
api: api,
|
|
4128
|
+
scenario: scenario,
|
|
4129
|
+
pallet: 'PolkadotXcm',
|
|
4130
|
+
recipientAddress: address,
|
|
4131
|
+
version: version
|
|
4132
|
+
})
|
|
4097
4133
|
}
|
|
4098
4134
|
}]);
|
|
4099
4135
|
};
|
|
@@ -4185,7 +4221,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4185
4221
|
}
|
|
4186
4222
|
var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
|
|
4187
4223
|
header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
|
|
4188
|
-
addressSelection:
|
|
4224
|
+
addressSelection: createVersionedBeneficiary({
|
|
4225
|
+
api: api,
|
|
4226
|
+
scenario: scenario,
|
|
4227
|
+
pallet: 'PolkadotXcm',
|
|
4228
|
+
recipientAddress: address,
|
|
4229
|
+
version: this.version,
|
|
4230
|
+
paraId: paraIdTo
|
|
4231
|
+
}),
|
|
4189
4232
|
currencySelection: createVersionedMultiAssets(exports.Version.V3, asset.amount, asset.multiLocation)
|
|
4190
4233
|
});
|
|
4191
4234
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'transfer_assets', 'Unlimited');
|
|
@@ -4211,7 +4254,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4211
4254
|
};
|
|
4212
4255
|
var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
|
|
4213
4256
|
header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
|
|
4214
|
-
addressSelection:
|
|
4257
|
+
addressSelection: createVersionedBeneficiary({
|
|
4258
|
+
api: api,
|
|
4259
|
+
scenario: scenario,
|
|
4260
|
+
pallet: 'PolkadotXcm',
|
|
4261
|
+
recipientAddress: address,
|
|
4262
|
+
version: version,
|
|
4263
|
+
paraId: paraId
|
|
4264
|
+
}),
|
|
4215
4265
|
currencySelection: createVersionedMultiAssets(version, asset.amount, customMultiLocation)
|
|
4216
4266
|
});
|
|
4217
4267
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'limited_teleport_assets', 'Unlimited');
|
|
@@ -4233,7 +4283,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4233
4283
|
var versionOrDefault = (_input$version3 = input.version) !== null && _input$version3 !== void 0 ? _input$version3 : exports.Version.V2;
|
|
4234
4284
|
return _objectSpread2(_objectSpread2({}, input), {}, {
|
|
4235
4285
|
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
|
|
4236
|
-
addressSelection:
|
|
4286
|
+
addressSelection: createVersionedBeneficiary({
|
|
4287
|
+
api: api,
|
|
4288
|
+
scenario: scenario,
|
|
4289
|
+
pallet: 'PolkadotXcm',
|
|
4290
|
+
recipientAddress: address,
|
|
4291
|
+
version: versionOrDefault,
|
|
4292
|
+
paraId: paraIdTo
|
|
4293
|
+
}),
|
|
4237
4294
|
currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset)
|
|
4238
4295
|
});
|
|
4239
4296
|
}
|
|
@@ -5065,7 +5122,13 @@ var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scena
|
|
|
5065
5122
|
AllCounted: 1
|
|
5066
5123
|
}
|
|
5067
5124
|
},
|
|
5068
|
-
beneficiary:
|
|
5125
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
5126
|
+
api: api,
|
|
5127
|
+
scenario: scenario,
|
|
5128
|
+
pallet: 'PolkadotXcm',
|
|
5129
|
+
recipientAddress: address,
|
|
5130
|
+
version: version
|
|
5131
|
+
})
|
|
5069
5132
|
}
|
|
5070
5133
|
}]
|
|
5071
5134
|
}
|
|
@@ -5142,7 +5205,13 @@ var createCustomXcmAh = function createCustomXcmAh(_ref, version) {
|
|
|
5142
5205
|
AllCounted: 1
|
|
5143
5206
|
}
|
|
5144
5207
|
},
|
|
5145
|
-
beneficiary:
|
|
5208
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
5209
|
+
api: api,
|
|
5210
|
+
scenario: scenario,
|
|
5211
|
+
pallet: 'PolkadotXcm',
|
|
5212
|
+
recipientAddress: address,
|
|
5213
|
+
version: version
|
|
5214
|
+
})
|
|
5146
5215
|
}
|
|
5147
5216
|
}]);
|
|
5148
5217
|
};
|
|
@@ -7544,10 +7613,11 @@ exports.claimAssets = claimAssets;
|
|
|
7544
7613
|
exports.computeFeeFromDryRun = computeFeeFromDryRun;
|
|
7545
7614
|
exports.computeFeeFromDryRunPjs = computeFeeFromDryRunPjs;
|
|
7546
7615
|
exports.createApiInstanceForNode = createApiInstanceForNode;
|
|
7616
|
+
exports.createBeneficiaryMultiLocation = createBeneficiaryMultiLocation;
|
|
7617
|
+
exports.createVersionedBeneficiary = createVersionedBeneficiary;
|
|
7547
7618
|
exports.createX1Payload = createX1Payload;
|
|
7548
7619
|
exports.determineRelayChain = determineRelayChain;
|
|
7549
7620
|
exports.generateAddressMultiLocationV4 = generateAddressMultiLocationV4;
|
|
7550
|
-
exports.generateAddressPayload = generateAddressPayload;
|
|
7551
7621
|
exports.getAssetBalance = getAssetBalance;
|
|
7552
7622
|
exports.getAssetBalanceInternal = getAssetBalanceInternal;
|
|
7553
7623
|
exports.getBalanceForeign = getBalanceForeign;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _paraspell_assets from '@paraspell/assets';
|
|
2
2
|
import { TMultiAsset, TCurrencyInputWithAmount, TCurrencyInput, WithAmount, TAsset, TMultiAssetWithFee, TCurrencyCore, TAmount } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
|
+
import * as _paraspell_sdk_common from '@paraspell/sdk-common';
|
|
4
5
|
import { TMultiLocation, TNodeDotKsmWithRelayChains, TNodeWithRelayChains, TNodePolkadotKusama, TNode, TJunction, TEcosystemType, TJunctions } from '@paraspell/sdk-common';
|
|
5
6
|
export * from '@paraspell/sdk-common';
|
|
6
7
|
import { TPallet } from '@paraspell/pallets';
|
|
@@ -238,6 +239,14 @@ type TWeight = {
|
|
|
238
239
|
refTime: bigint;
|
|
239
240
|
proofSize: bigint;
|
|
240
241
|
};
|
|
242
|
+
type TCreateBeneficiaryOptions<TApi, TRes> = {
|
|
243
|
+
api: IPolkadotApi<TApi, TRes>;
|
|
244
|
+
scenario: TScenario;
|
|
245
|
+
pallet: TPallet | null;
|
|
246
|
+
recipientAddress: TAddress;
|
|
247
|
+
version: Version;
|
|
248
|
+
paraId?: number;
|
|
249
|
+
};
|
|
241
250
|
|
|
242
251
|
type TAssetClaimOptionsBase = {
|
|
243
252
|
node: TNodeWithRelayChains;
|
|
@@ -1447,6 +1456,8 @@ declare const transferRelayToPara: <TApi, TRes>(options: TRelayToParaOptions<TAp
|
|
|
1447
1456
|
|
|
1448
1457
|
declare const createApiInstanceForNode: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>, node: TNodeDotKsmWithRelayChains) => Promise<TApi>;
|
|
1449
1458
|
|
|
1459
|
+
declare const createVersionedBeneficiary: <TApi, TRes>(options: TCreateBeneficiaryOptions<TApi, TRes>) => OneKey<Version, _paraspell_sdk_common.TMultiLocation>;
|
|
1460
|
+
|
|
1450
1461
|
declare const createX1Payload: (version: Version, junction: TJunction) => TJunctions;
|
|
1451
1462
|
|
|
1452
1463
|
declare const computeFeeFromDryRun: (dryRun: any, node: TNodeDotKsmWithRelayChains, executionFee: bigint) => bigint;
|
|
@@ -1457,8 +1468,6 @@ declare const resolveModuleError: (node: TNodeDotKsmWithRelayChains, error: TMod
|
|
|
1457
1468
|
|
|
1458
1469
|
declare const generateAddressMultiLocationV4: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>, address: TAddress) => TXcmVersioned<TMultiLocation>;
|
|
1459
1470
|
|
|
1460
|
-
declare const generateAddressPayload: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>, scenario: TScenario, pallet: TPallet | null, recipientAddress: TAddress, version: Version, nodeId: number | undefined) => TXcmVersioned<TMultiLocation>;
|
|
1461
|
-
|
|
1462
1471
|
declare const getFees: (scenario: TScenario) => number;
|
|
1463
1472
|
|
|
1464
1473
|
/**
|
|
@@ -1469,6 +1478,8 @@ declare const getFees: (scenario: TScenario) => number;
|
|
|
1469
1478
|
*/
|
|
1470
1479
|
declare const getNode: <TApi, TRes, T extends keyof ReturnType<typeof nodes>>(node: T) => ReturnType<typeof nodes<TApi, TRes>>[T];
|
|
1471
1480
|
|
|
1481
|
+
declare const createBeneficiaryMultiLocation: <TApi, TRes>({ api, scenario, pallet, recipientAddress, version, paraId }: TCreateBeneficiaryOptions<TApi, TRes>) => TMultiLocation;
|
|
1482
|
+
|
|
1472
1483
|
declare const transformMultiLocation: (multiLocation: TMultiLocation) => TMultiLocation;
|
|
1473
1484
|
|
|
1474
1485
|
declare const resolveParaId: (paraId: number | undefined, destination: TDestination) => number | undefined;
|
|
@@ -1490,4 +1501,4 @@ declare const determineRelayChain: (node: TNodeWithRelayChains) => TRelaychain;
|
|
|
1490
1501
|
*/
|
|
1491
1502
|
declare const isRelayChain: (node: TNodeWithRelayChains) => node is "Polkadot" | "Kusama";
|
|
1492
1503
|
|
|
1493
|
-
export { AssetClaimBuilder, BatchMode, Builder, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, NoXCMSupportImplementedError, NodeNotSupportedError, type OneKey, PolkadotXcmError, ScenarioNotSupportedError, type TAddress, type TApiOrUrl, type TAssetClaimOptions, type TAssetClaimOptionsBase, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TEvmNodeFrom, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TMantaAsset, type TModuleError, type TNativeTokenAsset, type TNodeConfig, type TNodeConfigMap, type TNodleAsset, type TOriginFeeDetails, type TOtherReserveAsset, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TTransferInfo, type TVerifyEdOnDestinationOptions, type TVerifyEdOnDestinationOptionsBase, type TVersionClaimAssets, type TWeight, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TXcmVersioned, type TZeitgeistAsset, Version, type WithApi, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, determineRelayChain, generateAddressMultiLocationV4,
|
|
1504
|
+
export { AssetClaimBuilder, BatchMode, Builder, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, NoXCMSupportImplementedError, NodeNotSupportedError, type OneKey, PolkadotXcmError, ScenarioNotSupportedError, type TAddress, type TApiOrUrl, type TAssetClaimOptions, type TAssetClaimOptionsBase, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TCreateBeneficiaryOptions, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TEvmNodeFrom, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TMantaAsset, type TModuleError, type TNativeTokenAsset, type TNodeConfig, type TNodeConfigMap, type TNodleAsset, type TOriginFeeDetails, type TOtherReserveAsset, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TTransferInfo, type TVerifyEdOnDestinationOptions, type TVerifyEdOnDestinationOptionsBase, type TVersionClaimAssets, type TWeight, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TXcmVersioned, type TZeitgeistAsset, Version, type WithApi, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, determineRelayChain, generateAddressMultiLocationV4, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDryRun, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, isEthersContract, isEthersSigner, isRelayChain, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
|
package/dist/index.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import { InvalidCurrencyError, isForeignAsset, getOtherAssets, getAssetsObject,
|
|
|
2
2
|
export * from '@paraspell/assets';
|
|
3
3
|
import { Parents, isTMultiLocation, NODE_NAMES_DOT_KSM, deepEqual, hasJunction } from '@paraspell/sdk-common';
|
|
4
4
|
export * from '@paraspell/sdk-common';
|
|
5
|
+
import { Contract, ethers } from 'ethers';
|
|
5
6
|
import { getDefaultPallet, getSupportedPalletsDetails } from '@paraspell/pallets';
|
|
6
7
|
export * from '@paraspell/pallets';
|
|
7
|
-
import { Contract, ethers } from 'ethers';
|
|
8
8
|
import { getContract, createPublicClient, http } from 'viem';
|
|
9
9
|
|
|
10
10
|
function _arrayLikeToArray(r, a) {
|
|
@@ -2166,7 +2166,14 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
|
|
|
2166
2166
|
var paraId = resolveParaId(paraIdTo, destination);
|
|
2167
2167
|
return _objectSpread2({
|
|
2168
2168
|
dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
|
|
2169
|
-
beneficiary:
|
|
2169
|
+
beneficiary: createVersionedBeneficiary({
|
|
2170
|
+
api: api,
|
|
2171
|
+
scenario: 'RelayToPara',
|
|
2172
|
+
pallet: null,
|
|
2173
|
+
recipientAddress: address,
|
|
2174
|
+
version: version,
|
|
2175
|
+
paraId: paraId
|
|
2176
|
+
}),
|
|
2170
2177
|
assets: createVersionedMultiAssets(version, asset.amount, {
|
|
2171
2178
|
parents: Parents.ZERO,
|
|
2172
2179
|
interior: 'Here'
|
|
@@ -2689,76 +2696,89 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
2689
2696
|
};
|
|
2690
2697
|
}();
|
|
2691
2698
|
|
|
2692
|
-
var
|
|
2693
|
-
var
|
|
2694
|
-
|
|
2695
|
-
|
|
2699
|
+
var createBeneficiaryMultiLocation = function createBeneficiaryMultiLocation(_ref) {
|
|
2700
|
+
var api = _ref.api,
|
|
2701
|
+
scenario = _ref.scenario,
|
|
2702
|
+
pallet = _ref.pallet,
|
|
2703
|
+
recipientAddress = _ref.recipientAddress,
|
|
2704
|
+
version = _ref.version,
|
|
2705
|
+
paraId = _ref.paraId;
|
|
2706
|
+
if (isTMultiLocation(recipientAddress)) {
|
|
2707
|
+
return recipientAddress;
|
|
2696
2708
|
}
|
|
2697
2709
|
var isEthAddress = ethers.isAddress(recipientAddress);
|
|
2710
|
+
var getAccountPayload = function getAccountPayload(allowNetwork) {
|
|
2711
|
+
if (isEthAddress) {
|
|
2712
|
+
return {
|
|
2713
|
+
AccountKey20: _objectSpread2({
|
|
2714
|
+
key: recipientAddress
|
|
2715
|
+
}, allowNetwork ? {
|
|
2716
|
+
network: 'any'
|
|
2717
|
+
} : {})
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
return {
|
|
2721
|
+
AccountId32: _objectSpread2({
|
|
2722
|
+
id: api.accountToHex(recipientAddress)
|
|
2723
|
+
}, allowNetwork ? {
|
|
2724
|
+
network: 'any'
|
|
2725
|
+
} : {})
|
|
2726
|
+
};
|
|
2727
|
+
};
|
|
2698
2728
|
if (scenario === 'ParaToRelay') {
|
|
2699
|
-
return
|
|
2729
|
+
return {
|
|
2700
2730
|
parents: pallet === 'XTokens' ? Parents.ONE : Parents.ZERO,
|
|
2701
2731
|
interior: createX1Payload(version, {
|
|
2702
|
-
AccountId32: _objectSpread2(
|
|
2703
|
-
network: 'any'
|
|
2704
|
-
}), {}, {
|
|
2732
|
+
AccountId32: _objectSpread2({
|
|
2705
2733
|
id: api.accountToHex(recipientAddress)
|
|
2706
|
-
}
|
|
2734
|
+
}, version === Version.V1 ? {
|
|
2735
|
+
network: 'any'
|
|
2736
|
+
} : {})
|
|
2707
2737
|
})
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
return addXcmVersionHeader({
|
|
2738
|
+
};
|
|
2739
|
+
} else if (scenario === 'ParaToPara' && pallet === 'XTokens') {
|
|
2740
|
+
return {
|
|
2712
2741
|
parents: Parents.ONE,
|
|
2713
2742
|
interior: {
|
|
2714
2743
|
X2: [{
|
|
2715
|
-
Parachain:
|
|
2716
|
-
},
|
|
2717
|
-
AccountKey20: _objectSpread2(_objectSpread2({}, (version === Version.V1 || version === Version.V2) && {
|
|
2718
|
-
network: 'any'
|
|
2719
|
-
}), {}, {
|
|
2720
|
-
key: recipientAddress
|
|
2721
|
-
})
|
|
2722
|
-
} : {
|
|
2723
|
-
AccountId32: _objectSpread2(_objectSpread2({}, (version === Version.V1 || version === Version.V2) && {
|
|
2724
|
-
network: 'any'
|
|
2725
|
-
}), {}, {
|
|
2726
|
-
id: api.accountToHex(recipientAddress)
|
|
2727
|
-
})
|
|
2728
|
-
}]
|
|
2744
|
+
Parachain: paraId
|
|
2745
|
+
}, getAccountPayload(version === Version.V1 || version === Version.V2)]
|
|
2729
2746
|
}
|
|
2730
|
-
}
|
|
2731
|
-
}
|
|
2732
|
-
|
|
2733
|
-
return addXcmVersionHeader({
|
|
2747
|
+
};
|
|
2748
|
+
} else if (scenario === 'ParaToPara' && pallet === 'PolkadotXcm') {
|
|
2749
|
+
return {
|
|
2734
2750
|
parents: Parents.ZERO,
|
|
2735
|
-
interior: createX1Payload(version,
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
AccountId32: _objectSpread2(_objectSpread2({}, (version === Version.V1 || version === Version.V2) && {
|
|
2743
|
-
network: 'any'
|
|
2744
|
-
}), {}, {
|
|
2745
|
-
id: api.accountToHex(recipientAddress)
|
|
2746
|
-
})
|
|
2747
|
-
})
|
|
2748
|
-
}, version);
|
|
2751
|
+
interior: createX1Payload(version, getAccountPayload(version === Version.V1 || version === Version.V2))
|
|
2752
|
+
};
|
|
2753
|
+
} else {
|
|
2754
|
+
return {
|
|
2755
|
+
parents: Parents.ZERO,
|
|
2756
|
+
interior: createX1Payload(version, getAccountPayload(false))
|
|
2757
|
+
};
|
|
2749
2758
|
}
|
|
2750
|
-
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
var transformMultiLocation = function transformMultiLocation(multiLocation) {
|
|
2762
|
+
var newInterior;
|
|
2763
|
+
if (multiLocation.interior === 'Here') {
|
|
2764
|
+
newInterior = 'Here';
|
|
2765
|
+
} else {
|
|
2766
|
+
var junctions = Object.values(multiLocation.interior).flat().filter(function (junction) {
|
|
2767
|
+
return _typeof(junction) === 'object' && junction !== null;
|
|
2768
|
+
});
|
|
2769
|
+
var filteredJunctions = junctions.filter(function (junction) {
|
|
2770
|
+
return !('Parachain' in junction);
|
|
2771
|
+
});
|
|
2772
|
+
if (filteredJunctions.length === 0) {
|
|
2773
|
+
newInterior = 'Here';
|
|
2774
|
+
} else {
|
|
2775
|
+
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
return _objectSpread2(_objectSpread2({}, multiLocation), {}, {
|
|
2751
2779
|
parents: Parents.ZERO,
|
|
2752
|
-
interior:
|
|
2753
|
-
|
|
2754
|
-
key: recipientAddress
|
|
2755
|
-
}
|
|
2756
|
-
} : {
|
|
2757
|
-
AccountId32: {
|
|
2758
|
-
id: api.accountToHex(recipientAddress)
|
|
2759
|
-
}
|
|
2760
|
-
})
|
|
2761
|
-
}, version);
|
|
2780
|
+
interior: newInterior
|
|
2781
|
+
});
|
|
2762
2782
|
};
|
|
2763
2783
|
|
|
2764
2784
|
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messageId) {
|
|
@@ -2786,7 +2806,13 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
|
|
|
2786
2806
|
assets: {
|
|
2787
2807
|
Wild: 'All'
|
|
2788
2808
|
},
|
|
2789
|
-
beneficiary:
|
|
2809
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
2810
|
+
api: api,
|
|
2811
|
+
scenario: scenario,
|
|
2812
|
+
pallet: 'PolkadotXcm',
|
|
2813
|
+
recipientAddress: senderAddress,
|
|
2814
|
+
version: version
|
|
2815
|
+
})
|
|
2790
2816
|
}
|
|
2791
2817
|
}]
|
|
2792
2818
|
}, {
|
|
@@ -3600,7 +3626,14 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3600
3626
|
input = {
|
|
3601
3627
|
api: api,
|
|
3602
3628
|
asset: asset,
|
|
3603
|
-
addressSelection:
|
|
3629
|
+
addressSelection: createVersionedBeneficiary({
|
|
3630
|
+
api: api,
|
|
3631
|
+
scenario: scenario,
|
|
3632
|
+
pallet: 'XTokens',
|
|
3633
|
+
recipientAddress: address,
|
|
3634
|
+
version: versionOrDefault,
|
|
3635
|
+
paraId: paraId
|
|
3636
|
+
}),
|
|
3604
3637
|
fees: getFees(scenario),
|
|
3605
3638
|
origin: this.node,
|
|
3606
3639
|
scenario: scenario,
|
|
@@ -3641,7 +3674,14 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3641
3674
|
return _context.abrupt("return", this.transferPolkadotXCM({
|
|
3642
3675
|
api: api,
|
|
3643
3676
|
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraId),
|
|
3644
|
-
addressSelection:
|
|
3677
|
+
addressSelection: createVersionedBeneficiary({
|
|
3678
|
+
api: api,
|
|
3679
|
+
scenario: scenario,
|
|
3680
|
+
pallet: 'PolkadotXcm',
|
|
3681
|
+
recipientAddress: address,
|
|
3682
|
+
version: versionOrDefault,
|
|
3683
|
+
paraId: paraId
|
|
3684
|
+
}),
|
|
3645
3685
|
address: address,
|
|
3646
3686
|
currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset),
|
|
3647
3687
|
overriddenAsset: overriddenAsset,
|
|
@@ -3947,27 +3987,10 @@ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
|
|
|
3947
3987
|
}]);
|
|
3948
3988
|
}(ParachainNode);
|
|
3949
3989
|
|
|
3950
|
-
var
|
|
3951
|
-
var
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
} else {
|
|
3955
|
-
var junctions = Object.values(multiLocation.interior).flat().filter(function (junction) {
|
|
3956
|
-
return _typeof(junction) === 'object' && junction !== null;
|
|
3957
|
-
});
|
|
3958
|
-
var filteredJunctions = junctions.filter(function (junction) {
|
|
3959
|
-
return !('Parachain' in junction);
|
|
3960
|
-
});
|
|
3961
|
-
if (filteredJunctions.length === 0) {
|
|
3962
|
-
newInterior = 'Here';
|
|
3963
|
-
} else {
|
|
3964
|
-
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
3965
|
-
}
|
|
3966
|
-
}
|
|
3967
|
-
return _objectSpread2(_objectSpread2({}, multiLocation), {}, {
|
|
3968
|
-
parents: Parents.ZERO,
|
|
3969
|
-
interior: newInterior
|
|
3970
|
-
});
|
|
3990
|
+
var createVersionedBeneficiary = function createVersionedBeneficiary(options) {
|
|
3991
|
+
var version = options.version;
|
|
3992
|
+
var multiLocation = createBeneficiaryMultiLocation(options);
|
|
3993
|
+
return addXcmVersionHeader(multiLocation, version);
|
|
3971
3994
|
};
|
|
3972
3995
|
|
|
3973
3996
|
var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
@@ -3984,7 +4007,14 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
|
3984
4007
|
_extractVersionFromHe2 = _slicedToArray(_extractVersionFromHe, 2);
|
|
3985
4008
|
_extractVersionFromHe2[0];
|
|
3986
4009
|
var dest = _extractVersionFromHe2[1];
|
|
3987
|
-
var beneficiaryWithHeader =
|
|
4010
|
+
var beneficiaryWithHeader = createVersionedBeneficiary({
|
|
4011
|
+
api: api,
|
|
4012
|
+
scenario: scenario,
|
|
4013
|
+
pallet: 'PolkadotXcm',
|
|
4014
|
+
recipientAddress: address,
|
|
4015
|
+
version: version,
|
|
4016
|
+
paraId: paraIdTo
|
|
4017
|
+
});
|
|
3988
4018
|
var _extractVersionFromHe3 = extractVersionFromHeader(beneficiaryWithHeader),
|
|
3989
4019
|
_extractVersionFromHe4 = _slicedToArray(_extractVersionFromHe3, 2);
|
|
3990
4020
|
_extractVersionFromHe4[0];
|
|
@@ -4094,7 +4124,13 @@ var createCustomXcmToBifrost = function createCustomXcmToBifrost(_ref, version)
|
|
|
4094
4124
|
assets: {
|
|
4095
4125
|
Wild: 'All'
|
|
4096
4126
|
},
|
|
4097
|
-
beneficiary:
|
|
4127
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
4128
|
+
api: api,
|
|
4129
|
+
scenario: scenario,
|
|
4130
|
+
pallet: 'PolkadotXcm',
|
|
4131
|
+
recipientAddress: address,
|
|
4132
|
+
version: version
|
|
4133
|
+
})
|
|
4098
4134
|
}
|
|
4099
4135
|
}]);
|
|
4100
4136
|
};
|
|
@@ -4186,7 +4222,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4186
4222
|
}
|
|
4187
4223
|
var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
|
|
4188
4224
|
header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
|
|
4189
|
-
addressSelection:
|
|
4225
|
+
addressSelection: createVersionedBeneficiary({
|
|
4226
|
+
api: api,
|
|
4227
|
+
scenario: scenario,
|
|
4228
|
+
pallet: 'PolkadotXcm',
|
|
4229
|
+
recipientAddress: address,
|
|
4230
|
+
version: this.version,
|
|
4231
|
+
paraId: paraIdTo
|
|
4232
|
+
}),
|
|
4190
4233
|
currencySelection: createVersionedMultiAssets(Version.V3, asset.amount, asset.multiLocation)
|
|
4191
4234
|
});
|
|
4192
4235
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'transfer_assets', 'Unlimited');
|
|
@@ -4212,7 +4255,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4212
4255
|
};
|
|
4213
4256
|
var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
|
|
4214
4257
|
header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
|
|
4215
|
-
addressSelection:
|
|
4258
|
+
addressSelection: createVersionedBeneficiary({
|
|
4259
|
+
api: api,
|
|
4260
|
+
scenario: scenario,
|
|
4261
|
+
pallet: 'PolkadotXcm',
|
|
4262
|
+
recipientAddress: address,
|
|
4263
|
+
version: version,
|
|
4264
|
+
paraId: paraId
|
|
4265
|
+
}),
|
|
4216
4266
|
currencySelection: createVersionedMultiAssets(version, asset.amount, customMultiLocation)
|
|
4217
4267
|
});
|
|
4218
4268
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'limited_teleport_assets', 'Unlimited');
|
|
@@ -4234,7 +4284,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4234
4284
|
var versionOrDefault = (_input$version3 = input.version) !== null && _input$version3 !== void 0 ? _input$version3 : Version.V2;
|
|
4235
4285
|
return _objectSpread2(_objectSpread2({}, input), {}, {
|
|
4236
4286
|
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
|
|
4237
|
-
addressSelection:
|
|
4287
|
+
addressSelection: createVersionedBeneficiary({
|
|
4288
|
+
api: api,
|
|
4289
|
+
scenario: scenario,
|
|
4290
|
+
pallet: 'PolkadotXcm',
|
|
4291
|
+
recipientAddress: address,
|
|
4292
|
+
version: versionOrDefault,
|
|
4293
|
+
paraId: paraIdTo
|
|
4294
|
+
}),
|
|
4238
4295
|
currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset)
|
|
4239
4296
|
});
|
|
4240
4297
|
}
|
|
@@ -5066,7 +5123,13 @@ var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scena
|
|
|
5066
5123
|
AllCounted: 1
|
|
5067
5124
|
}
|
|
5068
5125
|
},
|
|
5069
|
-
beneficiary:
|
|
5126
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
5127
|
+
api: api,
|
|
5128
|
+
scenario: scenario,
|
|
5129
|
+
pallet: 'PolkadotXcm',
|
|
5130
|
+
recipientAddress: address,
|
|
5131
|
+
version: version
|
|
5132
|
+
})
|
|
5070
5133
|
}
|
|
5071
5134
|
}]
|
|
5072
5135
|
}
|
|
@@ -5143,7 +5206,13 @@ var createCustomXcmAh = function createCustomXcmAh(_ref, version) {
|
|
|
5143
5206
|
AllCounted: 1
|
|
5144
5207
|
}
|
|
5145
5208
|
},
|
|
5146
|
-
beneficiary:
|
|
5209
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
5210
|
+
api: api,
|
|
5211
|
+
scenario: scenario,
|
|
5212
|
+
pallet: 'PolkadotXcm',
|
|
5213
|
+
recipientAddress: address,
|
|
5214
|
+
version: version
|
|
5215
|
+
})
|
|
5147
5216
|
}
|
|
5148
5217
|
}]);
|
|
5149
5218
|
};
|
|
@@ -7531,4 +7600,4 @@ var verifyEdOnDestination = /*#__PURE__*/function () {
|
|
|
7531
7600
|
};
|
|
7532
7601
|
}();
|
|
7533
7602
|
|
|
7534
|
-
export { AssetClaimBuilder, BatchMode, Builder, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, determineRelayChain, generateAddressMultiLocationV4,
|
|
7603
|
+
export { AssetClaimBuilder, BatchMode, Builder, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, determineRelayChain, generateAddressMultiLocationV4, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDryRun, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, isEthersContract, isEthersSigner, isRelayChain, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.1",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"ethers": "^6.13.5",
|
|
27
27
|
"viem": "^2.23.5",
|
|
28
|
-
"@paraspell/pallets": "8.9.
|
|
29
|
-
"@paraspell/
|
|
30
|
-
"@paraspell/
|
|
28
|
+
"@paraspell/pallets": "8.9.1",
|
|
29
|
+
"@paraspell/assets": "8.9.1",
|
|
30
|
+
"@paraspell/sdk-common": "8.9.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/plugin-syntax-import-attributes": "^7.26.0",
|