@hyperbridge/sdk 1.8.4 → 1.8.5

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.
@@ -612,7 +612,7 @@ declare class ChainConfigService {
612
612
  getExtAsset(chain: string): HexString | undefined;
613
613
  getExtDecimals(chain: string): number | undefined;
614
614
  getChainId(chain: string): number;
615
- getConsensusStateId(chain: string): HexString;
615
+ getConsensusStateId(chain: string): string;
616
616
  getHyperbridgeChainId(): number;
617
617
  getRpcUrl(chain: string): string;
618
618
  getUniswapRouterV2Address(chain: string): HexString;
@@ -874,6 +874,7 @@ declare function requestCommitmentKey(key: Hex): {
874
874
  slot1: Hex;
875
875
  slot2: Hex;
876
876
  };
877
+ declare function responseCommitmentKey(key: Hex): Hex;
877
878
  /**
878
879
  * Derives the storage slot for a specific field in the StateCommitment struct
879
880
  *
@@ -1549,6 +1550,63 @@ declare class TronChain implements IChain {
1549
1550
  }>;
1550
1551
  }
1551
1552
 
1553
+ /**
1554
+ * Full chain params: EVM JSON-RPC + Ismp host plus a Substrate JSON-RPC URL for proof queries.
1555
+ */
1556
+ type PolkadotHubChainParams = EvmChainParams & {
1557
+ substrateRpcUrl: string;
1558
+ };
1559
+ /**
1560
+ * Polkadot Hub (EVM on Substrate / Revive): EVM RPC + host for reads and txs; Substrate RPC for
1561
+ * child-trie proofs aligned with `tesseract/messaging/substrate-evm` (`query_requests_proof` /
1562
+ * `query_state_proof`).
1563
+ */
1564
+ declare class PolkadotHubChain implements IChain {
1565
+ private readonly params;
1566
+ private readonly evm;
1567
+ private readonly substrateRpc;
1568
+ static fromParams(params: PolkadotHubChainParams): PolkadotHubChain;
1569
+ /**
1570
+ * Creates a `PolkadotHubChain` by auto-detecting the EVM chain ID and `IsmpHost` address via
1571
+ * {@link EvmChain.create}, plus a Substrate RPC URL for Revive child-trie proofs.
1572
+ *
1573
+ * @param evmRpcUrl - HTTP(S) JSON-RPC URL of the EVM (Revive) node
1574
+ * @param substrateRpcUrl - Substrate node RPC (HTTP or WebSocket) for proof queries
1575
+ * @param bundlerUrl - Optional ERC-4337 bundler URL (forwarded to `EvmChain.create`)
1576
+ */
1577
+ static create(evmRpcUrl: string, substrateRpcUrl: string, bundlerUrl?: string): Promise<PolkadotHubChain>;
1578
+ private constructor();
1579
+ get client(): PublicClient;
1580
+ get host(): HexString;
1581
+ get bundlerUrl(): string | undefined;
1582
+ get configService(): ChainConfigService;
1583
+ get config(): IPolkadotHubConfig;
1584
+ private hostAddress20;
1585
+ private fetchCombinedProof;
1586
+ timestamp(): Promise<bigint>;
1587
+ requestReceiptKey(commitment: HexString): HexString;
1588
+ queryRequestReceipt(commitment: HexString): Promise<HexString | undefined>;
1589
+ queryProof(message: IMessage, _counterparty: string, at?: bigint): Promise<HexString>;
1590
+ queryStateProof(at: bigint, keys: HexString[], _address?: HexString): Promise<HexString>;
1591
+ encode(message: IIsmpMessage): HexString;
1592
+ latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1593
+ challengePeriod(stateMachineId: StateMachineIdParams): Promise<bigint>;
1594
+ stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1595
+ getHostNonce(): Promise<bigint>;
1596
+ quoteNative(request: IPostRequest | IGetRequest, fee: bigint): Promise<bigint>;
1597
+ getFeeTokenWithDecimals(): Promise<{
1598
+ address: HexString;
1599
+ decimals: number;
1600
+ }>;
1601
+ getPlaceOrderCalldata(txHash: string, intentGatewayAddress: string): Promise<HexString>;
1602
+ estimateGas(request: IPostRequest): Promise<{
1603
+ gas: bigint;
1604
+ postRequestCalldata: HexString;
1605
+ }>;
1606
+ broadcastTransaction(signedTransaction: HexString): Promise<TransactionReceipt>;
1607
+ getTransactionReceipt(hash: HexString): Promise<TransactionReceipt>;
1608
+ }
1609
+
1552
1610
  /**
1553
1611
  * Type representing an ISMP message.
1554
1612
  */
@@ -1660,7 +1718,7 @@ interface IChain {
1660
1718
  /**
1661
1719
  * Returns the configuration for this chain
1662
1720
  */
1663
- get config(): IEvmConfig | ISubstrateConfig;
1721
+ get config(): IEvmConfig | ISubstrateConfig | IPolkadotHubConfig;
1664
1722
  timestamp(): Promise<bigint>;
1665
1723
  /**
1666
1724
  * Returns the state trie key for the request-receipt storage item for the given request commitment.
@@ -1691,7 +1749,7 @@ interface IChain {
1691
1749
  stateMachineUpdateTime(stateMachineHeight: StateMachineHeight): Promise<bigint>;
1692
1750
  }
1693
1751
  /**
1694
- * Interface for EVM-compatible chains (EVM and Tron).
1752
+ * Interface for EVM-compatible chains (EVM, Tron, Polkadot Hub).
1695
1753
  * Extends IChain with methods required by IntentGatewayV2 and other EVM-specific protocols.
1696
1754
  */
1697
1755
  interface IEvmChain extends IChain {
@@ -1712,8 +1770,8 @@ interface IEvmChain extends IChain {
1712
1770
  type EstimateGasCallData = ContractFunctionArgs<typeof _default.ABI, "nonpayable" | "payable", "handlePostRequests">;
1713
1771
  type HexString = `0x${string}`;
1714
1772
  interface IConfig {
1715
- source: IEvmConfig | ISubstrateConfig;
1716
- dest: IEvmConfig | ISubstrateConfig;
1773
+ source: IEvmConfig | ISubstrateConfig | IPolkadotHubConfig;
1774
+ dest: IEvmConfig | ISubstrateConfig | IPolkadotHubConfig;
1717
1775
  hyperbridge: IHyperbridgeConfig;
1718
1776
  tracing?: boolean;
1719
1777
  }
@@ -1723,6 +1781,13 @@ interface IEvmConfig {
1723
1781
  host: HexString;
1724
1782
  consensusStateId: string;
1725
1783
  }
1784
+ /**
1785
+ * EVM-on-Substrate (e.g. Polkadot Hub) — same as {@link IEvmConfig} plus a Substrate node RPC URL
1786
+ * used for `state_getReadProof` / `state_getChildReadProof` (Revive child trie proofs).
1787
+ */
1788
+ interface IPolkadotHubConfig extends IEvmConfig {
1789
+ substrateRpcUrl: string;
1790
+ }
1726
1791
  interface ISubstrateConfig {
1727
1792
  wsUrl: string;
1728
1793
  consensusStateId: string;
@@ -8034,4 +8099,4 @@ declare const getChainId: (stateMachineId: string) => number | undefined;
8034
8099
  declare const getViemChain: (chainId: number) => Chain | undefined;
8035
8100
  declare const hyperbridgeAddress = "";
8036
8101
 
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 };
8102
+ 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 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 };