@paraspell/sdk 10.11.9 → 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.cjs
CHANGED
|
@@ -780,7 +780,7 @@ var releasePolkadotClient = function releasePolkadotClient(ws) {
|
|
|
780
780
|
clientPool["delete"](key);
|
|
781
781
|
}
|
|
782
782
|
};
|
|
783
|
-
var
|
|
783
|
+
var unsupportedChains = ['ComposableFinance', 'Interlay', 'CrustShadow', 'Kintsugi', 'RobonomicsKusama', 'Pendulum', 'Subsocial'];
|
|
784
784
|
var isHex = function isHex(str) {
|
|
785
785
|
return typeof str === 'string' && /^0x[0-9a-fA-F]+$/.test(str);
|
|
786
786
|
};
|
|
@@ -819,14 +819,14 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
819
819
|
}
|
|
820
820
|
return _context3.a(2);
|
|
821
821
|
case 1:
|
|
822
|
-
if (!
|
|
822
|
+
if (!unsupportedChains.includes(chain)) {
|
|
823
823
|
_context3.n = 2;
|
|
824
824
|
break;
|
|
825
825
|
}
|
|
826
|
-
throw new sdkCore.
|
|
826
|
+
throw new sdkCore.ChainNotSupportedError("The chain ".concat(chain, " is not yet supported by the Polkadot API."));
|
|
827
827
|
case 2:
|
|
828
828
|
this._ttlMs = clientTtlMs;
|
|
829
|
-
this.
|
|
829
|
+
this._chain = chain;
|
|
830
830
|
apiConfig = this.getApiConfigForChain(chain); // For development mode, api for each used chain must be provided
|
|
831
831
|
if (!(sdkCore.isConfig(this._config) && this._config.development && !apiConfig)) {
|
|
832
832
|
_context3.n = 3;
|
|
@@ -869,7 +869,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
869
869
|
_context4.n = 1;
|
|
870
870
|
break;
|
|
871
871
|
}
|
|
872
|
-
return _context4.a(2, sdkCore.
|
|
872
|
+
return _context4.a(2, sdkCore.createChainClient(this, chain));
|
|
873
873
|
case 1:
|
|
874
874
|
if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
|
|
875
875
|
_context4.n = 2;
|
|
@@ -1107,14 +1107,14 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1107
1107
|
}, {
|
|
1108
1108
|
key: "getBalanceForeignAssetsPallet",
|
|
1109
1109
|
value: function () {
|
|
1110
|
-
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address,
|
|
1111
|
-
var
|
|
1110
|
+
var _getBalanceForeignAssetsPallet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(address, location) {
|
|
1111
|
+
var transformedLocation, res;
|
|
1112
1112
|
return _regenerator().w(function (_context10) {
|
|
1113
1113
|
while (1) switch (_context10.n) {
|
|
1114
1114
|
case 0:
|
|
1115
|
-
|
|
1115
|
+
transformedLocation = _transform(location);
|
|
1116
1116
|
_context10.n = 1;
|
|
1117
|
-
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(
|
|
1117
|
+
return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedLocation, address);
|
|
1118
1118
|
case 1:
|
|
1119
1119
|
res = _context10.v;
|
|
1120
1120
|
return _context10.a(2, BigInt(res === undefined ? 0 : res.balance));
|
|
@@ -1155,7 +1155,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1155
1155
|
return _regenerator().w(function (_context12) {
|
|
1156
1156
|
while (1) switch (_context12.n) {
|
|
1157
1157
|
case 0:
|
|
1158
|
-
currencySelection = sdkCore.
|
|
1158
|
+
currencySelection = sdkCore.getChain('BifrostPolkadot').getCurrencySelection(asset);
|
|
1159
1159
|
transformedParameters = _transform(currencySelection);
|
|
1160
1160
|
_context12.n = 1;
|
|
1161
1161
|
return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
|
|
@@ -1199,16 +1199,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1199
1199
|
}, {
|
|
1200
1200
|
key: "getBalanceForeignXTokens",
|
|
1201
1201
|
value: function () {
|
|
1202
|
-
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(
|
|
1202
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(chain, address, asset) {
|
|
1203
1203
|
var pallet, _response, response, entry;
|
|
1204
1204
|
return _regenerator().w(function (_context14) {
|
|
1205
1205
|
while (1) switch (_context14.n) {
|
|
1206
1206
|
case 0:
|
|
1207
1207
|
pallet = 'Tokens';
|
|
1208
|
-
if (
|
|
1208
|
+
if (chain === 'Centrifuge' || chain === 'Altair') {
|
|
1209
1209
|
pallet = 'OrmlTokens';
|
|
1210
1210
|
}
|
|
1211
|
-
if (!(
|
|
1211
|
+
if (!(chain === 'Hydration')) {
|
|
1212
1212
|
_context14.n = 2;
|
|
1213
1213
|
break;
|
|
1214
1214
|
}
|
|
@@ -1289,42 +1289,42 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1289
1289
|
return new PapiApi(sdkCore.isConfig(this._config) ? this._config : undefined);
|
|
1290
1290
|
}
|
|
1291
1291
|
}, {
|
|
1292
|
-
key: "
|
|
1292
|
+
key: "createApiForChain",
|
|
1293
1293
|
value: function () {
|
|
1294
|
-
var
|
|
1294
|
+
var _createApiForChain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(chain) {
|
|
1295
1295
|
var api;
|
|
1296
1296
|
return _regenerator().w(function (_context17) {
|
|
1297
1297
|
while (1) switch (_context17.n) {
|
|
1298
1298
|
case 0:
|
|
1299
1299
|
api = new PapiApi();
|
|
1300
1300
|
_context17.n = 1;
|
|
1301
|
-
return api.init(
|
|
1301
|
+
return api.init(chain);
|
|
1302
1302
|
case 1:
|
|
1303
1303
|
return _context17.a(2, api);
|
|
1304
1304
|
}
|
|
1305
1305
|
}, _callee17);
|
|
1306
1306
|
}));
|
|
1307
|
-
function
|
|
1308
|
-
return
|
|
1307
|
+
function createApiForChain(_x32) {
|
|
1308
|
+
return _createApiForChain.apply(this, arguments);
|
|
1309
1309
|
}
|
|
1310
|
-
return
|
|
1310
|
+
return createApiForChain;
|
|
1311
1311
|
}()
|
|
1312
1312
|
}, {
|
|
1313
1313
|
key: "getDryRunCall",
|
|
1314
1314
|
value: function () {
|
|
1315
1315
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(_ref6) {
|
|
1316
1316
|
var _this = this;
|
|
1317
|
-
var tx, address,
|
|
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;
|
|
1318
1318
|
return _regenerator().w(function (_context19) {
|
|
1319
1319
|
while (1) switch (_context19.n) {
|
|
1320
1320
|
case 0:
|
|
1321
|
-
tx = _ref6.tx, address = _ref6.address,
|
|
1322
|
-
supportsDryRunApi = sdkCore.getAssetsObject(
|
|
1321
|
+
tx = _ref6.tx, address = _ref6.address, chain = _ref6.chain, feeAsset = _ref6.feeAsset;
|
|
1322
|
+
supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
|
|
1323
1323
|
if (supportsDryRunApi) {
|
|
1324
1324
|
_context19.n = 1;
|
|
1325
1325
|
break;
|
|
1326
1326
|
}
|
|
1327
|
-
throw new sdkCore.
|
|
1327
|
+
throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
|
|
1328
1328
|
case 1:
|
|
1329
1329
|
DEFAULT_XCM_VERSION = 3;
|
|
1330
1330
|
basePayload = {
|
|
@@ -1418,16 +1418,16 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1418
1418
|
return this.calculateTransactionFee(tx, address);
|
|
1419
1419
|
case 6:
|
|
1420
1420
|
executionFee = _context19.v;
|
|
1421
|
-
nativeAsset = sdkCore.
|
|
1422
|
-
symbol: sdkCore.Native(sdkCore.getNativeAssetSymbol(
|
|
1421
|
+
nativeAsset = sdkCore.findAssetInfo(chain, {
|
|
1422
|
+
symbol: sdkCore.Native(sdkCore.getNativeAssetSymbol(chain))
|
|
1423
1423
|
}, null);
|
|
1424
|
-
|
|
1425
|
-
if (!(sdkCore.hasXcmPaymentApiSupport(
|
|
1424
|
+
hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
|
|
1425
|
+
if (!(sdkCore.hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && nativeAsset && chain !== 'AssetHubPolkadot' && chain !== 'Kusama')) {
|
|
1426
1426
|
_context19.n = 8;
|
|
1427
1427
|
break;
|
|
1428
1428
|
}
|
|
1429
1429
|
_context19.n = 7;
|
|
1430
|
-
return this.getXcmPaymentApiFee(
|
|
1430
|
+
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
|
|
1431
1431
|
case 7:
|
|
1432
1432
|
xcmFee = _context19.v;
|
|
1433
1433
|
if (!(typeof xcmFee === 'bigint')) {
|
|
@@ -1442,7 +1442,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1442
1442
|
destParaId: destParaId
|
|
1443
1443
|
}));
|
|
1444
1444
|
case 8:
|
|
1445
|
-
fee = sdkCore.computeFeeFromDryRun(result,
|
|
1445
|
+
fee = sdkCore.computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1446
1446
|
return _context19.a(2, Promise.resolve({
|
|
1447
1447
|
success: true,
|
|
1448
1448
|
fee: fee,
|
|
@@ -1486,7 +1486,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1486
1486
|
}, {
|
|
1487
1487
|
key: "getXcmPaymentApiFee",
|
|
1488
1488
|
value: function () {
|
|
1489
|
-
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(
|
|
1489
|
+
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(chain, xcm, asset) {
|
|
1490
1490
|
var transformXcm,
|
|
1491
1491
|
weight,
|
|
1492
1492
|
localizedLocation,
|
|
@@ -1502,7 +1502,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1502
1502
|
case 1:
|
|
1503
1503
|
weight = _context21.v;
|
|
1504
1504
|
sdkCore.assertHasLocation(asset);
|
|
1505
|
-
localizedLocation =
|
|
1505
|
+
localizedLocation = chain === 'AssetHubPolkadot' || chain === 'AssetHubKusama' || sdkCore.isRelayChain(chain) ? sdkCore.localizeLocation(chain, asset.location) : asset.location;
|
|
1506
1506
|
transformedLocation = _transform(localizedLocation);
|
|
1507
1507
|
_context21.n = 2;
|
|
1508
1508
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
|
|
@@ -1525,17 +1525,17 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1525
1525
|
value: function () {
|
|
1526
1526
|
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(_ref9) {
|
|
1527
1527
|
var _ref0, _processAssetsDeposit, _ref1, _ref10, _ref11, _ref12, _ref13;
|
|
1528
|
-
var originLocation, xcm,
|
|
1528
|
+
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;
|
|
1529
1529
|
return _regenerator().w(function (_context22) {
|
|
1530
1530
|
while (1) switch (_context22.n) {
|
|
1531
1531
|
case 0:
|
|
1532
|
-
originLocation = _ref9.originLocation, xcm = _ref9.xcm,
|
|
1533
|
-
supportsDryRunApi = sdkCore.getAssetsObject(
|
|
1532
|
+
originLocation = _ref9.originLocation, xcm = _ref9.xcm, chain = _ref9.chain, origin = _ref9.origin, asset = _ref9.asset, feeAsset = _ref9.feeAsset, originFee = _ref9.originFee, amount = _ref9.amount;
|
|
1533
|
+
supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
|
|
1534
1534
|
if (supportsDryRunApi) {
|
|
1535
1535
|
_context22.n = 1;
|
|
1536
1536
|
break;
|
|
1537
1537
|
}
|
|
1538
|
-
throw new sdkCore.
|
|
1538
|
+
throw new sdkCore.ChainNotSupportedError("DryRunApi is not available on chain ".concat(chain));
|
|
1539
1539
|
case 1:
|
|
1540
1540
|
transformedOriginLocation = _transform(originLocation);
|
|
1541
1541
|
_context22.n = 2;
|
|
@@ -1560,12 +1560,12 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1560
1560
|
} : undefined;
|
|
1561
1561
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1562
1562
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1563
|
-
if (!(sdkCore.hasXcmPaymentApiSupport(
|
|
1563
|
+
if (!(sdkCore.hasXcmPaymentApiSupport(chain) && asset && chain !== 'AssetHubPolkadot' && chain !== 'Polkadot')) {
|
|
1564
1564
|
_context22.n = 5;
|
|
1565
1565
|
break;
|
|
1566
1566
|
}
|
|
1567
1567
|
_context22.n = 4;
|
|
1568
|
-
return this.getXcmPaymentApiFee(
|
|
1568
|
+
return this.getXcmPaymentApiFee(chain, xcm, asset);
|
|
1569
1569
|
case 4:
|
|
1570
1570
|
_fee = _context22.v;
|
|
1571
1571
|
if (!(typeof _fee === 'bigint')) {
|
|
@@ -1589,7 +1589,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1589
1589
|
}) : undefined) !== null && _ref0 !== void 0 ? _ref0 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1590
1590
|
return event.type === 'Tokens' && event.value.type === 'Deposited';
|
|
1591
1591
|
}) : undefined;
|
|
1592
|
-
processedAssetsAmount =
|
|
1592
|
+
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);
|
|
1593
1593
|
feeEvent = (_ref1 = (_ref10 = (_ref11 = (_ref12 = (_ref13 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
|
|
1594
1594
|
//
|
|
1595
1595
|
processedAssetsAmount !== undefined ? {
|
|
@@ -1602,11 +1602,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1602
1602
|
}
|
|
1603
1603
|
} : undefined) !== null && _ref13 !== void 0 ? _ref13 :
|
|
1604
1604
|
//
|
|
1605
|
-
|
|
1605
|
+
chain === 'Mythos' ? reversedEvents.find(function (event) {
|
|
1606
1606
|
return event.type === 'Balances' && event.value.type === 'Issued';
|
|
1607
1607
|
}) : undefined) !== null && _ref12 !== void 0 ? _ref12 :
|
|
1608
1608
|
//
|
|
1609
|
-
origin === 'Mythos' ||
|
|
1609
|
+
origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
|
|
1610
1610
|
return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
|
|
1611
1611
|
}) : undefined) !== null && _ref11 !== void 0 ? _ref11 :
|
|
1612
1612
|
// Prefer to Minted event
|
|
@@ -1632,7 +1632,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1632
1632
|
if (feeAssetFeeEvent) {
|
|
1633
1633
|
fee = amount - originFee - feeEvent.value.value.amount;
|
|
1634
1634
|
}
|
|
1635
|
-
processedFee = (sdkCore.isRelayChain(
|
|
1635
|
+
processedFee = (sdkCore.isRelayChain(chain) || chain.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? sdkCore.padFeeBy(fee, 30) : fee;
|
|
1636
1636
|
return _context22.a(2, Promise.resolve({
|
|
1637
1637
|
success: true,
|
|
1638
1638
|
fee: processedFee,
|
|
@@ -1686,7 +1686,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1686
1686
|
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1687
1687
|
if (!this.initialized) return Promise.resolve();
|
|
1688
1688
|
if (!force && !this.disconnectAllowed) return Promise.resolve();
|
|
1689
|
-
var api = sdkCore.isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this.
|
|
1689
|
+
var api = sdkCore.isConfig(this._config) ? (_this$_config$apiOver2 = this._config.apiOverrides) === null || _this$_config$apiOver2 === void 0 ? void 0 : _this$_config$apiOver2[this._chain] : this._config;
|
|
1690
1690
|
// Own client provided, destroy only if force true
|
|
1691
1691
|
if (force && _typeof(api) === 'object') {
|
|
1692
1692
|
this.api.destroy();
|
|
@@ -1696,7 +1696,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1696
1696
|
if (force) {
|
|
1697
1697
|
this.api.destroy();
|
|
1698
1698
|
} else {
|
|
1699
|
-
var key = api === undefined ? sdkCore.
|
|
1699
|
+
var key = api === undefined ? sdkCore.getChainProviders(this._chain) : api;
|
|
1700
1700
|
releasePolkadotClient(key);
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
@@ -1705,9 +1705,9 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1705
1705
|
}]);
|
|
1706
1706
|
}();
|
|
1707
1707
|
|
|
1708
|
-
var
|
|
1708
|
+
var createChainClient = function createChainClient(chain) {
|
|
1709
1709
|
var papiApi = new PapiApi();
|
|
1710
|
-
return sdkCore.
|
|
1710
|
+
return sdkCore.createChainClient(papiApi, chain);
|
|
1711
1711
|
};
|
|
1712
1712
|
var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
1713
1713
|
return /*#__PURE__*/function () {
|
|
@@ -1731,19 +1731,19 @@ var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
|
1731
1731
|
};
|
|
1732
1732
|
|
|
1733
1733
|
/**
|
|
1734
|
-
* Retrieves the native balance for a given account on a specified
|
|
1734
|
+
* Retrieves the native balance for a given account on a specified chain.
|
|
1735
1735
|
*
|
|
1736
1736
|
* @returns The native balance as a bigint.
|
|
1737
1737
|
*/
|
|
1738
1738
|
var getBalanceNative = createPapiApiCall(sdkCore.getBalanceNative);
|
|
1739
1739
|
/**
|
|
1740
|
-
* Retrieves the balance of a foreign asset for a given account on a specified
|
|
1740
|
+
* Retrieves the balance of a foreign asset for a given account on a specified chain.
|
|
1741
1741
|
*
|
|
1742
1742
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
1743
1743
|
*/
|
|
1744
1744
|
var getBalanceForeign = createPapiApiCall(sdkCore.getBalanceForeign);
|
|
1745
1745
|
/**
|
|
1746
|
-
* Retrieves the asset balance for a given account on a specified
|
|
1746
|
+
* Retrieves the asset balance for a given account on a specified chain.
|
|
1747
1747
|
*
|
|
1748
1748
|
* @returns The asset balance as a bigint.
|
|
1749
1749
|
*/
|
|
@@ -1757,7 +1757,7 @@ var claimAssets = createPapiApiCall(sdkCore.claimAssets);
|
|
|
1757
1757
|
/**
|
|
1758
1758
|
* @deprecated This function is deprecated and will be removed in a future version.
|
|
1759
1759
|
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
1760
|
-
* where `builder` is an instance of `Builder()`.
|
|
1760
|
+
* where `builder` is an instance of `Builder()`. Will be removed in v12
|
|
1761
1761
|
* For more details, please refer to the documentation:
|
|
1762
1762
|
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
1763
1763
|
*/
|
|
@@ -1770,7 +1770,7 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1770
1770
|
Native: sdkCore.Native,
|
|
1771
1771
|
Override: sdkCore.Override,
|
|
1772
1772
|
claimAssets: claimAssets,
|
|
1773
|
-
|
|
1773
|
+
findAssetInfo: sdkCore.findAssetInfo,
|
|
1774
1774
|
getAllAssetsSymbols: sdkCore.getAllAssetsSymbols,
|
|
1775
1775
|
getAssetBalance: getAssetBalance,
|
|
1776
1776
|
getAssetDecimals: sdkCore.getAssetDecimals,
|
|
@@ -1786,14 +1786,14 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1786
1786
|
getOtherAssets: sdkCore.getOtherAssets,
|
|
1787
1787
|
getRelayChainSymbol: sdkCore.getRelayChainSymbol,
|
|
1788
1788
|
getSupportedAssets: sdkCore.getSupportedAssets,
|
|
1789
|
-
|
|
1789
|
+
getTChain: sdkCore.getTChain,
|
|
1790
1790
|
hasSupportForAsset: sdkCore.hasSupportForAsset,
|
|
1791
|
-
|
|
1791
|
+
isChainEvm: sdkCore.isChainEvm
|
|
1792
1792
|
});
|
|
1793
1793
|
|
|
1794
|
-
var convertSs58 = function convertSs58(address,
|
|
1794
|
+
var convertSs58 = function convertSs58(address, chain) {
|
|
1795
1795
|
var papiApi = new PapiApi();
|
|
1796
|
-
return sdkCore.convertSs58(papiApi, address,
|
|
1796
|
+
return sdkCore.convertSs58(papiApi, address, chain);
|
|
1797
1797
|
};
|
|
1798
1798
|
|
|
1799
1799
|
/**
|
|
@@ -1806,22 +1806,22 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
return _createClass(EvmBuilderCore, [{
|
|
1808
1808
|
key: "from",
|
|
1809
|
-
value: function from(
|
|
1809
|
+
value: function from(chain) {
|
|
1810
1810
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1811
|
-
from:
|
|
1811
|
+
from: chain
|
|
1812
1812
|
}));
|
|
1813
1813
|
}
|
|
1814
1814
|
/**
|
|
1815
|
-
* Specifies the destination
|
|
1815
|
+
* Specifies the destination chain on Polkadot.
|
|
1816
1816
|
*
|
|
1817
|
-
* @param
|
|
1817
|
+
* @param chain - The Polkadot chain to which the transfer will be made.
|
|
1818
1818
|
* @returns An instance of EvmBuilder
|
|
1819
1819
|
*/
|
|
1820
1820
|
}, {
|
|
1821
1821
|
key: "to",
|
|
1822
|
-
value: function to(
|
|
1822
|
+
value: function to(chain) {
|
|
1823
1823
|
return new EvmBuilderCore(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1824
|
-
to:
|
|
1824
|
+
to: chain
|
|
1825
1825
|
}));
|
|
1826
1826
|
}
|
|
1827
1827
|
/**
|
|
@@ -1930,8 +1930,8 @@ var Builder = function Builder(api) {
|
|
|
1930
1930
|
var papiApi = new PapiApi(api);
|
|
1931
1931
|
return sdkCore.Builder(papiApi);
|
|
1932
1932
|
};
|
|
1933
|
-
var EvmBuilder = function EvmBuilder() {
|
|
1934
|
-
var papiApi = new PapiApi();
|
|
1933
|
+
var EvmBuilder = function EvmBuilder(api) {
|
|
1934
|
+
var papiApi = new PapiApi(api);
|
|
1935
1935
|
return EvmBuilder$1(papiApi);
|
|
1936
1936
|
};
|
|
1937
1937
|
|
|
@@ -2015,7 +2015,7 @@ exports.assets = assets;
|
|
|
2015
2015
|
exports.checkAndConvertToNumberOrBigInt = checkAndConvertToNumberOrBigInt;
|
|
2016
2016
|
exports.claimAssets = claimAssets;
|
|
2017
2017
|
exports.convertSs58 = convertSs58;
|
|
2018
|
-
exports.
|
|
2018
|
+
exports.createChainClient = createChainClient;
|
|
2019
2019
|
exports.dryRun = dryRun;
|
|
2020
2020
|
exports.dryRunOrigin = dryRunOrigin;
|
|
2021
2021
|
exports.getAssetBalance = getAssetBalance;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override,
|
|
2
|
+
import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TGetXcmFeeBaseOptions } from '@paraspell/sdk-core';
|
|
3
3
|
export * from '@paraspell/sdk-core';
|
|
4
|
-
import {
|
|
4
|
+
import { TEvmChainFrom, TBuilderOptions } from '@paraspell/sdk-core/src';
|
|
5
5
|
import * as polkadot_api from 'polkadot-api';
|
|
6
6
|
import { PolkadotClient, UnsafeTransaction } from 'polkadot-api';
|
|
7
7
|
import { WalletClient } from 'viem';
|
|
@@ -9,10 +9,10 @@ import { WalletClient } from 'viem';
|
|
|
9
9
|
type TPapiApi = PolkadotClient;
|
|
10
10
|
type TPapiApiOrUrl = TApiOrUrl<PolkadotClient>;
|
|
11
11
|
type TPapiTransaction = UnsafeTransaction<any, string, string, any>;
|
|
12
|
-
type
|
|
12
|
+
type TEvmChainFromPapi = Extract<TEvmChainFrom, 'Moonbeam' | 'Moonriver' | 'Darwinia'>;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Retrieves the native balance for a given account on a specified
|
|
15
|
+
* Retrieves the native balance for a given account on a specified chain.
|
|
16
16
|
*
|
|
17
17
|
* @returns The native balance as a bigint.
|
|
18
18
|
*/
|
|
@@ -20,7 +20,7 @@ declare const getBalanceNative: (options: _paraspell_sdk_core.TGetBalanceNativeO
|
|
|
20
20
|
api?: TPapiApiOrUrl;
|
|
21
21
|
}) => Promise<bigint>;
|
|
22
22
|
/**
|
|
23
|
-
* Retrieves the balance of a foreign asset for a given account on a specified
|
|
23
|
+
* Retrieves the balance of a foreign asset for a given account on a specified chain.
|
|
24
24
|
*
|
|
25
25
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
26
26
|
*/
|
|
@@ -28,7 +28,7 @@ declare const getBalanceForeign: (options: _paraspell_sdk_core.TGetBalanceForeig
|
|
|
28
28
|
api?: TPapiApiOrUrl;
|
|
29
29
|
}) => Promise<bigint>;
|
|
30
30
|
/**
|
|
31
|
-
* Retrieves the asset balance for a given account on a specified
|
|
31
|
+
* Retrieves the asset balance for a given account on a specified chain.
|
|
32
32
|
*
|
|
33
33
|
* @returns The asset balance as a bigint.
|
|
34
34
|
*/
|
|
@@ -46,7 +46,7 @@ declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase
|
|
|
46
46
|
/**
|
|
47
47
|
* @deprecated This function is deprecated and will be removed in a future version.
|
|
48
48
|
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
49
|
-
* where `builder` is an instance of `Builder()`.
|
|
49
|
+
* where `builder` is an instance of `Builder()`. Will be removed in v12
|
|
50
50
|
* For more details, please refer to the documentation:
|
|
51
51
|
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
52
52
|
*/
|
|
@@ -59,7 +59,7 @@ declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
|
59
59
|
declare const assets_Native: typeof Native;
|
|
60
60
|
declare const assets_Override: typeof Override;
|
|
61
61
|
declare const assets_claimAssets: typeof claimAssets;
|
|
62
|
-
declare const
|
|
62
|
+
declare const assets_findAssetInfo: typeof findAssetInfo;
|
|
63
63
|
declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
|
|
64
64
|
declare const assets_getAssetBalance: typeof getAssetBalance;
|
|
65
65
|
declare const assets_getAssetDecimals: typeof getAssetDecimals;
|
|
@@ -75,9 +75,9 @@ declare const assets_getOriginFeeDetails: typeof getOriginFeeDetails;
|
|
|
75
75
|
declare const assets_getOtherAssets: typeof getOtherAssets;
|
|
76
76
|
declare const assets_getRelayChainSymbol: typeof getRelayChainSymbol;
|
|
77
77
|
declare const assets_getSupportedAssets: typeof getSupportedAssets;
|
|
78
|
-
declare const
|
|
78
|
+
declare const assets_getTChain: typeof getTChain;
|
|
79
79
|
declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
|
|
80
|
-
declare const
|
|
80
|
+
declare const assets_isChainEvm: typeof isChainEvm;
|
|
81
81
|
declare namespace assets {
|
|
82
82
|
export {
|
|
83
83
|
assets_Foreign as Foreign,
|
|
@@ -85,7 +85,7 @@ declare namespace assets {
|
|
|
85
85
|
assets_Native as Native,
|
|
86
86
|
assets_Override as Override,
|
|
87
87
|
assets_claimAssets as claimAssets,
|
|
88
|
-
|
|
88
|
+
assets_findAssetInfo as findAssetInfo,
|
|
89
89
|
assets_getAllAssetsSymbols as getAllAssetsSymbols,
|
|
90
90
|
assets_getAssetBalance as getAssetBalance,
|
|
91
91
|
assets_getAssetDecimals as getAssetDecimals,
|
|
@@ -101,13 +101,13 @@ declare namespace assets {
|
|
|
101
101
|
assets_getOtherAssets as getOtherAssets,
|
|
102
102
|
assets_getRelayChainSymbol as getRelayChainSymbol,
|
|
103
103
|
assets_getSupportedAssets as getSupportedAssets,
|
|
104
|
-
|
|
104
|
+
assets_getTChain as getTChain,
|
|
105
105
|
assets_hasSupportForAsset as hasSupportForAsset,
|
|
106
|
-
|
|
106
|
+
assets_isChainEvm as isChainEvm,
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
declare const convertSs58: (address: string,
|
|
110
|
+
declare const convertSs58: (address: string, chain: TSubstrateChain) => string;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* Builder class for constructing transfers from Ethereum to Polkadot.
|
|
@@ -115,17 +115,17 @@ declare const convertSs58: (address: string, node: TNodeDotKsmWithRelayChains) =
|
|
|
115
115
|
declare class EvmBuilderCore<TApi, TRes, T extends Partial<TEvmBuilderOptions<TApi, TRes>> = object> {
|
|
116
116
|
protected readonly _options: T;
|
|
117
117
|
constructor(options: T);
|
|
118
|
-
from(
|
|
119
|
-
from:
|
|
118
|
+
from(chain: TEvmChainFromPapi): EvmBuilderCore<TApi, TRes, T & {
|
|
119
|
+
from: TEvmChainFromPapi;
|
|
120
120
|
}>;
|
|
121
121
|
/**
|
|
122
|
-
* Specifies the destination
|
|
122
|
+
* Specifies the destination chain on Polkadot.
|
|
123
123
|
*
|
|
124
|
-
* @param
|
|
124
|
+
* @param chain - The Polkadot chain to which the transfer will be made.
|
|
125
125
|
* @returns An instance of EvmBuilder
|
|
126
126
|
*/
|
|
127
|
-
to(
|
|
128
|
-
to:
|
|
127
|
+
to(chain: TChain): EvmBuilderCore<TApi, TRes, T & {
|
|
128
|
+
to: TChain;
|
|
129
129
|
}>;
|
|
130
130
|
/**
|
|
131
131
|
* Specifies the currency to transfer.
|
|
@@ -179,7 +179,7 @@ declare class EvmBuilderCore<TApi, TRes, T extends Partial<TEvmBuilderOptions<TA
|
|
|
179
179
|
*/
|
|
180
180
|
declare const Builder: (api?: TBuilderOptions<TPapiApiOrUrl>) => GeneralBuilder$1<PolkadotClient, TPapiTransaction, object>;
|
|
181
181
|
type GeneralBuilder<T extends Partial<TSendBaseOptions> = object> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, T>;
|
|
182
|
-
declare const EvmBuilder: () => EvmBuilderCore<unknown, unknown, {
|
|
182
|
+
declare const EvmBuilder: (api?: TBuilderOptions<TPapiApiOrUrl>) => EvmBuilderCore<unknown, unknown, {
|
|
183
183
|
api: _paraspell_sdk_core.IPolkadotApi<PolkadotClient, TPapiTransaction>;
|
|
184
184
|
}>;
|
|
185
185
|
|
|
@@ -196,7 +196,7 @@ declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<TPapiTran
|
|
|
196
196
|
}) => Promise<_paraspell_sdk_core.TDryRunResult>;
|
|
197
197
|
declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<TPapiTransaction> & {
|
|
198
198
|
api?: TPapiApiOrUrl;
|
|
199
|
-
}) => Promise<_paraspell_sdk_core.
|
|
199
|
+
}) => Promise<_paraspell_sdk_core.TDryRunChainResult>;
|
|
200
200
|
declare const getParaEthTransferFees: (ahApi?: TPapiApiOrUrl) => Promise<[bigint, bigint]>;
|
|
201
201
|
/**
|
|
202
202
|
* Gets the Ethereum bridge status.
|
|
@@ -234,10 +234,10 @@ declare namespace transfer {
|
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
declare const
|
|
237
|
+
declare const createChainClient: (chain: TSubstrateChain) => Promise<polkadot_api.PolkadotClient>;
|
|
238
238
|
|
|
239
239
|
declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
|
|
240
240
|
declare const transform: (obj: any) => any;
|
|
241
241
|
|
|
242
|
-
export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58,
|
|
243
|
-
export type { GeneralBuilder,
|
|
242
|
+
export { Builder, EvmBuilder, assets, checkAndConvertToNumberOrBigInt, claimAssets, convertSs58, createChainClient, dryRun, dryRunOrigin, getAssetBalance, getBalanceForeign, getBalanceNative, getBridgeStatus, getOriginFeeDetails, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, send, transform, transfer as xcmPallet };
|
|
243
|
+
export type { GeneralBuilder, TEvmChainFromPapi, TPapiApi, TPapiApiOrUrl, TPapiTransaction };
|