starknet 5.1.1 → 5.3.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/dist/index.d.ts CHANGED
@@ -1,11 +1,142 @@
1
1
  import * as _noble_curves_abstract_weierstrass from '@noble/curves/abstract/weierstrass';
2
2
  import * as poseidon from '@noble/curves/abstract/poseidon';
3
- import * as stark$1 from '@noble/curves/stark';
3
+ import * as microStarknet from 'micro-starknet';
4
4
  import { CustomError } from 'ts-custom-error';
5
5
 
6
+ declare const IS_BROWSER: boolean;
7
+ declare function arrayBufferToString(array: ArrayBuffer): string;
8
+ declare function btoaUniversal(b: ArrayBuffer): string;
9
+ declare function buf2hex(buffer: Uint8Array): string;
10
+ /**
11
+ * Some function imported from https://github.com/pedrouid/enc-utils/blob/master/src/index.ts
12
+ * enc-utils is no dependency to avoid using `Buffer` which just works in node and no browsers
13
+ */
14
+ declare function removeHexPrefix(hex: string): string;
15
+ declare function addHexPrefix(hex: string): string;
16
+ declare function padLeft(str: string, length: number, padding?: string): string;
17
+ declare function calcByteLength(length: number, byteSize?: number): number;
18
+ declare function sanitizeBytes(str: string, byteSize?: number, padding?: string): string;
19
+ declare function sanitizeHex(hex: string): string;
20
+ declare function utf8ToArray(str: string): Uint8Array;
21
+
22
+ declare const encode_IS_BROWSER: typeof IS_BROWSER;
23
+ declare const encode_arrayBufferToString: typeof arrayBufferToString;
24
+ declare const encode_btoaUniversal: typeof btoaUniversal;
25
+ declare const encode_buf2hex: typeof buf2hex;
26
+ declare const encode_removeHexPrefix: typeof removeHexPrefix;
27
+ declare const encode_addHexPrefix: typeof addHexPrefix;
28
+ declare const encode_padLeft: typeof padLeft;
29
+ declare const encode_calcByteLength: typeof calcByteLength;
30
+ declare const encode_sanitizeBytes: typeof sanitizeBytes;
31
+ declare const encode_sanitizeHex: typeof sanitizeHex;
32
+ declare const encode_utf8ToArray: typeof utf8ToArray;
33
+ declare namespace encode {
34
+ export {
35
+ encode_IS_BROWSER as IS_BROWSER,
36
+ encode_arrayBufferToString as arrayBufferToString,
37
+ encode_btoaUniversal as btoaUniversal,
38
+ encode_buf2hex as buf2hex,
39
+ encode_removeHexPrefix as removeHexPrefix,
40
+ encode_addHexPrefix as addHexPrefix,
41
+ encode_padLeft as padLeft,
42
+ encode_calcByteLength as calcByteLength,
43
+ encode_sanitizeBytes as sanitizeBytes,
44
+ encode_sanitizeHex as sanitizeHex,
45
+ encode_utf8ToArray as utf8ToArray,
46
+ };
47
+ }
48
+
49
+ declare const ZERO = 0n;
50
+ declare const MASK_250: bigint;
51
+ declare const MASK_251: bigint;
52
+ declare const API_VERSION = 0n;
53
+ declare enum BaseUrl {
54
+ SN_MAIN = "https://alpha-mainnet.starknet.io",
55
+ SN_GOERLI = "https://alpha4.starknet.io",
56
+ SN_GOERLI2 = "https://alpha4-2.starknet.io"
57
+ }
58
+ declare enum NetworkName {
59
+ SN_MAIN = "SN_MAIN",
60
+ SN_GOERLI = "SN_GOERLI",
61
+ SN_GOERLI2 = "SN_GOERLI2"
62
+ }
63
+ declare enum StarknetChainId {
64
+ SN_MAIN = "0x534e5f4d41494e",
65
+ SN_GOERLI = "0x534e5f474f45524c49",
66
+ SN_GOERLI2 = "0x534e5f474f45524c4932"
67
+ }
68
+ declare enum TransactionHashPrefix {
69
+ DECLARE = "0x6465636c617265",
70
+ DEPLOY = "0x6465706c6f79",
71
+ DEPLOY_ACCOUNT = "0x6465706c6f795f6163636f756e74",
72
+ INVOKE = "0x696e766f6b65",
73
+ L1_HANDLER = "0x6c315f68616e646c6572"
74
+ }
75
+ declare const UDC: {
76
+ ADDRESS: string;
77
+ ENTRYPOINT: string;
78
+ };
79
+ /**
80
+ * The following is taken from https://github.com/starkware-libs/starkex-resources/blob/master/crypto/starkware/crypto/signature/pedersen_params.json but converted to hex, because JS is very bad handling big integers by default
81
+ * Please do not edit until the JSON changes.
82
+ */
83
+ declare const FIELD_PRIME = "800000000000011000000000000000000000000000000000000000000000001";
84
+ declare const FIELD_GEN = "3";
85
+ declare const FIELD_SIZE = 251;
86
+ declare const EC_ORDER = "800000000000010FFFFFFFFFFFFFFFFB781126DCAE7B2321E66A241ADC64D2F";
87
+ declare const ALPHA = "1";
88
+ declare const BETA = "6F21413EFBE40DE150E596D72F7A8C5609AD26C15C915C1F4CDFCB99CEE9E89";
89
+ declare const MAX_ECDSA_VAL = "800000000000000000000000000000000000000000000000000000000000000";
90
+ declare const CONSTANT_POINTS: string[][];
91
+
92
+ declare const constants_ZERO: typeof ZERO;
93
+ declare const constants_MASK_250: typeof MASK_250;
94
+ declare const constants_MASK_251: typeof MASK_251;
95
+ declare const constants_API_VERSION: typeof API_VERSION;
96
+ type constants_BaseUrl = BaseUrl;
97
+ declare const constants_BaseUrl: typeof BaseUrl;
98
+ type constants_NetworkName = NetworkName;
99
+ declare const constants_NetworkName: typeof NetworkName;
100
+ type constants_StarknetChainId = StarknetChainId;
101
+ declare const constants_StarknetChainId: typeof StarknetChainId;
102
+ type constants_TransactionHashPrefix = TransactionHashPrefix;
103
+ declare const constants_TransactionHashPrefix: typeof TransactionHashPrefix;
104
+ declare const constants_UDC: typeof UDC;
105
+ declare const constants_FIELD_PRIME: typeof FIELD_PRIME;
106
+ declare const constants_FIELD_GEN: typeof FIELD_GEN;
107
+ declare const constants_FIELD_SIZE: typeof FIELD_SIZE;
108
+ declare const constants_EC_ORDER: typeof EC_ORDER;
109
+ declare const constants_ALPHA: typeof ALPHA;
110
+ declare const constants_BETA: typeof BETA;
111
+ declare const constants_MAX_ECDSA_VAL: typeof MAX_ECDSA_VAL;
112
+ declare const constants_CONSTANT_POINTS: typeof CONSTANT_POINTS;
113
+ declare const constants_IS_BROWSER: typeof IS_BROWSER;
114
+ declare namespace constants {
115
+ export {
116
+ constants_ZERO as ZERO,
117
+ constants_MASK_250 as MASK_250,
118
+ constants_MASK_251 as MASK_251,
119
+ constants_API_VERSION as API_VERSION,
120
+ constants_BaseUrl as BaseUrl,
121
+ constants_NetworkName as NetworkName,
122
+ constants_StarknetChainId as StarknetChainId,
123
+ constants_TransactionHashPrefix as TransactionHashPrefix,
124
+ constants_UDC as UDC,
125
+ constants_FIELD_PRIME as FIELD_PRIME,
126
+ constants_FIELD_GEN as FIELD_GEN,
127
+ constants_FIELD_SIZE as FIELD_SIZE,
128
+ constants_EC_ORDER as EC_ORDER,
129
+ constants_ALPHA as ALPHA,
130
+ constants_BETA as BETA,
131
+ constants_MAX_ECDSA_VAL as MAX_ECDSA_VAL,
132
+ constants_CONSTANT_POINTS as CONSTANT_POINTS,
133
+ constants_IS_BROWSER as IS_BROWSER,
134
+ };
135
+ }
136
+
6
137
  declare namespace ec {
7
138
  export {
8
- stark$1 as starkCurve,
139
+ microStarknet as starkCurve,
9
140
  _noble_curves_abstract_weierstrass as weierstrass,
10
141
  };
11
142
  }
@@ -30,6 +161,12 @@ declare function getDecimalString(value: string): string;
30
161
  declare function getHexString(value: string): string;
31
162
  declare function getHexStringArray(value: Array<string>): string[];
32
163
  declare const toCairoBool: (value: boolean) => string;
164
+ /**
165
+ * Convert a hex string to an array of Bytes (Uint8Array)
166
+ * @param value hex string
167
+ * @returns an array of Bytes
168
+ */
169
+ declare function hexToBytes(value: string): Uint8Array;
33
170
 
34
171
  type num_BigNumberish = BigNumberish;
35
172
  declare const num_isHex: typeof isHex;
@@ -47,6 +184,7 @@ declare const num_getDecimalString: typeof getDecimalString;
47
184
  declare const num_getHexString: typeof getHexString;
48
185
  declare const num_getHexStringArray: typeof getHexStringArray;
49
186
  declare const num_toCairoBool: typeof toCairoBool;
187
+ declare const num_hexToBytes: typeof hexToBytes;
50
188
  declare namespace num {
51
189
  export {
52
190
  num_BigNumberish as BigNumberish,
@@ -65,331 +203,606 @@ declare namespace num {
65
203
  num_getHexString as getHexString,
66
204
  num_getHexStringArray as getHexStringArray,
67
205
  num_toCairoBool as toCairoBool,
206
+ num_hexToBytes as hexToBytes,
68
207
  };
69
208
  }
70
209
 
71
- /**
72
- * Starknet RPC version 0.2.0
73
- *
74
- * Starknet Node API 0.45.0 - rpc 0.2.1
75
- * Starknet Node Write API 0.3.0 - rpc 0.2.1
76
- * Starknet Trace API 0.4.0 - rpc 0.2.1
77
- *
78
- * TypeScript Representation of OpenRpc protocol types
79
- */
80
- declare type FELT = string;
81
- declare type ADDRESS = FELT;
82
- declare type NUM_AS_HEX = string;
83
- declare type SIGNATURE = Array<FELT>;
84
- declare type BLOCK_NUMBER = number;
85
- declare type BLOCK_HASH = FELT;
86
- declare type TXN_HASH = FELT;
87
- declare type TXN_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
88
- declare type TXN_TYPE = 'DECLARE' | 'DEPLOY' | 'DEPLOY_ACCOUNT' | 'INVOKE' | 'L1_HANDLER';
89
- declare type BLOCK_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
90
- declare enum BLOCK_TAG {
91
- 'latest' = 0,
92
- 'pending' = 1
93
- }
94
- declare type BLOCK_ID = {
95
- block_hash: BLOCK_HASH;
96
- } | {
97
- block_number: BLOCK_NUMBER;
98
- } | BLOCK_TAG;
99
- declare type MSG_TO_L1 = {
100
- to_address: FELT;
101
- payload: Array<FELT>;
210
+ /** ABI */
211
+ declare type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
212
+ declare type AbiEntry = {
213
+ name: string;
214
+ type: 'felt' | 'felt*' | string;
102
215
  };
103
- declare type EVENT = {
104
- from_address: FELT;
105
- keys: Array<FELT>;
106
- data: Array<FELT>;
216
+ declare enum FunctionAbiType {
217
+ 'function' = 0,
218
+ 'l1_handler' = 1,
219
+ 'constructor' = 2
220
+ }
221
+ declare type FunctionAbi = {
222
+ inputs: AbiEntry[];
223
+ name: string;
224
+ outputs: AbiEntry[];
225
+ stateMutability?: 'view';
226
+ type: FunctionAbiType;
107
227
  };
108
- declare type COMMON_RECEIPT_PROPERTIES = {
109
- transaction_hash: TXN_HASH;
110
- actual_fee: FELT;
111
- status: TXN_STATUS;
112
- block_hash?: BLOCK_HASH;
113
- block_number?: BLOCK_NUMBER;
114
- type: TXN_TYPE;
115
- messages_sent: Array<MSG_TO_L1>;
116
- events: Array<EVENT>;
228
+ declare type AbiStructs = {
229
+ [name: string]: StructAbi;
117
230
  };
118
- declare type PENDING_COMMON_RECEIPT_PROPERTIES = {
119
- transaction_hash: TXN_HASH;
120
- actual_fee: FELT;
121
- type?: TXN_TYPE;
122
- messages_sent: Array<MSG_TO_L1>;
123
- events: Array<EVENT>;
231
+ declare type StructAbi = {
232
+ members: (AbiEntry & {
233
+ offset: number;
234
+ })[];
235
+ name: string;
236
+ size: number;
237
+ type: 'struct';
124
238
  };
125
- declare type INVOKE_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
126
- declare type DECLARE_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
127
- declare type DEPLOY_TXN_RECEIPT = {
128
- contract_address: FELT;
129
- } & COMMON_RECEIPT_PROPERTIES;
130
- declare type L1_HANDLER_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
131
- declare type PENDING_DEPLOY_TXN_RECEIPT = {
132
- contract_address: FELT;
133
- } & PENDING_COMMON_RECEIPT_PROPERTIES;
134
- declare type PENDING_TXN_RECEIPT = PENDING_DEPLOY_TXN_RECEIPT | PENDING_COMMON_RECEIPT_PROPERTIES;
135
- declare type TXN_RECEIPT = INVOKE_TXN_RECEIPT | L1_HANDLER_TXN_RECEIPT | DECLARE_TXN_RECEIPT | DEPLOY_TXN_RECEIPT | DEPLOY_ACCOUNT_TXN_RECEIPT | PENDING_TXN_RECEIPT;
136
- declare type BLOCK_HEADER = {
137
- block_hash: BLOCK_HASH;
138
- parent_hash: BLOCK_HASH;
139
- block_number: BLOCK_NUMBER;
140
- new_root: FELT;
141
- timestamp: number;
142
- sequencer_address: FELT;
239
+ declare type EventAbi = any;
240
+
241
+ /** LEGACY CONTRACT */
242
+ declare type LegacyContractClass = {
243
+ program: CompressedProgram;
244
+ entry_points_by_type: EntryPointsByType;
245
+ abi: Abi;
143
246
  };
144
- declare type BLOCK_BODY_WITH_TX_HASHES = {
145
- transactions: Array<TXN_HASH>;
247
+ declare type LegacyCompiledContract = Omit<LegacyContractClass, 'program'> & {
248
+ program: Program;
146
249
  };
147
- declare type BLOCK_WITH_TX_HASHES = {
148
- status: BLOCK_STATUS;
149
- } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES;
150
- declare type PENDING_BLOCK_WITH_TX_HASHES = BLOCK_BODY_WITH_TX_HASHES & {
151
- timestamp: number;
152
- sequencer_address: FELT;
153
- parent_hash: BLOCK_HASH;
250
+ /** SUBTYPES */
251
+ declare type Builtins = string[];
252
+ declare type CompressedProgram = string;
253
+ declare type EntryPointsByType = {
254
+ CONSTRUCTOR: ContractEntryPointFields[];
255
+ EXTERNAL: ContractEntryPointFields[];
256
+ L1_HANDLER: ContractEntryPointFields[];
154
257
  };
155
- declare type COMMON_TXN_PROPERTIES = {
156
- transaction_hash?: TXN_HASH;
157
- } & BROADCASTED_TXN_COMMON_PROPERTIES;
158
- declare type FUNCTION_CALL = {
159
- contract_address?: ADDRESS;
160
- entry_point_selector?: FELT;
161
- calldata?: Array<FELT>;
258
+ declare type ContractEntryPointFields = {
259
+ selector: string;
260
+ offset: string;
261
+ builtins?: Builtins;
162
262
  };
163
- declare type INVOKE_TXN = COMMON_TXN_PROPERTIES & (INVOKE_TXN_V0 | INVOKE_TXN_V1);
164
- declare type DECLARE_TXN = COMMON_TXN_PROPERTIES & {
165
- class_hash: FELT;
166
- sender_address: ADDRESS;
167
- };
168
- declare type DEPLOY_TXN = {
169
- transaction_hash: TXN_HASH;
170
- class_hash: FELT;
171
- } & DEPLOY_TXN_PROPERTIES;
172
- declare type DEPLOY_ACCOUNT_TXN = COMMON_TXN_PROPERTIES & DEPLOY_ACCOUNT_TXN_PROPERTIES;
173
- declare type DEPLOY_ACCOUNT_TXN_PROPERTIES = {
174
- contract_address_salt: FELT;
175
- constructor_calldata: Array<FELT>;
176
- class_hash: FELT;
177
- };
178
- declare type DEPLOY_ACCOUNT_TXN_RECEIPT = DEPLOY_TXN_RECEIPT;
179
- declare type TXN = INVOKE_TXN | L1_HANDLER_TXN | DECLARE_TXN | DEPLOY_TXN | DEPLOY_ACCOUNT_TXN;
180
- declare enum L1_HANDLER {
181
- 'L1_HANDLER' = 0
263
+ interface Program extends Record<string, any> {
264
+ builtins: string[];
265
+ data: string[];
182
266
  }
183
- declare type L1_HANDLER_TXN = {
184
- transaction_hash: TXN_HASH;
185
- version: NUM_AS_HEX;
186
- type: L1_HANDLER;
187
- nonce: NUM_AS_HEX;
188
- } & FUNCTION_CALL;
189
- declare type BROADCASTED_DEPLOY_ACCOUNT_TXN = BROADCASTED_TXN_COMMON_PROPERTIES & DEPLOY_ACCOUNT_TXN_PROPERTIES;
190
- declare type BROADCASTED_TXN = BROADCASTED_INVOKE_TXN | BROADCASTED_DECLARE_TXN | BROADCASTED_DEPLOY_TXN | BROADCASTED_DEPLOY_ACCOUNT_TXN;
191
- declare type BROADCASTED_INVOKE_TXN = BROADCASTED_TXN_COMMON_PROPERTIES & (INVOKE_TXN_V0 | INVOKE_TXN_V1);
192
- declare type BROADCASTED_TXN_COMMON_PROPERTIES = {
193
- type: TXN_TYPE;
194
- max_fee: FELT;
195
- version: NUM_AS_HEX;
196
- signature: SIGNATURE;
197
- nonce: FELT;
198
- };
199
- declare type BROADCASTED_DECLARE_TXN = {
200
- contract_class: CONTRACT_CLASS;
201
- sender_address: ADDRESS;
202
- } & BROADCASTED_TXN_COMMON_PROPERTIES;
203
- declare type BROADCASTED_DEPLOY_TXN = {
204
- contract_class: CONTRACT_CLASS;
205
- } & DEPLOY_TXN_PROPERTIES;
206
- declare type DEPLOY_TXN_PROPERTIES = {
207
- version: NUM_AS_HEX;
208
- type: TXN_TYPE;
209
- contract_address_salt: FELT;
210
- constructor_calldata: Array<FELT>;
211
- };
212
- declare type INVOKE_TXN_V0 = FUNCTION_CALL;
213
- declare type INVOKE_TXN_V1 = {
214
- sender_address: ADDRESS;
215
- calldata: Array<FELT>;
267
+
268
+ /** SYSTEM TYPES */
269
+ declare type CairoAssembly = {
270
+ prime: string;
271
+ compiler_version: string;
272
+ bytecode: ByteCode;
273
+ hints: Hints;
274
+ entry_points_by_type: EntryPointsByType;
216
275
  };
217
- declare type BLOCK_BODY_WITH_TXS = {
218
- transactions: Array<TXN>;
276
+ declare type SierraContractClass = {
277
+ sierra_program: ByteCode;
278
+ sierra_program_debug_info: SierraProgramDebugInfo;
279
+ contract_class_version: string;
280
+ entry_points_by_type: SierraEntryPointsByType;
281
+ abi: Abi;
219
282
  };
220
- declare type BLOCK_WITH_TXS = {
221
- status: BLOCK_STATUS;
222
- } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS;
223
- declare type PENDING_BLOCK_WITH_TXS = BLOCK_BODY_WITH_TXS & {
224
- timestamp: number;
225
- sequencer_address: FELT;
226
- parent_hash: BLOCK_HASH;
283
+ /** COMPILED CONTRACT */
284
+ declare type CompiledSierra = SierraContractClass;
285
+ declare type CompiledSierraCasm = CairoAssembly;
286
+ /** SUBTYPES */
287
+ declare type ByteCode = string[];
288
+ declare type Hints = [number, string[]][];
289
+ declare type SierraProgramDebugInfo = {
290
+ type_names: [number, string][];
291
+ libfunc_names: [number, string][];
292
+ user_func_names: [number, string][];
293
+ };
294
+ declare type SierraEntryPointsByType = {
295
+ CONSTRUCTOR: SierraContractEntryPointFields[];
296
+ EXTERNAL: SierraContractEntryPointFields[];
297
+ L1_HANDLER: SierraContractEntryPointFields[];
298
+ };
299
+ declare type SierraContractEntryPointFields = {
300
+ selector: string;
301
+ function_idx: number;
227
302
  };
228
- declare type CONTRACT_CLASS = {
229
- program: string;
230
- entry_points_by_type: {
231
- CONSTRUCTOR: CONTRACT_ENTRY_POINT_LIST;
232
- EXTERNAL: CONTRACT_ENTRY_POINT_LIST;
233
- L1_HANDLER: CONTRACT_ENTRY_POINT_LIST;
303
+
304
+ declare type ContractClass = LegacyContractClass | SierraContractClass;
305
+ declare type CompiledContract = LegacyCompiledContract | CompiledSierra;
306
+ declare type CairoContract = ContractClass | CompiledContract;
307
+ declare enum EntryPointType {
308
+ EXTERNAL = "EXTERNAL",
309
+ L1_HANDLER = "L1_HANDLER",
310
+ CONSTRUCTOR = "CONSTRUCTOR"
311
+ }
312
+
313
+ declare type Signature = _noble_curves_abstract_weierstrass.SignatureType;
314
+ declare type RawCalldata = BigNumberish[];
315
+ declare type AllowArray<T> = T | T[];
316
+ declare type RawArgs = {
317
+ [inputName: string]: BigNumberish | BigNumberish[] | {
318
+ type: 'struct';
319
+ [k: string]: BigNumberish;
234
320
  };
235
- abi?: CONTRACT_ABI;
321
+ } | BigNumberish[];
322
+ declare type UniversalDeployerContractPayload = {
323
+ classHash: BigNumberish;
324
+ salt?: string;
325
+ unique?: boolean;
326
+ constructorCalldata?: RawArgs;
236
327
  };
237
- declare type CONTRACT_ABI = Array<CONTRACT_ABI_ENTRY>;
238
- declare type CONTRACT_ABI_ENTRY = FUNCTION_ABI_ENTRY | EVENT_ABI_ENTRY | STRUCT_ABI_ENTRY;
239
- declare enum STRUCT_ABI_TYPE {
240
- 'struct' = 0
241
- }
242
- declare enum EVENT_ABI_TYPE {
243
- 'event' = 0
244
- }
245
- declare enum FUNCTION_ABI_TYPE {
246
- 'function' = 0,
247
- 'l1_handler' = 1,
248
- 'constructor' = 2
249
- }
250
- declare type STRUCT_ABI_ENTRY = STRUCT_ABI_TYPE & {
251
- name: string;
252
- size: number;
253
- members: Array<STRUCT_MEMBER>;
328
+ declare type DeployContractPayload = {
329
+ contract: CompiledContract | string;
330
+ constructorCalldata?: RawCalldata;
331
+ addressSalt?: string;
254
332
  };
255
- declare type STRUCT_MEMBER = {
256
- offset: number;
257
- } & TYPED_PARAMETER;
258
- declare type EVENT_ABI_ENTRY = {
259
- name: string;
260
- keys: Array<TYPED_PARAMETER>;
261
- data: Array<TYPED_PARAMETER>;
262
- } & EVENT_ABI_TYPE;
263
- declare type FUNCTION_ABI_ENTRY = {
264
- type: FUNCTION_ABI_TYPE;
265
- name: string;
266
- inputs: Array<TYPED_PARAMETER>;
267
- outputs: Array<TYPED_PARAMETER>;
333
+ declare type DeployAccountContractPayload = {
334
+ classHash: string;
335
+ constructorCalldata?: RawCalldata;
336
+ addressSalt?: BigNumberish;
337
+ contractAddress?: string;
268
338
  };
269
- declare type TYPED_PARAMETER = {
270
- name: string;
271
- type: string;
339
+ declare type DeployAccountContractTransaction = Omit<DeployAccountContractPayload, 'contractAddress'> & {
340
+ signature?: Signature;
272
341
  };
273
- declare type CONTRACT_ENTRY_POINT_LIST = Array<CONTRACT_ENTRY_POINT>;
274
- declare type CONTRACT_ENTRY_POINT = {
275
- offset: NUM_AS_HEX;
276
- selector: FELT;
342
+ declare type DeclareContractPayload = {
343
+ contract: CompiledContract | string;
344
+ classHash?: string;
345
+ casm?: CompiledSierraCasm;
346
+ compiledClassHash?: string;
277
347
  };
278
- declare type CONTRACT_STORAGE_DIFF_ITEM = {
279
- address: FELT;
280
- storage_entries: [key: FELT, value: FELT];
348
+ declare type CompleteDeclareContractPayload = {
349
+ contract: CompiledContract | string;
350
+ classHash: string;
351
+ casm?: CompiledSierraCasm;
352
+ compiledClassHash?: string;
281
353
  };
282
- declare type DEPLOYED_CONTRACT_ITEM = {
283
- address: FELT;
284
- class_hash: FELT;
354
+ declare type DeclareAndDeployContractPayload = Omit<UniversalDeployerContractPayload, 'classHash'> & DeclareContractPayload;
355
+ declare type DeclareContractTransaction = {
356
+ contractDefinition: ContractClass;
357
+ senderAddress: string;
358
+ signature?: Signature;
359
+ compiledClassHash?: string;
285
360
  };
286
- declare type STATE_UPDATE = {
287
- block_hash: BLOCK_HASH;
288
- new_root: FELT;
289
- old_root: FELT;
290
- state_diff: {
291
- storage_diffs: Array<CONTRACT_STORAGE_DIFF_ITEM>;
292
- declared_contract_hashes: Array<FELT>;
293
- deployed_contracts: Array<DEPLOYED_CONTRACT_ITEM>;
294
- nonces: Array<{
295
- contract_address: ADDRESS;
296
- nonce: FELT;
297
- }>;
298
- };
361
+ declare type CallDetails = {
362
+ contractAddress: string;
363
+ calldata?: RawCalldata;
299
364
  };
300
- declare type STORAGE_KEY = string;
301
- declare type EVENT_FILTER = {
302
- from_block?: BLOCK_ID;
303
- to_block?: BLOCK_ID;
304
- address?: ADDRESS;
305
- keys?: Array<FELT>;
365
+ declare type Invocation = CallDetails & {
366
+ signature?: Signature;
306
367
  };
307
- declare type RESULT_PAGE_REQUEST = {
308
- continuation_token?: string;
309
- chunk_size: number;
368
+ declare type Call = CallDetails & {
369
+ entrypoint: string;
310
370
  };
311
- declare type EMITTED_EVENT = EVENT & {
312
- block_hash: BLOCK_HASH;
313
- block_number: BLOCK_NUMBER;
314
- transaction_hash: TXN_HASH;
371
+ declare type InvocationsDetails = {
372
+ nonce?: BigNumberish;
373
+ maxFee?: BigNumberish;
374
+ version?: BigNumberish;
315
375
  };
316
- declare type SYNC_STATUS = {
317
- starting_block_hash: BLOCK_HASH;
318
- starting_block_num: NUM_AS_HEX;
319
- current_block_hash: BLOCK_HASH;
320
- current_block_num: NUM_AS_HEX;
321
- highest_block_hash: BLOCK_HASH;
322
- highest_block_num: NUM_AS_HEX;
376
+ /**
377
+ * Contain all additional details params
378
+ */
379
+ declare type Details = {
380
+ nonce: BigNumberish;
381
+ maxFee: BigNumberish;
382
+ version: BigNumberish;
383
+ chainId: StarknetChainId;
323
384
  };
324
- declare type FEE_ESTIMATE = {
325
- gas_consumed: NUM_AS_HEX;
326
- gas_price: NUM_AS_HEX;
327
- overall_fee: NUM_AS_HEX;
385
+ declare type InvocationsDetailsWithNonce = InvocationsDetails & {
386
+ nonce: BigNumberish;
328
387
  };
329
- declare enum CALL_TYPE {
330
- 'DELEGATE' = 0,
331
- 'CALL' = 1
388
+ declare enum TransactionStatus {
389
+ NOT_RECEIVED = "NOT_RECEIVED",
390
+ RECEIVED = "RECEIVED",
391
+ PENDING = "PENDING",
392
+ ACCEPTED_ON_L2 = "ACCEPTED_ON_L2",
393
+ ACCEPTED_ON_L1 = "ACCEPTED_ON_L1",
394
+ REJECTED = "REJECTED"
332
395
  }
333
- declare enum ENTRY_POINT_TYPE {
334
- 'EXTERNAL' = 0,
335
- 'L1_HANDLER' = 1,
336
- 'CONSTRUCTOR' = 2
396
+ declare type TransactionBulk = Array<({
397
+ type: 'DECLARE';
398
+ } & {
399
+ payload: DeclareContractPayload;
400
+ }) | ({
401
+ type: 'DEPLOY';
402
+ } & {
403
+ payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[];
404
+ }) | ({
405
+ type: 'DEPLOY_ACCOUNT';
406
+ } & {
407
+ payload: DeployAccountContractPayload;
408
+ }) | ({
409
+ type: 'INVOKE_FUNCTION';
410
+ } & {
411
+ payload: AllowArray<Call>;
412
+ })>;
413
+ declare type InvocationBulk = Array<(({
414
+ type: 'DECLARE';
415
+ } & DeclareContractTransaction) | ({
416
+ type: 'DEPLOY_ACCOUNT';
417
+ } & DeployAccountContractTransaction) | ({
418
+ type: 'INVOKE_FUNCTION';
419
+ } & Invocation)) & InvocationsDetailsWithNonce & {
420
+ blockIdentifier: BlockNumber | BigNumberish;
421
+ }>;
422
+ declare type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
423
+ declare enum TransactionType {
424
+ INVOKE = "INVOKE_FUNCTION",
425
+ DECLARE = "DECLARE",
426
+ DEPLOY = "DEPLOY",
427
+ DEPLOY_ACCOUNT = "DEPLOY_ACCOUNT"
337
428
  }
338
- declare type FUNCTION_INVOCATION = FUNCTION_CALL & {
339
- caller_address: FELT;
340
- code_address: FELT;
341
- entry_point_type: ENTRY_POINT_TYPE;
342
- call_type: CALL_TYPE;
343
- result: FELT;
344
- calls: NESTED_CALL;
429
+ declare type Tupled = {
430
+ element: any;
431
+ type: string;
432
+ };
433
+ declare type BlockTag = 'pending' | 'latest';
434
+ declare type BlockNumber = BlockTag | null | number;
435
+ declare type Struct = {
436
+ type: 'struct';
437
+ [k: string]: BigNumberish;
438
+ };
439
+ declare type Args = {
440
+ [inputName: string]: BigNumberish | BigNumberish[] | ParsedStruct | ParsedStruct[];
441
+ };
442
+ declare type ParsedStruct = {
443
+ [key: string]: BigNumberish | ParsedStruct;
444
+ };
445
+ declare type waitForTransactionOptions = {
446
+ retryInterval?: number;
447
+ successStates?: Array<TransactionStatus>;
448
+ };
449
+
450
+ declare type Calldata = string[];
451
+ declare type Overrides = {
452
+ maxFee?: BigNumberish;
453
+ nonce?: BigNumberish;
454
+ signature?: Signature;
455
+ parseRequest: Boolean;
456
+ };
457
+
458
+ interface InvocationsSignerDetails extends Required<InvocationsDetails> {
459
+ walletAddress: string;
460
+ chainId: StarknetChainId;
461
+ }
462
+ interface DeclareSignerDetails {
463
+ classHash: string;
464
+ senderAddress: BigNumberish;
465
+ chainId: StarknetChainId;
466
+ maxFee: BigNumberish;
467
+ version: BigNumberish;
468
+ nonce: BigNumberish;
469
+ compiledClassHash?: string;
470
+ }
471
+ declare type DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Required<InvocationsDetails> & {
472
+ contractAddress: BigNumberish;
473
+ chainId: StarknetChainId;
474
+ };
475
+
476
+ declare type AsyncContractFunction<T = any> = (...args: Array<any>) => Promise<T>;
477
+ declare type ContractFunction = (...args: Array<any>) => any;
478
+
479
+ declare type BlockIdentifier = BlockNumber | BigNumberish;
480
+
481
+ /**
482
+ * Starknet RPC version 0.2.1
483
+ *
484
+ * Starknet Node API 0.45.0 - rpc 0.2.1
485
+ * Starknet Node Write API 0.3.0 - rpc 0.2.1
486
+ * Starknet Trace API 0.4.0 - rpc 0.2.1
487
+ *
488
+ * TypeScript Representation of OpenRpc protocol types
489
+ */
490
+ declare type FELT = string;
491
+ declare type ADDRESS = FELT;
492
+ declare type NUM_AS_HEX = string;
493
+ declare type SIGNATURE = Array<FELT>;
494
+ declare type BLOCK_NUMBER = number;
495
+ declare type BLOCK_HASH = FELT;
496
+ declare type TXN_HASH = FELT;
497
+ declare type TXN_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
498
+ declare type TXN_TYPE = 'DECLARE' | 'DEPLOY' | 'DEPLOY_ACCOUNT' | 'INVOKE' | 'L1_HANDLER';
499
+ declare type BLOCK_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
500
+ declare enum BLOCK_TAG {
501
+ 'latest' = 0,
502
+ 'pending' = 1
503
+ }
504
+ declare type BLOCK_ID = {
505
+ block_hash: BLOCK_HASH;
506
+ } | {
507
+ block_number: BLOCK_NUMBER;
508
+ } | BLOCK_TAG;
509
+ declare type MSG_TO_L1 = {
510
+ to_address: FELT;
511
+ payload: Array<FELT>;
512
+ };
513
+ declare type EVENT = {
514
+ from_address: FELT;
515
+ keys: Array<FELT>;
516
+ data: Array<FELT>;
517
+ };
518
+ declare type COMMON_RECEIPT_PROPERTIES = {
519
+ transaction_hash: TXN_HASH;
520
+ actual_fee: FELT;
521
+ status: TXN_STATUS;
522
+ block_hash?: BLOCK_HASH;
523
+ block_number?: BLOCK_NUMBER;
524
+ type: TXN_TYPE;
525
+ messages_sent: Array<MSG_TO_L1>;
345
526
  events: Array<EVENT>;
346
- messages: MSG_TO_L1;
347
527
  };
348
- declare type NESTED_CALL = FUNCTION_INVOCATION;
349
- declare type TRACE_ROOT = {
528
+ declare type PENDING_COMMON_RECEIPT_PROPERTIES = {
529
+ transaction_hash: TXN_HASH;
530
+ actual_fee: FELT;
531
+ type?: TXN_TYPE;
532
+ messages_sent: Array<MSG_TO_L1>;
533
+ events: Array<EVENT>;
534
+ };
535
+ declare type INVOKE_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
536
+ declare type DECLARE_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
537
+ declare type DEPLOY_TXN_RECEIPT = {
538
+ contract_address: FELT;
539
+ } & COMMON_RECEIPT_PROPERTIES;
540
+ declare type L1_HANDLER_TXN_RECEIPT = COMMON_RECEIPT_PROPERTIES;
541
+ declare type PENDING_DEPLOY_TXN_RECEIPT = {
542
+ contract_address: FELT;
543
+ } & PENDING_COMMON_RECEIPT_PROPERTIES;
544
+ declare type PENDING_TXN_RECEIPT = PENDING_DEPLOY_TXN_RECEIPT | PENDING_COMMON_RECEIPT_PROPERTIES;
545
+ declare type TXN_RECEIPT = INVOKE_TXN_RECEIPT | L1_HANDLER_TXN_RECEIPT | DECLARE_TXN_RECEIPT | DEPLOY_TXN_RECEIPT | DEPLOY_ACCOUNT_TXN_RECEIPT | PENDING_TXN_RECEIPT;
546
+ declare type BLOCK_HEADER = {
547
+ block_hash: BLOCK_HASH;
548
+ parent_hash: BLOCK_HASH;
549
+ block_number: BLOCK_NUMBER;
550
+ new_root: FELT;
551
+ timestamp: number;
552
+ sequencer_address: FELT;
553
+ };
554
+ declare type BLOCK_BODY_WITH_TX_HASHES = {
555
+ transactions: Array<TXN_HASH>;
556
+ };
557
+ declare type BLOCK_WITH_TX_HASHES = {
558
+ status: BLOCK_STATUS;
559
+ } & BLOCK_HEADER & BLOCK_BODY_WITH_TX_HASHES;
560
+ declare type PENDING_BLOCK_WITH_TX_HASHES = BLOCK_BODY_WITH_TX_HASHES & {
561
+ timestamp: number;
562
+ sequencer_address: FELT;
563
+ parent_hash: BLOCK_HASH;
564
+ };
565
+ declare type COMMON_TXN_PROPERTIES = {
566
+ transaction_hash?: TXN_HASH;
567
+ } & BROADCASTED_TXN_COMMON_PROPERTIES;
568
+ declare type FUNCTION_CALL = {
569
+ contract_address?: ADDRESS;
570
+ entry_point_selector?: FELT;
571
+ calldata?: Array<FELT>;
572
+ };
573
+ declare type INVOKE_TXN = COMMON_TXN_PROPERTIES & (INVOKE_TXN_V0 | INVOKE_TXN_V1);
574
+ declare type DECLARE_TXN = COMMON_TXN_PROPERTIES & {
575
+ class_hash: FELT;
576
+ sender_address: ADDRESS;
577
+ };
578
+ declare type DEPLOY_TXN = {
579
+ transaction_hash: TXN_HASH;
580
+ class_hash: FELT;
581
+ } & DEPLOY_TXN_PROPERTIES;
582
+ declare type DEPLOY_ACCOUNT_TXN = COMMON_TXN_PROPERTIES & DEPLOY_ACCOUNT_TXN_PROPERTIES;
583
+ declare type DEPLOY_ACCOUNT_TXN_PROPERTIES = {
584
+ contract_address_salt: FELT;
585
+ constructor_calldata: Array<FELT>;
586
+ class_hash: FELT;
587
+ };
588
+ declare type DEPLOY_ACCOUNT_TXN_RECEIPT = DEPLOY_TXN_RECEIPT;
589
+ declare type TXN = INVOKE_TXN | L1_HANDLER_TXN | DECLARE_TXN | DEPLOY_TXN | DEPLOY_ACCOUNT_TXN;
590
+ declare enum L1_HANDLER {
591
+ 'L1_HANDLER' = 0
592
+ }
593
+ declare type L1_HANDLER_TXN = {
594
+ transaction_hash: TXN_HASH;
595
+ version: NUM_AS_HEX;
596
+ type: L1_HANDLER;
597
+ nonce: NUM_AS_HEX;
598
+ } & FUNCTION_CALL;
599
+ declare type BROADCASTED_DEPLOY_ACCOUNT_TXN = BROADCASTED_TXN_COMMON_PROPERTIES & DEPLOY_ACCOUNT_TXN_PROPERTIES;
600
+ declare type BROADCASTED_TXN = BROADCASTED_INVOKE_TXN | BROADCASTED_DECLARE_TXN | BROADCASTED_DEPLOY_TXN | BROADCASTED_DEPLOY_ACCOUNT_TXN;
601
+ declare type BROADCASTED_INVOKE_TXN = BROADCASTED_TXN_COMMON_PROPERTIES & (INVOKE_TXN_V0 | INVOKE_TXN_V1);
602
+ declare type BROADCASTED_TXN_COMMON_PROPERTIES = {
603
+ type: TXN_TYPE;
604
+ max_fee: FELT;
605
+ version: NUM_AS_HEX;
606
+ signature: SIGNATURE;
350
607
  nonce: FELT;
351
- signature: FELT;
352
- function_invocation: FUNCTION_INVOCATION;
353
608
  };
354
- declare namespace OPENRPC {
355
- type Nonce = FELT;
356
- type BlockWithTxHashes = BLOCK_WITH_TX_HASHES | PENDING_BLOCK_WITH_TX_HASHES;
357
- type BlockWithTxs = BLOCK_WITH_TXS | PENDING_BLOCK_WITH_TXS;
358
- type StateUpdate = STATE_UPDATE;
359
- type Storage = FELT;
360
- type Transaction = TXN;
361
- type TransactionReceipt = TXN_RECEIPT;
362
- type ContractClass = CONTRACT_CLASS;
363
- type CallResponse = Array<FELT>;
364
- type EstimatedFee = FEE_ESTIMATE;
365
- type BlockNumber = BLOCK_NUMBER;
366
- type BlockHashAndNumber = {
367
- block_hash: BLOCK_HASH;
368
- block_number: BLOCK_NUMBER;
369
- };
370
- type CHAIN_ID = string;
371
- type PendingTransactions = Array<TXN>;
372
- type SyncingStatus = false | SYNC_STATUS;
373
- type Events = {
374
- events: Array<EMITTED_EVENT>;
375
- continuation_token: string;
376
- };
377
- type Trace = TRACE_ROOT;
378
- type Traces = Array<{
379
- transaction_hash: FELT;
380
- trace_root: TRACE_ROOT;
381
- }>;
382
- type TransactionHash = TXN_HASH;
383
- type BlockHash = BLOCK_HASH;
384
- type EventFilter = EVENT_FILTER & RESULT_PAGE_REQUEST;
385
- type InvokedTransaction = {
386
- transaction_hash: TXN_HASH;
387
- };
388
- type DeclaredTransaction = {
389
- transaction_hash: TXN_HASH;
390
- class_hash: FELT;
609
+ declare type BROADCASTED_DECLARE_TXN = {
610
+ contract_class: CONTRACT_CLASS;
611
+ sender_address: ADDRESS;
612
+ } & BROADCASTED_TXN_COMMON_PROPERTIES;
613
+ declare type BROADCASTED_DEPLOY_TXN = {
614
+ contract_class: CONTRACT_CLASS;
615
+ } & DEPLOY_TXN_PROPERTIES;
616
+ declare type DEPLOY_TXN_PROPERTIES = {
617
+ version: NUM_AS_HEX;
618
+ type: TXN_TYPE;
619
+ contract_address_salt: FELT;
620
+ constructor_calldata: Array<FELT>;
621
+ };
622
+ declare type INVOKE_TXN_V0 = FUNCTION_CALL;
623
+ declare type INVOKE_TXN_V1 = {
624
+ sender_address: ADDRESS;
625
+ calldata: Array<FELT>;
626
+ };
627
+ declare type BLOCK_BODY_WITH_TXS = {
628
+ transactions: Array<TXN>;
629
+ };
630
+ declare type BLOCK_WITH_TXS = {
631
+ status: BLOCK_STATUS;
632
+ } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS;
633
+ declare type PENDING_BLOCK_WITH_TXS = BLOCK_BODY_WITH_TXS & {
634
+ timestamp: number;
635
+ sequencer_address: FELT;
636
+ parent_hash: BLOCK_HASH;
637
+ };
638
+ declare type CONTRACT_CLASS = {
639
+ program: string;
640
+ entry_points_by_type: {
641
+ CONSTRUCTOR: CONTRACT_ENTRY_POINT_LIST;
642
+ EXTERNAL: CONTRACT_ENTRY_POINT_LIST;
643
+ L1_HANDLER: CONTRACT_ENTRY_POINT_LIST;
391
644
  };
392
- type DeployedTransaction = {
645
+ abi?: CONTRACT_ABI;
646
+ };
647
+ declare type CONTRACT_ABI = Array<CONTRACT_ABI_ENTRY>;
648
+ declare type CONTRACT_ABI_ENTRY = FUNCTION_ABI_ENTRY | EVENT_ABI_ENTRY | STRUCT_ABI_ENTRY;
649
+ declare enum STRUCT_ABI_TYPE {
650
+ 'struct' = 0
651
+ }
652
+ declare enum EVENT_ABI_TYPE {
653
+ 'event' = 0
654
+ }
655
+ declare enum FUNCTION_ABI_TYPE {
656
+ 'function' = 0,
657
+ 'l1_handler' = 1,
658
+ 'constructor' = 2
659
+ }
660
+ declare type STRUCT_ABI_ENTRY = STRUCT_ABI_TYPE & {
661
+ name: string;
662
+ size: number;
663
+ members: Array<STRUCT_MEMBER>;
664
+ };
665
+ declare type STRUCT_MEMBER = {
666
+ offset: number;
667
+ } & TYPED_PARAMETER;
668
+ declare type EVENT_ABI_ENTRY = {
669
+ name: string;
670
+ keys: Array<TYPED_PARAMETER>;
671
+ data: Array<TYPED_PARAMETER>;
672
+ } & EVENT_ABI_TYPE;
673
+ declare type FUNCTION_ABI_ENTRY = {
674
+ type: FUNCTION_ABI_TYPE;
675
+ name: string;
676
+ inputs: Array<TYPED_PARAMETER>;
677
+ outputs: Array<TYPED_PARAMETER>;
678
+ };
679
+ declare type TYPED_PARAMETER = {
680
+ name: string;
681
+ type: string;
682
+ };
683
+ declare type CONTRACT_ENTRY_POINT_LIST = Array<CONTRACT_ENTRY_POINT>;
684
+ declare type CONTRACT_ENTRY_POINT = {
685
+ offset: NUM_AS_HEX;
686
+ selector: FELT;
687
+ };
688
+ declare type CONTRACT_STORAGE_DIFF_ITEM = {
689
+ address: FELT;
690
+ storage_entries: {
691
+ key: FELT;
692
+ value: FELT;
693
+ }[];
694
+ };
695
+ declare type DEPLOYED_CONTRACT_ITEM = {
696
+ address: FELT;
697
+ class_hash: FELT;
698
+ };
699
+ declare type STATE_UPDATE = {
700
+ block_hash: BLOCK_HASH;
701
+ new_root: FELT;
702
+ old_root: FELT;
703
+ state_diff: {
704
+ storage_diffs: Array<CONTRACT_STORAGE_DIFF_ITEM>;
705
+ declared_contract_hashes: Array<FELT>;
706
+ deployed_contracts: Array<DEPLOYED_CONTRACT_ITEM>;
707
+ nonces: Array<{
708
+ contract_address: ADDRESS;
709
+ nonce: FELT;
710
+ }>;
711
+ };
712
+ };
713
+ declare type STORAGE_KEY = string;
714
+ declare type EVENT_FILTER = {
715
+ from_block?: BLOCK_ID;
716
+ to_block?: BLOCK_ID;
717
+ address?: ADDRESS;
718
+ keys?: Array<FELT>;
719
+ };
720
+ declare type RESULT_PAGE_REQUEST = {
721
+ continuation_token?: string;
722
+ chunk_size: number;
723
+ };
724
+ declare type EMITTED_EVENT = EVENT & {
725
+ block_hash: BLOCK_HASH;
726
+ block_number: BLOCK_NUMBER;
727
+ transaction_hash: TXN_HASH;
728
+ };
729
+ declare type SYNC_STATUS = {
730
+ starting_block_hash: BLOCK_HASH;
731
+ starting_block_num: NUM_AS_HEX;
732
+ current_block_hash: BLOCK_HASH;
733
+ current_block_num: NUM_AS_HEX;
734
+ highest_block_hash: BLOCK_HASH;
735
+ highest_block_num: NUM_AS_HEX;
736
+ };
737
+ declare type FEE_ESTIMATE = {
738
+ gas_consumed: NUM_AS_HEX;
739
+ gas_price: NUM_AS_HEX;
740
+ overall_fee: NUM_AS_HEX;
741
+ };
742
+ declare enum CALL_TYPE {
743
+ 'DELEGATE' = 0,
744
+ 'CALL' = 1
745
+ }
746
+ declare enum ENTRY_POINT_TYPE {
747
+ 'EXTERNAL' = 0,
748
+ 'L1_HANDLER' = 1,
749
+ 'CONSTRUCTOR' = 2
750
+ }
751
+ declare type FUNCTION_INVOCATION = FUNCTION_CALL & {
752
+ caller_address: FELT;
753
+ code_address: FELT;
754
+ entry_point_type: ENTRY_POINT_TYPE;
755
+ call_type: CALL_TYPE;
756
+ result: FELT;
757
+ calls: NESTED_CALL;
758
+ events: Array<EVENT>;
759
+ messages: MSG_TO_L1;
760
+ };
761
+ declare type NESTED_CALL = FUNCTION_INVOCATION;
762
+ declare type TRACE_ROOT = {
763
+ nonce: FELT;
764
+ signature: FELT;
765
+ function_invocation: FUNCTION_INVOCATION;
766
+ };
767
+ declare namespace OPENRPC {
768
+ type Nonce = FELT;
769
+ type BlockWithTxHashes = BLOCK_WITH_TX_HASHES | PENDING_BLOCK_WITH_TX_HASHES;
770
+ type BlockWithTxs = BLOCK_WITH_TXS | PENDING_BLOCK_WITH_TXS;
771
+ type StateUpdate = STATE_UPDATE;
772
+ type Storage = FELT;
773
+ type Transaction = TXN;
774
+ type TransactionReceipt = TXN_RECEIPT;
775
+ type ContractClass = CONTRACT_CLASS;
776
+ type CallResponse = Array<FELT>;
777
+ type EstimatedFee = FEE_ESTIMATE;
778
+ type BlockNumber = BLOCK_NUMBER;
779
+ type BlockHashAndNumber = {
780
+ block_hash: BLOCK_HASH;
781
+ block_number: BLOCK_NUMBER;
782
+ };
783
+ type CHAIN_ID = string;
784
+ type PendingTransactions = Array<TXN>;
785
+ type SyncingStatus = false | SYNC_STATUS;
786
+ type Events = {
787
+ events: Array<EMITTED_EVENT>;
788
+ continuation_token: string;
789
+ };
790
+ type Trace = TRACE_ROOT;
791
+ type Traces = Array<{
792
+ transaction_hash: FELT;
793
+ trace_root: TRACE_ROOT;
794
+ }>;
795
+ type TransactionHash = TXN_HASH;
796
+ type BlockHash = BLOCK_HASH;
797
+ type EventFilter = EVENT_FILTER & RESULT_PAGE_REQUEST;
798
+ type InvokedTransaction = {
799
+ transaction_hash: TXN_HASH;
800
+ };
801
+ type DeclaredTransaction = {
802
+ transaction_hash: TXN_HASH;
803
+ class_hash: FELT;
804
+ };
805
+ type DeployedTransaction = {
393
806
  transaction_hash: TXN_HASH;
394
807
  contract_address: FELT;
395
808
  };
@@ -569,465 +982,135 @@ declare namespace OPENRPC {
569
982
  };
570
983
  starknet_traceBlockTransactions: {
571
984
  params: {
572
- block_hash: BLOCK_HASH;
573
- };
574
- result: Traces;
575
- errors: Errors.INVALID_BLOCK_HASH;
576
- };
577
- };
578
- }
579
- declare namespace Errors {
580
- interface FAILED_TO_RECEIVE_TXN {
581
- code: 1;
582
- message: 'Failed to write transaction';
583
- }
584
- interface CONTRACT_NOT_FOUND {
585
- code: 20;
586
- message: 'Contract not found';
587
- }
588
- interface INVALID_MESSAGE_SELECTOR {
589
- code: 21;
590
- message: 'Invalid message selector';
591
- }
592
- interface INVALID_CALL_DATA {
593
- code: 22;
594
- message: 'Invalid call data';
595
- }
596
- interface BLOCK_NOT_FOUND {
597
- code: 24;
598
- message: 'Block not found';
599
- }
600
- interface INVALID_TXN_INDEX {
601
- code: 27;
602
- message: 'Invalid transaction index in a block';
603
- }
604
- interface CLASS_HASH_NOT_FOUND {
605
- code: 28;
606
- message: 'Class hash not found';
607
- }
608
- interface PAGE_SIZE_TOO_BIG {
609
- code: 31;
610
- message: 'Requested page size is too big';
611
- }
612
- interface NO_BLOCKS {
613
- code: 32;
614
- message: 'There are no blocks';
615
- }
616
- interface INVALID_CONTINUATION_TOKEN {
617
- code: 33;
618
- message: 'The supplied continuation token is invalid or unknown';
619
- }
620
- interface CONTRACT_ERROR {
621
- code: 40;
622
- message: 'Contract error';
623
- }
624
- interface INVALID_CONTRACT_CLASS {
625
- code: 50;
626
- message: 'Invalid contract class';
627
- }
628
- interface NO_TRACE_AVAILABLE {
629
- code: 10;
630
- message: 'No trace available for transaction';
631
- data: {
632
- status: 'RECEIVED' | 'REJECTED';
633
- };
634
- }
635
- interface INVALID_BLOCK_HASH {
636
- code: 24;
637
- message: 'Invalid block hash';
638
- }
639
- interface TXN_HASH_NOT_FOUND {
640
- code: 25;
641
- message: 'Transaction hash not found';
642
- }
643
- }
644
-
645
- declare namespace RPC {
646
- type Response = {
647
- id: number;
648
- jsonrpc: string;
649
- result?: any;
650
- error?: {
651
- code: string;
652
- message: string;
653
- };
654
- };
655
- type ChainId = OPENRPC.CHAIN_ID;
656
- type CallResponse = OPENRPC.CallResponse;
657
- type ContractAddress = ADDRESS;
658
- type Felt = FELT;
659
- type Nonce = OPENRPC.Nonce;
660
- type ContractClass = OPENRPC.ContractClass;
661
- type StateUpdate = OPENRPC.StateUpdate;
662
- type Transaction = OPENRPC.Transaction;
663
- type PendingTransactions = OPENRPC.PendingTransactions;
664
- type TransactionHash = OPENRPC.TransactionHash;
665
- type Trace = OPENRPC.Trace;
666
- type Traces = OPENRPC.Traces;
667
- type BlockHash = OPENRPC.BlockHash;
668
- type BlockHashAndNumber = OPENRPC.BlockHashAndNumber;
669
- type GetClassResponse = OPENRPC.ContractClass;
670
- type EstimateFeeResponse = OPENRPC.EstimatedFee;
671
- type GetBlockWithTxHashesResponse = OPENRPC.BlockWithTxHashes;
672
- type GetBlockWithTxs = OPENRPC.BlockWithTxs;
673
- type GetStorageAtResponse = OPENRPC.Storage;
674
- type TransactionReceipt = OPENRPC.TransactionReceipt;
675
- type GetTransactionByHashResponse = OPENRPC.Transaction;
676
- type GetTransactionByBlockIdAndIndex = OPENRPC.Transaction;
677
- type GetTransactionCountResponse = number;
678
- type GetBlockNumberResponse = OPENRPC.BlockNumber;
679
- type GetSyncingStatsResponse = OPENRPC.SyncingStatus;
680
- type EventFilter = OPENRPC.EventFilter;
681
- type GetEventsResponse = OPENRPC.Events;
682
- type InvokedTransaction = OPENRPC.InvokedTransaction;
683
- type DeclaredTransaction = OPENRPC.DeclaredTransaction;
684
- type DeployedTransaction = OPENRPC.DeployedTransaction;
685
- type Methods = OPENRPC.Methods;
686
- enum TransactionType {
687
- DECLARE = "DECLARE",
688
- DEPLOY = "DEPLOY",
689
- DEPLOY_ACCOUNT = "DEPLOY_ACCOUNT",
690
- INVOKE = "INVOKE",
691
- L1_HANDLER = "L1_HANDLER"
692
- }
693
- }
694
-
695
- declare type Signature = _noble_curves_abstract_weierstrass.SignatureType;
696
- declare type RawCalldata = BigNumberish[];
697
- declare type AllowArray<T> = T | T[];
698
- declare type RawArgs = {
699
- [inputName: string]: BigNumberish | BigNumberish[] | {
700
- type: 'struct';
701
- [k: string]: BigNumberish;
702
- };
703
- } | BigNumberish[];
704
- interface ContractClass {
705
- program: CompressedProgram;
706
- entry_points_by_type: RPC.ContractClass['entry_points_by_type'];
707
- abi?: Abi;
708
- }
709
- declare type UniversalDeployerContractPayload = {
710
- classHash: BigNumberish;
711
- salt?: string;
712
- unique?: boolean;
713
- constructorCalldata?: RawArgs;
714
- };
715
- declare type DeployContractPayload = {
716
- contract: CompiledContract | string;
717
- constructorCalldata?: RawCalldata;
718
- addressSalt?: string;
719
- };
720
- declare type DeployAccountContractPayload = {
721
- classHash: string;
722
- constructorCalldata?: RawCalldata;
723
- addressSalt?: BigNumberish;
724
- contractAddress?: string;
725
- };
726
- declare type DeployAccountContractTransaction = Omit<DeployAccountContractPayload, 'contractAddress'> & {
727
- signature?: Signature;
728
- };
729
- declare type DeclareContractPayload = {
730
- contract: CompiledContract | string;
731
- classHash?: string;
732
- };
733
- declare type DeclareAndDeployContractPayload = Omit<UniversalDeployerContractPayload, 'classHash'> & DeclareContractPayload;
734
- declare type DeclareContractTransaction = {
735
- contractDefinition: ContractClass;
736
- senderAddress: string;
737
- signature?: Signature;
738
- };
739
- declare type CallDetails = {
740
- contractAddress: string;
741
- calldata?: RawCalldata;
742
- };
743
- declare type Invocation = CallDetails & {
744
- signature?: Signature;
745
- };
746
- declare type Call = CallDetails & {
747
- entrypoint: string;
748
- };
749
- declare type InvocationsDetails = {
750
- nonce?: BigNumberish;
751
- maxFee?: BigNumberish;
752
- version?: BigNumberish;
753
- };
754
- declare type InvocationsDetailsWithNonce = InvocationsDetails & {
755
- nonce: BigNumberish;
756
- };
757
- declare enum TransactionStatus {
758
- NOT_RECEIVED = "NOT_RECEIVED",
759
- RECEIVED = "RECEIVED",
760
- PENDING = "PENDING",
761
- ACCEPTED_ON_L2 = "ACCEPTED_ON_L2",
762
- ACCEPTED_ON_L1 = "ACCEPTED_ON_L1",
763
- REJECTED = "REJECTED"
764
- }
765
- declare type TransactionBulk = Array<({
766
- type: 'DECLARE';
767
- } & {
768
- payload: DeclareContractPayload;
769
- }) | ({
770
- type: 'DEPLOY';
771
- } & {
772
- payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[];
773
- }) | ({
774
- type: 'DEPLOY_ACCOUNT';
775
- } & {
776
- payload: DeployAccountContractPayload;
777
- }) | ({
778
- type: 'INVOKE_FUNCTION';
779
- } & {
780
- payload: AllowArray<Call>;
781
- })>;
782
- declare type InvocationBulk = Array<(({
783
- type: 'DECLARE';
784
- } & DeclareContractTransaction) | ({
785
- type: 'DEPLOY_ACCOUNT';
786
- } & DeployAccountContractTransaction) | ({
787
- type: 'INVOKE_FUNCTION';
788
- } & Invocation)) & InvocationsDetailsWithNonce & {
789
- blockIdentifier: BlockNumber | BigNumberish;
790
- }>;
791
- declare type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
792
- declare enum TransactionType {
793
- INVOKE = "INVOKE_FUNCTION",
794
- DECLARE = "DECLARE",
795
- DEPLOY = "DEPLOY",
796
- DEPLOY_ACCOUNT = "DEPLOY_ACCOUNT"
797
- }
798
- declare type EntryPointType = 'EXTERNAL';
799
- declare type CompressedProgram = string;
800
- declare type AbiEntry = {
801
- name: string;
802
- type: 'felt' | 'felt*' | string;
803
- };
804
- declare type Tupled = {
805
- element: any;
806
- type: string;
807
- };
808
- declare type FunctionAbi = {
809
- inputs: AbiEntry[];
810
- name: string;
811
- outputs: AbiEntry[];
812
- stateMutability?: 'view';
813
- type: FunctionAbiType;
814
- };
815
- declare enum FunctionAbiType {
816
- 'function' = 0,
817
- 'l1_handler' = 1,
818
- 'constructor' = 2
819
- }
820
- declare type abiStructs = {
821
- [name: string]: StructAbi;
822
- };
823
- declare type StructAbi = {
824
- members: (AbiEntry & {
825
- offset: number;
826
- })[];
827
- name: string;
828
- size: number;
829
- type: 'struct';
830
- };
831
- declare type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
832
- declare type EventAbi = any;
833
- declare type ContractEntryPointFields = {
834
- selector: string;
835
- offset: string;
836
- };
837
- declare type EntryPointsByType = {
838
- CONSTRUCTOR: ContractEntryPointFields[];
839
- EXTERNAL: ContractEntryPointFields[];
840
- L1_HANDLER: ContractEntryPointFields[];
841
- };
842
- interface Program extends Record<string, any> {
843
- builtins: string[];
844
- data: string[];
845
- }
846
- declare type BlockTag = 'pending' | 'latest';
847
- declare type BlockNumber = BlockTag | null | number;
848
- declare type CompiledContract = {
849
- abi: Abi;
850
- entry_points_by_type: EntryPointsByType;
851
- program: Program;
852
- };
853
- declare type CompressedCompiledContract = Omit<CompiledContract, 'program'> & {
854
- program: CompressedProgram;
855
- };
856
- declare type Struct = {
857
- type: 'struct';
858
- [k: string]: BigNumberish;
859
- };
860
- declare type Args = {
861
- [inputName: string]: BigNumberish | BigNumberish[] | ParsedStruct | ParsedStruct[];
862
- };
863
- declare type ParsedStruct = {
864
- [key: string]: BigNumberish | ParsedStruct;
865
- };
866
- declare type waitForTransactionOptions = {
867
- retryInterval?: number;
868
- successStates?: Array<TransactionStatus>;
869
- };
870
-
871
- declare type Calldata = string[];
872
- declare type Overrides = {
873
- maxFee?: BigNumberish;
874
- nonce?: BigNumberish;
875
- signature?: Signature;
876
- parseRequest: Boolean;
877
- };
878
-
879
- declare const IS_BROWSER: boolean;
880
- declare function arrayBufferToString(array: ArrayBuffer): string;
881
- declare function btoaUniversal(b: ArrayBuffer): string;
882
- declare function buf2hex(buffer: Uint8Array): string;
883
- /**
884
- * Some function imported from https://github.com/pedrouid/enc-utils/blob/master/src/index.ts
885
- * enc-utils is no dependency to avoid using `Buffer` which just works in node and no browsers
886
- */
887
- declare function removeHexPrefix(hex: string): string;
888
- declare function addHexPrefix(hex: string): string;
889
- declare function padLeft(str: string, length: number, padding?: string): string;
890
- declare function calcByteLength(length: number, byteSize?: number): number;
891
- declare function sanitizeBytes(str: string, byteSize?: number, padding?: string): string;
892
- declare function sanitizeHex(hex: string): string;
893
- declare function utf8ToArray(str: string): Uint8Array;
894
-
895
- declare const encode_IS_BROWSER: typeof IS_BROWSER;
896
- declare const encode_arrayBufferToString: typeof arrayBufferToString;
897
- declare const encode_btoaUniversal: typeof btoaUniversal;
898
- declare const encode_buf2hex: typeof buf2hex;
899
- declare const encode_removeHexPrefix: typeof removeHexPrefix;
900
- declare const encode_addHexPrefix: typeof addHexPrefix;
901
- declare const encode_padLeft: typeof padLeft;
902
- declare const encode_calcByteLength: typeof calcByteLength;
903
- declare const encode_sanitizeBytes: typeof sanitizeBytes;
904
- declare const encode_sanitizeHex: typeof sanitizeHex;
905
- declare const encode_utf8ToArray: typeof utf8ToArray;
906
- declare namespace encode {
907
- export {
908
- encode_IS_BROWSER as IS_BROWSER,
909
- encode_arrayBufferToString as arrayBufferToString,
910
- encode_btoaUniversal as btoaUniversal,
911
- encode_buf2hex as buf2hex,
912
- encode_removeHexPrefix as removeHexPrefix,
913
- encode_addHexPrefix as addHexPrefix,
914
- encode_padLeft as padLeft,
915
- encode_calcByteLength as calcByteLength,
916
- encode_sanitizeBytes as sanitizeBytes,
917
- encode_sanitizeHex as sanitizeHex,
918
- encode_utf8ToArray as utf8ToArray,
919
- };
920
- }
921
-
922
- declare const ZERO = 0n;
923
- declare const MASK_250: bigint;
924
- declare const MASK_251: bigint;
925
- declare const API_VERSION = 0n;
926
- declare enum BaseUrl {
927
- SN_MAIN = "https://alpha-mainnet.starknet.io",
928
- SN_GOERLI = "https://alpha4.starknet.io",
929
- SN_GOERLI2 = "https://alpha4-2.starknet.io"
930
- }
931
- declare enum NetworkName {
932
- SN_MAIN = "SN_MAIN",
933
- SN_GOERLI = "SN_GOERLI",
934
- SN_GOERLI2 = "SN_GOERLI2"
935
- }
936
- declare enum StarknetChainId {
937
- SN_MAIN = "0x534e5f4d41494e",
938
- SN_GOERLI = "0x534e5f474f45524c49",
939
- SN_GOERLI2 = "0x534e5f474f45524c4932"
940
- }
941
- declare enum TransactionHashPrefix {
942
- DECLARE = "0x6465636c617265",
943
- DEPLOY = "0x6465706c6f79",
944
- DEPLOY_ACCOUNT = "0x6465706c6f795f6163636f756e74",
945
- INVOKE = "0x696e766f6b65",
946
- L1_HANDLER = "0x6c315f68616e646c6572"
985
+ block_hash: BLOCK_HASH;
986
+ };
987
+ result: Traces;
988
+ errors: Errors.INVALID_BLOCK_HASH;
989
+ };
990
+ };
947
991
  }
948
- declare const UDC: {
949
- ADDRESS: string;
950
- ENTRYPOINT: string;
951
- };
952
- /**
953
- * The following is taken from https://github.com/starkware-libs/starkex-resources/blob/master/crypto/starkware/crypto/signature/pedersen_params.json but converted to hex, because JS is very bad handling big integers by default
954
- * Please do not edit until the JSON changes.
955
- */
956
- declare const FIELD_PRIME = "800000000000011000000000000000000000000000000000000000000000001";
957
- declare const FIELD_GEN = "3";
958
- declare const FIELD_SIZE = 251;
959
- declare const EC_ORDER = "800000000000010FFFFFFFFFFFFFFFFB781126DCAE7B2321E66A241ADC64D2F";
960
- declare const ALPHA = "1";
961
- declare const BETA = "6F21413EFBE40DE150E596D72F7A8C5609AD26C15C915C1F4CDFCB99CEE9E89";
962
- declare const MAX_ECDSA_VAL = "800000000000000000000000000000000000000000000000000000000000000";
963
- declare const CONSTANT_POINTS: string[][];
964
-
965
- declare const constants_ZERO: typeof ZERO;
966
- declare const constants_MASK_250: typeof MASK_250;
967
- declare const constants_MASK_251: typeof MASK_251;
968
- declare const constants_API_VERSION: typeof API_VERSION;
969
- type constants_BaseUrl = BaseUrl;
970
- declare const constants_BaseUrl: typeof BaseUrl;
971
- type constants_NetworkName = NetworkName;
972
- declare const constants_NetworkName: typeof NetworkName;
973
- type constants_StarknetChainId = StarknetChainId;
974
- declare const constants_StarknetChainId: typeof StarknetChainId;
975
- type constants_TransactionHashPrefix = TransactionHashPrefix;
976
- declare const constants_TransactionHashPrefix: typeof TransactionHashPrefix;
977
- declare const constants_UDC: typeof UDC;
978
- declare const constants_FIELD_PRIME: typeof FIELD_PRIME;
979
- declare const constants_FIELD_GEN: typeof FIELD_GEN;
980
- declare const constants_FIELD_SIZE: typeof FIELD_SIZE;
981
- declare const constants_EC_ORDER: typeof EC_ORDER;
982
- declare const constants_ALPHA: typeof ALPHA;
983
- declare const constants_BETA: typeof BETA;
984
- declare const constants_MAX_ECDSA_VAL: typeof MAX_ECDSA_VAL;
985
- declare const constants_CONSTANT_POINTS: typeof CONSTANT_POINTS;
986
- declare const constants_IS_BROWSER: typeof IS_BROWSER;
987
- declare namespace constants {
988
- export {
989
- constants_ZERO as ZERO,
990
- constants_MASK_250 as MASK_250,
991
- constants_MASK_251 as MASK_251,
992
- constants_API_VERSION as API_VERSION,
993
- constants_BaseUrl as BaseUrl,
994
- constants_NetworkName as NetworkName,
995
- constants_StarknetChainId as StarknetChainId,
996
- constants_TransactionHashPrefix as TransactionHashPrefix,
997
- constants_UDC as UDC,
998
- constants_FIELD_PRIME as FIELD_PRIME,
999
- constants_FIELD_GEN as FIELD_GEN,
1000
- constants_FIELD_SIZE as FIELD_SIZE,
1001
- constants_EC_ORDER as EC_ORDER,
1002
- constants_ALPHA as ALPHA,
1003
- constants_BETA as BETA,
1004
- constants_MAX_ECDSA_VAL as MAX_ECDSA_VAL,
1005
- constants_CONSTANT_POINTS as CONSTANT_POINTS,
1006
- constants_IS_BROWSER as IS_BROWSER,
1007
- };
992
+ declare namespace Errors {
993
+ interface FAILED_TO_RECEIVE_TXN {
994
+ code: 1;
995
+ message: 'Failed to write transaction';
996
+ }
997
+ interface CONTRACT_NOT_FOUND {
998
+ code: 20;
999
+ message: 'Contract not found';
1000
+ }
1001
+ interface INVALID_MESSAGE_SELECTOR {
1002
+ code: 21;
1003
+ message: 'Invalid message selector';
1004
+ }
1005
+ interface INVALID_CALL_DATA {
1006
+ code: 22;
1007
+ message: 'Invalid call data';
1008
+ }
1009
+ interface BLOCK_NOT_FOUND {
1010
+ code: 24;
1011
+ message: 'Block not found';
1012
+ }
1013
+ interface INVALID_TXN_INDEX {
1014
+ code: 27;
1015
+ message: 'Invalid transaction index in a block';
1016
+ }
1017
+ interface CLASS_HASH_NOT_FOUND {
1018
+ code: 28;
1019
+ message: 'Class hash not found';
1020
+ }
1021
+ interface PAGE_SIZE_TOO_BIG {
1022
+ code: 31;
1023
+ message: 'Requested page size is too big';
1024
+ }
1025
+ interface NO_BLOCKS {
1026
+ code: 32;
1027
+ message: 'There are no blocks';
1028
+ }
1029
+ interface INVALID_CONTINUATION_TOKEN {
1030
+ code: 33;
1031
+ message: 'The supplied continuation token is invalid or unknown';
1032
+ }
1033
+ interface CONTRACT_ERROR {
1034
+ code: 40;
1035
+ message: 'Contract error';
1036
+ }
1037
+ interface INVALID_CONTRACT_CLASS {
1038
+ code: 50;
1039
+ message: 'Invalid contract class';
1040
+ }
1041
+ interface NO_TRACE_AVAILABLE {
1042
+ code: 10;
1043
+ message: 'No trace available for transaction';
1044
+ data: {
1045
+ status: 'RECEIVED' | 'REJECTED';
1046
+ };
1047
+ }
1048
+ interface INVALID_BLOCK_HASH {
1049
+ code: 24;
1050
+ message: 'Invalid block hash';
1051
+ }
1052
+ interface TXN_HASH_NOT_FOUND {
1053
+ code: 25;
1054
+ message: 'Transaction hash not found';
1055
+ }
1008
1056
  }
1009
1057
 
1010
- interface InvocationsSignerDetails extends Required<InvocationsDetails> {
1011
- walletAddress: string;
1012
- chainId: StarknetChainId;
1013
- }
1014
- interface DeclareSignerDetails {
1015
- classHash: string;
1016
- senderAddress: BigNumberish;
1017
- chainId: StarknetChainId;
1018
- maxFee: BigNumberish;
1019
- version: BigNumberish;
1020
- nonce: BigNumberish;
1058
+ declare namespace RPC {
1059
+ type Response = {
1060
+ id: number;
1061
+ jsonrpc: string;
1062
+ result?: any;
1063
+ error?: {
1064
+ code: string;
1065
+ message: string;
1066
+ };
1067
+ };
1068
+ type ChainId = OPENRPC.CHAIN_ID;
1069
+ type CallResponse = OPENRPC.CallResponse;
1070
+ type ContractAddress = ADDRESS;
1071
+ type Felt = FELT;
1072
+ type Nonce = OPENRPC.Nonce;
1073
+ type ContractClass = OPENRPC.ContractClass;
1074
+ type StateUpdate = OPENRPC.StateUpdate;
1075
+ type Transaction = OPENRPC.Transaction;
1076
+ type PendingTransactions = OPENRPC.PendingTransactions;
1077
+ type TransactionHash = OPENRPC.TransactionHash;
1078
+ type Trace = OPENRPC.Trace;
1079
+ type Traces = OPENRPC.Traces;
1080
+ type BlockHash = OPENRPC.BlockHash;
1081
+ type BlockHashAndNumber = OPENRPC.BlockHashAndNumber;
1082
+ type GetClassResponse = OPENRPC.ContractClass;
1083
+ type EstimateFeeResponse = OPENRPC.EstimatedFee;
1084
+ type GetBlockWithTxHashesResponse = OPENRPC.BlockWithTxHashes;
1085
+ type GetBlockWithTxs = OPENRPC.BlockWithTxs;
1086
+ type GetStorageAtResponse = OPENRPC.Storage;
1087
+ type TransactionReceipt = OPENRPC.TransactionReceipt;
1088
+ type GetTransactionByHashResponse = OPENRPC.Transaction;
1089
+ type GetTransactionByBlockIdAndIndex = OPENRPC.Transaction;
1090
+ type GetTransactionCountResponse = number;
1091
+ type GetBlockNumberResponse = OPENRPC.BlockNumber;
1092
+ type GetSyncingStatsResponse = OPENRPC.SyncingStatus;
1093
+ type EventFilter = OPENRPC.EventFilter;
1094
+ type GetEventsResponse = OPENRPC.Events;
1095
+ type InvokedTransaction = OPENRPC.InvokedTransaction;
1096
+ type DeclaredTransaction = OPENRPC.DeclaredTransaction;
1097
+ type DeployedTransaction = OPENRPC.DeployedTransaction;
1098
+ type Methods = OPENRPC.Methods;
1099
+ type Storage = OPENRPC.Storage;
1100
+ enum TransactionType {
1101
+ DECLARE = "DECLARE",
1102
+ DEPLOY = "DEPLOY",
1103
+ DEPLOY_ACCOUNT = "DEPLOY_ACCOUNT",
1104
+ INVOKE = "INVOKE",
1105
+ L1_HANDLER = "L1_HANDLER"
1106
+ }
1107
+ type StorageDiffs = Array<CONTRACT_STORAGE_DIFF_ITEM>;
1108
+ type DeclaredContractHashes = Array<FELT>;
1109
+ type Nonces = Array<{
1110
+ contract_address: ADDRESS;
1111
+ nonce: FELT;
1112
+ }>;
1021
1113
  }
1022
- declare type DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Required<InvocationsDetails> & {
1023
- contractAddress: BigNumberish;
1024
- chainId: StarknetChainId;
1025
- };
1026
-
1027
- declare type AsyncContractFunction<T = any> = (...args: Array<any>) => Promise<T>;
1028
- declare type ContractFunction = (...args: Array<any>) => any;
1029
-
1030
- declare type BlockIdentifier = BlockNumber | BigNumberish;
1031
1114
 
1032
1115
  declare type GetTransactionStatusResponse = {
1033
1116
  tx_status: TransactionStatus;
@@ -1048,7 +1131,7 @@ declare type FunctionInvocation = {
1048
1131
  call_type?: string;
1049
1132
  class_hash?: string;
1050
1133
  selector?: string;
1051
- entry_point_type?: EntryPointType;
1134
+ entry_point_type?: EntryPointType.EXTERNAL;
1052
1135
  result: Array<any>;
1053
1136
  execution_resources: ExecutionResources;
1054
1137
  internal_calls: Array<FunctionInvocation>;
@@ -1079,22 +1162,10 @@ declare type CallL1Handler = {
1079
1162
  entry_point_selector: string;
1080
1163
  payload: Array<string>;
1081
1164
  };
1082
- declare type StateDiffItem = {
1083
- key: string;
1084
- value: string;
1085
- };
1086
- declare type StorageDiffItem = {
1087
- address: string;
1088
- storage_entries: [key: string, value: string];
1089
- };
1090
1165
  declare type DeployedContractItem = {
1091
1166
  address: string;
1092
1167
  class_hash: string;
1093
1168
  };
1094
- declare type Nonces = {
1095
- contract_address: string;
1096
- nonce: string;
1097
- };
1098
1169
  declare type SequencerIdentifier = {
1099
1170
  blockHash: string;
1100
1171
  } | {
@@ -1109,6 +1180,7 @@ declare namespace Sequencer {
1109
1180
  nonce: BigNumberish;
1110
1181
  max_fee?: BigNumberish;
1111
1182
  version?: BigNumberish;
1183
+ compiled_class_hash?: string;
1112
1184
  };
1113
1185
  type DeployTransaction = {
1114
1186
  type: 'DEPLOY';
@@ -1129,9 +1201,9 @@ declare namespace Sequencer {
1129
1201
  };
1130
1202
  type InvokeFunctionTransaction = {
1131
1203
  type: 'INVOKE_FUNCTION';
1132
- contract_address: string;
1204
+ sender_address: string;
1133
1205
  signature?: string[];
1134
- entry_point_type?: EntryPointType;
1206
+ entry_point_type?: EntryPointType.EXTERNAL;
1135
1207
  calldata?: RawCalldata;
1136
1208
  nonce: BigNumberish;
1137
1209
  max_fee?: BigNumberish;
@@ -1145,7 +1217,7 @@ declare namespace Sequencer {
1145
1217
  class_hash?: string;
1146
1218
  };
1147
1219
  type GetCodeResponse = {
1148
- bytecode: string[];
1220
+ bytecode: ByteCode;
1149
1221
  abi: Abi;
1150
1222
  };
1151
1223
  interface InvokeFunctionTransactionResponse extends InvokeFunctionTransaction {
@@ -1219,9 +1291,18 @@ declare namespace Sequencer {
1219
1291
  sequencer_address: string;
1220
1292
  starknet_version: string;
1221
1293
  };
1222
- type CallContractTransaction = Omit<InvokeFunctionTransaction, 'type' | 'entry_point_type' | 'nonce'> & {
1294
+ type CallContractTransaction = {
1295
+ calldata?: RawCalldata;
1296
+ max_fee?: BigNumberish;
1297
+ version?: BigNumberish;
1223
1298
  entry_point_selector: string;
1224
- };
1299
+ } & ({
1300
+ sender_address: string;
1301
+ signature: string[];
1302
+ } | {
1303
+ contract_address: string;
1304
+ signature?: never;
1305
+ });
1225
1306
  type CallContractResponse = {
1226
1307
  result: string[];
1227
1308
  };
@@ -1251,19 +1332,39 @@ declare namespace Sequencer {
1251
1332
  transaction_hash: string;
1252
1333
  }>;
1253
1334
  };
1335
+ type Storage = string;
1254
1336
  type StateUpdateResponse = {
1255
1337
  block_hash: string;
1256
1338
  new_root: string;
1257
1339
  old_root: string;
1258
1340
  state_diff: {
1259
- storage_diffs: Array<{
1260
- [address: string]: Array<StateDiffItem>;
1261
- }>;
1262
- declared_contract_hashes: Array<string>;
1341
+ storage_diffs: StorageDiffs;
1342
+ nonces: Nonces;
1263
1343
  deployed_contracts: Array<DeployedContractItem>;
1264
- nonces: Array<Nonces>;
1344
+ old_declared_contracts: OldDeclaredContracts;
1345
+ declared_classes: DeclaredClasses;
1346
+ replaced_classes: ReplacedClasses;
1265
1347
  };
1266
1348
  };
1349
+ type StorageDiffs = {
1350
+ [address: string]: Array<StateDiffItem>;
1351
+ };
1352
+ type StateDiffItem = {
1353
+ key: string;
1354
+ value: string;
1355
+ };
1356
+ type Nonces = {
1357
+ [address: string]: Nonce;
1358
+ };
1359
+ type Nonce = string;
1360
+ type DeployedContracts = DeployedContractItem[];
1361
+ type OldDeclaredContracts = string[];
1362
+ type DeclaredClasses = DeclaredClass[];
1363
+ type DeclaredClass = {
1364
+ class_hash: string;
1365
+ compiled_class_hash: string;
1366
+ };
1367
+ type ReplacedClasses = string[];
1267
1368
  type Endpoints = {
1268
1369
  get_contract_addresses: {
1269
1370
  QUERY: never;
@@ -1309,7 +1410,7 @@ declare namespace Sequencer {
1309
1410
  blockIdentifier: BlockIdentifier;
1310
1411
  };
1311
1412
  REQUEST: never;
1312
- RESPONSE: BigNumberish;
1413
+ RESPONSE: Nonce;
1313
1414
  };
1314
1415
  get_storage_at: {
1315
1416
  QUERY: {
@@ -1318,7 +1419,7 @@ declare namespace Sequencer {
1318
1419
  blockIdentifier: BlockIdentifier;
1319
1420
  };
1320
1421
  REQUEST: never;
1321
- RESPONSE: string;
1422
+ RESPONSE: Storage;
1322
1423
  };
1323
1424
  get_code: {
1324
1425
  QUERY: {
@@ -1345,6 +1446,7 @@ declare namespace Sequencer {
1345
1446
  estimate_fee: {
1346
1447
  QUERY: {
1347
1448
  blockIdentifier: BlockIdentifier;
1449
+ skipValidate: boolean;
1348
1450
  };
1349
1451
  REQUEST: EstimateFeeRequest;
1350
1452
  RESPONSE: EstimateFeeResponse;
@@ -1352,9 +1454,10 @@ declare namespace Sequencer {
1352
1454
  get_class_by_hash: {
1353
1455
  QUERY: {
1354
1456
  classHash: string;
1457
+ blockIdentifier?: BlockIdentifier;
1355
1458
  };
1356
1459
  REQUEST: never;
1357
- RESPONSE: any;
1460
+ RESPONSE: CompiledContract;
1358
1461
  };
1359
1462
  get_class_hash_at: {
1360
1463
  QUERY: {
@@ -1378,7 +1481,7 @@ declare namespace Sequencer {
1378
1481
  blockIdentifier?: BlockIdentifier;
1379
1482
  };
1380
1483
  REQUEST: never;
1381
- RESPONSE: any;
1484
+ RESPONSE: CompiledContract;
1382
1485
  };
1383
1486
  estimate_message_fee: {
1384
1487
  QUERY: any;
@@ -1388,6 +1491,7 @@ declare namespace Sequencer {
1388
1491
  simulate_transaction: {
1389
1492
  QUERY: {
1390
1493
  blockIdentifier: BlockIdentifier;
1494
+ skipValidate: boolean;
1391
1495
  };
1392
1496
  REQUEST: SimulateTransaction;
1393
1497
  RESPONSE: TransactionSimulationResponse;
@@ -1407,6 +1511,14 @@ declare namespace Sequencer {
1407
1511
  REQUEST: never;
1408
1512
  RESPONSE: BlockTransactionTracesResponse;
1409
1513
  };
1514
+ get_compiled_class_by_class_hash: {
1515
+ QUERY: {
1516
+ classHash: string;
1517
+ blockIdentifier?: BlockIdentifier;
1518
+ };
1519
+ REQUEST: any;
1520
+ RESPONSE: CairoAssembly;
1521
+ };
1410
1522
  };
1411
1523
  }
1412
1524
 
@@ -1429,7 +1541,7 @@ interface GetBlockResponse {
1429
1541
  transaction_receipts?: any;
1430
1542
  }
1431
1543
  interface GetCodeResponse {
1432
- bytecode: string[];
1544
+ bytecode: ByteCode;
1433
1545
  }
1434
1546
  declare type GetTransactionResponse = InvokeTransactionResponse & DeclareTransactionResponse;
1435
1547
  interface CommonTransactionResponse {
@@ -1441,6 +1553,7 @@ interface CommonTransactionResponse {
1441
1553
  }
1442
1554
  interface InvokeTransactionResponse extends CommonTransactionResponse {
1443
1555
  contract_address?: string;
1556
+ sender_address?: string;
1444
1557
  entry_point_selector?: string;
1445
1558
  calldata: RawCalldata;
1446
1559
  }
@@ -1508,6 +1621,8 @@ declare type EstimateFeeAction = {
1508
1621
  payload: UniversalDeployerContractPayload;
1509
1622
  };
1510
1623
  declare type EstimateFeeResponseBulk = Array<EstimateFeeResponse>;
1624
+ declare type Storage = Sequencer.Storage;
1625
+ declare type Nonce = Sequencer.Nonce;
1511
1626
  interface TransactionSimulationResponse {
1512
1627
  trace: TransactionTraceResponse;
1513
1628
  fee_estimation: EstimateFeeResponse;
@@ -1517,10 +1632,13 @@ interface StateUpdateResponse {
1517
1632
  new_root: string;
1518
1633
  old_root: string;
1519
1634
  state_diff: {
1520
- storage_diffs: Array<StorageDiffItem>;
1521
- declared_contract_hashes: Array<string>;
1522
- deployed_contracts: Array<DeployedContractItem>;
1523
- nonces: Array<Nonces>;
1635
+ storage_diffs: RPC.StorageDiffs;
1636
+ declared_contract_hashes?: RPC.DeclaredContractHashes;
1637
+ deployed_contracts: Sequencer.DeployedContracts;
1638
+ nonces: RPC.Nonces;
1639
+ old_declared_contracts?: Sequencer.OldDeclaredContracts;
1640
+ declared_classes?: Sequencer.DeclaredClasses;
1641
+ replaced_classes?: Sequencer.ReplacedClasses;
1524
1642
  };
1525
1643
  }
1526
1644
 
@@ -1531,6 +1649,7 @@ declare type EstimateFeeBulk = Array<EstimateFee>;
1531
1649
  interface EstimateFeeDetails {
1532
1650
  nonce?: BigNumberish;
1533
1651
  blockIdentifier?: BlockIdentifier;
1652
+ skipValidate?: boolean;
1534
1653
  }
1535
1654
  interface DeployContractResponse {
1536
1655
  contract_address: string;
@@ -1594,7 +1713,7 @@ declare abstract class ProviderInterface {
1594
1713
  * @param blockIdentifier - block identifier
1595
1714
  * @returns Contract class of compiled contract
1596
1715
  */
1597
- abstract getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass>;
1716
+ abstract getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass | RPC.ContractClass>;
1598
1717
  /**
1599
1718
  * Returns the class hash deployed under the given address.
1600
1719
  *
@@ -1609,14 +1728,14 @@ declare abstract class ProviderInterface {
1609
1728
  * @param classHash - class hash
1610
1729
  * @returns Contract class of compiled contract
1611
1730
  */
1612
- abstract getClassByHash(classHash: string): Promise<ContractClass>;
1731
+ abstract getClassByHash(classHash: string): Promise<ContractClass | RPC.ContractClass>;
1613
1732
  /**
1614
1733
  * Gets the nonce of a contract with respect to a specific block
1615
1734
  *
1616
1735
  * @param contractAddress - contract address
1617
1736
  * @returns the hex nonce
1618
1737
  */
1619
- abstract getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
1738
+ abstract getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Nonce>;
1620
1739
  /**
1621
1740
  * Gets the contract's storage variable at a specific key.
1622
1741
  *
@@ -1625,7 +1744,7 @@ declare abstract class ProviderInterface {
1625
1744
  * @param blockIdentifier - block identifier
1626
1745
  * @returns the value of the storage variable
1627
1746
  */
1628
- abstract getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
1747
+ abstract getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Storage>;
1629
1748
  /**
1630
1749
  * Gets the transaction information from a tx id.
1631
1750
  *
@@ -1688,13 +1807,14 @@ declare abstract class ProviderInterface {
1688
1807
  * - entrypoint - the entrypoint of the contract
1689
1808
  * - calldata - (defaults to []) the calldata
1690
1809
  * - signature - (defaults to []) the signature
1691
- * @param blockIdentifier - block identifier
1692
1810
  * @param details - optional details containing:
1693
1811
  * - nonce - optional nonce
1694
1812
  * - version - optional version
1813
+ * @param blockIdentifier - (optional) block identifier
1814
+ * @param skipValidate - (optional) skip cairo __validate__ method
1695
1815
  * @returns the estimated fee
1696
1816
  */
1697
- abstract getEstimateFee(invocation: Invocation, details: InvocationsDetailsWithNonce, blockIdentifier: BlockIdentifier): Promise<EstimateFeeResponse>;
1817
+ abstract getEstimateFee(invocation: Invocation, details: InvocationsDetailsWithNonce, blockIdentifier: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
1698
1818
  /**
1699
1819
  * Estimates the fee for a given INVOKE transaction
1700
1820
  *
@@ -1703,13 +1823,14 @@ declare abstract class ProviderInterface {
1703
1823
  * - entrypoint - the entrypoint of the contract
1704
1824
  * - calldata - (defaults to []) the calldata
1705
1825
  * - signature - (defaults to []) the signature
1706
- * @param blockIdentifier - block identifier
1707
1826
  * @param details - optional details containing:
1708
1827
  * - nonce - optional nonce
1709
1828
  * - version - optional version
1829
+ * @param blockIdentifier - (optional) block identifier
1830
+ * @param skipValidate - (optional) skip cairo __validate__ method
1710
1831
  * @returns the estimated fee
1711
1832
  */
1712
- abstract getInvokeEstimateFee(invocation: Invocation, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1833
+ abstract getInvokeEstimateFee(invocation: Invocation, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
1713
1834
  /**
1714
1835
  * Estimates the fee for a given DECLARE transaction
1715
1836
  *
@@ -1721,10 +1842,11 @@ declare abstract class ProviderInterface {
1721
1842
  * - nonce
1722
1843
  * - version - optional version
1723
1844
  * - optional maxFee
1724
- * @param blockIdentifier - block identifier
1845
+ * @param blockIdentifier - (optional) block identifier
1846
+ * @param skipValidate - (optional) skip cairo __validate__ method
1725
1847
  * @returns the estimated fee
1726
1848
  */
1727
- abstract getDeclareEstimateFee(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1849
+ abstract getDeclareEstimateFee(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
1728
1850
  /**
1729
1851
  * Estimates the fee for a given DEPLOY_ACCOUNT transaction
1730
1852
  *
@@ -1737,10 +1859,11 @@ declare abstract class ProviderInterface {
1737
1859
  * - nonce
1738
1860
  * - version - optional version
1739
1861
  * - optional maxFee
1740
- * @param blockIdentifier - block identifier
1862
+ * @param blockIdentifier - (optional) block identifier
1863
+ * @param skipValidate - (optional) skip cairo __validate__ method
1741
1864
  * @returns the estimated fee
1742
1865
  */
1743
- abstract getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1866
+ abstract getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
1744
1867
  /**
1745
1868
  * Estimates the fee for a list of INVOKE transaction
1746
1869
  *
@@ -1772,10 +1895,11 @@ declare abstract class ProviderInterface {
1772
1895
  * @param details - optional details containing:
1773
1896
  * - nonce - optional nonce
1774
1897
  * - version - optional version
1775
- * @param blockIdentifier - block identifier
1898
+ * @param blockIdentifier - (optional) block identifier
1899
+ * @param skipValidate - (optional) skip cairo __validate__ method
1776
1900
  * @returns the transaction trace and estimated fee
1777
1901
  */
1778
- abstract getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
1902
+ abstract getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<TransactionSimulationResponse>;
1779
1903
  /**
1780
1904
  * Gets the state changes in a specific block
1781
1905
  *
@@ -1812,7 +1936,7 @@ declare class RpcProvider implements ProviderInterface {
1812
1936
  getPendingTransactions(): Promise<RPC.PendingTransactions>;
1813
1937
  getProtocolVersion(): Promise<Error>;
1814
1938
  getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<RPC.StateUpdate>;
1815
- getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
1939
+ getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<RPC.Storage>;
1816
1940
  getTransaction(txHash: string): Promise<GetTransactionResponse>;
1817
1941
  getTransactionByHash(txHash: string): Promise<RPC.GetTransactionByHashResponse>;
1818
1942
  getTransactionByBlockIdAndIndex(blockIdentifier: BlockIdentifier, index: number): Promise<RPC.GetTransactionByBlockIdAndIndex>;
@@ -1904,20 +2028,21 @@ declare class SequencerProvider implements ProviderInterface {
1904
2028
  getChainId(): Promise<StarknetChainId>;
1905
2029
  callContract({ contractAddress, entrypoint: entryPointSelector, calldata }: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
1906
2030
  getBlock(blockIdentifier?: BlockIdentifier): Promise<GetBlockResponse>;
1907
- getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
1908
- getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
2031
+ getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Sequencer.Nonce>;
2032
+ getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Sequencer.Storage>;
1909
2033
  getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
1910
2034
  getTransactionReceipt(txHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
1911
2035
  getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass>;
1912
2036
  getClassHashAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<string>;
1913
- getClassByHash(classHash: string): Promise<ContractClass>;
2037
+ getClassByHash(classHash: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass>;
2038
+ getCompiledClassByClassHash(classHash: string, blockIdentifier?: BlockIdentifier): Promise<CairoAssembly>;
1914
2039
  invokeFunction(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<InvokeFunctionResponse>;
1915
2040
  deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
1916
- declareContract({ senderAddress, contractDefinition, signature }: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
1917
- getEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1918
- getInvokeEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1919
- getDeclareEstimateFee({ senderAddress, contractDefinition, signature }: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1920
- getDeployAccountEstimateFee({ classHash, addressSalt, constructorCalldata, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2041
+ declareContract({ senderAddress, contractDefinition, signature, compiledClassHash }: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
2042
+ getEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2043
+ getInvokeEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2044
+ getDeclareEstimateFee({ senderAddress, contractDefinition, signature, compiledClassHash }: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2045
+ getDeployAccountEstimateFee({ classHash, addressSalt, constructorCalldata, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
1921
2046
  getEstimateFeeBulk(invocations: InvocationBulk, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
1922
2047
  getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Sequencer.GetCodeResponse>;
1923
2048
  waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
@@ -1945,7 +2070,7 @@ declare class SequencerProvider implements ProviderInterface {
1945
2070
  */
1946
2071
  getTransactionTrace(txHash: BigNumberish): Promise<TransactionTraceResponse>;
1947
2072
  estimateMessageFee({ from_address, to_address, entry_point_selector, payload }: CallL1Handler, blockIdentifier?: BlockIdentifier): Promise<Sequencer.EstimateFeeResponse>;
1948
- getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
2073
+ getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<TransactionSimulationResponse>;
1949
2074
  getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<StateUpdateResponse>;
1950
2075
  getBlockTraces(blockIdentifier?: BlockIdentifier): Promise<Sequencer.BlockTransactionTracesResponse>;
1951
2076
  getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
@@ -1961,25 +2086,25 @@ declare class Provider implements ProviderInterface {
1961
2086
  constructor(providerOrOptions?: ProviderOptions | ProviderInterface);
1962
2087
  getChainId(): Promise<StarknetChainId>;
1963
2088
  getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
1964
- getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass>;
2089
+ getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClass | RPC.ContractClass>;
1965
2090
  getClassHashAt(contractAddress: string, blockIdentifier: BlockIdentifier): Promise<string>;
1966
- getClassByHash(classHash: string): Promise<ContractClass>;
2091
+ getClassByHash(classHash: string): Promise<ContractClass | RPC.ContractClass>;
1967
2092
  getEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier: BlockIdentifier): Promise<EstimateFeeResponse>;
1968
- getInvokeEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2093
+ getInvokeEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
1969
2094
  getEstimateFeeBulk(invocations: InvocationBulk, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponseBulk>;
1970
- getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
1971
- getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
2095
+ getNonceForAddress(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<Nonce>;
2096
+ getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Storage>;
1972
2097
  getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
1973
2098
  getTransactionReceipt(txHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
1974
2099
  callContract(request: Call, blockIdentifier?: BlockIdentifier): Promise<CallContractResponse>;
1975
2100
  invokeFunction(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<InvokeFunctionResponse>;
1976
2101
  deployAccountContract(payload: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
1977
2102
  declareContract(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeclareContractResponse>;
1978
- getDeclareEstimateFee(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
1979
- getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
2103
+ getDeclareEstimateFee(transaction: DeclareContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
2104
+ getDeployAccountEstimateFee(transaction: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
1980
2105
  getCode(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
1981
2106
  waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
1982
- getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<TransactionSimulationResponse>;
2107
+ getSimulateTransaction(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<TransactionSimulationResponse>;
1983
2108
  getStateUpdate(blockIdentifier?: BlockIdentifier): Promise<StateUpdateResponse>;
1984
2109
  getStarkName(address: BigNumberish, StarknetIdContract?: string): Promise<string>;
1985
2110
  getAddressFromStarkName(name: string, StarknetIdContract?: string): Promise<string>;
@@ -2197,7 +2322,7 @@ declare class Signer implements SignerInterface {
2197
2322
  signMessage(typedData: TypedData, accountAddress: string): Promise<Signature>;
2198
2323
  signTransaction(transactions: Call[], transactionsDetail: InvocationsSignerDetails, abis?: Abi[]): Promise<Signature>;
2199
2324
  signDeployAccountTransaction({ classHash, contractAddress, constructorCalldata, addressSalt, maxFee, version, chainId, nonce, }: DeployAccountSignerDetails): Promise<_noble_curves_abstract_weierstrass.SignatureType>;
2200
- signDeclareTransaction({ classHash, senderAddress, chainId, maxFee, version, nonce }: DeclareSignerDetails): Promise<_noble_curves_abstract_weierstrass.SignatureType>;
2325
+ signDeclareTransaction({ classHash, senderAddress, chainId, maxFee, version, nonce, compiledClassHash, }: DeclareSignerDetails): Promise<_noble_curves_abstract_weierstrass.SignatureType>;
2201
2326
  }
2202
2327
 
2203
2328
  declare abstract class AccountInterface extends ProviderInterface {
@@ -2281,7 +2406,9 @@ declare abstract class AccountInterface extends ProviderInterface {
2281
2406
  *
2282
2407
  * @param contractPayload transaction payload to be deployed containing:
2283
2408
  - contract: compiled contract code
2284
- - classHash: computed class hash of compiled contract
2409
+ - (optional) classHash: computed class hash of compiled contract. Pre-compute it for faster execution.
2410
+ - (required for Cairo1 without compiledClassHash) casm: CompiledContract | string;
2411
+ - (optional for Cairo1 with casm) compiledClassHash: compiled class hash from casm. Pre-compute it for faster execution.
2285
2412
  * @param transactionsDetail Invocation Details containing:
2286
2413
  - optional nonce
2287
2414
  - optional version
@@ -2447,14 +2574,14 @@ declare class Account extends Provider implements AccountInterface {
2447
2574
  constructor(providerOrOptions: ProviderOptions | ProviderInterface, address: string, pkOrSigner: Uint8Array | string | SignerInterface);
2448
2575
  getNonce(blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
2449
2576
  estimateFee(calls: AllowArray<Call>, estimateFeeDetails?: EstimateFeeDetails | undefined): Promise<EstimateFee>;
2450
- estimateInvokeFee(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
2451
- estimateDeclareFee({ contract, classHash: providedClassHash }: DeclareContractPayload, { blockIdentifier, nonce: providedNonce }?: EstimateFeeDetails): Promise<EstimateFee>;
2452
- estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
2577
+ estimateInvokeFee(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier, skipValidate }?: EstimateFeeDetails): Promise<EstimateFee>;
2578
+ estimateDeclareFee({ contract, classHash: providedClassHash, casm, compiledClassHash }: DeclareContractPayload, { blockIdentifier, nonce: providedNonce, skipValidate }?: EstimateFeeDetails): Promise<EstimateFee>;
2579
+ estimateAccountDeployFee({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { blockIdentifier, skipValidate }?: EstimateFeeDetails): Promise<EstimateFee>;
2453
2580
  estimateDeployFee(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], transactionsDetail?: InvocationsDetails | undefined): Promise<EstimateFee>;
2454
2581
  estimateFeeBulk(transactions: TransactionBulk, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFeeBulk>;
2455
2582
  buildInvocation(call: Array<Call>, signerDetails: InvocationsSignerDetails): Promise<Invocation>;
2456
2583
  execute(calls: AllowArray<Call>, abis?: Abi[] | undefined, transactionsDetail?: InvocationsDetails): Promise<InvokeFunctionResponse>;
2457
- declare({ contract, classHash: providedClassHash }: DeclareContractPayload, transactionsDetail?: InvocationsDetails): Promise<DeclareContractResponse>;
2584
+ declare(payload: DeclareContractPayload, transactionsDetail?: InvocationsDetails): Promise<DeclareContractResponse>;
2458
2585
  deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], details?: InvocationsDetails | undefined): Promise<MultiDeployContractResponse>;
2459
2586
  deployContract(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], details?: InvocationsDetails | undefined): Promise<DeployContractUDCResponse>;
2460
2587
  declareAndDeploy(payload: DeclareAndDeployContractPayload, details?: InvocationsDetails | undefined): Promise<DeclareDeployUDCResponse>;
@@ -2464,10 +2591,13 @@ declare class Account extends Provider implements AccountInterface {
2464
2591
  verifyMessageHash(hash: BigNumberish, signature: Signature): Promise<boolean>;
2465
2592
  verifyMessage(typedData: TypedData, signature: Signature): Promise<boolean>;
2466
2593
  getSuggestedMaxFee({ type, payload }: EstimateFeeAction, details: EstimateFeeDetails): Promise<string>;
2467
- buildDeclarePayload({ classHash: providedClassHash, contract }: DeclareContractPayload, { nonce, chainId, version, walletAddress, maxFee }: InvocationsSignerDetails): Promise<DeclareContractTransaction>;
2594
+ /**
2595
+ * @deprecated will be renamed to buildDeclareContractTransaction
2596
+ */
2597
+ buildDeclarePayload(payload: DeclareContractPayload, { nonce, chainId, version, walletAddress, maxFee }: InvocationsSignerDetails): Promise<DeclareContractTransaction>;
2468
2598
  buildAccountDeployPayload({ classHash, addressSalt, constructorCalldata, contractAddress: providedContractAddress, }: DeployAccountContractPayload, { nonce, chainId, version, maxFee }: InvocationsSignerDetails): Promise<DeployAccountContractTransaction>;
2469
2599
  buildUDCContractPayload(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Call[];
2470
- simulateTransaction(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<TransactionSimulation>;
2600
+ simulateTransaction(calls: AllowArray<Call>, { nonce: providedNonce, blockIdentifier, skipValidate }?: EstimateFeeDetails): Promise<TransactionSimulation>;
2471
2601
  getStarkName(address?: BigNumberish, // default to the wallet address
2472
2602
  StarknetIdContract?: string): Promise<string>;
2473
2603
  }
@@ -2476,7 +2606,7 @@ declare type CallOptions = {
2476
2606
  blockIdentifier?: BlockIdentifier;
2477
2607
  parseRequest: Boolean;
2478
2608
  parseResponse: Boolean;
2479
- formatResponse?: Object | null;
2609
+ formatResponse?: object | null;
2480
2610
  };
2481
2611
  declare abstract class ContractInterface {
2482
2612
  abstract abi: Abi;
@@ -2586,7 +2716,7 @@ declare class Contract implements ContractInterface {
2586
2716
  attach(address: string): void;
2587
2717
  connect(providerOrAccount: ProviderInterface | AccountInterface): void;
2588
2718
  deployed(): Promise<Contract>;
2589
- call(method: string, args?: Array<any>, options?: CallOptions): Promise<Object>;
2719
+ call(method: string, args?: Array<any>, options?: CallOptions): Promise<object>;
2590
2720
  invoke(method: string, args?: Array<any>, options?: Overrides): Promise<InvokeFunctionResponse>;
2591
2721
  estimate(method: string, args?: Array<any>): Promise<EstimateFeeResponse>;
2592
2722
  populate(method: string, args?: Array<any>): Call;
@@ -2624,6 +2754,7 @@ declare class ContractFactory {
2624
2754
  }
2625
2755
 
2626
2756
  declare const transactionVersion = 1n;
2757
+ declare const transactionVersion_2 = 2n;
2627
2758
  declare const feeTransactionVersion: bigint;
2628
2759
  declare function keccakBn(value: BigNumberish): string;
2629
2760
  /**
@@ -2651,14 +2782,24 @@ declare function getSelector(value: string): string;
2651
2782
  declare function computeHashOnElements(data: BigNumberish[]): string;
2652
2783
  declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
2653
2784
  declare function calculateDeployTransactionHash(contractAddress: BigNumberish, constructorCalldata: BigNumberish[], version: BigNumberish, chainId: StarknetChainId): string;
2654
- declare function calculateDeclareTransactionHash(classHash: string, senderAddress: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2785
+ declare function calculateDeclareTransactionHash(classHash: string, senderAddress: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish, compiledClassHash?: string): string;
2655
2786
  declare function calculateDeployAccountTransactionHash(contractAddress: BigNumberish, classHash: BigNumberish, constructorCalldata: BigNumberish[], salt: BigNumberish, version: BigNumberish, maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2656
2787
  declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
2657
2788
  declare function calculateContractAddressFromHash(salt: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, deployerAddress: BigNumberish): string;
2658
- declare function computeHintedClassHash(compiledContract: CompiledContract): string;
2789
+ declare function formatSpaces(json: string): string;
2790
+ declare function computeHintedClassHash(compiledContract: LegacyCompiledContract): string;
2791
+ declare function computeLegacyContractClassHash(contract: LegacyCompiledContract | string): string;
2792
+ declare function computeCompiledClassHash(casm: CompiledSierraCasm): string;
2793
+ declare function computeSierraContractClassHash(sierra: CompiledSierra): string;
2794
+ /**
2795
+ * Compute ClassHash (sierra or legacy) based on provided contract
2796
+ * @param contract CompiledContract | CompiledSierra | string
2797
+ * @returns HexString ClassHash
2798
+ */
2659
2799
  declare function computeContractClassHash(contract: CompiledContract | string): string;
2660
2800
 
2661
2801
  declare const hash_transactionVersion: typeof transactionVersion;
2802
+ declare const hash_transactionVersion_2: typeof transactionVersion_2;
2662
2803
  declare const hash_feeTransactionVersion: typeof feeTransactionVersion;
2663
2804
  declare const hash_keccakBn: typeof keccakBn;
2664
2805
  declare const hash_starknetKeccak: typeof starknetKeccak;
@@ -2671,12 +2812,17 @@ declare const hash_calculateDeclareTransactionHash: typeof calculateDeclareTrans
2671
2812
  declare const hash_calculateDeployAccountTransactionHash: typeof calculateDeployAccountTransactionHash;
2672
2813
  declare const hash_calculateTransactionHash: typeof calculateTransactionHash;
2673
2814
  declare const hash_calculateContractAddressFromHash: typeof calculateContractAddressFromHash;
2815
+ declare const hash_formatSpaces: typeof formatSpaces;
2816
+ declare const hash_computeLegacyContractClassHash: typeof computeLegacyContractClassHash;
2817
+ declare const hash_computeCompiledClassHash: typeof computeCompiledClassHash;
2818
+ declare const hash_computeSierraContractClassHash: typeof computeSierraContractClassHash;
2674
2819
  declare const hash_computeContractClassHash: typeof computeContractClassHash;
2675
2820
  declare const hash_poseidon: typeof poseidon;
2676
2821
  declare namespace hash {
2677
2822
  export {
2678
2823
  computeHintedClassHash as default,
2679
2824
  hash_transactionVersion as transactionVersion,
2825
+ hash_transactionVersion_2 as transactionVersion_2,
2680
2826
  hash_feeTransactionVersion as feeTransactionVersion,
2681
2827
  hash_keccakBn as keccakBn,
2682
2828
  hash_starknetKeccak as starknetKeccak,
@@ -2689,6 +2835,10 @@ declare namespace hash {
2689
2835
  hash_calculateDeployAccountTransactionHash as calculateDeployAccountTransactionHash,
2690
2836
  hash_calculateTransactionHash as calculateTransactionHash,
2691
2837
  hash_calculateContractAddressFromHash as calculateContractAddressFromHash,
2838
+ hash_formatSpaces as formatSpaces,
2839
+ hash_computeLegacyContractClassHash as computeLegacyContractClassHash,
2840
+ hash_computeCompiledClassHash as computeCompiledClassHash,
2841
+ hash_computeSierraContractClassHash as computeSierraContractClassHash,
2692
2842
  hash_computeContractClassHash as computeContractClassHash,
2693
2843
  hash_poseidon as poseidon,
2694
2844
  };
@@ -2921,6 +3071,51 @@ declare function validateChecksumAddress(address: string): boolean;
2921
3071
  declare function isUrl(s?: string): boolean;
2922
3072
  declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: string): string;
2923
3073
 
3074
+ declare class CallData {
3075
+ abi: Abi;
3076
+ protected readonly structs: AbiStructs;
3077
+ constructor(abi: Abi);
3078
+ /**
3079
+ * Validates if all arguments that are passed to the method are corresponding to the ones in the abi
3080
+ *
3081
+ * @param type - type of the method
3082
+ * @param method - name of the method
3083
+ * @param args - arguments that are passed to the method
3084
+ */
3085
+ validate(type: 'INVOKE' | 'CALL' | 'DEPLOY', method: string, args?: Array<any>): void;
3086
+ /**
3087
+ * Parse the calldata by using input fields from the abi for that method
3088
+ *
3089
+ * @param args - arguments passed the the method
3090
+ * @param inputs - list of inputs(fields) that are in the abi
3091
+ * @return {Calldata} - parsed arguments in format that contract is expecting
3092
+ */
3093
+ compile(args: Array<any>, inputs: AbiEntry[]): Calldata;
3094
+ /**
3095
+ * Compile contract callData without abi
3096
+ * @param data Object representing cairo method arguments or string array of compiled data
3097
+ * @returns string[]
3098
+ */
3099
+ static compile(data: object | string[]): Calldata;
3100
+ /**
3101
+ * Parse elements of the response array and structuring them into response object
3102
+ * @param method - method name
3103
+ * @param response - response from the method
3104
+ * @return - parsed response corresponding to the abi
3105
+ */
3106
+ parse(method: string, response: string[]): object;
3107
+ /**
3108
+ * Format cairo method response data to native js values based on provided format schema
3109
+ * @param method - cairo method name
3110
+ * @param response - cairo method response
3111
+ * @param format - formatter object schema
3112
+ * @returns parsed and formatted response object
3113
+ */
3114
+ format(method: string, response: string[], format: object): object;
3115
+ static abiInputsLength(inputs: AbiEntry[]): number;
3116
+ static getAbiStruct(abi: Abi): any;
3117
+ }
3118
+
2924
3119
  /**
2925
3120
  * Main
2926
3121
  */
@@ -2928,4 +3123,4 @@ declare function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: stri
2928
3123
  /** @deprecated prefer the 'num' naming */
2929
3124
  declare const number: typeof num;
2930
3125
 
2931
- export { Abi, AbiEntry, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Call, CallContractResponse, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompressedCompiledContract, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonces, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, Signature, Signer, SignerInterface, StateDiffItem, StateUpdateResponse, Status, StorageDiffItem, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, abiStructs, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
3126
+ export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, AsyncContractFunction, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, Hints, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonce, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, RPC, RawArgs, RawCalldata, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };