Skip to content

Commit

Permalink
Merge pull request #13 from reservoirprotocol/pedro/grwth-4057-add-so…
Browse files Browse the repository at this point in the history
…urce-to-sdk-call-api

Add source to sdk call api
  • Loading branch information
pedromcunha authored Feb 9, 2024
2 parents 62bb413 + 7024523 commit 333e237
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 3,312 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-worms-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@reservoir0x/relay-sdk': patch
---

Add source attribution parameter to call action
1 change: 0 additions & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"private": true,
"name": "relay-sdk-demo",
"version": "0.0.0",
"scripts": {
"dev": "next-remote-watch ../packages/ui/dist",
"build": "next build",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"package:release": "pnpm run deploy && changeset version && pnpm -r publish --access public && changeset tag && git push --follow-tags",
"build:sdk": "pnpm run -C packages/sdk build",
"build:adapter": "pnpm run -C packages/relay-ethers-wallet-adapter build",
"syncSdkTypes": "pnpm run -C packages/sdk ./scripts/sync-api.mjs",
"syncSdkTypes": "node packages/sdk/scripts/sync-api.mjs",
"deploy": "pnpm build:sdk && pnpm build:adapter",
"sdk": "pnpm run -C packages/sdk dev",
"typecheck": "tsc --noEmit"
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"node-fetch": "^3.3.2",
"rimraf": "^5.0.5"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/actions/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export async function call(data: Data) {
txs: preparedTransactions,
originChainId: chainId,
destinationChainId: toChainId,
source: client.source || undefined,
...options,
}

Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const routes = [
"/chains",
"/chains/add",
"/chains/update",
"/chains/status",
"/config",
"/execute/call",
"/lives",
Expand Down
119 changes: 119 additions & 0 deletions packages/sdk/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,52 @@ export interface paths {
};
};
};
"/admin/chains": {
get: {
parameters: {
header: {
"x-admin-api-key": string;
};
};
responses: {
/** @description Default Response */
200: {
content: {
"application/json": {
chains?: ({
id?: number;
name?: string;
httpRpcUrl?: string;
wsRpcUrl?: string | null;
targetBalance?: string;
capacityPerRequest?: string;
feeBpsPrice?: string | null;
stack?: string | null;
httpRpcUrlPublic?: string | null;
wsRpcUrlPublic?: string | null;
explorerUrl?: string | null;
explorerName?: string | null;
displayName?: string | null;
depositAddress?: string | null;
baseChainId?: number | null;
enabled?: boolean;
rebalancePercentage?: string | null;
bufferPercentage?: string | null;
})[];
};
};
};
/** @description Default Response */
401: {
content: {
"application/json": {
message?: string;
};
};
};
};
};
};
"/chains/add": {
post: {
parameters: {
Expand All @@ -58,6 +104,8 @@ export interface paths {
displayName: string;
depositAddress?: string;
baseChainId?: number;
rebalancePercentage?: string;
bufferPercentage?: string;
};
};
};
Expand Down Expand Up @@ -121,6 +169,8 @@ export interface paths {
explorerName?: string;
displayName?: string;
depositAddress?: string;
rebalancePercentage?: string;
bufferPercentage?: string;
};
};
};
Expand Down Expand Up @@ -160,6 +210,41 @@ export interface paths {
};
};
};
"/chains/status": {
post: {
parameters: {
header: {
"x-admin-api-key": string;
};
};
requestBody: {
content: {
"application/json": {
chainId?: number;
enabled: boolean;
};
};
};
responses: {
/** @description Default Response */
200: {
content: {
"application/json": {
message?: string;
};
};
};
/** @description Default Response */
401: {
content: {
"application/json": {
message?: string;
};
};
};
};
};
};
"/config": {
get: {
parameters: {
Expand Down Expand Up @@ -203,6 +288,7 @@ export interface paths {
value?: string;
data?: string;
}[];
source?: string;
};
};
};
Expand Down Expand Up @@ -310,6 +396,7 @@ export interface paths {
content: {
"application/json": {
request: Record<string, never>;
source?: string;
};
};
};
Expand Down Expand Up @@ -441,6 +528,11 @@ export interface paths {
};
"/transactions/index": {
post: {
parameters: {
header: {
"x-admin-api-key": string;
};
};
requestBody: {
content: {
"application/json": {
Expand Down Expand Up @@ -509,6 +601,33 @@ export interface paths {
};
};
};
"/admin/rebalance": {
post: {
parameters: {
header: {
"x-admin-api-key": string;
};
};
responses: {
/** @description Default Response */
200: {
content: {
"application/json": {
message?: string;
};
};
};
/** @description Default Response */
401: {
content: {
"application/json": {
message?: string;
};
};
};
};
};
};
}

export type webhooks = Record<string, never>;
Expand Down
Loading

0 comments on commit 333e237

Please sign in to comment.