@paraspell/sdk-core 14.3.3 → 14.3.4
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 +7 -2
- package/dist/index.mjs +91 -6
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _paraspell_sdk_common from '@paraspell/sdk-common';
|
|
|
2
2
|
import { TChain, TRelaychain, Version, TSubstrateChain, TLocation, TParachain, TExternalChain, ParaSpellError, TJunction, Parents, TJunctions } from '@paraspell/sdk-common';
|
|
3
3
|
export * from '@paraspell/sdk-common';
|
|
4
4
|
import * as _paraspell_assets from '@paraspell/assets';
|
|
5
|
-
import { TAssetInfo, TChainAssetsInfo, TCurrencyInput, TCurrencyCore, WithAmount, TAsset, TCurrencyInputWithAmount, WithComplexAmount, TSingleCurrencyInputWithAmount, TCustomAssetInfo, TCustomCtx, TCustomAssetsMap, TSingleCurrencyInput, TAmount, TAssetWithFee, TAssetInfoWithId } from '@paraspell/assets';
|
|
5
|
+
import { TAssetInfo, TChainAssetsInfo, TCurrencyInput, TCurrencyCore, WithAmount, TAsset, TCurrencyInputWithAmount, WithComplexAmount, TSingleCurrencyInputWithAmount, TCustomAssetInfo, TCustomCtx, TCustomAssetsMap, TSingleCurrencyInput, TAmount, TAssetWithFee, TAssetInfoWithId, TErc20Info } from '@paraspell/assets';
|
|
6
6
|
export * from '@paraspell/assets';
|
|
7
7
|
import { TPallet, TPalletEntry, TAssetsPallet, TCustomChainPallets, TCrosschainPallet } from '@paraspell/pallets';
|
|
8
8
|
export * from '@paraspell/pallets';
|
|
@@ -222,9 +222,11 @@ declare class Astar<TApi, TRes, TSigner, TCustomChain extends string = never> ex
|
|
|
222
222
|
declare class Hydration<TApi, TRes, TSigner, TCustomChain extends string = never> extends SubstrateChain<TApi, TRes, TSigner, TCustomChain> implements IPolkadotXCMTransfer<TApi, TRes, TSigner, TCustomChain> {
|
|
223
223
|
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
224
224
|
protected getMintConfig(): TMintConfig;
|
|
225
|
+
mint(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, address: string, assetInfo: WithAmount<TAssetInfo>, balance: bigint): Promise<TSetBalanceRes>;
|
|
225
226
|
shouldUseExecuteTransfer(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner, TCustomChain>): boolean;
|
|
226
227
|
transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
|
|
227
228
|
transferLocalNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
|
|
229
|
+
getBalanceForeign(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, address: string, asset: TAssetInfo): Promise<bigint>;
|
|
228
230
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner, TCustomChain>): TRes;
|
|
229
231
|
}
|
|
230
232
|
|
|
@@ -2291,6 +2293,7 @@ declare const resolveTransferParams: <TApi, TRes, TSigner, TCustomChain extends
|
|
|
2291
2293
|
location: _paraspell_sdk_common.TLocation;
|
|
2292
2294
|
existentialDeposit?: string;
|
|
2293
2295
|
isFeeAsset?: boolean;
|
|
2296
|
+
erc20?: _paraspell_assets.TErc20Info;
|
|
2294
2297
|
alias?: string;
|
|
2295
2298
|
};
|
|
2296
2299
|
};
|
|
@@ -2429,6 +2432,8 @@ declare const createVersionedAssets: (version: Version, amount: bigint, location
|
|
|
2429
2432
|
|
|
2430
2433
|
declare const formatAssetIdToERC20: (id: string) => string;
|
|
2431
2434
|
|
|
2435
|
+
declare const buildErc20StorageMint: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, address: string, asset: TAssetInfo, erc20: TErc20Info, balance: bigint) => TSetBalanceRes;
|
|
2436
|
+
|
|
2432
2437
|
declare const maybeOverrideAssets: (version: Version, amount: bigint, assets: TAsset[], overriddenCurrency?: TLocation | TAsset[]) => TAsset | TAsset[];
|
|
2433
2438
|
declare const maybeOverrideAsset: (version: Version, amount: bigint, asset: TAsset, overriddenCurrency?: TLocation | TAsset[]) => TAsset;
|
|
2434
2439
|
|
|
@@ -2574,5 +2579,5 @@ declare const selectXcmVersion: (forcedVersion: Version | undefined, originVersi
|
|
|
2574
2579
|
declare const pickCompatibleXcmVersion: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, origin: TSubstrateChain | TCustomChain, destination: TDestination, override?: Version) => Version;
|
|
2575
2580
|
declare const pickRouterCompatibleXcmVersion: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, origin: TSubstrateChain | undefined, exchangeChain: TSubstrateChain, destination: TChain | undefined) => Version;
|
|
2576
2581
|
|
|
2577
|
-
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, CustomChainConflictError, CustomChainInvalidError, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, buildCustomChainAssetsInfo, buildCustomChainConfig, buildDestInfo, buildDryRunError, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getAssetReserveChainImpl, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainConfigImpl, getChainLocation, getChainProviders, getChainProvidersImpl, getChainVersion, getDryRunError, getErrorInstruction, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getParaIdImpl, getRelayChainOf, getRelayChainOfImpl, getRelayChainSymbolOf, getSwapExtensionOrThrow, getTChain, getTSubstrateChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isExchange, isNativeAssetTeleport, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, localizeLocationImpl, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeCustomChains, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickOtherMintPallet, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
|
|
2582
|
+
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, CustomChainConflictError, CustomChainInvalidError, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, buildCustomChainAssetsInfo, buildCustomChainConfig, buildDestInfo, buildDryRunError, buildErc20StorageMint, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getAssetReserveChainImpl, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainConfigImpl, getChainLocation, getChainProviders, getChainProvidersImpl, getChainVersion, getDryRunError, getErrorInstruction, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getParaIdImpl, getRelayChainOf, getRelayChainOfImpl, getRelayChainSymbolOf, getSwapExtensionOrThrow, getTChain, getTSubstrateChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isExchange, isNativeAssetTeleport, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, localizeLocationImpl, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeCustomChains, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickOtherMintPallet, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
|
|
2578
2583
|
export type { BuildHopInfoOptions, ClientCache, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotXCMTransfer, IXTokensTransfer, OneKey, TAddress, TApiOrUrl, TApiType, TBatchOptions, TBatchedTransferOptions, TBifrostToken, TBridgeStatus, TBuildAllInternalRes, TBuildDestInfoOptions, TBuildEvmTransferOptions, TBuildInternalRes, TBuildInternalResBase, TBuildOriginInfoOptions, TBuilderConfig, TBuilderInternalOptions, TBuilderOptions, TBypassOptions, TCacheItem, TChainConfig, TChainConfigMap, TChainWithApi, TClientEntry, TClientKey, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateEthBridgeInstructionsOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions, TCustomChainEntry, TCustomChainEntryHydrated, TCustomChainFrom, TCustomChainInput, TCustomChainPalletsInput, TCustomChainsCtx, TCustomChainsMap, TDestWeight, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChainFailure, TDryRunChainKind, TDryRunChainResult, TDryRunChainSuccess, TDryRunError, TDryRunFailure, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmExtension, TEvmSnowbridgeExtension, TEvmTransferOptions, TEvmTransferOptionsBase, TExchangeChain, TExchangeInput, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TFullCustomCtx, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceCommonOptions, TGetBalanceOptions, TGetBalanceOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeInternalOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeInternalOptions, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, TMintConfig, TModuleError, TNativeTokenAsset, TOriginFeeDetails, TOriginXcmFeeInfo, TOtherReserveAsset, TPaymentInfo, TPerAssetResult, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TReceivedCurrencyInfo, TReserveAsset, TResolveHopParams, TResolvedCurrency, TRuntimeApi, TScenario, TSelectedCurrencyInfo, TSelfReserveAsset, TSender, TSerializedExtrinsics, TSerializedRuntimeApiQuery, TSerializedStateQuery, TSetBalanceRes, TStatusChangeCallback, TSubstrateTransferBaseOptions, TSubstrateTransferBaseOptionsWithSender, TSubstrateTransferOptions, TSwapBuilder, TSwapBuilderFactory, TSwapConfig, TSwapEvent, TSwapEventType, TSwapExtension, TSwapFeeEstimates, TSwapOptions, TSystemProperties, TTransactOptions, TTransactOrigin, TTransactionContext, TTransactionType, TTransferBaseOptions, TTransferBaseOptionsWithSender, TTransferBaseOptionsWithSwap, TTransferFeeEstimates, TTransferInfo, TTransferInternalOptions, TTransferLocalOptions, TTransferOptions, TTransferOptionsWithSwap, TTxFactory, TTypeAndThenCallContext, TTypeAndThenFees, TTypeAndThenOverrides, TUrl, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeDetailWithForwardedXcm, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmFeeSwapConfig, TXcmForeignAsset, TXcmVersioned, WithApi, WithRequiredSender, WithRequiredSwapOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,8 @@ export * from '@paraspell/sdk-common';
|
|
|
8
8
|
import { getXcmPallet, getOtherAssetsPallets, getNativeAssetsPallet, getSupportedPalletsDetails, ASSETS_PALLETS, NATIVE_ASSETS_PALLET_PRIORITY, OTHER_ASSETS_PALLET_PRIORITY, hasPalletImpl, getXcmPalletImpl } from '@paraspell/pallets';
|
|
9
9
|
export * from '@paraspell/pallets';
|
|
10
10
|
import { mainnet, sepolia } from 'viem/chains';
|
|
11
|
+
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
12
|
+
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';
|
|
11
13
|
|
|
12
14
|
function _arrayLikeToArray(r, a) {
|
|
13
15
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -2427,9 +2429,30 @@ var CurrenciesPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
2427
2429
|
}
|
|
2428
2430
|
}, {
|
|
2429
2431
|
key: "getBalance",
|
|
2430
|
-
value: function
|
|
2431
|
-
|
|
2432
|
-
|
|
2432
|
+
value: function () {
|
|
2433
|
+
var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset) {
|
|
2434
|
+
var account;
|
|
2435
|
+
return _regenerator().w(function (_context) {
|
|
2436
|
+
while (1) switch (_context.n) {
|
|
2437
|
+
case 0:
|
|
2438
|
+
assertHasId(asset);
|
|
2439
|
+
_context.n = 1;
|
|
2440
|
+
return api.queryRuntimeApi({
|
|
2441
|
+
module: 'CurrenciesApi',
|
|
2442
|
+
method: 'account',
|
|
2443
|
+
params: [Number(asset.assetId), address]
|
|
2444
|
+
});
|
|
2445
|
+
case 1:
|
|
2446
|
+
account = _context.v;
|
|
2447
|
+
return _context.a(2, (account === null || account === void 0 ? void 0 : account.free) !== undefined ? BigInt(account.free) : 0n);
|
|
2448
|
+
}
|
|
2449
|
+
}, _callee);
|
|
2450
|
+
}));
|
|
2451
|
+
function getBalance(_x, _x2, _x3) {
|
|
2452
|
+
return _getBalance.apply(this, arguments);
|
|
2453
|
+
}
|
|
2454
|
+
return getBalance;
|
|
2455
|
+
}()
|
|
2433
2456
|
}]);
|
|
2434
2457
|
}(BaseAssetsPallet);
|
|
2435
2458
|
|
|
@@ -10974,6 +10997,14 @@ var Hydration = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
10974
10997
|
useIdPrefix: false
|
|
10975
10998
|
};
|
|
10976
10999
|
}
|
|
11000
|
+
}, {
|
|
11001
|
+
key: "mint",
|
|
11002
|
+
value: function mint(api, address, assetInfo, balance) {
|
|
11003
|
+
if (assetInfo.erc20) {
|
|
11004
|
+
return Promise.resolve(buildErc20StorageMint(api, address, assetInfo, assetInfo.erc20, balance + assetInfo.amount));
|
|
11005
|
+
}
|
|
11006
|
+
return _superPropGet(Hydration, "mint", this, 3)([api, address, assetInfo, balance]);
|
|
11007
|
+
}
|
|
10977
11008
|
}, {
|
|
10978
11009
|
key: "shouldUseExecuteTransfer",
|
|
10979
11010
|
value: function shouldUseExecuteTransfer(input) {
|
|
@@ -11041,6 +11072,12 @@ var Hydration = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11041
11072
|
}
|
|
11042
11073
|
}));
|
|
11043
11074
|
}
|
|
11075
|
+
}, {
|
|
11076
|
+
key: "getBalanceForeign",
|
|
11077
|
+
value: function getBalanceForeign(api, address, asset) {
|
|
11078
|
+
if (!asset.erc20) return _superPropGet(Hydration, "getBalanceForeign", this, 3)([api, address, asset]);
|
|
11079
|
+
return getPalletInstance('Currencies').getBalance(api, address, asset);
|
|
11080
|
+
}
|
|
11044
11081
|
}, {
|
|
11045
11082
|
key: "transferLocalNonNativeAsset",
|
|
11046
11083
|
value: function transferLocalNonNativeAsset(options) {
|
|
@@ -11048,9 +11085,22 @@ var Hydration = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11048
11085
|
asset = options.assetInfo,
|
|
11049
11086
|
recipient = options.recipient,
|
|
11050
11087
|
isAmountAll = options.isAmountAll,
|
|
11051
|
-
keepAlive = options.keepAlive
|
|
11088
|
+
keepAlive = options.keepAlive,
|
|
11089
|
+
balance = options.balance;
|
|
11052
11090
|
assertHasId(asset);
|
|
11053
11091
|
var currencyId = Number(asset.assetId);
|
|
11092
|
+
if (asset.erc20) {
|
|
11093
|
+
var amount = isAmountAll ? balance - (keepAlive ? getEdFromAssetOrThrow(asset) : 0n) : asset.amount;
|
|
11094
|
+
return api.deserializeExtrinsics({
|
|
11095
|
+
module: 'Currencies',
|
|
11096
|
+
method: 'transfer',
|
|
11097
|
+
params: {
|
|
11098
|
+
dest: recipient,
|
|
11099
|
+
currency_id: currencyId,
|
|
11100
|
+
amount: amount
|
|
11101
|
+
}
|
|
11102
|
+
});
|
|
11103
|
+
}
|
|
11054
11104
|
if (isAmountAll) {
|
|
11055
11105
|
return api.deserializeExtrinsics({
|
|
11056
11106
|
module: 'Tokens',
|
|
@@ -11725,7 +11775,9 @@ var EnergyWebX = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11725
11775
|
scenario: scenario
|
|
11726
11776
|
});
|
|
11727
11777
|
}
|
|
11728
|
-
|
|
11778
|
+
// EnergyWebX has to stay on reserve_transfer_assets for now.
|
|
11779
|
+
// limited_reserve_transfer_assets causes 'Extrinsic is now allowed error'
|
|
11780
|
+
return transferPolkadotXcm(input, 'reserve_transfer_assets');
|
|
11729
11781
|
}
|
|
11730
11782
|
}, {
|
|
11731
11783
|
key: "isRelayToParaEnabled",
|
|
@@ -12767,6 +12819,39 @@ var formatAssetIdToERC20 = function formatAssetIdToERC20(id) {
|
|
|
12767
12819
|
return "0xffffffff".concat(BigInt(id).toString(16).padStart(32, '0'));
|
|
12768
12820
|
};
|
|
12769
12821
|
|
|
12822
|
+
// twox128("EVM") ++ twox128("AccountStorages") — the pallet_evm::AccountStorages storage prefix.
|
|
12823
|
+
var ACCOUNT_STORAGES_PREFIX = '1da53b775b270400e7e61ed5cbc5a146ab1160471b1418779239ba8e2b847e42';
|
|
12824
|
+
// "ETH\0" — prefix of account ids that Hydration derives from an EVM address
|
|
12825
|
+
var EVM_ACCOUNT_PREFIX = '45544800';
|
|
12826
|
+
var word = function word(hex) {
|
|
12827
|
+
return hex.padStart(64, '0');
|
|
12828
|
+
};
|
|
12829
|
+
var blake2128Concat = function blake2128Concat(hex) {
|
|
12830
|
+
return bytesToHex(blake2b(hexToBytes(hex), {
|
|
12831
|
+
dkLen: 16
|
|
12832
|
+
})) + hex;
|
|
12833
|
+
};
|
|
12834
|
+
// Mirrors pallet_evm_accounts::evm_address
|
|
12835
|
+
var toEvmAddress = function toEvmAddress(accountId) {
|
|
12836
|
+
return accountId.startsWith(EVM_ACCOUNT_PREFIX) && accountId.endsWith('0'.repeat(16)) ? accountId.slice(8, 48) : accountId.slice(0, 40);
|
|
12837
|
+
};
|
|
12838
|
+
var buildErc20StorageMint = function buildErc20StorageMint(api, address, asset, erc20, balance) {
|
|
12839
|
+
var _erc20$contract, _getJunctionValue;
|
|
12840
|
+
var contract = (_erc20$contract = erc20.contract) !== null && _erc20$contract !== void 0 ? _erc20$contract : (_getJunctionValue = getJunctionValue(asset.location, 'AccountKey20')) === null || _getJunctionValue === void 0 ? void 0 : _getJunctionValue.key;
|
|
12841
|
+
if (!contract) throw new InvalidCurrencyError("Missing ERC20 contract for asset ".concat(asset.symbol));
|
|
12842
|
+
var evmAddress = toEvmAddress(bytesToHex(api.accountToUint8a(address)));
|
|
12843
|
+
var slotKey = bytesToHex(keccak_256(hexToBytes(word(evmAddress) + word(erc20.balanceSlot.toString(16)))));
|
|
12844
|
+
return {
|
|
12845
|
+
balanceTx: {
|
|
12846
|
+
module: 'System',
|
|
12847
|
+
method: 'set_storage',
|
|
12848
|
+
params: {
|
|
12849
|
+
items: [['0x' + ACCOUNT_STORAGES_PREFIX + blake2128Concat(contract.slice(2)) + blake2128Concat(slotKey), '0x' + word(balance.toString(16))]]
|
|
12850
|
+
}
|
|
12851
|
+
}
|
|
12852
|
+
};
|
|
12853
|
+
};
|
|
12854
|
+
|
|
12770
12855
|
var maybeOverrideAssets = function maybeOverrideAssets(version, amount, assets, overriddenCurrency) {
|
|
12771
12856
|
if (!overriddenCurrency) {
|
|
12772
12857
|
return assets;
|
|
@@ -13941,4 +14026,4 @@ var createClientCache = function createClientCache(maxSize, pingClient, onEvicti
|
|
|
13941
14026
|
};
|
|
13942
14027
|
};
|
|
13943
14028
|
|
|
13944
|
-
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, CustomChainConflictError, CustomChainInvalidError, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, buildCustomChainAssetsInfo, buildCustomChainConfig, buildDestInfo, buildDryRunError, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getAssetReserveChainImpl, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainConfigImpl, getChainLocation, getChainProviders, getChainProvidersImpl, getChainVersion, getDryRunError, getErrorInstruction, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getParaIdImpl, getRelayChainOf, getRelayChainOfImpl, getRelayChainSymbolOf, getSwapExtensionOrThrow, getTChain, getTSubstrateChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isExchange, isNativeAssetTeleport, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, localizeLocationImpl, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeCustomChains, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickOtherMintPallet, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
|
|
14029
|
+
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, CustomChainConflictError, CustomChainInvalidError, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, buildCustomChainAssetsInfo, buildCustomChainConfig, buildDestInfo, buildDryRunError, buildErc20StorageMint, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getAssetReserveChainImpl, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainConfigImpl, getChainLocation, getChainProviders, getChainProvidersImpl, getChainVersion, getDryRunError, getErrorInstruction, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getParaIdImpl, getRelayChainOf, getRelayChainOfImpl, getRelayChainSymbolOf, getSwapExtensionOrThrow, getTChain, getTSubstrateChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isExchange, isNativeAssetTeleport, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, localizeLocationImpl, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeCustomChains, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickOtherMintPallet, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.4",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@noble/hashes": "^2.3.0",
|
|
26
|
-
"@paraspell/assets": "14.3.
|
|
27
|
-
"@paraspell/pallets": "14.3.
|
|
28
|
-
"@paraspell/sdk-common": "14.3.
|
|
26
|
+
"@paraspell/assets": "14.3.4",
|
|
27
|
+
"@paraspell/pallets": "14.3.4",
|
|
28
|
+
"@paraspell/sdk-common": "14.3.4",
|
|
29
29
|
"@scure/base": "^2.3.0",
|
|
30
30
|
"viem": "^2.55.19"
|
|
31
31
|
},
|