-
Notifications
You must be signed in to change notification settings - Fork 239
/
pathfinder_rpc_api.json
333 lines (333 loc) · 13.5 KB
/
pathfinder_rpc_api.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
{
"openrpc": "1.2.6",
"info": {
"title": "Pathfinder RPC API",
"version": "0.1",
"description": "Provides additional (pathfinder specific) methods over and above the Starknet RPC API"
},
"methods": [
{
"name": "pathfinder_version",
"summary": "The version of the pathfinder node hosting this API.",
"params": [],
"result": {
"name": "semver version",
"required": true,
"schema": {
"type": "string",
"description": "A semver compatible version string"
}
}
},
{
"name": "pathfinder_getProof",
"summary": "Returns merkle proofs of a contract's storage state",
"description": "This method returns merkle proofs for a contract's storage. This allows you to verify a contract's state for a specific Starknet block.",
"params": [
{
"name": "block_id",
"description": "The hash of the requested block, or number (height) of the requested block, or a block tag",
"required": true,
"schema": {
"$ref": "#/components/schemas/BLOCK_ID"
}
}, {
"name": "contract_address",
"description": "The address of the contract",
"required": true,
"schema": {
"$ref": "#/components/schemas/ADDRESS"
}
}, {
"name": "keys",
"description": "The storage element addresses to gather proofs for",
"required": true,
"schema": {
"type": "array",
"items": {
"title": "storage address",
"$ref": "#/components/schemas/ADDRESS"
}
}
}
],
"result": {
"name": "storage proofs",
"required": true,
"schema": {
"type": "object",
"description": "Contains the requested contract's state proofs",
"properties": {
"state_commitment": {
"title": "Starknet state commitment",
"description": "The commitment for the state of a Starknet block. Before Starknet v0.11.0 this was equivalent to storage commitment, which is the hash of the first node in the contract proof",
"$ref": "#/components/schemas/FELT"
},
"class_commitment": {
"title": "The root of the class commitment tree",
"$ref": "#/components/schemas/FELT"
},
"contract_proof": {
"title": "Proof of the contract state hash",
"$ref": "#/components/schemas/PROOF"
},
"contract_data": {
"type": "object",
"description": "Only present if the contract exists",
"properties": {
"class_hash": {
"description": "The hash of the contract's class",
"$ref": "#/components/schemas/FELT"
},
"nonce": {
"description": "The contract's nonce",
"$ref": "#/components/schemas/FELT"
},
"root": {
"description": "The contract's storage state root hash",
"$ref": "#/components/schemas/FELT"
},
"contract_state_hash_version": {
"description": "The state hash version used to calculate the state hash",
"$ref": "#/components/schemas/FELT"
},
"storage_proofs": {
"description": "Contains the requested storage proofs (in order of request)",
"type": "array",
"items": {
"$ref": "#/components/schemas/PROOF"
}
}
},
"required": ["class_hash", "nonce", "root", "contract_state_hash_version"]
}
},
"required": ["contract_proof"]
}
},
"errors": [
{
"$ref": "#/components/errors/PROOF_LIMIT_EXCEEDED"
}
]
},
{
"name": "pathfinder_getTransactionStatus",
"summary": "Returns the status of a transaction",
"description": "Returns a transaction's current status, including if it has been rejected by the sequencer.",
"params": [
{
"name": "transaction_hash",
"summary": "The hash of the requested transaction",
"required": true,
"schema": {
"$ref": "#/components/schemas/TXN_HASH"
}
}
],
"result": {
"name": "result",
"description": "The status of the transaction.",
"schema": {
"$ref": "#/components/schemas/TX_GATEWAY_STATUS"
}
}
}
],
"components": {
"contentDescriptors": {},
"schemas": {
"BLOCK_ID": {
"title": "Block hash, number or tag",
"oneOf": [
{
"type": "object",
"properties": {
"block_hash": {
"$ref": "#/components/schemas/BLOCK_HASH"
}
}
}, {
"type": "object",
"properties": {
"block_number": {
"$ref": "#/components/schemas/BLOCK_NUMBER"
}
}
}, {
"$ref": "#/components/schemas/BLOCK_TAG"
}
]
},
"BLOCK_TAG": {
"type": "string",
"description": "A tag specifying a dynamic reference to a block",
"enum": ["latest", "pending"]
},
"FELT": {
"type": "string",
"title": "Field element",
"$comment": "A field element, represented as a string of hex digits",
"description": "A field element represented as a string of hex digits with a 0x prefix and up-to 63 hex digits",
"pattern": "^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$"
},
"BLOCK_NUMBER": {
"description": "The block's number (its height)",
"type": "integer",
"minimum": 0
},
"BLOCK_HASH": {
"$ref": "#/components/schemas/FELT"
},
"ADDRESS": {
"$ref": "#/components/schemas/FELT"
},
"PROOF": {
"type": "array",
"title": "Ordered set of merkle tree nodes which constitute a merkle proof",
"description": "Set of merkle tree nodes which constitute a merkle proof. Ordered from root towards the target.",
"items": {
"$ref": "#/components/schemas/NODE"
}
},
"NODE": {
"oneof": [
{
"$ref": "#/components/schemas/BINARY_NODE"
}, {
"$ref": "#/components/schemas/EDGE_NODE"
}
]
},
"BINARY_NODE": {
"type": "object",
"properties": {
"binary": {
"type": "object",
"properties": {
"left": {
"title": "Left child's hash",
"$ref": "#/components/schemas/FELT"
},
"right": {
"title": "Right child's hash",
"$ref": "#/components/schemas/FELT"
}
},
"required": ["left", "right"]
}
},
"required": ["binary"]
},
"EDGE_NODE": {
"type": "object",
"properties": {
"edge": {
"type": "object",
"properties": {
"child": {
"title": "Child's hash",
"$ref": "#/components/schemas/FELT"
},
"path": {
"type": "object",
"properties": {
"value": {
"title": "The path of this edge node",
"$ref": "#/components/schemas/FELT"
},
"len": {
"title": "The bit length of this path",
"type": "integer"
}
},
"required": ["value", "len"]
}
},
"required": ["child", "path"]
}
},
"required": ["edge"]
},
"TXN_HASH": {
"$ref": "#/components/schemas/FELT",
"description": "The transaction hash, as assigned in Starknet",
"title": "A transaction's hash"
},
"TX_GATEWAY_STATUS": {
"type": "string",
"enum": [
"NOT_RECEIVED",
"RECEIVED",
"PENDING",
"REJECTED",
"ACCEPTED_ON_L1",
"ACCEPTED_ON_L2",
"REVERTED",
"ABORTED"
],
"description": "The status of a transaction"
}
},
"errors": {
"BLOCK_NOT_FOUND": {
"code": 24,
"message": "Block not found"
},
"PROOF_LIMIT_EXCEEDED": {
"code": 10000,
"message": "Too many storage keys requested",
"data": {
"type": "object",
"properties": {
"limit": {
"description": "The maximum number of storage keys a request may have",
"type": "integer"
},
"requested": {
"description": "The number of storage keys this request had",
"type": "integer"
}
},
"required": ["limit", "requested"]
}
},
"PROOF_MISSING": {
"code": 10001,
"message": "Merkle trie proof is not available"
},
"SUBSCRIPTION_TXN_HASH_NOT_FOUND": {
"code": 10029,
"message": "Transaction hash not found",
"data": {
"type": "object",
"properties": {
"subscription_id": {
"description": "The subscription id",
"type": "integer"
},
"transaction_hash": {
"title": "transaction hash",
"$ref": "#/components/schemas/TXN_HASH"
}
},
"required": ["subscription_id", "transaction_hash"]
}
},
"SUBSCRIPTION_GATEWAY_DOWN": {
"code": 10030,
"message": "Gateway is down",
"data": {
"type": "object",
"properties": {
"subscription_id": {
"description": "The subscription id",
"type": "integer"
}
},
"required": ["subscription_id"]
}
}
}
}
}