@hyperbridge/sdk 2.6.0 → 2.7.2

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.
@@ -898,6 +898,14 @@ interface UniswapV4PoolConfigData {
898
898
  tickSpacing: number;
899
899
  hooks?: `0x${string}`;
900
900
  }
901
+ /** A known ERC-4626 vault fillers can use as a stablecoin treasury. */
902
+ interface Erc4626VaultConfigData {
903
+ /** Display label, e.g. "Aave stataUSDC" */
904
+ label: string;
905
+ address: `0x${string}`;
906
+ /** Underlying asset symbol; the on-chain vault resolves the address. */
907
+ asset: ConfiguredAssetSymbol;
908
+ }
901
909
  interface ChainConfigData {
902
910
  chainId: number;
903
911
  stateMachineId: Chains;
@@ -914,6 +922,7 @@ interface ChainConfigData {
914
922
  EURC?: string;
915
923
  XSGD?: string;
916
924
  TRYB?: string;
925
+ USDR?: string;
917
926
  };
918
927
  tokenDecimals?: {
919
928
  USDC: number;
@@ -976,6 +985,8 @@ interface ChainConfigData {
976
985
  coingeckoId: string;
977
986
  popularTokens?: string[];
978
987
  uniswapV4Pools?: UniswapV4PoolConfigData[];
988
+ /** Known ERC-4626 treasury vaults on this chain */
989
+ erc4626Vaults?: Erc4626VaultConfigData[];
979
990
  /** LayerZero Endpoint ID for cross-chain messaging */
980
991
  layerZeroEid?: number;
981
992
  }
@@ -1024,6 +1035,14 @@ declare class ChainConfigService {
1024
1035
  getCNgnDecimals(chain: string): number | undefined;
1025
1036
  getExtAsset(chain: string): HexString | undefined;
1026
1037
  getExtDecimals(chain: string): number | undefined;
1038
+ /** Configured exotic (non-USD) tokens on a chain, for selection UIs. EXT is a test asset and is not offered. */
1039
+ getKnownExoticTokens(chain: string): Array<{
1040
+ symbol: string;
1041
+ address: HexString;
1042
+ decimals?: number;
1043
+ }>;
1044
+ /** Known ERC-4626 treasury vaults on a chain, for selection UIs. */
1045
+ getKnownVaults(chain: string): Erc4626VaultConfigData[];
1027
1046
  getChainId(chain: string): number;
1028
1047
  getConsensusStateId(chain: string): string;
1029
1048
  getHyperbridgeChainId(): number;
@@ -1736,7 +1755,10 @@ declare class SubstrateChain implements IChain {
1736
1755
  */
1737
1756
  latestStateMachineHeight(stateMachineId: StateMachineIdParams): Promise<bigint>;
1738
1757
  /**
1739
- * Get the state machine update time for a given state machine height.
1758
+ * Get the state machine update time for a given state machine height. Reads the
1759
+ * `BoundedStateMachineUpdateTime` map in pallet-ismp directly, so the height is either
1760
+ * still retained on-chain or it has been evicted — there's no intermediate RPC to
1761
+ * reinterpret the absence.
1740
1762
  * @param {StateMachineHeight} stateMachineHeight - The state machine height.
1741
1763
  * @returns {Promise<bigint>} The statemachine update time in seconds.
1742
1764
  */
@@ -3607,6 +3629,33 @@ interface FillOrderEstimate {
3607
3629
  */
3608
3630
  relayerFeeInSourceFeeToken: bigint;
3609
3631
  }
3632
+ /**
3633
+ * Solver-fee quote for an order, priced with the same policy `execute()` /
3634
+ * `executeBest()` apply when `order.fees` is `0n`.
3635
+ */
3636
+ interface OrderFeesQuote {
3637
+ /**
3638
+ * The amount to set as `Order.fees`, denominated in the source-chain fee
3639
+ * token. Same-chain fills carry a 2x margin over the estimated fill gas without
3640
+ * a gas-price bump. Cross-chain gas is priced with 10% SDK-only headroom before
3641
+ * adding the settlement relayer fee and a further 5% buffer over the whole sum.
3642
+ */
3643
+ fees: bigint;
3644
+ /**
3645
+ * The native value attached to the placement transaction when the fee is
3646
+ * paid in the native token: the estimated fill gas cost in source-chain
3647
+ * wei plus a 2% buffer. The gateway swaps it for the fee token and refunds
3648
+ * any unused amount.
3649
+ */
3650
+ nativeValue: bigint;
3651
+ /**
3652
+ * The source-chain fee token `fees` is denominated in — check the user's
3653
+ * balance and allowance against this address when paying the fee directly.
3654
+ */
3655
+ feeToken: HexString;
3656
+ /** The underlying gas estimate the quote was derived from. */
3657
+ estimate: FillOrderEstimate;
3658
+ }
3610
3659
  /**
3611
3660
  * Result of submitting a bid to Hyperbridge
3612
3661
  */
@@ -3730,8 +3779,24 @@ type IntentOrderStatusUpdate = {
3730
3779
  status: "AWAITING_PLACE_ORDER";
3731
3780
  to: HexString;
3732
3781
  data: HexString;
3733
- value?: bigint;
3782
+ /**
3783
+ * The order's native-token input amounts. Native inputs cannot be
3784
+ * pulled via allowance, so this must be part of the placement
3785
+ * transaction's `msg.value`. Does not include the solver fee.
3786
+ */
3787
+ value: bigint;
3788
+ /**
3789
+ * The native amount that funds `order.fees`: what the gateway swaps
3790
+ * into the fee token at placement. Add it to `value` when paying the
3791
+ * fee in native token. `0n` when `order.fees` was set by the caller
3792
+ * (fee-token rail).
3793
+ */
3794
+ nativeFee: bigint;
3734
3795
  sessionPrivateKey: HexString;
3796
+ /** Exact source-chain fee-token amount encoded in `data`. */
3797
+ feeTokenAmount: bigint;
3798
+ /** Source-chain ERC-20 token charged for `feeTokenAmount`. */
3799
+ feeTokenAddress: HexString;
3735
3800
  } | {
3736
3801
  status: "ORDER_PLACED";
3737
3802
  order: Order;
@@ -4985,14 +5050,22 @@ declare class IntentGateway {
4985
5050
  * placement, fee estimation, bid collection, and execution.
4986
5051
  *
4987
5052
  * **Yield/receive protocol:**
4988
- * 1. If `order.fees` is unset or zero, estimates gas on an internal copy and
4989
- * sets same-chain fees to twice the estimate. Cross-chain orders attach
4990
- * (fill gas + a settlement-message uplift of `RELAYER_MESSAGE_GAS`, the
4991
- * same gas budget the solver's relayer fee uses) with a 5% buffer over
4992
- * the whole sum — strictly above the solver's unpadded requirement. The
4993
- * wei cost used for the `value` field receives a 2% buffer.
4994
- * 2. Yields `AWAITING_PLACE_ORDER` with `{ to, data, value, sessionPrivateKey }`.
4995
- * The caller must sign the transaction and pass it back via `gen.next(signedTx)`.
5053
+ * 1. If `order.fees` is unset or zero, prices the fee on an internal copy
5054
+ * via {@link quoteOrderFees}: same-chain fees are twice the fill-gas
5055
+ * estimate without a gas-price bump; cross-chain gas is priced 10% above
5056
+ * the live price before attaching (fill gas + the settlement relayer fee)
5057
+ * with a further 5% buffer over the whole sum — strictly above the solver's
5058
+ * unpadded requirement. Direct solver estimates remain unbumped. The wei
5059
+ * cost used for the `value` field receives a 2% buffer.
5060
+ * 2. Yields `AWAITING_PLACE_ORDER` with `{ to, data, value, nativeFee,
5061
+ * feeTokenAmount, feeTokenAddress, sessionPrivateKey }`. `value` carries
5062
+ * only the order's native-token input amounts; `nativeFee` is the native
5063
+ * amount that funds `order.fees` (`0n` when the caller set `order.fees`);
5064
+ * `feeTokenAmount`/`feeTokenAddress` are the exact fee encoded in `data`
5065
+ * and the source-chain token it is charged in. To pay the fee in native
5066
+ * token, sign the transaction with `value + nativeFee`; with a fee-token
5067
+ * allowance, `value` alone. Pass the signed transaction back via
5068
+ * `gen.next(signedTx)`.
4996
5069
  * 3. Yields `ORDER_PLACED` with the finalised order and transaction hash once
4997
5070
  * the `OrderPlaced` event is confirmed.
4998
5071
  * 4. Delegates to {@link OrderExecutor.executeOrder} and forwards all
@@ -5205,6 +5278,30 @@ declare class IntentGateway {
5205
5278
  * @returns A {@link FillOrderEstimate} with all gas components.
5206
5279
  */
5207
5280
  estimateFillOrder(params: EstimateFillOrderParams): Promise<FillOrderEstimate>;
5281
+ /**
5282
+ * Quotes the solver fee for an order using the same policy {@link execute} /
5283
+ * {@link executeBest} apply when `order.fees` is `0n`.
5284
+ *
5285
+ * Use this before placing to display the fee, or to check what the user can
5286
+ * afford: pay `fees` in the source-chain fee token (check balance and
5287
+ * allowance, then set `order.fees` and submit with `value: 0`), or leave
5288
+ * `order.fees` at `0n` and let the SDK attach `nativeValue` to the placement
5289
+ * transaction (check the native balance).
5290
+ *
5291
+ * @param order - The order to quote. `order.fees` is ignored and not mutated.
5292
+ * Gas prices used to derive cross-chain `fees` receive 10% SDK-only headroom.
5293
+ * Same-chain quotes and direct calls to {@link estimateFillOrder}, including
5294
+ * Simplex solver estimates, remain unbumped.
5295
+ *
5296
+ * @param options - Optional transaction gas-price bump percentages, as in {@link execute}.
5297
+ * @returns An {@link OrderFeesQuote} with the fee-token amount, the native
5298
+ * value for the native rail, and the underlying estimate.
5299
+ * @throws If gas estimation returns zero.
5300
+ */
5301
+ quoteOrderFees(order: Order, options?: {
5302
+ maxPriorityFeePerGasBumpPercent?: number;
5303
+ maxFeePerGasBumpPercent?: number;
5304
+ }): Promise<OrderFeesQuote>;
5208
5305
  /**
5209
5306
  * Encodes a list of calls into ERC-7821 `execute` calldata using
5210
5307
  * single-batch mode.
@@ -10484,4 +10581,4 @@ declare function teleport(teleport_param: {
10484
10581
  extrinsics?: Array<SubmittableExtrinsic<"promise", ISubmittableResult>>;
10485
10582
  }): Promise<ReadableStream<HyperbridgeTxEvents>>;
10486
10583
 
10487
- export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type AvailableLiquidityByChain, type AvailableLiquiditySnapshot, 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 IntentQuoteTradeType, IntentsCoprocessor, InvalidPhantomSnapshotError, 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, type PhantomOrderPriceSnapshot, type PhantomOrderPriceSnapshotsResponse, type PhantomSnapshotIntentQuoteMetadata, type PhantomSnapshotQuoteIntentResult, PhantomSnapshotUnavailableError, PharosChain, type PharosChainParams, PolkadotHubChain, type PolkadotHubChainParams, type PollPhantomOrdersOptions, 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, type UniswapV4QuoteIntentResult, 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, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };
10584
+ export { ADDRESS_ZERO, type AllStatusKey, type AssetTeleported, type AssetTeleportedResponse, type AvailableLiquidityByChain, type AvailableLiquiditySnapshot, 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 Erc4626VaultConfigData, 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 IntentQuoteTradeType, IntentsCoprocessor, InvalidPhantomSnapshotError, IsmpClient, type IsmpRequest, MOCK_ADDRESS, ORDER_V2_PARAM_TYPE, type Order, type OrderFeesQuote, type OrderResponse, OrderStatus, OrderStatusChecker, type OrderStatusMetadata, type OrderWithStatus, PACKED_USEROP_TYPEHASH, PLACE_ORDER_SELECTOR, type PackedUserOperation, type Params, type PaymentInfo, type PhantomOrderEvent, type PhantomOrderPriceSnapshot, type PhantomOrderPriceSnapshotsResponse, type PhantomSnapshotIntentQuoteMetadata, type PhantomSnapshotQuoteIntentResult, PhantomSnapshotUnavailableError, PharosChain, type PharosChainParams, PolkadotHubChain, type PolkadotHubChainParams, type PollPhantomOrdersOptions, 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, type UniswapV4QuoteIntentResult, 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, normalizeEvmAddress, normalizeEvmChainId, normalizeStateMachineId, orderCommitment, parseStateMachineId, pharosAtlantic, pharosMainnet, polkadotAssetHubPaseo, polkadotHubMainnet, postRequestCommitment, queryAssetTeleported, queryGetRequest, queryPostRequest, quoteUniswap, requestCommitmentKey, responseCommitmentKey, retryPromise, teleport, teleportDot, transformOrderForContract, tronChainIds, tronNile };