@hyperbridge/sdk 2.2.2 → 2.3.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.
@@ -1822,6 +1822,14 @@ declare function encodeUserOpScale(userOp: PackedUserOperation): HexString;
1822
1822
  * @returns The decoded PackedUserOperation
1823
1823
  */
1824
1824
  declare function decodeUserOpScale(hex: HexString): PackedUserOperation;
1825
+ interface PhantomOrderEvent {
1826
+ commitment: HexString;
1827
+ chain: string;
1828
+ createdAt: number;
1829
+ tokenA: HexString;
1830
+ tokenB: HexString;
1831
+ standardAmount: bigint;
1832
+ }
1825
1833
  /**
1826
1834
  * Service for interacting with Hyperbridge's pallet-intents coprocessor.
1827
1835
  * Handles bid submission and retrieval for the IntentGatewayV2 protocol.
@@ -1834,6 +1842,7 @@ declare class IntentsCoprocessor {
1834
1842
  private ownsConnection;
1835
1843
  /** Cached result of whether the node exposes intents_* RPC methods */
1836
1844
  private hasIntentsRpc;
1845
+ private submissionQueue;
1837
1846
  /**
1838
1847
  * Creates and connects an IntentsCoprocessor to a Hyperbridge node.
1839
1848
  * This creates and manages its own API connection.
@@ -1865,15 +1874,21 @@ declare class IntentsCoprocessor {
1865
1874
  */
1866
1875
  disconnect(): Promise<void>;
1867
1876
  /**
1868
- * Creates a Substrate keypair from the configured private key
1869
- * Supports both hex seed (without 0x prefix) and mnemonic phrases
1877
+ * Creates a Substrate keypair from the configured private key.
1878
+ * Supports hex seed (with or without 0x), mnemonic phrases, and URI derivation paths (//Alice).
1870
1879
  */
1871
1880
  getKeyPair(): KeyringPair;
1872
1881
  /**
1873
- * Signs and sends an extrinsic, handling status updates and errors
1874
- * Implements retry logic with progressive tip increases for stuck transactions
1882
+ * Signs and sends an extrinsic. Submissions are serialised through {@link submissionQueue} so
1883
+ * concurrent calls never collide on the substrate account nonce — each extrinsic reaches a block
1884
+ * before the next is signed.
1875
1885
  */
1876
1886
  private signAndSendExtrinsic;
1887
+ /**
1888
+ * Signs and sends an extrinsic, handling status updates and errors.
1889
+ * Implements retry logic with progressive tip increases for stuck transactions.
1890
+ */
1891
+ private sendExtrinsicWithRetries;
1877
1892
  /**
1878
1893
  * Sends an extrinsic with a timeout
1879
1894
  */
@@ -1895,6 +1910,18 @@ declare class IntentsCoprocessor {
1895
1910
  * @returns BidSubmissionResult with success status and block/extrinsic hash
1896
1911
  */
1897
1912
  retractBid(commitment: HexString): Promise<BidSubmissionResult>;
1913
+ /**
1914
+ * Retracts a previous bid and places a new one in a single transaction via utility.batch.
1915
+ * The retraction runs first, so the old deposit is reclaimed even if the new bid then fails
1916
+ * (batch is non-atomic — a failing call interrupts the batch without reverting the calls that
1917
+ * already succeeded, unlike batchAll which would roll the retraction back too).
1918
+ *
1919
+ * @param retractCommitment - The order commitment of the bid to retract (bytes32)
1920
+ * @param bidCommitment - The order commitment of the new bid (bytes32)
1921
+ * @param userOp - The encoded PackedUserOperation as hex string
1922
+ * @returns BidSubmissionResult with success status and block/extrinsic hash
1923
+ */
1924
+ submitBidWithRetraction(retractCommitment: HexString, bidCommitment: HexString, userOp: HexString): Promise<BidSubmissionResult>;
1898
1925
  /**
1899
1926
  * Fetches all bid storage entries for a given order commitment.
1900
1927
  * Returns the on-chain data only (filler addresses and deposits).
@@ -1928,6 +1955,21 @@ declare class IntentsCoprocessor {
1928
1955
  private decodeBid;
1929
1956
  /** Builds offchain storage key: "intents::bid::" + commitment + filler */
1930
1957
  private buildOffchainBidKey;
1958
+ /**
1959
+ * Fetches the ABI-encoded phantom order from offchain storage and decodes it
1960
+ * into an `Order` object. The pallet writes the order bytes under the key
1961
+ * `intents::phantom::order::<commitment>` when it calls `on_initialize`.
1962
+ *
1963
+ * Returns `null` if the key is absent (e.g. the node is not an offchain worker
1964
+ * or the commitment has expired and been cleared).
1965
+ */
1966
+ fetchPhantomOrder(commitment: HexString): Promise<Order | null>;
1967
+ /**
1968
+ * Subscribes to PhantomOrderRegistered events from the intents coprocessor pallet.
1969
+ * Calls the callback for each new phantom order as blocks arrive.
1970
+ * Returns an unsubscribe function to stop the subscription.
1971
+ */
1972
+ subscribePhantomOrders(callback: (event: PhantomOrderEvent) => void): Promise<() => void>;
1931
1973
  }
1932
1974
 
1933
1975
  /**
@@ -3105,6 +3147,10 @@ interface DispatchGet {
3105
3147
  * Context for the request
3106
3148
  */
3107
3149
  context: HexString;
3150
+ /**
3151
+ * Who pays for this request?
3152
+ */
3153
+ payer: HexString;
3108
3154
  }
3109
3155
  interface StateMachineHeight {
3110
3156
  id: {
@@ -5066,24 +5112,13 @@ declare class OrderStatusChecker {
5066
5112
  isOrderRefunded(order: Order): Promise<boolean>;
5067
5113
  }
5068
5114
 
5115
+ declare function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString;
5116
+ declare function decodeERC7821ExecuteBatch(callData: HexString): ERC7821Call[] | null;
5117
+
5069
5118
  type ContractOrder = Omit<Order, "id" | "source" | "destination"> & {
5070
5119
  source: HexString;
5071
5120
  destination: HexString;
5072
5121
  };
5073
- /**
5074
- * Encodes a list of calls into ERC-7821 `execute` function calldata using
5075
- * single-batch mode.
5076
- *
5077
- * This is a standalone utility that can be used outside of the
5078
- * `IntentGatewayV2` class — for example, by filler strategies that need to
5079
- * build custom batch calldata for combined swap-and-fill operations before
5080
- * submitting a UserOperation.
5081
- *
5082
- * @param calls - Ordered list of calls to batch; each specifies a target
5083
- * address, ETH value, and calldata.
5084
- * @returns ABI-encoded calldata for the ERC-7821 `execute(bytes32,bytes)` function.
5085
- */
5086
- declare function encodeERC7821ExecuteBatch(calls: ERC7821Call[]): HexString;
5087
5122
  /**
5088
5123
  * Fetches a Merkle/state proof for the given ISMP request commitment on the
5089
5124
  * source chain.
@@ -6171,6 +6206,10 @@ declare const ABI$1: readonly [{
6171
6206
  readonly name: "context";
6172
6207
  readonly type: "bytes";
6173
6208
  readonly internalType: "bytes";
6209
+ }, {
6210
+ readonly name: "payer";
6211
+ readonly type: "address";
6212
+ readonly internalType: "address";
6174
6213
  }];
6175
6214
  }];
6176
6215
  readonly outputs: readonly [{
@@ -6866,6 +6905,10 @@ declare const ABI: readonly [{
6866
6905
  readonly name: "context";
6867
6906
  readonly type: "bytes";
6868
6907
  readonly internalType: "bytes";
6908
+ }, {
6909
+ readonly name: "payer";
6910
+ readonly type: "address";
6911
+ readonly internalType: "address";
6869
6912
  }];
6870
6913
  }];
6871
6914
  readonly outputs: readonly [{
@@ -8825,6 +8868,10 @@ declare const HyperFungibleTokenABI: readonly [{
8825
8868
  readonly name: "context";
8826
8869
  readonly type: "bytes";
8827
8870
  readonly internalType: "bytes";
8871
+ }, {
8872
+ readonly name: "payer";
8873
+ readonly type: "address";
8874
+ readonly internalType: "address";
8828
8875
  }];
8829
8876
  }];
8830
8877
  readonly outputs: readonly [{
@@ -9689,6 +9736,10 @@ declare const WrappedHyperFungibleTokenABI: readonly [{
9689
9736
  readonly name: "context";
9690
9737
  readonly type: "bytes";
9691
9738
  readonly internalType: "bytes";
9739
+ }, {
9740
+ readonly name: "payer";
9741
+ readonly type: "address";
9742
+ readonly internalType: "address";
9692
9743
  }];
9693
9744
  }];
9694
9745
  readonly outputs: readonly [{
@@ -10166,4 +10217,4 @@ declare function teleport(teleport_param: {
10166
10217
  extrinsics?: Array<SubmittableExtrinsic<"promise", ISubmittableResult>>;
10167
10218
  }): Promise<ReadableStream<HyperbridgeTxEvents>>;
10168
10219
 
10169
- export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type Bid, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BridgeParams, type BridgeStep, type BundlerGasEstimate, BundlerMethod, type BytesLikeHex, type CancelEvent, type CancelOptions, type CancelOrderOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, type ConfiguredAssetSymbol, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type Deployment, 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, HyperFungibleToken, HyperFungibleTokenABI, type HyperbridgeTxEvents, type IBatchConsensusAndGetResponseMessage, type IBatchConsensusAndPostRequestMessage, type IChain, type IConfig, type IConsensusMessage, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPharosConfig, type IPolkadotHubConfig, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, type IndexerQueryClient, IntentGateway, ABI$1 as IntentGatewayABI, type IntentGatewayContext, type IntentGatewayParams, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, type IntentQuoteStrategy, type IntentQuoteToken, type IntentQuoteTradeType, IntentsCoprocessor, IsmpClient, type IsmpRequest, MOCK_ADDRESS, 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, PharosChain, type PharosChainParams, PolkadotHubChain, type PolkadotHubChainParams, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteIntentParams, type QuoteIntentResult, type QuoteNativeResult, type QuoteResult, type QuoteUniswapParams, type QuoteUniswapResult, 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 ResumeIntentOrderOptions, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type SigningAccount, type StateMachineHeight, type StateMachineId, 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 UniswapProtocol, type UniswapQuote, type UniswapQuoteToken, type UniswapTradeType, type UniswapV4IntentQuoteMetadata, type UniswapV4IntentQuoteOptions, type UniswapV4PoolConfigData, type UniswapV4PoolKey, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
10220
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type Bid, type BidStorageEntry, type BidSubmissionResult, type BlockMetadata, type BridgeParams, type BridgeStep, type BundlerGasEstimate, BundlerMethod, type BytesLikeHex, type CancelEvent, type CancelOptions, type CancelOrderOptions, type CancelQuote, type ChainConfig, type ChainConfigData, ChainConfigService, Chains, type ClientConfig, type ConfiguredAssetSymbol, CryptoUtils, DEFAULT_ADDRESS, DEFAULT_GRAFFITI, DOMAIN_TYPEHASH, DUMMY_PRIVATE_KEY, type DecodedOrderPlacedLog, type DecodedPostRequestEvent, type DecodedPostResponseEvent, type Deployment, 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, HyperFungibleToken, HyperFungibleTokenABI, type HyperbridgeTxEvents, type IBatchConsensusAndGetResponseMessage, type IBatchConsensusAndPostRequestMessage, type IChain, type IConfig, type IConsensusMessage, type IEvmChain, type IEvmConfig, type IGetRequest, type IGetRequestMessage, type IGetResponse, type IGetResponseMessage, type IHyperbridgeConfig, type IIsmpMessage, type IMessage, type IPharosConfig, type IPolkadotHubConfig, type IPostRequest, type IPostResponse, type IProof, type IRequestMessage, type ISubstrateConfig, type ITimeoutPostRequestMessage, type IndexerQueryClient, IntentGateway, ABI$1 as IntentGatewayABI, type IntentGatewayContext, type IntentGatewayParams, IntentOrderStatus, type IntentOrderStatusKey, type IntentOrderStatusUpdate, type IntentQuoteStrategy, type IntentQuoteToken, type IntentQuoteTradeType, IntentsCoprocessor, IsmpClient, type IsmpRequest, MOCK_ADDRESS, 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 PhantomOrderEvent, PharosChain, type PharosChainParams, PolkadotHubChain, type PolkadotHubChainParams, type PostRequestStatus, type PostRequestTimeoutStatus, type PostRequestWithStatus, type QuoteIntentParams, type QuoteIntentResult, type QuoteNativeResult, type QuoteResult, type QuoteUniswapParams, type QuoteUniswapResult, 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 ResumeIntentOrderOptions, type RetryConfig, SELECT_SOLVER_TYPEHASH, STATE_COMMITMENTS_SLOT, type SelectBidResult, type SelectOptions, type SigningAccount, type StateMachineHeight, type StateMachineId, 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 UniswapProtocol, type UniswapQuote, type UniswapQuoteToken, type UniswapTradeType, type UniswapV4IntentQuoteMetadata, type UniswapV4IntentQuoteOptions, type UniswapV4PoolConfigData, type UniswapV4PoolKey, UnsupportedIntentQuotePairError, UnsupportedIntentQuoteStrategyError, WrappedHyperFungibleTokenABI, type XcmGatewayParams, __test, adjustDecimals, bytes20ToBytes32, bytes32ToBytes20, calculateAllowanceMappingLocation, calculateBalanceMappingLocation, chainConfigs, constructRedeemEscrowRequestBody, constructRefundEscrowRequestBody, convertCodecToIGetRequest, convertCodecToIProof, convertIGetRequestToCodec, convertIProofToCodec, convertStateIdToStateMachineId, convertStateMachineEnumToString, convertStateMachineIdToEnum, createEvmChain, createQueryClient, decodeERC7821ExecuteBatch, decodeUserOpScale, encodeERC7821ExecuteBatch, encodeISMPMessage, encodeStateMachineId, encodeUserOpScale, encodeWithdrawalRequest, estimateGasForPost, fetchPrice, fetchSourceProof, generateRootWithProof, getChainId, getConfigByStateMachineId, getContractCallInput, getContractCallInputs, getGasPriceFromEtherscan, getOrFetchStorageSlot, getOrderPlacedFromTx, getPostRequestEventFromTx, getPostResponseEventFromTx, getRequestCommitment, getStateCommitmentFieldSlot, getStateCommitmentSlot, getStorageSlot, getViemChain, hexToString, hyperbridgeAddress, maxBigInt, normalizeAddressForEvmBytes32, normalizeAddressForStateMachine, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };