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
5 changes: 5 additions & 0 deletions .changeset/fluffy-ideas-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@yieldxyz/sdk": patch
---

feat: add abort signal support + schema changes
33 changes: 17 additions & 16 deletions src/api-client.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { sdkConfig } from "./sdk-config";

export const customFetch = async <T>({
url,
method,
params,
headers,
data,
signal,
}: {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
params?: unknown;
data?: unknown;
headers?: Record<string, string>;
signal?: AbortSignal;
}): Promise<T> => {
export const customFetch = async <T>(
{
url,
method,
params,
headers,
data,
}: {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
params?: unknown;
data?: unknown;
headers?: Record<string, string>;
},
options?: { signal?: AbortSignal },
): Promise<T> => {
const {
apiKey,
baseURL = "https://api.yield.xyz/",
Expand All @@ -26,7 +27,7 @@ export const customFetch = async <T>({
const requestInit: RequestInit = {
method,
headers: { ...headers, "X-API-KEY": apiKey },
signal,
signal: options?.signal,
...(!!data && { body: JSON.stringify(data) }),
};

Expand Down
27 changes: 27 additions & 0 deletions src/api/index.msw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const getYieldsControllerGetYieldsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -182,6 +183,7 @@ export const getYieldsControllerGetYieldsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -302,6 +304,7 @@ export const getYieldsControllerGetYieldsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -424,6 +427,7 @@ export const getYieldsControllerGetYieldsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -564,6 +568,7 @@ export const getYieldsControllerGetYieldsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -749,6 +754,7 @@ export const getYieldsControllerGetYieldsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -1371,6 +1377,7 @@ export const getYieldsControllerGetAggregateBalancesResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -1525,6 +1532,7 @@ export const getYieldsControllerGetAggregateBalancesResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -1736,6 +1744,7 @@ export const getYieldsControllerGetAggregateBalancesResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -1927,6 +1936,7 @@ export const getYieldsControllerGetYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -2031,6 +2041,7 @@ export const getYieldsControllerGetYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -2148,6 +2159,7 @@ export const getYieldsControllerGetYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -2270,6 +2282,7 @@ export const getYieldsControllerGetYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -2408,6 +2421,7 @@ export const getYieldsControllerGetYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -2584,6 +2598,7 @@ export const getYieldsControllerGetYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -3140,6 +3155,7 @@ export const getYieldsControllerGetYieldBalancesResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -3292,6 +3308,7 @@ export const getYieldsControllerGetYieldBalancesResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -3499,6 +3516,7 @@ export const getYieldsControllerGetYieldBalancesResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -3741,6 +3759,7 @@ export const getYieldsControllerGetYieldValidatorsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -3982,6 +4001,7 @@ export const getActionsControllerGetActionsResponseMock =
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -4263,6 +4283,7 @@ export const getActionsControllerGetActionResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -4537,6 +4558,7 @@ export const getActionsControllerEnterYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -4811,6 +4833,7 @@ export const getActionsControllerExitYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -5085,6 +5108,7 @@ export const getActionsControllerManageYieldResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -5319,6 +5343,7 @@ export const getTransactionsControllerSubmitTransactionHashResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -5529,6 +5554,7 @@ export const getTransactionsControllerGetTransactionResponseMock = (
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down Expand Up @@ -5739,6 +5765,7 @@ export const getNetworksControllerGetNetworksResponseMock = (): NetworkDto[] =>
"viction",
"core",
"sonic",
"katana",
"agoric",
"akash",
"axelar",
Expand Down
Loading