@paraspell/sdk-core 14.1.0 → 14.1.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.d.ts +5 -1
- package/dist/index.mjs +29 -7
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ declare abstract class SubstrateChain<TApi, TRes, TSigner, TCustomChain extends
|
|
|
153
153
|
canReceiveFrom<TCustomChain extends string = never>(_origin: TChain | TCustomChain): boolean;
|
|
154
154
|
shouldUseNativeAssetTeleport({ api, assetInfo: asset, to }: TTransferInternalOptions<TApi, TRes, TSigner, TCustomChain>): boolean;
|
|
155
155
|
shouldUseExecuteTransfer(_options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner, TCustomChain>): boolean;
|
|
156
|
+
protected shouldUseReserveTransfer(): boolean;
|
|
156
157
|
createAsset(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, asset: WithAmount<TAssetInfo>, version: Version): TAsset;
|
|
157
158
|
getNativeAssetSymbol(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>): string;
|
|
158
159
|
transferLocal(options: TTransferInternalOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
|
|
@@ -211,6 +212,8 @@ declare class AssetHubWestend<TApi, TRes, TSigner, TCustomChain extends string =
|
|
|
211
212
|
declare class Astar<TApi, TRes, TSigner, TCustomChain extends string = never> extends SubstrateChain<TApi, TRes, TSigner, TCustomChain> implements IPolkadotXCMTransfer<TApi, TRes, TSigner, TCustomChain> {
|
|
212
213
|
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
213
214
|
protected getMintConfig(): TMintConfig;
|
|
215
|
+
protected shouldUseReserveTransfer(): boolean;
|
|
216
|
+
isSendingTempDisabled({ assetInfo }: TTransferInternalOptions<TApi, TRes, TSigner, TCustomChain>): boolean;
|
|
214
217
|
transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
|
|
215
218
|
isRelayToParaEnabled(): boolean;
|
|
216
219
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner, TCustomChain>): TRes;
|
|
@@ -368,6 +371,7 @@ declare class EnergyWebX<TApi, TRes, TSigner, TCustomChain extends string = neve
|
|
|
368
371
|
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
369
372
|
transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
|
|
370
373
|
isRelayToParaEnabled(): boolean;
|
|
374
|
+
protected shouldUseReserveTransfer(): boolean;
|
|
371
375
|
protected getMintConfig(): TMintConfig;
|
|
372
376
|
getBalanceForeign(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, address: string, asset: TAssetInfo): Promise<bigint>;
|
|
373
377
|
}
|
|
@@ -2035,7 +2039,7 @@ type TDestWeight = {
|
|
|
2035
2039
|
proof_size: bigint;
|
|
2036
2040
|
};
|
|
2037
2041
|
type TXTokensMethod = 'transfer' | 'transfer_multiasset' | 'transfer_multiassets';
|
|
2038
|
-
type TPolkadotXcmMethod = 'limited_teleport_assets' | 'transfer_assets_using_type_and_then';
|
|
2042
|
+
type TPolkadotXcmMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'reserve_transfer_assets' | 'transfer_assets_using_type_and_then';
|
|
2039
2043
|
type TWeight<TWeightType = bigint> = {
|
|
2040
2044
|
refTime: TWeightType;
|
|
2041
2045
|
proofSize: TWeightType;
|
package/dist/index.mjs
CHANGED
|
@@ -2766,7 +2766,7 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
|
|
|
2766
2766
|
key: "transfer",
|
|
2767
2767
|
value: function () {
|
|
2768
2768
|
var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(transferOptions) {
|
|
2769
|
-
var api, asset, currency, feeAsset, feeCurrency, recipient, destination, paraIdTo, overriddenAsset, version, sender, ahAddress, pallet, method, keepAlive, transactOptions, scenario, paraId, destChain, isLocalTransfer, isRelayAsset, mythAsset, isMythAsset, assetNeedsTypeThen, supportsTypeThen, isSubBridge, useTypeAndThen, options, promise, isAHOrigin, isAHDest, isExternalAsset, isEthDest, isExternalAssetViaAh, isExternalAssetToAh, call, input, _t;
|
|
2769
|
+
var api, asset, currency, feeAsset, feeCurrency, recipient, destination, paraIdTo, overriddenAsset, version, sender, ahAddress, pallet, method, keepAlive, transactOptions, scenario, paraId, destChain, isLocalTransfer, isRelayAsset, mythAsset, isMythAsset, assetNeedsTypeThen, shouldUseReserveTransfer, supportsTypeThen, isSubBridge, useTypeAndThen, options, promise, isAHOrigin, isAHDest, isExternalAsset, isEthDest, isExternalAssetViaAh, isExternalAssetToAh, call, input, _t;
|
|
2770
2770
|
return _regenerator().w(function (_context) {
|
|
2771
2771
|
while (1) switch (_context.n) {
|
|
2772
2772
|
case 0:
|
|
@@ -2795,18 +2795,19 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
|
|
|
2795
2795
|
mythAsset = api.findNativeAssetInfoOrThrow('Mythos');
|
|
2796
2796
|
isMythAsset = isAssetEqual(mythAsset, asset);
|
|
2797
2797
|
assetNeedsTypeThen = isRelayAsset || isMythAsset;
|
|
2798
|
+
shouldUseReserveTransfer = isRelayAsset && this.shouldUseReserveTransfer();
|
|
2798
2799
|
_context.n = 3;
|
|
2799
2800
|
return api.hasMethod(api.hasPallet(this.chain, 'XcmPallet') ? 'XcmPallet' : 'PolkadotXcm', 'transfer_assets_using_type_and_then');
|
|
2800
2801
|
case 3:
|
|
2801
2802
|
supportsTypeThen = _context.v;
|
|
2802
|
-
|
|
2803
|
+
isSubBridge = !isTLocation(destination) && isSubstrateBridge(this.chain, destination);
|
|
2804
|
+
if (!(assetNeedsTypeThen && !supportsTypeThen && (!shouldUseReserveTransfer || isSubBridge))) {
|
|
2803
2805
|
_context.n = 4;
|
|
2804
2806
|
break;
|
|
2805
2807
|
}
|
|
2806
2808
|
throw new TypeAndThenUnavailableError('Relaychain assets require the type-and-then method which is not supported by this chain.');
|
|
2807
2809
|
case 4:
|
|
2808
|
-
|
|
2809
|
-
useTypeAndThen = assetNeedsTypeThen && supportsTypeThen && destChain && !isExternalChain(destChain) && !feeAsset && (!isTrustedChain(this.chain) || !isTrustedChain(destChain)) || isSubBridge;
|
|
2810
|
+
useTypeAndThen = !shouldUseReserveTransfer && assetNeedsTypeThen && supportsTypeThen && destChain && !isExternalChain(destChain) && !feeAsset && (!isTrustedChain(this.chain) || !isTrustedChain(destChain)) || isSubBridge;
|
|
2810
2811
|
if (!(supportsPolkadotXCM(this) || useTypeAndThen)) {
|
|
2811
2812
|
_context.n = 13;
|
|
2812
2813
|
break;
|
|
@@ -2943,7 +2944,7 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
|
|
|
2943
2944
|
value: function throwIfTempDisabled(options, destChain) {
|
|
2944
2945
|
var isSendingDisabled = this.isSendingTempDisabled(options);
|
|
2945
2946
|
if (isSendingDisabled) {
|
|
2946
|
-
throw new FeatureTemporarilyDisabledError("Sending from ".concat(this.chain, " is temporarily disabled"));
|
|
2947
|
+
throw new FeatureTemporarilyDisabledError("Sending ".concat(options.assetInfo.symbol, " from ").concat(this.chain, " is temporarily disabled"));
|
|
2947
2948
|
}
|
|
2948
2949
|
var scenario = resolveScenario(this.chain, options.to);
|
|
2949
2950
|
var isReceivingDisabled = destChain && !isExternalChain(destChain) && getChain(destChain).isReceivingTempDisabled(scenario);
|
|
@@ -2981,6 +2982,11 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
|
|
|
2981
2982
|
value: function shouldUseExecuteTransfer(_options) {
|
|
2982
2983
|
return false;
|
|
2983
2984
|
}
|
|
2985
|
+
}, {
|
|
2986
|
+
key: "shouldUseReserveTransfer",
|
|
2987
|
+
value: function shouldUseReserveTransfer() {
|
|
2988
|
+
return false;
|
|
2989
|
+
}
|
|
2984
2990
|
}, {
|
|
2985
2991
|
key: "createAsset",
|
|
2986
2992
|
value: function createAsset$1(api, asset, version) {
|
|
@@ -10724,10 +10730,21 @@ var Astar = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
10724
10730
|
useBigIntId: true
|
|
10725
10731
|
};
|
|
10726
10732
|
}
|
|
10733
|
+
}, {
|
|
10734
|
+
key: "shouldUseReserveTransfer",
|
|
10735
|
+
value: function shouldUseReserveTransfer() {
|
|
10736
|
+
return true;
|
|
10737
|
+
}
|
|
10738
|
+
}, {
|
|
10739
|
+
key: "isSendingTempDisabled",
|
|
10740
|
+
value: function isSendingTempDisabled(_ref) {
|
|
10741
|
+
var assetInfo = _ref.assetInfo;
|
|
10742
|
+
return deepEqual(assetInfo.location, RELAY_LOCATION);
|
|
10743
|
+
}
|
|
10727
10744
|
}, {
|
|
10728
10745
|
key: "transferPolkadotXCM",
|
|
10729
10746
|
value: function transferPolkadotXCM(input) {
|
|
10730
|
-
return transferPolkadotXcm(input, '
|
|
10747
|
+
return transferPolkadotXcm(input, 'reserve_transfer_assets');
|
|
10731
10748
|
}
|
|
10732
10749
|
}, {
|
|
10733
10750
|
key: "isRelayToParaEnabled",
|
|
@@ -11530,13 +11547,18 @@ var EnergyWebX = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11530
11547
|
scenario: scenario
|
|
11531
11548
|
});
|
|
11532
11549
|
}
|
|
11533
|
-
return transferPolkadotXcm(input);
|
|
11550
|
+
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
11534
11551
|
}
|
|
11535
11552
|
}, {
|
|
11536
11553
|
key: "isRelayToParaEnabled",
|
|
11537
11554
|
value: function isRelayToParaEnabled() {
|
|
11538
11555
|
return false;
|
|
11539
11556
|
}
|
|
11557
|
+
}, {
|
|
11558
|
+
key: "shouldUseReserveTransfer",
|
|
11559
|
+
value: function shouldUseReserveTransfer() {
|
|
11560
|
+
return true;
|
|
11561
|
+
}
|
|
11540
11562
|
}, {
|
|
11541
11563
|
key: "getMintConfig",
|
|
11542
11564
|
value: function getMintConfig() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "14.1.
|
|
3
|
+
"version": "14.1.1",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"@noble/hashes": "^2.2.0",
|
|
26
26
|
"@scure/base": "^2.2.0",
|
|
27
27
|
"viem": "^2.55.10",
|
|
28
|
-
"@paraspell/assets": "14.1.
|
|
29
|
-
"@paraspell/
|
|
30
|
-
"@paraspell/
|
|
28
|
+
"@paraspell/assets": "14.1.1",
|
|
29
|
+
"@paraspell/pallets": "14.1.1",
|
|
30
|
+
"@paraspell/sdk-common": "14.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/plugin-syntax-import-attributes": "^7.29.7",
|