@paraspell/sdk-core 8.2.2 → 8.3.1
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 +82 -25
- package/dist/index.d.ts +27 -3
- package/dist/index.mjs +76 -26
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,9 @@ function _arrayLikeToArray(r, a) {
|
|
|
8
8
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
9
9
|
return n;
|
|
10
10
|
}
|
|
11
|
+
function _arrayWithHoles(r) {
|
|
12
|
+
if (Array.isArray(r)) return r;
|
|
13
|
+
}
|
|
11
14
|
function _arrayWithoutHoles(r) {
|
|
12
15
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
13
16
|
}
|
|
@@ -164,6 +167,33 @@ function _isNativeReflectConstruct() {
|
|
|
164
167
|
function _iterableToArray(r) {
|
|
165
168
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
166
169
|
}
|
|
170
|
+
function _iterableToArrayLimit(r, l) {
|
|
171
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
172
|
+
if (null != t) {
|
|
173
|
+
var e,
|
|
174
|
+
n,
|
|
175
|
+
i,
|
|
176
|
+
u,
|
|
177
|
+
a = [],
|
|
178
|
+
f = true,
|
|
179
|
+
o = false;
|
|
180
|
+
try {
|
|
181
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
182
|
+
} catch (r) {
|
|
183
|
+
o = true, n = r;
|
|
184
|
+
} finally {
|
|
185
|
+
try {
|
|
186
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
187
|
+
} finally {
|
|
188
|
+
if (o) throw n;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return a;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function _nonIterableRest() {
|
|
195
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
196
|
+
}
|
|
167
197
|
function _nonIterableSpread() {
|
|
168
198
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
169
199
|
}
|
|
@@ -499,6 +529,9 @@ function _setPrototypeOf(t, e) {
|
|
|
499
529
|
return t.__proto__ = e, t;
|
|
500
530
|
}, _setPrototypeOf(t, e);
|
|
501
531
|
}
|
|
532
|
+
function _slicedToArray(r, e) {
|
|
533
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
534
|
+
}
|
|
502
535
|
function _superPropBase(t, o) {
|
|
503
536
|
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););
|
|
504
537
|
return t;
|
|
@@ -11811,6 +11844,10 @@ var isForeignAsset = function isForeignAsset(asset) {
|
|
|
11811
11844
|
return _typeof(asset) === 'object' && asset !== null && ('assetId' in asset || 'multiLocation' in asset || 'xcmInterior' in asset);
|
|
11812
11845
|
};
|
|
11813
11846
|
|
|
11847
|
+
var isSymbolSpecifier = function isSymbolSpecifier(currencySymbolValue) {
|
|
11848
|
+
return _typeof(currencySymbolValue) === 'object' && 'type' in currencySymbolValue && 'value' in currencySymbolValue;
|
|
11849
|
+
};
|
|
11850
|
+
|
|
11814
11851
|
/**
|
|
11815
11852
|
* Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
|
|
11816
11853
|
*/
|
|
@@ -16214,10 +16251,6 @@ var isOverrideMultiLocationSpecifier = function isOverrideMultiLocationSpecifier
|
|
|
16214
16251
|
return _typeof(multiLocationSpecifier) === 'object' && 'type' in multiLocationSpecifier && 'value' in multiLocationSpecifier;
|
|
16215
16252
|
};
|
|
16216
16253
|
|
|
16217
|
-
var isSymbolSpecifier = function isSymbolSpecifier(currencySymbolValue) {
|
|
16218
|
-
return _typeof(currencySymbolValue) === 'object' && 'type' in currencySymbolValue && 'value' in currencySymbolValue;
|
|
16219
|
-
};
|
|
16220
|
-
|
|
16221
16254
|
// Contains function for getting Asset ID or Symbol used in XCM call creation
|
|
16222
16255
|
var throwDuplicateAssetError = function throwDuplicateAssetError(symbol, nativeMatches, foreignMatches) {
|
|
16223
16256
|
if (nativeMatches.length > 0 && foreignMatches.length > 0) {
|
|
@@ -16488,6 +16521,29 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency, destina
|
|
|
16488
16521
|
return null;
|
|
16489
16522
|
};
|
|
16490
16523
|
|
|
16524
|
+
var getAssetMultiLocation = function getAssetMultiLocation(node, currency) {
|
|
16525
|
+
var asset = getAssetBySymbolOrId(node, currency, null);
|
|
16526
|
+
if (!asset || !isForeignAsset(asset)) {
|
|
16527
|
+
return null;
|
|
16528
|
+
}
|
|
16529
|
+
if (asset.multiLocation) {
|
|
16530
|
+
return asset.multiLocation;
|
|
16531
|
+
}
|
|
16532
|
+
if (asset.xcmInterior) {
|
|
16533
|
+
var _asset$xcmInterior$sl = asset.xcmInterior.slice(-2),
|
|
16534
|
+
_asset$xcmInterior$sl2 = _slicedToArray(_asset$xcmInterior$sl, 2),
|
|
16535
|
+
secondLast = _asset$xcmInterior$sl2[0],
|
|
16536
|
+
last = _asset$xcmInterior$sl2[1];
|
|
16537
|
+
return {
|
|
16538
|
+
parents: exports.Parents.ZERO,
|
|
16539
|
+
interior: {
|
|
16540
|
+
X2: [secondLast, last]
|
|
16541
|
+
}
|
|
16542
|
+
};
|
|
16543
|
+
}
|
|
16544
|
+
return null;
|
|
16545
|
+
};
|
|
16546
|
+
|
|
16491
16547
|
/**
|
|
16492
16548
|
* Retrieves the existential deposit value for a given node.
|
|
16493
16549
|
*
|
|
@@ -18341,16 +18397,16 @@ var Builder = function Builder(api) {
|
|
|
18341
18397
|
var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
|
|
18342
18398
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
18343
18399
|
var _getExistentialDeposi;
|
|
18344
|
-
var api, account, accountDestination, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
18400
|
+
var api, account, accountDestination, ahAccount, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
18345
18401
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
18346
18402
|
while (1) switch (_context.prev = _context.next) {
|
|
18347
18403
|
case 0:
|
|
18348
|
-
api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === undefined ? 10 : _ref$feeMarginPercent;
|
|
18404
|
+
api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, ahAccount = _ref.ahAccount, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === undefined ? 10 : _ref$feeMarginPercent;
|
|
18349
18405
|
_context.next = 3;
|
|
18350
18406
|
return api.init(origin);
|
|
18351
18407
|
case 3:
|
|
18352
18408
|
_context.next = 5;
|
|
18353
|
-
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).build();
|
|
18409
|
+
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination, ahAccount).build();
|
|
18354
18410
|
case 5:
|
|
18355
18411
|
tx = _context.sent;
|
|
18356
18412
|
_context.next = 8;
|
|
@@ -19298,31 +19354,25 @@ var getDryRun = /*#__PURE__*/function () {
|
|
|
19298
19354
|
while (1) switch (_context.prev = _context.next) {
|
|
19299
19355
|
case 0:
|
|
19300
19356
|
api = options.api, node = options.node;
|
|
19301
|
-
|
|
19302
|
-
_context.next = 3;
|
|
19303
|
-
break;
|
|
19304
|
-
}
|
|
19305
|
-
throw new Error('Kusama is temporarily disable due to unknown error in DryRun.');
|
|
19306
|
-
case 3:
|
|
19307
|
-
_context.next = 5;
|
|
19357
|
+
_context.next = 3;
|
|
19308
19358
|
return api.init(node);
|
|
19309
|
-
case
|
|
19310
|
-
_context.prev =
|
|
19311
|
-
_context.next =
|
|
19359
|
+
case 3:
|
|
19360
|
+
_context.prev = 3;
|
|
19361
|
+
_context.next = 6;
|
|
19312
19362
|
return api.getDryRun(options);
|
|
19313
|
-
case
|
|
19363
|
+
case 6:
|
|
19314
19364
|
return _context.abrupt("return", _context.sent);
|
|
19315
|
-
case
|
|
19316
|
-
_context.prev =
|
|
19317
|
-
_context.next =
|
|
19365
|
+
case 7:
|
|
19366
|
+
_context.prev = 7;
|
|
19367
|
+
_context.next = 10;
|
|
19318
19368
|
return api.disconnect();
|
|
19319
|
-
case
|
|
19320
|
-
return _context.finish(
|
|
19321
|
-
case
|
|
19369
|
+
case 10:
|
|
19370
|
+
return _context.finish(7);
|
|
19371
|
+
case 11:
|
|
19322
19372
|
case "end":
|
|
19323
19373
|
return _context.stop();
|
|
19324
19374
|
}
|
|
19325
|
-
}, _callee, null, [[
|
|
19375
|
+
}, _callee, null, [[3,, 7, 11]]);
|
|
19326
19376
|
}));
|
|
19327
19377
|
return function getDryRun(_x) {
|
|
19328
19378
|
return _ref.apply(this, arguments);
|
|
@@ -19587,6 +19637,10 @@ exports.createApiInstanceForNode = createApiInstanceForNode;
|
|
|
19587
19637
|
exports.createX1Payload = createX1Payload;
|
|
19588
19638
|
exports.deepEqual = _deepEqual;
|
|
19589
19639
|
exports.determineRelayChain = determineRelayChain;
|
|
19640
|
+
exports.findAssetById = findAssetById;
|
|
19641
|
+
exports.findAssetByMultiLocation = findAssetByMultiLocation;
|
|
19642
|
+
exports.findAssetBySymbol = findAssetBySymbol;
|
|
19643
|
+
exports.findBestMatches = findBestMatches;
|
|
19590
19644
|
exports.generateAddressMultiLocationV4 = generateAddressMultiLocationV4;
|
|
19591
19645
|
exports.generateAddressPayload = generateAddressPayload;
|
|
19592
19646
|
exports.getAllAssetsSymbols = getAllAssetsSymbols;
|
|
@@ -19595,6 +19649,7 @@ exports.getAssetBalanceInternal = getAssetBalanceInternal;
|
|
|
19595
19649
|
exports.getAssetBySymbolOrId = getAssetBySymbolOrId;
|
|
19596
19650
|
exports.getAssetDecimals = getAssetDecimals;
|
|
19597
19651
|
exports.getAssetId = getAssetId;
|
|
19652
|
+
exports.getAssetMultiLocation = getAssetMultiLocation;
|
|
19598
19653
|
exports.getAssets = getAssets;
|
|
19599
19654
|
exports.getAssetsObject = getAssetsObject;
|
|
19600
19655
|
exports.getBalanceForeign = getBalanceForeign;
|
|
@@ -19628,6 +19683,8 @@ exports.isForeignAsset = isForeignAsset;
|
|
|
19628
19683
|
exports.isNodeEvm = isNodeEvm;
|
|
19629
19684
|
exports.isOverrideMultiLocationSpecifier = isOverrideMultiLocationSpecifier;
|
|
19630
19685
|
exports.isRelayChain = isRelayChain;
|
|
19686
|
+
exports.isSymbolSpecifier = isSymbolSpecifier;
|
|
19687
|
+
exports.normalizeSymbol = normalizeSymbol;
|
|
19631
19688
|
exports.resolveModuleError = resolveModuleError;
|
|
19632
19689
|
exports.resolveParaId = resolveParaId;
|
|
19633
19690
|
exports.send = send;
|
package/dist/index.d.ts
CHANGED
|
@@ -1213,7 +1213,7 @@ type TGetOriginFeeDetailsOptionsBase = {
|
|
|
1213
1213
|
/**
|
|
1214
1214
|
* The destination node.
|
|
1215
1215
|
*/
|
|
1216
|
-
destination:
|
|
1216
|
+
destination: TNodeWithRelayChains;
|
|
1217
1217
|
/**
|
|
1218
1218
|
* The currency to transfer.
|
|
1219
1219
|
*/
|
|
@@ -1226,6 +1226,10 @@ type TGetOriginFeeDetailsOptionsBase = {
|
|
|
1226
1226
|
* The destination account.
|
|
1227
1227
|
*/
|
|
1228
1228
|
accountDestination: string;
|
|
1229
|
+
/**
|
|
1230
|
+
* The AssetHub address
|
|
1231
|
+
*/
|
|
1232
|
+
ahAccount?: string;
|
|
1229
1233
|
/**
|
|
1230
1234
|
* The fee margin percentage.
|
|
1231
1235
|
*/
|
|
@@ -1317,6 +1321,8 @@ declare const getDryRun: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>) => Pr
|
|
|
1317
1321
|
|
|
1318
1322
|
declare const transferMoonbeamEvm: <TApi, TRes>({ api, from, to, signer, address, currency }: TEvmBuilderOptions<TApi, TRes>) => Promise<string>;
|
|
1319
1323
|
|
|
1324
|
+
declare const getAssetMultiLocation: (node: TNodeWithRelayChains, currency: TCurrencyInput) => TMultiLocation | null;
|
|
1325
|
+
|
|
1320
1326
|
/**
|
|
1321
1327
|
* Retrieves the existential deposit value for a given node.
|
|
1322
1328
|
*
|
|
@@ -1416,7 +1422,7 @@ declare const getBalanceNative: <TApi, TRes>(options: TGetBalanceNativeOptions<T
|
|
|
1416
1422
|
declare const getBalanceForeignInternal: <TApi, TRes>({ address, node, currency, api }: TGetBalanceForeignOptions<TApi, TRes>) => Promise<bigint>;
|
|
1417
1423
|
declare const getBalanceForeign: <TApi, TRes>(options: TGetBalanceForeignOptions<TApi, TRes>) => Promise<bigint>;
|
|
1418
1424
|
|
|
1419
|
-
declare const getOriginFeeDetailsInternal: <TApi, TRes>({ api, account, accountDestination, currency, origin, destination, feeMarginPercentage }: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
|
|
1425
|
+
declare const getOriginFeeDetailsInternal: <TApi, TRes>({ api, account, accountDestination, ahAccount, currency, origin, destination, feeMarginPercentage }: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
|
|
1420
1426
|
declare const getOriginFeeDetails: <TApi, TRes>(options: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
|
|
1421
1427
|
|
|
1422
1428
|
declare const getTransferInfo: <TApi, TRes>({ origin, destination, accountOrigin, accountDestination, currency, api }: TGetTransferInfoOptions<TApi, TRes>) => Promise<TTransferInfo>;
|
|
@@ -1437,6 +1443,13 @@ declare const ForeignAbstract: (symbol: string) => TSymbolSpecifier;
|
|
|
1437
1443
|
|
|
1438
1444
|
declare const Override: (multiLocation: TMultiLocation) => TOverrideMultiLocationSpecifier;
|
|
1439
1445
|
|
|
1446
|
+
/**
|
|
1447
|
+
* Normalizes an asset symbol by stripping the 'xc' prefix (if present) and converting it to lowercase.
|
|
1448
|
+
*
|
|
1449
|
+
* @param symbol - The symbol to normalize.
|
|
1450
|
+
* @returns The normalized symbol.
|
|
1451
|
+
*/
|
|
1452
|
+
declare const normalizeSymbol: (symbol: string | undefined) => string;
|
|
1440
1453
|
/**
|
|
1441
1454
|
* Retrieves the list of assets that are supported for transfers between two specified nodes.
|
|
1442
1455
|
*
|
|
@@ -1452,6 +1465,15 @@ declare const getTransferableAmount: <TApi, TRes>({ api, address, node, currency
|
|
|
1452
1465
|
|
|
1453
1466
|
declare const getAssetBySymbolOrId: (node: TNodeWithRelayChains, currency: TCurrencyInput, destination: TNodeWithRelayChains | null) => TAsset | null;
|
|
1454
1467
|
|
|
1468
|
+
declare const findBestMatches: <T extends {
|
|
1469
|
+
symbol: string;
|
|
1470
|
+
alias?: string;
|
|
1471
|
+
}>(assets: T[], value: string, property?: "symbol" | "alias") => T[];
|
|
1472
|
+
declare const findAssetBySymbol: (node: TNodeWithRelayChains, destination: TNodeWithRelayChains | null, otherAssets: TForeignAsset[], nativeAssets: TNativeAsset[], symbol: TCurrencySymbolValue) => TAsset | undefined;
|
|
1473
|
+
declare const findAssetById: (assets: TForeignAsset[], assetId: TCurrency) => TForeignAsset | undefined;
|
|
1474
|
+
|
|
1475
|
+
declare const findAssetByMultiLocation: (foreignAssets: TForeignAsset[], multiLocation: string | TMultiLocation | TJunction[]) => TForeignAsset | undefined;
|
|
1476
|
+
|
|
1455
1477
|
/**
|
|
1456
1478
|
* Retrieves the default pallet for a specified node.
|
|
1457
1479
|
*
|
|
@@ -1594,6 +1616,8 @@ declare const createApiInstanceForNode: <TApi, TRes>(api: IPolkadotApi<TApi, TRe
|
|
|
1594
1616
|
|
|
1595
1617
|
declare const isForeignAsset: (asset: TAsset) => asset is TForeignAsset;
|
|
1596
1618
|
|
|
1619
|
+
declare const isSymbolSpecifier: (currencySymbolValue: TCurrencySymbolValue) => currencySymbolValue is TSymbolSpecifier;
|
|
1620
|
+
|
|
1597
1621
|
declare const resolveModuleError: (node: TNodeDotKsmWithRelayChains, error: TModuleError) => XTokensError | PolkadotXcmError;
|
|
1598
1622
|
|
|
1599
1623
|
declare const computeFeeFromDryRun: (dryRun: any, node: TNodeDotKsmWithRelayChains, executionFee: bigint) => bigint;
|
|
@@ -1729,4 +1753,4 @@ declare const getNodeProviders: (node: TNodeDotKsmWithRelayChains) => string[];
|
|
|
1729
1753
|
*/
|
|
1730
1754
|
declare const getParaId: (node: TNodeDotKsmWithRelayChains) => number;
|
|
1731
1755
|
|
|
1732
|
-
export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, GeneralBuilder, type IAccountBuilder, type IAddToBatchBuilder, type IAddressBuilder, type ICurrencyBuilder, type IFinalBuilder, type IFinalBuilderWithOptions, type IFromBuilder, type IFungibleBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IToBuilder, type IVersionBuilder, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiOrUrl, type TAsset, type TAssetJsonMap, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyCoreV1, type TCurrencyCoreV1WithAmount, type TCurrencyCoreWithFee, type TCurrencyInput, type TCurrencyInputWithAmount, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TCurrencySymbolValue, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TJunction, type TJunctionGeneralIndex, type TJunctionParachain, type TJunctionType, type TJunctions, type TMantaAsset, type TModuleError, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiAssetWithFee, type TMultiLocation, type TMultiLocationHeader, type TMultiLocationValue, type TMultiLocationValueWithOverride, type TNativeAsset, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeConfig, type TNodeConfigMap, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TOverrideMultiLocationSpecifier, type TPallet, type TPalletDetails, type TPalletJsonMap, type TPalletMap, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayChainSymbol, type TRelayChainType, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TSymbolSpecifier, type TTransferInfo, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TZeitgeistAsset, Version, type WithAmount, type WithApi, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, deepEqual, determineRelayChain, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara };
|
|
1756
|
+
export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, GeneralBuilder, type IAccountBuilder, type IAddToBatchBuilder, type IAddressBuilder, type ICurrencyBuilder, type IFinalBuilder, type IFinalBuilderWithOptions, type IFromBuilder, type IFungibleBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IToBuilder, type IVersionBuilder, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiOrUrl, type TAsset, type TAssetJsonMap, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyCoreV1, type TCurrencyCoreV1WithAmount, type TCurrencyCoreWithFee, type TCurrencyInput, type TCurrencyInputWithAmount, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TCurrencySymbolValue, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TJunction, type TJunctionGeneralIndex, type TJunctionParachain, type TJunctionType, type TJunctions, type TMantaAsset, type TModuleError, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiAssetWithFee, type TMultiLocation, type TMultiLocationHeader, type TMultiLocationValue, type TMultiLocationValueWithOverride, type TNativeAsset, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeConfig, type TNodeConfigMap, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TOverrideMultiLocationSpecifier, type TPallet, type TPalletDetails, type TPalletJsonMap, type TPalletMap, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayChainSymbol, type TRelayChainType, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TSymbolSpecifier, type TTransferInfo, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TZeitgeistAsset, Version, type WithAmount, type WithApi, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara };
|
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,9 @@ function _arrayLikeToArray(r, a) {
|
|
|
6
6
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
7
7
|
return n;
|
|
8
8
|
}
|
|
9
|
+
function _arrayWithHoles(r) {
|
|
10
|
+
if (Array.isArray(r)) return r;
|
|
11
|
+
}
|
|
9
12
|
function _arrayWithoutHoles(r) {
|
|
10
13
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
11
14
|
}
|
|
@@ -162,6 +165,33 @@ function _isNativeReflectConstruct() {
|
|
|
162
165
|
function _iterableToArray(r) {
|
|
163
166
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
164
167
|
}
|
|
168
|
+
function _iterableToArrayLimit(r, l) {
|
|
169
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
170
|
+
if (null != t) {
|
|
171
|
+
var e,
|
|
172
|
+
n,
|
|
173
|
+
i,
|
|
174
|
+
u,
|
|
175
|
+
a = [],
|
|
176
|
+
f = true,
|
|
177
|
+
o = false;
|
|
178
|
+
try {
|
|
179
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
180
|
+
} catch (r) {
|
|
181
|
+
o = true, n = r;
|
|
182
|
+
} finally {
|
|
183
|
+
try {
|
|
184
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
185
|
+
} finally {
|
|
186
|
+
if (o) throw n;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return a;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function _nonIterableRest() {
|
|
193
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
194
|
+
}
|
|
165
195
|
function _nonIterableSpread() {
|
|
166
196
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
167
197
|
}
|
|
@@ -497,6 +527,9 @@ function _setPrototypeOf(t, e) {
|
|
|
497
527
|
return t.__proto__ = e, t;
|
|
498
528
|
}, _setPrototypeOf(t, e);
|
|
499
529
|
}
|
|
530
|
+
function _slicedToArray(r, e) {
|
|
531
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
532
|
+
}
|
|
500
533
|
function _superPropBase(t, o) {
|
|
501
534
|
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););
|
|
502
535
|
return t;
|
|
@@ -11809,6 +11842,10 @@ var isForeignAsset = function isForeignAsset(asset) {
|
|
|
11809
11842
|
return _typeof(asset) === 'object' && asset !== null && ('assetId' in asset || 'multiLocation' in asset || 'xcmInterior' in asset);
|
|
11810
11843
|
};
|
|
11811
11844
|
|
|
11845
|
+
var isSymbolSpecifier = function isSymbolSpecifier(currencySymbolValue) {
|
|
11846
|
+
return _typeof(currencySymbolValue) === 'object' && 'type' in currencySymbolValue && 'value' in currencySymbolValue;
|
|
11847
|
+
};
|
|
11848
|
+
|
|
11812
11849
|
/**
|
|
11813
11850
|
* Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
|
|
11814
11851
|
*/
|
|
@@ -16212,10 +16249,6 @@ var isOverrideMultiLocationSpecifier = function isOverrideMultiLocationSpecifier
|
|
|
16212
16249
|
return _typeof(multiLocationSpecifier) === 'object' && 'type' in multiLocationSpecifier && 'value' in multiLocationSpecifier;
|
|
16213
16250
|
};
|
|
16214
16251
|
|
|
16215
|
-
var isSymbolSpecifier = function isSymbolSpecifier(currencySymbolValue) {
|
|
16216
|
-
return _typeof(currencySymbolValue) === 'object' && 'type' in currencySymbolValue && 'value' in currencySymbolValue;
|
|
16217
|
-
};
|
|
16218
|
-
|
|
16219
16252
|
// Contains function for getting Asset ID or Symbol used in XCM call creation
|
|
16220
16253
|
var throwDuplicateAssetError = function throwDuplicateAssetError(symbol, nativeMatches, foreignMatches) {
|
|
16221
16254
|
if (nativeMatches.length > 0 && foreignMatches.length > 0) {
|
|
@@ -16486,6 +16519,29 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency, destina
|
|
|
16486
16519
|
return null;
|
|
16487
16520
|
};
|
|
16488
16521
|
|
|
16522
|
+
var getAssetMultiLocation = function getAssetMultiLocation(node, currency) {
|
|
16523
|
+
var asset = getAssetBySymbolOrId(node, currency, null);
|
|
16524
|
+
if (!asset || !isForeignAsset(asset)) {
|
|
16525
|
+
return null;
|
|
16526
|
+
}
|
|
16527
|
+
if (asset.multiLocation) {
|
|
16528
|
+
return asset.multiLocation;
|
|
16529
|
+
}
|
|
16530
|
+
if (asset.xcmInterior) {
|
|
16531
|
+
var _asset$xcmInterior$sl = asset.xcmInterior.slice(-2),
|
|
16532
|
+
_asset$xcmInterior$sl2 = _slicedToArray(_asset$xcmInterior$sl, 2),
|
|
16533
|
+
secondLast = _asset$xcmInterior$sl2[0],
|
|
16534
|
+
last = _asset$xcmInterior$sl2[1];
|
|
16535
|
+
return {
|
|
16536
|
+
parents: Parents.ZERO,
|
|
16537
|
+
interior: {
|
|
16538
|
+
X2: [secondLast, last]
|
|
16539
|
+
}
|
|
16540
|
+
};
|
|
16541
|
+
}
|
|
16542
|
+
return null;
|
|
16543
|
+
};
|
|
16544
|
+
|
|
16489
16545
|
/**
|
|
16490
16546
|
* Retrieves the existential deposit value for a given node.
|
|
16491
16547
|
*
|
|
@@ -18339,16 +18395,16 @@ var Builder = function Builder(api) {
|
|
|
18339
18395
|
var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
|
|
18340
18396
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
18341
18397
|
var _getExistentialDeposi;
|
|
18342
|
-
var api, account, accountDestination, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
18398
|
+
var api, account, accountDestination, ahAccount, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
18343
18399
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
18344
18400
|
while (1) switch (_context.prev = _context.next) {
|
|
18345
18401
|
case 0:
|
|
18346
|
-
api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === undefined ? 10 : _ref$feeMarginPercent;
|
|
18402
|
+
api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, ahAccount = _ref.ahAccount, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === undefined ? 10 : _ref$feeMarginPercent;
|
|
18347
18403
|
_context.next = 3;
|
|
18348
18404
|
return api.init(origin);
|
|
18349
18405
|
case 3:
|
|
18350
18406
|
_context.next = 5;
|
|
18351
|
-
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).build();
|
|
18407
|
+
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination, ahAccount).build();
|
|
18352
18408
|
case 5:
|
|
18353
18409
|
tx = _context.sent;
|
|
18354
18410
|
_context.next = 8;
|
|
@@ -19296,31 +19352,25 @@ var getDryRun = /*#__PURE__*/function () {
|
|
|
19296
19352
|
while (1) switch (_context.prev = _context.next) {
|
|
19297
19353
|
case 0:
|
|
19298
19354
|
api = options.api, node = options.node;
|
|
19299
|
-
|
|
19300
|
-
_context.next = 3;
|
|
19301
|
-
break;
|
|
19302
|
-
}
|
|
19303
|
-
throw new Error('Kusama is temporarily disable due to unknown error in DryRun.');
|
|
19304
|
-
case 3:
|
|
19305
|
-
_context.next = 5;
|
|
19355
|
+
_context.next = 3;
|
|
19306
19356
|
return api.init(node);
|
|
19307
|
-
case
|
|
19308
|
-
_context.prev =
|
|
19309
|
-
_context.next =
|
|
19357
|
+
case 3:
|
|
19358
|
+
_context.prev = 3;
|
|
19359
|
+
_context.next = 6;
|
|
19310
19360
|
return api.getDryRun(options);
|
|
19311
|
-
case
|
|
19361
|
+
case 6:
|
|
19312
19362
|
return _context.abrupt("return", _context.sent);
|
|
19313
|
-
case
|
|
19314
|
-
_context.prev =
|
|
19315
|
-
_context.next =
|
|
19363
|
+
case 7:
|
|
19364
|
+
_context.prev = 7;
|
|
19365
|
+
_context.next = 10;
|
|
19316
19366
|
return api.disconnect();
|
|
19317
|
-
case
|
|
19318
|
-
return _context.finish(
|
|
19319
|
-
case
|
|
19367
|
+
case 10:
|
|
19368
|
+
return _context.finish(7);
|
|
19369
|
+
case 11:
|
|
19320
19370
|
case "end":
|
|
19321
19371
|
return _context.stop();
|
|
19322
19372
|
}
|
|
19323
|
-
}, _callee, null, [[
|
|
19373
|
+
}, _callee, null, [[3,, 7, 11]]);
|
|
19324
19374
|
}));
|
|
19325
19375
|
return function getDryRun(_x) {
|
|
19326
19376
|
return _ref.apply(this, arguments);
|
|
@@ -19559,4 +19609,4 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
19559
19609
|
};
|
|
19560
19610
|
}();
|
|
19561
19611
|
|
|
19562
|
-
export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, _deepEqual as deepEqual, determineRelayChain, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara };
|
|
19612
|
+
export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, _deepEqual as deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.1",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"ethers": "^6.13.5",
|
|
27
|
-
"viem": "^2.22.
|
|
27
|
+
"viem": "^2.22.22"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/plugin-syntax-import-attributes": "^7.26.0",
|