@paraspell/sdk-core 10.0.1 → 10.0.2
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 +51 -51
- package/dist/index.mjs +51 -51
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -785,7 +785,7 @@ var blake2b512 = function blake2b512(msg) {
|
|
|
785
785
|
var ALLOWED_PUBKEY_BYTES = new Set([32, 33]);
|
|
786
786
|
var deriveAccountId = function deriveAccountId(raw) {
|
|
787
787
|
if (!ALLOWED_PUBKEY_BYTES.has(raw.length)) {
|
|
788
|
-
throw new
|
|
788
|
+
throw new InvalidParameterError('public key length is invalid');
|
|
789
789
|
}
|
|
790
790
|
return raw.length === 33 ? blake2b256(raw) : raw;
|
|
791
791
|
};
|
|
@@ -803,7 +803,7 @@ var networkToBytes = function networkToBytes(net) {
|
|
|
803
803
|
};
|
|
804
804
|
var encodeSs58 = function encodeSs58(payload, network) {
|
|
805
805
|
if (!VALID_ADDR_PAYLOAD.has(payload.length)) {
|
|
806
|
-
throw new
|
|
806
|
+
throw new InvalidParameterError('unexpected payload length for SS58 address');
|
|
807
807
|
}
|
|
808
808
|
var netBytes = networkToBytes(network);
|
|
809
809
|
var chkInput = new Uint8Array(SS58_HARD_PREFIX.length + netBytes.length + payload.length);
|
|
@@ -2170,7 +2170,7 @@ var getNodeProviders = function getNodeProviders(node) {
|
|
|
2170
2170
|
var _getNodeConfig = getNodeConfig(node),
|
|
2171
2171
|
providers = _getNodeConfig.providers;
|
|
2172
2172
|
if (providers.length === 0) {
|
|
2173
|
-
throw new
|
|
2173
|
+
throw new InvalidParameterError("No providers found for node ".concat(node));
|
|
2174
2174
|
}
|
|
2175
2175
|
// Prefer Dwellir provider
|
|
2176
2176
|
providers.sort(function (a, b) {
|
|
@@ -2383,12 +2383,12 @@ var addXcmVersionHeader = function addXcmVersionHeader(obj, version) {
|
|
|
2383
2383
|
var extractVersionFromHeader = function extractVersionFromHeader(versionHeader) {
|
|
2384
2384
|
var keys = Object.keys(versionHeader);
|
|
2385
2385
|
if (keys.length !== 1) {
|
|
2386
|
-
throw new
|
|
2386
|
+
throw new InvalidParameterError('Invalid version header: expected exactly one key.');
|
|
2387
2387
|
}
|
|
2388
2388
|
var version = keys[0];
|
|
2389
2389
|
var value = versionHeader[version];
|
|
2390
2390
|
if (value === undefined) {
|
|
2391
|
-
throw new
|
|
2391
|
+
throw new InvalidParameterError('Invalid version header: value is undefined.');
|
|
2392
2392
|
}
|
|
2393
2393
|
return [version, value];
|
|
2394
2394
|
};
|
|
@@ -2431,13 +2431,13 @@ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(relay
|
|
|
2431
2431
|
var _NODE_NAMES_DOT_KSM$f;
|
|
2432
2432
|
var parachainId = findParachainJunction(multiLocation);
|
|
2433
2433
|
if (parachainId === null) {
|
|
2434
|
-
throw new
|
|
2434
|
+
throw new InvalidParameterError('Parachain ID not found in destination multi location.');
|
|
2435
2435
|
}
|
|
2436
2436
|
var node = (_NODE_NAMES_DOT_KSM$f = sdkCommon.NODE_NAMES_DOT_KSM.find(function (nodeName) {
|
|
2437
2437
|
return getParaId(nodeName) === parachainId && determineRelayChain(nodeName) === relayChain;
|
|
2438
2438
|
})) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
|
|
2439
2439
|
if (node === null) {
|
|
2440
|
-
throw new
|
|
2440
|
+
throw new InvalidParameterError('Node with specified paraId not found in destination multi location.');
|
|
2441
2441
|
}
|
|
2442
2442
|
return node;
|
|
2443
2443
|
};
|
|
@@ -2717,17 +2717,17 @@ var resolveModuleError = function resolveModuleError(node, error) {
|
|
|
2717
2717
|
return p.index === Number(error.index);
|
|
2718
2718
|
});
|
|
2719
2719
|
if (!palletDetails) {
|
|
2720
|
-
throw new
|
|
2720
|
+
throw new InvalidParameterError("Pallet with index ".concat(error.index, " not found"));
|
|
2721
2721
|
}
|
|
2722
2722
|
// Use only the first byte of the error to get the error index
|
|
2723
2723
|
var errorIndex = Number(error.error.slice(0, 4));
|
|
2724
2724
|
var name = palletDetails.name;
|
|
2725
2725
|
if (name !== 'XTokens' && name !== 'PolkadotXcm' && name !== 'XcmPallet') {
|
|
2726
|
-
throw new
|
|
2726
|
+
throw new InvalidParameterError("Pallet ".concat(name, " is not supported"));
|
|
2727
2727
|
}
|
|
2728
2728
|
var failureReason = name === 'XTokens' ? Object.values(exports.XTokensError)[errorIndex] : Object.values(exports.PolkadotXcmError)[errorIndex];
|
|
2729
2729
|
if (!failureReason) {
|
|
2730
|
-
throw new
|
|
2730
|
+
throw new InvalidParameterError("Error index ".concat(errorIndex, " not found in ").concat(name, " pallet"));
|
|
2731
2731
|
}
|
|
2732
2732
|
return failureReason;
|
|
2733
2733
|
};
|
|
@@ -2761,7 +2761,7 @@ var getFees = function getFees(scenario) {
|
|
|
2761
2761
|
} else if (scenario === 'ParaToPara') {
|
|
2762
2762
|
return 399600000000;
|
|
2763
2763
|
}
|
|
2764
|
-
throw new
|
|
2764
|
+
throw new InvalidParameterError("Fees for scenario ".concat(scenario, " are not defined."));
|
|
2765
2765
|
};
|
|
2766
2766
|
|
|
2767
2767
|
/**
|
|
@@ -2921,7 +2921,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
2921
2921
|
useMultiAssetTransfer = _input$useMultiAssetT === void 0 ? false : _input$useMultiAssetT;
|
|
2922
2922
|
var isMultiLocationDestination = _typeof(destination) === 'object';
|
|
2923
2923
|
if (isMultiLocationDestination) {
|
|
2924
|
-
throw new
|
|
2924
|
+
throw new InvalidParameterError('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
|
|
2925
2925
|
}
|
|
2926
2926
|
var isBifrostOrigin = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
2927
2927
|
var isAssetHubDest = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
|
|
@@ -3219,7 +3219,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
3219
3219
|
_context.next = 17;
|
|
3220
3220
|
break;
|
|
3221
3221
|
}
|
|
3222
|
-
throw new
|
|
3222
|
+
throw new InvalidParameterError("Unable to find TNode for paraId ".concat(nextParaId));
|
|
3223
3223
|
case 17:
|
|
3224
3224
|
hopApi = api.clone();
|
|
3225
3225
|
_context.prev = 18;
|
|
@@ -3419,7 +3419,7 @@ var formatAssetIdToERC20 = function formatAssetIdToERC20(id) {
|
|
|
3419
3419
|
return id;
|
|
3420
3420
|
}
|
|
3421
3421
|
if (!(/^\d{38,39}$/.test(id) || /^\d{4}$/.test(id))) {
|
|
3422
|
-
throw new
|
|
3422
|
+
throw new InvalidParameterError("Asset id: ".concat(id, " must be a string and have either 4 digits or 38-39 digits"));
|
|
3423
3423
|
}
|
|
3424
3424
|
return "0xffffffff".concat(BigInt(id).toString(16).padStart(32, '0'));
|
|
3425
3425
|
};
|
|
@@ -3594,7 +3594,7 @@ var getBalanceForeignInternal = /*#__PURE__*/function () {
|
|
|
3594
3594
|
}
|
|
3595
3595
|
return _context.abrupt("return", getBalanceForeignPolkadotXcm(api, node, address, asset));
|
|
3596
3596
|
case 11:
|
|
3597
|
-
throw new
|
|
3597
|
+
throw new InvalidParameterError('Unsupported pallet');
|
|
3598
3598
|
case 12:
|
|
3599
3599
|
case "end":
|
|
3600
3600
|
return _context.stop();
|
|
@@ -3939,13 +3939,13 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
3939
3939
|
_context.next = 3;
|
|
3940
3940
|
break;
|
|
3941
3941
|
}
|
|
3942
|
-
throw new
|
|
3942
|
+
throw new InvalidParameterError('Multiassets syntax is not supported for Evm transfers');
|
|
3943
3943
|
case 3:
|
|
3944
3944
|
if (!('multilocation' in currency && assets.isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
3945
3945
|
_context.next = 5;
|
|
3946
3946
|
break;
|
|
3947
3947
|
}
|
|
3948
|
-
throw new
|
|
3948
|
+
throw new InvalidParameterError('Override multilocation is not supported for Evm transfers');
|
|
3949
3949
|
case 5:
|
|
3950
3950
|
contract = isEthersSigner(signer) ? new ethers.Contract(CONTRACT_ADDRESS, abi$1, signer) : viem.getContract({
|
|
3951
3951
|
abi: abi$1,
|
|
@@ -4266,7 +4266,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4266
4266
|
_context.next = 3;
|
|
4267
4267
|
break;
|
|
4268
4268
|
}
|
|
4269
|
-
throw new
|
|
4269
|
+
throw new InvalidParameterError('AssetHub address is required');
|
|
4270
4270
|
case 3:
|
|
4271
4271
|
_context.next = 5;
|
|
4272
4272
|
return getBridgeStatus(api.clone());
|
|
@@ -4282,13 +4282,13 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4282
4282
|
_context.next = 10;
|
|
4283
4283
|
break;
|
|
4284
4284
|
}
|
|
4285
|
-
throw new
|
|
4285
|
+
throw new InvalidParameterError('Multiassets syntax is not supported for Evm transfers');
|
|
4286
4286
|
case 10:
|
|
4287
4287
|
if (!('multilocation' in currency && assets.isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
4288
4288
|
_context.next = 12;
|
|
4289
4289
|
break;
|
|
4290
4290
|
}
|
|
4291
|
-
throw new
|
|
4291
|
+
throw new InvalidParameterError('Override multilocation is not supported for Evm transfers');
|
|
4292
4292
|
case 12:
|
|
4293
4293
|
foundAsset = assets.findAsset(from, currency, to);
|
|
4294
4294
|
if (!(foundAsset === null)) {
|
|
@@ -4339,7 +4339,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4339
4339
|
_context.next = 31;
|
|
4340
4340
|
break;
|
|
4341
4341
|
}
|
|
4342
|
-
throw new
|
|
4342
|
+
throw new InvalidParameterError('Unable to get sender address');
|
|
4343
4343
|
case 31:
|
|
4344
4344
|
_context.next = 33;
|
|
4345
4345
|
return api.init(from, TX_CLIENT_TIMEOUT_MS);
|
|
@@ -4382,7 +4382,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4382
4382
|
};
|
|
4383
4383
|
numberToHex32 = function numberToHex32(num) {
|
|
4384
4384
|
return typeof num !== 'number' || isNaN(num) ? function () {
|
|
4385
|
-
throw new
|
|
4385
|
+
throw new InvalidParameterError('Input must be a valid number');
|
|
4386
4386
|
}() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
|
|
4387
4387
|
}; // Execute the custom XCM message with the precompile
|
|
4388
4388
|
_context.next = 54;
|
|
@@ -4614,7 +4614,7 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
4614
4614
|
_context.next = 39;
|
|
4615
4615
|
break;
|
|
4616
4616
|
}
|
|
4617
|
-
throw new
|
|
4617
|
+
throw new InvalidParameterError("Unable to find TNode for paraId ".concat(nextParaId));
|
|
4618
4618
|
case 39:
|
|
4619
4619
|
hopApi = api.clone();
|
|
4620
4620
|
_context.prev = 40;
|
|
@@ -4844,7 +4844,7 @@ var transferRelayToPara = /*#__PURE__*/function () {
|
|
|
4844
4844
|
_context.next = 4;
|
|
4845
4845
|
break;
|
|
4846
4846
|
}
|
|
4847
|
-
throw new
|
|
4847
|
+
throw new InvalidParameterError('API is required when using MultiLocation as destination.');
|
|
4848
4848
|
case 4:
|
|
4849
4849
|
_context.next = 6;
|
|
4850
4850
|
return api.init(origin, TX_CLIENT_TIMEOUT_MS);
|
|
@@ -5044,13 +5044,13 @@ var send = /*#__PURE__*/function () {
|
|
|
5044
5044
|
_context.next = 14;
|
|
5045
5045
|
break;
|
|
5046
5046
|
}
|
|
5047
|
-
throw new
|
|
5047
|
+
throw new InvalidParameterError('Transfers from relay chain to Ethereum are not supported.');
|
|
5048
5048
|
case 14:
|
|
5049
5049
|
if (asset) {
|
|
5050
5050
|
_context.next = 16;
|
|
5051
5051
|
break;
|
|
5052
5052
|
}
|
|
5053
|
-
throw new
|
|
5053
|
+
throw new InvalidParameterError('Asset is required for relay chain to relay chain transfers.');
|
|
5054
5054
|
case 16:
|
|
5055
5055
|
isLocalTransfer = origin === destination;
|
|
5056
5056
|
if (!isLocalTransfer) {
|
|
@@ -5193,7 +5193,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5193
5193
|
_context.next = 6;
|
|
5194
5194
|
break;
|
|
5195
5195
|
}
|
|
5196
|
-
throw new
|
|
5196
|
+
throw new InvalidParameterError('Sending assets to Polimec is supported only from AssetHubPolkadot and Hydration');
|
|
5197
5197
|
case 6:
|
|
5198
5198
|
versionOrDefault = version !== null && version !== void 0 ? version : this.version;
|
|
5199
5199
|
isLocalTransfer = this.node === destination;
|
|
@@ -5436,13 +5436,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5436
5436
|
_context2.next = 5;
|
|
5437
5437
|
break;
|
|
5438
5438
|
}
|
|
5439
|
-
throw new
|
|
5439
|
+
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
5440
5440
|
case 5:
|
|
5441
5441
|
if (!sdkCommon.isTMultiLocation(address)) {
|
|
5442
5442
|
_context2.next = 7;
|
|
5443
5443
|
break;
|
|
5444
5444
|
}
|
|
5445
|
-
throw new
|
|
5445
|
+
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
5446
5446
|
case 7:
|
|
5447
5447
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
5448
5448
|
PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
|
|
@@ -5589,13 +5589,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5589
5589
|
_context3.next = 11;
|
|
5590
5590
|
break;
|
|
5591
5591
|
}
|
|
5592
|
-
throw new
|
|
5592
|
+
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
5593
5593
|
case 11:
|
|
5594
5594
|
if (!sdkCommon.isTMultiLocation(address)) {
|
|
5595
5595
|
_context3.next = 13;
|
|
5596
5596
|
break;
|
|
5597
5597
|
}
|
|
5598
|
-
throw new
|
|
5598
|
+
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
5599
5599
|
case 13:
|
|
5600
5600
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
5601
5601
|
_context3.next = 16;
|
|
@@ -5980,7 +5980,7 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
|
5980
5980
|
_extractVersionFromHe4[0];
|
|
5981
5981
|
var beneficiary = _extractVersionFromHe4[1];
|
|
5982
5982
|
if (!asset.multiLocation) {
|
|
5983
|
-
throw new
|
|
5983
|
+
throw new InvalidParameterError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
5984
5984
|
}
|
|
5985
5985
|
var transformedMultiLocation = transformMultiLocation(asset.multiLocation);
|
|
5986
5986
|
var amountWithoutFee = BigInt(asset.amount) - executionFee;
|
|
@@ -6163,13 +6163,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6163
6163
|
_context.next = 8;
|
|
6164
6164
|
break;
|
|
6165
6165
|
}
|
|
6166
|
-
throw new
|
|
6166
|
+
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6167
6167
|
case 8:
|
|
6168
6168
|
if (!sdkCommon.isTMultiLocation(address)) {
|
|
6169
6169
|
_context.next = 10;
|
|
6170
6170
|
break;
|
|
6171
6171
|
}
|
|
6172
|
-
throw new
|
|
6172
|
+
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
6173
6173
|
case 10:
|
|
6174
6174
|
if (assets.isForeignAsset(asset)) {
|
|
6175
6175
|
_context.next = 12;
|
|
@@ -6253,7 +6253,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6253
6253
|
_context2.next = 8;
|
|
6254
6254
|
break;
|
|
6255
6255
|
}
|
|
6256
|
-
throw new
|
|
6256
|
+
throw new InvalidParameterError('Only Ethereum addresses are supported for Ethereum transfers');
|
|
6257
6257
|
case 8:
|
|
6258
6258
|
if (assets.isForeignAsset(asset)) {
|
|
6259
6259
|
_context2.next = 10;
|
|
@@ -6385,7 +6385,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6385
6385
|
_context3.next = 3;
|
|
6386
6386
|
break;
|
|
6387
6387
|
}
|
|
6388
|
-
throw new
|
|
6388
|
+
throw new InvalidParameterError('Please provide senderAddress');
|
|
6389
6389
|
case 3:
|
|
6390
6390
|
validateAddress(senderAddress, this.node, false);
|
|
6391
6391
|
decimals = asset.decimals;
|
|
@@ -6411,13 +6411,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6411
6411
|
_context3.next = 16;
|
|
6412
6412
|
break;
|
|
6413
6413
|
}
|
|
6414
|
-
throw new
|
|
6414
|
+
throw new DryRunFailedError("Dry run failed: ".concat(dryRunResult.failureReason));
|
|
6415
6415
|
case 16:
|
|
6416
6416
|
if (dryRunResult.weight) {
|
|
6417
6417
|
_context3.next = 18;
|
|
6418
6418
|
break;
|
|
6419
6419
|
}
|
|
6420
|
-
throw new
|
|
6420
|
+
throw new DryRunFailedError('Dry run failed: weight not found');
|
|
6421
6421
|
case 18:
|
|
6422
6422
|
feeDotShifted = dryRunResult.fee / 10n;
|
|
6423
6423
|
toMl = transformMultiLocation(asset.multiLocation);
|
|
@@ -6429,13 +6429,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6429
6429
|
_context3.next = 25;
|
|
6430
6430
|
break;
|
|
6431
6431
|
}
|
|
6432
|
-
throw new
|
|
6432
|
+
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
6433
6433
|
case 25:
|
|
6434
6434
|
if (!(BigInt(asset.amount) - feeConverted < 0)) {
|
|
6435
6435
|
_context3.next = 27;
|
|
6436
6436
|
break;
|
|
6437
6437
|
}
|
|
6438
|
-
throw new
|
|
6438
|
+
throw new InvalidParameterError("Insufficient balance. Fee: ".concat(feeConverted, ", Amount: ").concat(asset.amount));
|
|
6439
6439
|
case 27:
|
|
6440
6440
|
feeConvertedPadded = feeConverted * 3n / 2n; // increases fee by 50%
|
|
6441
6441
|
return _context3.abrupt("return", createExecuteXcm(input, dryRunResult.weight, feeConvertedPadded));
|
|
@@ -8179,7 +8179,7 @@ var XTransferTransferImpl = /*#__PURE__*/function () {
|
|
|
8179
8179
|
method = input.method;
|
|
8180
8180
|
var isMultiLocationDestination = _typeof(destination) === 'object';
|
|
8181
8181
|
if (isMultiLocationDestination) {
|
|
8182
|
-
throw new
|
|
8182
|
+
throw new InvalidParameterError('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
|
|
8183
8183
|
}
|
|
8184
8184
|
var version = exports.Version.V1;
|
|
8185
8185
|
var multiAssets = [createMultiAsset(version, asset.amount, {
|
|
@@ -8801,7 +8801,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8801
8801
|
_context.next = 10;
|
|
8802
8802
|
break;
|
|
8803
8803
|
}
|
|
8804
|
-
throw new
|
|
8804
|
+
throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency), "."));
|
|
8805
8805
|
case 10:
|
|
8806
8806
|
edBN = BigInt(ed);
|
|
8807
8807
|
isNativeAsset = assets.getNativeAssetSymbol(node) === asset.symbol;
|
|
@@ -8829,7 +8829,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8829
8829
|
_context.next = 21;
|
|
8830
8830
|
break;
|
|
8831
8831
|
}
|
|
8832
|
-
throw new
|
|
8832
|
+
throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(node, "."));
|
|
8833
8833
|
case 21:
|
|
8834
8834
|
feeToSubtract = fee;
|
|
8835
8835
|
case 22:
|
|
@@ -8984,7 +8984,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8984
8984
|
_context.next = 47;
|
|
8985
8985
|
break;
|
|
8986
8986
|
}
|
|
8987
|
-
throw new
|
|
8987
|
+
throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(origin, "."));
|
|
8988
8988
|
case 47:
|
|
8989
8989
|
isDestFeeInNativeCurrency = destFeeCurrency === assets.getNativeAssetSymbol(destination);
|
|
8990
8990
|
if (!isDestFeeInNativeCurrency) {
|
|
@@ -9101,7 +9101,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9101
9101
|
_context.next = 10;
|
|
9102
9102
|
break;
|
|
9103
9103
|
}
|
|
9104
|
-
throw new
|
|
9104
|
+
throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency)));
|
|
9105
9105
|
case 10:
|
|
9106
9106
|
edBN = BigInt(ed);
|
|
9107
9107
|
_context.next = 13;
|
|
@@ -9136,7 +9136,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9136
9136
|
_context.next = 24;
|
|
9137
9137
|
break;
|
|
9138
9138
|
}
|
|
9139
|
-
throw new
|
|
9139
|
+
throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(destination, "."));
|
|
9140
9140
|
case 24:
|
|
9141
9141
|
if (!dryRunError) {
|
|
9142
9142
|
_context.next = 26;
|
|
@@ -9250,7 +9250,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
9250
9250
|
_context.next = 6;
|
|
9251
9251
|
break;
|
|
9252
9252
|
}
|
|
9253
|
-
throw new
|
|
9253
|
+
throw new InvalidParameterError('No transactions to batch.');
|
|
9254
9254
|
case 6:
|
|
9255
9255
|
sameFrom = this.transactionOptions.every(function (tx) {
|
|
9256
9256
|
return tx.from === from;
|
|
@@ -9259,7 +9259,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
9259
9259
|
_context.next = 9;
|
|
9260
9260
|
break;
|
|
9261
9261
|
}
|
|
9262
|
-
throw new
|
|
9262
|
+
throw new InvalidParameterError('All transactions must have the same origin.');
|
|
9263
9263
|
case 9:
|
|
9264
9264
|
results = this.transactionOptions.map(function (options) {
|
|
9265
9265
|
return send(options);
|
|
@@ -9317,7 +9317,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
9317
9317
|
key: "to",
|
|
9318
9318
|
value: function to(node, paraIdTo) {
|
|
9319
9319
|
if (this._options.from && sdkCommon.isRelayChain(this._options.from) && node === 'Ethereum') {
|
|
9320
|
-
throw new
|
|
9320
|
+
throw new InvalidParameterError('Transfers from Relay chain to Ethereum are not yet supported.');
|
|
9321
9321
|
}
|
|
9322
9322
|
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
9323
9323
|
to: node,
|
|
@@ -9487,14 +9487,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
9487
9487
|
_context2.next = 2;
|
|
9488
9488
|
break;
|
|
9489
9489
|
}
|
|
9490
|
-
throw new
|
|
9490
|
+
throw new InvalidParameterError('Transaction manager contains batched items. Use buildBatch() to process them.');
|
|
9491
9491
|
case 2:
|
|
9492
9492
|
_this$_options = this._options, from = _this$_options.from, to = _this$_options.to;
|
|
9493
9493
|
if (!(!sdkCommon.isTMultiLocation(to) && sdkCommon.isRelayChain(from) && sdkCommon.isRelayChain(to) && from !== to)) {
|
|
9494
9494
|
_context2.next = 5;
|
|
9495
9495
|
break;
|
|
9496
9496
|
}
|
|
9497
|
-
throw new
|
|
9497
|
+
throw new InvalidParameterError('Transfers between relay chains are not yet supported.');
|
|
9498
9498
|
case 5:
|
|
9499
9499
|
return _context2.abrupt("return", send(_objectSpread2({
|
|
9500
9500
|
api: this.api
|
package/dist/index.mjs
CHANGED
|
@@ -786,7 +786,7 @@ var blake2b512 = function blake2b512(msg) {
|
|
|
786
786
|
var ALLOWED_PUBKEY_BYTES = new Set([32, 33]);
|
|
787
787
|
var deriveAccountId = function deriveAccountId(raw) {
|
|
788
788
|
if (!ALLOWED_PUBKEY_BYTES.has(raw.length)) {
|
|
789
|
-
throw new
|
|
789
|
+
throw new InvalidParameterError('public key length is invalid');
|
|
790
790
|
}
|
|
791
791
|
return raw.length === 33 ? blake2b256(raw) : raw;
|
|
792
792
|
};
|
|
@@ -804,7 +804,7 @@ var networkToBytes = function networkToBytes(net) {
|
|
|
804
804
|
};
|
|
805
805
|
var encodeSs58 = function encodeSs58(payload, network) {
|
|
806
806
|
if (!VALID_ADDR_PAYLOAD.has(payload.length)) {
|
|
807
|
-
throw new
|
|
807
|
+
throw new InvalidParameterError('unexpected payload length for SS58 address');
|
|
808
808
|
}
|
|
809
809
|
var netBytes = networkToBytes(network);
|
|
810
810
|
var chkInput = new Uint8Array(SS58_HARD_PREFIX.length + netBytes.length + payload.length);
|
|
@@ -2171,7 +2171,7 @@ var getNodeProviders = function getNodeProviders(node) {
|
|
|
2171
2171
|
var _getNodeConfig = getNodeConfig(node),
|
|
2172
2172
|
providers = _getNodeConfig.providers;
|
|
2173
2173
|
if (providers.length === 0) {
|
|
2174
|
-
throw new
|
|
2174
|
+
throw new InvalidParameterError("No providers found for node ".concat(node));
|
|
2175
2175
|
}
|
|
2176
2176
|
// Prefer Dwellir provider
|
|
2177
2177
|
providers.sort(function (a, b) {
|
|
@@ -2384,12 +2384,12 @@ var addXcmVersionHeader = function addXcmVersionHeader(obj, version) {
|
|
|
2384
2384
|
var extractVersionFromHeader = function extractVersionFromHeader(versionHeader) {
|
|
2385
2385
|
var keys = Object.keys(versionHeader);
|
|
2386
2386
|
if (keys.length !== 1) {
|
|
2387
|
-
throw new
|
|
2387
|
+
throw new InvalidParameterError('Invalid version header: expected exactly one key.');
|
|
2388
2388
|
}
|
|
2389
2389
|
var version = keys[0];
|
|
2390
2390
|
var value = versionHeader[version];
|
|
2391
2391
|
if (value === undefined) {
|
|
2392
|
-
throw new
|
|
2392
|
+
throw new InvalidParameterError('Invalid version header: value is undefined.');
|
|
2393
2393
|
}
|
|
2394
2394
|
return [version, value];
|
|
2395
2395
|
};
|
|
@@ -2432,13 +2432,13 @@ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(relay
|
|
|
2432
2432
|
var _NODE_NAMES_DOT_KSM$f;
|
|
2433
2433
|
var parachainId = findParachainJunction(multiLocation);
|
|
2434
2434
|
if (parachainId === null) {
|
|
2435
|
-
throw new
|
|
2435
|
+
throw new InvalidParameterError('Parachain ID not found in destination multi location.');
|
|
2436
2436
|
}
|
|
2437
2437
|
var node = (_NODE_NAMES_DOT_KSM$f = NODE_NAMES_DOT_KSM.find(function (nodeName) {
|
|
2438
2438
|
return getParaId(nodeName) === parachainId && determineRelayChain(nodeName) === relayChain;
|
|
2439
2439
|
})) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
|
|
2440
2440
|
if (node === null) {
|
|
2441
|
-
throw new
|
|
2441
|
+
throw new InvalidParameterError('Node with specified paraId not found in destination multi location.');
|
|
2442
2442
|
}
|
|
2443
2443
|
return node;
|
|
2444
2444
|
};
|
|
@@ -2718,17 +2718,17 @@ var resolveModuleError = function resolveModuleError(node, error) {
|
|
|
2718
2718
|
return p.index === Number(error.index);
|
|
2719
2719
|
});
|
|
2720
2720
|
if (!palletDetails) {
|
|
2721
|
-
throw new
|
|
2721
|
+
throw new InvalidParameterError("Pallet with index ".concat(error.index, " not found"));
|
|
2722
2722
|
}
|
|
2723
2723
|
// Use only the first byte of the error to get the error index
|
|
2724
2724
|
var errorIndex = Number(error.error.slice(0, 4));
|
|
2725
2725
|
var name = palletDetails.name;
|
|
2726
2726
|
if (name !== 'XTokens' && name !== 'PolkadotXcm' && name !== 'XcmPallet') {
|
|
2727
|
-
throw new
|
|
2727
|
+
throw new InvalidParameterError("Pallet ".concat(name, " is not supported"));
|
|
2728
2728
|
}
|
|
2729
2729
|
var failureReason = name === 'XTokens' ? Object.values(XTokensError)[errorIndex] : Object.values(PolkadotXcmError)[errorIndex];
|
|
2730
2730
|
if (!failureReason) {
|
|
2731
|
-
throw new
|
|
2731
|
+
throw new InvalidParameterError("Error index ".concat(errorIndex, " not found in ").concat(name, " pallet"));
|
|
2732
2732
|
}
|
|
2733
2733
|
return failureReason;
|
|
2734
2734
|
};
|
|
@@ -2762,7 +2762,7 @@ var getFees = function getFees(scenario) {
|
|
|
2762
2762
|
} else if (scenario === 'ParaToPara') {
|
|
2763
2763
|
return 399600000000;
|
|
2764
2764
|
}
|
|
2765
|
-
throw new
|
|
2765
|
+
throw new InvalidParameterError("Fees for scenario ".concat(scenario, " are not defined."));
|
|
2766
2766
|
};
|
|
2767
2767
|
|
|
2768
2768
|
/**
|
|
@@ -2922,7 +2922,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
2922
2922
|
useMultiAssetTransfer = _input$useMultiAssetT === void 0 ? false : _input$useMultiAssetT;
|
|
2923
2923
|
var isMultiLocationDestination = _typeof(destination) === 'object';
|
|
2924
2924
|
if (isMultiLocationDestination) {
|
|
2925
|
-
throw new
|
|
2925
|
+
throw new InvalidParameterError('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
|
|
2926
2926
|
}
|
|
2927
2927
|
var isBifrostOrigin = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
2928
2928
|
var isAssetHubDest = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
|
|
@@ -3220,7 +3220,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
3220
3220
|
_context.next = 17;
|
|
3221
3221
|
break;
|
|
3222
3222
|
}
|
|
3223
|
-
throw new
|
|
3223
|
+
throw new InvalidParameterError("Unable to find TNode for paraId ".concat(nextParaId));
|
|
3224
3224
|
case 17:
|
|
3225
3225
|
hopApi = api.clone();
|
|
3226
3226
|
_context.prev = 18;
|
|
@@ -3420,7 +3420,7 @@ var formatAssetIdToERC20 = function formatAssetIdToERC20(id) {
|
|
|
3420
3420
|
return id;
|
|
3421
3421
|
}
|
|
3422
3422
|
if (!(/^\d{38,39}$/.test(id) || /^\d{4}$/.test(id))) {
|
|
3423
|
-
throw new
|
|
3423
|
+
throw new InvalidParameterError("Asset id: ".concat(id, " must be a string and have either 4 digits or 38-39 digits"));
|
|
3424
3424
|
}
|
|
3425
3425
|
return "0xffffffff".concat(BigInt(id).toString(16).padStart(32, '0'));
|
|
3426
3426
|
};
|
|
@@ -3595,7 +3595,7 @@ var getBalanceForeignInternal = /*#__PURE__*/function () {
|
|
|
3595
3595
|
}
|
|
3596
3596
|
return _context.abrupt("return", getBalanceForeignPolkadotXcm(api, node, address, asset));
|
|
3597
3597
|
case 11:
|
|
3598
|
-
throw new
|
|
3598
|
+
throw new InvalidParameterError('Unsupported pallet');
|
|
3599
3599
|
case 12:
|
|
3600
3600
|
case "end":
|
|
3601
3601
|
return _context.stop();
|
|
@@ -3940,13 +3940,13 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
3940
3940
|
_context.next = 3;
|
|
3941
3941
|
break;
|
|
3942
3942
|
}
|
|
3943
|
-
throw new
|
|
3943
|
+
throw new InvalidParameterError('Multiassets syntax is not supported for Evm transfers');
|
|
3944
3944
|
case 3:
|
|
3945
3945
|
if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
3946
3946
|
_context.next = 5;
|
|
3947
3947
|
break;
|
|
3948
3948
|
}
|
|
3949
|
-
throw new
|
|
3949
|
+
throw new InvalidParameterError('Override multilocation is not supported for Evm transfers');
|
|
3950
3950
|
case 5:
|
|
3951
3951
|
contract = isEthersSigner(signer) ? new Contract(CONTRACT_ADDRESS, abi$1, signer) : getContract({
|
|
3952
3952
|
abi: abi$1,
|
|
@@ -4267,7 +4267,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4267
4267
|
_context.next = 3;
|
|
4268
4268
|
break;
|
|
4269
4269
|
}
|
|
4270
|
-
throw new
|
|
4270
|
+
throw new InvalidParameterError('AssetHub address is required');
|
|
4271
4271
|
case 3:
|
|
4272
4272
|
_context.next = 5;
|
|
4273
4273
|
return getBridgeStatus(api.clone());
|
|
@@ -4283,13 +4283,13 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4283
4283
|
_context.next = 10;
|
|
4284
4284
|
break;
|
|
4285
4285
|
}
|
|
4286
|
-
throw new
|
|
4286
|
+
throw new InvalidParameterError('Multiassets syntax is not supported for Evm transfers');
|
|
4287
4287
|
case 10:
|
|
4288
4288
|
if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
4289
4289
|
_context.next = 12;
|
|
4290
4290
|
break;
|
|
4291
4291
|
}
|
|
4292
|
-
throw new
|
|
4292
|
+
throw new InvalidParameterError('Override multilocation is not supported for Evm transfers');
|
|
4293
4293
|
case 12:
|
|
4294
4294
|
foundAsset = findAsset(from, currency, to);
|
|
4295
4295
|
if (!(foundAsset === null)) {
|
|
@@ -4340,7 +4340,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4340
4340
|
_context.next = 31;
|
|
4341
4341
|
break;
|
|
4342
4342
|
}
|
|
4343
|
-
throw new
|
|
4343
|
+
throw new InvalidParameterError('Unable to get sender address');
|
|
4344
4344
|
case 31:
|
|
4345
4345
|
_context.next = 33;
|
|
4346
4346
|
return api.init(from, TX_CLIENT_TIMEOUT_MS);
|
|
@@ -4383,7 +4383,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4383
4383
|
};
|
|
4384
4384
|
numberToHex32 = function numberToHex32(num) {
|
|
4385
4385
|
return typeof num !== 'number' || isNaN(num) ? function () {
|
|
4386
|
-
throw new
|
|
4386
|
+
throw new InvalidParameterError('Input must be a valid number');
|
|
4387
4387
|
}() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
|
|
4388
4388
|
}; // Execute the custom XCM message with the precompile
|
|
4389
4389
|
_context.next = 54;
|
|
@@ -4615,7 +4615,7 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
4615
4615
|
_context.next = 39;
|
|
4616
4616
|
break;
|
|
4617
4617
|
}
|
|
4618
|
-
throw new
|
|
4618
|
+
throw new InvalidParameterError("Unable to find TNode for paraId ".concat(nextParaId));
|
|
4619
4619
|
case 39:
|
|
4620
4620
|
hopApi = api.clone();
|
|
4621
4621
|
_context.prev = 40;
|
|
@@ -4845,7 +4845,7 @@ var transferRelayToPara = /*#__PURE__*/function () {
|
|
|
4845
4845
|
_context.next = 4;
|
|
4846
4846
|
break;
|
|
4847
4847
|
}
|
|
4848
|
-
throw new
|
|
4848
|
+
throw new InvalidParameterError('API is required when using MultiLocation as destination.');
|
|
4849
4849
|
case 4:
|
|
4850
4850
|
_context.next = 6;
|
|
4851
4851
|
return api.init(origin, TX_CLIENT_TIMEOUT_MS);
|
|
@@ -5045,13 +5045,13 @@ var send = /*#__PURE__*/function () {
|
|
|
5045
5045
|
_context.next = 14;
|
|
5046
5046
|
break;
|
|
5047
5047
|
}
|
|
5048
|
-
throw new
|
|
5048
|
+
throw new InvalidParameterError('Transfers from relay chain to Ethereum are not supported.');
|
|
5049
5049
|
case 14:
|
|
5050
5050
|
if (asset) {
|
|
5051
5051
|
_context.next = 16;
|
|
5052
5052
|
break;
|
|
5053
5053
|
}
|
|
5054
|
-
throw new
|
|
5054
|
+
throw new InvalidParameterError('Asset is required for relay chain to relay chain transfers.');
|
|
5055
5055
|
case 16:
|
|
5056
5056
|
isLocalTransfer = origin === destination;
|
|
5057
5057
|
if (!isLocalTransfer) {
|
|
@@ -5194,7 +5194,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5194
5194
|
_context.next = 6;
|
|
5195
5195
|
break;
|
|
5196
5196
|
}
|
|
5197
|
-
throw new
|
|
5197
|
+
throw new InvalidParameterError('Sending assets to Polimec is supported only from AssetHubPolkadot and Hydration');
|
|
5198
5198
|
case 6:
|
|
5199
5199
|
versionOrDefault = version !== null && version !== void 0 ? version : this.version;
|
|
5200
5200
|
isLocalTransfer = this.node === destination;
|
|
@@ -5437,13 +5437,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5437
5437
|
_context2.next = 5;
|
|
5438
5438
|
break;
|
|
5439
5439
|
}
|
|
5440
|
-
throw new
|
|
5440
|
+
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
5441
5441
|
case 5:
|
|
5442
5442
|
if (!isTMultiLocation(address)) {
|
|
5443
5443
|
_context2.next = 7;
|
|
5444
5444
|
break;
|
|
5445
5445
|
}
|
|
5446
|
-
throw new
|
|
5446
|
+
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
5447
5447
|
case 7:
|
|
5448
5448
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
5449
5449
|
PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
|
|
@@ -5590,13 +5590,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5590
5590
|
_context3.next = 11;
|
|
5591
5591
|
break;
|
|
5592
5592
|
}
|
|
5593
|
-
throw new
|
|
5593
|
+
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
5594
5594
|
case 11:
|
|
5595
5595
|
if (!isTMultiLocation(address)) {
|
|
5596
5596
|
_context3.next = 13;
|
|
5597
5597
|
break;
|
|
5598
5598
|
}
|
|
5599
|
-
throw new
|
|
5599
|
+
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
5600
5600
|
case 13:
|
|
5601
5601
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
5602
5602
|
_context3.next = 16;
|
|
@@ -5981,7 +5981,7 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
|
5981
5981
|
_extractVersionFromHe4[0];
|
|
5982
5982
|
var beneficiary = _extractVersionFromHe4[1];
|
|
5983
5983
|
if (!asset.multiLocation) {
|
|
5984
|
-
throw new
|
|
5984
|
+
throw new InvalidParameterError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
5985
5985
|
}
|
|
5986
5986
|
var transformedMultiLocation = transformMultiLocation(asset.multiLocation);
|
|
5987
5987
|
var amountWithoutFee = BigInt(asset.amount) - executionFee;
|
|
@@ -6164,13 +6164,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6164
6164
|
_context.next = 8;
|
|
6165
6165
|
break;
|
|
6166
6166
|
}
|
|
6167
|
-
throw new
|
|
6167
|
+
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6168
6168
|
case 8:
|
|
6169
6169
|
if (!isTMultiLocation(address)) {
|
|
6170
6170
|
_context.next = 10;
|
|
6171
6171
|
break;
|
|
6172
6172
|
}
|
|
6173
|
-
throw new
|
|
6173
|
+
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
6174
6174
|
case 10:
|
|
6175
6175
|
if (isForeignAsset(asset)) {
|
|
6176
6176
|
_context.next = 12;
|
|
@@ -6254,7 +6254,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6254
6254
|
_context2.next = 8;
|
|
6255
6255
|
break;
|
|
6256
6256
|
}
|
|
6257
|
-
throw new
|
|
6257
|
+
throw new InvalidParameterError('Only Ethereum addresses are supported for Ethereum transfers');
|
|
6258
6258
|
case 8:
|
|
6259
6259
|
if (isForeignAsset(asset)) {
|
|
6260
6260
|
_context2.next = 10;
|
|
@@ -6386,7 +6386,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6386
6386
|
_context3.next = 3;
|
|
6387
6387
|
break;
|
|
6388
6388
|
}
|
|
6389
|
-
throw new
|
|
6389
|
+
throw new InvalidParameterError('Please provide senderAddress');
|
|
6390
6390
|
case 3:
|
|
6391
6391
|
validateAddress(senderAddress, this.node, false);
|
|
6392
6392
|
decimals = asset.decimals;
|
|
@@ -6412,13 +6412,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6412
6412
|
_context3.next = 16;
|
|
6413
6413
|
break;
|
|
6414
6414
|
}
|
|
6415
|
-
throw new
|
|
6415
|
+
throw new DryRunFailedError("Dry run failed: ".concat(dryRunResult.failureReason));
|
|
6416
6416
|
case 16:
|
|
6417
6417
|
if (dryRunResult.weight) {
|
|
6418
6418
|
_context3.next = 18;
|
|
6419
6419
|
break;
|
|
6420
6420
|
}
|
|
6421
|
-
throw new
|
|
6421
|
+
throw new DryRunFailedError('Dry run failed: weight not found');
|
|
6422
6422
|
case 18:
|
|
6423
6423
|
feeDotShifted = dryRunResult.fee / 10n;
|
|
6424
6424
|
toMl = transformMultiLocation(asset.multiLocation);
|
|
@@ -6430,13 +6430,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6430
6430
|
_context3.next = 25;
|
|
6431
6431
|
break;
|
|
6432
6432
|
}
|
|
6433
|
-
throw new
|
|
6433
|
+
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
6434
6434
|
case 25:
|
|
6435
6435
|
if (!(BigInt(asset.amount) - feeConverted < 0)) {
|
|
6436
6436
|
_context3.next = 27;
|
|
6437
6437
|
break;
|
|
6438
6438
|
}
|
|
6439
|
-
throw new
|
|
6439
|
+
throw new InvalidParameterError("Insufficient balance. Fee: ".concat(feeConverted, ", Amount: ").concat(asset.amount));
|
|
6440
6440
|
case 27:
|
|
6441
6441
|
feeConvertedPadded = feeConverted * 3n / 2n; // increases fee by 50%
|
|
6442
6442
|
return _context3.abrupt("return", createExecuteXcm(input, dryRunResult.weight, feeConvertedPadded));
|
|
@@ -8180,7 +8180,7 @@ var XTransferTransferImpl = /*#__PURE__*/function () {
|
|
|
8180
8180
|
method = input.method;
|
|
8181
8181
|
var isMultiLocationDestination = _typeof(destination) === 'object';
|
|
8182
8182
|
if (isMultiLocationDestination) {
|
|
8183
|
-
throw new
|
|
8183
|
+
throw new InvalidParameterError('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
|
|
8184
8184
|
}
|
|
8185
8185
|
var version = Version.V1;
|
|
8186
8186
|
var multiAssets = [createMultiAsset(version, asset.amount, {
|
|
@@ -8802,7 +8802,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8802
8802
|
_context.next = 10;
|
|
8803
8803
|
break;
|
|
8804
8804
|
}
|
|
8805
|
-
throw new
|
|
8805
|
+
throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency), "."));
|
|
8806
8806
|
case 10:
|
|
8807
8807
|
edBN = BigInt(ed);
|
|
8808
8808
|
isNativeAsset = getNativeAssetSymbol(node) === asset.symbol;
|
|
@@ -8830,7 +8830,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8830
8830
|
_context.next = 21;
|
|
8831
8831
|
break;
|
|
8832
8832
|
}
|
|
8833
|
-
throw new
|
|
8833
|
+
throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(node, "."));
|
|
8834
8834
|
case 21:
|
|
8835
8835
|
feeToSubtract = fee;
|
|
8836
8836
|
case 22:
|
|
@@ -8985,7 +8985,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8985
8985
|
_context.next = 47;
|
|
8986
8986
|
break;
|
|
8987
8987
|
}
|
|
8988
|
-
throw new
|
|
8988
|
+
throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(origin, "."));
|
|
8989
8989
|
case 47:
|
|
8990
8990
|
isDestFeeInNativeCurrency = destFeeCurrency === getNativeAssetSymbol(destination);
|
|
8991
8991
|
if (!isDestFeeInNativeCurrency) {
|
|
@@ -9102,7 +9102,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9102
9102
|
_context.next = 10;
|
|
9103
9103
|
break;
|
|
9104
9104
|
}
|
|
9105
|
-
throw new
|
|
9105
|
+
throw new InvalidParameterError("Cannot get existential deposit for currency ".concat(JSON.stringify(currency)));
|
|
9106
9106
|
case 10:
|
|
9107
9107
|
edBN = BigInt(ed);
|
|
9108
9108
|
_context.next = 13;
|
|
@@ -9137,7 +9137,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9137
9137
|
_context.next = 24;
|
|
9138
9138
|
break;
|
|
9139
9139
|
}
|
|
9140
|
-
throw new
|
|
9140
|
+
throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(destination, "."));
|
|
9141
9141
|
case 24:
|
|
9142
9142
|
if (!dryRunError) {
|
|
9143
9143
|
_context.next = 26;
|
|
@@ -9251,7 +9251,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
9251
9251
|
_context.next = 6;
|
|
9252
9252
|
break;
|
|
9253
9253
|
}
|
|
9254
|
-
throw new
|
|
9254
|
+
throw new InvalidParameterError('No transactions to batch.');
|
|
9255
9255
|
case 6:
|
|
9256
9256
|
sameFrom = this.transactionOptions.every(function (tx) {
|
|
9257
9257
|
return tx.from === from;
|
|
@@ -9260,7 +9260,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
9260
9260
|
_context.next = 9;
|
|
9261
9261
|
break;
|
|
9262
9262
|
}
|
|
9263
|
-
throw new
|
|
9263
|
+
throw new InvalidParameterError('All transactions must have the same origin.');
|
|
9264
9264
|
case 9:
|
|
9265
9265
|
results = this.transactionOptions.map(function (options) {
|
|
9266
9266
|
return send(options);
|
|
@@ -9318,7 +9318,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
9318
9318
|
key: "to",
|
|
9319
9319
|
value: function to(node, paraIdTo) {
|
|
9320
9320
|
if (this._options.from && isRelayChain(this._options.from) && node === 'Ethereum') {
|
|
9321
|
-
throw new
|
|
9321
|
+
throw new InvalidParameterError('Transfers from Relay chain to Ethereum are not yet supported.');
|
|
9322
9322
|
}
|
|
9323
9323
|
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
9324
9324
|
to: node,
|
|
@@ -9488,14 +9488,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
9488
9488
|
_context2.next = 2;
|
|
9489
9489
|
break;
|
|
9490
9490
|
}
|
|
9491
|
-
throw new
|
|
9491
|
+
throw new InvalidParameterError('Transaction manager contains batched items. Use buildBatch() to process them.');
|
|
9492
9492
|
case 2:
|
|
9493
9493
|
_this$_options = this._options, from = _this$_options.from, to = _this$_options.to;
|
|
9494
9494
|
if (!(!isTMultiLocation(to) && isRelayChain(from) && isRelayChain(to) && from !== to)) {
|
|
9495
9495
|
_context2.next = 5;
|
|
9496
9496
|
break;
|
|
9497
9497
|
}
|
|
9498
|
-
throw new
|
|
9498
|
+
throw new InvalidParameterError('Transfers between relay chains are not yet supported.');
|
|
9499
9499
|
case 5:
|
|
9500
9500
|
return _context2.abrupt("return", send(_objectSpread2({
|
|
9501
9501
|
api: this.api
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.2",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@scure/base": "^1.2.5",
|
|
28
28
|
"ethers": "^6.13.7",
|
|
29
29
|
"viem": "^2.28.1",
|
|
30
|
-
"@paraspell/assets": "10.0.
|
|
31
|
-
"@paraspell/
|
|
32
|
-
"@paraspell/
|
|
30
|
+
"@paraspell/assets": "10.0.2",
|
|
31
|
+
"@paraspell/pallets": "10.0.2",
|
|
32
|
+
"@paraspell/sdk-common": "10.0.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|