starknet 3.18.2 → 3.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/__tests__/account.test.ts +11 -56
- package/__tests__/contract.test.ts +11 -49
- package/__tests__/defaultProvider.test.ts +321 -0
- package/__tests__/fixtures.ts +32 -11
- package/__tests__/rpcProvider.test.ts +17 -0
- package/__tests__/sequencerProvider.test.ts +45 -0
- package/account/default.d.ts +54 -77
- package/account/default.js +271 -596
- package/account/index.js +18 -31
- package/account/interface.d.ts +66 -95
- package/account/interface.js +20 -30
- package/constants.d.ts +17 -19
- package/constants.js +2038 -2059
- package/contract/contractFactory.d.ts +25 -29
- package/contract/contractFactory.js +94 -210
- package/contract/default.d.ts +117 -146
- package/contract/default.js +582 -776
- package/contract/index.js +19 -32
- package/contract/interface.d.ts +72 -92
- package/contract/interface.js +6 -5
- package/dist/account/default.d.ts +5 -9
- package/dist/account/default.js +35 -169
- package/dist/account/interface.d.ts +3 -15
- package/dist/contract/contractFactory.js +4 -4
- package/dist/contract/default.d.ts +3 -3
- package/dist/contract/default.js +3 -2
- package/dist/contract/interface.d.ts +2 -2
- package/dist/provider/default.d.ts +18 -134
- package/dist/provider/default.js +47 -411
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.js +2 -0
- package/dist/provider/interface.d.ts +45 -50
- package/dist/provider/rpc.d.ts +57 -0
- package/dist/provider/rpc.js +364 -0
- package/dist/provider/sequencer.d.ts +66 -0
- package/dist/provider/sequencer.js +443 -0
- package/dist/types/account.d.ts +2 -3
- package/dist/types/api/index.d.ts +16 -0
- package/dist/types/api/index.js +18 -0
- package/dist/types/api/rpc.d.ts +221 -0
- package/dist/types/{api.js → api/rpc.js} +0 -0
- package/dist/types/api/sequencer.d.ts +289 -0
- package/dist/types/api/sequencer.js +2 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.js +15 -1
- package/dist/types/lib.d.ts +3 -1
- package/dist/types/provider.d.ts +86 -0
- package/dist/types/provider.js +2 -0
- package/dist/utils/provider.d.ts +4 -0
- package/dist/utils/provider.js +38 -0
- package/dist/utils/responseParser/index.d.ts +11 -0
- package/dist/utils/responseParser/index.js +9 -0
- package/dist/utils/responseParser/rpc.d.ts +13 -0
- package/dist/utils/responseParser/rpc.js +96 -0
- package/dist/utils/responseParser/sequencer.d.ts +13 -0
- package/dist/utils/responseParser/sequencer.js +124 -0
- package/index.js +42 -75
- package/package.json +1 -1
- package/provider/default.d.ts +21 -175
- package/provider/default.js +139 -704
- package/provider/errors.d.ts +4 -4
- package/provider/errors.js +30 -40
- package/provider/index.d.ts +2 -0
- package/provider/index.js +22 -33
- package/provider/interface.d.ts +104 -131
- package/provider/interface.js +6 -5
- package/provider/rpc.d.ts +57 -0
- package/provider/rpc.js +364 -0
- package/provider/sequencer.d.ts +66 -0
- package/provider/sequencer.js +443 -0
- package/provider/utils.d.ts +7 -9
- package/provider/utils.js +39 -44
- package/signer/default.d.ts +5 -9
- package/signer/default.js +72 -177
- package/signer/index.js +18 -31
- package/signer/interface.d.ts +29 -33
- package/signer/interface.js +6 -5
- package/src/account/default.ts +26 -146
- package/src/account/interface.ts +5 -20
- package/src/contract/contractFactory.ts +3 -6
- package/src/contract/default.ts +6 -4
- package/src/contract/interface.ts +2 -2
- package/src/provider/default.ts +63 -395
- package/src/provider/index.ts +2 -0
- package/src/provider/interface.ts +68 -63
- package/src/provider/rpc.ts +300 -0
- package/src/provider/sequencer.ts +384 -0
- package/src/types/account.ts +2 -3
- package/src/types/api/index.ts +17 -0
- package/src/types/api/rpc.ts +247 -0
- package/src/types/api/sequencer.ts +331 -0
- package/src/types/index.ts +3 -1
- package/src/types/lib.ts +3 -1
- package/src/types/provider.ts +108 -0
- package/src/utils/provider.ts +28 -0
- package/src/utils/responseParser/index.ts +28 -0
- package/src/utils/responseParser/rpc.ts +93 -0
- package/src/utils/responseParser/sequencer.ts +127 -0
- package/types/account.d.ts +5 -7
- package/types/account.js +2 -2
- package/types/api/index.d.ts +16 -0
- package/types/api/index.js +18 -0
- package/types/api/rpc.d.ts +221 -0
- package/types/api/rpc.js +2 -0
- package/types/api/sequencer.d.ts +289 -0
- package/types/api/sequencer.js +2 -0
- package/types/contract.d.ts +1 -1
- package/types/contract.js +2 -2
- package/types/index.d.ts +3 -1
- package/types/index.js +35 -34
- package/types/lib.d.ts +36 -41
- package/types/lib.js +2 -2
- package/types/provider.d.ts +86 -0
- package/types/provider.js +2 -0
- package/types/signer.d.ts +2 -2
- package/types/signer.js +2 -2
- package/utils/address.js +26 -37
- package/utils/ellipticCurve.d.ts +1 -6
- package/utils/ellipticCurve.js +73 -137
- package/utils/encode.js +49 -85
- package/utils/hash.d.ts +4 -31
- package/utils/hash.js +76 -141
- package/utils/json.d.ts +13 -45
- package/utils/json.js +15 -22
- package/utils/number.d.ts +2 -9
- package/utils/number.js +47 -81
- package/utils/provider.d.ts +4 -0
- package/utils/provider.js +38 -0
- package/utils/responseParser/index.d.ts +11 -0
- package/utils/responseParser/index.js +9 -0
- package/utils/responseParser/rpc.d.ts +13 -0
- package/utils/responseParser/rpc.js +96 -0
- package/utils/responseParser/sequencer.d.ts +13 -0
- package/utils/responseParser/sequencer.js +124 -0
- package/utils/shortString.js +13 -21
- package/utils/stark.d.ts +0 -1
- package/utils/stark.js +59 -93
- package/utils/transaction.d.ts +3 -6
- package/utils/transaction.js +50 -81
- package/utils/typedData/index.d.ts +3 -15
- package/utils/typedData/index.js +109 -175
- package/utils/typedData/types.d.ts +9 -9
- package/utils/typedData/types.js +2 -2
- package/utils/typedData/utils.js +6 -6
- package/utils/uint256.d.ts +5 -5
- package/utils/uint256.js +16 -26
- package/www/docs/API/account.md +3 -4
- package/www/docs/API/contract.md +2 -2
- package/www/docs/API/contractFactory.md +2 -2
- package/www/docs/API/provider.md +185 -74
- package/www/guides/account.md +1 -8
- package/www/guides/erc20.md +3 -0
- package/__tests__/provider.test.ts +0 -168
- package/dist/types/api.d.ts +0 -261
- package/src/types/api.ts +0 -303
- package/types/api.d.ts +0 -287
- package/types/api.js +0 -2
package/types/api.d.ts
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import BN from 'bn.js';
|
|
2
|
-
|
|
3
|
-
import { BlockIdentifier } from '../provider/utils';
|
|
4
|
-
import { BigNumberish } from '../utils/number';
|
|
5
|
-
import {
|
|
6
|
-
Abi,
|
|
7
|
-
BlockNumber,
|
|
8
|
-
CompressedCompiledContract,
|
|
9
|
-
EntryPointType,
|
|
10
|
-
RawCalldata,
|
|
11
|
-
Signature,
|
|
12
|
-
Status,
|
|
13
|
-
TransactionStatus,
|
|
14
|
-
} from './lib';
|
|
15
|
-
export declare type Endpoints = {
|
|
16
|
-
get_contract_addresses: {
|
|
17
|
-
QUERY: never;
|
|
18
|
-
REQUEST: never;
|
|
19
|
-
RESPONSE: GetContractAddressesResponse;
|
|
20
|
-
};
|
|
21
|
-
add_transaction: {
|
|
22
|
-
QUERY: never;
|
|
23
|
-
REQUEST: Transaction;
|
|
24
|
-
RESPONSE: AddTransactionResponse;
|
|
25
|
-
};
|
|
26
|
-
get_transaction: {
|
|
27
|
-
QUERY: {
|
|
28
|
-
transactionHash: string;
|
|
29
|
-
};
|
|
30
|
-
REQUEST: never;
|
|
31
|
-
RESPONSE: GetTransactionResponse;
|
|
32
|
-
};
|
|
33
|
-
get_transaction_status: {
|
|
34
|
-
QUERY: {
|
|
35
|
-
transactionHash: string;
|
|
36
|
-
};
|
|
37
|
-
REQUEST: never;
|
|
38
|
-
RESPONSE: GetTransactionStatusResponse;
|
|
39
|
-
};
|
|
40
|
-
get_transaction_trace: {
|
|
41
|
-
QUERY: {
|
|
42
|
-
transactionHash: string;
|
|
43
|
-
};
|
|
44
|
-
REQUEST: never;
|
|
45
|
-
RESPONSE: GetTransactionTraceResponse;
|
|
46
|
-
};
|
|
47
|
-
get_transaction_receipt: {
|
|
48
|
-
QUERY: {
|
|
49
|
-
transactionHash: string;
|
|
50
|
-
};
|
|
51
|
-
REQUEST: never;
|
|
52
|
-
RESPONSE: TransactionReceiptResponse;
|
|
53
|
-
};
|
|
54
|
-
get_storage_at: {
|
|
55
|
-
QUERY: {
|
|
56
|
-
contractAddress: string;
|
|
57
|
-
key: BigNumberish;
|
|
58
|
-
blockIdentifier: BlockIdentifier;
|
|
59
|
-
};
|
|
60
|
-
REQUEST: never;
|
|
61
|
-
RESPONSE: object;
|
|
62
|
-
};
|
|
63
|
-
get_code: {
|
|
64
|
-
QUERY: {
|
|
65
|
-
contractAddress: string;
|
|
66
|
-
blockIdentifier: BlockIdentifier;
|
|
67
|
-
};
|
|
68
|
-
REQUEST: never;
|
|
69
|
-
RESPONSE: GetCodeResponse;
|
|
70
|
-
};
|
|
71
|
-
get_block: {
|
|
72
|
-
QUERY: {
|
|
73
|
-
blockIdentifier: BlockIdentifier;
|
|
74
|
-
};
|
|
75
|
-
REQUEST: never;
|
|
76
|
-
RESPONSE: GetBlockResponse;
|
|
77
|
-
};
|
|
78
|
-
call_contract: {
|
|
79
|
-
QUERY: {
|
|
80
|
-
blockIdentifier: BlockIdentifier;
|
|
81
|
-
};
|
|
82
|
-
REQUEST: CallContractTransaction;
|
|
83
|
-
RESPONSE: CallContractResponse;
|
|
84
|
-
};
|
|
85
|
-
estimate_fee: {
|
|
86
|
-
QUERY: {
|
|
87
|
-
blockIdentifier: BlockIdentifier;
|
|
88
|
-
};
|
|
89
|
-
REQUEST: CallContractTransaction;
|
|
90
|
-
RESPONSE: EstimateFeeResponse;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
export declare type GetContractAddressesResponse = {
|
|
94
|
-
Starknet: string;
|
|
95
|
-
GpsStatementVerifier: string;
|
|
96
|
-
};
|
|
97
|
-
export declare type DeclareTransaction = {
|
|
98
|
-
type: 'DECLARE';
|
|
99
|
-
contract_class: CompressedCompiledContract;
|
|
100
|
-
nonce: BigNumberish;
|
|
101
|
-
sender_address: BigNumberish;
|
|
102
|
-
signature: Signature;
|
|
103
|
-
};
|
|
104
|
-
export declare type DeployTransaction = {
|
|
105
|
-
type: 'DEPLOY';
|
|
106
|
-
contract_definition: CompressedCompiledContract;
|
|
107
|
-
contract_address_salt: BigNumberish;
|
|
108
|
-
constructor_calldata: string[];
|
|
109
|
-
nonce?: BigNumberish;
|
|
110
|
-
};
|
|
111
|
-
export declare type InvokeFunctionTransaction = {
|
|
112
|
-
type: 'INVOKE_FUNCTION';
|
|
113
|
-
contract_address: string;
|
|
114
|
-
signature?: Signature;
|
|
115
|
-
entry_point_type?: EntryPointType;
|
|
116
|
-
entry_point_selector: string;
|
|
117
|
-
calldata?: RawCalldata;
|
|
118
|
-
nonce?: BigNumberish;
|
|
119
|
-
max_fee?: BigNumberish;
|
|
120
|
-
version?: BigNumberish;
|
|
121
|
-
};
|
|
122
|
-
export interface InvokeFunctionTransactionResponse extends InvokeFunctionTransaction {
|
|
123
|
-
transaction_hash: string;
|
|
124
|
-
}
|
|
125
|
-
export declare type InvokeFunctionTrace = {
|
|
126
|
-
caller_address: string;
|
|
127
|
-
contract_address: string;
|
|
128
|
-
code_address: string;
|
|
129
|
-
selector: string;
|
|
130
|
-
calldata: RawCalldata;
|
|
131
|
-
result: Array<any>;
|
|
132
|
-
execution_resources: ExecutionResources;
|
|
133
|
-
internal_call: Array<InvokeFunctionTrace>;
|
|
134
|
-
events: Array<any>;
|
|
135
|
-
messages: Array<any>;
|
|
136
|
-
};
|
|
137
|
-
export declare type ExecutionResources = {
|
|
138
|
-
n_steps: number;
|
|
139
|
-
builtin_instance_counter: {
|
|
140
|
-
pedersen_builtin: number;
|
|
141
|
-
range_check_builtin: number;
|
|
142
|
-
bitwise_builtin: number;
|
|
143
|
-
output_builtin: number;
|
|
144
|
-
ecdsa_builtin: number;
|
|
145
|
-
ec_op_builtin?: number;
|
|
146
|
-
};
|
|
147
|
-
n_memory_holes: number;
|
|
148
|
-
};
|
|
149
|
-
export declare type CallContractTransaction = Omit<
|
|
150
|
-
InvokeFunctionTransaction,
|
|
151
|
-
'type' | 'entry_point_type' | 'nonce'
|
|
152
|
-
>;
|
|
153
|
-
export declare type Transaction =
|
|
154
|
-
| DeclareTransaction
|
|
155
|
-
| DeployTransaction
|
|
156
|
-
| InvokeFunctionTransaction;
|
|
157
|
-
export declare type TransactionResponse =
|
|
158
|
-
| DeclareTransaction
|
|
159
|
-
| DeployTransaction
|
|
160
|
-
| InvokeFunctionTransactionResponse;
|
|
161
|
-
export declare type CallContractResponse = {
|
|
162
|
-
result: string[];
|
|
163
|
-
};
|
|
164
|
-
export declare type GetBlockResponse = {
|
|
165
|
-
block_number: number;
|
|
166
|
-
state_root: string;
|
|
167
|
-
block_hash: string;
|
|
168
|
-
transactions: {
|
|
169
|
-
[txHash: string]: TransactionResponse;
|
|
170
|
-
};
|
|
171
|
-
timestamp: number;
|
|
172
|
-
transaction_receipts: {
|
|
173
|
-
[txHash: string]: {
|
|
174
|
-
block_hash: string;
|
|
175
|
-
transaction_hash: string;
|
|
176
|
-
l2_to_l1_messages: {
|
|
177
|
-
to_address: string;
|
|
178
|
-
payload: string[];
|
|
179
|
-
from_address: string;
|
|
180
|
-
}[];
|
|
181
|
-
block_number: BlockNumber;
|
|
182
|
-
status: Status;
|
|
183
|
-
transaction_index: number;
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
parent_block_hash: string;
|
|
187
|
-
status: Status;
|
|
188
|
-
gas_price: string;
|
|
189
|
-
starknet_version?: string;
|
|
190
|
-
};
|
|
191
|
-
export declare type GetCodeResponse = {
|
|
192
|
-
bytecode: string[];
|
|
193
|
-
abi: Abi;
|
|
194
|
-
};
|
|
195
|
-
export declare type GetTransactionStatusResponse = {
|
|
196
|
-
tx_status: Status;
|
|
197
|
-
block_hash?: string;
|
|
198
|
-
tx_failure_reason?: {
|
|
199
|
-
code: string;
|
|
200
|
-
error_message: string;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
export declare type GetTransactionTraceResponse = {
|
|
204
|
-
function_invocation: {
|
|
205
|
-
caller_address: string;
|
|
206
|
-
contract_address: string;
|
|
207
|
-
code_address: string;
|
|
208
|
-
selector: string;
|
|
209
|
-
calldata: RawArgs;
|
|
210
|
-
result: Array<any>;
|
|
211
|
-
execution_resources: ExecutionResources;
|
|
212
|
-
internal_call: Array<any>;
|
|
213
|
-
events: Array<any>;
|
|
214
|
-
messages: Array<any>;
|
|
215
|
-
};
|
|
216
|
-
signature: Signature;
|
|
217
|
-
};
|
|
218
|
-
export declare type SuccessfulTransactionResponse = {
|
|
219
|
-
status: Status;
|
|
220
|
-
transaction: TransactionResponse;
|
|
221
|
-
block_hash: string;
|
|
222
|
-
block_number: BlockNumber;
|
|
223
|
-
transaction_index: number;
|
|
224
|
-
};
|
|
225
|
-
export declare type FailedTransactionResponse = {
|
|
226
|
-
status: 'REJECTED';
|
|
227
|
-
transaction_failure_reason: {
|
|
228
|
-
code: string;
|
|
229
|
-
error_message: string;
|
|
230
|
-
};
|
|
231
|
-
transaction: TransactionResponse;
|
|
232
|
-
};
|
|
233
|
-
export declare type GetTransactionResponse =
|
|
234
|
-
| SuccessfulTransactionResponse
|
|
235
|
-
| FailedTransactionResponse;
|
|
236
|
-
export declare type AddTransactionResponse = {
|
|
237
|
-
code: TransactionStatus;
|
|
238
|
-
transaction_hash: string;
|
|
239
|
-
address?: string;
|
|
240
|
-
class_hash?: string;
|
|
241
|
-
};
|
|
242
|
-
export declare type SuccessfulTransactionReceiptResponse = {
|
|
243
|
-
status: Status;
|
|
244
|
-
transaction_hash: string;
|
|
245
|
-
transaction_index: number;
|
|
246
|
-
block_hash: string;
|
|
247
|
-
block_number: BlockNumber;
|
|
248
|
-
l2_to_l1_messages: string[];
|
|
249
|
-
events: string[];
|
|
250
|
-
actual_fee: string;
|
|
251
|
-
execution_resources: ExecutionResources;
|
|
252
|
-
};
|
|
253
|
-
export declare type FailedTransactionReceiptResponse = {
|
|
254
|
-
status: 'REJECTED';
|
|
255
|
-
transaction_failure_reason: {
|
|
256
|
-
code: string;
|
|
257
|
-
error_message: string;
|
|
258
|
-
};
|
|
259
|
-
transaction_hash: string;
|
|
260
|
-
l2_to_l1_messages: string[];
|
|
261
|
-
events: string[];
|
|
262
|
-
};
|
|
263
|
-
export declare type TransactionReceiptResponse =
|
|
264
|
-
| SuccessfulTransactionReceiptResponse
|
|
265
|
-
| FailedTransactionReceiptResponse;
|
|
266
|
-
export declare type EstimateFeeResponse = {
|
|
267
|
-
overall_fee?: BN;
|
|
268
|
-
amount?: BN;
|
|
269
|
-
unit: string;
|
|
270
|
-
gas_price?: BN;
|
|
271
|
-
gas_usage?: BigNumberish;
|
|
272
|
-
};
|
|
273
|
-
export declare type RawArgs = {
|
|
274
|
-
[inputName: string]:
|
|
275
|
-
| string
|
|
276
|
-
| string[]
|
|
277
|
-
| {
|
|
278
|
-
type: 'struct';
|
|
279
|
-
[k: string]: BigNumberish;
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
export declare type Calldata = string[];
|
|
283
|
-
export declare type Overrides = {
|
|
284
|
-
maxFee?: BigNumberish;
|
|
285
|
-
nonce?: BigNumberish;
|
|
286
|
-
signature?: Signature;
|
|
287
|
-
};
|
package/types/api.js
DELETED