Skip to content

Commit 2f126a8

Browse files
committed
feat: update wallet apis with create session
1 parent 54b76a4 commit 2f126a8

File tree

3 files changed

+310
-174
lines changed

3 files changed

+310
-174
lines changed

accounts/wallet_createSession.json

+186
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
{
2+
"request": {
3+
"type": "array",
4+
"items": {
5+
"type": "object",
6+
"properties": {
7+
"account": {
8+
"type": "string",
9+
"pattern": "^0x(.*)$"
10+
},
11+
"chainId": {
12+
"type": "string",
13+
"pattern": "^0x(.*)$"
14+
},
15+
"expiry": {
16+
"type": "number"
17+
},
18+
"key": {
19+
"type": "object",
20+
"properties": {
21+
"type": {
22+
"anyOf": [
23+
{
24+
"type": "string",
25+
"enum": ["secp256k1"]
26+
},
27+
{
28+
"type": "string",
29+
"enum": ["contract"]
30+
}
31+
]
32+
},
33+
"publicKey": {
34+
"type": "string",
35+
"pattern": "^0x(.*)$"
36+
}
37+
},
38+
"required": ["type", "publicKey"]
39+
},
40+
"permissions": {
41+
"minItems": 1,
42+
"type": "array",
43+
"items": {
44+
"anyOf": [
45+
{
46+
"description": "allows transfer of native tokens from the account",
47+
"type": "object",
48+
"properties": {
49+
"type": {
50+
"type": "string",
51+
"enum": ["native-token-transfer"]
52+
},
53+
"data": {
54+
"type": "object",
55+
"properties": {
56+
"allowance": {
57+
"type": "string",
58+
"pattern": "^0x(.*)$"
59+
}
60+
},
61+
"required": ["allowance"]
62+
}
63+
},
64+
"required": ["type", "data"]
65+
},
66+
{
67+
"description": "allows the key to spend gas for UOs",
68+
"type": "object",
69+
"properties": {
70+
"type": {
71+
"type": "string",
72+
"enum": ["gas-limit"]
73+
},
74+
"data": {
75+
"type": "object",
76+
"properties": {
77+
"limit": {
78+
"type": "string",
79+
"pattern": "^0x(.*)$"
80+
}
81+
},
82+
"required": ["limit"]
83+
}
84+
},
85+
"required": ["type", "data"]
86+
},
87+
{
88+
"description": "grants access to functions in the account",
89+
"type": "object",
90+
"properties": {
91+
"type": {
92+
"type": "string",
93+
"enum": ["account-functions"]
94+
},
95+
"data": {
96+
"type": "object",
97+
"properties": {
98+
"functions": {
99+
"minItems": 1,
100+
"type": "array",
101+
"items": {
102+
"type": "string",
103+
"pattern": "^0x(.*)$"
104+
}
105+
}
106+
},
107+
"required": ["functions"]
108+
}
109+
},
110+
"required": ["type", "data"]
111+
},
112+
{
113+
"description": "grants full access to everything",
114+
"type": "object",
115+
"properties": {
116+
"type": {
117+
"type": "string",
118+
"enum": ["root"]
119+
},
120+
"data": {
121+
"not": {}
122+
}
123+
},
124+
"required": ["type"]
125+
}
126+
]
127+
}
128+
}
129+
},
130+
"required": ["account", "chainId", "key", "permissions"]
131+
}
132+
},
133+
"response": {
134+
"type": "object",
135+
"properties": {
136+
"sessionId": {
137+
"type": "string",
138+
"pattern": "^0x(.*)$"
139+
},
140+
"signatureRequest": {
141+
"anyOf": [
142+
{
143+
"type": "object",
144+
"properties": {
145+
"type": {
146+
"type": "string",
147+
"enum": ["personal_sign"]
148+
},
149+
"data": {
150+
"anyOf": [
151+
{
152+
"minLength": 1,
153+
"type": "string"
154+
},
155+
{
156+
"type": "object",
157+
"properties": {
158+
"raw": {
159+
"type": "string",
160+
"pattern": "^0x(.*)$"
161+
}
162+
},
163+
"required": ["raw"]
164+
}
165+
]
166+
}
167+
},
168+
"required": ["type", "data"]
169+
},
170+
{
171+
"type": "object",
172+
"properties": {
173+
"type": {
174+
"type": "string",
175+
"enum": ["eth_signTypedData_v4"]
176+
},
177+
"data": {}
178+
},
179+
"required": ["type", "data"]
180+
}
181+
]
182+
}
183+
},
184+
"required": ["sessionId", "signatureRequest"]
185+
}
186+
}

accounts/wallet_createSession.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# This file is generated by scripts/generate-schema.ts
2+
openapi: 3.1.0
3+
info:
4+
title: wallet_createSession
5+
version: 1.0.0
6+
servers:
7+
- url: https://api.g.alchemy.com
8+
x-sandbox:
9+
category:
10+
type:
11+
$ref: "../components/sandbox.yaml#/Category"
12+
value: accounts
13+
paths:
14+
/{apiKey}:
15+
post:
16+
summary: wallet_createSession
17+
18+
x-readme:
19+
samples-languages:
20+
- javascript
21+
- curl
22+
- python
23+
- go
24+
parameters:
25+
- name: apiKey
26+
in: path
27+
schema:
28+
type: string
29+
default: docs-demo
30+
description: |
31+
<style>
32+
.custom-style {
33+
color: #048FF4;
34+
}
35+
</style>
36+
For higher throughput, <span class="custom-style"><a href="https://alchemy.com/?a=docs-demo" target="_blank">create your own API key</a></span>
37+
required: true
38+
39+
requestBody:
40+
required: true
41+
content:
42+
application/json:
43+
schema:
44+
type: object
45+
properties:
46+
id:
47+
type: integer
48+
default: 1
49+
jsonrpc:
50+
type: string
51+
default: "2.0"
52+
enum:
53+
- "2.0"
54+
method:
55+
type: string
56+
default: wallet_createSession
57+
enum:
58+
- wallet_createSession
59+
params:
60+
$ref: wallet_createSession.json#/request
61+
responses:
62+
"200":
63+
description: "Success"
64+
content:
65+
application/json:
66+
schema:
67+
$ref: "#/components/schemas/Response"
68+
operationId: wallet-createsession
69+
x-sandbox:
70+
category:
71+
type:
72+
$ref: "../components/sandbox.yaml#/Category"
73+
value: accounts
74+
components:
75+
schemas:
76+
Response:
77+
$ref: wallet_createSession.json#/response

0 commit comments

Comments
 (0)