@paraspell/sdk-core 10.10.4 → 10.10.6

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
@@ -637,6 +637,45 @@ type TDryRunResult = {
637
637
  bridgeHub?: TDryRunNodeResult;
638
638
  hops: THopInfo[];
639
639
  };
640
+ type HopProcessParams<TApi, TRes> = {
641
+ api: IPolkadotApi<TApi, TRes>;
642
+ currentChain: TNodeDotKsmWithRelayChains;
643
+ currentOrigin: TNodeDotKsmWithRelayChains;
644
+ currentAsset: TAsset;
645
+ forwardedXcms: any;
646
+ hasPassedExchange: boolean;
647
+ isDestination: boolean;
648
+ isAssetHub: boolean;
649
+ isBridgeHub: boolean;
650
+ };
651
+ type HopTraversalConfig<TApi, TRes, THopResult> = {
652
+ api: IPolkadotApi<TApi, TRes>;
653
+ origin: TNodeDotKsmWithRelayChains;
654
+ destination: TNodeWithRelayChains;
655
+ currency: TCurrencyCore;
656
+ initialForwardedXcms: any;
657
+ initialDestParaId: number | undefined;
658
+ swapConfig?: {
659
+ exchangeChain: TNodeDotKsmWithRelayChains;
660
+ currencyTo: TCurrencyCore;
661
+ };
662
+ processHop: (params: HopProcessParams<TApi, TRes>) => Promise<THopResult>;
663
+ shouldContinue: (hopResult: THopResult) => boolean;
664
+ extractNextHopData: (hopResult: THopResult) => {
665
+ forwardedXcms: any;
666
+ destParaId: number | undefined;
667
+ };
668
+ };
669
+ type HopTraversalResult<THopResult> = {
670
+ hops: Array<{
671
+ chain: TNodeDotKsmWithRelayChains;
672
+ result: THopResult;
673
+ }>;
674
+ assetHub?: THopResult;
675
+ bridgeHub?: THopResult;
676
+ destination?: THopResult;
677
+ lastProcessedChain?: TNodeDotKsmWithRelayChains;
678
+ };
640
679
  declare enum XTokensError {
641
680
  AssetHasNoReserve = "AssetHasNoReserve",
642
681
  NotCrossChainTransfer = "NotCrossChainTransfer",
@@ -884,7 +923,7 @@ type TGetTransferInfoOptionsBase<TRes> = {
884
923
  };
885
924
  type TGetTransferInfoOptions<TApi, TRes> = WithApi<TGetTransferInfoOptionsBase<TRes>, TApi, TRes>;
886
925
 
887
- type TGetXcmFeeBaseOptions<TRes> = {
926
+ type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
888
927
  /**
889
928
  * The transaction to calculate the fee for
890
929
  */
@@ -904,13 +943,13 @@ type TGetXcmFeeBaseOptions<TRes> = {
904
943
  address: string;
905
944
  currency: WithAmount<TCurrencyCore>;
906
945
  feeAsset?: TCurrencyInput;
907
- disableFallback: boolean;
946
+ disableFallback: TDisableFallback;
908
947
  swapConfig?: {
909
948
  currencyTo: TCurrencyCore;
910
949
  exchangeChain: TNodePolkadotKusama;
911
950
  };
912
951
  };
913
- type TGetXcmFeeOptions<TApi, TRes> = WithApi<TGetXcmFeeBaseOptions<TRes>, TApi, TRes>;
952
+ type TGetXcmFeeOptions<TApi, TRes, TDisableFallback extends boolean = boolean> = WithApi<TGetXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes>;
914
953
  type TGetXcmFeeEstimateOptions<TApi, TRes> = Omit<TGetXcmFeeOptions<TApi, TRes>, 'disableFallback'>;
915
954
  type TGetOriginXcmFeeEstimateOptions<TApi, TRes> = Omit<TGetXcmFeeOptions<TApi, TRes>, 'disableFallback' | 'address'>;
916
955
  type TGetXcmFeeBuilderOptions = {
@@ -945,6 +984,14 @@ type TGetReverseTxFeeOptions<TApi, TRes> = Omit<TGetFeeForDestNodeOptions<TApi,
945
984
  };
946
985
  type THubKey = 'assetHub' | 'bridgeHub';
947
986
  type TFeeType = 'dryRun' | 'paymentInfo' | 'noFeeRequired';
987
+ type TXcmFeeDetailWithFallback = {
988
+ fee: bigint;
989
+ currency: string;
990
+ feeType: TFeeType;
991
+ weight?: TWeight;
992
+ sufficient?: boolean;
993
+ dryRunError?: string;
994
+ };
948
995
  type TXcmFeeDetail = {
949
996
  fee: bigint;
950
997
  currency: string;
@@ -960,19 +1007,28 @@ type TXcmFeeDetail = {
960
1007
  sufficient?: boolean;
961
1008
  dryRunError: string;
962
1009
  };
1010
+ type TConditionalXcmFeeDetail<TDisableFallback extends boolean> = TDisableFallback extends false ? TXcmFeeDetailWithFallback : TXcmFeeDetail;
1011
+ type TDestXcmFeeDetail<TDisableFallback extends boolean> = Omit<TConditionalXcmFeeDetail<TDisableFallback>, 'currency'> & {
1012
+ forwardedXcms?: any;
1013
+ destParaId?: number;
1014
+ };
1015
+ type TConditionalXcmFeeHopInfo<TDisableFallback extends boolean> = {
1016
+ chain: TNodeWithRelayChains;
1017
+ result: TConditionalXcmFeeDetail<TDisableFallback>;
1018
+ };
963
1019
  type TXcmFeeChain = 'origin' | 'destination' | 'assetHub' | 'bridgeHub' | TNodeWithRelayChains;
964
1020
  type TXcmFeeHopInfo = {
965
1021
  chain: TNodeWithRelayChains;
966
1022
  result: TXcmFeeDetail;
967
1023
  };
968
- type TGetXcmFeeResult = {
1024
+ type TGetXcmFeeResult<TDisableFallback extends boolean = boolean> = {
969
1025
  failureReason?: string;
970
1026
  failureChain?: TXcmFeeChain;
971
- origin: TXcmFeeDetail;
972
- destination: TXcmFeeDetail;
973
- assetHub?: TXcmFeeDetail;
974
- bridgeHub?: TXcmFeeDetail;
975
- hops: TXcmFeeHopInfo[];
1027
+ origin: TConditionalXcmFeeDetail<TDisableFallback>;
1028
+ destination: TConditionalXcmFeeDetail<TDisableFallback>;
1029
+ assetHub?: TConditionalXcmFeeDetail<TDisableFallback>;
1030
+ bridgeHub?: TConditionalXcmFeeDetail<TDisableFallback>;
1031
+ hops: TConditionalXcmFeeHopInfo<TDisableFallback>[];
976
1032
  };
977
1033
  type TGetXcmFeeEstimateDetail = {
978
1034
  fee: bigint;
@@ -1216,7 +1272,9 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
1216
1272
  *
1217
1273
  * @returns An origin and destination fee.
1218
1274
  */
1219
- getXcmFee(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, { disableFallback }?: TGetXcmFeeBuilderOptions): Promise<TGetXcmFeeResult>;
1275
+ getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TGetXcmFeeBuilderOptions & {
1276
+ disableFallback: TDisableFallback;
1277
+ }): Promise<TGetXcmFeeResult<TDisableFallback>>;
1220
1278
  /**
1221
1279
  * Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
1222
1280
  *
@@ -1893,6 +1951,11 @@ declare const dryRun: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>) => Promi
1893
1951
 
1894
1952
  declare const dryRunOrigin: <TApi, TRes>(options: TDryRunCallOptions<TApi, TRes>) => Promise<TDryRunNodeResult>;
1895
1953
 
1954
+ declare function traverseXcmHops<TApi, TRes, THopResult>(config: HopTraversalConfig<TApi, TRes, THopResult>): Promise<HopTraversalResult<THopResult>>;
1955
+ declare const addEthereumBridgeFees: <TApi, TRes, TResult extends {
1956
+ fee?: bigint;
1957
+ }>(api: IPolkadotApi<TApi, TRes>, bridgeHubResult: TResult | undefined, destination: TNodeWithRelayChains, assetHubNode: TNodeDotKsmWithRelayChains) => Promise<TResult | undefined>;
1958
+
1896
1959
  declare const getParaEthTransferFees: <TApi, TRes>(ahApi: IPolkadotApi<TApi, TRes>) => Promise<[bigint, bigint]>;
1897
1960
 
1898
1961
  declare const transferMoonbeamEvm: <TApi, TRes>({ api, from, to, signer, address, currency }: TEvmBuilderOptions<TApi, TRes>) => Promise<string>;
@@ -1906,7 +1969,16 @@ declare const getOriginXcmFee: <TApi, TRes>({ api, tx, origin, destination, send
1906
1969
 
1907
1970
  declare const getOriginXcmFeeEstimate: <TApi, TRes>({ api, tx, origin, destination, currency, senderAddress, feeAsset }: TGetOriginXcmFeeEstimateOptions<TApi, TRes>) => Promise<TGetXcmFeeEstimateDetail>;
1908
1971
 
1909
- declare const getXcmFee: <TApi, TRes>({ api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig }: TGetXcmFeeOptions<TApi, TRes>) => Promise<TGetXcmFeeResult>;
1972
+ type XcmFeeHopResult = {
1973
+ fee?: bigint;
1974
+ feeType?: TFeeType;
1975
+ sufficient?: boolean;
1976
+ dryRunError?: string;
1977
+ forwardedXcms?: any;
1978
+ destParaId?: number;
1979
+ currency?: string;
1980
+ };
1981
+ declare const getXcmFee: <TApi, TRes, TDisableFallback extends boolean>({ api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig }: TGetXcmFeeOptions<TApi, TRes, TDisableFallback>) => Promise<TGetXcmFeeResult<TDisableFallback>>;
1910
1982
 
1911
1983
  declare const getXcmFeeEstimate: <TApi, TRes>(options: TGetXcmFeeEstimateOptions<TApi, TRes>) => Promise<TGetXcmFeeEstimateResult>;
1912
1984
 
@@ -2005,5 +2077,5 @@ declare const handleToAhTeleport: <TApi, TRes>(origin: TNodePolkadotKusama, inpu
2005
2077
 
2006
2078
  declare const validateAddress: (address: TAddress, node: TNodeWithRelayChains, isDestination?: boolean) => void;
2007
2079
 
2008
- export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, addXcmVersionHeader, assertAddressIsString, assertHasLocation, assertToIsString, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createApiInstanceForNode, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createMultiAsset, createVersionedMultiAssets, createX1Payload, deriveAccountId, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChainLocation, getChainVersion, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getParaEthTransferFees, getParaId, getRelayChainOf, getTNode, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, localizeLocation, maybeOverrideMultiAsset, maybeOverrideMultiAssets, resolveModuleError, resolveParaId, reverseTransformMultiLocation, send, sortMultiAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, validateAddress, verifyEdOnDestination };
2009
- export type { IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimOptions, TAssetClaimOptionsBase, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestination, TDryRunBaseOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunNodeFailure, TDryRunNodeResult, TDryRunNodeResultInternal, TDryRunNodeSuccess, TDryRunOptions, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEdJsonMap, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmNodeFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestNodeBaseOptions, TGetFeeForDestNodeOptions, 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, TNodeConfig, TNodeConfigMap, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeHopInfo, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
2080
+ export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, addEthereumBridgeFees, addXcmVersionHeader, assertAddressIsString, assertHasLocation, assertToIsString, blake2b256, blake2b512, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createApiInstanceForNode, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createMultiAsset, createVersionedMultiAssets, createX1Payload, deriveAccountId, dryRun, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChainLocation, getChainVersion, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getParaEthTransferFees, getParaId, getRelayChainOf, getTNode, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, localizeLocation, maybeOverrideMultiAsset, maybeOverrideMultiAssets, resolveModuleError, resolveParaId, reverseTransformMultiLocation, send, sortMultiAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination };
2081
+ export type { HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimOptions, TAssetClaimOptionsBase, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunNodeFailure, TDryRunNodeResult, TDryRunNodeResultInternal, TDryRunNodeSuccess, TDryRunOptions, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEdJsonMap, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmNodeFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestNodeBaseOptions, TGetFeeForDestNodeOptions, 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, TNodeConfig, TNodeConfigMap, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress, XcmFeeHopResult };