Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/neat-pugs-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@relayprotocol/relay-kit-hooks': major
'@relayprotocol/relay-sdk': major
'@relayprotocol/relay-kit-ui': major
---

Upgrade to quote/v2 api
4 changes: 2 additions & 2 deletions demo/pages/api/secure/[...path].ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions packages/hooks/src/hooks/useQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -36,7 +36,7 @@ export const queryQuote = function (
config?: AxiosRequestConfig
): Promise<QuoteResponse> {
return new Promise((resolve, reject) => {
const href = `${baseApiUrl}/quote`
const href = `${baseApiUrl}/quote/v2`
axiosPostFetcher(href, options, config)
.then((response) => {
const request: AxiosRequestConfig = {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/actions/apiKey.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/actions/getQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: {
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ export const routes = [
"/execute/swap/multi-input",
"/execute/permits",
"/quote",
"/quote/v2",
"/price",
"/execute",
"/fast-fill",
"/lives",
"/intents/status",
"/intents/status/v2",
"/intents/status/v3",
"/intents/quote",
"/intents/quote/v2",
"/requests/{requestId}/signature",
"/requests/{requestId}/signature/v2",
"/requests",
"/requests/v2",
"/requests/metadata",
"/transactions/index",
"/transactions/single",
"/transactions/status",
"/swap-sources",
"/loadforge.txt",
"/conduit/install",
"/prices/rates",
Expand All @@ -40,5 +39,6 @@ export const routes = [
"/chains/{chainId}/currencies/{address}",
"/chains/{chainId}/currencies/{address}/chart",
"/provision/chain",
"/sanctioned/{address}"
"/sanctioned/{address}",
"/wallets/screen"
];
6 changes: 3 additions & 3 deletions packages/sdk/src/types/Execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 9 additions & 1 deletion packages/sdk/src/types/RelayChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading