@paraspell/sdk-core 8.12.1 → 8.13.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
@@ -492,6 +492,15 @@ type TNodeConfig = {
492
492
  };
493
493
  type TNodeConfigMap = Record<TNodeDotKsmWithRelayChains, TNodeConfig>;
494
494
 
495
+ type TDryRunBaseOptions<TRes> = {
496
+ tx: TRes;
497
+ origin: TNodeDotKsmWithRelayChains;
498
+ destination: TNodeDotKsmWithRelayChains;
499
+ senderAddress: string;
500
+ address: string;
501
+ currency: TCurrencyInputWithAmount;
502
+ };
503
+ type TDryRunOptions<TApi, TRes> = WithApi<TDryRunBaseOptions<TRes>, TApi, TRes>;
495
504
  type TDryRunCallBaseOptions<TRes> = {
496
505
  /**
497
506
  * The transaction to dry-run
@@ -523,16 +532,27 @@ type TDryRunXcmBaseOptions = {
523
532
  origin: TNodeDotKsmWithRelayChains;
524
533
  };
525
534
  type TDryRunXcmOptions<TApi, TRes> = WithApi<TDryRunXcmBaseOptions, TApi, TRes>;
526
- type TDryRunResult = {
535
+ type TDryRunNodeSuccess = {
527
536
  success: true;
528
537
  fee: bigint;
529
538
  weight?: TWeight;
530
539
  forwardedXcms: any;
531
540
  destParaId?: number;
532
- } | {
541
+ };
542
+ type TDryRunNodeFailure = {
533
543
  success: false;
534
544
  failureReason: string;
535
545
  };
546
+ type TDryRunNodeResultInternal = TDryRunNodeSuccess | TDryRunNodeFailure;
547
+ type TDryRunNodeResult = (TDryRunNodeSuccess & {
548
+ currency: string;
549
+ }) | TDryRunNodeFailure;
550
+ type TDryRunResult = {
551
+ origin: TDryRunNodeResult;
552
+ destination?: TDryRunNodeResult;
553
+ assetHub?: TDryRunNodeResult;
554
+ bridgeHub?: TDryRunNodeResult;
555
+ };
536
556
  declare enum XTokensError {
537
557
  AssetHasNoReserve = "AssetHasNoReserve",
538
558
  NotCrossChainTransfer = "NotCrossChainTransfer",
@@ -674,6 +694,7 @@ type TGetFeeForDestNodeBaseOptions = {
674
694
  disableFallback: boolean;
675
695
  };
676
696
  type TGetFeeForDestNodeOptions<TApi, TRes> = WithApi<TGetFeeForDestNodeBaseOptions, TApi, TRes>;
697
+ type THubKey = 'assetHub' | 'bridgeHub';
677
698
  type TFeeType = 'dryRun' | 'paymentInfo';
678
699
  type TXcmFeeDetail = {
679
700
  fee: bigint;
@@ -728,8 +749,8 @@ interface IPolkadotApi<TApi, TRes> {
728
749
  blake2AsHex(data: Uint8Array): string;
729
750
  clone(): IPolkadotApi<TApi, TRes>;
730
751
  createApiForNode(node: TNodeWithRelayChains): Promise<IPolkadotApi<TApi, TRes>>;
731
- getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunResult>;
732
- getDryRunXcm(options: TDryRunXcmBaseOptions): Promise<TDryRunResult>;
752
+ getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunNodeResultInternal>;
753
+ getDryRunXcm(options: TDryRunXcmBaseOptions): Promise<TDryRunNodeResultInternal>;
733
754
  getBridgeStatus(): Promise<TBridgeStatus>;
734
755
  setDisconnectAllowed(allowed: boolean): void;
735
756
  getDisconnectAllowed(): boolean;
@@ -851,8 +872,13 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
851
872
  address(address: TAddress): GeneralBuilder<TApi, TRes, T & {
852
873
  address: TAddress;
853
874
  }>;
854
- address(address: TAddress, senderAddress: string): GeneralBuilder<TApi, TRes, T & {
855
- address: TAddress;
875
+ /**
876
+ * Sets the sender address.
877
+ *
878
+ * @param address - The sender address.
879
+ * @returns
880
+ */
881
+ senderAddress(address: string): GeneralBuilder<TApi, TRes, T & {
856
882
  senderAddress: string;
857
883
  }>;
858
884
  /**
@@ -913,7 +939,7 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
913
939
  * @returns A Promise that resolves to the transfer extrinsic.
914
940
  */
915
941
  build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
916
- dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>, senderAddress: string): Promise<TDryRunResult>;
942
+ dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
917
943
  /**
918
944
  * Estimates the XCM fee for the transfer using paymentInfo function.
919
945
  *
@@ -1642,6 +1668,10 @@ declare const getTransferInfo: <TApi, TRes>({ origin, destination, accountOrigin
1642
1668
 
1643
1669
  declare const verifyEdOnDestination: <TApi, TRes>(options: TVerifyEdOnDestinationOptions<TApi, TRes>) => Promise<boolean>;
1644
1670
 
1671
+ declare const dryRun: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>) => Promise<TDryRunResult>;
1672
+
1673
+ declare const dryRunOrigin: <TApi, TRes>(options: TDryRunCallOptions<TApi, TRes>) => Promise<TDryRunNodeResult>;
1674
+
1645
1675
  declare const getParaEthTransferFees: <TApi, TRes>(ahApi: IPolkadotApi<TApi, TRes>) => Promise<[bigint, bigint]>;
1646
1676
 
1647
1677
  declare const transferMoonbeamEvm: <TApi, TRes>({ api, from, to, signer, address, currency }: TEvmBuilderOptions<TApi, TRes>) => Promise<string>;
@@ -1657,8 +1687,6 @@ declare const getXcmFeeEstimate: <TApi, TRes>({ api, tx, origin, destination, ad
1657
1687
 
1658
1688
  declare const getBridgeStatus: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => Promise<TBridgeStatus>;
1659
1689
 
1660
- declare const getDryRun: <TApi, TRes>(options: TDryRunCallOptions<TApi, TRes>) => Promise<TDryRunResult>;
1661
-
1662
1690
  declare const send: <TApi, TRes>(options: TSendOptions<TApi, TRes>) => Promise<TRes>;
1663
1691
 
1664
1692
  declare const transferRelayToPara: <TApi, TRes>(options: TRelayToParaOptions<TApi, TRes>) => Promise<TRes>;
@@ -1710,5 +1738,5 @@ declare const validateAddress: (address: TAddress, node: TNodeWithRelayChains, i
1710
1738
  */
1711
1739
  declare const determineRelayChain: (node: TNodeWithRelayChains) => TRelaychain;
1712
1740
 
1713
- export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, determineRelayChain, generateAddressMultiLocationV4, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getDryRun, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, getXcmFee, getXcmFeeEstimate, isEthersContract, isEthersSigner, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
1714
- export type { IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimOptions, TAssetClaimOptionsBase, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TCreateBeneficiaryOptions, TDestWeight, TDestination, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEdJsonMap, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmNodeFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestNodeBaseOptions, TGetFeeForDestNodeOptions, TGetFeeForOriginNodeBaseOptions, TGetFeeForOriginNodeOptions, TGetMaxForeignTransferableAmountOptions, TGetMaxForeignTransferableAmountOptionsBase, TGetMaxNativeTransferableAmountOptions, TGetMaxNativeTransferableAmountOptionsBase, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, TMantaAsset, TModuleError, TNativeTokenAsset, TNodeConfig, TNodeConfigMap, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmSection, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TRelaychain, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TTransferInfo, TTransferLocalOptions, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TVersionClaimAssets, TWeight, TXTokensCurrencySelection, TXTokensSection, TXTokensTransferOptions, TXTransferSection, TXTransferTransferOptions, TXcmAsset, TXcmFeeDetail, TXcmForeignAsset, TXcmPalletSection, TXcmVersioned, TZeitgeistAsset, WithApi };
1741
+ export { AssetClaimBuilder, BatchMode, BridgeHaltedError, Builder, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidParameterError, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXcmError, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createBeneficiaryMultiLocation, createVersionedBeneficiary, createX1Payload, determineRelayChain, dryRun, dryRunOrigin, generateAddressMultiLocationV4, getAssetBalance, getAssetBalanceInternal, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getParaEthTransferFees, getParaId, getTNode, getTransferInfo, getTransferableAmount, getXcmFee, getXcmFeeEstimate, isEthersContract, isEthersSigner, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, transformMultiLocation, validateAddress, verifyEdOnDestination };
1742
+ export type { IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimOptions, TAssetClaimOptionsBase, TBalanceResponse, TBatchOptions, TBifrostToken, TBridgeStatus, TCreateBeneficiaryOptions, TDestWeight, TDestination, TDryRunBaseOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunNodeFailure, TDryRunNodeResult, TDryRunNodeResultInternal, TDryRunNodeSuccess, TDryRunOptions, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEdJsonMap, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmNodeFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestNodeBaseOptions, TGetFeeForDestNodeOptions, TGetFeeForOriginNodeBaseOptions, TGetFeeForOriginNodeOptions, TGetMaxForeignTransferableAmountOptions, TGetMaxForeignTransferableAmountOptionsBase, TGetMaxNativeTransferableAmountOptions, TGetMaxNativeTransferableAmountOptionsBase, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodeConfig, TNodeConfigMap, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmSection, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TRelaychain, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TTransferInfo, TTransferLocalOptions, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TVersionClaimAssets, TWeight, TXTokensCurrencySelection, TXTokensSection, TXTokensTransferOptions, TXTransferSection, TXTransferTransferOptions, TXcmAsset, TXcmFeeDetail, TXcmForeignAsset, TXcmPalletSection, TXcmVersioned, TZeitgeistAsset, WithApi };