starknet 4.12.0 → 4.13.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.
Files changed (224) hide show
  1. package/.eslintrc +1 -0
  2. package/CHANGELOG.md +14 -0
  3. package/__tests__/account.test.ts +0 -2
  4. package/dist/index.d.ts +2683 -24
  5. package/dist/index.global.js +22994 -0
  6. package/dist/index.global.js.map +1 -0
  7. package/dist/index.js +4713 -53
  8. package/dist/index.js.map +1 -0
  9. package/dist/index.mjs +4655 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/index.d.ts +2683 -24
  12. package/index.global.js +22994 -0
  13. package/index.global.js.map +1 -0
  14. package/index.js +4713 -53
  15. package/index.js.map +1 -0
  16. package/index.mjs +4655 -0
  17. package/index.mjs.map +1 -0
  18. package/package.json +8 -2
  19. package/src/account/default.ts +43 -8
  20. package/src/account/interface.ts +25 -2
  21. package/src/constants.ts +0 -1
  22. package/src/provider/default.ts +3 -0
  23. package/src/provider/interface.ts +2 -0
  24. package/src/provider/rpc.ts +4 -4
  25. package/src/provider/sequencer.ts +4 -1
  26. package/src/types/lib.ts +1 -1
  27. package/src/types/provider.ts +5 -0
  28. package/src/utils/ellipticCurve.ts +3 -1
  29. package/src/utils/fetchPonyfill.ts +3 -2
  30. package/src/utils/hash.ts +3 -2
  31. package/src/utils/number.ts +2 -2
  32. package/tsup.config.ts +10 -0
  33. package/account/default.d.ts +0 -30
  34. package/account/default.js +0 -526
  35. package/account/index.d.ts +0 -2
  36. package/account/index.js +0 -18
  37. package/account/interface.d.ts +0 -161
  38. package/account/interface.js +0 -27
  39. package/constants.d.ts +0 -36
  40. package/constants.js +0 -2067
  41. package/contract/contractFactory.d.ts +0 -31
  42. package/contract/contractFactory.js +0 -102
  43. package/contract/default.d.ts +0 -108
  44. package/contract/default.js +0 -640
  45. package/contract/index.d.ts +0 -3
  46. package/contract/index.js +0 -19
  47. package/contract/interface.d.ts +0 -80
  48. package/contract/interface.js +0 -9
  49. package/dist/account/default.d.ts +0 -30
  50. package/dist/account/default.js +0 -526
  51. package/dist/account/index.d.ts +0 -2
  52. package/dist/account/index.js +0 -18
  53. package/dist/account/interface.d.ts +0 -161
  54. package/dist/account/interface.js +0 -27
  55. package/dist/constants.d.ts +0 -36
  56. package/dist/constants.js +0 -2067
  57. package/dist/contract/contractFactory.d.ts +0 -31
  58. package/dist/contract/contractFactory.js +0 -102
  59. package/dist/contract/default.d.ts +0 -108
  60. package/dist/contract/default.js +0 -640
  61. package/dist/contract/index.d.ts +0 -3
  62. package/dist/contract/index.js +0 -19
  63. package/dist/contract/interface.d.ts +0 -80
  64. package/dist/contract/interface.js +0 -9
  65. package/dist/provider/default.d.ts +0 -37
  66. package/dist/provider/default.js +0 -207
  67. package/dist/provider/errors.d.ts +0 -9
  68. package/dist/provider/errors.js +0 -40
  69. package/dist/provider/index.d.ts +0 -7
  70. package/dist/provider/index.js +0 -24
  71. package/dist/provider/interface.d.ts +0 -203
  72. package/dist/provider/interface.js +0 -9
  73. package/dist/provider/rpc.d.ts +0 -86
  74. package/dist/provider/rpc.js +0 -605
  75. package/dist/provider/sequencer.d.ts +0 -79
  76. package/dist/provider/sequencer.js +0 -575
  77. package/dist/provider/utils.d.ts +0 -30
  78. package/dist/provider/utils.js +0 -84
  79. package/dist/signer/default.d.ts +0 -13
  80. package/dist/signer/default.js +0 -102
  81. package/dist/signer/index.d.ts +0 -2
  82. package/dist/signer/index.js +0 -18
  83. package/dist/signer/interface.d.ts +0 -60
  84. package/dist/signer/interface.js +0 -9
  85. package/dist/types/account.d.ts +0 -11
  86. package/dist/types/account.js +0 -2
  87. package/dist/types/api/index.d.ts +0 -10
  88. package/dist/types/api/index.js +0 -18
  89. package/dist/types/api/openrpc.d.ts +0 -572
  90. package/dist/types/api/openrpc.js +0 -45
  91. package/dist/types/api/rpc.d.ts +0 -43
  92. package/dist/types/api/rpc.js +0 -2
  93. package/dist/types/api/sequencer.d.ts +0 -320
  94. package/dist/types/api/sequencer.js +0 -2
  95. package/dist/types/contract.d.ts +0 -5
  96. package/dist/types/contract.js +0 -2
  97. package/dist/types/index.d.ts +0 -7
  98. package/dist/types/index.js +0 -35
  99. package/dist/types/lib.d.ts +0 -120
  100. package/dist/types/lib.js +0 -8
  101. package/dist/types/provider.d.ts +0 -99
  102. package/dist/types/provider.js +0 -2
  103. package/dist/types/signer.d.ts +0 -19
  104. package/dist/types/signer.js +0 -2
  105. package/dist/utils/address.d.ts +0 -5
  106. package/dist/utils/address.js +0 -41
  107. package/dist/utils/ellipticCurve.d.ts +0 -29
  108. package/dist/utils/ellipticCurve.js +0 -132
  109. package/dist/utils/encode.d.ts +0 -15
  110. package/dist/utils/encode.js +0 -96
  111. package/dist/utils/fetchPonyfill.d.ts +0 -2
  112. package/dist/utils/fetchPonyfill.js +0 -6
  113. package/dist/utils/hash.d.ts +0 -37
  114. package/dist/utils/hash.js +0 -162
  115. package/dist/utils/json.d.ts +0 -16
  116. package/dist/utils/json.js +0 -19
  117. package/dist/utils/merkle.d.ts +0 -10
  118. package/dist/utils/merkle.js +0 -89
  119. package/dist/utils/number.d.ts +0 -16
  120. package/dist/utils/number.js +0 -112
  121. package/dist/utils/provider.d.ts +0 -4
  122. package/dist/utils/provider.js +0 -38
  123. package/dist/utils/responseParser/index.d.ts +0 -11
  124. package/dist/utils/responseParser/index.js +0 -9
  125. package/dist/utils/responseParser/rpc.d.ts +0 -20
  126. package/dist/utils/responseParser/rpc.js +0 -44
  127. package/dist/utils/responseParser/sequencer.d.ts +0 -17
  128. package/dist/utils/responseParser/sequencer.js +0 -99
  129. package/dist/utils/shortString.d.ts +0 -4
  130. package/dist/utils/shortString.js +0 -26
  131. package/dist/utils/stark.d.ts +0 -16
  132. package/dist/utils/stark.js +0 -91
  133. package/dist/utils/transaction.d.ts +0 -20
  134. package/dist/utils/transaction.js +0 -79
  135. package/dist/utils/typedData/index.d.ts +0 -72
  136. package/dist/utils/typedData/index.js +0 -239
  137. package/dist/utils/typedData/types.d.ts +0 -32
  138. package/dist/utils/typedData/types.js +0 -2
  139. package/dist/utils/typedData/utils.d.ts +0 -8
  140. package/dist/utils/typedData/utils.js +0 -16
  141. package/dist/utils/uint256.d.ts +0 -11
  142. package/dist/utils/uint256.js +0 -28
  143. package/dist/utils/url.d.ts +0 -7
  144. package/dist/utils/url.js +0 -49
  145. package/provider/default.d.ts +0 -37
  146. package/provider/default.js +0 -207
  147. package/provider/errors.d.ts +0 -9
  148. package/provider/errors.js +0 -40
  149. package/provider/index.d.ts +0 -7
  150. package/provider/index.js +0 -24
  151. package/provider/interface.d.ts +0 -203
  152. package/provider/interface.js +0 -9
  153. package/provider/rpc.d.ts +0 -86
  154. package/provider/rpc.js +0 -605
  155. package/provider/sequencer.d.ts +0 -79
  156. package/provider/sequencer.js +0 -575
  157. package/provider/utils.d.ts +0 -30
  158. package/provider/utils.js +0 -84
  159. package/signer/default.d.ts +0 -13
  160. package/signer/default.js +0 -102
  161. package/signer/index.d.ts +0 -2
  162. package/signer/index.js +0 -18
  163. package/signer/interface.d.ts +0 -60
  164. package/signer/interface.js +0 -9
  165. package/types/account.d.ts +0 -11
  166. package/types/account.js +0 -2
  167. package/types/api/index.d.ts +0 -10
  168. package/types/api/index.js +0 -18
  169. package/types/api/openrpc.d.ts +0 -572
  170. package/types/api/openrpc.js +0 -45
  171. package/types/api/rpc.d.ts +0 -43
  172. package/types/api/rpc.js +0 -2
  173. package/types/api/sequencer.d.ts +0 -320
  174. package/types/api/sequencer.js +0 -2
  175. package/types/contract.d.ts +0 -5
  176. package/types/contract.js +0 -2
  177. package/types/index.d.ts +0 -7
  178. package/types/index.js +0 -35
  179. package/types/lib.d.ts +0 -120
  180. package/types/lib.js +0 -8
  181. package/types/provider.d.ts +0 -99
  182. package/types/provider.js +0 -2
  183. package/types/signer.d.ts +0 -19
  184. package/types/signer.js +0 -2
  185. package/utils/address.d.ts +0 -5
  186. package/utils/address.js +0 -41
  187. package/utils/ellipticCurve.d.ts +0 -29
  188. package/utils/ellipticCurve.js +0 -132
  189. package/utils/encode.d.ts +0 -15
  190. package/utils/encode.js +0 -96
  191. package/utils/fetchPonyfill.d.ts +0 -2
  192. package/utils/fetchPonyfill.js +0 -6
  193. package/utils/hash.d.ts +0 -37
  194. package/utils/hash.js +0 -162
  195. package/utils/json.d.ts +0 -16
  196. package/utils/json.js +0 -19
  197. package/utils/merkle.d.ts +0 -10
  198. package/utils/merkle.js +0 -89
  199. package/utils/number.d.ts +0 -16
  200. package/utils/number.js +0 -112
  201. package/utils/provider.d.ts +0 -4
  202. package/utils/provider.js +0 -38
  203. package/utils/responseParser/index.d.ts +0 -11
  204. package/utils/responseParser/index.js +0 -9
  205. package/utils/responseParser/rpc.d.ts +0 -20
  206. package/utils/responseParser/rpc.js +0 -44
  207. package/utils/responseParser/sequencer.d.ts +0 -17
  208. package/utils/responseParser/sequencer.js +0 -99
  209. package/utils/shortString.d.ts +0 -4
  210. package/utils/shortString.js +0 -26
  211. package/utils/stark.d.ts +0 -16
  212. package/utils/stark.js +0 -91
  213. package/utils/transaction.d.ts +0 -20
  214. package/utils/transaction.js +0 -79
  215. package/utils/typedData/index.d.ts +0 -72
  216. package/utils/typedData/index.js +0 -239
  217. package/utils/typedData/types.d.ts +0 -32
  218. package/utils/typedData/types.js +0 -2
  219. package/utils/typedData/utils.d.ts +0 -8
  220. package/utils/typedData/utils.js +0 -16
  221. package/utils/uint256.d.ts +0 -11
  222. package/utils/uint256.js +0 -28
  223. package/utils/url.d.ts +0 -7
  224. package/utils/url.js +0 -49
@@ -1,320 +0,0 @@
1
- import BN from 'bn.js';
2
- import { BlockIdentifier } from '../../provider/utils';
3
- import { BigNumberish } from '../../utils/number';
4
- import { Abi, BlockNumber, ContractClass, EntryPointType, RawCalldata, Signature, Status, TransactionStatus } from '../lib';
5
- export declare type GetTransactionStatusResponse = {
6
- tx_status: Status;
7
- block_hash?: string;
8
- tx_failure_reason?: {
9
- code: string;
10
- error_message: string;
11
- };
12
- };
13
- export declare type GetContractAddressesResponse = {
14
- Starknet: string;
15
- GpsStatementVerifier: string;
16
- };
17
- export declare type FunctionInvocation = {
18
- caller_address: string;
19
- contract_address: string;
20
- calldata: RawCalldata;
21
- call_type?: string;
22
- class_hash?: string;
23
- selector?: string;
24
- entry_point_type?: EntryPointType;
25
- result: Array<any>;
26
- execution_resources: ExecutionResources;
27
- internal_calls: Array<FunctionInvocation>;
28
- events: Array<any>;
29
- messages: Array<any>;
30
- };
31
- export declare type ExecutionResources = {
32
- n_steps: number;
33
- builtin_instance_counter: {
34
- pedersen_builtin: number;
35
- range_check_builtin: number;
36
- bitwise_builtin: number;
37
- output_builtin: number;
38
- ecdsa_builtin: number;
39
- ec_op_builtin?: number;
40
- };
41
- n_memory_holes: number;
42
- };
43
- export declare type GetTransactionTraceResponse = {
44
- validate_invocation?: FunctionInvocation;
45
- function_invocation?: FunctionInvocation;
46
- fee_transfer_invocation?: FunctionInvocation;
47
- signature: Signature;
48
- };
49
- export declare type RawArgs = {
50
- [inputName: string]: string | string[] | {
51
- type: 'struct';
52
- [k: string]: BigNumberish;
53
- };
54
- };
55
- export declare type CallL1Handler = {
56
- from_address: string;
57
- to_address: string;
58
- entry_point_selector: string;
59
- payload: Array<string>;
60
- };
61
- export declare namespace Sequencer {
62
- type DeclareTransaction = {
63
- type: 'DECLARE';
64
- sender_address: string;
65
- contract_class: ContractClass;
66
- signature?: Signature;
67
- nonce: BigNumberish;
68
- max_fee?: BigNumberish;
69
- version?: BigNumberish;
70
- };
71
- type DeployTransaction = {
72
- type: 'DEPLOY';
73
- contract_definition: ContractClass;
74
- contract_address_salt: BigNumberish;
75
- constructor_calldata: string[];
76
- nonce?: BigNumberish;
77
- };
78
- type DeployAccountTransaction = {
79
- type: 'DEPLOY_ACCOUNT';
80
- class_hash: string;
81
- contract_address_salt: BigNumberish;
82
- constructor_calldata: string[];
83
- signature?: Signature;
84
- max_fee?: BigNumberish;
85
- version?: BigNumberish;
86
- nonce?: BigNumberish;
87
- };
88
- type InvokeFunctionTransaction = {
89
- type: 'INVOKE_FUNCTION';
90
- contract_address: string;
91
- signature?: Signature;
92
- entry_point_type?: EntryPointType;
93
- calldata?: RawCalldata;
94
- nonce: BigNumberish;
95
- max_fee?: BigNumberish;
96
- version?: BigNumberish;
97
- };
98
- type Transaction = DeclareTransaction | DeployTransaction | InvokeFunctionTransaction | DeployAccountTransaction;
99
- type AddTransactionResponse = {
100
- transaction_hash: string;
101
- code?: TransactionStatus;
102
- address?: string;
103
- class_hash?: string;
104
- };
105
- type GetCodeResponse = {
106
- bytecode: string[];
107
- abi: Abi;
108
- };
109
- interface InvokeFunctionTransactionResponse extends InvokeFunctionTransaction {
110
- transaction_hash: string;
111
- entry_point_selector: string;
112
- }
113
- type TransactionResponse = DeclareTransaction | DeployTransaction | InvokeFunctionTransactionResponse;
114
- type SuccessfulTransactionResponse = {
115
- status: Status;
116
- transaction: TransactionResponse;
117
- block_hash: string;
118
- block_number: BlockNumber;
119
- transaction_index: number;
120
- };
121
- type FailedTransactionResponse = {
122
- status: 'REJECTED';
123
- transaction_failure_reason: {
124
- code: string;
125
- error_message: string;
126
- };
127
- transaction: TransactionResponse;
128
- };
129
- type GetTransactionResponse = SuccessfulTransactionResponse | FailedTransactionResponse;
130
- type TransactionReceiptResponse = SuccessfulTransactionReceiptResponse | FailedTransactionReceiptResponse;
131
- type SuccessfulTransactionReceiptResponse = {
132
- status: Status;
133
- transaction_hash: string;
134
- transaction_index: number;
135
- block_hash: string;
136
- block_number: BlockNumber;
137
- l2_to_l1_messages: string[];
138
- events: string[];
139
- actual_fee: string;
140
- execution_resources: ExecutionResources;
141
- };
142
- type FailedTransactionReceiptResponse = {
143
- status: 'REJECTED';
144
- transaction_failure_reason: {
145
- code: string;
146
- error_message: string;
147
- };
148
- transaction_hash: string;
149
- l2_to_l1_messages: string[];
150
- events: string[];
151
- };
152
- type GetBlockResponse = {
153
- block_number: number;
154
- state_root: string;
155
- block_hash: string;
156
- transactions: {
157
- [txHash: string]: TransactionResponse;
158
- };
159
- timestamp: number;
160
- transaction_receipts: {
161
- [txHash: string]: {
162
- block_hash: string;
163
- transaction_hash: string;
164
- l2_to_l1_messages: {
165
- to_address: string;
166
- payload: string[];
167
- from_address: string;
168
- }[];
169
- block_number: BlockNumber;
170
- status: Status;
171
- transaction_index: number;
172
- };
173
- };
174
- parent_block_hash: string;
175
- status: Status;
176
- gas_price: string;
177
- sequencer_address: string;
178
- starknet_version: string;
179
- };
180
- type CallContractTransaction = Omit<InvokeFunctionTransaction, 'type' | 'entry_point_type' | 'nonce'> & {
181
- entry_point_selector: string;
182
- };
183
- type CallContractResponse = {
184
- result: string[];
185
- };
186
- type InvokeEstimateFee = Omit<InvokeFunctionTransaction, 'max_fee' | 'entry_point_type'>;
187
- type DeclareEstimateFee = Omit<DeclareTransaction, 'max_fee'>;
188
- type DeployAccountEstimateFee = Omit<DeployAccountTransaction, 'max_fee'>;
189
- type DeployEstimateFee = DeployTransaction;
190
- type EstimateFeeRequest = InvokeEstimateFee | DeclareEstimateFee | DeployEstimateFee | DeployAccountEstimateFee;
191
- type EstimateFeeResponse = {
192
- overall_fee: number;
193
- gas_price: number;
194
- gas_usage: number;
195
- } | {
196
- amount: BN;
197
- unit: string;
198
- };
199
- type Endpoints = {
200
- get_contract_addresses: {
201
- QUERY: never;
202
- REQUEST: never;
203
- RESPONSE: GetContractAddressesResponse;
204
- };
205
- add_transaction: {
206
- QUERY: never;
207
- REQUEST: Transaction;
208
- RESPONSE: AddTransactionResponse;
209
- };
210
- get_transaction: {
211
- QUERY: {
212
- transactionHash: string;
213
- };
214
- REQUEST: never;
215
- RESPONSE: GetTransactionResponse;
216
- };
217
- get_transaction_status: {
218
- QUERY: {
219
- transactionHash: string;
220
- };
221
- REQUEST: never;
222
- RESPONSE: GetTransactionStatusResponse;
223
- };
224
- get_transaction_trace: {
225
- QUERY: {
226
- transactionHash: string;
227
- };
228
- REQUEST: never;
229
- RESPONSE: GetTransactionTraceResponse;
230
- };
231
- get_transaction_receipt: {
232
- QUERY: {
233
- transactionHash: string;
234
- };
235
- REQUEST: never;
236
- RESPONSE: TransactionReceiptResponse;
237
- };
238
- get_nonce: {
239
- QUERY: {
240
- contractAddress: string;
241
- blockIdentifier: BlockIdentifier;
242
- };
243
- REQUEST: never;
244
- RESPONSE: BigNumberish;
245
- };
246
- get_storage_at: {
247
- QUERY: {
248
- contractAddress: string;
249
- key: BigNumberish;
250
- blockIdentifier: BlockIdentifier;
251
- };
252
- REQUEST: never;
253
- RESPONSE: string;
254
- };
255
- get_code: {
256
- QUERY: {
257
- contractAddress: string;
258
- blockIdentifier: BlockIdentifier;
259
- };
260
- REQUEST: never;
261
- RESPONSE: GetCodeResponse;
262
- };
263
- get_block: {
264
- QUERY: {
265
- blockIdentifier: BlockIdentifier;
266
- };
267
- REQUEST: never;
268
- RESPONSE: GetBlockResponse;
269
- };
270
- call_contract: {
271
- QUERY: {
272
- blockIdentifier: BlockIdentifier;
273
- };
274
- REQUEST: CallContractTransaction;
275
- RESPONSE: CallContractResponse;
276
- };
277
- estimate_fee: {
278
- QUERY: {
279
- blockIdentifier: BlockIdentifier;
280
- };
281
- REQUEST: EstimateFeeRequest;
282
- RESPONSE: EstimateFeeResponse;
283
- };
284
- get_class_by_hash: {
285
- QUERY: {
286
- classHash: string;
287
- };
288
- REQUEST: never;
289
- RESPONSE: any;
290
- };
291
- get_class_hash_at: {
292
- QUERY: {
293
- contractAddress: string;
294
- blockIdentifier?: BlockIdentifier;
295
- };
296
- REQUEST: never;
297
- RESPONSE: string;
298
- };
299
- get_state_update: {
300
- QUERY: {
301
- blockHash: string;
302
- };
303
- REQUEST: never;
304
- RESPONSE: any;
305
- };
306
- get_full_contract: {
307
- QUERY: {
308
- contractAddress: string;
309
- blockIdentifier?: BlockIdentifier;
310
- };
311
- REQUEST: never;
312
- RESPONSE: any;
313
- };
314
- estimate_message_fee: {
315
- QUERY: any;
316
- REQUEST: any;
317
- RESPONSE: EstimateFeeResponse;
318
- };
319
- };
320
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export declare type AsyncContractFunction<T = any> = (...args: Array<any>) => Promise<T>;
2
- export declare type ContractFunction = (...args: Array<any>) => any;
3
- export interface Result extends Array<any> {
4
- [key: string]: any;
5
- }
package/types/contract.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/types/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export * from './lib';
2
- export * as api from './api';
3
- export { Calldata, Overrides } from './api';
4
- export * from './signer';
5
- export * from './contract';
6
- export * from './account';
7
- export * from './provider';
package/types/index.js DELETED
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.api = void 0;
30
- __exportStar(require("./lib"), exports);
31
- exports.api = __importStar(require("./api"));
32
- __exportStar(require("./signer"), exports);
33
- __exportStar(require("./contract"), exports);
34
- __exportStar(require("./account"), exports);
35
- __exportStar(require("./provider"), exports);
package/types/lib.d.ts DELETED
@@ -1,120 +0,0 @@
1
- import type { ec as EC } from 'elliptic';
2
- import type { BigNumberish } from '../utils/number';
3
- import { RPC } from './api/rpc';
4
- export declare type KeyPair = EC.KeyPair;
5
- export declare type Signature = string[];
6
- export declare type RawCalldata = BigNumberish[];
7
- export declare type AllowArray<T> = T | T[];
8
- export declare type RawArgs = {
9
- [inputName: string]: string | string[] | {
10
- type: 'struct';
11
- [k: string]: BigNumberish;
12
- };
13
- } | string[];
14
- export interface ContractClass {
15
- program: CompressedProgram;
16
- entry_points_by_type: RPC.ContractClass['entry_points_by_type'];
17
- abi?: Abi;
18
- }
19
- export declare type UniversalDeployerContractPayload = {
20
- classHash: BigNumberish;
21
- salt: string;
22
- unique: boolean;
23
- constructorCalldata?: RawArgs;
24
- isDevnet?: boolean;
25
- };
26
- export declare type DeployContractPayload = {
27
- contract: CompiledContract | string;
28
- constructorCalldata?: RawCalldata;
29
- addressSalt?: string;
30
- };
31
- export declare type DeployAccountContractPayload = {
32
- classHash: BigNumberish;
33
- constructorCalldata?: RawCalldata;
34
- addressSalt?: BigNumberish;
35
- contractAddress?: string;
36
- };
37
- export declare type DeployAccountContractTransaction = Omit<DeployAccountContractPayload, 'contractAddress'> & {
38
- signature?: Signature;
39
- };
40
- export declare type DeclareContractPayload = {
41
- contract: CompiledContract | string;
42
- classHash: BigNumberish;
43
- };
44
- export declare type DeclareContractTransaction = {
45
- contractDefinition: ContractClass;
46
- senderAddress: string;
47
- signature?: Signature;
48
- };
49
- export declare type CallDetails = {
50
- contractAddress: string;
51
- calldata?: RawCalldata;
52
- };
53
- export declare type Invocation = CallDetails & {
54
- signature?: Signature;
55
- };
56
- export declare type Call = CallDetails & {
57
- entrypoint: string;
58
- };
59
- export declare type InvocationsDetails = {
60
- nonce?: BigNumberish;
61
- maxFee?: BigNumberish;
62
- version?: BigNumberish;
63
- };
64
- export declare type InvocationsDetailsWithNonce = InvocationsDetails & {
65
- nonce: BigNumberish;
66
- };
67
- export declare type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
68
- export declare type TransactionStatus = 'TRANSACTION_RECEIVED';
69
- export declare type TransactionType = 'DECLARE' | 'DEPLOY' | 'INVOKE_FUNCTION' | 'DEPLOY_ACCOUNT';
70
- export declare type EntryPointType = 'EXTERNAL';
71
- export declare type CompressedProgram = string;
72
- export declare type AbiEntry = {
73
- name: string;
74
- type: 'felt' | 'felt*' | string;
75
- };
76
- export declare type FunctionAbi = {
77
- inputs: AbiEntry[];
78
- name: string;
79
- outputs: AbiEntry[];
80
- stateMutability?: 'view';
81
- type: FunctionAbiType;
82
- };
83
- declare enum FunctionAbiType {
84
- 'function' = 0,
85
- 'l1_handler' = 1,
86
- 'constructor' = 2
87
- }
88
- export declare type StructAbi = {
89
- members: (AbiEntry & {
90
- offset: number;
91
- })[];
92
- name: string;
93
- size: number;
94
- type: 'struct';
95
- };
96
- export declare type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
97
- declare type EventAbi = any;
98
- export declare type EntryPointsByType = object;
99
- export declare type Program = Record<any, any>;
100
- export declare type BlockTag = 'pending' | 'latest';
101
- export declare type BlockNumber = BlockTag | null | number;
102
- export declare type CompiledContract = {
103
- abi: Abi;
104
- entry_points_by_type: EntryPointsByType;
105
- program: Program;
106
- };
107
- export declare type CompressedCompiledContract = Omit<CompiledContract, 'program'> & {
108
- program: CompressedProgram;
109
- };
110
- export declare type Struct = {
111
- type: 'struct';
112
- [k: string]: BigNumberish;
113
- };
114
- export declare type Args = {
115
- [inputName: string]: BigNumberish | BigNumberish[] | ParsedStruct | ParsedStruct[];
116
- };
117
- export declare type ParsedStruct = {
118
- [key: string]: BigNumberish | ParsedStruct;
119
- };
120
- export {};
package/types/lib.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var FunctionAbiType;
4
- (function (FunctionAbiType) {
5
- FunctionAbiType[FunctionAbiType["function"] = 0] = "function";
6
- FunctionAbiType[FunctionAbiType["l1_handler"] = 1] = "l1_handler";
7
- FunctionAbiType[FunctionAbiType["constructor"] = 2] = "constructor";
8
- })(FunctionAbiType || (FunctionAbiType = {}));
@@ -1,99 +0,0 @@
1
- /**
2
- * Common interface response
3
- * Intersection (sequencer response ∩ (∪ rpc responses))
4
- */
5
- import BN from 'bn.js';
6
- import { AllowArray, Call, DeclareContractPayload, DeployAccountContractPayload, RawCalldata, Signature, Status } from './lib';
7
- export interface GetBlockResponse {
8
- timestamp: number;
9
- block_hash: string;
10
- block_number: number;
11
- new_root: string;
12
- parent_hash: string;
13
- status: Status;
14
- transactions: Array<string>;
15
- gas_price?: string;
16
- sequencer_address?: string;
17
- starknet_version?: string;
18
- transaction_receipts?: any;
19
- }
20
- export interface GetCodeResponse {
21
- bytecode: string[];
22
- }
23
- export declare type GetTransactionResponse = InvokeTransactionResponse & DeclareTransactionResponse;
24
- export interface CommonTransactionResponse {
25
- transaction_hash?: string;
26
- version?: string;
27
- signature?: Signature;
28
- max_fee?: string;
29
- nonce?: string;
30
- }
31
- export interface InvokeTransactionResponse extends CommonTransactionResponse {
32
- contract_address?: string;
33
- entry_point_selector?: string;
34
- calldata: RawCalldata;
35
- }
36
- export interface ContractEntryPoint {
37
- offset: string;
38
- selector: string;
39
- }
40
- export interface DeclareTransactionResponse extends CommonTransactionResponse {
41
- contract_class?: any;
42
- sender_address?: string;
43
- }
44
- export declare type GetTransactionReceiptResponse = InvokeTransactionReceiptResponse | DeclareTransactionReceiptResponse;
45
- export interface CommonTransactionReceiptResponse {
46
- transaction_hash: string;
47
- status?: Status;
48
- actual_fee?: string;
49
- status_data?: string;
50
- }
51
- export interface MessageToL1 {
52
- to_address: string;
53
- payload: Array<string>;
54
- }
55
- export interface Event {
56
- from_address: string;
57
- keys: Array<string>;
58
- data: Array<string>;
59
- }
60
- export interface MessageToL2 {
61
- from_address: string;
62
- payload: Array<string>;
63
- }
64
- export interface InvokeTransactionReceiptResponse extends CommonTransactionReceiptResponse {
65
- /** @deprecated Use l2_to_l1_messages */
66
- messages_sent?: Array<MessageToL1>;
67
- events?: Array<Event>;
68
- l1_origin_message?: MessageToL2;
69
- }
70
- export declare type DeclareTransactionReceiptResponse = CommonTransactionReceiptResponse;
71
- export interface EstimateFeeResponse {
72
- overall_fee: BN;
73
- gas_consumed?: BN;
74
- gas_price?: BN;
75
- }
76
- export interface InvokeFunctionResponse {
77
- transaction_hash: string;
78
- }
79
- export interface DeployContractResponse {
80
- contract_address: string;
81
- transaction_hash: string;
82
- }
83
- export interface DeclareContractResponse {
84
- transaction_hash: string;
85
- class_hash: string;
86
- }
87
- export declare type CallContractResponse = {
88
- result: Array<string>;
89
- };
90
- export declare type EstimateFeeAction = {
91
- type: 'INVOKE';
92
- payload: AllowArray<Call>;
93
- } | {
94
- type: 'DECLARE';
95
- payload: DeclareContractPayload;
96
- } | {
97
- type: 'DEPLOY_ACCOUNT';
98
- payload: DeployAccountContractPayload;
99
- };
package/types/provider.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/types/signer.d.ts DELETED
@@ -1,19 +0,0 @@
1
- import { StarknetChainId } from '../constants';
2
- import { BigNumberish } from '../utils/number';
3
- import { DeployAccountContractPayload, InvocationsDetails } from './lib';
4
- export interface InvocationsSignerDetails extends Required<InvocationsDetails> {
5
- walletAddress: string;
6
- chainId: StarknetChainId;
7
- }
8
- export interface DeclareSignerDetails {
9
- classHash: BigNumberish;
10
- senderAddress: BigNumberish;
11
- chainId: StarknetChainId;
12
- maxFee: BigNumberish;
13
- version: BigNumberish;
14
- nonce: BigNumberish;
15
- }
16
- export declare type DeployAccountSignerDetails = Required<DeployAccountContractPayload> & Required<InvocationsDetails> & {
17
- contractAddress: BigNumberish;
18
- chainId: StarknetChainId;
19
- };
package/types/signer.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- import { BigNumberish } from './number';
2
- export declare function addAddressPadding(address: BigNumberish): string;
3
- export declare function validateAndParseAddress(address: BigNumberish): string;
4
- export declare function getChecksumAddress(address: BigNumberish): string;
5
- export declare function validateChecksumAddress(address: string): boolean;
package/utils/address.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateChecksumAddress = exports.getChecksumAddress = exports.validateAndParseAddress = exports.addAddressPadding = void 0;
4
- /* eslint-disable no-bitwise */
5
- var bytes_1 = require("@ethersproject/bytes");
6
- var constants_1 = require("../constants");
7
- var encode_1 = require("./encode");
8
- var hash_1 = require("./hash");
9
- var number_1 = require("./number");
10
- function addAddressPadding(address) {
11
- return (0, encode_1.addHexPrefix)((0, encode_1.removeHexPrefix)((0, number_1.toHex)((0, number_1.toBN)(address))).padStart(64, '0'));
12
- }
13
- exports.addAddressPadding = addAddressPadding;
14
- function validateAndParseAddress(address) {
15
- (0, number_1.assertInRange)(address, constants_1.ZERO, constants_1.MASK_251, 'Starknet Address');
16
- var result = addAddressPadding(address);
17
- if (!result.match(/^(0x)?[0-9a-fA-F]{64}$/)) {
18
- throw new Error('Invalid Address Format');
19
- }
20
- return result;
21
- }
22
- exports.validateAndParseAddress = validateAndParseAddress;
23
- // from https://github.com/ethers-io/ethers.js/blob/fc1e006575d59792fa97b4efb9ea2f8cca1944cf/packages/address/src.ts/index.ts#L12
24
- function getChecksumAddress(address) {
25
- var chars = (0, encode_1.removeHexPrefix)(validateAndParseAddress(address)).toLowerCase().split('');
26
- var hashed = (0, bytes_1.arrayify)((0, hash_1.keccakBn)(address), { hexPad: 'left' }); // in case the hash is 251 bits (63 chars) we need to pad it to 64 chars without changing the number value ("left")
27
- for (var i = 0; i < chars.length; i += 2) {
28
- if (hashed[i >> 1] >> 4 >= 8) {
29
- chars[i] = chars[i].toUpperCase();
30
- }
31
- if ((hashed[i >> 1] & 0x0f) >= 8) {
32
- chars[i + 1] = chars[i + 1].toUpperCase();
33
- }
34
- }
35
- return (0, encode_1.addHexPrefix)(chars.join(''));
36
- }
37
- exports.getChecksumAddress = getChecksumAddress;
38
- function validateChecksumAddress(address) {
39
- return getChecksumAddress(address) === address;
40
- }
41
- exports.validateChecksumAddress = validateChecksumAddress;