@paraspell/sdk 10.11.10 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -86
- package/dist/index.cjs +63 -63
- package/dist/index.d.ts +25 -25
- package/dist/index.mjs +64 -64
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidParameterError, isConfig, BatchMode,
|
|
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';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { blake2b } from '@noble/hashes/blake2';
|
|
4
4
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
@@ -779,7 +779,7 @@ var releasePolkadotClient = function releasePolkadotClient(ws) {
|
|
|
779
779
|
clientPool["delete"](key);
|
|
780
780
|
}
|
|
781
781
|
};
|
|
782
|
-
var
|
|
782
|
+
var unsupportedChains = ['ComposableFinance', 'Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsKusama', 'Pendulum', 'Subsocial'];
|
|
783
783
|
var isHex = function isHex(str) {
|
|
784
784
|
return typeof str === 'string' && /^0x[0-9a-fA-F]+$/.test(str);
|
|
785
785
|
};
|
|
@@ -818,14 +818,14 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
818
818
|
}
|
|
819
819
|
return _context3.a(2);
|
|
820
820
|
case 1:
|
|
821
|
-
if (!
|
|
821
|
+
if (!unsupportedChains.includes(chain)) {
|
|
822
822
|
_context3.n = 2;
|
|
823
823
|
break;
|
|
824
824
|
}
|
|
825
|
-
throw new
|
|
825
|
+
throw new ChainNotSupportedError("The chain ".concat(chain, " is not yet supported by the Polkadot API."));
|
|
826
826
|
case 2:
|
|
827
827
|
this._ttlMs = clientTtlMs;
|
|
828
|
-
this.
|
|
828
|
+
this._chain = chain;
|
|
829
829
|
apiConfig = this.getApiConfigForChain(chain); // For development mode, api for each used chain must be provided
|
|
830
830
|
if (!(isConfig(this._config) && this._config.development && !apiConfig)) {
|
|
831
831
|
_context3.n = 3;
|
|
@@ -868,7 +868,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
868
868
|
_context4.n = 1;
|
|
869
869
|
break;
|
|
870
870
|
}
|
|
871
|
-
return _context4.a(2,
|
|
871
|
+
return _context4.a(2, createChainClient$1(this, chain));
|
|
872
872
|
case 1:
|
|
873
873
|
if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
|
|
874
874
|
_context4.n = 2;
|
|
@@ -1106,14 +1106,14 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1106
1106
|
}, {
|
|
1107
1107
|
key: "getBalanceForeignAssetsPallet",
|
|
1108
1108
|
value: function () {
|
|
1109
|
-
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address,
|
|
1110
|
-
var
|
|
1109
|
+
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address, location) {
|
|
1110
|
+
var transformedLocation, res;
|
|
1111
1111
|
return _regenerator().w(function (_context10) {
|
|
1112
1112
|
while (1) switch (_context10.n) {
|
|
1113
1113
|
case 0:
|
|
1114
|
-
|
|
1114
|
+
transformedLocation = _transform(location);
|
|
1115
1115
|
_context10.n = 1;
|
|
1116
|
-
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(
|
|
1116
|
+
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedLocation, address);
|
|
1117
1117
|
case 1:
|
|
1118
1118
|
res = _context10.v;
|
|
1119
1119
|
return _context10.a(2, BigInt(res === undefined ? 0 : res.balance));
|
|
@@ -1154,7 +1154,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1154
1154
|
return _regenerator().w(function (_context12) {
|
|
1155
1155
|
while (1) switch (_context12.n) {
|
|
1156
1156
|
case 0:
|
|
1157
|
-
currencySelection =
|
|
1157
|
+
currencySelection = getChain('BifrostPolkadot').getCurrencySelection(asset);
|
|
1158
1158
|
transformedParameters = _transform(currencySelection);
|
|
1159
1159
|
_context12.n = 1;
|
|
1160
1160
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
@@ -1198,16 +1198,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1198
1198
|
}, {
|
|
1199
1199
|
key: "getBalanceForeignXTokens",
|
|
1200
1200
|
value: function () {
|
|
1201
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(
|
|
1201
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(chain, address, asset) {
|
|
1202
1202
|
var pallet, _response, response, entry;
|
|
1203
1203
|
return _regenerator().w(function (_context14) {
|
|
1204
1204
|
while (1) switch (_context14.n) {
|
|
1205
1205
|
case 0:
|
|
1206
1206
|
pallet = 'Tokens';
|
|
1207
|
-
if (
|
|
1207
|
+
if (chain === 'Centrifuge' || chain === 'Altair') {
|
|
1208
1208
|
pallet = 'OrmlTokens';
|
|
1209
1209
|
}
|
|
1210
|
-
if (!(
|
|
1210
|
+
if (!(chain === 'Hydration')) {
|
|
1211
1211
|
_context14.n = 2;
|
|
1212
1212
|
break;
|
|
1213
1213
|
}
|
|
@@ -1288,42 +1288,42 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1288
1288
|
return new PapiApi(isConfig(this._config) ? this._config : undefined);
|
|
1289
1289
|
}
|
|
1290
1290
|
}, {
|
|
1291
|
-
key: "
|
|
1291
|
+
key: "createApiForChain",
|
|
1292
1292
|
value: function () {
|
|
1293
|
-
var
|
|
1293
|
+
var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(chain) {
|
|
1294
1294
|
var api;
|
|
1295
1295
|
return _regenerator().w(function (_context17) {
|
|
1296
1296
|
while (1) switch (_context17.n) {
|
|
1297
1297
|
case 0:
|
|
1298
1298
|
api = new PapiApi();
|
|
1299
1299
|
_context17.n = 1;
|
|
1300
|
-
return api.init(
|
|
1300
|
+
return api.init(chain);
|
|
1301
1301
|
case 1:
|
|
1302
1302
|
return _context17.a(2, api);
|
|
1303
1303
|
}
|
|
1304
1304
|
}, _callee17);
|
|
1305
1305
|
}));
|
|
1306
|
-
function
|
|
1307
|
-
return
|
|
1306
|
+
function createApiForChain(_x32) {
|
|
1307
|
+
return _createApiForChain.apply(this, arguments);
|
|
1308
1308
|
}
|
|
1309
|
-
return
|
|
1309
|
+
return createApiForChain;
|
|
1310
1310
|
}()
|
|
1311
1311
|
}, {
|
|
1312
1312
|
key: "getDryRunCall",
|
|
1313
1313
|
value: function () {
|
|
1314
1314
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref6) {
|
|
1315
1315
|
var _this = this;
|
|
1316
|
-
var tx, address,
|
|
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;
|
|
1317
1317
|
return _regenerator().w(function (_context19) {
|
|
1318
1318
|
while (1) switch (_context19.n) {
|
|
1319
1319
|
case 0:
|
|
1320
|
-
tx = _ref6.tx, address = _ref6.address,
|
|
1321
|
-
supportsDryRunApi = getAssetsObject(
|
|
1320
|
+
tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, feeAsset = _ref6.feeAsset;
|
|
1321
|
+
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1322
1322
|
if (supportsDryRunApi) {
|
|
1323
1323
|
_context19.n = 1;
|
|
1324
1324
|
break;
|
|
1325
1325
|
}
|
|
1326
|
-
throw new
|
|
1326
|
+
throw new ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
|
|
1327
1327
|
case 1:
|
|
1328
1328
|
DEFAULT_XCM_VERSION = 3;
|
|
1329
1329
|
basePayload = {
|
|
@@ -1417,16 +1417,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1417
1417
|
return this.calculateTransactionFee(tx, address);
|
|
1418
1418
|
case 6:
|
|
1419
1419
|
executionFee = _context19.v;
|
|
1420
|
-
nativeAsset =
|
|
1421
|
-
symbol: Native(getNativeAssetSymbol(
|
|
1420
|
+
nativeAsset = findAssetInfo(chain, {
|
|
1421
|
+
symbol: Native(getNativeAssetSymbol(chain))
|
|
1422
1422
|
}, null);
|
|
1423
|
-
|
|
1424
|
-
if (!(hasXcmPaymentApiSupport(
|
|
1423
|
+
hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
|
|
1424
|
+
if (!(hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && nativeAsset && chain !== 'AssetHubPolkadot' && chain !== 'Kusama')) {
|
|
1425
1425
|
_context19.n = 8;
|
|
1426
1426
|
break;
|
|
1427
1427
|
}
|
|
1428
1428
|
_context19.n = 7;
|
|
1429
|
-
return this.getXcmPaymentApiFee(
|
|
1429
|
+
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
|
|
1430
1430
|
case 7:
|
|
1431
1431
|
xcmFee = _context19.v;
|
|
1432
1432
|
if (!(typeof xcmFee === 'bigint')) {
|
|
@@ -1441,7 +1441,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1441
1441
|
destParaId: destParaId
|
|
1442
1442
|
}));
|
|
1443
1443
|
case 8:
|
|
1444
|
-
fee = computeFeeFromDryRun(result,
|
|
1444
|
+
fee = computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1445
1445
|
return _context19.a(2, Promise.resolve({
|
|
1446
1446
|
success: true,
|
|
1447
1447
|
fee: fee,
|
|
@@ -1485,7 +1485,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1485
1485
|
}, {
|
|
1486
1486
|
key: "getXcmPaymentApiFee",
|
|
1487
1487
|
value: function () {
|
|
1488
|
-
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(
|
|
1488
|
+
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(chain, xcm, asset) {
|
|
1489
1489
|
var transformXcm,
|
|
1490
1490
|
weight,
|
|
1491
1491
|
localizedLocation,
|
|
@@ -1501,7 +1501,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1501
1501
|
case 1:
|
|
1502
1502
|
weight = _context21.v;
|
|
1503
1503
|
assertHasLocation(asset);
|
|
1504
|
-
localizedLocation =
|
|
1504
|
+
localizedLocation = chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama' || isRelayChain(chain) ? localizeLocation(chain, asset.location) : asset.location;
|
|
1505
1505
|
transformedLocation = _transform(localizedLocation);
|
|
1506
1506
|
_context21.n = 2;
|
|
1507
1507
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
|
|
@@ -1524,17 +1524,17 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1524
1524
|
value: function () {
|
|
1525
1525
|
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(_ref9) {
|
|
1526
1526
|
var _ref0, _processAssetsDeposit, _ref1, _ref10, _ref11, _ref12, _ref13;
|
|
1527
|
-
var originLocation, xcm,
|
|
1527
|
+
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
|
|
1528
1528
|
return _regenerator().w(function (_context22) {
|
|
1529
1529
|
while (1) switch (_context22.n) {
|
|
1530
1530
|
case 0:
|
|
1531
|
-
originLocation = _ref9.originLocation, xcm = _ref9.xcm,
|
|
1532
|
-
supportsDryRunApi = getAssetsObject(
|
|
1531
|
+
originLocation = _ref9.originLocation, xcm = _ref9.xcm, chain = _ref9.chain, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
|
|
1532
|
+
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1533
1533
|
if (supportsDryRunApi) {
|
|
1534
1534
|
_context22.n = 1;
|
|
1535
1535
|
break;
|
|
1536
1536
|
}
|
|
1537
|
-
throw new
|
|
1537
|
+
throw new ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
|
|
1538
1538
|
case 1:
|
|
1539
1539
|
transformedOriginLocation = _transform(originLocation);
|
|
1540
1540
|
_context22.n = 2;
|
|
@@ -1559,12 +1559,12 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1559
1559
|
} : undefined;
|
|
1560
1560
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1561
1561
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1562
|
-
if (!(hasXcmPaymentApiSupport(
|
|
1562
|
+
if (!(hasXcmPaymentApiSupport(chain) && asset && chain !== 'AssetHubPolkadot' && chain !== 'Polkadot')) {
|
|
1563
1563
|
_context22.n = 5;
|
|
1564
1564
|
break;
|
|
1565
1565
|
}
|
|
1566
1566
|
_context22.n = 4;
|
|
1567
|
-
return this.getXcmPaymentApiFee(
|
|
1567
|
+
return this.getXcmPaymentApiFee(chain, xcm, asset);
|
|
1568
1568
|
case 4:
|
|
1569
1569
|
_fee = _context22.v;
|
|
1570
1570
|
if (!(typeof _fee === 'bigint')) {
|
|
@@ -1588,7 +1588,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1588
1588
|
}) : undefined) !== null && _ref0 !== void 0 ? _ref0 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1589
1589
|
return event.type === 'Tokens' && event.value.type === 'Deposited';
|
|
1590
1590
|
}) : undefined;
|
|
1591
|
-
processedAssetsAmount =
|
|
1591
|
+
processedAssetsAmount = chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
|
|
1592
1592
|
feeEvent = (_ref1 = (_ref10 = (_ref11 = (_ref12 = (_ref13 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
|
|
1593
1593
|
//
|
|
1594
1594
|
processedAssetsAmount !== undefined ? {
|
|
@@ -1601,11 +1601,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1601
1601
|
}
|
|
1602
1602
|
} : undefined) !== null && _ref13 !== void 0 ? _ref13 :
|
|
1603
1603
|
//
|
|
1604
|
-
|
|
1604
|
+
chain === 'Mythos' ? reversedEvents.find(function (event) {
|
|
1605
1605
|
return event.type === 'Balances' && event.value.type === 'Issued';
|
|
1606
1606
|
}) : undefined) !== null && _ref12 !== void 0 ? _ref12 :
|
|
1607
1607
|
//
|
|
1608
|
-
origin === 'Mythos' ||
|
|
1608
|
+
origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
|
|
1609
1609
|
return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
|
|
1610
1610
|
}) : undefined) !== null && _ref11 !== void 0 ? _ref11 :
|
|
1611
1611
|
// Prefer to Minted event
|
|
@@ -1631,7 +1631,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1631
1631
|
if (feeAssetFeeEvent) {
|
|
1632
1632
|
fee = amount - originFee - feeEvent.value.value.amount;
|
|
1633
1633
|
}
|
|
1634
|
-
processedFee = (isRelayChain(
|
|
1634
|
+
processedFee = (isRelayChain(chain) || chain.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? padFeeBy(fee, 30) : fee;
|
|
1635
1635
|
return _context22.a(2, Promise.resolve({
|
|
1636
1636
|
success: true,
|
|
1637
1637
|
fee: processedFee,
|
|
@@ -1685,7 +1685,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1685
1685
|
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1686
1686
|
if (!this.initialized) return Promise.resolve();
|
|
1687
1687
|
if (!force && !this.disconnectAllowed) return Promise.resolve();
|
|
1688
|
-
var api = isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this.
|
|
1688
|
+
var api = isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._chain] : this._config;
|
|
1689
1689
|
// Own client provided, destroy only if force true
|
|
1690
1690
|
if (force && _typeof(api) === 'object') {
|
|
1691
1691
|
this.api.destroy();
|
|
@@ -1695,7 +1695,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1695
1695
|
if (force) {
|
|
1696
1696
|
this.api.destroy();
|
|
1697
1697
|
} else {
|
|
1698
|
-
var key = api === undefined ?
|
|
1698
|
+
var key = api === undefined ? getChainProviders(this._chain) : api;
|
|
1699
1699
|
releasePolkadotClient(key);
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
@@ -1704,9 +1704,9 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1704
1704
|
}]);
|
|
1705
1705
|
}();
|
|
1706
1706
|
|
|
1707
|
-
var
|
|
1707
|
+
var createChainClient = function createChainClient(chain) {
|
|
1708
1708
|
var papiApi = new PapiApi();
|
|
1709
|
-
return
|
|
1709
|
+
return createChainClient$1(papiApi, chain);
|
|
1710
1710
|
};
|
|
1711
1711
|
var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
1712
1712
|
return /*#__PURE__*/function () {
|
|
@@ -1730,19 +1730,19 @@ var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
|
1730
1730
|
};
|
|
1731
1731
|
|
|
1732
1732
|
/**
|
|
1733
|
-
* Retrieves the native balance for a given account on a specified
|
|
1733
|
+
* Retrieves the native balance for a given account on a specified chain.
|
|
1734
1734
|
*
|
|
1735
1735
|
* @returns The native balance as a bigint.
|
|
1736
1736
|
*/
|
|
1737
1737
|
var getBalanceNative = createPapiApiCall(getBalanceNative$1);
|
|
1738
1738
|
/**
|
|
1739
|
-
* Retrieves the balance of a foreign asset for a given account on a specified
|
|
1739
|
+
* Retrieves the balance of a foreign asset for a given account on a specified chain.
|
|
1740
1740
|
*
|
|
1741
1741
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
1742
1742
|
*/
|
|
1743
1743
|
var getBalanceForeign = createPapiApiCall(getBalanceForeign$1);
|
|
1744
1744
|
/**
|
|
1745
|
-
* Retrieves the asset balance for a given account on a specified
|
|
1745
|
+
* Retrieves the asset balance for a given account on a specified chain.
|
|
1746
1746
|
*
|
|
1747
1747
|
* @returns The asset balance as a bigint.
|
|
1748
1748
|
*/
|
|
@@ -1756,7 +1756,7 @@ var claimAssets = createPapiApiCall(claimAssets$1);
|
|
|
1756
1756
|
/**
|
|
1757
1757
|
* @deprecated This function is deprecated and will be removed in a future version.
|
|
1758
1758
|
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
1759
|
-
* where `builder` is an instance of `Builder()`.
|
|
1759
|
+
* where `builder` is an instance of `Builder()`. Will be removed in v12
|
|
1760
1760
|
* For more details, please refer to the documentation:
|
|
1761
1761
|
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
1762
1762
|
*/
|
|
@@ -1769,7 +1769,7 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1769
1769
|
Native: Native,
|
|
1770
1770
|
Override: Override,
|
|
1771
1771
|
claimAssets: claimAssets,
|
|
1772
|
-
|
|
1772
|
+
findAssetInfo: findAssetInfo,
|
|
1773
1773
|
getAllAssetsSymbols: getAllAssetsSymbols,
|
|
1774
1774
|
getAssetBalance: getAssetBalance,
|
|
1775
1775
|
getAssetDecimals: getAssetDecimals,
|
|
@@ -1785,14 +1785,14 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1785
1785
|
getOtherAssets: getOtherAssets,
|
|
1786
1786
|
getRelayChainSymbol: getRelayChainSymbol,
|
|
1787
1787
|
getSupportedAssets: getSupportedAssets,
|
|
1788
|
-
|
|
1788
|
+
getTChain: getTChain,
|
|
1789
1789
|
hasSupportForAsset: hasSupportForAsset,
|
|
1790
|
-
|
|
1790
|
+
isChainEvm: isChainEvm
|
|
1791
1791
|
});
|
|
1792
1792
|
|
|
1793
|
-
var convertSs58 = function convertSs58(address,
|
|
1793
|
+
var convertSs58 = function convertSs58(address, chain) {
|
|
1794
1794
|
var papiApi = new PapiApi();
|
|
1795
|
-
return convertSs58$1(papiApi, address,
|
|
1795
|
+
return convertSs58$1(papiApi, address, chain);
|
|
1796
1796
|
};
|
|
1797
1797
|
|
|
1798
1798
|
/**
|
|
@@ -1805,22 +1805,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1805
1805
|
}
|
|
1806
1806
|
return _createClass(EvmBuilderCore, [{
|
|
1807
1807
|
key: "from",
|
|
1808
|
-
value: function from(
|
|
1808
|
+
value: function from(chain) {
|
|
1809
1809
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1810
|
-
from:
|
|
1810
|
+
from: chain
|
|
1811
1811
|
}));
|
|
1812
1812
|
}
|
|
1813
1813
|
/**
|
|
1814
|
-
* Specifies the destination
|
|
1814
|
+
* Specifies the destination chain on Polkadot.
|
|
1815
1815
|
*
|
|
1816
|
-
* @param
|
|
1816
|
+
* @param chain - The Polkadot chain to which the transfer will be made.
|
|
1817
1817
|
* @returns An instance of EvmBuilder
|
|
1818
1818
|
*/
|
|
1819
1819
|
}, {
|
|
1820
1820
|
key: "to",
|
|
1821
|
-
value: function to(
|
|
1821
|
+
value: function to(chain) {
|
|
1822
1822
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1823
|
-
to:
|
|
1823
|
+
to: chain
|
|
1824
1824
|
}));
|
|
1825
1825
|
}
|
|
1826
1826
|
/**
|
|
@@ -1929,8 +1929,8 @@ var Builder = function Builder(api) {
|
|
|
1929
1929
|
var papiApi = new PapiApi(api);
|
|
1930
1930
|
return Builder$1(papiApi);
|
|
1931
1931
|
};
|
|
1932
|
-
var EvmBuilder = function EvmBuilder() {
|
|
1933
|
-
var papiApi = new PapiApi();
|
|
1932
|
+
var EvmBuilder = function EvmBuilder(api) {
|
|
1933
|
+
var papiApi = new PapiApi(api);
|
|
1934
1934
|
return EvmBuilder$1(papiApi);
|
|
1935
1935
|
};
|
|
1936
1936
|
|
|
@@ -2008,4 +2008,4 @@ var transfer = /*#__PURE__*/Object.freeze({
|
|
|
2008
2008
|
send: send
|
|
2009
2009
|
});
|
|
2010
2010
|
|
|
2011
|
-
export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58,
|
|
2011
|
+
export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58, createChainClient, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, send, _transform as transform, transfer as xcmPallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.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": "
|
|
28
|
+
"@paraspell/sdk-core": "11.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"polkadot-api": ">= 1.15.2 < 2"
|