@paraspell/sdk 11.1.1 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +72 -24
- package/dist/index.mjs +74 -26
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -372,6 +372,16 @@ var _transform = function transform(obj) {
|
|
|
372
372
|
if (keys.length === 1) {
|
|
373
373
|
var key = keys[0];
|
|
374
374
|
var value = obj[key];
|
|
375
|
+
if (key === 'items' && Array.isArray(value)) {
|
|
376
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
|
377
|
+
return {
|
|
378
|
+
items: value.map(function (item) {
|
|
379
|
+
return item.map(function (i) {
|
|
380
|
+
return polkadotApi.Binary.fromHex(i);
|
|
381
|
+
});
|
|
382
|
+
})
|
|
383
|
+
};
|
|
384
|
+
}
|
|
375
385
|
if (key === 'AccountId32') {
|
|
376
386
|
return {
|
|
377
387
|
type: key,
|
|
@@ -497,11 +507,13 @@ var _transform = function transform(obj) {
|
|
|
497
507
|
newObj[k] = undefined;
|
|
498
508
|
continue;
|
|
499
509
|
}
|
|
500
|
-
if ((k === 'dest' || k === 'target') && typeof v === 'string') {
|
|
510
|
+
if ((k === 'dest' || k === 'who' || k === 'target') && typeof v === 'string') {
|
|
501
511
|
newObj[k] = v;
|
|
502
512
|
continue;
|
|
503
513
|
}
|
|
504
|
-
if (typeof v === 'string' &&
|
|
514
|
+
if (typeof v === 'string' && viem.isAddress(v)) {
|
|
515
|
+
newObj[k] = v;
|
|
516
|
+
} else if (typeof v === 'string' && v.startsWith('0x')) {
|
|
505
517
|
newObj[k] = polkadotApi.FixedSizeBinary.fromHex(v);
|
|
506
518
|
} else if (typeof v === 'string') {
|
|
507
519
|
newObj[k] = {
|
|
@@ -938,6 +950,21 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
938
950
|
})
|
|
939
951
|
});
|
|
940
952
|
}
|
|
953
|
+
}, {
|
|
954
|
+
key: "callDispatchAsMethod",
|
|
955
|
+
value: function callDispatchAsMethod(call, address) {
|
|
956
|
+
var origin = {
|
|
957
|
+
type: 'system',
|
|
958
|
+
value: {
|
|
959
|
+
type: 'Signed',
|
|
960
|
+
value: address
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
return this.api.getUnsafeApi().tx.Utility.dispatch_as({
|
|
964
|
+
as_origin: origin,
|
|
965
|
+
call: call.decodedCall
|
|
966
|
+
});
|
|
967
|
+
}
|
|
941
968
|
}, {
|
|
942
969
|
key: "objectToHex",
|
|
943
970
|
value: function () {
|
|
@@ -1041,6 +1068,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1041
1068
|
}
|
|
1042
1069
|
return quoteAhPrice;
|
|
1043
1070
|
}()
|
|
1071
|
+
}, {
|
|
1072
|
+
key: "getEvmStorage",
|
|
1073
|
+
value: function getEvmStorage(contract, slot) {
|
|
1074
|
+
return this.api.getUnsafeApi().query.EVM.AccountStorages.getKey(polkadotApi.FixedSizeBinary.fromHex(contract), polkadotApi.FixedSizeBinary.fromHex(slot));
|
|
1075
|
+
}
|
|
1044
1076
|
}, {
|
|
1045
1077
|
key: "getBalanceNative",
|
|
1046
1078
|
value: function () {
|
|
@@ -1314,11 +1346,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1314
1346
|
value: function () {
|
|
1315
1347
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref6) {
|
|
1316
1348
|
var _this = this;
|
|
1317
|
-
var tx, address, chain, feeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee;
|
|
1349
|
+
var tx, address, chain, asset, feeAsset, _ref6$useRootOrigin, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee, _t3;
|
|
1318
1350
|
return _regenerator().w(function (_context19) {
|
|
1319
1351
|
while (1) switch (_context19.n) {
|
|
1320
1352
|
case 0:
|
|
1321
|
-
tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, feeAsset = _ref6.feeAsset;
|
|
1353
|
+
tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, asset = _ref6.asset, feeAsset = _ref6.feeAsset, _ref6$useRootOrigin = _ref6.useRootOrigin, useRootOrigin = _ref6$useRootOrigin === void 0 ? false : _ref6$useRootOrigin;
|
|
1322
1354
|
supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
|
|
1323
1355
|
if (supportsDryRunApi) {
|
|
1324
1356
|
_context19.n = 1;
|
|
@@ -1329,11 +1361,27 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1329
1361
|
DEFAULT_XCM_VERSION = 3;
|
|
1330
1362
|
basePayload = {
|
|
1331
1363
|
type: 'system',
|
|
1332
|
-
value: {
|
|
1364
|
+
value: useRootOrigin ? {
|
|
1365
|
+
type: 'Root'
|
|
1366
|
+
} : {
|
|
1333
1367
|
type: 'Signed',
|
|
1334
1368
|
value: address
|
|
1335
1369
|
}
|
|
1336
1370
|
};
|
|
1371
|
+
if (!useRootOrigin) {
|
|
1372
|
+
_context19.n = 3;
|
|
1373
|
+
break;
|
|
1374
|
+
}
|
|
1375
|
+
_context19.n = 2;
|
|
1376
|
+
return sdkCore.wrapTxBypass(this, chain, asset, feeAsset, address, tx);
|
|
1377
|
+
case 2:
|
|
1378
|
+
_t3 = _context19.v;
|
|
1379
|
+
_context19.n = 4;
|
|
1380
|
+
break;
|
|
1381
|
+
case 3:
|
|
1382
|
+
_t3 = tx;
|
|
1383
|
+
case 4:
|
|
1384
|
+
resolvedTx = _t3;
|
|
1337
1385
|
performDryRunCall = /*#__PURE__*/function () {
|
|
1338
1386
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(includeVersion) {
|
|
1339
1387
|
var _this$api$getUnsafeAp;
|
|
@@ -1341,7 +1389,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1341
1389
|
return _regenerator().w(function (_context18) {
|
|
1342
1390
|
while (1) switch (_context18.n) {
|
|
1343
1391
|
case 0:
|
|
1344
|
-
callArgs = [basePayload,
|
|
1392
|
+
callArgs = [basePayload, resolvedTx.decodedCall];
|
|
1345
1393
|
if (includeVersion) {
|
|
1346
1394
|
callArgs.push(DEFAULT_XCM_VERSION);
|
|
1347
1395
|
}
|
|
@@ -1369,27 +1417,27 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1369
1417
|
if (result !== null && result !== void 0 && (_result$value3 = result.value) !== null && _result$value3 !== void 0 && _result$value3.type) {
|
|
1370
1418
|
return String(result.value.type);
|
|
1371
1419
|
}
|
|
1372
|
-
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure');
|
|
1420
|
+
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure', sdkCore.replaceBigInt);
|
|
1373
1421
|
};
|
|
1374
1422
|
failureOutputReason = '';
|
|
1375
|
-
_context19.n =
|
|
1423
|
+
_context19.n = 5;
|
|
1376
1424
|
return performDryRunCall(false);
|
|
1377
|
-
case
|
|
1425
|
+
case 5:
|
|
1378
1426
|
result = _context19.v;
|
|
1379
1427
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1380
1428
|
if (isSuccess) {
|
|
1381
|
-
_context19.n =
|
|
1429
|
+
_context19.n = 7;
|
|
1382
1430
|
break;
|
|
1383
1431
|
}
|
|
1384
1432
|
initialFailureReason = extractFailureReasonFromResult(result);
|
|
1385
1433
|
failureOutputReason = initialFailureReason;
|
|
1386
1434
|
if (!(initialFailureReason === 'VersionedConversionFailed')) {
|
|
1387
|
-
_context19.n =
|
|
1435
|
+
_context19.n = 7;
|
|
1388
1436
|
break;
|
|
1389
1437
|
}
|
|
1390
|
-
_context19.n =
|
|
1438
|
+
_context19.n = 6;
|
|
1391
1439
|
return performDryRunCall(true);
|
|
1392
|
-
case
|
|
1440
|
+
case 6:
|
|
1393
1441
|
result = _context19.v;
|
|
1394
1442
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1395
1443
|
if (!isSuccess) {
|
|
@@ -1397,16 +1445,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1397
1445
|
} else {
|
|
1398
1446
|
failureOutputReason = '';
|
|
1399
1447
|
}
|
|
1400
|
-
case
|
|
1448
|
+
case 7:
|
|
1401
1449
|
if (isSuccess) {
|
|
1402
|
-
_context19.n =
|
|
1450
|
+
_context19.n = 8;
|
|
1403
1451
|
break;
|
|
1404
1452
|
}
|
|
1405
1453
|
return _context19.a(2, Promise.resolve({
|
|
1406
1454
|
success: false,
|
|
1407
1455
|
failureReason: failureOutputReason
|
|
1408
1456
|
}));
|
|
1409
|
-
case
|
|
1457
|
+
case 8:
|
|
1410
1458
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
1411
1459
|
weight = actualWeight ? {
|
|
1412
1460
|
refTime: actualWeight.ref_time,
|
|
@@ -1414,24 +1462,24 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1414
1462
|
} : undefined;
|
|
1415
1463
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1416
1464
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1417
|
-
_context19.n =
|
|
1418
|
-
return this.calculateTransactionFee(
|
|
1419
|
-
case
|
|
1465
|
+
_context19.n = 9;
|
|
1466
|
+
return this.calculateTransactionFee(resolvedTx, address);
|
|
1467
|
+
case 9:
|
|
1420
1468
|
executionFee = _context19.v;
|
|
1421
1469
|
nativeAsset = sdkCore.findAssetInfo(chain, {
|
|
1422
1470
|
symbol: sdkCore.Native(sdkCore.getNativeAssetSymbol(chain))
|
|
1423
1471
|
}, null);
|
|
1424
1472
|
hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
|
|
1425
1473
|
if (!(sdkCore.hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && nativeAsset && chain !== 'AssetHubPolkadot' && chain !== 'Kusama')) {
|
|
1426
|
-
_context19.n =
|
|
1474
|
+
_context19.n = 11;
|
|
1427
1475
|
break;
|
|
1428
1476
|
}
|
|
1429
|
-
_context19.n =
|
|
1477
|
+
_context19.n = 10;
|
|
1430
1478
|
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
|
|
1431
|
-
case
|
|
1479
|
+
case 10:
|
|
1432
1480
|
xcmFee = _context19.v;
|
|
1433
1481
|
if (!(typeof xcmFee === 'bigint')) {
|
|
1434
|
-
_context19.n =
|
|
1482
|
+
_context19.n = 11;
|
|
1435
1483
|
break;
|
|
1436
1484
|
}
|
|
1437
1485
|
return _context19.a(2, Promise.resolve({
|
|
@@ -1441,7 +1489,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1441
1489
|
forwardedXcms: forwardedXcms,
|
|
1442
1490
|
destParaId: destParaId
|
|
1443
1491
|
}));
|
|
1444
|
-
case
|
|
1492
|
+
case 11:
|
|
1445
1493
|
fee = sdkCore.computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1446
1494
|
return _context19.a(2, Promise.resolve({
|
|
1447
1495
|
success: true,
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError, ChainNotSupportedError, createChainClient as createChainClient$1, Parents, Version, getChain, isForeignAsset, assertHasId, computeFeeFromDryRun, findAssetInfo, Native, getNativeAssetSymbol, hasXcmPaymentApiSupport, getAssetsObject, assertHasLocation, localizeLocation, isRelayChain, padFeeBy, isAssetEqual, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, getXcmFee as getXcmFee$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1 } from '@paraspell/sdk-core';
|
|
1
|
+
import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError, ChainNotSupportedError, createChainClient as createChainClient$1, Parents, Version, getChain, isForeignAsset, assertHasId, computeFeeFromDryRun, findAssetInfo, Native, getNativeAssetSymbol, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, wrapTxBypass, assertHasLocation, localizeLocation, isRelayChain, padFeeBy, isAssetEqual, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, getXcmFee as getXcmFee$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { blake2b } from '@noble/hashes/blake2';
|
|
4
4
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
5
|
-
import { FixedSizeBinary, getSs58AddressInfo,
|
|
5
|
+
import { Binary, FixedSizeBinary, getSs58AddressInfo, AccountId, createClient } from 'polkadot-api';
|
|
6
6
|
import { withPolkadotSdkCompat } from 'polkadot-api/polkadot-sdk-compat';
|
|
7
7
|
import { isAddress } from 'viem';
|
|
8
8
|
|
|
@@ -371,6 +371,16 @@ var _transform = function transform(obj) {
|
|
|
371
371
|
if (keys.length === 1) {
|
|
372
372
|
var key = keys[0];
|
|
373
373
|
var value = obj[key];
|
|
374
|
+
if (key === 'items' && Array.isArray(value)) {
|
|
375
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
|
|
376
|
+
return {
|
|
377
|
+
items: value.map(function (item) {
|
|
378
|
+
return item.map(function (i) {
|
|
379
|
+
return Binary.fromHex(i);
|
|
380
|
+
});
|
|
381
|
+
})
|
|
382
|
+
};
|
|
383
|
+
}
|
|
374
384
|
if (key === 'AccountId32') {
|
|
375
385
|
return {
|
|
376
386
|
type: key,
|
|
@@ -496,11 +506,13 @@ var _transform = function transform(obj) {
|
|
|
496
506
|
newObj[k] = undefined;
|
|
497
507
|
continue;
|
|
498
508
|
}
|
|
499
|
-
if ((k === 'dest' || k === 'target') && typeof v === 'string') {
|
|
509
|
+
if ((k === 'dest' || k === 'who' || k === 'target') && typeof v === 'string') {
|
|
500
510
|
newObj[k] = v;
|
|
501
511
|
continue;
|
|
502
512
|
}
|
|
503
|
-
if (typeof v === 'string' && v
|
|
513
|
+
if (typeof v === 'string' && isAddress(v)) {
|
|
514
|
+
newObj[k] = v;
|
|
515
|
+
} else if (typeof v === 'string' && v.startsWith('0x')) {
|
|
504
516
|
newObj[k] = FixedSizeBinary.fromHex(v);
|
|
505
517
|
} else if (typeof v === 'string') {
|
|
506
518
|
newObj[k] = {
|
|
@@ -937,6 +949,21 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
937
949
|
})
|
|
938
950
|
});
|
|
939
951
|
}
|
|
952
|
+
}, {
|
|
953
|
+
key: "callDispatchAsMethod",
|
|
954
|
+
value: function callDispatchAsMethod(call, address) {
|
|
955
|
+
var origin = {
|
|
956
|
+
type: 'system',
|
|
957
|
+
value: {
|
|
958
|
+
type: 'Signed',
|
|
959
|
+
value: address
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
return this.api.getUnsafeApi().tx.Utility.dispatch_as({
|
|
963
|
+
as_origin: origin,
|
|
964
|
+
call: call.decodedCall
|
|
965
|
+
});
|
|
966
|
+
}
|
|
940
967
|
}, {
|
|
941
968
|
key: "objectToHex",
|
|
942
969
|
value: function () {
|
|
@@ -1040,6 +1067,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1040
1067
|
}
|
|
1041
1068
|
return quoteAhPrice;
|
|
1042
1069
|
}()
|
|
1070
|
+
}, {
|
|
1071
|
+
key: "getEvmStorage",
|
|
1072
|
+
value: function getEvmStorage(contract, slot) {
|
|
1073
|
+
return this.api.getUnsafeApi().query.EVM.AccountStorages.getKey(FixedSizeBinary.fromHex(contract), FixedSizeBinary.fromHex(slot));
|
|
1074
|
+
}
|
|
1043
1075
|
}, {
|
|
1044
1076
|
key: "getBalanceNative",
|
|
1045
1077
|
value: function () {
|
|
@@ -1313,11 +1345,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1313
1345
|
value: function () {
|
|
1314
1346
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref6) {
|
|
1315
1347
|
var _this = this;
|
|
1316
|
-
var tx, address, chain, feeAsset, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee;
|
|
1348
|
+
var tx, address, chain, asset, feeAsset, _ref6$useRootOrigin, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee, _t3;
|
|
1317
1349
|
return _regenerator().w(function (_context19) {
|
|
1318
1350
|
while (1) switch (_context19.n) {
|
|
1319
1351
|
case 0:
|
|
1320
|
-
tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, feeAsset = _ref6.feeAsset;
|
|
1352
|
+
tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, asset = _ref6.asset, feeAsset = _ref6.feeAsset, _ref6$useRootOrigin = _ref6.useRootOrigin, useRootOrigin = _ref6$useRootOrigin === void 0 ? false : _ref6$useRootOrigin;
|
|
1321
1353
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1322
1354
|
if (supportsDryRunApi) {
|
|
1323
1355
|
_context19.n = 1;
|
|
@@ -1328,11 +1360,27 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1328
1360
|
DEFAULT_XCM_VERSION = 3;
|
|
1329
1361
|
basePayload = {
|
|
1330
1362
|
type: 'system',
|
|
1331
|
-
value: {
|
|
1363
|
+
value: useRootOrigin ? {
|
|
1364
|
+
type: 'Root'
|
|
1365
|
+
} : {
|
|
1332
1366
|
type: 'Signed',
|
|
1333
1367
|
value: address
|
|
1334
1368
|
}
|
|
1335
1369
|
};
|
|
1370
|
+
if (!useRootOrigin) {
|
|
1371
|
+
_context19.n = 3;
|
|
1372
|
+
break;
|
|
1373
|
+
}
|
|
1374
|
+
_context19.n = 2;
|
|
1375
|
+
return wrapTxBypass(this, chain, asset, feeAsset, address, tx);
|
|
1376
|
+
case 2:
|
|
1377
|
+
_t3 = _context19.v;
|
|
1378
|
+
_context19.n = 4;
|
|
1379
|
+
break;
|
|
1380
|
+
case 3:
|
|
1381
|
+
_t3 = tx;
|
|
1382
|
+
case 4:
|
|
1383
|
+
resolvedTx = _t3;
|
|
1336
1384
|
performDryRunCall = /*#__PURE__*/function () {
|
|
1337
1385
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(includeVersion) {
|
|
1338
1386
|
var _this$api$getUnsafeAp;
|
|
@@ -1340,7 +1388,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1340
1388
|
return _regenerator().w(function (_context18) {
|
|
1341
1389
|
while (1) switch (_context18.n) {
|
|
1342
1390
|
case 0:
|
|
1343
|
-
callArgs = [basePayload,
|
|
1391
|
+
callArgs = [basePayload, resolvedTx.decodedCall];
|
|
1344
1392
|
if (includeVersion) {
|
|
1345
1393
|
callArgs.push(DEFAULT_XCM_VERSION);
|
|
1346
1394
|
}
|
|
@@ -1368,27 +1416,27 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1368
1416
|
if (result !== null && result !== void 0 && (_result$value3 = result.value) !== null && _result$value3 !== void 0 && _result$value3.type) {
|
|
1369
1417
|
return String(result.value.type);
|
|
1370
1418
|
}
|
|
1371
|
-
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure');
|
|
1419
|
+
return JSON.stringify((_ref8 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref8 !== void 0 ? _ref8 : 'Unknown error structure', replaceBigInt);
|
|
1372
1420
|
};
|
|
1373
1421
|
failureOutputReason = '';
|
|
1374
|
-
_context19.n =
|
|
1422
|
+
_context19.n = 5;
|
|
1375
1423
|
return performDryRunCall(false);
|
|
1376
|
-
case
|
|
1424
|
+
case 5:
|
|
1377
1425
|
result = _context19.v;
|
|
1378
1426
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1379
1427
|
if (isSuccess) {
|
|
1380
|
-
_context19.n =
|
|
1428
|
+
_context19.n = 7;
|
|
1381
1429
|
break;
|
|
1382
1430
|
}
|
|
1383
1431
|
initialFailureReason = extractFailureReasonFromResult(result);
|
|
1384
1432
|
failureOutputReason = initialFailureReason;
|
|
1385
1433
|
if (!(initialFailureReason === 'VersionedConversionFailed')) {
|
|
1386
|
-
_context19.n =
|
|
1434
|
+
_context19.n = 7;
|
|
1387
1435
|
break;
|
|
1388
1436
|
}
|
|
1389
|
-
_context19.n =
|
|
1437
|
+
_context19.n = 6;
|
|
1390
1438
|
return performDryRunCall(true);
|
|
1391
|
-
case
|
|
1439
|
+
case 6:
|
|
1392
1440
|
result = _context19.v;
|
|
1393
1441
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1394
1442
|
if (!isSuccess) {
|
|
@@ -1396,16 +1444,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1396
1444
|
} else {
|
|
1397
1445
|
failureOutputReason = '';
|
|
1398
1446
|
}
|
|
1399
|
-
case
|
|
1447
|
+
case 7:
|
|
1400
1448
|
if (isSuccess) {
|
|
1401
|
-
_context19.n =
|
|
1449
|
+
_context19.n = 8;
|
|
1402
1450
|
break;
|
|
1403
1451
|
}
|
|
1404
1452
|
return _context19.a(2, Promise.resolve({
|
|
1405
1453
|
success: false,
|
|
1406
1454
|
failureReason: failureOutputReason
|
|
1407
1455
|
}));
|
|
1408
|
-
case
|
|
1456
|
+
case 8:
|
|
1409
1457
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
1410
1458
|
weight = actualWeight ? {
|
|
1411
1459
|
refTime: actualWeight.ref_time,
|
|
@@ -1413,24 +1461,24 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1413
1461
|
} : undefined;
|
|
1414
1462
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1415
1463
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1416
|
-
_context19.n =
|
|
1417
|
-
return this.calculateTransactionFee(
|
|
1418
|
-
case
|
|
1464
|
+
_context19.n = 9;
|
|
1465
|
+
return this.calculateTransactionFee(resolvedTx, address);
|
|
1466
|
+
case 9:
|
|
1419
1467
|
executionFee = _context19.v;
|
|
1420
1468
|
nativeAsset = findAssetInfo(chain, {
|
|
1421
1469
|
symbol: Native(getNativeAssetSymbol(chain))
|
|
1422
1470
|
}, null);
|
|
1423
1471
|
hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
|
|
1424
1472
|
if (!(hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && nativeAsset && chain !== 'AssetHubPolkadot' && chain !== 'Kusama')) {
|
|
1425
|
-
_context19.n =
|
|
1473
|
+
_context19.n = 11;
|
|
1426
1474
|
break;
|
|
1427
1475
|
}
|
|
1428
|
-
_context19.n =
|
|
1476
|
+
_context19.n = 10;
|
|
1429
1477
|
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
|
|
1430
|
-
case
|
|
1478
|
+
case 10:
|
|
1431
1479
|
xcmFee = _context19.v;
|
|
1432
1480
|
if (!(typeof xcmFee === 'bigint')) {
|
|
1433
|
-
_context19.n =
|
|
1481
|
+
_context19.n = 11;
|
|
1434
1482
|
break;
|
|
1435
1483
|
}
|
|
1436
1484
|
return _context19.a(2, Promise.resolve({
|
|
@@ -1440,7 +1488,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1440
1488
|
forwardedXcms: forwardedXcms,
|
|
1441
1489
|
destParaId: destParaId
|
|
1442
1490
|
}));
|
|
1443
|
-
case
|
|
1491
|
+
case 11:
|
|
1444
1492
|
fee = computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1445
1493
|
return _context19.a(2, Promise.resolve({
|
|
1446
1494
|
success: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@noble/hashes": "^1.8.0",
|
|
27
27
|
"viem": "^2.33.2",
|
|
28
|
-
"@paraspell/sdk-core": "11.
|
|
28
|
+
"@paraspell/sdk-core": "11.2.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"polkadot-api": ">= 1.15.2 < 2"
|