@paraspell/sdk-core 11.3.2 → 11.4.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.d.ts CHANGED
@@ -300,12 +300,19 @@ type TGetBalanceForeignOptionsBase = {
300
300
  * The chain on which to query the balance.
301
301
  */
302
302
  chain: TChain;
303
+ };
304
+ type TGetBalanceForeignOptions<TApi, TRes> = WithApi<TGetBalanceForeignOptionsBase & {
303
305
  /**
304
306
  * The currency to query.
305
307
  */
306
308
  currency: TCurrencyCore;
307
- };
308
- type TGetBalanceForeignOptions<TApi, TRes> = WithApi<TGetBalanceForeignOptionsBase, TApi, TRes>;
309
+ }, TApi, TRes>;
310
+ type TGetBalanceForeignByAssetOptions<TApi, TRes> = WithApi<TGetBalanceForeignOptionsBase & {
311
+ /**
312
+ * The asset to query balance for.
313
+ */
314
+ asset: TAssetInfo;
315
+ }, TApi, TRes>;
309
316
  /**
310
317
  * Retrieves the asset balance for a given account on a specified chain.
311
318
  */
@@ -505,6 +512,9 @@ type TBatchOptions = {
505
512
  */
506
513
  mode: BatchMode;
507
514
  };
515
+ type TDryRunPreviewOptions = {
516
+ mintFeeAssets?: boolean;
517
+ };
508
518
  type TBuilderOptions<TApi> = TApi | TBuilderConfig<TApi>;
509
519
  type TBuilderConfig<TApi> = {
510
520
  apiOverrides?: Partial<Record<TChain, TApi>>;
@@ -584,6 +594,7 @@ type TDryRunBaseOptions<TRes> = {
584
594
  exchangeChain: TParachain;
585
595
  };
586
596
  useRootOrigin?: boolean;
597
+ bypassOptions?: TBypassOptions;
587
598
  };
588
599
  type TDryRunOptions<TApi, TRes> = WithApi<TDryRunBaseOptions<TRes>, TApi, TRes>;
589
600
  type TDryRunCallBaseOptions<TRes> = {
@@ -604,8 +615,10 @@ type TDryRunCallBaseOptions<TRes> = {
604
615
  */
605
616
  useRootOrigin?: boolean;
606
617
  asset: WithAmount<TAssetInfo>;
618
+ bypassOptions?: TBypassOptions;
607
619
  feeAsset?: TAssetInfo;
608
620
  };
621
+ type TDryRunBypassOptions<TApi, TRes> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin'>, TApi, TRes>;
609
622
  type TDryRunCallOptions<TApi, TRes> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes>;
610
623
  type TDryRunXcmBaseOptions = {
611
624
  originLocation: any;
@@ -697,6 +710,10 @@ type HopTraversalResult<THopResult> = {
697
710
  destination?: THopResult;
698
711
  lastProcessedChain?: TSubstrateChain;
699
712
  };
713
+ type TBypassOptions = {
714
+ mintFeeAssets?: boolean;
715
+ sentAssetMintMode?: 'preview' | 'bypass';
716
+ };
700
717
  declare enum XTokensError {
701
718
  AssetHasNoReserve = "AssetHasNoReserve",
702
719
  NotCrossChainTransfer = "NotCrossChainTransfer",
@@ -744,13 +761,21 @@ declare enum PolkadotXcmError {
744
761
  InvalidAssetUnknownReserve = "InvalidAssetUnknownReserve",
745
762
  InvalidAssetUnsupportedReserve = "InvalidAssetUnsupportedReserve",
746
763
  TooManyReserves = "TooManyReserves",
747
- LocalExecutionIncomplete = "LocalExecutionIncomplete"
764
+ LocalExecutionIncomplete = "LocalExecutionIncomplete",
765
+ TooManyAuthorizedAliases = "TooManyAuthorizedAliases",
766
+ ExpiresInPast = "ExpiresInPast",
767
+ AliasNotFound = "AliasNotFound",
768
+ LocalExecutionIncompleteWithError = "LocalExecutionIncompleteWithError"
748
769
  }
749
770
  type TModuleError = {
750
771
  index: string;
751
772
  error: string;
752
773
  };
753
774
 
775
+ declare class AmountTooLowError extends Error {
776
+ constructor(message?: string);
777
+ }
778
+
754
779
  /**
755
780
  * Error thrown when the Ethereum bridge is halted.
756
781
  */
@@ -1166,6 +1191,7 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
1166
1191
  */
1167
1192
  build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
1168
1193
  dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
1194
+ dryRunPreview(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TDryRunPreviewOptions): Promise<TDryRunResult>;
1169
1195
  /**
1170
1196
  * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
1171
1197
  *
@@ -2039,11 +2065,11 @@ type TSetBalanceRes = {
2039
2065
  balanceTx: TSerializedApiCall;
2040
2066
  };
2041
2067
  interface IAssetsPallet {
2042
- setBalance<TApi, TRes>(address: string, assetInfo: WithAmount<TAssetInfo>, chain: TSubstrateChain, api: IPolkadotApi<TApi, TRes>): Promise<TSetBalanceRes>;
2068
+ mint<TApi, TRes>(address: string, assetInfo: WithAmount<TAssetInfo>, balance: bigint, chain: TSubstrateChain, api: IPolkadotApi<TApi, TRes>): Promise<TSetBalanceRes>;
2043
2069
  }
2044
2070
 
2045
2071
  declare class AssetsPallet implements IAssetsPallet {
2046
- setBalance(address: string, asset: WithAmount<TAssetInfo>, chain: TSubstrateChain): Promise<TSetBalanceRes>;
2072
+ mint(address: string, asset: WithAmount<TAssetInfo>, _balance: bigint, chain: TSubstrateChain): Promise<TSetBalanceRes>;
2047
2073
  }
2048
2074
 
2049
2075
  declare const getAssetBalanceInternal: <TApi, TRes>({ address, chain, currency, api }: TGetAssetBalanceOptions<TApi, TRes>) => Promise<bigint>;
@@ -2074,7 +2100,9 @@ declare const addEthereumBridgeFees: <TApi, TRes, TResult extends {
2074
2100
  fee?: bigint;
2075
2101
  }>(api: IPolkadotApi<TApi, TRes>, bridgeHubResult: TResult | undefined, destination: TChain, assetHubChain: TSubstrateChain) => Promise<TResult | undefined>;
2076
2102
 
2077
- declare const wrapTxBypass: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>, chain: TSubstrateChain, asset: WithAmount<TAssetInfo>, feeAsset: TAssetInfo | undefined, address: string, tx: TRes) => Promise<TRes>;
2103
+ declare const getCurrencySelection: (asset: TAssetInfo) => TCurrencyCore;
2104
+ declare const calcPreviewMintAmount: (balance: bigint, desired: bigint) => bigint | null;
2105
+ declare const wrapTxBypass: <TApi, TRes>(dryRunOptions: TDryRunBypassOptions<TApi, TRes>, options?: TBypassOptions) => Promise<TRes>;
2078
2106
 
2079
2107
  declare const getParaEthTransferFees: <TApi, TRes>(ahApi: IPolkadotApi<TApi, TRes>) => Promise<[bigint, bigint]>;
2080
2108
 
@@ -2212,5 +2240,5 @@ declare const handleToAhTeleport: <TApi, TRes>(origin: TParachain, input: TPolka
2212
2240
 
2213
2241
  declare const validateAddress: (address: TAddress, chain: TChain, isDestination?: boolean) => void;
2214
2242
 
2215
- export { AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertToIsString, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
2216
- export type { HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TAttemptDryRunFeeOptions, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TBuilderConfig, TBuilderOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMaxForeignTransferableAmountOptions, TGetMaxForeignTransferableAmountOptionsBase, TGetMaxNativeTransferableAmountOptions, TGetMaxNativeTransferableAmountOptionsBase, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTypeAndThenCallContext, TTypeAndThenFees, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase$1 as TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
2243
+ export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
2244
+ export type { HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TAttemptDryRunFeeOptions, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMaxForeignTransferableAmountOptions, TGetMaxForeignTransferableAmountOptionsBase, TGetMaxNativeTransferableAmountOptions, TGetMaxNativeTransferableAmountOptionsBase, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTypeAndThenCallContext, TTypeAndThenFees, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase$1 as TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };