@paraspell/sdk 11.9.2 → 11.10.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 +25 -16
- package/dist/index.d.ts +4 -6
- package/dist/index.mjs +26 -17
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -838,6 +838,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
838
838
|
key: "resolveApi",
|
|
839
839
|
value: function () {
|
|
840
840
|
var _resolveApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(apiConfig, chain) {
|
|
841
|
+
var wsUrl;
|
|
841
842
|
return _regenerator().w(function (_context2) {
|
|
842
843
|
while (1) switch (_context2.n) {
|
|
843
844
|
case 0:
|
|
@@ -845,7 +846,8 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
845
846
|
_context2.n = 1;
|
|
846
847
|
break;
|
|
847
848
|
}
|
|
848
|
-
|
|
849
|
+
wsUrl = sdkCore.getChainProviders(chain);
|
|
850
|
+
return _context2.a(2, this.createApiInstance(wsUrl, chain));
|
|
849
851
|
case 1:
|
|
850
852
|
if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
|
|
851
853
|
_context2.n = 2;
|
|
@@ -1374,7 +1376,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1374
1376
|
value: function () {
|
|
1375
1377
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(options) {
|
|
1376
1378
|
var _this = this;
|
|
1377
|
-
var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedAsset, usedSymbol, actualWeight, weight, forwardedXcms, destParaId,
|
|
1379
|
+
var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedAsset, usedSymbol, actualWeight, weight, forwardedXcms, destParaId, nativeAsset, hasLocation, xcmFee, executionFee, fee, _t2;
|
|
1378
1380
|
return _regenerator().w(function (_context17) {
|
|
1379
1381
|
while (1) switch (_context17.n) {
|
|
1380
1382
|
case 0:
|
|
@@ -1503,22 +1505,18 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1503
1505
|
} : undefined;
|
|
1504
1506
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1505
1507
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1506
|
-
_context17.n = 9;
|
|
1507
|
-
return this.calculateTransactionFee(tx, address);
|
|
1508
|
-
case 9:
|
|
1509
|
-
executionFee = _context17.v;
|
|
1510
1508
|
nativeAsset = sdkCore.findNativeAssetInfoOrThrow(chain);
|
|
1511
1509
|
hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
|
|
1512
1510
|
if (!(sdkCore.hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum'))) {
|
|
1513
|
-
_context17.n =
|
|
1511
|
+
_context17.n = 10;
|
|
1514
1512
|
break;
|
|
1515
1513
|
}
|
|
1516
|
-
_context17.n =
|
|
1514
|
+
_context17.n = 9;
|
|
1517
1515
|
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, forwardedXcms, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
|
|
1518
|
-
case
|
|
1516
|
+
case 9:
|
|
1519
1517
|
xcmFee = _context17.v;
|
|
1520
1518
|
if (!(typeof xcmFee === 'bigint')) {
|
|
1521
|
-
_context17.n =
|
|
1519
|
+
_context17.n = 10;
|
|
1522
1520
|
break;
|
|
1523
1521
|
}
|
|
1524
1522
|
return _context17.a(2, Promise.resolve({
|
|
@@ -1530,7 +1528,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1530
1528
|
forwardedXcms: forwardedXcms,
|
|
1531
1529
|
destParaId: destParaId
|
|
1532
1530
|
}));
|
|
1531
|
+
case 10:
|
|
1532
|
+
_context17.n = 11;
|
|
1533
|
+
return this.calculateTransactionFee(tx, address);
|
|
1533
1534
|
case 11:
|
|
1535
|
+
executionFee = _context17.v;
|
|
1534
1536
|
fee = sdkCore.computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1535
1537
|
return _context17.a(2, Promise.resolve({
|
|
1536
1538
|
success: true,
|
|
@@ -1881,8 +1883,8 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1881
1883
|
}]);
|
|
1882
1884
|
}();
|
|
1883
1885
|
|
|
1884
|
-
var createChainClient = function createChainClient(chain) {
|
|
1885
|
-
var papiApi = new PapiApi();
|
|
1886
|
+
var createChainClient = function createChainClient(chain, api) {
|
|
1887
|
+
var papiApi = new PapiApi(api);
|
|
1886
1888
|
return sdkCore.createChainClient(papiApi, chain);
|
|
1887
1889
|
};
|
|
1888
1890
|
var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
@@ -2163,21 +2165,28 @@ var getBridgeStatus = /*#__PURE__*/function () {
|
|
|
2163
2165
|
}();
|
|
2164
2166
|
var getOriginXcmFee = createPapiApiCall(sdkCore.getOriginXcmFee);
|
|
2165
2167
|
var getXcmFee = /*#__PURE__*/function () {
|
|
2166
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
2168
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options, builderOptions) {
|
|
2169
|
+
var api;
|
|
2167
2170
|
return _regenerator().w(function (_context3) {
|
|
2168
2171
|
while (1) switch (_context3.n) {
|
|
2169
2172
|
case 0:
|
|
2173
|
+
api = new PapiApi(builderOptions);
|
|
2170
2174
|
return _context3.a(2, sdkCore.getXcmFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
2171
|
-
api:
|
|
2175
|
+
api: api
|
|
2172
2176
|
})));
|
|
2173
2177
|
}
|
|
2174
2178
|
}, _callee3);
|
|
2175
2179
|
}));
|
|
2176
|
-
return function getXcmFee(_x3) {
|
|
2180
|
+
return function getXcmFee(_x3, _x4) {
|
|
2177
2181
|
return _ref3.apply(this, arguments);
|
|
2178
2182
|
};
|
|
2179
2183
|
}();
|
|
2180
|
-
var handleSwapExecuteTransfer =
|
|
2184
|
+
var handleSwapExecuteTransfer = function handleSwapExecuteTransfer(options, builderOptions) {
|
|
2185
|
+
var api = new PapiApi(builderOptions);
|
|
2186
|
+
return sdkCore.handleSwapExecuteTransfer(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
2187
|
+
api: api
|
|
2188
|
+
}));
|
|
2189
|
+
};
|
|
2181
2190
|
|
|
2182
2191
|
var transfer = /*#__PURE__*/Object.freeze({
|
|
2183
2192
|
__proto__: null,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import { TApiOrUrl, TEvmChainFrom, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, TBuilderOptions, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TGetXcmFeeBaseOptions } from '@paraspell/sdk-core';
|
|
2
|
+
import { TApiOrUrl, TEvmChainFrom, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TEvmBuilderOptions, TChain, TCurrencyInputWithAmount, TBuilderOptions, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } from '@paraspell/sdk-core';
|
|
3
3
|
export * from '@paraspell/sdk-core';
|
|
4
4
|
import * as polkadot_api from 'polkadot-api';
|
|
5
5
|
import { PolkadotClient, UnsafeTransaction } from 'polkadot-api';
|
|
@@ -211,10 +211,8 @@ declare const getOriginXcmFee: (options: _paraspell_sdk_core.TGetOriginXcmFeeBas
|
|
|
211
211
|
forwardedXcms?: unknown;
|
|
212
212
|
destParaId?: number;
|
|
213
213
|
}>;
|
|
214
|
-
declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback>>;
|
|
215
|
-
declare const handleSwapExecuteTransfer: (options:
|
|
216
|
-
api?: TPapiApiOrUrl;
|
|
217
|
-
}) => Promise<TPapiTransaction>;
|
|
214
|
+
declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>, builderOptions?: TBuilderOptions<TPapiApiOrUrl>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback>>;
|
|
215
|
+
declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TPapiApiOrUrl>) => Promise<TPapiTransaction>;
|
|
218
216
|
|
|
219
217
|
declare const transfer_dryRun: typeof dryRun;
|
|
220
218
|
declare const transfer_dryRunOrigin: typeof dryRunOrigin;
|
|
@@ -237,7 +235,7 @@ declare namespace transfer {
|
|
|
237
235
|
};
|
|
238
236
|
}
|
|
239
237
|
|
|
240
|
-
declare const createChainClient: (chain: TSubstrateChain) => Promise<polkadot_api.PolkadotClient>;
|
|
238
|
+
declare const createChainClient: (chain: TSubstrateChain, api?: TBuilderOptions<TPapiApiOrUrl>) => Promise<polkadot_api.PolkadotClient>;
|
|
241
239
|
|
|
242
240
|
declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
|
|
243
241
|
declare const transform: (obj: any) => any;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError,
|
|
1
|
+
import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError, Parents, Version, assertHasId, assertHasLocation, getChain, isForeignAsset, computeFeeFromDryRun, findNativeAssetInfoOrThrow, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, ChainNotSupportedError, wrapTxBypass, localizeLocation, isAssetXcEqual, padFeeBy, isRelayChain, isAssetEqual, createChainClient as createChainClient$1, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$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 } 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';
|
|
@@ -837,6 +837,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
837
837
|
key: "resolveApi",
|
|
838
838
|
value: function () {
|
|
839
839
|
var _resolveApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(apiConfig, chain) {
|
|
840
|
+
var wsUrl;
|
|
840
841
|
return _regenerator().w(function (_context2) {
|
|
841
842
|
while (1) switch (_context2.n) {
|
|
842
843
|
case 0:
|
|
@@ -844,7 +845,8 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
844
845
|
_context2.n = 1;
|
|
845
846
|
break;
|
|
846
847
|
}
|
|
847
|
-
|
|
848
|
+
wsUrl = getChainProviders(chain);
|
|
849
|
+
return _context2.a(2, this.createApiInstance(wsUrl, chain));
|
|
848
850
|
case 1:
|
|
849
851
|
if (!(typeof apiConfig === 'string' || apiConfig instanceof Array)) {
|
|
850
852
|
_context2.n = 2;
|
|
@@ -1373,7 +1375,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1373
1375
|
value: function () {
|
|
1374
1376
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(options) {
|
|
1375
1377
|
var _this = this;
|
|
1376
|
-
var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedAsset, usedSymbol, actualWeight, weight, forwardedXcms, destParaId,
|
|
1378
|
+
var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedAsset, usedSymbol, actualWeight, weight, forwardedXcms, destParaId, nativeAsset, hasLocation, xcmFee, executionFee, fee, _t2;
|
|
1377
1379
|
return _regenerator().w(function (_context17) {
|
|
1378
1380
|
while (1) switch (_context17.n) {
|
|
1379
1381
|
case 0:
|
|
@@ -1502,22 +1504,18 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1502
1504
|
} : undefined;
|
|
1503
1505
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1504
1506
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1505
|
-
_context17.n = 9;
|
|
1506
|
-
return this.calculateTransactionFee(tx, address);
|
|
1507
|
-
case 9:
|
|
1508
|
-
executionFee = _context17.v;
|
|
1509
1507
|
nativeAsset = findNativeAssetInfoOrThrow(chain);
|
|
1510
1508
|
hasLocation = feeAsset ? Boolean(feeAsset.location) : Boolean(nativeAsset === null || nativeAsset === void 0 ? void 0 : nativeAsset.location);
|
|
1511
1509
|
if (!(hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum'))) {
|
|
1512
|
-
_context17.n =
|
|
1510
|
+
_context17.n = 10;
|
|
1513
1511
|
break;
|
|
1514
1512
|
}
|
|
1515
|
-
_context17.n =
|
|
1513
|
+
_context17.n = 9;
|
|
1516
1514
|
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, forwardedXcms, feeAsset !== null && feeAsset !== void 0 ? feeAsset : nativeAsset);
|
|
1517
|
-
case
|
|
1515
|
+
case 9:
|
|
1518
1516
|
xcmFee = _context17.v;
|
|
1519
1517
|
if (!(typeof xcmFee === 'bigint')) {
|
|
1520
|
-
_context17.n =
|
|
1518
|
+
_context17.n = 10;
|
|
1521
1519
|
break;
|
|
1522
1520
|
}
|
|
1523
1521
|
return _context17.a(2, Promise.resolve({
|
|
@@ -1529,7 +1527,11 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1529
1527
|
forwardedXcms: forwardedXcms,
|
|
1530
1528
|
destParaId: destParaId
|
|
1531
1529
|
}));
|
|
1530
|
+
case 10:
|
|
1531
|
+
_context17.n = 11;
|
|
1532
|
+
return this.calculateTransactionFee(tx, address);
|
|
1532
1533
|
case 11:
|
|
1534
|
+
executionFee = _context17.v;
|
|
1533
1535
|
fee = computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1534
1536
|
return _context17.a(2, Promise.resolve({
|
|
1535
1537
|
success: true,
|
|
@@ -1880,8 +1882,8 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1880
1882
|
}]);
|
|
1881
1883
|
}();
|
|
1882
1884
|
|
|
1883
|
-
var createChainClient = function createChainClient(chain) {
|
|
1884
|
-
var papiApi = new PapiApi();
|
|
1885
|
+
var createChainClient = function createChainClient(chain, api) {
|
|
1886
|
+
var papiApi = new PapiApi(api);
|
|
1885
1887
|
return createChainClient$1(papiApi, chain);
|
|
1886
1888
|
};
|
|
1887
1889
|
var createPapiApiCall = function createPapiApiCall(apiCall) {
|
|
@@ -2162,21 +2164,28 @@ var getBridgeStatus = /*#__PURE__*/function () {
|
|
|
2162
2164
|
}();
|
|
2163
2165
|
var getOriginXcmFee = createPapiApiCall(getOriginXcmFee$1);
|
|
2164
2166
|
var getXcmFee = /*#__PURE__*/function () {
|
|
2165
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
2167
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options, builderOptions) {
|
|
2168
|
+
var api;
|
|
2166
2169
|
return _regenerator().w(function (_context3) {
|
|
2167
2170
|
while (1) switch (_context3.n) {
|
|
2168
2171
|
case 0:
|
|
2172
|
+
api = new PapiApi(builderOptions);
|
|
2169
2173
|
return _context3.a(2, getXcmFee$1(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
2170
|
-
api:
|
|
2174
|
+
api: api
|
|
2171
2175
|
})));
|
|
2172
2176
|
}
|
|
2173
2177
|
}, _callee3);
|
|
2174
2178
|
}));
|
|
2175
|
-
return function getXcmFee(_x3) {
|
|
2179
|
+
return function getXcmFee(_x3, _x4) {
|
|
2176
2180
|
return _ref3.apply(this, arguments);
|
|
2177
2181
|
};
|
|
2178
2182
|
}();
|
|
2179
|
-
var handleSwapExecuteTransfer =
|
|
2183
|
+
var handleSwapExecuteTransfer = function handleSwapExecuteTransfer(options, builderOptions) {
|
|
2184
|
+
var api = new PapiApi(builderOptions);
|
|
2185
|
+
return handleSwapExecuteTransfer$1(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
2186
|
+
api: api
|
|
2187
|
+
}));
|
|
2188
|
+
};
|
|
2180
2189
|
|
|
2181
2190
|
var transfer = /*#__PURE__*/Object.freeze({
|
|
2182
2191
|
__proto__: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.10.0",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@noble/hashes": "^1.8.0",
|
|
27
27
|
"@polkadot-api/legacy-provider": "^0.3.3",
|
|
28
28
|
"viem": "^2.37.9",
|
|
29
|
-
"@paraspell/sdk-core": "11.
|
|
29
|
+
"@paraspell/sdk-core": "11.10.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"polkadot-api": ">= 1.20.0 < 2"
|