@paraspell/sdk-core 8.12.0 → 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
@@ -77,6 +77,7 @@ type TPolkadotXCMTransferOptions<TApi, TRes> = {
77
77
  paraIdTo?: number;
78
78
  version?: Version;
79
79
  senderAddress?: string;
80
+ ahAddress?: string;
80
81
  pallet?: string;
81
82
  method?: string;
82
83
  };
@@ -141,9 +142,13 @@ type TSendBaseOptions = {
141
142
  */
142
143
  address: TAddress;
143
144
  /**
144
- * The optional sender address. A SS58
145
+ * The optional sender address. A SS58 or H160 format.
145
146
  */
146
147
  senderAddress?: string;
148
+ /**
149
+ * The optional asset hub address. A SS58 format only.
150
+ */
151
+ ahAddress?: string;
147
152
  /**
148
153
  * The destination node or multi-location
149
154
  */
@@ -487,6 +492,15 @@ type TNodeConfig = {
487
492
  };
488
493
  type TNodeConfigMap = Record<TNodeDotKsmWithRelayChains, TNodeConfig>;
489
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>;
490
504
  type TDryRunCallBaseOptions<TRes> = {
491
505
  /**
492
506
  * The transaction to dry-run
@@ -518,16 +532,27 @@ type TDryRunXcmBaseOptions = {
518
532
  origin: TNodeDotKsmWithRelayChains;
519
533
  };
520
534
  type TDryRunXcmOptions<TApi, TRes> = WithApi<TDryRunXcmBaseOptions, TApi, TRes>;
521
- type TDryRunResult = {
535
+ type TDryRunNodeSuccess = {
522
536
  success: true;
523
537
  fee: bigint;
524
538
  weight?: TWeight;
525
539
  forwardedXcms: any;
526
540
  destParaId?: number;
527
- } | {
541
+ };
542
+ type TDryRunNodeFailure = {
528
543
  success: false;
529
544
  failureReason: string;
530
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
+ };
531
556
  declare enum XTokensError {
532
557
  AssetHasNoReserve = "AssetHasNoReserve",
533
558
  NotCrossChainTransfer = "NotCrossChainTransfer",
@@ -669,6 +694,7 @@ type TGetFeeForDestNodeBaseOptions = {
669
694
  disableFallback: boolean;
670
695
  };
671
696
  type TGetFeeForDestNodeOptions<TApi, TRes> = WithApi<TGetFeeForDestNodeBaseOptions, TApi, TRes>;
697
+ type THubKey = 'assetHub' | 'bridgeHub';
672
698
  type TFeeType = 'dryRun' | 'paymentInfo';
673
699
  type TXcmFeeDetail = {
674
700
  fee: bigint;
@@ -723,8 +749,8 @@ interface IPolkadotApi<TApi, TRes> {
723
749
  blake2AsHex(data: Uint8Array): string;
724
750
  clone(): IPolkadotApi<TApi, TRes>;
725
751
  createApiForNode(node: TNodeWithRelayChains): Promise<IPolkadotApi<TApi, TRes>>;
726
- getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunResult>;
727
- getDryRunXcm(options: TDryRunXcmBaseOptions): Promise<TDryRunResult>;
752
+ getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunNodeResultInternal>;
753
+ getDryRunXcm(options: TDryRunXcmBaseOptions): Promise<TDryRunNodeResultInternal>;
728
754
  getBridgeStatus(): Promise<TBridgeStatus>;
729
755
  setDisconnectAllowed(allowed: boolean): void;
730
756
  getDisconnectAllowed(): boolean;
@@ -846,10 +872,24 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
846
872
  address(address: TAddress): GeneralBuilder<TApi, TRes, T & {
847
873
  address: TAddress;
848
874
  }>;
849
- address(address: TAddress, senderAddress: string): GeneralBuilder<TApi, TRes, T & {
850
- 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 & {
851
882
  senderAddress: string;
852
883
  }>;
884
+ /**
885
+ * Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
886
+ *
887
+ * @param address - The address to be used.
888
+ * @returns An instance of Builder
889
+ */
890
+ ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, T & {
891
+ ahAddress: string | undefined;
892
+ }>;
853
893
  /**
854
894
  * Sets the XCM version to be used for the transfer.
855
895
  *
@@ -899,7 +939,7 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
899
939
  * @returns A Promise that resolves to the transfer extrinsic.
900
940
  */
901
941
  build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
902
- dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>, senderAddress: string): Promise<TDryRunResult>;
942
+ dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
903
943
  /**
904
944
  * Estimates the XCM fee for the transfer using paymentInfo function.
905
945
  *
@@ -1628,6 +1668,10 @@ declare const getTransferInfo: <TApi, TRes>({ origin, destination, accountOrigin
1628
1668
 
1629
1669
  declare const verifyEdOnDestination: <TApi, TRes>(options: TVerifyEdOnDestinationOptions<TApi, TRes>) => Promise<boolean>;
1630
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
+
1631
1675
  declare const getParaEthTransferFees: <TApi, TRes>(ahApi: IPolkadotApi<TApi, TRes>) => Promise<[bigint, bigint]>;
1632
1676
 
1633
1677
  declare const transferMoonbeamEvm: <TApi, TRes>({ api, from, to, signer, address, currency }: TEvmBuilderOptions<TApi, TRes>) => Promise<string>;
@@ -1643,8 +1687,6 @@ declare const getXcmFeeEstimate: <TApi, TRes>({ api, tx, origin, destination, ad
1643
1687
 
1644
1688
  declare const getBridgeStatus: <TApi, TRes>(api: IPolkadotApi<TApi, TRes>) => Promise<TBridgeStatus>;
1645
1689
 
1646
- declare const getDryRun: <TApi, TRes>(options: TDryRunCallOptions<TApi, TRes>) => Promise<TDryRunResult>;
1647
-
1648
1690
  declare const send: <TApi, TRes>(options: TSendOptions<TApi, TRes>) => Promise<TRes>;
1649
1691
 
1650
1692
  declare const transferRelayToPara: <TApi, TRes>(options: TRelayToParaOptions<TApi, TRes>) => Promise<TRes>;
@@ -1696,5 +1738,5 @@ declare const validateAddress: (address: TAddress, node: TNodeWithRelayChains, i
1696
1738
  */
1697
1739
  declare const determineRelayChain: (node: TNodeWithRelayChains) => TRelaychain;
1698
1740
 
1699
- 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 };
1700
- 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 };