diff --git a/.changeset/neat-pugs-attend.md b/.changeset/neat-pugs-attend.md new file mode 100644 index 000000000..0eacefdcb --- /dev/null +++ b/.changeset/neat-pugs-attend.md @@ -0,0 +1,7 @@ +--- +'@relayprotocol/relay-kit-hooks': major +'@relayprotocol/relay-sdk': major +'@relayprotocol/relay-kit-ui': major +--- + +Upgrade to quote/v2 api diff --git a/demo/pages/api/secure/[...path].ts b/demo/pages/api/secure/[...path].ts index 9a2e52f8b..a0b8dffac 100644 --- a/demo/pages/api/secure/[...path].ts +++ b/demo/pages/api/secure/[...path].ts @@ -2,7 +2,7 @@ import { paths } from '@relayprotocol/relay-sdk' import type { NextApiRequest, NextApiResponse } from 'next' type QuoteResponse = - paths['/quote']['post']['responses']['200']['content']['application/json'] + paths['/quote/v2']['post']['responses']['200']['content']['application/json'] const sponsoredTokens = [ '792703809:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', @@ -21,7 +21,7 @@ export default async function handler( ) { const { query } = req - const url = new URL('https://api.relay.link/quote') + const url = new URL('https://api.relay.link/quote/v2') for (const [key, value] of Object.entries(query)) { url.searchParams.set(key, value as string) diff --git a/packages/hooks/src/hooks/useQuote.ts b/packages/hooks/src/hooks/useQuote.ts index f4d285694..fb50c4dec 100644 --- a/packages/hooks/src/hooks/useQuote.ts +++ b/packages/hooks/src/hooks/useQuote.ts @@ -17,10 +17,10 @@ import type { WalletClient } from 'viem' import type { AxiosRequestConfig } from 'axios' type QuoteBody = - paths['/quote']['post']['requestBody']['content']['application/json'] + paths['/quote/v2']['post']['requestBody']['content']['application/json'] export type QuoteResponse = - paths['/quote']['post']['responses']['200']['content']['application/json'] + paths['/quote/v2']['post']['responses']['200']['content']['application/json'] type QueryType = typeof useQuery< QuoteResponse, @@ -36,7 +36,7 @@ export const queryQuote = function ( config?: AxiosRequestConfig ): Promise { return new Promise((resolve, reject) => { - const href = `${baseApiUrl}/quote` + const href = `${baseApiUrl}/quote/v2` axiosPostFetcher(href, options, config) .then((response) => { const request: AxiosRequestConfig = { diff --git a/packages/sdk/src/actions/apiKey.test.ts b/packages/sdk/src/actions/apiKey.test.ts index 9ea3d1ef6..8a4634ff0 100644 --- a/packages/sdk/src/actions/apiKey.test.ts +++ b/packages/sdk/src/actions/apiKey.test.ts @@ -59,7 +59,7 @@ describe('API Key Header Tests', () => { expect(axiosRequestSpy).toHaveBeenCalledWith( expect.objectContaining({ - url: expect.stringContaining('/quote'), + url: expect.stringContaining('/quote/v2'), headers: expect.objectContaining({ 'x-api-key': 'test-api-key' }) diff --git a/packages/sdk/src/actions/getQuote.ts b/packages/sdk/src/actions/getQuote.ts index 18fbc92d6..a0e897c25 100644 --- a/packages/sdk/src/actions/getQuote.ts +++ b/packages/sdk/src/actions/getQuote.ts @@ -15,7 +15,7 @@ import type { AdaptedWallet, Execute, paths } from '../types/index.js' import { getDeadAddress } from '../constants/address.js' export type QuoteBody = NonNullable< - paths['/quote']['post']['requestBody']['content']['application/json'] + paths['/quote/v2']['post']['requestBody']['content']['application/json'] > export type QuoteBodyOptions = Omit< QuoteBody, @@ -158,7 +158,7 @@ export async function getQuote( } const request: AxiosRequestConfig = { - url: `${client.baseApiUrl}/quote`, + url: `${client.baseApiUrl}/quote/v2`, method: 'post', data: query, headers: { diff --git a/packages/sdk/src/routes/index.ts b/packages/sdk/src/routes/index.ts index 68691a6f5..3ba1a37f3 100644 --- a/packages/sdk/src/routes/index.ts +++ b/packages/sdk/src/routes/index.ts @@ -13,6 +13,7 @@ export const routes = [ "/execute/swap/multi-input", "/execute/permits", "/quote", + "/quote/v2", "/price", "/execute", "/fast-fill", @@ -20,8 +21,6 @@ export const routes = [ "/intents/status", "/intents/status/v2", "/intents/status/v3", - "/intents/quote", - "/intents/quote/v2", "/requests/{requestId}/signature", "/requests/{requestId}/signature/v2", "/requests", @@ -29,7 +28,7 @@ export const routes = [ "/requests/metadata", "/transactions/index", "/transactions/single", - "/transactions/status", + "/swap-sources", "/loadforge.txt", "/conduit/install", "/prices/rates", @@ -40,5 +39,6 @@ export const routes = [ "/chains/{chainId}/currencies/{address}", "/chains/{chainId}/currencies/{address}/chart", "/provision/chain", - "/sanctioned/{address}" + "/sanctioned/{address}", + "/wallets/screen" ]; \ No newline at end of file diff --git a/packages/sdk/src/types/Execute.ts b/packages/sdk/src/types/Execute.ts index 19eac31be..7c440fdea 100644 --- a/packages/sdk/src/types/Execute.ts +++ b/packages/sdk/src/types/Execute.ts @@ -9,14 +9,14 @@ export type CallBreakdown = paths['/execute/call/v2']['post']['responses']['200']['content']['application/json']['breakdown'] export type CheckApi = NonNullable< NonNullable< - paths['/execute/call/v2']['post']['responses']['200']['content']['application/json']['steps'] + paths['/quote/v2']['post']['responses']['200']['content']['application/json']['steps'] >['0']['items'] >[0]['check'] export type QuoteDetails = NonNullable< - paths['/quote']['post']['responses']['200']['content']['application/json']['details'] + paths['/quote/v2']['post']['responses']['200']['content']['application/json']['details'] > export type QuoteStepId = NonNullable< - paths['/quote']['post']['responses']['200']['content']['application/json']['steps'] + paths['/quote/v2']['post']['responses']['200']['content']['application/json']['steps'] >['0']['id'] export type TransactionStepState = 'confirming' | 'validating' | 'complete' diff --git a/packages/sdk/src/types/RelayChain.ts b/packages/sdk/src/types/RelayChain.ts index 12764f592..9967da927 100644 --- a/packages/sdk/src/types/RelayChain.ts +++ b/packages/sdk/src/types/RelayChain.ts @@ -5,7 +5,15 @@ type RelayAPIChain = NonNullable< paths['/chains']['get']['responses']['200']['content']['application/json']['chains'] >['0'] -export type ChainVM = 'evm' | 'svm' | 'bvm' | 'tvm' | 'suivm' | 'hypevm' | 'lvm' +export type ChainVM = + | 'evm' + | 'svm' + | 'bvm' + | 'tvm' + | 'suivm' + | 'hypevm' + | 'lvm' + | 'tonvm' export type RelayChain = { id: number diff --git a/packages/sdk/src/types/api.ts b/packages/sdk/src/types/api.ts index 4e02a0f94..b3ab5e2e2 100644 --- a/packages/sdk/src/types/api.ts +++ b/packages/sdk/src/types/api.ts @@ -214,7 +214,7 @@ export interface paths { * @description The type of VM the chain runs on * @enum {string} */ - vmType?: "bvm" | "evm" | "svm"; + vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm" | "lvm"; explorerQueryParams?: { [key: string]: unknown; } | null; @@ -315,7 +315,7 @@ export interface paths { /** @description User address, when supplied returns user balance and max bridge amount */ user?: string; /** @description Restricts the user balance and capacity to a particular currency when supplied with a currency id. Defaults to the native currency of the destination chain. */ - currency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl"; + currency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh"; }; }; responses: { @@ -368,7 +368,7 @@ export interface paths { originChainId: number; destinationChainId: number; /** @enum {string} */ - currency: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl"; + currency: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh"; /** @description Amount to bridge as the base amount (can be switched to exact input using the dedicated flag), denoted in wei */ amount: string; /** @description App fees to be charged for execution */ @@ -472,7 +472,7 @@ export interface paths { * @description Origin chain gas currency * @enum {string} */ - gasCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "avax" | "bnb" | "dai" | "matic" | "sei" | "mnt" | "trx" | "bera" | "ip" | "s" | "lrds" | "celo" | "flow" | "ron" | "metis" | "btcn" | "core" | "sui" | "ton" | "cronos" | "hype" | "mcade"; + gasCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh" | "avax" | "bnb" | "dai" | "matic" | "sei" | "mnt" | "trx" | "bera" | "ip" | "s" | "lrds" | "celo" | "flow" | "ron" | "metis" | "btcn" | "core" | "sui" | "ton" | "cronos" | "hype" | "mcade" | "gusdt"; /** @description Combination of the relayerGas and relayerService to give you the full relayer fee in wei */ relayer?: string; /** @description Destination chain gas fee in wei */ @@ -483,10 +483,10 @@ export interface paths { * @description The currency for all relayer fees (gas and service) * @enum {string} */ - relayerCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl"; + relayerCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh"; app?: string; /** @enum {string} */ - appCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl"; + appCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh"; }; breakdown?: { /** @description Amount that will be bridged in the estimated time */ @@ -548,7 +548,7 @@ export interface paths { originChainId: number; destinationChainId: number; /** @enum {string} */ - currency: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl"; + currency: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh"; /** @description Amount to bridge as the base amount (can be switched to exact input using the dedicated flag), denoted in wei */ amount: string; /** @description App fees to be charged for execution */ @@ -1029,7 +1029,7 @@ export interface paths { * @description Origin chain gas currency * @enum {string} */ - gasCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "avax" | "bnb" | "dai" | "matic" | "sei" | "mnt" | "trx" | "bera" | "ip" | "s" | "lrds" | "celo" | "flow" | "ron" | "metis" | "btcn" | "core" | "sui" | "ton" | "cronos" | "hype" | "mcade"; + gasCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh" | "avax" | "bnb" | "dai" | "matic" | "sei" | "mnt" | "trx" | "bera" | "ip" | "s" | "lrds" | "celo" | "flow" | "ron" | "metis" | "btcn" | "core" | "sui" | "ton" | "cronos" | "hype" | "mcade" | "gusdt"; /** @description Combination of the relayerGas and relayerService to give you the full relayer fee in wei */ relayer?: string; /** @description Destination chain gas fee in wei */ @@ -1040,10 +1040,10 @@ export interface paths { * @description The currency for all relayer fees (gas and service) * @enum {string} */ - relayerCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl"; + relayerCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh"; app?: string; /** @enum {string} */ - appCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl"; + appCurrency?: "anime" | "btc" | "cgt" | "degen" | "eth" | "omi" | "pop" | "power" | "sipher" | "tg7" | "tia" | "topia" | "usdc" | "usdc.e" | "usdt" | "sol" | "xai" | "weth" | "apeeth" | "ape" | "g" | "dmt" | "g7" | "god" | "pengu" | "plume" | "wbtc" | "pusd" | "gun" | "somi" | "synd" | "xpl" | "usde" | "mon" | "usdh"; }; /** * @example { @@ -2041,6 +2041,8 @@ export interface paths { referrer?: string; gasLimitForDepositSpecifiedTxs?: number; originGasOverhead?: number; + /** @description Slippage tolerance for the swap, if not specified then the slippage tolerance is automatically calculated to avoid front-running. This value is in basis points (1/100th of a percent), e.g. 50 for 0.5% slippage */ + slippageTolerance?: string; }; }; }; @@ -2479,97 +2481,998 @@ export interface paths { }; }; /** @description Default Response */ - 401: { + 401: { + content: { + "application/json": { + message?: string; + }; + }; + }; + /** @description Default Response */ + 500: { + content: { + "application/json": { + message?: string; + }; + }; + }; + }; + }; + }; + "/execute/permits": { + post: { + parameters: { + query: { + /** @description The permit signature. */ + signature: string; + }; + }; + requestBody: { + content: { + "application/json": { + /** @description The kind of signature. This value is returned in the quote API steps body field. e.g eip3009 */ + kind: string; + /** @description The requestId of the quote this permit signature applies to. Returned in the quote API steps body field. */ + requestId: string; + /** + * @description The API value returned from the quote API steps body field. + * @enum {string} + */ + api?: "bridge" | "swap" | "user-swap"; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + message?: string; + steps?: { + id?: string; + action?: string; + description?: string; + kind?: string; + items?: { + status?: string; + data?: { + to?: string; + data?: string; + value?: string; + chainId?: number; + }; + check?: { + endpoint?: string; + method?: string; + }; + }[]; + }[]; + }; + }; + }; + /** @description Default Response */ + 400: { + content: { + "application/json": { + message?: string; + }; + }; + }; + }; + }; + }; + "/quote": { + post: { + requestBody: { + content: { + "application/json": { + /** + * @description Address that is depositing funds on the origin chain and submitting transactions or signatures + * @default 0x03508bb71268bba25ecacc8f620e01866650532c + */ + user: string; + /** @description Address that is receiving the funds on the destination chain, if not specified then this will default to the user address */ + recipient?: string; + /** @default 8453 */ + originChainId: number; + /** @default 10 */ + destinationChainId: number; + /** @default 0x0000000000000000000000000000000000000000 */ + originCurrency: string; + /** @default 0x0000000000000000000000000000000000000000 */ + destinationCurrency: string; + /** + * @description Amount to swap as the base amount (can be switched to exact input/output using the dedicated flag), denoted in the smallest unit of the specified currency (e.g., wei for ETH) + * @default 1000000000000000000 + */ + amount: string; + /** + * @description Whether to use the amount as the output or the input for the basis of the swap + * @default EXACT_INPUT + * @enum {string} + */ + tradeType: "EXACT_INPUT" | "EXACT_OUTPUT" | "EXPECTED_OUTPUT"; + txs?: { + to?: string; + value?: string; + data?: string; + originalTxValue?: string; + }[]; + /** @description Total gas limit for the destination chain call transactions */ + txsGasLimit?: number; + /** @description Authorization list for EIP-7702 transactions to be executed on destination chain */ + authorizationList?: { + chainId: number; + address: string; + nonce: number; + yParity: number; + r: string; + s: string; + }[]; + /** @description Additional data needed for specific routes */ + additionalData?: { + /** @description If the request originates from Bitcoin and the user is a P2SH address, the public key is needed to be able to generate the transaction data */ + userPublicKey?: string; + }; + referrer?: string; + referrerAddress?: string; + /** @description Address to send the refund to in the case of failure, if not specified then the recipient address or user address is used */ + refundTo?: string; + /** + * @deprecated + * @description Always refund on the origin chain in case of any issues + */ + refundOnOrigin?: boolean; + /** @description If set, the destination fill will include a gas topup to the recipient (only supported for EVM chains if the requested currency is not the gas currency on the destination chain) */ + topupGas?: boolean; + /** @description The destination gas topup amount in USD decimal format, e.g 100000 = $1. topupGas is required to be enabled. Defaults to 2000000 ($2) */ + topupGasAmount?: string; + /** + * @description Enable this to route payments via a receiver contract. This contract will emit an event when receiving payments before forwarding to the solver. This is needed when depositing from a smart contract as the payment will be an internal transaction and detecting such a transaction requires obtaining the transaction traces. + * @default true + */ + useReceiver?: boolean; + /** + * @description Enabling will send any swap surplus when doing exact output operations to the solver EOA, otherwise it will be swept to the recipient + * @default false + */ + enableTrueExactOutput?: boolean; + /** + * @description Enable this to avoid direct transfers to the depository (only relevant for EVM and v2 protocol flow) + * @default true + */ + explicitDeposit?: boolean; + /** @description Enable this to use canonical+ bridging, trading speed for more liquidity */ + useExternalLiquidity?: boolean; + /** @description Enable this for specific fallback routes */ + useFallbacks?: boolean; + /** @description Enable this to use permit (eip3009) when bridging, only works on supported currency such as usdc */ + usePermit?: boolean; + /** @description How long the permit remains valid, in seconds. Defaults to 10 minutes. */ + permitExpiry?: number; + /** @description Enable this to use a deposit address when bridging, in scenarios where calldata cannot be sent alongside the transaction. only works on native currency bridges. */ + useDepositAddress?: boolean; + /** @description Slippage tolerance for the swap, if not specified then the slippage tolerance is automatically calculated to avoid front-running. This value is in basis points (1/100th of a percent), e.g. 50 for 0.5% slippage */ + slippageTolerance?: string; + /** @description Slippage tolerance for destination gas in the event that the deposit occurs after the order deadline, and more gas is required for the solver to execute the destination transaction. */ + latePaymentSlippageTolerance?: string; + appFees?: { + /** @description Address that will receive the app fee, if not specified then the user address is used */ + recipient?: string; + /** @description App fees to be charged for execution in basis points, e.g. 100 = 1% */ + fee?: string; + }[]; + /** @description If the request involves specifying transactions to be executed during the deposit transaction, an explicit gas limit must be set when requesting the quote */ + gasLimitForDepositSpecifiedTxs?: number; + /** @description Force executing swap requests via the solver (by default, same-chain swap requests are self-executed) */ + forceSolverExecution?: boolean; + /** @description If the sponsor should pay for the fees associated with the request. Includes gas topup amounts. */ + subsidizeFees?: boolean; + /** @description The max subsidization amount in USDC decimal format, e.g 1000000 = $1. subsidizeFees must be enabled. This amount is the threshhold where if its surpassed the entire request will not be subsidized at all. */ + maxSubsidizationAmount?: string; + /** @description Swap sources to include for swap routing. */ + includedSwapSources?: string[]; + /** @description Swap sources to exclude for swap routing. */ + excludedSwapSources?: string[]; + /** @description Swap sources to include for swap routing on origin. */ + includedOriginSwapSources?: string[]; + /** @description Swap sources to include for swap routing on destination. */ + includedDestinationSwapSources?: string[]; + /** @description The gas overhead for the origin chain, this is used to calculate the gas fee for the origin chain when the solver is executing a gasless transaction on the origin chain */ + originGasOverhead?: number; + /** @description The payer to be set for deposit transactions on solana. This account must have enough for fees and rent. */ + depositFeePayer?: string; + /** @description Whether to include compute unit limit instruction for solana origin requests. */ + includeComputeUnitLimit?: boolean; + /** @description Whether to ignore price impact errors. */ + overridePriceImpact?: boolean; + /** @description Whether to disable origin swaps. */ + disableOriginSwaps?: boolean; + /** + * @description The protocol version to use for the quote (currently experimental, do not use in production) + * @enum {string} + */ + protocolVersion?: "v1" | "v2" | "preferV2"; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + /** + * @description An array of steps detailing what needs to be done to bridge, steps includes multiple items of the same kind (signature, transaction, etc) + * @example [ + * { + * "id": "deposit", + * "action": "Confirm transaction in your wallet", + * "description": "Depositing funds to the relayer to execute the swap for USDC", + * "kind": "transaction", + * "requestId": "0x92b99e6e1ee1deeb9531b5ad7f87091b3d71254b3176de9e8b5f6c6d0bd3a331", + * "items": [ + * { + * "status": "incomplete", + * "data": { + * "from": "0x0CccD55A5Ac261Ea29136831eeaA93bfE07f5Db6", + * "to": "0xf70da97812cb96acdf810712aa562db8dfa3dbef", + * "data": "0x00fad611", + * "value": "1000000000000000000", + * "maxFeePerGas": "12205661344", + * "maxPriorityFeePerGas": "2037863396", + * "chainId": 1 + * }, + * "check": { + * "endpoint": "/intents/status?requestId=0x92b99e6e1ee1deeb9531b5ad7f87091b3d71254b3176de9e8b5f6c6d0bd3a331", + * "method": "GET" + * } + * } + * ] + * } + * ] + */ + steps?: ({ + /** + * @description Unique identifier tied to the step + * @enum {string} + */ + id: "deposit" | "approve" | "authorize" | "authorize1" | "authorize2" | "swap" | "send"; + /** @description A call to action for the step */ + action: string; + /** @description A short description of the step and what it entails */ + description: string; + /** @description The kind of step, can either be a transaction or a signature. Transaction steps require submitting a transaction while signature steps require submitting a signature */ + kind: string; + /** @description A unique identifier for this step, tying all related transactions together */ + requestId?: string; + /** @description The deposit address for the bridge request */ + depositAddress?: string; + /** @description While uncommon it is possible for steps to contain multiple items of the same kind (transaction/signature) grouped together that can be executed simultaneously. */ + items: { + /** @description Can either be complete or incomplete, this can be locally controlled once the step item is completed (depending on the kind) and the check object (if returned) has been verified. Once all step items are complete, the bridge is complete */ + status?: string; + data?: unknown; + /** @description Details an endpoint and a method you should poll to get confirmation, the endpoint should return a boolean success flag which can be used to determine if the step item is complete */ + check?: { + /** @description The endpoint to confirm that the step item was successfully completed */ + endpoint?: string; + /** @description The REST method to access the endpoint */ + method?: string; + }; + }[]; + })[]; + fees?: { + /** + * @description Origin chain gas fee + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + gas?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @description Combination of the relayerGas and relayerService to give you the full relayer fee + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + relayer?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @description Destination chain gas fee + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + relayerGas?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @description Fees paid to the relay solver, note that this value can be negative (which represents network rewards for moving in a direction that optimizes liquidity distribution) + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + relayerService?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @description Fees paid to the app. Currency will be the same as the relayer fee currency. This needs to be claimed later by the app owner and is not immediately distributed to the app + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + app?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @description The amount of fees for the request that are subsidized by the request sponsor. Does not include deposit origin gas unless it is a permit based deposit. + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + subsidized?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + }; + /** @description A summary of the swap and what the user should expect to happen given an input */ + details?: { + /** @description The operation that will be performed, possible options are send, swap, wrap, unwrap, bridge */ + operation?: string; + /** @description The address that deposited the funds */ + sender?: string; + /** @description The address that will be receiving the swap output */ + recipient?: string; + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + currencyIn?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + currencyOut?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + refundCurrency?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + currencyGasTopup?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** @description The difference between the input and output values, including fees */ + totalImpact?: { + usd?: string; + percent?: string; + }; + /** @description The impact of the swap, not factoring in fees */ + swapImpact?: { + usd?: string; + percent?: string; + }; + expandedPriceImpact?: { + /** @description Cost to execute swap or bridge depending on available liquidity. This value can be negative (representing network rewards for improving liquidity distribution) */ + swap?: { + usd?: string; + }; + /** @description Fees paid to cover transaction execution costs */ + execution?: { + usd?: string; + }; + /** @description Fees paid to the protocol */ + relay?: { + usd?: string; + }; + /** @description Fees paid to the app. Currency will be the same as the relayer fee currency. This needs to be claimed later by the app owner and is not immediately distributed to the app */ + app?: { + usd?: string; + }; + }; + /** @description The swap rate which is equal to 1 input unit in the output unit, e.g. 1 USDC -> x ETH. This value can fluctuate based on gas and fees. */ + rate?: string; + slippageTolerance?: { + /** @description The slippage tolerance on the origin chain swap */ + origin?: { + usd?: string; + value?: string; + percent?: string; + }; + /** @description The slippage tolerance on the destination chain swap */ + destination?: { + usd?: string; + value?: string; + percent?: string; + }; + }; + /** @description Estimated swap time in seconds */ + timeEstimate?: number; + /** @description The user's balance in the given currency on the origin chain */ + userBalance?: string; + /** @description The type of fallback route the request uses, if any */ + fallbackType?: string; + /** @description Whether the rate for the quote is fixed or dynamic (swap on origin/destination) */ + isFixedRate?: boolean; + route?: { + /** @description The route taken for the origin chain swap */ + origin?: { + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + inputCurrency?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + outputCurrency?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + router?: string; + includedSwapSources?: string[]; + }; + /** @description The route taken for the origin chain swap */ + destination?: { + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + inputCurrency?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + /** + * @example { + * "currency": { + * "chainId": 8453, + * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", + * "symbol": "USDC", + * "name": "USD Coin", + * "decimals": 6, + * "metadata": { + * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", + * "verified": false, + * "isNative": false + * } + * }, + * "amount": "30754920", + * "amountFormatted": "30.75492", + * "amountUsd": "30.901612", + * "minimumAmount": "30454920" + * } + */ + outputCurrency?: { + currency?: { + chainId?: number; + address?: string; + symbol?: string; + name?: string; + decimals?: number; + metadata?: { + logoURI?: string; + verified?: boolean; + isNative?: boolean; + }; + }; + amount?: string; + amountFormatted?: string; + amountUsd?: string; + minimumAmount?: string; + }; + router?: string; + includedSwapSources?: string[]; + }; + }; + }; + /** @description Protocol information for the quote */ + protocol?: { + v2?: { + /** @description The underlying protocol order id */ + orderId?: string; + /** @description The underlying protocol order data */ + orderData?: unknown; + /** @description The details for the depository payment */ + paymentDetails?: { + /** @description The protocol chain id for the payment */ + chainId?: string; + /** @description The depository address */ + depository?: string; + /** @description The currency of the payment */ + currency?: string; + /** @description The amount of the payment */ + amount?: string; + }; + }; + }; + }; + }; + }; + /** @description Default Response */ + 400: { content: { "application/json": { message?: string; + errorCode?: string; + errorData?: string; + requestId?: string; + approxSimulatedBlock?: number; + failedCallData?: { + from?: string; + to?: string; + data?: string; + value?: string; + }; }; }; }; /** @description Default Response */ - 500: { + 401: { content: { "application/json": { message?: string; + errorCode?: string; }; }; }; - }; - }; - }; - "/execute/permits": { - post: { - parameters: { - query: { - signature: string; - }; - }; - requestBody: { - content: { - "application/json": { - kind: string; - requestId: string; - /** @enum {string} */ - api?: "bridge" | "swap" | "user-swap"; - }; - }; - }; - responses: { /** @description Default Response */ - 200: { + 429: { content: { "application/json": { message?: string; - steps?: { - id?: string; - action?: string; - description?: string; - kind?: string; - items?: { - status?: string; - data?: { - to?: string; - data?: string; - value?: string; - chainId?: number; - }; - check?: { - endpoint?: string; - method?: string; - }; - }[]; - }[]; }; }; }; /** @description Default Response */ - 400: { + 500: { content: { "application/json": { message?: string; + errorCode?: string; + requestId?: string; }; }; }; }; }; }; - "/quote": { + "/quote/v2": { post: { requestBody: { content: { "application/json": { - /** @description Address that is depositing funds on the origin chain and submitting transactions or signatures */ + /** + * @description Address that is depositing funds on the origin chain and submitting transactions or signatures + * @default 0x03508bb71268bba25ecacc8f620e01866650532c + */ user: string; /** @description Address that is receiving the funds on the destination chain, if not specified then this will default to the user address */ recipient?: string; + /** @default 8453 */ originChainId: number; + /** @default 10 */ destinationChainId: number; + /** @default 0x0000000000000000000000000000000000000000 */ originCurrency: string; + /** @default 0x0000000000000000000000000000000000000000 */ destinationCurrency: string; - /** @description Amount to swap as the base amount (can be switched to exact input/output using the dedicated flag), denoted in the smallest unit of the specified currency (e.g., wei for ETH) */ + /** + * @description Amount to swap as the base amount (can be switched to exact input/output using the dedicated flag), denoted in the smallest unit of the specified currency (e.g., wei for ETH) + * @default 1000000000000000000 + */ amount: string; /** * @description Whether to use the amount as the output or the input for the basis of the swap + * @default EXACT_INPUT * @enum {string} */ tradeType: "EXACT_INPUT" | "EXACT_OUTPUT" | "EXPECTED_OUTPUT"; @@ -2577,6 +3480,7 @@ export interface paths { to?: string; value?: string; data?: string; + originalTxValue?: string; }[]; /** @description Total gas limit for the destination chain call transactions */ txsGasLimit?: number; @@ -2617,11 +3521,6 @@ export interface paths { * @default false */ enableTrueExactOutput?: boolean; - /** - * @description The protocol version to use for the quote (currently experimental, do not use in production) - * @enum {string} - */ - protocolVersion?: "v1" | "v2" | "preferV2"; /** * @description Enable this to avoid direct transfers to the depository (only relevant for EVM and v2 protocol flow) * @default true @@ -2633,6 +3532,8 @@ export interface paths { useFallbacks?: boolean; /** @description Enable this to use permit (eip3009) when bridging, only works on supported currency such as usdc */ usePermit?: boolean; + /** @description How long the permit remains valid, in seconds. Defaults to 10 minutes. */ + permitExpiry?: number; /** @description Enable this to use a deposit address when bridging, in scenarios where calldata cannot be sent alongside the transaction. only works on native currency bridges. */ useDepositAddress?: boolean; /** @description Slippage tolerance for the swap, if not specified then the slippage tolerance is automatically calculated to avoid front-running. This value is in basis points (1/100th of a percent), e.g. 50 for 0.5% slippage */ @@ -2651,7 +3552,7 @@ export interface paths { forceSolverExecution?: boolean; /** @description If the sponsor should pay for the fees associated with the request. Includes gas topup amounts. */ subsidizeFees?: boolean; - /** @description The max subsidization amount in USD decimal format, e.g 100000 = $1. subsidizeFees must be enabled. This amount is the threshhold where if its surpassed the entire request will not be subsidized at all. */ + /** @description The max subsidization amount in USDC decimal format, e.g 1000000 = $1. subsidizeFees must be enabled. This amount is the threshhold where if its surpassed the entire request will not be subsidized at all. */ maxSubsidizationAmount?: string; /** @description Swap sources to include for swap routing. */ includedSwapSources?: string[]; @@ -2665,6 +3566,12 @@ export interface paths { originGasOverhead?: number; /** @description The payer to be set for deposit transactions on solana. This account must have enough for fees and rent. */ depositFeePayer?: string; + /** @description Whether to include compute unit limit instruction for solana origin requests. */ + includeComputeUnitLimit?: boolean; + /** @description Whether to ignore price impact errors. */ + overridePriceImpact?: boolean; + /** @description Whether to disable origin swaps. */ + disableOriginSwaps?: boolean; }; }; }; @@ -3351,6 +4258,8 @@ export interface paths { v2?: { /** @description The underlying protocol order id */ orderId?: string; + /** @description The underlying protocol order data */ + orderData?: unknown; /** @description The details for the depository payment */ paymentDetails?: { /** @description The protocol chain id for the payment */ @@ -3375,6 +4284,13 @@ export interface paths { errorCode?: string; errorData?: string; requestId?: string; + approxSimulatedBlock?: number; + failedCallData?: { + from?: string; + to?: string; + data?: string; + value?: string; + }; }; }; }; @@ -3891,12 +4807,30 @@ export interface paths { s: string; }[]; }; - /** @description Options related to gas fee sponsorship and app referrer */ + /** @description Options related to gas fee sponsorship, app referrer and destination calls */ executionOptions: { /** @description The referrer of the app which is executing the gasless transaction */ referrer: string; /** @description If the app should pay for the fees associated with the request */ subsidizeFees: boolean; + /** @description Destination execution data for the gasless transaction */ + destinationChainExecutionData?: { + /** @description Calls to be executed on the destination chain */ + calls: { + to?: string; + value?: string; + data?: string; + }[]; + /** @description Authorization list for EIP-7702 transactions to be executed on destination chain */ + authorizationList?: { + chainId: number; + address: string; + nonce: number; + yParity: number; + r: string; + s: string; + }[]; + }; }; /** @description The request ID of the gasless transaction to execute */ requestId?: string; @@ -3975,6 +4909,8 @@ export interface paths { "application/json": { /** @description The request ID of the request that needs to be fast filled */ requestId: string; + /** @description The input currency amount that the solver receives on origin */ + solverInputCurrencyAmount?: string; }; }; }; @@ -4056,12 +4992,39 @@ export interface paths { }; "/lives": { get: { + parameters: { + query?: { + withReport?: string | null; + skipPostgres?: string | null; + skipRedis?: string | null; + }; + }; responses: { /** @description Default Response */ 200: { content: { "application/json": { - message?: string; + status?: string; + report?: { + [key: string]: { + status?: string; + reason?: string | null; + }; + }; + }; + }; + }; + /** @description Default Response */ + 503: { + content: { + "application/json": { + status?: string; + report?: { + [key: string]: { + status?: string; + reason?: string | null; + }; + }; }; }; }; @@ -4161,163 +5124,6 @@ export interface paths { }; }; }; - "/intents/quote": { - post: { - requestBody: { - content: { - "application/json": { - request: Record; - source?: string; - }; - }; - }; - responses: { - /** @description Default Response */ - 200: { - content: { - "application/json": { - txData?: { - to?: string; - data?: string; - value?: string; - }; - requestId?: string; - currency?: string; - price?: string; - relayerFee?: string; - depositGasFee?: string; - }; - }; - }; - /** @description Default Response */ - 400: { - content: { - "application/json": { - message?: string; - }; - }; - }; - }; - }; - }; - "/intents/quote/v2": { - post: { - requestBody: { - content: { - "application/json": { - request: Record; - source?: string; - }; - }; - }; - responses: { - /** @description Default Response */ - 200: { - content: { - "application/json": { - requestId?: string; - approvalTxData?: { - to?: string; - data?: string; - value?: string; - }; - depositTxData?: { - to?: string; - data?: string; - value?: string; - }; - /** - * @example { - * "currency": { - * "chainId": 8453, - * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", - * "symbol": "USDC", - * "name": "USD Coin", - * "decimals": 6, - * "metadata": { - * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", - * "verified": false, - * "isNative": false - * } - * }, - * "amount": "30754920", - * "amountFormatted": "30.75492", - * "amountUsd": "30.901612", - * "minimumAmount": "30454920" - * } - */ - currencyIn?: { - currency?: { - chainId?: number; - address?: string; - symbol?: string; - name?: string; - decimals?: number; - metadata?: { - logoURI?: string; - verified?: boolean; - isNative?: boolean; - }; - }; - amount?: string; - amountFormatted?: string; - amountUsd?: string; - minimumAmount?: string; - }; - /** - * @example { - * "currency": { - * "chainId": 8453, - * "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", - * "symbol": "USDC", - * "name": "USD Coin", - * "decimals": 6, - * "metadata": { - * "logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png", - * "verified": false, - * "isNative": false - * } - * }, - * "amount": "30754920", - * "amountFormatted": "30.75492", - * "amountUsd": "30.901612", - * "minimumAmount": "30454920" - * } - */ - currencyOut?: { - currency?: { - chainId?: number; - address?: string; - symbol?: string; - name?: string; - decimals?: number; - metadata?: { - logoURI?: string; - verified?: boolean; - isNative?: boolean; - }; - }; - amount?: string; - amountFormatted?: string; - amountUsd?: string; - minimumAmount?: string; - }; - relayerFee?: string; - depositGasFee?: string; - }; - }; - }; - /** @description Default Response */ - 400: { - content: { - "application/json": { - message?: string; - }; - }; - }; - }; - }; - }; "/requests/{requestId}/signature": { get: { parameters: { @@ -4626,6 +5432,7 @@ export interface paths { privateChainsToInclude?: string; id?: string; orderId?: string; + includeOrderData?: boolean; startTimestamp?: number; endTimestamp?: number; startBlock?: number; @@ -4648,8 +5455,8 @@ export interface paths { * "status": "success", * "user": "0x456bccd1eaa77d5cc5ace1723b5dcca00d67cdea", * "recipient": "0x456bccd1eaa77d5cc5ace1723b5dcca00d67cdea", - * "subsidizedRequest": false, * "data": { + * "subsidizedRequest": false, * "fees": { * "gas": "2622672522398", * "fixed": "10000000000000", @@ -4708,7 +5515,6 @@ export interface paths { status?: "refund" | "waiting" | "failure" | "pending" | "success"; user?: string; recipient?: string; - subsidizedRequest?: boolean; data?: { /** @description Slippage tolerance for the swap. This value is in basis points (1/100th of a percent), e.g. 50 for 0.5% slippage */ slippageTolerance?: string; @@ -4717,12 +5523,14 @@ export interface paths { /** @enum {string} */ refundFailReason?: "AMOUNT_TOO_LOW_TO_REFUND"; failedTxHash?: string; + failedTxBlockNumber?: number; failedCallData?: { from?: string; to?: string; data?: string; value?: string; }; + subsidizedRequest?: boolean; fees?: { /** @description Estimated gas cost required for execution, in wei */ gas?: string; @@ -4834,6 +5642,13 @@ export interface paths { amountUsd?: string; amountUsdCurrent?: string; }[]; + paidAppFees?: { + recipient?: string; + bps?: string; + amount?: string; + amountUsd?: string; + amountUsdCurrent?: string; + }[]; metadata?: { sender?: string; recipient?: string; @@ -5139,6 +5954,7 @@ export interface paths { timestamp?: number; }[]; }; + orderData?: unknown; referrer?: string; moonpayId?: string; createdAt?: string; @@ -5220,12 +6036,12 @@ export interface paths { }; }; }; - "/transactions/status": { + "/swap-sources": { get: { parameters: { query?: { - chainId?: string; - hash?: string; + /** @description Chain ID to get swap sources for */ + chainId?: number; }; }; responses: { @@ -5233,15 +6049,17 @@ export interface paths { 200: { content: { "application/json": { - status?: string; + /** @description An array of swap sources */ + sources?: string[]; }; }; }; /** @description Default Response */ - 404: { + 400: { content: { "application/json": { - status?: string; + /** @description Descriptive error message */ + message?: string; }; }; }; @@ -5419,7 +6237,7 @@ export interface paths { name?: string; decimals?: number; /** @enum {string} */ - vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm"; + vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm" | "lvm"; metadata?: { logoURI?: string; verified?: boolean; @@ -5475,7 +6293,7 @@ export interface paths { name?: string; decimals?: number; /** @enum {string} */ - vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm"; + vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm" | "lvm"; metadata?: { logoURI?: string; verified?: boolean; @@ -5539,7 +6357,7 @@ export interface paths { name?: string; decimals?: number; /** @enum {string} */ - vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm"; + vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm" | "lvm"; metadata?: { logoURI?: string; verified?: boolean; @@ -5570,7 +6388,7 @@ export interface paths { name?: string; decimals?: number; /** @enum {string} */ - vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm"; + vmType?: "bvm" | "evm" | "svm" | "tvm" | "tonvm" | "suivm" | "hypevm" | "lvm"; metadata?: { logoURI?: string; verified?: boolean; @@ -5782,6 +6600,53 @@ export interface paths { }; }; }; + "/wallets/screen": { + post: { + parameters: { + header: { + /** @description Required API key for authentication. Contact the team for getting an API Key */ + "x-api-key": string; + }; + }; + requestBody: { + content: { + "application/json": { + wallets: { + address?: string; + chainId?: number; + }[]; + }; + }; + }; + responses: { + /** @description Default Response */ + 200: { + content: { + "application/json": { + message?: string; + wallets?: unknown[]; + }; + }; + }; + /** @description Default Response */ + 400: { + content: { + "application/json": { + message?: string; + }; + }; + }; + /** @description Default Response */ + 401: { + content: { + "application/json": { + message?: string; + }; + }; + }; + }; + }; + }; } export type webhooks = Record; diff --git a/packages/sdk/src/utils/executeSteps/executeSteps.test.ts b/packages/sdk/src/utils/executeSteps/executeSteps.test.ts index 1ccdc1159..38cfff9af 100644 --- a/packages/sdk/src/utils/executeSteps/executeSteps.test.ts +++ b/packages/sdk/src/utils/executeSteps/executeSteps.test.ts @@ -1038,7 +1038,7 @@ describe('Base tests', () => { const result = await executeSteps( 1, { - url: 'https://api.relay.link/get/quote', + url: 'https://api.relay.link/get/quote/v2', method: 'GET' }, wallet, diff --git a/packages/ui/src/components/widgets/SwapWidgetRenderer.tsx b/packages/ui/src/components/widgets/SwapWidgetRenderer.tsx index 2f8964587..47b099e28 100644 --- a/packages/ui/src/components/widgets/SwapWidgetRenderer.tsx +++ b/packages/ui/src/components/widgets/SwapWidgetRenderer.tsx @@ -473,19 +473,11 @@ const SwapWidgetRenderer: FC = ({ ...tokenPriceQueryOptions } ) - const originChainSupportsProtocolv2 = - fromChain?.protocol?.v2?.depository !== undefined && - toChain?.protocol?.v2?.chainId !== undefined - - //Enabled only on certain chains - const quoteProtocol = - fromChain?.id && originChainSupportsProtocolv2 ? 'preferV2' : undefined const isFromNative = fromToken?.address === fromChain?.currency?.address const explicitDeposit = useEOADetection( wallet, - quoteProtocol, fromToken?.chainId, fromChain?.vmType, fromChain, @@ -497,9 +489,7 @@ const SwapWidgetRenderer: FC = ({ const shouldSetQuoteParameters = fromToken && toToken && - (quoteProtocol !== 'preferV2' || - fromChain?.vmType !== 'evm' || - explicitDeposit !== undefined) + (fromChain?.vmType !== 'evm' || explicitDeposit !== undefined) const quoteParameters: Parameters['2'] = shouldSetQuoteParameters @@ -534,11 +524,9 @@ const SwapWidgetRenderer: FC = ({ } } : {}), - protocolVersion: quoteProtocol, - ...(quoteProtocol === 'preferV2' && - explicitDeposit !== undefined && { - explicitDeposit: explicitDeposit - }) + ...(explicitDeposit !== undefined && { + explicitDeposit: explicitDeposit + }) } : undefined diff --git a/packages/ui/src/components/widgets/TokenWidget/widget/TokenWidgetRenderer.tsx b/packages/ui/src/components/widgets/TokenWidget/widget/TokenWidgetRenderer.tsx index c3138f7b9..9631f9a74 100644 --- a/packages/ui/src/components/widgets/TokenWidget/widget/TokenWidgetRenderer.tsx +++ b/packages/ui/src/components/widgets/TokenWidget/widget/TokenWidgetRenderer.tsx @@ -559,19 +559,11 @@ const TokenWidgetRenderer: FC = ({ ...tokenPriceQueryOptions } ) - const originChainSupportsProtocolv2 = - fromChain?.protocol?.v2?.depository !== undefined && - toChain?.protocol?.v2?.chainId !== undefined - - //Enabled only on certain chains - const quoteProtocol = - fromChain?.id && originChainSupportsProtocolv2 ? 'preferV2' : undefined const isFromNative = fromToken?.address === fromChain?.currency?.address const explicitDeposit = useEOADetection( wallet, - quoteProtocol, fromToken?.chainId, fromChain?.vmType, fromChain, @@ -583,9 +575,7 @@ const TokenWidgetRenderer: FC = ({ const shouldSetQuoteParameters = fromToken && toToken && - (quoteProtocol !== 'preferV2' || - fromChain?.vmType !== 'evm' || - explicitDeposit !== undefined) + (fromChain?.vmType !== 'evm' || explicitDeposit !== undefined) const quoteParameters: Parameters['2'] = shouldSetQuoteParameters @@ -620,11 +610,9 @@ const TokenWidgetRenderer: FC = ({ } } : {}), - protocolVersion: quoteProtocol, - ...(quoteProtocol === 'preferV2' && - explicitDeposit !== undefined && { - explicitDeposit: explicitDeposit - }) + ...(explicitDeposit !== undefined && { + explicitDeposit: explicitDeposit + }) } : undefined diff --git a/packages/ui/src/hooks/useEOADetection.ts b/packages/ui/src/hooks/useEOADetection.ts index 4617436e8..809b39831 100644 --- a/packages/ui/src/hooks/useEOADetection.ts +++ b/packages/ui/src/hooks/useEOADetection.ts @@ -6,11 +6,10 @@ import useTransactionCount from './useTransactionCount.js' /** * Hook to detect if a wallet is an EOA and return the appropriate explicitDeposit flag * Includes checks for zero native balance and low transaction count - * Only runs detection when protocol version is 'preferV2' and wallet supports EOA detection + * Only runs detection when evm chain and wallet supports EOA detection */ const useEOADetection = ( wallet?: AdaptedWallet, - protocolVersion?: string, chainId?: number, chainVmType?: string, fromChain?: RelayChain, @@ -32,11 +31,7 @@ const useEOADetection = ( } const shouldRunSafetyChecks = Boolean( - protocolVersion === 'preferV2' && - chainVmType === 'evm' && - !isFromNative && - userAddress && - fromChain + chainVmType === 'evm' && !isFromNative && userAddress && fromChain ) // get native balance @@ -73,11 +68,10 @@ const useEOADetection = ( transactionCount !== undefined && transactionCount <= 1 - const conditionKey = `${wallet?.vmType}:${chainVmType}:${!!wallet?.isEOA}:${protocolVersion}:${chainId}:${walletId.current}:${hasZeroNativeBalance}:${hasLowTransactionCount}` + const conditionKey = `${wallet?.vmType}:${chainVmType}:${!!wallet?.isEOA}:${chainId}:${walletId.current}:${hasZeroNativeBalance}:${hasLowTransactionCount}` const shouldDetect = useMemo(() => { return ( - protocolVersion === 'preferV2' && chainId !== undefined && (!wallet || wallet?.vmType === 'evm') && chainVmType === 'evm' && @@ -86,7 +80,6 @@ const useEOADetection = ( ) }, [ wallet?.vmType, - protocolVersion, chainId, chainVmType, hasZeroNativeBalance, @@ -179,7 +172,7 @@ const useEOADetection = ( detectEOA() }, [conditionKey, shouldDetect, wallet, chainId]) - if (!shouldDetect && protocolVersion === 'preferV2' && chainVmType === 'evm') { + if (!shouldDetect && chainVmType === 'evm') { return explicitDeposit ?? true } diff --git a/packages/ui/src/hooks/useEnhancedTokensList.ts b/packages/ui/src/hooks/useEnhancedTokensList.ts index bc4f5e71e..ad69a217e 100644 --- a/packages/ui/src/hooks/useEnhancedTokensList.ts +++ b/packages/ui/src/hooks/useEnhancedTokensList.ts @@ -2,7 +2,7 @@ import { useMemo } from 'react' import type { BalanceMap } from './useDuneBalances' import { type Currency } from '@relayprotocol/relay-kit-hooks' import { useInternalRelayChains } from '../hooks/index.js' -import type { RelayChain } from '@relayprotocol/relay-sdk' +import type { ChainVM, RelayChain } from '@relayprotocol/relay-sdk' export type EnhancedToken = { chainId: number @@ -12,7 +12,7 @@ export type EnhancedToken = { decimals: number logoURI: string verified?: boolean - vmType?: 'bvm' | 'evm' | 'svm' | 'tvm' | 'tonvm' | 'suivm' | 'hypevm' + vmType?: ChainVM balance?: { amount: string price_usd?: number diff --git a/packages/ui/src/providers/RelayKitProvider.tsx b/packages/ui/src/providers/RelayKitProvider.tsx index 3d6bb52b2..9dc6f64b3 100644 --- a/packages/ui/src/providers/RelayKitProvider.tsx +++ b/packages/ui/src/providers/RelayKitProvider.tsx @@ -6,7 +6,7 @@ import type { RelayKitTheme } from '../themes/index.js' import { generateCssVars } from '../utils/theme.js' export type AppFees = - paths['/quote']['post']['requestBody']['content']['application/json']['appFees'] + paths['/quote/v2']['post']['requestBody']['content']['application/json']['appFees'] type RelayKitProviderOptions = { /**