@paraspell/sdk-core 8.12.0 → 8.12.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 +44 -24
- package/dist/index.d.ts +15 -1
- package/dist/index.mjs +44 -24
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1329,20 +1329,20 @@ var Moonbeam$1 = {
|
|
|
1329
1329
|
paraId: 2004,
|
|
1330
1330
|
providers: [
|
|
1331
1331
|
{
|
|
1332
|
-
name: "
|
|
1333
|
-
endpoint: "wss://moonbeam
|
|
1332
|
+
name: "IBP1",
|
|
1333
|
+
endpoint: "wss://moonbeam.ibp.network"
|
|
1334
1334
|
},
|
|
1335
1335
|
{
|
|
1336
|
-
name: "
|
|
1337
|
-
endpoint: "wss://moonbeam.public.
|
|
1336
|
+
name: "RadiumBlock",
|
|
1337
|
+
endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
|
|
1338
1338
|
},
|
|
1339
1339
|
{
|
|
1340
|
-
name: "
|
|
1341
|
-
endpoint: "wss://moonbeam-rpc.
|
|
1340
|
+
name: "Allnodes",
|
|
1341
|
+
endpoint: "wss://moonbeam-rpc.publicnode.com"
|
|
1342
1342
|
},
|
|
1343
1343
|
{
|
|
1344
|
-
name: "
|
|
1345
|
-
endpoint: "wss://moonbeam.
|
|
1344
|
+
name: "Blast",
|
|
1345
|
+
endpoint: "wss://moonbeam.public.blastapi.io"
|
|
1346
1346
|
},
|
|
1347
1347
|
{
|
|
1348
1348
|
name: "IBP2",
|
|
@@ -1356,10 +1356,6 @@ var Moonbeam$1 = {
|
|
|
1356
1356
|
name: "OnFinality",
|
|
1357
1357
|
endpoint: "wss://moonbeam.api.onfinality.io/public-ws"
|
|
1358
1358
|
},
|
|
1359
|
-
{
|
|
1360
|
-
name: "RadiumBlock",
|
|
1361
|
-
endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
|
|
1362
|
-
},
|
|
1363
1359
|
{
|
|
1364
1360
|
name: "UnitedBloc",
|
|
1365
1361
|
endpoint: "wss://moonbeam.unitedbloc.com"
|
|
@@ -3005,12 +3001,13 @@ var getBridgeStatus = /*#__PURE__*/function () {
|
|
|
3005
3001
|
};
|
|
3006
3002
|
}();
|
|
3007
3003
|
|
|
3008
|
-
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messageId) {
|
|
3004
|
+
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, version, messageId) {
|
|
3009
3005
|
var api = _ref.api,
|
|
3010
3006
|
address = _ref.address,
|
|
3011
3007
|
asset = _ref.asset,
|
|
3012
3008
|
scenario = _ref.scenario,
|
|
3013
|
-
senderAddress = _ref.senderAddress
|
|
3009
|
+
senderAddress = _ref.senderAddress,
|
|
3010
|
+
ahAddress = _ref.ahAddress;
|
|
3014
3011
|
if (!assets.isForeignAsset(asset)) {
|
|
3015
3012
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
3016
3013
|
}
|
|
@@ -3018,7 +3015,10 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
|
|
|
3018
3015
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
3019
3016
|
}
|
|
3020
3017
|
if (!senderAddress) {
|
|
3021
|
-
throw new
|
|
3018
|
+
throw new InvalidParameterError("Please provide senderAddress");
|
|
3019
|
+
}
|
|
3020
|
+
if (assets.isNodeEvm(origin) && !ahAddress) {
|
|
3021
|
+
throw new InvalidParameterError("Please provide ahAddress");
|
|
3022
3022
|
}
|
|
3023
3023
|
var ethAsset = assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
|
|
3024
3024
|
if (!ethAsset) {
|
|
@@ -3044,7 +3044,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
|
|
|
3044
3044
|
api: api,
|
|
3045
3045
|
scenario: scenario,
|
|
3046
3046
|
pallet: 'PolkadotXcm',
|
|
3047
|
-
recipientAddress: senderAddress,
|
|
3047
|
+
recipientAddress: assets.isNodeEvm(origin) ? ahAddress : senderAddress,
|
|
3048
3048
|
version: version
|
|
3049
3049
|
})
|
|
3050
3050
|
}
|
|
@@ -3184,11 +3184,11 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3184
3184
|
key: "transfer",
|
|
3185
3185
|
value: function () {
|
|
3186
3186
|
var _transfer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
3187
|
-
var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
|
|
3187
|
+
var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
|
|
3188
3188
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3189
3189
|
while (1) switch (_context.prev = _context.next) {
|
|
3190
3190
|
case 0:
|
|
3191
|
-
api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
|
|
3191
|
+
api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
|
|
3192
3192
|
isRelayDestination = !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination);
|
|
3193
3193
|
scenario = isRelayDestination ? 'ParaToRelay' : 'ParaToPara';
|
|
3194
3194
|
paraId = resolveParaId(paraIdTo, destination);
|
|
@@ -3282,6 +3282,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3282
3282
|
paraIdTo: paraId,
|
|
3283
3283
|
version: version,
|
|
3284
3284
|
senderAddress: senderAddress,
|
|
3285
|
+
ahAddress: ahAddress,
|
|
3285
3286
|
pallet: pallet,
|
|
3286
3287
|
method: method
|
|
3287
3288
|
}; // Handle common cases
|
|
@@ -3648,7 +3649,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3648
3649
|
version: version
|
|
3649
3650
|
})
|
|
3650
3651
|
}
|
|
3651
|
-
}], version) : createCustomXcmOnDest(input, version, messageId),
|
|
3652
|
+
}], version) : createCustomXcmOnDest(input, this.node, version, messageId),
|
|
3652
3653
|
weight_limit: 'Unlimited'
|
|
3653
3654
|
}
|
|
3654
3655
|
};
|
|
@@ -5809,10 +5810,14 @@ var Moonbeam = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5809
5810
|
}, {
|
|
5810
5811
|
key: "transferPolkadotXCM",
|
|
5811
5812
|
value: function transferPolkadotXCM(input) {
|
|
5812
|
-
var
|
|
5813
|
+
var destination = input.destination,
|
|
5814
|
+
asset = input.asset,
|
|
5813
5815
|
scenario = input.scenario,
|
|
5814
5816
|
_input$version = input.version,
|
|
5815
5817
|
version = _input$version === void 0 ? this.version : _input$version;
|
|
5818
|
+
if (destination === 'Ethereum') {
|
|
5819
|
+
return this.transferToEthereum(input);
|
|
5820
|
+
}
|
|
5816
5821
|
var multiLocation = this.getMultiLocation(asset, scenario);
|
|
5817
5822
|
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
|
|
5818
5823
|
currencySelection: createVersionedMultiAssets(version, asset.amount, multiLocation)
|
|
@@ -6980,9 +6985,10 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
6980
6985
|
address: address,
|
|
6981
6986
|
scenario: 'ParaToPara',
|
|
6982
6987
|
senderAddress: senderAddress,
|
|
6988
|
+
ahAddress: ahAddress,
|
|
6983
6989
|
asset: _objectSpread2(_objectSpread2({}, foundAsset), {}, {
|
|
6984
6990
|
amount: currency.amount
|
|
6985
|
-
})}, exports.Version.V4, messageId);
|
|
6991
|
+
})}, from, exports.Version.V4, messageId);
|
|
6986
6992
|
_context.next = 39;
|
|
6987
6993
|
return api.objectToHex(customXcm, 'XcmVersionedXcm');
|
|
6988
6994
|
case 39:
|
|
@@ -7722,7 +7728,7 @@ var validateDestination = function validateDestination(origin, destination) {
|
|
|
7722
7728
|
if (sdkCommon.isRelayChain(origin) && !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination) && origin !== destination) {
|
|
7723
7729
|
throw new IncompatibleNodesError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
|
|
7724
7730
|
}
|
|
7725
|
-
if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot') {
|
|
7731
|
+
if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot' && origin !== 'Moonbeam') {
|
|
7726
7732
|
throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot and Hydration.');
|
|
7727
7733
|
}
|
|
7728
7734
|
var isMultiLocationDestination = _typeof(destination) === 'object';
|
|
@@ -7848,11 +7854,11 @@ var validateDestinationAddress = function validateDestinationAddress(address, de
|
|
|
7848
7854
|
|
|
7849
7855
|
var send = /*#__PURE__*/function () {
|
|
7850
7856
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
7851
|
-
var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
|
|
7857
|
+
var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, ahAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
|
|
7852
7858
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7853
7859
|
while (1) switch (_context.prev = _context.next) {
|
|
7854
7860
|
case 0:
|
|
7855
|
-
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
|
|
7861
|
+
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
|
|
7856
7862
|
validateCurrency(currency, feeAsset);
|
|
7857
7863
|
validateDestination(origin, destination);
|
|
7858
7864
|
validateDestinationAddress(address, destination);
|
|
@@ -7939,6 +7945,7 @@ var send = /*#__PURE__*/function () {
|
|
|
7939
7945
|
overriddenAsset: overriddenAsset,
|
|
7940
7946
|
version: version,
|
|
7941
7947
|
senderAddress: senderAddress,
|
|
7948
|
+
ahAddress: ahAddress,
|
|
7942
7949
|
pallet: pallet,
|
|
7943
7950
|
method: method
|
|
7944
7951
|
}));
|
|
@@ -8101,6 +8108,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
8101
8108
|
senderAddress: senderAddress
|
|
8102
8109
|
} : {}));
|
|
8103
8110
|
}
|
|
8111
|
+
/**
|
|
8112
|
+
* Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
|
|
8113
|
+
*
|
|
8114
|
+
* @param address - The address to be used.
|
|
8115
|
+
* @returns An instance of Builder
|
|
8116
|
+
*/
|
|
8117
|
+
}, {
|
|
8118
|
+
key: "ahAddress",
|
|
8119
|
+
value: function ahAddress(address) {
|
|
8120
|
+
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
8121
|
+
ahAddress: address
|
|
8122
|
+
}));
|
|
8123
|
+
}
|
|
8104
8124
|
/**
|
|
8105
8125
|
* Sets the XCM version to be used for the transfer.
|
|
8106
8126
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ type TPolkadotXCMTransferOptions<TApi, TRes> = {
|
|
|
77
77
|
paraIdTo?: number;
|
|
78
78
|
version?: Version;
|
|
79
79
|
senderAddress?: string;
|
|
80
|
+
ahAddress?: string;
|
|
80
81
|
pallet?: string;
|
|
81
82
|
method?: string;
|
|
82
83
|
};
|
|
@@ -141,9 +142,13 @@ type TSendBaseOptions = {
|
|
|
141
142
|
*/
|
|
142
143
|
address: TAddress;
|
|
143
144
|
/**
|
|
144
|
-
* The optional sender address. A SS58
|
|
145
|
+
* The optional sender address. A SS58 or H160 format.
|
|
145
146
|
*/
|
|
146
147
|
senderAddress?: string;
|
|
148
|
+
/**
|
|
149
|
+
* The optional asset hub address. A SS58 format only.
|
|
150
|
+
*/
|
|
151
|
+
ahAddress?: string;
|
|
147
152
|
/**
|
|
148
153
|
* The destination node or multi-location
|
|
149
154
|
*/
|
|
@@ -850,6 +855,15 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
|
|
|
850
855
|
address: TAddress;
|
|
851
856
|
senderAddress: string;
|
|
852
857
|
}>;
|
|
858
|
+
/**
|
|
859
|
+
* Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
|
|
860
|
+
*
|
|
861
|
+
* @param address - The address to be used.
|
|
862
|
+
* @returns An instance of Builder
|
|
863
|
+
*/
|
|
864
|
+
ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, T & {
|
|
865
|
+
ahAddress: string | undefined;
|
|
866
|
+
}>;
|
|
853
867
|
/**
|
|
854
868
|
* Sets the XCM version to be used for the transfer.
|
|
855
869
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1330,20 +1330,20 @@ var Moonbeam$1 = {
|
|
|
1330
1330
|
paraId: 2004,
|
|
1331
1331
|
providers: [
|
|
1332
1332
|
{
|
|
1333
|
-
name: "
|
|
1334
|
-
endpoint: "wss://moonbeam
|
|
1333
|
+
name: "IBP1",
|
|
1334
|
+
endpoint: "wss://moonbeam.ibp.network"
|
|
1335
1335
|
},
|
|
1336
1336
|
{
|
|
1337
|
-
name: "
|
|
1338
|
-
endpoint: "wss://moonbeam.public.
|
|
1337
|
+
name: "RadiumBlock",
|
|
1338
|
+
endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
|
|
1339
1339
|
},
|
|
1340
1340
|
{
|
|
1341
|
-
name: "
|
|
1342
|
-
endpoint: "wss://moonbeam-rpc.
|
|
1341
|
+
name: "Allnodes",
|
|
1342
|
+
endpoint: "wss://moonbeam-rpc.publicnode.com"
|
|
1343
1343
|
},
|
|
1344
1344
|
{
|
|
1345
|
-
name: "
|
|
1346
|
-
endpoint: "wss://moonbeam.
|
|
1345
|
+
name: "Blast",
|
|
1346
|
+
endpoint: "wss://moonbeam.public.blastapi.io"
|
|
1347
1347
|
},
|
|
1348
1348
|
{
|
|
1349
1349
|
name: "IBP2",
|
|
@@ -1357,10 +1357,6 @@ var Moonbeam$1 = {
|
|
|
1357
1357
|
name: "OnFinality",
|
|
1358
1358
|
endpoint: "wss://moonbeam.api.onfinality.io/public-ws"
|
|
1359
1359
|
},
|
|
1360
|
-
{
|
|
1361
|
-
name: "RadiumBlock",
|
|
1362
|
-
endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
|
|
1363
|
-
},
|
|
1364
1360
|
{
|
|
1365
1361
|
name: "UnitedBloc",
|
|
1366
1362
|
endpoint: "wss://moonbeam.unitedbloc.com"
|
|
@@ -3006,12 +3002,13 @@ var getBridgeStatus = /*#__PURE__*/function () {
|
|
|
3006
3002
|
};
|
|
3007
3003
|
}();
|
|
3008
3004
|
|
|
3009
|
-
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messageId) {
|
|
3005
|
+
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, version, messageId) {
|
|
3010
3006
|
var api = _ref.api,
|
|
3011
3007
|
address = _ref.address,
|
|
3012
3008
|
asset = _ref.asset,
|
|
3013
3009
|
scenario = _ref.scenario,
|
|
3014
|
-
senderAddress = _ref.senderAddress
|
|
3010
|
+
senderAddress = _ref.senderAddress,
|
|
3011
|
+
ahAddress = _ref.ahAddress;
|
|
3015
3012
|
if (!isForeignAsset(asset)) {
|
|
3016
3013
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
3017
3014
|
}
|
|
@@ -3019,7 +3016,10 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
|
|
|
3019
3016
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
3020
3017
|
}
|
|
3021
3018
|
if (!senderAddress) {
|
|
3022
|
-
throw new
|
|
3019
|
+
throw new InvalidParameterError("Please provide senderAddress");
|
|
3020
|
+
}
|
|
3021
|
+
if (isNodeEvm(origin) && !ahAddress) {
|
|
3022
|
+
throw new InvalidParameterError("Please provide ahAddress");
|
|
3023
3023
|
}
|
|
3024
3024
|
var ethAsset = findAssetByMultiLocation(getOtherAssets('Ethereum'), asset.multiLocation);
|
|
3025
3025
|
if (!ethAsset) {
|
|
@@ -3045,7 +3045,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, version, messag
|
|
|
3045
3045
|
api: api,
|
|
3046
3046
|
scenario: scenario,
|
|
3047
3047
|
pallet: 'PolkadotXcm',
|
|
3048
|
-
recipientAddress: senderAddress,
|
|
3048
|
+
recipientAddress: isNodeEvm(origin) ? ahAddress : senderAddress,
|
|
3049
3049
|
version: version
|
|
3050
3050
|
})
|
|
3051
3051
|
}
|
|
@@ -3185,11 +3185,11 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3185
3185
|
key: "transfer",
|
|
3186
3186
|
value: function () {
|
|
3187
3187
|
var _transfer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
3188
|
-
var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
|
|
3188
|
+
var api, asset, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
|
|
3189
3189
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3190
3190
|
while (1) switch (_context.prev = _context.next) {
|
|
3191
3191
|
case 0:
|
|
3192
|
-
api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
|
|
3192
|
+
api = options.api, asset = options.asset, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
|
|
3193
3193
|
isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
|
|
3194
3194
|
scenario = isRelayDestination ? 'ParaToRelay' : 'ParaToPara';
|
|
3195
3195
|
paraId = resolveParaId(paraIdTo, destination);
|
|
@@ -3283,6 +3283,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3283
3283
|
paraIdTo: paraId,
|
|
3284
3284
|
version: version,
|
|
3285
3285
|
senderAddress: senderAddress,
|
|
3286
|
+
ahAddress: ahAddress,
|
|
3286
3287
|
pallet: pallet,
|
|
3287
3288
|
method: method
|
|
3288
3289
|
}; // Handle common cases
|
|
@@ -3649,7 +3650,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3649
3650
|
version: version
|
|
3650
3651
|
})
|
|
3651
3652
|
}
|
|
3652
|
-
}], version) : createCustomXcmOnDest(input, version, messageId),
|
|
3653
|
+
}], version) : createCustomXcmOnDest(input, this.node, version, messageId),
|
|
3653
3654
|
weight_limit: 'Unlimited'
|
|
3654
3655
|
}
|
|
3655
3656
|
};
|
|
@@ -5810,10 +5811,14 @@ var Moonbeam = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5810
5811
|
}, {
|
|
5811
5812
|
key: "transferPolkadotXCM",
|
|
5812
5813
|
value: function transferPolkadotXCM(input) {
|
|
5813
|
-
var
|
|
5814
|
+
var destination = input.destination,
|
|
5815
|
+
asset = input.asset,
|
|
5814
5816
|
scenario = input.scenario,
|
|
5815
5817
|
_input$version = input.version,
|
|
5816
5818
|
version = _input$version === void 0 ? this.version : _input$version;
|
|
5819
|
+
if (destination === 'Ethereum') {
|
|
5820
|
+
return this.transferToEthereum(input);
|
|
5821
|
+
}
|
|
5817
5822
|
var multiLocation = this.getMultiLocation(asset, scenario);
|
|
5818
5823
|
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
|
|
5819
5824
|
currencySelection: createVersionedMultiAssets(version, asset.amount, multiLocation)
|
|
@@ -6981,9 +6986,10 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
6981
6986
|
address: address,
|
|
6982
6987
|
scenario: 'ParaToPara',
|
|
6983
6988
|
senderAddress: senderAddress,
|
|
6989
|
+
ahAddress: ahAddress,
|
|
6984
6990
|
asset: _objectSpread2(_objectSpread2({}, foundAsset), {}, {
|
|
6985
6991
|
amount: currency.amount
|
|
6986
|
-
})}, Version.V4, messageId);
|
|
6992
|
+
})}, from, Version.V4, messageId);
|
|
6987
6993
|
_context.next = 39;
|
|
6988
6994
|
return api.objectToHex(customXcm, 'XcmVersionedXcm');
|
|
6989
6995
|
case 39:
|
|
@@ -7723,7 +7729,7 @@ var validateDestination = function validateDestination(origin, destination) {
|
|
|
7723
7729
|
if (isRelayChain(origin) && !isTMultiLocation(destination) && isRelayChain(destination) && origin !== destination) {
|
|
7724
7730
|
throw new IncompatibleNodesError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
|
|
7725
7731
|
}
|
|
7726
|
-
if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot') {
|
|
7732
|
+
if (destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration' && origin !== 'BifrostPolkadot' && origin !== 'Moonbeam') {
|
|
7727
7733
|
throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot and Hydration.');
|
|
7728
7734
|
}
|
|
7729
7735
|
var isMultiLocationDestination = _typeof(destination) === 'object';
|
|
@@ -7849,11 +7855,11 @@ var validateDestinationAddress = function validateDestinationAddress(address, de
|
|
|
7849
7855
|
|
|
7850
7856
|
var send = /*#__PURE__*/function () {
|
|
7851
7857
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
7852
|
-
var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
|
|
7858
|
+
var api, origin, currency, feeAsset, address, destination, paraIdTo, version, senderAddress, ahAddress, pallet, method, isBridge, assetCheckEnabled, asset, resolvedFeeAsset, isLocalTransfer, overriddenAsset, resolvedAsset, originNode;
|
|
7853
7859
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7854
7860
|
while (1) switch (_context.prev = _context.next) {
|
|
7855
7861
|
case 0:
|
|
7856
|
-
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, pallet = options.pallet, method = options.method;
|
|
7862
|
+
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
|
|
7857
7863
|
validateCurrency(currency, feeAsset);
|
|
7858
7864
|
validateDestination(origin, destination);
|
|
7859
7865
|
validateDestinationAddress(address, destination);
|
|
@@ -7940,6 +7946,7 @@ var send = /*#__PURE__*/function () {
|
|
|
7940
7946
|
overriddenAsset: overriddenAsset,
|
|
7941
7947
|
version: version,
|
|
7942
7948
|
senderAddress: senderAddress,
|
|
7949
|
+
ahAddress: ahAddress,
|
|
7943
7950
|
pallet: pallet,
|
|
7944
7951
|
method: method
|
|
7945
7952
|
}));
|
|
@@ -8102,6 +8109,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
8102
8109
|
senderAddress: senderAddress
|
|
8103
8110
|
} : {}));
|
|
8104
8111
|
}
|
|
8112
|
+
/**
|
|
8113
|
+
* Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
|
|
8114
|
+
*
|
|
8115
|
+
* @param address - The address to be used.
|
|
8116
|
+
* @returns An instance of Builder
|
|
8117
|
+
*/
|
|
8118
|
+
}, {
|
|
8119
|
+
key: "ahAddress",
|
|
8120
|
+
value: function ahAddress(address) {
|
|
8121
|
+
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
8122
|
+
ahAddress: address
|
|
8123
|
+
}));
|
|
8124
|
+
}
|
|
8105
8125
|
/**
|
|
8106
8126
|
* Sets the XCM version to be used for the transfer.
|
|
8107
8127
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.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.7",
|
|
27
27
|
"viem": "^2.28.1",
|
|
28
|
-
"@paraspell/assets": "8.12.
|
|
29
|
-
"@paraspell/
|
|
30
|
-
"@paraspell/
|
|
28
|
+
"@paraspell/assets": "8.12.1",
|
|
29
|
+
"@paraspell/sdk-common": "8.12.1",
|
|
30
|
+
"@paraspell/pallets": "8.12.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|