Skip to content

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed

packages/agent-sdk/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from "./evm";
33
export * from "./request";
44
export * from "./error";
55
export * from "./misc";
6+
export * from "./openai";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from "./params";
2+
export * from "./response";
3+
export * from "./schema";
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
export const chainIdParam = {
2+
name: "chainId",
3+
in: "query",
4+
required: true,
5+
description: "EVM Network (aka chain ID)",
6+
schema: { type: "number" },
7+
example: 100,
8+
};
9+
10+
export const addressParam = {
11+
name: "address",
12+
in: "query",
13+
required: true,
14+
description: "20 byte Ethereum address with 0x prefix",
15+
schema: { type: "string" },
16+
};
17+
18+
export const addressOrSymbolParam = {
19+
name: "address",
20+
in: "query",
21+
required: true,
22+
description:
23+
"The ERC-20 token symbol or address to be sold, if provided with the symbol do not try to infer the address.",
24+
schema: { type: "string" },
25+
example: "0x6810e776880c02933d47db1b9fc05908e5386b96",
26+
};
27+
28+
export const amountParam = {
29+
name: "amount",
30+
in: "query",
31+
required: true,
32+
description: "Amount in human-readable units (not wei)",
33+
schema: { type: "number" },
34+
example: 0.123,
35+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export const SignRequestResponse200 = {
2+
description: "Successful signing request",
3+
content: {
4+
"application/json": {
5+
schema: {
6+
type: "object",
7+
required: ["transaction"],
8+
properties: {
9+
transaction: { $ref: "#/components/schemas/SignRequest" },
10+
meta: {
11+
type: "object",
12+
additionalProperties: true,
13+
example: { message: "Submitted" },
14+
},
15+
},
16+
},
17+
},
18+
},
19+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
export const AddressSchema = {
2+
description: "20 byte Ethereum address encoded as a hex with `0x` prefix.",
3+
type: "string",
4+
example: "0x6810e776880c02933d47db1b9fc05908e5386b96",
5+
};
6+
7+
export const MetaTransactionSchema = {
8+
type: "object",
9+
description: "Sufficient data representing an EVM transaction",
10+
properties: {
11+
to: { $ref: "#/components/schemas/Address" },
12+
data: {
13+
type: "string",
14+
description: "Transaction calldata",
15+
example: "0xd0e30db0",
16+
},
17+
value: {
18+
type: "string",
19+
description: "Transaction value",
20+
example: "0x1b4fbd92b5f8000",
21+
},
22+
},
23+
required: ["to", "data", "value"],
24+
};
25+
26+
export const SignRequestSchema = {
27+
type: "object",
28+
required: ["method", "chainId", "params"],
29+
properties: {
30+
method: {
31+
type: "string",
32+
enum: [
33+
"eth_sign",
34+
"personal_sign",
35+
"eth_sendTransaction",
36+
"eth_signTypedData",
37+
"eth_signTypedData_v4",
38+
],
39+
description: "The signing method to be used.",
40+
},
41+
chainId: {
42+
type: "integer",
43+
description: "The ID of the Ethereum chain.",
44+
},
45+
params: {
46+
oneOf: [
47+
{
48+
type: "array",
49+
items: { $ref: "#/components/schemas/MetaTransaction" },
50+
},
51+
{
52+
type: "array",
53+
items: { type: "string" },
54+
},
55+
],
56+
},
57+
},
58+
};

0 commit comments

Comments
 (0)