@paraspell/sdk-core 8.5.1 → 8.5.3

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
@@ -1,5 +1,5 @@
1
- import { Signer, AbstractProvider } from 'ethers';
2
- import { WalletClient } from 'viem';
1
+ import { Signer, AbstractProvider, Contract } from 'ethers';
2
+ import { WalletClient, GetContractReturnType, Abi } from 'viem';
3
3
 
4
4
  type WithApi<TBase, TApi, TRes> = TBase & {
5
5
  api: IPolkadotApi<TApi, TRes>;
@@ -354,7 +354,7 @@ type TCurrencyCoreWithFee = WithAmount<TCurrencyCore> & {
354
354
  type TMultiAssetWithFee = TMultiAsset & {
355
355
  isFeeAsset?: boolean;
356
356
  };
357
- type TMultiLocationValue = string | TMultiLocation | TJunction[];
357
+ type TMultiLocationValue = string | TMultiLocation;
358
358
  type TMultiLocationValueWithOverride = TMultiLocationValue | TOverrideMultiLocationSpecifier;
359
359
  type TCurrencyInputWithAmount = WithAmount<TCurrencySymbol | {
360
360
  id: TCurrency;
@@ -460,7 +460,6 @@ type TNativeAsset = TBaseAsset & {
460
460
  type TForeignAsset = TBaseAsset & AtLeastOne<{
461
461
  assetId?: string;
462
462
  multiLocation?: object;
463
- xcmInterior?: object[];
464
463
  }>;
465
464
  type TAsset = TNativeAsset | TForeignAsset;
466
465
  type TNodeAssets = {
@@ -485,7 +484,7 @@ type TPolkadotXCMTransferOptions<TApi, TRes> = {
485
484
  paraIdTo?: number;
486
485
  overriddenAsset?: TMultiLocation | TMultiAssetWithFee[];
487
486
  version?: Version;
488
- ahAddress?: string;
487
+ senderAddress?: string;
489
488
  pallet?: string;
490
489
  method?: string;
491
490
  };
@@ -551,9 +550,9 @@ type TSendBaseOptions = {
551
550
  */
552
551
  address: TAddress;
553
552
  /**
554
- * The optional AssetHub address used when transfering to Ethereum
553
+ * The optional sender address. A SS58
555
554
  */
556
- ahAddress?: string;
555
+ senderAddress?: string;
557
556
  /**
558
557
  * The destination node or multi-location
559
558
  */
@@ -1077,7 +1076,7 @@ interface IFinalBuilder<TRes> {
1077
1076
  build: () => Promise<TRes>;
1078
1077
  }
1079
1078
  interface IAddressBuilder<TApi, TRes> {
1080
- address: (address: TAddress, ahAddress?: string) => IFinalBuilderWithOptions<TApi, TRes>;
1079
+ address: (address: TAddress, senderAddress?: string) => IFinalBuilderWithOptions<TApi, TRes>;
1081
1080
  }
1082
1081
  interface IFungibleBuilder<TRes> {
1083
1082
  fungible: (multiAssets: TMultiAsset[]) => IAccountBuilder<TRes>;
@@ -1230,10 +1229,6 @@ type TGetOriginFeeDetailsOptionsBase = {
1230
1229
  * The destination account.
1231
1230
  */
1232
1231
  accountDestination: string;
1233
- /**
1234
- * The AssetHub address
1235
- */
1236
- ahAccount?: string;
1237
1232
  /**
1238
1233
  * The fee margin percentage.
1239
1234
  */
@@ -1287,6 +1282,12 @@ type TGetTransferableAmountOptionsBase = {
1287
1282
  currency: TCurrencyCore;
1288
1283
  };
1289
1284
  type TGetTransferableAmountOptions<TApi, TRes> = WithApi<TGetTransferableAmountOptionsBase, TApi, TRes>;
1285
+ type TVerifyEdOnDestinationOptionsBase = {
1286
+ node: TNodeDotKsmWithRelayChains;
1287
+ address: string;
1288
+ currency: WithAmount<TCurrencyCore>;
1289
+ };
1290
+ type TVerifyEdOnDestinationOptions<TApi, TRes> = WithApi<TVerifyEdOnDestinationOptionsBase, TApi, TRes>;
1290
1291
 
1291
1292
  interface IPolkadotApi<TApi, TRes> {
1292
1293
  setApi(api?: TApiOrUrl<TApi>): void;
@@ -1294,10 +1295,12 @@ interface IPolkadotApi<TApi, TRes> {
1294
1295
  getApiOrUrl(): TApiOrUrl<TApi> | undefined;
1295
1296
  init(node: TNodeWithRelayChains): Promise<void>;
1296
1297
  createApiInstance: (wsUrl: string | string[]) => Promise<TApi>;
1297
- createAccountId(address: string): string;
1298
1298
  accountToHex(address: string, isPrefixed?: boolean): string;
1299
1299
  callTxMethod(serializedCall: TSerializedApiCall): TRes;
1300
1300
  callBatchMethod(calls: TRes[], mode: BatchMode): TRes;
1301
+ objectToHex(obj: unknown, typeName: string): Promise<string>;
1302
+ hexToUint8a(hex: string): Uint8Array;
1303
+ stringToUint8a(str: string): Uint8Array;
1301
1304
  calculateTransactionFee(tx: TRes, address: string): Promise<bigint>;
1302
1305
  getBalanceNative(address: string): Promise<bigint>;
1303
1306
  getBalanceNativeAcala(address: string, symbol: string): Promise<bigint>;
@@ -1308,7 +1311,8 @@ interface IPolkadotApi<TApi, TRes> {
1308
1311
  getBalanceForeignXTokens(node: TNodePolkadotKusama, address: string, asset: TAsset): Promise<bigint>;
1309
1312
  getBalanceForeignBifrost(address: string, asset: TAsset): Promise<bigint>;
1310
1313
  getBalanceForeignAssetsAccount(address: string, assetId: bigint | number): Promise<bigint>;
1311
- getFromStorage(key: string): Promise<string>;
1314
+ getFromRpc(module: string, method: string, key: string): Promise<string>;
1315
+ blake2AsHex(data: Uint8Array): string;
1312
1316
  clone(): IPolkadotApi<TApi, TRes>;
1313
1317
  createApiForNode(node: TNodeWithRelayChains): Promise<IPolkadotApi<TApi, TRes>>;
1314
1318
  getDryRun(options: TDryRunBaseOptions<TRes>): Promise<TDryRunResult>;
@@ -1325,8 +1329,13 @@ declare const getDryRun: <TApi, TRes>(options: TDryRunOptions<TApi, TRes>) => Pr
1325
1329
 
1326
1330
  declare const transferMoonbeamEvm: <TApi, TRes>({ api, from, to, signer, address, currency }: TEvmBuilderOptions<TApi, TRes>) => Promise<string>;
1327
1331
 
1332
+ declare const transferMoonbeamToEth: <TApi, TRes>({ api, from, to, signer, address, ahAddress, currency }: TEvmBuilderOptions<TApi, TRes>) => Promise<string>;
1333
+
1328
1334
  declare const getParaEthTransferFees: <TApi, TRes>(ahApi: IPolkadotApi<TApi, TRes>) => Promise<[bigint, bigint]>;
1329
1335
 
1336
+ declare const isEthersSigner: (signer: Signer | WalletClient) => signer is Signer;
1337
+ declare const isEthersContract: (contract: Contract | GetContractReturnType<Abi | readonly unknown[]>) => contract is Contract;
1338
+
1330
1339
  declare const getAssetMultiLocation: (node: TNodeWithRelayChains, currency: TCurrencyInput) => TMultiLocation | null;
1331
1340
 
1332
1341
  /**
@@ -1428,7 +1437,7 @@ declare const getBalanceNative: <TApi, TRes>(options: TGetBalanceNativeOptions<T
1428
1437
  declare const getBalanceForeignInternal: <TApi, TRes>({ address, node, currency, api }: TGetBalanceForeignOptions<TApi, TRes>) => Promise<bigint>;
1429
1438
  declare const getBalanceForeign: <TApi, TRes>(options: TGetBalanceForeignOptions<TApi, TRes>) => Promise<bigint>;
1430
1439
 
1431
- declare const getOriginFeeDetailsInternal: <TApi, TRes>({ api, account, accountDestination, ahAccount, currency, origin, destination, feeMarginPercentage }: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
1440
+ declare const getOriginFeeDetailsInternal: <TApi, TRes>({ api, account, accountDestination, currency, origin, destination, feeMarginPercentage }: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
1432
1441
  declare const getOriginFeeDetails: <TApi, TRes>(options: TGetOriginFeeDetailsOptions<TApi, TRes>) => Promise<TOriginFeeDetails>;
1433
1442
 
1434
1443
  declare const getTransferInfo: <TApi, TRes>({ origin, destination, accountOrigin, accountDestination, currency, api }: TGetTransferInfoOptions<TApi, TRes>) => Promise<TTransferInfo>;
@@ -1478,7 +1487,9 @@ declare const findBestMatches: <T extends {
1478
1487
  declare const findAssetBySymbol: (node: TNodeWithRelayChains, destination: TNodeWithRelayChains | null, otherAssets: TForeignAsset[], nativeAssets: TNativeAsset[], symbol: TCurrencySymbolValue) => TAsset | undefined;
1479
1488
  declare const findAssetById: (assets: TForeignAsset[], assetId: TCurrency) => TForeignAsset | undefined;
1480
1489
 
1481
- declare const findAssetByMultiLocation: (foreignAssets: TForeignAsset[], multiLocation: string | TMultiLocation | TJunction[]) => TForeignAsset | undefined;
1490
+ declare const findAssetByMultiLocation: (foreignAssets: TForeignAsset[], multiLocation: string | TMultiLocation) => TForeignAsset | undefined;
1491
+
1492
+ declare const verifyEdOnDestination: <TApi, TRes>(options: TVerifyEdOnDestinationOptions<TApi, TRes>) => Promise<boolean>;
1482
1493
 
1483
1494
  /**
1484
1495
  * Retrieves the default pallet for a specified node.
@@ -1514,7 +1525,7 @@ declare class GeneralBuilder<TApi, TRes> implements IToBuilder<TApi, TRes>, ICur
1514
1525
  private _currency;
1515
1526
  private _paraIdTo?;
1516
1527
  private _address;
1517
- private _ahAddress?;
1528
+ private _senderAddress?;
1518
1529
  private _version?;
1519
1530
  private _pallet?;
1520
1531
  private _method?;
@@ -1554,7 +1565,7 @@ declare class GeneralBuilder<TApi, TRes> implements IToBuilder<TApi, TRes>, ICur
1554
1565
  * @param address - The destination address.
1555
1566
  * @returns An instance of Builder
1556
1567
  */
1557
- address(address: TAddress, ahAddress?: string): this;
1568
+ address(address: TAddress, senderAddress?: string): this;
1558
1569
  /**
1559
1570
  * Sets the XCM version to be used for the transfer.
1560
1571
  *
@@ -1761,4 +1772,4 @@ declare const getNodeProviders: (node: TNodeDotKsmWithRelayChains) => string[];
1761
1772
  */
1762
1773
  declare const getParaId: (node: TNodeWithRelayChains) => number;
1763
1774
 
1764
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, Foreign, ForeignAbstract, GeneralBuilder, type IAccountBuilder, type IAddToBatchBuilder, type IAddressBuilder, type ICurrencyBuilder, type IFinalBuilder, type IFinalBuilderWithOptions, type IFromBuilder, type IFungibleBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IToBuilder, type IVersionBuilder, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiOrUrl, type TAsset, type TAssetJsonMap, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyCoreWithFee, type TCurrencyInput, type TCurrencyInputWithAmount, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TCurrencySymbolValue, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEcosystemType, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TJunction, type TJunctionGeneralIndex, type TJunctionParachain, type TJunctionType, type TJunctions, type TMantaAsset, type TModuleError, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiAssetWithFee, type TMultiLocation, type TMultiLocationHeader, type TMultiLocationValue, type TMultiLocationValueWithOverride, type TNativeAsset, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeConfig, type TNodeConfigMap, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TOverrideMultiLocationSpecifier, type TPallet, type TPalletDetails, type TPalletJsonMap, type TPalletMap, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayChainSymbol, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TSymbolSpecifier, type TTransferInfo, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TZeitgeistAsset, Version, type WithAmount, type WithApi, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaEthTransferFees, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferRelayToPara, validateAddress };
1775
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, Foreign, ForeignAbstract, GeneralBuilder, type IAccountBuilder, type IAddToBatchBuilder, type IAddressBuilder, type ICurrencyBuilder, type IFinalBuilder, type IFinalBuilderWithOptions, type IFromBuilder, type IFungibleBuilder, type IPolkadotApi, type IPolkadotXCMTransfer, type IToBuilder, type IVersionBuilder, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TApiOrUrl, type TAsset, type TAssetJsonMap, type TBalanceResponse, type TBatchOptions, type TBifrostToken, type TCurrency, type TCurrencyCore, type TCurrencyCoreWithFee, type TCurrencyInput, type TCurrencyInputWithAmount, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TCurrencySelectionV4, type TCurrencySymbol, type TCurrencySymbolValue, type TDestWeight, type TDestination, type TDryRunBaseOptions, type TDryRunOptions, type TDryRunResult, type TEcosystemType, type TEdJsonMap, type TEvmBuilderOptions, type TEvmBuilderOptionsBase, type TForeignAsset, type TForeignAssetId, type TForeignOrNativeAsset, type TForeignOrTokenAsset, type TGetAssetBalanceOptions, type TGetAssetBalanceOptionsBase, type TGetBalanceForeignOptions, type TGetBalanceForeignOptionsBase, type TGetBalanceNativeOptions, type TGetBalanceNativeOptionsBase, type TGetMaxForeignTransferableAmountOptions, type TGetMaxForeignTransferableAmountOptionsBase, type TGetMaxNativeTransferableAmountOptions, type TGetMaxNativeTransferableAmountOptionsBase, type TGetOriginFeeDetailsOptions, type TGetOriginFeeDetailsOptionsBase, type TGetTransferInfoOptions, type TGetTransferInfoOptionsBase, type TGetTransferableAmountOptions, type TGetTransferableAmountOptionsBase, type TJunction, type TJunctionGeneralIndex, type TJunctionParachain, type TJunctionType, type TJunctions, type TMantaAsset, type TModuleError, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiAssetWithFee, type TMultiLocation, type TMultiLocationHeader, type TMultiLocationValue, type TMultiLocationValueWithOverride, type TNativeAsset, type TNativeTokenAsset, type TNode, type TNodeAssets, type TNodeConfig, type TNodeConfigMap, type TNodeDotKsmWithRelayChains, type TNodePolkadotKusama, type TNodeWithRelayChains, type TNodleAsset, type TOptionalEvmBuilderOptions, type TOriginFeeDetails, type TOtherReserveAsset, type TOverrideMultiLocationSpecifier, type TPallet, type TPalletDetails, type TPalletJsonMap, type TPalletMap, type TPolkadotXCMTransferOptions, type TPolkadotXcmSection, type TProviderEntry, type TRelayChainSymbol, type TRelayToParaDestination, type TRelayToParaOptions, type TRelayToParaOverrides, type TRelaychain, type TReserveAsset, type TScenario, type TSelfReserveAsset, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSerializeEthTransferOptions, type TSerializedApiCall, type TSerializedEthTransfer, type TSymbolSpecifier, type TTransferInfo, type TVerifyEdOnDestinationOptions, type TVerifyEdOnDestinationOptionsBase, type TVersionClaimAssets, type TXTokensCurrencySelection, type TXTokensSection, type TXTokensTransferOptions, type TXTransferSection, type TXTransferTransferOptions, type TXcmAsset, type TXcmForeignAsset, type TXcmPalletSection, type TZeitgeistAsset, Version, type WithAmount, type WithApi, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, deepEqual, determineRelayChain, findAssetById, findAssetByMultiLocation, findAssetBySymbol, findBestMatches, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssetMultiLocation, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaEthTransferFees, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isEthersContract, isEthersSigner, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, isSymbolSpecifier, normalizeSymbol, resolveModuleError, resolveParaId, send, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, validateAddress, verifyEdOnDestination };