Skip to content

[sdk}: intent quote service#966

Merged
seunlanlege merged 7 commits into
mainfrom
feature/uniswap-intent-quote-service
Jun 19, 2026
Merged

[sdk}: intent quote service#966
seunlanlege merged 7 commits into
mainfrom
feature/uniswap-intent-quote-service

Conversation

@ddboy19912

Copy link
Copy Markdown
Contributor

feat(sdk): add partner-facing intent quote API (quoteIntent)

Summary

Adds a strategy-based intent quoting API to the SDK so partners can price IntentGateway V2 orders before placing them. Uniswap V4 is the only strategy today, but the API is strategy-shaped (strategy: "uniswap_v4" is the default) so new quote sources can be added without breaking partner integrations.

import { quoteIntent } from "@hyperbridge/sdk"

const quote = await quoteIntent({
  source: { chainId: "EVM-8453" },
  destination: { chainId: "EVM-8453" },
  tokenIn: { address: USDC, decimals: 6, symbol: "USDC" },
  tokenOut: { address: cNGN, decimals: 6, symbol: "cNGN" },
  amountIn: 100_000_000n,
})
// quote.amountIn / quote.amountOut → raw Uniswap V4 quoter amounts

What's included

  • IntentQuoteService / quoteIntent() (protocols/intents/quote/) — supports exact-input and exact-output quotes. Returns the raw amounts from the Uniswap V4 quoter with no slippage or fee adjustments; partners apply their own tolerance. quoteMetadata exposes the resolved poolKey, quoterAddress, and the source-chain protocolFeeBps (read from IntentGatewayV2.params()) so callers can account for the gateway's input fee when constructing the order.
  • Pool resolution — pools are resolved from SDK chain config (uniswapV4Pools, seeded with USDC/cNGN on Base). Same-chain quotes match configured pools by token address; cross-chain quotes match tokenIn by symbol since its source-chain address is meaningless against destination config. For unconfigured pairs, callers can pass an explicit uniswapV4.poolKey override (with optional quoterAddress and, for cross-chain quotes, currencyIn — the destination-side input currency, validated against the pool to prevent silently quoting the wrong swap direction).
  • Config plumbinguniswapV4Pools chain config field, ChainConfigService.getUniswapV4PoolConfigs() and getAssetAddress().
  • ErrorsUnsupportedIntentQuoteStrategyError, UnsupportedIntentQuotePairError, and a clear failure when the V4 quoter is not configured for a chain instead of an opaque eth_call failure.
  • Docs — new quoteIntent(params) section in intent-gateway.mdx, including how to apply slippage and the protocol fee on top of the raw amounts.
  • Test — live Base USDC → cNGN exact-input quote in tests/sequential/intentGateway.test.ts.

Notes for reviewers

  • Quoted amounts are intentionally unadjusted: applying slippage tolerance and accounting for protocolFeeBps is the caller's responsibility (documented with a snippet in the docs).
  • The V4 quoter is called via eth_call with manual encode/decode since its quote functions are nonpayable.

Test plan

  • pnpm test:intent-gateway (live Base RPC) — quotes 1 USDC → cNGN through the configured V4 pool
  • tsc --noEmit passes (two pre-existing errors in unrelated test files)

Closes #963

@ddboy19912 ddboy19912 requested a review from Wizdave97 June 12, 2026 07:39
@seunlanlege

Copy link
Copy Markdown
Member

better to be a method on the existing intent class

@seunlanlege seunlanlege left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Retracted — this review was posted in error from a stale file and did not apply to this PR. Its inline comments have been removed. See the follow-up review for the actual feedback.)

Comment thread sdk/packages/sdk/src/protocols/intents/quote/uniswapV4.ts Outdated
Comment thread sdk/packages/sdk/src/protocols/intents/quote/uniswapV4.ts Outdated
@seunlanlege

Copy link
Copy Markdown
Member

need to patch bump sdk

@ddboy19912

Copy link
Copy Markdown
Contributor Author

need to patch bump sdk

It's already patched to 2.2.1

…t-quote-service

# Conflicts:
#	docs/content/developers/sdk/api/intent-gateway.mdx
@seunlanlege seunlanlege merged commit 79e0d0e into main Jun 19, 2026
1 check passed
@seunlanlege seunlanlege deleted the feature/uniswap-intent-quote-service branch June 19, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Methods in the SDK for users to quote amount

3 participants