starknet 4.9.0 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +1 -3
- package/__tests__/account.test.ts +5 -1
- package/__tests__/defaultProvider.test.ts +97 -210
- package/__tests__/fixtures.ts +2 -2
- package/__tests__/rpcProvider.test.ts +7 -4
- package/__tests__/udc.test.ts +41 -0
- package/account/default.d.ts +3 -1
- package/account/default.js +53 -3
- package/account/interface.d.ts +24 -7
- package/constants.d.ts +7 -1
- package/constants.js +7 -1
- package/contract/default.d.ts +11 -27
- package/contract/default.js +104 -120
- package/contract/interface.d.ts +5 -2
- package/dist/account/default.d.ts +3 -1
- package/dist/account/default.js +53 -3
- package/dist/account/interface.d.ts +24 -7
- package/dist/constants.d.ts +7 -1
- package/dist/constants.js +7 -1
- package/dist/contract/default.d.ts +11 -27
- package/dist/contract/default.js +104 -120
- package/dist/contract/interface.d.ts +5 -2
- package/dist/provider/default.d.ts +4 -2
- package/dist/provider/default.js +13 -2
- package/dist/provider/interface.d.ts +18 -3
- package/dist/provider/rpc.d.ts +15 -10
- package/dist/provider/rpc.js +71 -31
- package/dist/provider/sequencer.d.ts +6 -2
- package/dist/provider/sequencer.js +33 -5
- package/dist/signer/default.d.ts +2 -2
- package/dist/signer/default.js +15 -15
- package/dist/signer/interface.d.ts +2 -0
- package/dist/types/api/index.d.ts +0 -6
- package/dist/types/api/openrpc.d.ts +147 -98
- package/dist/types/api/openrpc.js +22 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/lib.d.ts +22 -2
- package/dist/types/lib.js +6 -0
- package/dist/utils/number.d.ts +1 -0
- package/dist/utils/number.js +3 -1
- package/package.json +1 -1
- package/provider/default.d.ts +4 -2
- package/provider/default.js +13 -2
- package/provider/interface.d.ts +18 -3
- package/provider/rpc.d.ts +15 -10
- package/provider/rpc.js +71 -31
- package/provider/sequencer.d.ts +6 -2
- package/provider/sequencer.js +33 -5
- package/signer/default.d.ts +2 -2
- package/signer/default.js +15 -15
- package/signer/interface.d.ts +2 -0
- package/src/account/default.ts +51 -7
- package/src/account/interface.ts +34 -7
- package/src/constants.ts +7 -0
- package/src/contract/default.ts +123 -140
- package/src/contract/interface.ts +5 -2
- package/src/provider/default.ts +21 -3
- package/src/provider/interface.ts +26 -2
- package/src/provider/rpc.ts +73 -45
- package/src/provider/sequencer.ts +24 -4
- package/src/signer/default.ts +18 -18
- package/src/signer/interface.ts +2 -0
- package/src/types/api/index.ts +0 -4
- package/src/types/api/openrpc.ts +193 -105
- package/src/types/api/rpc.ts +0 -1
- package/src/types/index.ts +1 -1
- package/src/types/lib.ts +23 -2
- package/src/utils/number.ts +2 -0
- package/types/api/index.d.ts +0 -6
- package/types/api/openrpc.d.ts +147 -98
- package/types/api/openrpc.js +22 -4
- package/types/index.d.ts +1 -1
- package/types/lib.d.ts +22 -2
- package/types/lib.js +6 -0
- package/utils/number.d.ts +1 -0
- package/utils/number.js +3 -1
- package/www/docs/API/account.md +122 -22
- package/www/docs/API/contract.md +39 -3
- package/www/docs/API/provider.md +4 -0
- package/www/docs/API/signer.md +56 -2
package/types/api/openrpc.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Starknet RPC version 0.
|
|
2
|
+
* Starknet RPC version 0.2.0
|
|
3
3
|
*
|
|
4
|
-
* StarkNet Node API 0.
|
|
5
|
-
* StarkNet Node Write API 0.3.0
|
|
6
|
-
* StarkNet Trace API 0.
|
|
4
|
+
* StarkNet Node API 0.45.0 - rpc 0.2.1
|
|
5
|
+
* StarkNet Node Write API 0.3.0 - rpc 0.2.1
|
|
6
|
+
* StarkNet Trace API 0.4.0 - rpc 0.2.1
|
|
7
7
|
*
|
|
8
8
|
* TypeScript Representation of OpenRpc protocol types
|
|
9
9
|
*/
|
|
@@ -11,11 +11,9 @@ export declare type FELT = string;
|
|
|
11
11
|
export declare type ADDRESS = FELT;
|
|
12
12
|
declare type NUM_AS_HEX = string;
|
|
13
13
|
declare type SIGNATURE = Array<FELT>;
|
|
14
|
-
declare type ETH_ADDRESS = string;
|
|
15
14
|
declare type BLOCK_NUMBER = number;
|
|
16
15
|
declare type BLOCK_HASH = FELT;
|
|
17
16
|
declare type TXN_HASH = FELT;
|
|
18
|
-
declare type PROTOCOL_VERSION = string;
|
|
19
17
|
declare type TXN_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
|
|
20
18
|
declare type TXN_TYPE = 'DECLARE' | 'DEPLOY' | 'DEPLOY_ACCOUNT' | 'INVOKE' | 'L1_HANDLER';
|
|
21
19
|
declare type BLOCK_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
|
|
@@ -41,29 +39,30 @@ declare type COMMON_RECEIPT_PROPERTIES = {
|
|
|
41
39
|
transaction_hash: TXN_HASH;
|
|
42
40
|
actual_fee: FELT;
|
|
43
41
|
status: TXN_STATUS;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
from_address: ETH_ADDRESS;
|
|
50
|
-
payload: FELT;
|
|
51
|
-
};
|
|
52
|
-
declare type INVOKE_TXN_RECEIPT_PROPERTIES = {
|
|
53
|
-
messages_sent: MSG_TO_L1;
|
|
54
|
-
l1_origin_message?: MSG_TO_L2;
|
|
55
|
-
events: EVENT;
|
|
42
|
+
block_hash?: BLOCK_HASH;
|
|
43
|
+
block_number?: BLOCK_NUMBER;
|
|
44
|
+
type: TXN_TYPE;
|
|
45
|
+
messages_sent: Array<MSG_TO_L1>;
|
|
46
|
+
events: Array<EVENT>;
|
|
56
47
|
};
|
|
57
48
|
declare type PENDING_COMMON_RECEIPT_PROPERTIES = {
|
|
58
49
|
transaction_hash: TXN_HASH;
|
|
59
50
|
actual_fee: FELT;
|
|
51
|
+
type?: TXN_TYPE;
|
|
52
|
+
messages_sent: Array<MSG_TO_L1>;
|
|
53
|
+
events: Array<EVENT>;
|
|
60
54
|
};
|
|
61
|
-
declare type INVOKE_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES
|
|
55
|
+
declare type INVOKE_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
|
|
62
56
|
declare type DECLARE_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
|
|
63
|
-
declare type DEPLOY_TXN_RECEIPT =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
declare type
|
|
57
|
+
declare type DEPLOY_TXN_RECEIPT = {
|
|
58
|
+
contract_address: FELT;
|
|
59
|
+
} & COMMON_RECEIPT_PROPERTIES;
|
|
60
|
+
declare type L1_HANDLER_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
|
|
61
|
+
declare type PENDING_DEPLOY_TXN_RECEIPT = {
|
|
62
|
+
contract_address: FELT;
|
|
63
|
+
} & PENDING_COMMON_RECEIPT_PROPERTIES;
|
|
64
|
+
declare type PENDING_TXN_RECEIPT = PENDING_DEPLOY_TXN_RECEIPT | PENDING_COMMON_RECEIPT_PROPERTIES;
|
|
65
|
+
declare type TXN_RECEIPT = INVOKE_TXN_RECEIPT | L1_HANDLER_TXN_RECEIPT | DECLARE_TXN_RECEIPT | DEPLOY_TXN_RECEIPT | DEPLOY_ACCOUNT_TXN_RECEIPT | PENDING_TXN_RECEIPT;
|
|
67
66
|
declare type BLOCK_HEADER = {
|
|
68
67
|
block_hash: BLOCK_HASH;
|
|
69
68
|
parent_hash: BLOCK_HASH;
|
|
@@ -76,7 +75,7 @@ declare type BLOCK_BODY_WITH_TX_HASHES = {
|
|
|
76
75
|
transactions: Array<TXN_HASH>;
|
|
77
76
|
};
|
|
78
77
|
declare type BLOCK_WITH_TX_HASHES = {
|
|
79
|
-
status:
|
|
78
|
+
status: BLOCK_STATUS;
|
|
80
79
|
} & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES;
|
|
81
80
|
declare type PENDING_BLOCK_WITH_TX_HASHES = BLOCK_BODY_WITH_TX_HASHES & {
|
|
82
81
|
timestamp: number;
|
|
@@ -85,41 +84,66 @@ declare type PENDING_BLOCK_WITH_TX_HASHES = BLOCK_BODY_WITH_TX_HASHES & {
|
|
|
85
84
|
};
|
|
86
85
|
declare type COMMON_TXN_PROPERTIES = {
|
|
87
86
|
transaction_hash?: TXN_HASH;
|
|
88
|
-
|
|
89
|
-
version: NUM_AS_HEX;
|
|
90
|
-
signature: SIGNATURE;
|
|
91
|
-
nonce?: FELT;
|
|
92
|
-
type?: TXN_TYPE;
|
|
93
|
-
};
|
|
87
|
+
} & BROADCASTED_TXN_COMMON_PROPERTIES;
|
|
94
88
|
declare type FUNCTION_CALL = {
|
|
95
89
|
contract_address?: ADDRESS;
|
|
96
90
|
entry_point_selector?: FELT;
|
|
97
91
|
calldata?: Array<FELT>;
|
|
98
92
|
};
|
|
99
|
-
declare type INVOKE_TXN = COMMON_TXN_PROPERTIES &
|
|
93
|
+
declare type INVOKE_TXN = COMMON_TXN_PROPERTIES & (INVOKE_TXN_V0 | INVOKE_TXN_V1);
|
|
100
94
|
declare type DECLARE_TXN = COMMON_TXN_PROPERTIES & {
|
|
101
95
|
class_hash: FELT;
|
|
102
96
|
sender_address: ADDRESS;
|
|
103
97
|
};
|
|
104
|
-
declare type
|
|
98
|
+
declare type DEPLOY_TXN = {
|
|
99
|
+
transaction_hash: TXN_HASH;
|
|
105
100
|
class_hash: FELT;
|
|
101
|
+
} & DEPLOY_TXN_PROPERTIES;
|
|
102
|
+
declare type DEPLOY_ACCOUNT_TXN = COMMON_TXN_PROPERTIES & DEPLOY_ACCOUNT_TXN_PROPERTIES;
|
|
103
|
+
declare type DEPLOY_ACCOUNT_TXN_PROPERTIES = {
|
|
106
104
|
contract_address_salt: FELT;
|
|
107
105
|
constructor_calldata: Array<FELT>;
|
|
106
|
+
class_hash: FELT;
|
|
107
|
+
};
|
|
108
|
+
declare type DEPLOY_ACCOUNT_TXN_RECEIPT = DEPLOY_TXN_RECEIPT;
|
|
109
|
+
declare type TXN = INVOKE_TXN | L1_HANDLER_TXN | DECLARE_TXN | DEPLOY_TXN | DEPLOY_ACCOUNT_TXN;
|
|
110
|
+
declare enum L1_HANDLER {
|
|
111
|
+
'L1_HANDLER' = 0
|
|
112
|
+
}
|
|
113
|
+
declare type L1_HANDLER_TXN = {
|
|
114
|
+
transaction_hash: TXN_HASH;
|
|
115
|
+
version: NUM_AS_HEX;
|
|
116
|
+
type: L1_HANDLER;
|
|
117
|
+
nonce: NUM_AS_HEX;
|
|
118
|
+
} & FUNCTION_CALL;
|
|
119
|
+
declare type BROADCASTED_DEPLOY_ACCOUNT_TXN = BROADCASTED_TXN_COMMON_PROPERTIES & DEPLOY_ACCOUNT_TXN_PROPERTIES;
|
|
120
|
+
declare type BROADCASTED_TXN = BROADCASTED_INVOKE_TXN | BROADCASTED_DECLARE_TXN | BROADCASTED_DEPLOY_TXN | BROADCASTED_DEPLOY_ACCOUNT_TXN;
|
|
121
|
+
declare type BROADCASTED_INVOKE_TXN = BROADCASTED_TXN_COMMON_PROPERTIES & (INVOKE_TXN_V0 | INVOKE_TXN_V1);
|
|
122
|
+
declare type BROADCASTED_TXN_COMMON_PROPERTIES = {
|
|
123
|
+
type: TXN_TYPE;
|
|
124
|
+
max_fee: FELT;
|
|
125
|
+
version: NUM_AS_HEX;
|
|
126
|
+
signature: SIGNATURE;
|
|
127
|
+
nonce: FELT;
|
|
108
128
|
};
|
|
109
|
-
declare type
|
|
129
|
+
declare type BROADCASTED_DECLARE_TXN = {
|
|
110
130
|
contract_class: CONTRACT_CLASS;
|
|
111
131
|
sender_address: ADDRESS;
|
|
112
|
-
};
|
|
113
|
-
declare type
|
|
114
|
-
|
|
115
|
-
|
|
132
|
+
} & BROADCASTED_TXN_COMMON_PROPERTIES;
|
|
133
|
+
declare type BROADCASTED_DEPLOY_TXN = {
|
|
134
|
+
contract_class: CONTRACT_CLASS;
|
|
135
|
+
} & DEPLOY_TXN_PROPERTIES;
|
|
136
|
+
declare type DEPLOY_TXN_PROPERTIES = {
|
|
116
137
|
version: NUM_AS_HEX;
|
|
117
138
|
type: TXN_TYPE;
|
|
118
|
-
contract_address: FELT;
|
|
119
139
|
contract_address_salt: FELT;
|
|
120
140
|
constructor_calldata: Array<FELT>;
|
|
121
141
|
};
|
|
122
|
-
declare type
|
|
142
|
+
declare type INVOKE_TXN_V0 = FUNCTION_CALL;
|
|
143
|
+
declare type INVOKE_TXN_V1 = {
|
|
144
|
+
sender_address: ADDRESS;
|
|
145
|
+
calldata: Array<FELT>;
|
|
146
|
+
};
|
|
123
147
|
declare type BLOCK_BODY_WITH_TXS = {
|
|
124
148
|
transactions: Array<TXN>;
|
|
125
149
|
};
|
|
@@ -138,20 +162,52 @@ declare type CONTRACT_CLASS = {
|
|
|
138
162
|
EXTERNAL: CONTRACT_ENTRY_POINT_LIST;
|
|
139
163
|
L1_HANDLER: CONTRACT_ENTRY_POINT_LIST;
|
|
140
164
|
};
|
|
141
|
-
abi?:
|
|
165
|
+
abi?: CONTRACT_ABI;
|
|
166
|
+
};
|
|
167
|
+
declare type CONTRACT_ABI = Array<CONTRACT_ABI_ENTRY>;
|
|
168
|
+
declare type CONTRACT_ABI_ENTRY = FUNCTION_ABI_ENTRY | EVENT_ABI_ENTRY | STRUCT_ABI_ENTRY;
|
|
169
|
+
declare enum STRUCT_ABI_TYPE {
|
|
170
|
+
'struct' = 0
|
|
171
|
+
}
|
|
172
|
+
declare enum EVENT_ABI_TYPE {
|
|
173
|
+
'event' = 0
|
|
174
|
+
}
|
|
175
|
+
declare enum FUNCTION_ABI_TYPE {
|
|
176
|
+
'function' = 0,
|
|
177
|
+
'l1_handler' = 1,
|
|
178
|
+
'constructor' = 2
|
|
179
|
+
}
|
|
180
|
+
declare type STRUCT_ABI_ENTRY = STRUCT_ABI_TYPE & {
|
|
181
|
+
name: string;
|
|
182
|
+
size: number;
|
|
183
|
+
members: Array<STRUCT_MEMBER>;
|
|
184
|
+
};
|
|
185
|
+
declare type STRUCT_MEMBER = {
|
|
186
|
+
offset: number;
|
|
187
|
+
} & TYPED_PARAMETER;
|
|
188
|
+
declare type EVENT_ABI_ENTRY = {
|
|
189
|
+
name: string;
|
|
190
|
+
keys: Array<TYPED_PARAMETER>;
|
|
191
|
+
data: Array<TYPED_PARAMETER>;
|
|
192
|
+
} & EVENT_ABI_TYPE;
|
|
193
|
+
declare type FUNCTION_ABI_ENTRY = {
|
|
194
|
+
type: FUNCTION_ABI_TYPE;
|
|
195
|
+
name: string;
|
|
196
|
+
inputs: Array<TYPED_PARAMETER>;
|
|
197
|
+
outputs: Array<TYPED_PARAMETER>;
|
|
198
|
+
};
|
|
199
|
+
declare type TYPED_PARAMETER = {
|
|
200
|
+
name: string;
|
|
201
|
+
type: string;
|
|
142
202
|
};
|
|
143
203
|
declare type CONTRACT_ENTRY_POINT_LIST = Array<CONTRACT_ENTRY_POINT>;
|
|
144
204
|
declare type CONTRACT_ENTRY_POINT = {
|
|
145
205
|
offset: NUM_AS_HEX;
|
|
146
206
|
selector: FELT;
|
|
147
207
|
};
|
|
148
|
-
declare type
|
|
208
|
+
declare type CONTRACT_STORAGE_DIFF_ITEM = {
|
|
149
209
|
address: FELT;
|
|
150
|
-
key: FELT;
|
|
151
|
-
value: FELT;
|
|
152
|
-
};
|
|
153
|
-
declare type DECLARED_CONTRACT_ITEM = {
|
|
154
|
-
class_hash: FELT;
|
|
210
|
+
storage_entries: [key: FELT, value: FELT];
|
|
155
211
|
};
|
|
156
212
|
declare type DEPLOYED_CONTRACT_ITEM = {
|
|
157
213
|
address: FELT;
|
|
@@ -162,8 +218,8 @@ declare type STATE_UPDATE = {
|
|
|
162
218
|
new_root: FELT;
|
|
163
219
|
old_root: FELT;
|
|
164
220
|
state_diff: {
|
|
165
|
-
storage_diffs: Array<
|
|
166
|
-
|
|
221
|
+
storage_diffs: Array<CONTRACT_STORAGE_DIFF_ITEM>;
|
|
222
|
+
declared_contract_hashes: Array<FELT>;
|
|
167
223
|
deployed_contracts: Array<DEPLOYED_CONTRACT_ITEM>;
|
|
168
224
|
nonces: Array<{
|
|
169
225
|
contract_address: ADDRESS;
|
|
@@ -179,8 +235,8 @@ declare type EVENT_FILTER = {
|
|
|
179
235
|
keys?: Array<FELT>;
|
|
180
236
|
};
|
|
181
237
|
declare type RESULT_PAGE_REQUEST = {
|
|
182
|
-
|
|
183
|
-
|
|
238
|
+
continuation_token?: string;
|
|
239
|
+
chunk_size: number;
|
|
184
240
|
};
|
|
185
241
|
declare type EMITTED_EVENT = EVENT & {
|
|
186
242
|
block_hash: BLOCK_HASH;
|
|
@@ -215,10 +271,11 @@ declare type FUNCTION_INVOCATION = FUNCTION_CALL & {
|
|
|
215
271
|
entry_point_type: ENTRY_POINT_TYPE;
|
|
216
272
|
call_type: CALL_TYPE;
|
|
217
273
|
result: FELT;
|
|
218
|
-
calls:
|
|
219
|
-
events: EVENT
|
|
274
|
+
calls: NESTED_CALL;
|
|
275
|
+
events: Array<EVENT>;
|
|
220
276
|
messages: MSG_TO_L1;
|
|
221
277
|
};
|
|
278
|
+
declare type NESTED_CALL = FUNCTION_INVOCATION;
|
|
222
279
|
declare type TRACE_ROOT = {
|
|
223
280
|
nonce: FELT;
|
|
224
281
|
signature: FELT;
|
|
@@ -242,12 +299,10 @@ export declare namespace OPENRPC {
|
|
|
242
299
|
};
|
|
243
300
|
type CHAIN_ID = string;
|
|
244
301
|
type PendingTransactions = Array<TXN>;
|
|
245
|
-
type ProtocolVersion = PROTOCOL_VERSION;
|
|
246
302
|
type SyncingStatus = false | SYNC_STATUS;
|
|
247
303
|
type Events = {
|
|
248
304
|
events: Array<EMITTED_EVENT>;
|
|
249
|
-
|
|
250
|
-
is_last_page: boolean;
|
|
305
|
+
continuation_token: string;
|
|
251
306
|
};
|
|
252
307
|
type Trace = TRACE_ROOT;
|
|
253
308
|
type Traces = Array<{
|
|
@@ -274,21 +329,21 @@ export declare namespace OPENRPC {
|
|
|
274
329
|
block_id: BLOCK_ID;
|
|
275
330
|
};
|
|
276
331
|
result: BlockWithTxHashes;
|
|
277
|
-
errors: Errors.
|
|
332
|
+
errors: Errors.BLOCK_NOT_FOUND;
|
|
278
333
|
};
|
|
279
334
|
starknet_getBlockWithTxs: {
|
|
280
335
|
params: {
|
|
281
336
|
block_id: BLOCK_ID;
|
|
282
337
|
};
|
|
283
338
|
result: BlockWithTxs;
|
|
284
|
-
errors: Errors.
|
|
339
|
+
errors: Errors.BLOCK_NOT_FOUND;
|
|
285
340
|
};
|
|
286
341
|
starknet_getStateUpdate: {
|
|
287
342
|
params: {
|
|
288
343
|
block_id: BLOCK_ID;
|
|
289
344
|
};
|
|
290
345
|
result: StateUpdate;
|
|
291
|
-
errors: Errors.
|
|
346
|
+
errors: Errors.BLOCK_NOT_FOUND;
|
|
292
347
|
};
|
|
293
348
|
starknet_getStorageAt: {
|
|
294
349
|
params: {
|
|
@@ -297,14 +352,14 @@ export declare namespace OPENRPC {
|
|
|
297
352
|
block_id: BLOCK_ID;
|
|
298
353
|
};
|
|
299
354
|
result: Storage;
|
|
300
|
-
errors: Errors.CONTRACT_NOT_FOUND | Errors.
|
|
355
|
+
errors: Errors.CONTRACT_NOT_FOUND | Errors.BLOCK_NOT_FOUND;
|
|
301
356
|
};
|
|
302
357
|
starknet_getTransactionByHash: {
|
|
303
358
|
params: {
|
|
304
359
|
transaction_hash: TXN_HASH;
|
|
305
360
|
};
|
|
306
361
|
result: Transaction;
|
|
307
|
-
errors: Errors.
|
|
362
|
+
errors: Errors.TXN_HASH_NOT_FOUND;
|
|
308
363
|
};
|
|
309
364
|
starknet_getTransactionByBlockIdAndIndex: {
|
|
310
365
|
params: {
|
|
@@ -312,21 +367,22 @@ export declare namespace OPENRPC {
|
|
|
312
367
|
index: number;
|
|
313
368
|
};
|
|
314
369
|
result: Transaction;
|
|
315
|
-
errors: Errors.
|
|
370
|
+
errors: Errors.BLOCK_NOT_FOUND | Errors.INVALID_TXN_INDEX;
|
|
316
371
|
};
|
|
317
372
|
starknet_getTransactionReceipt: {
|
|
318
373
|
params: {
|
|
319
374
|
transaction_hash: TXN_HASH;
|
|
320
375
|
};
|
|
321
376
|
result: TransactionReceipt;
|
|
322
|
-
errors: Errors.
|
|
377
|
+
errors: Errors.TXN_HASH_NOT_FOUND;
|
|
323
378
|
};
|
|
324
379
|
starknet_getClass: {
|
|
325
380
|
params: {
|
|
381
|
+
block_id: BLOCK_ID;
|
|
326
382
|
class_hash: FELT;
|
|
327
383
|
};
|
|
328
384
|
result: ContractClass;
|
|
329
|
-
errors: Errors.
|
|
385
|
+
errors: Errors.BLOCK_NOT_FOUND | Errors.CLASS_HASH_NOT_FOUND;
|
|
330
386
|
};
|
|
331
387
|
starknet_getClassHashAt: {
|
|
332
388
|
params: {
|
|
@@ -334,7 +390,7 @@ export declare namespace OPENRPC {
|
|
|
334
390
|
contract_address: ADDRESS;
|
|
335
391
|
};
|
|
336
392
|
result: FELT;
|
|
337
|
-
errors: Errors.
|
|
393
|
+
errors: Errors.BLOCK_NOT_FOUND | Errors.CONTRACT_NOT_FOUND;
|
|
338
394
|
};
|
|
339
395
|
starknet_getClassAt: {
|
|
340
396
|
params: {
|
|
@@ -342,14 +398,14 @@ export declare namespace OPENRPC {
|
|
|
342
398
|
contract_address: ADDRESS;
|
|
343
399
|
};
|
|
344
400
|
result: ContractClass;
|
|
345
|
-
errors: Errors.
|
|
401
|
+
errors: Errors.BLOCK_NOT_FOUND | Errors.CONTRACT_NOT_FOUND;
|
|
346
402
|
};
|
|
347
403
|
starknet_getBlockTransactionCount: {
|
|
348
404
|
params: {
|
|
349
405
|
block_id: BLOCK_ID;
|
|
350
406
|
};
|
|
351
407
|
result: number;
|
|
352
|
-
errors: Errors.
|
|
408
|
+
errors: Errors.BLOCK_NOT_FOUND;
|
|
353
409
|
};
|
|
354
410
|
starknet_call: {
|
|
355
411
|
params: {
|
|
@@ -357,15 +413,15 @@ export declare namespace OPENRPC {
|
|
|
357
413
|
block_id: BLOCK_ID;
|
|
358
414
|
};
|
|
359
415
|
result: Array<FELT>;
|
|
360
|
-
errors: Errors.CONTRACT_NOT_FOUND | Errors.INVALID_MESSAGE_SELECTOR | Errors.INVALID_CALL_DATA | Errors.CONTRACT_ERROR | Errors.
|
|
416
|
+
errors: Errors.CONTRACT_NOT_FOUND | Errors.INVALID_MESSAGE_SELECTOR | Errors.INVALID_CALL_DATA | Errors.CONTRACT_ERROR | Errors.BLOCK_NOT_FOUND;
|
|
361
417
|
};
|
|
362
418
|
starknet_estimateFee: {
|
|
363
419
|
params: {
|
|
364
|
-
request:
|
|
420
|
+
request: BROADCASTED_TXN;
|
|
365
421
|
block_id: BLOCK_ID;
|
|
366
422
|
};
|
|
367
423
|
result: FEE_ESTIMATE;
|
|
368
|
-
errors: Errors.CONTRACT_NOT_FOUND | Errors.INVALID_MESSAGE_SELECTOR | Errors.INVALID_CALL_DATA | Errors.CONTRACT_ERROR | Errors.
|
|
424
|
+
errors: Errors.CONTRACT_NOT_FOUND | Errors.INVALID_MESSAGE_SELECTOR | Errors.INVALID_CALL_DATA | Errors.CONTRACT_ERROR | Errors.BLOCK_NOT_FOUND;
|
|
369
425
|
};
|
|
370
426
|
starknet_blockNumber: {
|
|
371
427
|
params: {};
|
|
@@ -394,61 +450,50 @@ export declare namespace OPENRPC {
|
|
|
394
450
|
filter: EVENT_FILTER & RESULT_PAGE_REQUEST;
|
|
395
451
|
};
|
|
396
452
|
result: Events;
|
|
397
|
-
errors: Errors.PAGE_SIZE_TOO_BIG;
|
|
453
|
+
errors: Errors.PAGE_SIZE_TOO_BIG | Errors.INVALID_CONTINUATION_TOKEN | Errors.BLOCK_NOT_FOUND;
|
|
398
454
|
};
|
|
399
455
|
starknet_getNonce: {
|
|
400
456
|
params: {
|
|
401
|
-
contract_address: ADDRESS;
|
|
402
457
|
block_id: BLOCK_ID;
|
|
458
|
+
contract_address: ADDRESS;
|
|
403
459
|
};
|
|
404
460
|
result: FELT;
|
|
405
|
-
errors: Errors.CONTRACT_NOT_FOUND;
|
|
461
|
+
errors: Errors.BLOCK_NOT_FOUND | Errors.CONTRACT_NOT_FOUND;
|
|
406
462
|
};
|
|
407
463
|
starknet_addInvokeTransaction: {
|
|
408
464
|
params: {
|
|
409
|
-
|
|
410
|
-
signature: SIGNATURE;
|
|
411
|
-
max_fee: NUM_AS_HEX;
|
|
412
|
-
version: NUM_AS_HEX;
|
|
465
|
+
invoke_transaction: BROADCASTED_INVOKE_TXN;
|
|
413
466
|
};
|
|
414
467
|
result: InvokedTransaction;
|
|
415
468
|
};
|
|
416
469
|
starknet_addDeclareTransaction: {
|
|
417
470
|
params: {
|
|
418
|
-
|
|
419
|
-
sender_address: ADDRESS;
|
|
420
|
-
signature: SIGNATURE;
|
|
421
|
-
max_fee: NUM_AS_HEX;
|
|
422
|
-
version: NUM_AS_HEX;
|
|
423
|
-
nonce: FELT;
|
|
471
|
+
declare_transaction: BROADCASTED_DECLARE_TXN;
|
|
424
472
|
};
|
|
425
473
|
result: DeclaredTransaction;
|
|
426
474
|
errors: Errors.INVALID_CONTRACT_CLASS;
|
|
427
475
|
};
|
|
428
476
|
starknet_addDeployTransaction: {
|
|
429
477
|
params: {
|
|
430
|
-
|
|
431
|
-
constructor_calldata: Array<FELT>;
|
|
432
|
-
contract_definition: CONTRACT_CLASS;
|
|
478
|
+
deploy_transaction: BROADCASTED_DEPLOY_TXN;
|
|
433
479
|
};
|
|
434
480
|
result: DeployedTransaction;
|
|
435
481
|
errors: Errors.INVALID_CONTRACT_CLASS;
|
|
436
482
|
};
|
|
437
483
|
starknet_addDeployAccountTransaction: {
|
|
438
|
-
params:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
484
|
+
params: BROADCASTED_DEPLOY_ACCOUNT_TXN;
|
|
485
|
+
result: {
|
|
486
|
+
transaction_hash: TXN_HASH;
|
|
487
|
+
contract_address: FELT;
|
|
442
488
|
};
|
|
443
|
-
|
|
444
|
-
errors: Errors.INVALID_CONTRACT_CLASS;
|
|
489
|
+
errors: Errors.CLASS_HASH_NOT_FOUND;
|
|
445
490
|
};
|
|
446
491
|
starknet_traceTransaction: {
|
|
447
492
|
params: {
|
|
448
493
|
transaction_hash: TXN_HASH;
|
|
449
494
|
};
|
|
450
495
|
result: Trace;
|
|
451
|
-
errors: Errors.
|
|
496
|
+
errors: Errors.TXN_HASH_NOT_FOUND | Errors.NO_TRACE_AVAILABLE | Errors.INVALID_BLOCK_HASH | Errors.TXN_HASH_NOT_FOUND;
|
|
452
497
|
};
|
|
453
498
|
starknet_traceBlockTransactions: {
|
|
454
499
|
params: {
|
|
@@ -476,17 +521,17 @@ export declare namespace Errors {
|
|
|
476
521
|
code: 22;
|
|
477
522
|
message: 'Invalid call data';
|
|
478
523
|
}
|
|
479
|
-
interface
|
|
524
|
+
interface BLOCK_NOT_FOUND {
|
|
480
525
|
code: 24;
|
|
481
|
-
message: '
|
|
526
|
+
message: 'Block not found';
|
|
482
527
|
}
|
|
483
528
|
interface INVALID_TXN_INDEX {
|
|
484
529
|
code: 27;
|
|
485
530
|
message: 'Invalid transaction index in a block';
|
|
486
531
|
}
|
|
487
|
-
interface
|
|
532
|
+
interface CLASS_HASH_NOT_FOUND {
|
|
488
533
|
code: 28;
|
|
489
|
-
message: '
|
|
534
|
+
message: 'Class hash not found';
|
|
490
535
|
}
|
|
491
536
|
interface PAGE_SIZE_TOO_BIG {
|
|
492
537
|
code: 31;
|
|
@@ -496,6 +541,10 @@ export declare namespace Errors {
|
|
|
496
541
|
code: 32;
|
|
497
542
|
message: 'There are no blocks';
|
|
498
543
|
}
|
|
544
|
+
interface INVALID_CONTINUATION_TOKEN {
|
|
545
|
+
code: 33;
|
|
546
|
+
message: 'The supplied continuation token is invalid or unknown';
|
|
547
|
+
}
|
|
499
548
|
interface CONTRACT_ERROR {
|
|
500
549
|
code: 40;
|
|
501
550
|
message: 'Contract error';
|
|
@@ -515,9 +564,9 @@ export declare namespace Errors {
|
|
|
515
564
|
code: 24;
|
|
516
565
|
message: 'Invalid block hash';
|
|
517
566
|
}
|
|
518
|
-
interface
|
|
567
|
+
interface TXN_HASH_NOT_FOUND {
|
|
519
568
|
code: 25;
|
|
520
|
-
message: '
|
|
569
|
+
message: 'Transaction hash not found';
|
|
521
570
|
}
|
|
522
571
|
}
|
|
523
572
|
export {};
|
package/types/api/openrpc.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Starknet RPC version 0.
|
|
3
|
+
* Starknet RPC version 0.2.0
|
|
4
4
|
*
|
|
5
|
-
* StarkNet Node API 0.
|
|
6
|
-
* StarkNet Node Write API 0.3.0
|
|
7
|
-
* StarkNet Trace API 0.
|
|
5
|
+
* StarkNet Node API 0.45.0 - rpc 0.2.1
|
|
6
|
+
* StarkNet Node Write API 0.3.0 - rpc 0.2.1
|
|
7
|
+
* StarkNet Trace API 0.4.0 - rpc 0.2.1
|
|
8
8
|
*
|
|
9
9
|
* TypeScript Representation of OpenRpc protocol types
|
|
10
10
|
*/
|
|
@@ -14,6 +14,24 @@ var BLOCK_TAG;
|
|
|
14
14
|
BLOCK_TAG[BLOCK_TAG["latest"] = 0] = "latest";
|
|
15
15
|
BLOCK_TAG[BLOCK_TAG["pending"] = 1] = "pending";
|
|
16
16
|
})(BLOCK_TAG || (BLOCK_TAG = {}));
|
|
17
|
+
var L1_HANDLER;
|
|
18
|
+
(function (L1_HANDLER) {
|
|
19
|
+
L1_HANDLER[L1_HANDLER["L1_HANDLER"] = 0] = "L1_HANDLER";
|
|
20
|
+
})(L1_HANDLER || (L1_HANDLER = {}));
|
|
21
|
+
var STRUCT_ABI_TYPE;
|
|
22
|
+
(function (STRUCT_ABI_TYPE) {
|
|
23
|
+
STRUCT_ABI_TYPE[STRUCT_ABI_TYPE["struct"] = 0] = "struct";
|
|
24
|
+
})(STRUCT_ABI_TYPE || (STRUCT_ABI_TYPE = {}));
|
|
25
|
+
var EVENT_ABI_TYPE;
|
|
26
|
+
(function (EVENT_ABI_TYPE) {
|
|
27
|
+
EVENT_ABI_TYPE[EVENT_ABI_TYPE["event"] = 0] = "event";
|
|
28
|
+
})(EVENT_ABI_TYPE || (EVENT_ABI_TYPE = {}));
|
|
29
|
+
var FUNCTION_ABI_TYPE;
|
|
30
|
+
(function (FUNCTION_ABI_TYPE) {
|
|
31
|
+
FUNCTION_ABI_TYPE[FUNCTION_ABI_TYPE["function"] = 0] = "function";
|
|
32
|
+
FUNCTION_ABI_TYPE[FUNCTION_ABI_TYPE["l1_handler"] = 1] = "l1_handler";
|
|
33
|
+
FUNCTION_ABI_TYPE[FUNCTION_ABI_TYPE["constructor"] = 2] = "constructor";
|
|
34
|
+
})(FUNCTION_ABI_TYPE || (FUNCTION_ABI_TYPE = {}));
|
|
17
35
|
var CALL_TYPE;
|
|
18
36
|
(function (CALL_TYPE) {
|
|
19
37
|
CALL_TYPE[CALL_TYPE["DELEGATE"] = 0] = "DELEGATE";
|
package/types/index.d.ts
CHANGED
package/types/lib.d.ts
CHANGED
|
@@ -5,11 +5,24 @@ export declare type KeyPair = EC.KeyPair;
|
|
|
5
5
|
export declare type Signature = string[];
|
|
6
6
|
export declare type RawCalldata = BigNumberish[];
|
|
7
7
|
export declare type AllowArray<T> = T | T[];
|
|
8
|
+
export declare type RawArgs = {
|
|
9
|
+
[inputName: string]: string | string[] | {
|
|
10
|
+
type: 'struct';
|
|
11
|
+
[k: string]: BigNumberish;
|
|
12
|
+
};
|
|
13
|
+
} | string[];
|
|
8
14
|
export interface ContractClass {
|
|
9
15
|
program: CompressedProgram;
|
|
10
16
|
entry_points_by_type: RPC.ContractClass['entry_points_by_type'];
|
|
11
17
|
abi?: Abi;
|
|
12
18
|
}
|
|
19
|
+
export declare type UniversalDeployerContractPayload = {
|
|
20
|
+
classHash: BigNumberish;
|
|
21
|
+
salt: string;
|
|
22
|
+
unique: boolean;
|
|
23
|
+
constructorCalldata?: RawArgs;
|
|
24
|
+
isDevnet?: boolean;
|
|
25
|
+
};
|
|
13
26
|
export declare type DeployContractPayload = {
|
|
14
27
|
contract: CompiledContract | string;
|
|
15
28
|
constructorCalldata?: RawCalldata;
|
|
@@ -65,8 +78,13 @@ export declare type FunctionAbi = {
|
|
|
65
78
|
name: string;
|
|
66
79
|
outputs: AbiEntry[];
|
|
67
80
|
stateMutability?: 'view';
|
|
68
|
-
type:
|
|
81
|
+
type: FunctionAbiType;
|
|
69
82
|
};
|
|
83
|
+
declare enum FunctionAbiType {
|
|
84
|
+
'function' = 0,
|
|
85
|
+
'l1_handler' = 1,
|
|
86
|
+
'constructor' = 2
|
|
87
|
+
}
|
|
70
88
|
export declare type StructAbi = {
|
|
71
89
|
members: (AbiEntry & {
|
|
72
90
|
offset: number;
|
|
@@ -75,7 +93,8 @@ export declare type StructAbi = {
|
|
|
75
93
|
size: number;
|
|
76
94
|
type: 'struct';
|
|
77
95
|
};
|
|
78
|
-
export declare type Abi = Array<FunctionAbi | StructAbi>;
|
|
96
|
+
export declare type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
|
|
97
|
+
declare type EventAbi = any;
|
|
79
98
|
export declare type EntryPointsByType = object;
|
|
80
99
|
export declare type Program = Record<any, any>;
|
|
81
100
|
export declare type BlockTag = 'pending' | 'latest';
|
|
@@ -98,3 +117,4 @@ export declare type Args = {
|
|
|
98
117
|
export declare type ParsedStruct = {
|
|
99
118
|
[key: string]: BigNumberish | ParsedStruct;
|
|
100
119
|
};
|
|
120
|
+
export {};
|
package/types/lib.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var FunctionAbiType;
|
|
4
|
+
(function (FunctionAbiType) {
|
|
5
|
+
FunctionAbiType[FunctionAbiType["function"] = 0] = "function";
|
|
6
|
+
FunctionAbiType[FunctionAbiType["l1_handler"] = 1] = "l1_handler";
|
|
7
|
+
FunctionAbiType[FunctionAbiType["constructor"] = 2] = "constructor";
|
|
8
|
+
})(FunctionAbiType || (FunctionAbiType = {}));
|
package/utils/number.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ export declare const toHexString: (value: string) => string;
|
|
|
13
13
|
export declare function getDecimalString(value: string): string;
|
|
14
14
|
export declare function getHexString(value: string): string;
|
|
15
15
|
export declare function getHexStringArray(value: Array<string>): string[];
|
|
16
|
+
export declare const toCairoBool: (value: boolean) => string;
|
package/utils/number.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getHexStringArray = exports.getHexString = exports.getDecimalString = exports.toHexString = exports.isStringWholeNumber = exports.bigNumberishArrayToHexadecimalStringArray = exports.bigNumberishArrayToDecimalStringArray = exports.assertInRange = exports.toFelt = exports.hexToDecimalString = exports.toHex = exports.toBN = exports.isHex = void 0;
|
|
29
|
+
exports.toCairoBool = exports.getHexStringArray = exports.getHexString = exports.getDecimalString = exports.toHexString = exports.isStringWholeNumber = exports.bigNumberishArrayToHexadecimalStringArray = exports.bigNumberishArrayToDecimalStringArray = exports.assertInRange = exports.toFelt = exports.hexToDecimalString = exports.toHex = exports.toBN = exports.isHex = void 0;
|
|
30
30
|
var bn_js_1 = __importStar(require("bn.js"));
|
|
31
31
|
var minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
|
|
32
32
|
var encode_1 = require("./encode");
|
|
@@ -108,3 +108,5 @@ function getHexStringArray(value) {
|
|
|
108
108
|
return value.map(function (el) { return getHexString(el); });
|
|
109
109
|
}
|
|
110
110
|
exports.getHexStringArray = getHexStringArray;
|
|
111
|
+
var toCairoBool = function (value) { return (+value).toString(); };
|
|
112
|
+
exports.toCairoBool = toCairoBool;
|