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
49 changes: 49 additions & 0 deletions .changeset/api-types-nullable-amounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
'@relayprotocol/relay-kit-hooks': major
'@relayprotocol/relay-kit-ui': major
'@relayprotocol/relay-sdk': major
---

`paths` and `routes` now track the current Relay API. Three endpoints are gone, request
amount fields are nullable, and deposit addresses, fee sponsorship and route racing gained
new options.

**Breaking**

- `/execute/swap`, `/requests/{requestId}/signature` and `/requests/{requestId}/signature/v2`
are removed from `paths` and from the exported `routes` array. Quotes come from
`POST /quote/v2`. `SwapBreakdown` and `Execute['breakdown']` are unchanged — the SDK now
declares that shape directly instead of deriving it from `/execute/swap`.
- On `GET /requests/v2` and `GET /requests/v3`, amount-bearing fields are now `string | null`
rather than `string | undefined`: `appFees[]` / `paidAppFees[]` (`recipient`, `bps`,
`amount`, `amountUsd`, `amountUsdCurrent`), `data.fees.*` (`usd`, `amount`,
`amountFormatted`) and `data.route.*` currency amounts (`amount`, `amountFormatted`,
`amountUsd`, `minimumAmount`). This reaches `useRequests`, `queryRequests` and
`useDepositAddressStatus`. Passing one of these into a `string | undefined` slot no longer
compiles — use `?? undefined`, or widen the receiving type to accept `null`.
- `ChainVM` gains `'hederavm'`. An exhaustive `switch` over `ChainVM` with a `never`
fallthrough needs the new case.
- `GET /config/v2` no longer accepts `currency: "degen"` or `"usdh"`, and `GET /prices/rates`
no longer returns `DEGEN`. Remove references to those literals; `"ausd"` is now accepted.

**Added**

- `GET /deposit-addresses/v2` returns a deposit address with its `deposits` and `sweeps`
history, and `POST /deposit-addresses/{depositAddressId}/disable/v2` disables one.
`/quote` and `/quote/v2` responses now carry `requestId` and, on deposit-address steps,
`depositAddressId`.
- Quote request options: `subsidizationBps` (share of each sponsored fee component the
sponsor covers, applied before `maxSubsidizationAmount`), `indicativeQuote`,
`referencePrice`, `useRouteRacing` and `routeRacingMinUsdSize`. `subsidizationBps` is
echoed back in `feeSponsorship` on quotes and requests.
- `GET /requests/v3` accepts a `referrer` filter (requires `apiKey`) and returns `apiKeyName`
and `blockedAddresses` to the request's creator integrator. `GET /requests/v2` responses
carry a `deprecation` block with its sunset and successor.
- `MANUAL_REFUND_REQUIRED` joins `refundFailReason`; `GET /intents/status/v3` now reports
`failReason` and `refundFailReason`; `GET /withdrawals/status` returns `txHash`;
`hederavm` joins the chain VM types.

**Deprecated**

- The `strict` quote parameter is ignored by `/quote/v2`; deposit-address creation follows
the requested trade type.
5 changes: 2 additions & 3 deletions packages/sdk/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ export const routes = [
"/config",
"/config/v2",
"/deposit-addresses/v1",
"/deposit-addresses/v2",
"/deposit-addresses/{depositAddressId}/disable/v2",
"/execute/permits",
"/quote",
"/quote/v2",
"/price",
"/execute/swap",
"/execute",
"/fast-fill",
"/lives",
"/intents/status",
"/intents/status/v2",
"/intents/status/v3",
"/requests/{requestId}/signature",
"/requests/{requestId}/signature/v2",
"/requests",
"/requests/v2",
"/requests/v3",
Expand Down
7 changes: 6 additions & 1 deletion packages/sdk/src/types/Execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ import type { TransactionReceipt } from 'viem'

export type QuoteFees =
paths['/quote/v2']['post']['responses']['200']['content']['application/json']['fees']
// Inlined from the dropped /execute/swap schema; still returned on execute step payloads.
export type SwapBreakdown =
paths['/execute/swap']['post']['responses']['200']['content']['application/json']['breakdown']
| {
value?: string
timeEstimate?: number
}[]
| undefined
export type CheckApi = NonNullable<
NonNullable<
paths['/quote/v2']['post']['responses']['200']['content']['application/json']['steps']
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/types/RelayChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type ChainVM =
| 'lvm'
| 'tonvm'
| 'xrpvm'
| 'hederavm'

export type RelayChain = {
id: number
Expand Down
Loading