-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathopenapi.yaml
312 lines (312 loc) · 9.24 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
---
openapi: 3.0.3
info:
title: relayer
description: "APIs for creating accounts, managing allowances, and relaying meta
transactions. \n NOTE: the SignedDelegateAction is not supported by the openapi
schema. \n Here's an example json of a SignedDelegateAction payload:\n ```{\"delegate_action\":
{\"actions\": [{\"Transfer\": {\"deposit\": \"1\" }}], \"max_block_height\": 922790412,
\"nonce\": 103066617000686, \"public_key\": \"ed25519:98GtfFzez3opomVpwa7i4m2nptHtc8Ha405XHMWszQtL\",
\"receiver_id\": \"relayer.example.testnet\", \"sender_id\": \"example.testnet\"
}, \"signature\": \"ed25519:4uJu8KapH98h8cQm4btE0DKnbiFXSZNT7McDw4LHy7pdAt4Mz8DfuyQZadGgFExo77or9152iwcw2q12rnFWa6bg\"
}``` \n For more details on the SignedDelegateAction data structure, please see
https://docs.rs/near-primitives/latest/near_primitives/delegate_action/struct.SignedDelegateAction.html
or https://docs.near.org/develop/relayers/build-relayer#signing-a-delegated-transaction "
license:
name: ''
version: 0.3.0
paths:
"/create_account_atomic":
post:
tags:
- crate
operationId: create_account_atomic
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/AccountIdAllowanceOauthSDAJson"
required: true
responses:
'201':
description: 'Added Oauth token https://securetoken.google.com/pagoda-oboarding-dev:Op4h13AQozM4CikngfHiFVC2xhf2
for account_id example.near with allowance (in Gas) 90000000000000 to
Relayer DB. Near onchain account creation response: {create_account_sda_result:?}'
content:
text/plain:
schema:
type: string
'400':
description: 'Error: oauth_token https://securetoken.google.com/pagoda-oboarding-dev:Op4h13AQozM4CikngfHiFVC2xhf2
has already been used to register an account. You can only register 1
account per oauth_token'
content:
text/plain:
schema:
type: string
'403':
description: 'Invalid account_id: invalid_account_id.near'
content:
text/plain:
schema:
type: string
'500':
description: |-
Error creating oauth token https://securetoken.google.com/pagoda-oboarding-dev:Op4h13AQozM4CikngfHiFVC2xhf2 in Relayer DB:
{err:?}
content:
text/plain:
schema:
type: string
"/get_allowance":
get:
tags:
- crate
operationId: get_allowance
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/AccountIdJson"
required: true
responses:
'200':
description: '90000000000000'
content:
text/plain:
schema:
type: string
'500':
description: 'Error getting allowance for account_id example.near in Relayer
DB: err_msg'
content:
text/plain:
schema:
type: string
"/register_account_and_allowance":
post:
tags:
- crate
operationId: register_account_and_allowance
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/AccountIdAllowanceOauthJson"
required: true
responses:
'201':
description: 'Added Oauth token {oauth_token: https://securetoken.google.com/pagoda-oboarding-dev:Op4h13AQozM4CikngfHiFVC2xhf2,
account_id: example.near, allowance: 90000000000000 to Relayer DB'
content:
text/plain:
schema:
type: string
'500':
description: 'Error: oauth_token https://securetoken.google.com/pagoda-oboarding-dev:Op4h13AQozM4CikngfHiFVC2xhf2
has already been used to register an account. You can only register 1
account per oauth_token'
content:
text/plain:
schema:
type: string
"/relay":
post:
tags:
- crate
operationId: relay
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
required: true
responses:
'201':
description: Relayed and sent transaction ...
content:
text/plain:
schema:
type: string
'400':
description: Error deserializing payload data object ...
content:
text/plain:
schema:
type: string
'500':
description: 'Error signing transaction: ...'
content:
text/plain:
schema:
type: string
"/send_meta_tx":
post:
tags:
- crate
operationId: send_meta_tx
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/SignedDelegateAction"
required: true
responses:
'201':
description: Relayed and sent transaction ...
content:
text/plain:
schema:
type: string
'400':
description: Error deserializing payload data object ...
content:
text/plain:
schema:
type: string
'500':
description: 'Error signing transaction: ...'
content:
text/plain:
schema:
type: string
"/update_all_allowances":
post:
tags:
- crate
operationId: update_all_allowances
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/AllowanceJson"
required: true
responses:
'200':
description: Updated 321 keys in Relayer DB
content:
text/plain:
schema:
type: string
'500':
description: 'Error updating allowance for key example.near: err_msg'
content:
text/plain:
schema:
type: string
"/update_allowance":
post:
tags:
- crate
operationId: update_allowance
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/AccountIdAllowanceJson"
required: true
responses:
'201':
description: 'Relayer DB updated for {account_id: example.near,allowance:
90000000000000}'
content:
text/plain:
schema:
type: string
'500':
description: |-
Error updating account_id example.near with allowance 90000000000000 in Relayer DB:
{db_result:?}
content:
text/plain:
schema:
type: string
components:
schemas:
AccountIdAllowanceJson:
type: object
required:
- account_id
- allowance
properties:
account_id:
type: string
example: example.near
allowance:
type: integer
format: int64
example: 900000000
minimum: 0
AccountIdAllowanceOauthJson:
type: object
required:
- account_id
- allowance
- oauth_token
properties:
account_id:
type: string
example: example.near
allowance:
type: integer
format: int64
example: 900000000
minimum: 0
oauth_token:
type: string
example: https://securetoken.google.com/pagoda-oboarding-dev:Op4h13AQozM4CikngfHiFVC2xhf2
AccountIdAllowanceOauthSDAJson:
type: object
required:
- account_id
- allowance
- oauth_token
- signed_delegate_action
properties:
account_id:
type: string
example: example.near
allowance:
type: integer
format: int64
example: 900000000
minimum: 0
oauth_token:
type: string
example: https://securetoken.google.com/pagoda-oboarding-dev:Op4h13AQozM4CikngfHiFVC2xhf2
signed_delegate_action:
"$ref": "#/components/schemas/SignedDelegateAction"
AccountIdJson:
type: object
required:
- account_id
properties:
account_id:
type: string
example: example.near
AllowanceJson:
type: object
required:
- allowance_in_gas
properties:
allowance_in_gas:
type: integer
format: int64
example: 900000000
minimum: 0
RelayError:
type: object
required:
- status_code
- message
properties:
message:
type: string
example: AccountId example.near does not have enough remaining gas allowance.
status_code:
"$ref": "#/components/schemas/StatusCode"
tags:
- name: relayer
description: APIs for creating accounts, managing allowances, and relaying meta
transactions