@hyperbridge/sdk 1.8.4 → 1.8.6-rc.1

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.
@@ -9,6 +9,7 @@ import { SignerOptions, SubmittableExtrinsic } from '@polkadot/api/types';
9
9
  import { ISubmittableResult } from '@polkadot/types/types';
10
10
  import { Chain } from 'viem/chains';
11
11
  import { TronWeb } from 'tronweb';
12
+ export { Account as ViemAccount } from 'viem/accounts';
12
13
 
13
14
  declare const _default: {
14
15
  ABI: readonly [{
@@ -612,7 +613,7 @@ declare class ChainConfigService {
612
613
  getExtAsset(chain: string): HexString | undefined;
613
614
  getExtDecimals(chain: string): number | undefined;
614
615
  getChainId(chain: string): number;
615
- getConsensusStateId(chain: string): HexString;
616
+ getConsensusStateId(chain: string): string;
616
617
  getHyperbridgeChainId(): number;
617
618
  getRpcUrl(chain: string): string;
618
619
  getUniswapRouterV2Address(chain: string): HexString;
@@ -874,6 +875,7 @@ declare function requestCommitmentKey(key: Hex): {
874
875
  slot1: Hex;
875
876
  slot2: Hex;
876
877
  };
878
+ declare function responseCommitmentKey(key: Hex): Hex;
877
879
  /**
878
880
  * Derives the storage slot for a specific field in the StateCommitment struct
879
881
  *
@@ -1549,6 +1551,63 @@ declare class TronChain implements IChain {
1549
1551
  }>;
1550
1552
  }
1551
1553
 
1554
+ /**
1555
+ * Full chain params: EVM JSON-RPC + Ismp host plus a Substrate JSON-RPC URL for proof queries.
1556
+ */
1557
+ type PolkadotHubChainParams = EvmChainParams & {
1558
+ substrateRpcUrl: string;
1559
+ };
1560
+ /**
1561
+ * Polkadot Hub (EVM on Substrate / Revive): EVM RPC + host for reads and txs; Substrate RPC for
1562
+ * child-trie proofs aligned with `tesseract/messaging/substrate-evm` (`query_requests_proof` /
1563
+ * `query_state_proof`).
1564
+ */
1565
+ declare class PolkadotHubChain implements IChain {
1566
+ private readonly params;
1567
+ private readonly evm;
1568
+ private readonly substrateRpc;
1569
+ static fromParams(params: PolkadotHubChainParams): PolkadotHubChain;
1570
+ /**
1571
+ * Creates a `PolkadotHubChain` by auto-detecting the EVM chain ID and `IsmpHost` address via
1572
+ * {@link EvmChain.create}, plus a Substrate RPC URL for Revive child-trie proofs.
1573
+ *
1574
+ * @param evmRpcUrl - HTTP(S) JSON-RPC URL of the EVM (Revive) node
1575
+ * @param substrateRpcUrl - Substrate node RPC (HTTP or WebSocket) for proof queries
1576
+ * @param bundlerUrl - Optional ERC-4337 bundler URL (forwarded to `EvmChain.create`)
1577
+ */
1578
+ static create(evmRpcUrl: string, substrateRpcUrl: string, bundlerUrl?: string): Promise<PolkadotHubChain>;
1579
+ private constructor();
1580
+ get client(): PublicClient;
1581
+ get host(): HexString;
1582
+ get bundlerUrl(): string | undefined;
1583
+ get configService(): ChainConfigService;
1584
+ get config(): IPolkadotHubConfig;
1585
+ private hostAddress20;
1586
+ private fetchCombinedProof;
1587
+ timestamp(): Promise<bigint>;
1588
+ requestReceiptKey(commitment: HexString): HexString;
1589
+ queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1590
+ queryProof(message: IMessage, _counterparty: string, at?: bigint): Promise<HexString>;
1591
+ queryStateProof(at: bigint, keys: HexString[], _address?: HexString): Promise<HexString>;
1592
+ encode(message: IIsmpMessage): HexString;
1593
+ latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1594
+ challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
1595
+ stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1596
+ getHostNonce(): Promise<bigint>;
1597
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1598
+ getFeeTokenWithDecimals(): Promise<{
1599
+ address: HexString;
1600
+ decimals: number;
1601
+ }>;
1602
+ getPlaceOrderCalldata(txHash: string, intentGatewayAddress: string): Promise<HexString>;
1603
+ estimateGas(request: IPostRequest): Promise<{
1604
+ gas: bigint;
1605
+ postRequestCalldata: HexString;
1606
+ }>;
1607
+ broadcastTransaction(signedTransaction: HexString): Promise<TransactionReceipt>;
1608
+ getTransactionReceipt(hash: HexString): Promise<TransactionReceipt>;
1609
+ }
1610
+
1552
1611
  /**
1553
1612
  * Type representing an ISMP message.
1554
1613
  */
@@ -1660,7 +1719,7 @@ interface IChain {
1660
1719
  /**
1661
1720
  * Returns the configuration for this chain
1662
1721
  */
1663
- get config(): IEvmConfig | ISubstrateConfig;
1722
+ get config(): IEvmConfig | ISubstrateConfig | IPolkadotHubConfig;
1664
1723
  timestamp(): Promise<bigint>;
1665
1724
  /**
1666
1725
  * Returns the state trie key for the request-receipt storage item for the given request commitment.
@@ -1691,7 +1750,7 @@ interface IChain {
1691
1750
  stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1692
1751
  }
1693
1752
  /**
1694
- * Interface for EVM-compatible chains (EVM and Tron).
1753
+ * Interface for EVM-compatible chains (EVM, Tron, Polkadot Hub).
1695
1754
  * Extends IChain with methods required by IntentGatewayV2 and other EVM-specific protocols.
1696
1755
  */
1697
1756
  interface IEvmChain extends IChain {
@@ -1712,8 +1771,8 @@ interface IEvmChain extends IChain {
1712
1771
  type EstimateGasCallData = ContractFunctionArgs<typeof _default.ABI, "nonpayable" | "payable", "handlePostRequests">;
1713
1772
  type HexString = `0x${string}`;
1714
1773
  interface IConfig {
1715
- source: IEvmConfig | ISubstrateConfig;
1716
- dest: IEvmConfig | ISubstrateConfig;
1774
+ source: IEvmConfig | ISubstrateConfig | IPolkadotHubConfig;
1775
+ dest: IEvmConfig | ISubstrateConfig | IPolkadotHubConfig;
1717
1776
  hyperbridge: IHyperbridgeConfig;
1718
1777
  tracing?: boolean;
1719
1778
  }
@@ -1723,6 +1782,13 @@ interface IEvmConfig {
1723
1782
  host: HexString;
1724
1783
  consensusStateId: string;
1725
1784
  }
1785
+ /**
1786
+ * EVM-on-Substrate (e.g. Polkadot Hub) — same as {@link IEvmConfig} plus a Substrate node RPC URL
1787
+ * used for `state_getReadProof` / `state_getChildReadProof` (Revive child trie proofs).
1788
+ */
1789
+ interface IPolkadotHubConfig extends IEvmConfig {
1790
+ substrateRpcUrl: string;
1791
+ }
1726
1792
  interface ISubstrateConfig {
1727
1793
  wsUrl: string;
1728
1794
  consensusStateId: string;
@@ -2709,11 +2775,22 @@ interface PackedUserOperation {
2709
2775
  paymasterAndData: HexString;
2710
2776
  signature: HexString;
2711
2777
  }
2778
+ interface SigningAccount {
2779
+ /** Signs a bid message hash for a given chain. Returns a 65-byte ECDSA signature. */
2780
+ signMessage: (messageHash: HexString, chainId: number) => Promise<HexString>;
2781
+ /** Signs a raw 32-byte hash, returning split signature components for EIP-7702 etc. */
2782
+ signRawHash: (hash: HexString) => Promise<{
2783
+ r: HexString;
2784
+ s: HexString;
2785
+ yParity: number;
2786
+ }>;
2787
+ }
2712
2788
  interface SubmitBidOptions {
2713
2789
  order: Order;
2714
2790
  fillOptions: FillOptions;
2715
2791
  solverAccount: HexString;
2716
- solverPrivateKey: HexString;
2792
+ /** Canonical signer used for bid message signing and raw-hash operations. */
2793
+ solverSigner: SigningAccount;
2717
2794
  nonce: bigint;
2718
2795
  entryPointAddress: HexString;
2719
2796
  callGasLimit: bigint;
@@ -8034,4 +8111,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
8034
8111
  declare const getViemChain: (chainId: number) => Chain | undefined;
8035
8112
  declare const hyperbridgeAddress = "";
8036
8113
 
8037
- export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayContext, type IntentGatewayParams, ABI$1 as IntentGatewayV2ABI, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, IntentsCoprocessor, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteNativeResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, parseStateMachineId, polkadotAssetHubPaseo, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
8114
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BundlerGasEstimate, BundlerMethod, type CancelEvent, type CancelOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type DispatchGet, type DispatchInfo, type DispatchPost, ERC20Method, type ERC7821Call, ERC7821_BATCH_MODE, type EstimateFillOrderParams, type EstimateGasCallData, EvmChain, type EvmChainParams, ABI as EvmHostABI, EvmLanguage, type ExecuteIntentOrderOptions, type ExecutionResult, type FillOptions, type FillOrderEstimate, type FillerBid, type FillerConfig, type GetRequestResponse, type GetRequestWithStatus, type GetResponseByRequestIdResponse, type GetResponseStorageValues, type HexString, type HostParams, HyperClientStatus, type HyperbridgeTxEvents, type IChain, type IConfig, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPolkadotHubConfig, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, IndexerClient, type IndexerQueryClient, IntentGateway, type IntentGatewayContext, type IntentGatewayParams, ABI$1 as IntentGatewayV2ABI, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, IntentsCoprocessor, type IsmpRequest, MOCK_ADDRESS, type NewDeployment, ORDER_V2_PARAM_TYPE, type Order, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, PolkadotHubChain, type PolkadotHubChainParams, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteNativeResult, REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, type RequestBody, type RequestCommitment, RequestKind, type RequestResponse, RequestStatus, type RequestStatusKey, type RequestStatusWithMetadata, type ResponseCommitmentWithValues, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type SigningAccount, type StateMachineHeight, type StateMachineIdParams, type StateMachineResponse, type StateMachineUpdate, type StorageFacade, type SubmitBidOptions, SubstrateChain, Swap, TESTNET_CHAINS, type TeleportParams, TeleportStatus, TimeoutStatus, type TimeoutStatusKey, TokenGateway, type TokenGatewayAssetTeleportedResponse, type TokenGatewayAssetTeleportedWithStatus, type TokenInfo, type TokenPrice, type TokenPricesResponse, type Transaction, TronChain, type TronChainParams, USE_ETHERSCAN_CHAINS, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, orderCommitment, parseStateMachineId, polkadotAssetHubPaseo, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };