starknet 4.17.0 → 4.18.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 +20 -0
- package/README.md +2 -10
- package/dist/index.d.ts +27 -9
- package/dist/index.global.js +30 -13
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +30 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
- package/.babelrc +0 -6
- package/.commitlintrc +0 -22
- package/.eslintignore +0 -2
- package/.eslintrc +0 -28
- package/.prettierrc +0 -6
- package/.releaserc +0 -28
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -52
- package/__mocks__/Account.json +0 -25486
- package/__mocks__/ERC20.json +0 -40027
- package/__mocks__/TestDapp.json +0 -12962
- package/__mocks__/contract.json +0 -33191
- package/__mocks__/l1l2_compiled.json +0 -10107
- package/__mocks__/multicall.json +0 -8139
- package/__mocks__/naming_compiled.json +0 -53283
- package/__mocks__/starknetId_compiled.json +0 -44703
- package/__mocks__/typedDataExample.json +0 -35
- package/__mocks__/typedDataSessionExample.json +0 -42
- package/__mocks__/typedDataStructArrayExample.json +0 -44
- package/__tests__/account.test.ts +0 -345
- package/__tests__/contract.test.ts +0 -249
- package/__tests__/defaultProvider.test.ts +0 -177
- package/__tests__/fixtures.ts +0 -84
- package/__tests__/jest.setup.ts +0 -30
- package/__tests__/rpcProvider.test.ts +0 -132
- package/__tests__/sequencerProvider.test.ts +0 -123
- package/__tests__/utils/__snapshots__/ellipticalCurve.test.ts.snap +0 -5
- package/__tests__/utils/__snapshots__/utils.browser.test.ts.snap +0 -5
- package/__tests__/utils/__snapshots__/utils.test.ts.snap +0 -5
- package/__tests__/utils/address.test.ts +0 -45
- package/__tests__/utils/ellipticalCurve.test.ts +0 -91
- package/__tests__/utils/merkle.test.ts +0 -256
- package/__tests__/utils/shortString.test.ts +0 -22
- package/__tests__/utils/starknetId.test.ts +0 -53
- package/__tests__/utils/transactionHash.test.ts +0 -17
- package/__tests__/utils/typedData.test.ts +0 -223
- package/__tests__/utils/uint256.test.ts +0 -32
- package/__tests__/utils/utils.browser.test.ts +0 -29
- package/__tests__/utils/utils.test.ts +0 -141
- package/img/logo.svg +0 -17
- package/index.d.ts +0 -2683
- package/index.global.js +0 -23192
- package/index.global.js.map +0 -1
- package/index.js +0 -4910
- package/index.js.map +0 -1
- package/index.mjs +0 -4852
- package/index.mjs.map +0 -1
- package/src/account/default.ts +0 -501
- package/src/account/index.ts +0 -2
- package/src/account/interface.ts +0 -309
- package/src/constants.ts +0 -2065
- package/src/contract/contractFactory.ts +0 -88
- package/src/contract/default.ts +0 -425
- package/src/contract/index.ts +0 -3
- package/src/contract/interface.ts +0 -106
- package/src/index.ts +0 -26
- package/src/provider/default.ts +0 -187
- package/src/provider/errors.ts +0 -14
- package/src/provider/index.ts +0 -9
- package/src/provider/interface.ts +0 -281
- package/src/provider/rpc.ts +0 -482
- package/src/provider/sequencer.ts +0 -523
- package/src/provider/utils.ts +0 -100
- package/src/signer/default.ts +0 -99
- package/src/signer/index.ts +0 -2
- package/src/signer/interface.ts +0 -77
- package/src/types/account.ts +0 -43
- package/src/types/api/index.ts +0 -10
- package/src/types/api/openrpc.ts +0 -607
- package/src/types/api/rpc.ts +0 -45
- package/src/types/api/sequencer.ts +0 -369
- package/src/types/contract.ts +0 -5
- package/src/types/index.ts +0 -8
- package/src/types/lib.ts +0 -143
- package/src/types/provider.ts +0 -134
- package/src/types/signer.ts +0 -24
- package/src/utils/address.ts +0 -44
- package/src/utils/calldata.ts +0 -250
- package/src/utils/ellipticCurve.ts +0 -120
- package/src/utils/encode.ts +0 -66
- package/src/utils/events.ts +0 -32
- package/src/utils/fetchPonyfill.ts +0 -5
- package/src/utils/hash.ts +0 -235
- package/src/utils/json.ts +0 -15
- package/src/utils/merkle.ts +0 -69
- package/src/utils/number.ts +0 -98
- package/src/utils/provider.ts +0 -28
- package/src/utils/responseParser/index.ts +0 -28
- package/src/utils/responseParser/rpc.ts +0 -70
- package/src/utils/responseParser/sequencer.ts +0 -135
- package/src/utils/shortString.ts +0 -21
- package/src/utils/stark.ts +0 -57
- package/src/utils/starknetId.ts +0 -116
- package/src/utils/transaction.ts +0 -56
- package/src/utils/typedData/index.ts +0 -247
- package/src/utils/typedData/types.ts +0 -37
- package/src/utils/typedData/utils.ts +0 -16
- package/src/utils/uint256.ts +0 -32
- package/src/utils/url.ts +0 -53
- package/tsconfig.eslint.json +0 -4
- package/tsup.config.ts +0 -9
- package/www/README.md +0 -41
- package/www/babel.config.js +0 -3
- package/www/code-examples/account.js +0 -65
- package/www/code-examples/amm.js +0 -44
- package/www/code-examples/erc20.js +0 -13
- package/www/code-examples/package-lock.json +0 -336
- package/www/code-examples/package.json +0 -15
- package/www/docs/API/_category_.json +0 -5
- package/www/docs/API/account.md +0 -463
- package/www/docs/API/changelog.md +0 -15
- package/www/docs/API/contract.md +0 -135
- package/www/docs/API/contractFactory.md +0 -45
- package/www/docs/API/index.md +0 -3
- package/www/docs/API/provider.md +0 -725
- package/www/docs/API/signer.md +0 -105
- package/www/docs/API/utils.md +0 -374
- package/www/docusaurus.config.js +0 -130
- package/www/guides/account.md +0 -140
- package/www/guides/cra.md +0 -3
- package/www/guides/erc20.md +0 -163
- package/www/guides/intro.md +0 -63
- package/www/package-lock.json +0 -20405
- package/www/package.json +0 -43
- package/www/sidebars.js +0 -31
- package/www/src/components/HomepageFeatures/index.tsx +0 -67
- package/www/src/components/HomepageFeatures/styles.module.css +0 -10
- package/www/src/css/custom.css +0 -39
- package/www/src/pages/index.module.css +0 -23
- package/www/src/pages/index.tsx +0 -40
- package/www/src/pages/markdown-page.md +0 -7
- package/www/static/.nojekyll +0 -0
- package/www/static/img/docusaurus.png +0 -0
- package/www/static/img/favicon.ico +0 -0
- package/www/static/img/logo.svg +0 -17
- package/www/static/img/starknet-1.png +0 -0
- package/www/static/img/starknet-2.png +0 -0
- package/www/static/img/starknet-3.png +0 -0
- package/www/static/img/tutorial/docsVersionDropdown.png +0 -0
- package/www/static/img/tutorial/localeDropdown.png +0 -0
|
@@ -1,369 +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
|
-
ContractClass,
|
|
9
|
-
EntryPointType,
|
|
10
|
-
RawCalldata,
|
|
11
|
-
Signature,
|
|
12
|
-
Status,
|
|
13
|
-
TransactionStatus,
|
|
14
|
-
} from '../lib';
|
|
15
|
-
|
|
16
|
-
export type GetTransactionStatusResponse = {
|
|
17
|
-
tx_status: Status;
|
|
18
|
-
block_hash?: string;
|
|
19
|
-
tx_failure_reason?: {
|
|
20
|
-
code: string;
|
|
21
|
-
error_message: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type GetContractAddressesResponse = {
|
|
26
|
-
Starknet: string;
|
|
27
|
-
GpsStatementVerifier: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export type FunctionInvocation = {
|
|
31
|
-
caller_address: string;
|
|
32
|
-
contract_address: string;
|
|
33
|
-
calldata: RawCalldata;
|
|
34
|
-
call_type?: string;
|
|
35
|
-
class_hash?: string;
|
|
36
|
-
selector?: string;
|
|
37
|
-
entry_point_type?: EntryPointType;
|
|
38
|
-
result: Array<any>;
|
|
39
|
-
execution_resources: ExecutionResources;
|
|
40
|
-
internal_calls: Array<FunctionInvocation>;
|
|
41
|
-
events: Array<any>;
|
|
42
|
-
messages: Array<any>;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type ExecutionResources = {
|
|
46
|
-
n_steps: number;
|
|
47
|
-
builtin_instance_counter: {
|
|
48
|
-
pedersen_builtin: number;
|
|
49
|
-
range_check_builtin: number;
|
|
50
|
-
bitwise_builtin: number;
|
|
51
|
-
output_builtin: number;
|
|
52
|
-
ecdsa_builtin: number;
|
|
53
|
-
ec_op_builtin?: number;
|
|
54
|
-
};
|
|
55
|
-
n_memory_holes: number;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type GetTransactionTraceResponse = {
|
|
59
|
-
validate_invocation?: FunctionInvocation;
|
|
60
|
-
function_invocation?: FunctionInvocation;
|
|
61
|
-
fee_transfer_invocation?: FunctionInvocation;
|
|
62
|
-
signature: Signature;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export type CallL1Handler = {
|
|
66
|
-
from_address: string;
|
|
67
|
-
to_address: string;
|
|
68
|
-
entry_point_selector: string;
|
|
69
|
-
payload: Array<string>;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export namespace Sequencer {
|
|
73
|
-
export type DeclareTransaction = {
|
|
74
|
-
type: 'DECLARE';
|
|
75
|
-
sender_address: string;
|
|
76
|
-
contract_class: ContractClass;
|
|
77
|
-
signature?: Signature;
|
|
78
|
-
nonce: BigNumberish;
|
|
79
|
-
max_fee?: BigNumberish;
|
|
80
|
-
version?: BigNumberish;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export type DeployTransaction = {
|
|
84
|
-
type: 'DEPLOY';
|
|
85
|
-
contract_definition: ContractClass;
|
|
86
|
-
contract_address_salt: BigNumberish;
|
|
87
|
-
constructor_calldata: string[];
|
|
88
|
-
nonce?: BigNumberish;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export type DeployAccountTransaction = {
|
|
92
|
-
type: 'DEPLOY_ACCOUNT';
|
|
93
|
-
class_hash: string;
|
|
94
|
-
contract_address_salt: BigNumberish;
|
|
95
|
-
constructor_calldata: string[];
|
|
96
|
-
signature?: Signature;
|
|
97
|
-
max_fee?: BigNumberish;
|
|
98
|
-
version?: BigNumberish;
|
|
99
|
-
nonce?: BigNumberish;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export type InvokeFunctionTransaction = {
|
|
103
|
-
type: 'INVOKE_FUNCTION';
|
|
104
|
-
contract_address: string;
|
|
105
|
-
signature?: Signature;
|
|
106
|
-
entry_point_type?: EntryPointType;
|
|
107
|
-
calldata?: RawCalldata;
|
|
108
|
-
nonce: BigNumberish;
|
|
109
|
-
max_fee?: BigNumberish;
|
|
110
|
-
version?: BigNumberish;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export type Transaction =
|
|
114
|
-
| DeclareTransaction
|
|
115
|
-
| DeployTransaction
|
|
116
|
-
| InvokeFunctionTransaction
|
|
117
|
-
| DeployAccountTransaction;
|
|
118
|
-
|
|
119
|
-
export type AddTransactionResponse = {
|
|
120
|
-
transaction_hash: string;
|
|
121
|
-
code?: TransactionStatus;
|
|
122
|
-
address?: string;
|
|
123
|
-
class_hash?: string;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export type GetCodeResponse = {
|
|
127
|
-
bytecode: string[];
|
|
128
|
-
abi: Abi;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export interface InvokeFunctionTransactionResponse extends InvokeFunctionTransaction {
|
|
132
|
-
transaction_hash: string;
|
|
133
|
-
entry_point_selector: string;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export type TransactionResponse =
|
|
137
|
-
| DeclareTransaction
|
|
138
|
-
| DeployTransaction
|
|
139
|
-
| InvokeFunctionTransactionResponse;
|
|
140
|
-
|
|
141
|
-
export type SuccessfulTransactionResponse = {
|
|
142
|
-
status: Status;
|
|
143
|
-
transaction: TransactionResponse;
|
|
144
|
-
block_hash: string;
|
|
145
|
-
block_number: BlockNumber;
|
|
146
|
-
transaction_index: number;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export type FailedTransactionResponse = {
|
|
150
|
-
status: 'REJECTED';
|
|
151
|
-
transaction_failure_reason: {
|
|
152
|
-
code: string;
|
|
153
|
-
error_message: string;
|
|
154
|
-
};
|
|
155
|
-
transaction: TransactionResponse;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export type GetTransactionResponse = SuccessfulTransactionResponse | FailedTransactionResponse;
|
|
159
|
-
|
|
160
|
-
export type TransactionReceiptResponse =
|
|
161
|
-
| SuccessfulTransactionReceiptResponse
|
|
162
|
-
| FailedTransactionReceiptResponse;
|
|
163
|
-
|
|
164
|
-
export type SuccessfulTransactionReceiptResponse = {
|
|
165
|
-
status: Status;
|
|
166
|
-
transaction_hash: string;
|
|
167
|
-
transaction_index: number;
|
|
168
|
-
block_hash: string;
|
|
169
|
-
block_number: BlockNumber;
|
|
170
|
-
l2_to_l1_messages: string[];
|
|
171
|
-
events: string[];
|
|
172
|
-
actual_fee: string;
|
|
173
|
-
execution_resources: ExecutionResources;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export type FailedTransactionReceiptResponse = {
|
|
177
|
-
status: 'REJECTED';
|
|
178
|
-
transaction_failure_reason: {
|
|
179
|
-
code: string;
|
|
180
|
-
error_message: string;
|
|
181
|
-
};
|
|
182
|
-
transaction_hash: string;
|
|
183
|
-
l2_to_l1_messages: string[];
|
|
184
|
-
events: string[];
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export type GetBlockResponse = {
|
|
188
|
-
block_number: number;
|
|
189
|
-
state_root: string;
|
|
190
|
-
block_hash: string;
|
|
191
|
-
transactions: {
|
|
192
|
-
[txHash: string]: TransactionResponse;
|
|
193
|
-
};
|
|
194
|
-
timestamp: number;
|
|
195
|
-
transaction_receipts: {
|
|
196
|
-
[txHash: string]: {
|
|
197
|
-
block_hash: string;
|
|
198
|
-
transaction_hash: string;
|
|
199
|
-
l2_to_l1_messages: {
|
|
200
|
-
to_address: string;
|
|
201
|
-
payload: string[];
|
|
202
|
-
from_address: string;
|
|
203
|
-
}[];
|
|
204
|
-
block_number: BlockNumber;
|
|
205
|
-
status: Status;
|
|
206
|
-
transaction_index: number;
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
parent_block_hash: string;
|
|
210
|
-
status: Status;
|
|
211
|
-
gas_price: string;
|
|
212
|
-
sequencer_address: string;
|
|
213
|
-
starknet_version: string;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export type CallContractTransaction = Omit<
|
|
217
|
-
InvokeFunctionTransaction,
|
|
218
|
-
'type' | 'entry_point_type' | 'nonce'
|
|
219
|
-
> & { entry_point_selector: string };
|
|
220
|
-
|
|
221
|
-
export type CallContractResponse = {
|
|
222
|
-
result: string[];
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
export type InvokeEstimateFee = Omit<InvokeFunctionTransaction, 'max_fee' | 'entry_point_type'>;
|
|
226
|
-
export type DeclareEstimateFee = Omit<DeclareTransaction, 'max_fee'>;
|
|
227
|
-
export type DeployAccountEstimateFee = Omit<DeployAccountTransaction, 'max_fee'>;
|
|
228
|
-
export type DeployEstimateFee = DeployTransaction;
|
|
229
|
-
|
|
230
|
-
export type EstimateFeeRequest =
|
|
231
|
-
| InvokeEstimateFee
|
|
232
|
-
| DeclareEstimateFee
|
|
233
|
-
| DeployEstimateFee
|
|
234
|
-
| DeployAccountEstimateFee;
|
|
235
|
-
|
|
236
|
-
// Support 0.9.1 changes in a backward-compatible way
|
|
237
|
-
export type EstimateFeeResponse =
|
|
238
|
-
| {
|
|
239
|
-
overall_fee: number;
|
|
240
|
-
gas_price: number;
|
|
241
|
-
gas_usage: number;
|
|
242
|
-
}
|
|
243
|
-
| {
|
|
244
|
-
amount: BN;
|
|
245
|
-
unit: string;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export type Endpoints = {
|
|
249
|
-
get_contract_addresses: {
|
|
250
|
-
QUERY: never;
|
|
251
|
-
REQUEST: never;
|
|
252
|
-
RESPONSE: GetContractAddressesResponse;
|
|
253
|
-
};
|
|
254
|
-
add_transaction: {
|
|
255
|
-
QUERY: never;
|
|
256
|
-
REQUEST: Transaction;
|
|
257
|
-
RESPONSE: AddTransactionResponse;
|
|
258
|
-
};
|
|
259
|
-
get_transaction: {
|
|
260
|
-
QUERY: {
|
|
261
|
-
transactionHash: string;
|
|
262
|
-
};
|
|
263
|
-
REQUEST: never;
|
|
264
|
-
RESPONSE: GetTransactionResponse;
|
|
265
|
-
};
|
|
266
|
-
get_transaction_status: {
|
|
267
|
-
QUERY: {
|
|
268
|
-
transactionHash: string;
|
|
269
|
-
};
|
|
270
|
-
REQUEST: never;
|
|
271
|
-
RESPONSE: GetTransactionStatusResponse;
|
|
272
|
-
};
|
|
273
|
-
get_transaction_trace: {
|
|
274
|
-
QUERY: {
|
|
275
|
-
transactionHash: string;
|
|
276
|
-
};
|
|
277
|
-
REQUEST: never;
|
|
278
|
-
RESPONSE: GetTransactionTraceResponse;
|
|
279
|
-
};
|
|
280
|
-
get_transaction_receipt: {
|
|
281
|
-
QUERY: {
|
|
282
|
-
transactionHash: string;
|
|
283
|
-
};
|
|
284
|
-
REQUEST: never;
|
|
285
|
-
RESPONSE: TransactionReceiptResponse;
|
|
286
|
-
};
|
|
287
|
-
get_nonce: {
|
|
288
|
-
QUERY: {
|
|
289
|
-
contractAddress: string;
|
|
290
|
-
blockIdentifier: BlockIdentifier;
|
|
291
|
-
};
|
|
292
|
-
REQUEST: never;
|
|
293
|
-
RESPONSE: BigNumberish;
|
|
294
|
-
};
|
|
295
|
-
get_storage_at: {
|
|
296
|
-
QUERY: {
|
|
297
|
-
contractAddress: string;
|
|
298
|
-
key: BigNumberish;
|
|
299
|
-
blockIdentifier: BlockIdentifier;
|
|
300
|
-
};
|
|
301
|
-
REQUEST: never;
|
|
302
|
-
RESPONSE: string;
|
|
303
|
-
};
|
|
304
|
-
get_code: {
|
|
305
|
-
QUERY: {
|
|
306
|
-
contractAddress: string;
|
|
307
|
-
blockIdentifier: BlockIdentifier;
|
|
308
|
-
};
|
|
309
|
-
REQUEST: never;
|
|
310
|
-
RESPONSE: GetCodeResponse;
|
|
311
|
-
};
|
|
312
|
-
get_block: {
|
|
313
|
-
QUERY: {
|
|
314
|
-
blockIdentifier: BlockIdentifier;
|
|
315
|
-
};
|
|
316
|
-
REQUEST: never;
|
|
317
|
-
RESPONSE: GetBlockResponse;
|
|
318
|
-
};
|
|
319
|
-
call_contract: {
|
|
320
|
-
QUERY: {
|
|
321
|
-
blockIdentifier: BlockIdentifier;
|
|
322
|
-
};
|
|
323
|
-
REQUEST: CallContractTransaction;
|
|
324
|
-
RESPONSE: CallContractResponse;
|
|
325
|
-
};
|
|
326
|
-
estimate_fee: {
|
|
327
|
-
QUERY: {
|
|
328
|
-
blockIdentifier: BlockIdentifier;
|
|
329
|
-
};
|
|
330
|
-
REQUEST: EstimateFeeRequest;
|
|
331
|
-
RESPONSE: EstimateFeeResponse;
|
|
332
|
-
};
|
|
333
|
-
get_class_by_hash: {
|
|
334
|
-
QUERY: {
|
|
335
|
-
classHash: string;
|
|
336
|
-
};
|
|
337
|
-
REQUEST: never;
|
|
338
|
-
RESPONSE: any;
|
|
339
|
-
};
|
|
340
|
-
get_class_hash_at: {
|
|
341
|
-
QUERY: {
|
|
342
|
-
contractAddress: string;
|
|
343
|
-
blockIdentifier?: BlockIdentifier;
|
|
344
|
-
};
|
|
345
|
-
REQUEST: never;
|
|
346
|
-
RESPONSE: string;
|
|
347
|
-
};
|
|
348
|
-
get_state_update: {
|
|
349
|
-
QUERY: {
|
|
350
|
-
blockHash: string;
|
|
351
|
-
};
|
|
352
|
-
REQUEST: never;
|
|
353
|
-
RESPONSE: any;
|
|
354
|
-
};
|
|
355
|
-
get_full_contract: {
|
|
356
|
-
QUERY: {
|
|
357
|
-
contractAddress: string;
|
|
358
|
-
blockIdentifier?: BlockIdentifier;
|
|
359
|
-
};
|
|
360
|
-
REQUEST: never;
|
|
361
|
-
RESPONSE: any;
|
|
362
|
-
};
|
|
363
|
-
estimate_message_fee: {
|
|
364
|
-
QUERY: any;
|
|
365
|
-
REQUEST: any;
|
|
366
|
-
RESPONSE: EstimateFeeResponse;
|
|
367
|
-
};
|
|
368
|
-
};
|
|
369
|
-
}
|
package/src/types/contract.ts
DELETED
package/src/types/index.ts
DELETED
package/src/types/lib.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import type { ec as EC } from 'elliptic';
|
|
2
|
-
|
|
3
|
-
import type { BigNumberish } from '../utils/number';
|
|
4
|
-
import { RPC } from './api/rpc';
|
|
5
|
-
|
|
6
|
-
export type KeyPair = EC.KeyPair;
|
|
7
|
-
export type Signature = string[];
|
|
8
|
-
export type RawCalldata = BigNumberish[];
|
|
9
|
-
export type AllowArray<T> = T | T[];
|
|
10
|
-
export type RawArgs =
|
|
11
|
-
| {
|
|
12
|
-
[inputName: string]: string | string[] | { type: 'struct'; [k: string]: BigNumberish };
|
|
13
|
-
}
|
|
14
|
-
| string[];
|
|
15
|
-
|
|
16
|
-
export interface ContractClass {
|
|
17
|
-
program: CompressedProgram;
|
|
18
|
-
entry_points_by_type: RPC.ContractClass['entry_points_by_type'];
|
|
19
|
-
abi?: Abi;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type UniversalDeployerContractPayload = {
|
|
23
|
-
classHash: BigNumberish;
|
|
24
|
-
salt?: string;
|
|
25
|
-
unique?: boolean;
|
|
26
|
-
constructorCalldata?: RawArgs;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type DeployContractPayload = {
|
|
30
|
-
contract: CompiledContract | string;
|
|
31
|
-
constructorCalldata?: RawCalldata;
|
|
32
|
-
addressSalt?: string;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type DeployAccountContractPayload = {
|
|
36
|
-
classHash: BigNumberish;
|
|
37
|
-
constructorCalldata?: RawCalldata;
|
|
38
|
-
addressSalt?: BigNumberish;
|
|
39
|
-
contractAddress?: string;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type DeployAccountContractTransaction = Omit<
|
|
43
|
-
DeployAccountContractPayload,
|
|
44
|
-
'contractAddress'
|
|
45
|
-
> & {
|
|
46
|
-
signature?: Signature;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type DeclareContractPayload = {
|
|
50
|
-
contract: CompiledContract | string;
|
|
51
|
-
classHash: BigNumberish; // Once the classHash is included in CompiledContract, this can be removed
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type DeclareDeployContractPayload = DeclareContractPayload &
|
|
55
|
-
UniversalDeployerContractPayload;
|
|
56
|
-
|
|
57
|
-
export type DeclareContractTransaction = {
|
|
58
|
-
contractDefinition: ContractClass;
|
|
59
|
-
senderAddress: string;
|
|
60
|
-
signature?: Signature;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export type CallDetails = {
|
|
64
|
-
contractAddress: string;
|
|
65
|
-
calldata?: RawCalldata;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type Invocation = CallDetails & { signature?: Signature };
|
|
69
|
-
|
|
70
|
-
export type Call = CallDetails & { entrypoint: string };
|
|
71
|
-
|
|
72
|
-
export type InvocationsDetails = {
|
|
73
|
-
nonce?: BigNumberish;
|
|
74
|
-
maxFee?: BigNumberish;
|
|
75
|
-
version?: BigNumberish;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export type InvocationsDetailsWithNonce = InvocationsDetails & { nonce: BigNumberish };
|
|
79
|
-
|
|
80
|
-
export type Status =
|
|
81
|
-
| 'NOT_RECEIVED'
|
|
82
|
-
| 'RECEIVED'
|
|
83
|
-
| 'PENDING'
|
|
84
|
-
| 'ACCEPTED_ON_L2'
|
|
85
|
-
| 'ACCEPTED_ON_L1'
|
|
86
|
-
| 'REJECTED';
|
|
87
|
-
export type TransactionStatus = 'TRANSACTION_RECEIVED';
|
|
88
|
-
export type TransactionType = 'DECLARE' | 'DEPLOY' | 'INVOKE_FUNCTION' | 'DEPLOY_ACCOUNT';
|
|
89
|
-
export type EntryPointType = 'EXTERNAL';
|
|
90
|
-
export type CompressedProgram = string;
|
|
91
|
-
|
|
92
|
-
export type AbiEntry = { name: string; type: 'felt' | 'felt*' | string };
|
|
93
|
-
|
|
94
|
-
export type FunctionAbi = {
|
|
95
|
-
inputs: AbiEntry[];
|
|
96
|
-
name: string;
|
|
97
|
-
outputs: AbiEntry[];
|
|
98
|
-
stateMutability?: 'view';
|
|
99
|
-
type: FunctionAbiType;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
enum FunctionAbiType {
|
|
103
|
-
'function',
|
|
104
|
-
'l1_handler',
|
|
105
|
-
'constructor',
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export type StructAbi = {
|
|
109
|
-
members: (AbiEntry & { offset: number })[];
|
|
110
|
-
name: string;
|
|
111
|
-
size: number;
|
|
112
|
-
type: 'struct';
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export type Abi = Array<FunctionAbi | EventAbi | StructAbi>;
|
|
116
|
-
|
|
117
|
-
type EventAbi = any;
|
|
118
|
-
|
|
119
|
-
export type EntryPointsByType = object;
|
|
120
|
-
export type Program = Record<any, any>;
|
|
121
|
-
export type BlockTag = 'pending' | 'latest';
|
|
122
|
-
export type BlockNumber = BlockTag | null | number;
|
|
123
|
-
|
|
124
|
-
export type CompiledContract = {
|
|
125
|
-
abi: Abi;
|
|
126
|
-
entry_points_by_type: EntryPointsByType;
|
|
127
|
-
program: Program;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export type CompressedCompiledContract = Omit<CompiledContract, 'program'> & {
|
|
131
|
-
program: CompressedProgram;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export type Struct = {
|
|
135
|
-
type: 'struct';
|
|
136
|
-
[k: string]: BigNumberish;
|
|
137
|
-
};
|
|
138
|
-
export type Args = {
|
|
139
|
-
[inputName: string]: BigNumberish | BigNumberish[] | ParsedStruct | ParsedStruct[];
|
|
140
|
-
};
|
|
141
|
-
export type ParsedStruct = {
|
|
142
|
-
[key: string]: BigNumberish | ParsedStruct;
|
|
143
|
-
};
|
package/src/types/provider.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common interface response
|
|
3
|
-
* Intersection (sequencer response ∩ (∪ rpc responses))
|
|
4
|
-
*/
|
|
5
|
-
import BN from 'bn.js';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
AllowArray,
|
|
9
|
-
Call,
|
|
10
|
-
DeclareContractPayload,
|
|
11
|
-
DeployAccountContractPayload,
|
|
12
|
-
RawCalldata,
|
|
13
|
-
Signature,
|
|
14
|
-
Status,
|
|
15
|
-
UniversalDeployerContractPayload,
|
|
16
|
-
} from './lib';
|
|
17
|
-
|
|
18
|
-
export interface GetBlockResponse {
|
|
19
|
-
timestamp: number;
|
|
20
|
-
block_hash: string;
|
|
21
|
-
block_number: number;
|
|
22
|
-
new_root: string;
|
|
23
|
-
parent_hash: string;
|
|
24
|
-
status: Status;
|
|
25
|
-
transactions: Array<string>;
|
|
26
|
-
gas_price?: string;
|
|
27
|
-
sequencer_address?: string;
|
|
28
|
-
starknet_version?: string;
|
|
29
|
-
transaction_receipts?: any;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface GetCodeResponse {
|
|
33
|
-
bytecode: string[];
|
|
34
|
-
// abi: string; // is not consistent between rpc and sequencer (is it?), therefore not included in the provider interface
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type GetTransactionResponse = InvokeTransactionResponse & DeclareTransactionResponse;
|
|
38
|
-
|
|
39
|
-
export interface CommonTransactionResponse {
|
|
40
|
-
transaction_hash?: string;
|
|
41
|
-
version?: string;
|
|
42
|
-
signature?: Signature;
|
|
43
|
-
max_fee?: string;
|
|
44
|
-
nonce?: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface InvokeTransactionResponse extends CommonTransactionResponse {
|
|
48
|
-
contract_address?: string;
|
|
49
|
-
entry_point_selector?: string;
|
|
50
|
-
calldata: RawCalldata;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface ContractEntryPoint {
|
|
54
|
-
offset: string;
|
|
55
|
-
selector: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface DeclareTransactionResponse extends CommonTransactionResponse {
|
|
59
|
-
contract_class?: any;
|
|
60
|
-
sender_address?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type GetTransactionReceiptResponse =
|
|
64
|
-
| InvokeTransactionReceiptResponse
|
|
65
|
-
| DeclareTransactionReceiptResponse;
|
|
66
|
-
|
|
67
|
-
export interface CommonTransactionReceiptResponse {
|
|
68
|
-
transaction_hash: string;
|
|
69
|
-
status?: Status;
|
|
70
|
-
actual_fee?: string;
|
|
71
|
-
status_data?: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface MessageToL1 {
|
|
75
|
-
to_address: string;
|
|
76
|
-
payload: Array<string>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface Event {
|
|
80
|
-
from_address: string;
|
|
81
|
-
keys: Array<string>;
|
|
82
|
-
data: Array<string>;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface MessageToL2 {
|
|
86
|
-
from_address: string;
|
|
87
|
-
payload: Array<string>;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface InvokeTransactionReceiptResponse extends CommonTransactionReceiptResponse {
|
|
91
|
-
/** @deprecated Use l2_to_l1_messages */
|
|
92
|
-
messages_sent?: Array<MessageToL1>;
|
|
93
|
-
events?: Array<Event>;
|
|
94
|
-
l1_origin_message?: MessageToL2;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export type DeclareTransactionReceiptResponse = CommonTransactionReceiptResponse;
|
|
98
|
-
|
|
99
|
-
export interface EstimateFeeResponse {
|
|
100
|
-
overall_fee: BN;
|
|
101
|
-
gas_consumed?: BN;
|
|
102
|
-
gas_price?: BN;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface InvokeFunctionResponse {
|
|
106
|
-
transaction_hash: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface DeclareContractResponse {
|
|
110
|
-
transaction_hash: string;
|
|
111
|
-
class_hash: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export type CallContractResponse = {
|
|
115
|
-
result: Array<string>;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export type EstimateFeeAction =
|
|
119
|
-
| {
|
|
120
|
-
type: 'INVOKE';
|
|
121
|
-
payload: AllowArray<Call>;
|
|
122
|
-
}
|
|
123
|
-
| {
|
|
124
|
-
type: 'DECLARE';
|
|
125
|
-
payload: DeclareContractPayload;
|
|
126
|
-
}
|
|
127
|
-
| {
|
|
128
|
-
type: 'DEPLOY_ACCOUNT';
|
|
129
|
-
payload: DeployAccountContractPayload;
|
|
130
|
-
}
|
|
131
|
-
| {
|
|
132
|
-
type: 'DEPLOY';
|
|
133
|
-
payload: UniversalDeployerContractPayload;
|
|
134
|
-
};
|
package/src/types/signer.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { StarknetChainId } from '../constants';
|
|
2
|
-
import { BigNumberish } from '../utils/number';
|
|
3
|
-
import { DeployAccountContractPayload, InvocationsDetails } from './lib';
|
|
4
|
-
|
|
5
|
-
export interface InvocationsSignerDetails extends Required<InvocationsDetails> {
|
|
6
|
-
walletAddress: string;
|
|
7
|
-
chainId: StarknetChainId;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface DeclareSignerDetails {
|
|
11
|
-
// contractClass: ContractClass, // Should be used once class hash is present in ContractClass
|
|
12
|
-
classHash: BigNumberish;
|
|
13
|
-
senderAddress: BigNumberish;
|
|
14
|
-
chainId: StarknetChainId;
|
|
15
|
-
maxFee: BigNumberish;
|
|
16
|
-
version: BigNumberish;
|
|
17
|
-
nonce: BigNumberish;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type DeployAccountSignerDetails = Required<DeployAccountContractPayload> &
|
|
21
|
-
Required<InvocationsDetails> & {
|
|
22
|
-
contractAddress: BigNumberish;
|
|
23
|
-
chainId: StarknetChainId;
|
|
24
|
-
};
|