-
Notifications
You must be signed in to change notification settings - Fork 241
/
pathfinder_ws.json
313 lines (313 loc) · 11.8 KB
/
pathfinder_ws.json
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
313
{
"openrpc": "1.2.6",
"info": {
"title": "Pathfinder websocket RPC API",
"version": "0.1",
"description": "Provides additional (pathfinder specific) methods over and above the Starknet RPC API"
},
"methods": [
{
"name": "pathfinder_subscribe",
"summary": "Open a new websocket subscription",
"description": "Creates a websocket stream which will fire events of the requested subscription type. Only available for websocket connections.",
"params": {
"oneOf": [
[
{
"name": "kind",
"summary": "The type of subscription",
"required": true,
"schema": {
"type": "string",
"enum": [
"newHeads"
]
}
}
],
[
{
"name": "kind",
"summary": "The type of subscription",
"required": true,
"schema": {
"type": "string",
"enum": [
"events"
]
}
},
{
"name": "address",
"summary": "The from_address to filter events by",
"required": false,
"schema": {
"$ref": "#/components/schemas/FELT"
}
},
{
"name": "keys",
"summary": "The keys to filter events by",
"required": false,
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FELT"
}
}
}
],
[
{
"name": "kind",
"summary": "The type of subscription",
"required": true,
"schema": {
"type": "string",
"enum": [
"transactionStatus"
]
}
},
{
"name": "transaction_hash",
"summary": "The transaction hash to fetch status updates for",
"required": true,
"schema": {
"$ref": "#/components/schemas/FELT"
}
}
]
]
},
"result": {
"name": "subscription ID",
"description": "An identifier for this subscription stream used to associate events with this subscription.",
"schema": {
"type": "integer"
}
}
},
{
"name": "pathfinder_unsubscribe",
"summary": "Closes a websocket subscription",
"description": "Creates a websocket stream which will fire events of the requested subscription type. Only available for websocket connections.",
"params": [
{
"name": "subscription ID",
"summary": "The subscription to close",
"required": true,
"schema": {
"type": "integer"
}
}
],
"result": {
"name": "Unsubscription result",
"description": "True if the unsubscription was successful",
"schema": {
"type": "boolean"
}
}
},
{
"name": "pathfinder_subscription",
"summary": "A subscription event notification sent by the node.",
"params": [],
"result": {
"name": "Subscription event",
"schema": {
"type": "object",
"properties": {
"subscription": {
"name": "Subscription ID",
"summary": "The subscription this event is for",
"type": "integer"
},
"event": {
"$ref": "#/components/schemas/SUBSCRIPTION_EVENT"
}
},
"required": [
"subscription",
"event"
]
}
},
"errors": [
{
"$ref": "#/components/errors/WEBSOCKET_SUBSCRIPTION_CLOSED"
}
]
}
],
"components": {
"contentDescriptors": {},
"schemas": {
"SUBSCRIPTION_EVENT": {
"title": "Subscription event",
"oneOf": [
{
"$ref": "#/components/schemas/BLOCK_HEADER"
},
{
"$ref": "#/components/schemas/EMITTED_EVENT"
},
{
"$ref": "#/components/schemas/TRANSACTION_STATUS"
}
]
},
"BLOCK_HEADER": {
"type": "object",
"properties": {
"hash": {
"ref": "#/components/schemas/FELT"
},
"parent_hash": {
"ref": "#/components/schemas/FELT"
},
"number": {
"type": "integer"
},
"timestamp": {
"type": "integer"
},
"eth_l1_gas_price": {
"ref": "#/components/schemas/FELT"
},
"strk_l1_gas_price": {
"ref": "#/components/schemas/FELT"
},
"eth_l1_data_gas_price": {
"ref": "#/components/schemas/FELT"
},
"strk_l1_data_gas_price": {
"ref": "#/components/schemas/FELT"
},
"sequencer_address": {
"ref": "#/components/schemas/FELT"
},
"starknet_version": {
"ref": "string"
},
"class_commitment": {
"ref": "#/components/schemas/FELT"
},
"event_commitment": {
"ref": "#/components/schemas/FELT"
},
"state_commitment": {
"ref": "#/components/schemas/FELT"
},
"storage_commitment": {
"ref": "#/components/schemas/FELT"
},
"transaction_commitment": {
"ref": "#/components/schemas/FELT"
},
"transaction_count": {
"type": "integer"
},
"event_count": {
"type": "integer"
},
"l1_da_mode": {
"type": "string",
"enum": [
"BLOB",
"CALLDATA"
]
}
},
"required": [
"hash",
"parent_hash",
"number",
"timestamp",
"eth_l1_gas_price",
"strk_l1_gas_price",
"sequencer_address",
"starknet_version",
"class_commitment",
"event_commitment",
"state_commitment",
"storage_commitment",
"transaction_commitment",
"transaction_count",
"event_count"
]
},
"EMITTED_EVENT": {
"title": "Emitted event",
"description": "Event information decorated with metadata on where it was emitted / An event emitted as a result of transaction execution",
"allOf": [
{
"title": "Event",
"description": "The event information",
"$ref": "./v07/starknet_api_openrpc.json#/components/schemas/EVENT"
},
{
"title": "Event context",
"description": "The event emission information, without block hash",
"type": "object",
"properties": {
"block_number": {
"title": "Block number",
"description": "The number of the block in which the event was emitted",
"$ref": "#/components/schemas/BLOCK_NUMBER"
},
"transaction_hash": {
"title": "Transaction hash",
"description": "The transaction that emitted the event",
"$ref": "#/components/schemas/TXN_HASH"
}
},
"required": [
"block_number",
"transaction_hash"
]
}
]
},
"TRANSACTION_STATUS": {
"type": "string",
"enum": [
"RECEIVED",
"REJECTED",
"SUCCEEDED",
"REVERTED"
]
},
"FELT": {
"$ref": "./pathfinder_rpc_api.json#/components/schemas/FELT"
}
},
"errors": {
"WEBSOCKET_SUBSCRIPTION_CLOSED": {
"code": -32099,
"message": "Websocket subscription closed",
"data": {
"type": "object",
"description": "More data about the execution failure",
"properties": {
"id": {
"title": "Subscription ID",
"description": "The ID of the closed subscription",
"type": "integer"
},
"reason": {
"title": "Closing reason",
"description": "The reason why the subscription was closed",
"type": "string"
}
},
"required": [
"id",
"reason"
]
}
}
}
}
}