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
package/src/account/interface.ts
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { ProviderInterface } from '../provider';
|
|
2
|
-
import { BlockIdentifier } from '../provider/utils';
|
|
3
|
-
import { SignerInterface } from '../signer';
|
|
4
|
-
import {
|
|
5
|
-
Abi,
|
|
6
|
-
AllowArray,
|
|
7
|
-
Call,
|
|
8
|
-
DeclareContractPayload,
|
|
9
|
-
DeclareContractResponse,
|
|
10
|
-
DeclareDeployContractPayload,
|
|
11
|
-
DeclareDeployUDCResponse,
|
|
12
|
-
DeployAccountContractPayload,
|
|
13
|
-
DeployContractResponse,
|
|
14
|
-
DeployContractUDCResponse,
|
|
15
|
-
EstimateFeeAction,
|
|
16
|
-
EstimateFeeDetails,
|
|
17
|
-
EstimateFeeResponse,
|
|
18
|
-
InvocationsDetails,
|
|
19
|
-
InvokeFunctionResponse,
|
|
20
|
-
MultiDeployContractResponse,
|
|
21
|
-
Signature,
|
|
22
|
-
UniversalDeployerContractPayload,
|
|
23
|
-
} from '../types';
|
|
24
|
-
import { BigNumberish } from '../utils/number';
|
|
25
|
-
import { TypedData } from '../utils/typedData/types';
|
|
26
|
-
|
|
27
|
-
export abstract class AccountInterface extends ProviderInterface {
|
|
28
|
-
public abstract address: string;
|
|
29
|
-
|
|
30
|
-
public abstract signer: SignerInterface;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use estimateInvokeFee or estimateDeclareFee instead
|
|
34
|
-
* Estimate Fee for executing an INVOKE transaction on starknet
|
|
35
|
-
*
|
|
36
|
-
* @param calls the invocation object containing:
|
|
37
|
-
* - contractAddress - the address of the contract
|
|
38
|
-
* - entrypoint - the entrypoint of the contract
|
|
39
|
-
* - calldata - (defaults to []) the calldata
|
|
40
|
-
*
|
|
41
|
-
* @returns response from estimate_fee
|
|
42
|
-
*/
|
|
43
|
-
public abstract estimateFee(
|
|
44
|
-
calls: AllowArray<Call>,
|
|
45
|
-
estimateFeeDetails?: EstimateFeeDetails
|
|
46
|
-
): Promise<EstimateFeeResponse>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Estimate Fee for executing an INVOKE transaction on starknet
|
|
50
|
-
*
|
|
51
|
-
* @param calls the invocation object containing:
|
|
52
|
-
* - contractAddress - the address of the contract
|
|
53
|
-
* - entrypoint - the entrypoint of the contract
|
|
54
|
-
* - calldata - (defaults to []) the calldata
|
|
55
|
-
*
|
|
56
|
-
* @returns response from estimate_fee
|
|
57
|
-
*/
|
|
58
|
-
public abstract estimateInvokeFee(
|
|
59
|
-
calls: AllowArray<Call>,
|
|
60
|
-
estimateFeeDetails?: EstimateFeeDetails
|
|
61
|
-
): Promise<EstimateFeeResponse>;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Estimate Fee for executing a DECLARE transaction on starknet
|
|
65
|
-
*
|
|
66
|
-
* @param contractPayload the payload object containing:
|
|
67
|
-
* - contract - the compiled contract to be declared
|
|
68
|
-
* - classHash - the class hash of the compiled contract. This can be obtained by using starknet-cli.
|
|
69
|
-
*
|
|
70
|
-
* @returns response from estimate_fee
|
|
71
|
-
*/
|
|
72
|
-
public abstract estimateDeclareFee(
|
|
73
|
-
contractPayload: DeclareContractPayload,
|
|
74
|
-
estimateFeeDetails?: EstimateFeeDetails
|
|
75
|
-
): Promise<EstimateFeeResponse>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet
|
|
79
|
-
*
|
|
80
|
-
* @param contractPayload the payload object containing:
|
|
81
|
-
* - contract - the compiled contract to be deployed
|
|
82
|
-
* - classHash - the class hash of the compiled contract. This can be obtained by using starknet-cli.
|
|
83
|
-
*
|
|
84
|
-
* @returns response from estimate_fee
|
|
85
|
-
*/
|
|
86
|
-
public abstract estimateAccountDeployFee(
|
|
87
|
-
contractPayload: DeployAccountContractPayload,
|
|
88
|
-
estimateFeeDetails?: EstimateFeeDetails
|
|
89
|
-
): Promise<EstimateFeeResponse>;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Estimate Fee for executing a UDC DEPLOY transaction on starknet
|
|
93
|
-
* This is different from the normal DEPLOY transaction as it goes through the Universal Deployer Contract (UDC)
|
|
94
|
-
|
|
95
|
-
* @param deployContractPayload containing
|
|
96
|
-
* - classHash: computed class hash of compiled contract
|
|
97
|
-
* - salt: address salt
|
|
98
|
-
* - unique: bool if true ensure unique salt
|
|
99
|
-
* - calldata: constructor calldata
|
|
100
|
-
*
|
|
101
|
-
* @param transactionsDetail Invocation Details containing:
|
|
102
|
-
* - optional nonce
|
|
103
|
-
* - optional version
|
|
104
|
-
* - optional maxFee
|
|
105
|
-
*/
|
|
106
|
-
public abstract estimateDeployFee(
|
|
107
|
-
deployContractPayload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[],
|
|
108
|
-
transactionsDetail?: InvocationsDetails
|
|
109
|
-
): Promise<EstimateFeeResponse>;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Invoke execute function in account contract
|
|
113
|
-
*
|
|
114
|
-
* @param transactions the invocation object or an array of them, containing:
|
|
115
|
-
* - contractAddress - the address of the contract
|
|
116
|
-
* - entrypoint - the entrypoint of the contract
|
|
117
|
-
* - calldata - (defaults to []) the calldata
|
|
118
|
-
* - signature - (defaults to []) the signature
|
|
119
|
-
* @param abi (optional) the abi of the contract for better displaying
|
|
120
|
-
*
|
|
121
|
-
* @returns response from addTransaction
|
|
122
|
-
*/
|
|
123
|
-
public abstract execute(
|
|
124
|
-
transactions: AllowArray<Call>,
|
|
125
|
-
abis?: Abi[],
|
|
126
|
-
transactionsDetail?: InvocationsDetails
|
|
127
|
-
): Promise<InvokeFunctionResponse>;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Declares a given compiled contract (json) to starknet
|
|
131
|
-
*
|
|
132
|
-
* @param contractPayload transaction payload to be deployed containing:
|
|
133
|
-
- contract: compiled contract code
|
|
134
|
-
- classHash: computed class hash of compiled contract
|
|
135
|
-
* @param transactionsDetail Invocation Details containing:
|
|
136
|
-
- optional nonce
|
|
137
|
-
- optional version
|
|
138
|
-
- optional maxFee
|
|
139
|
-
* @returns a confirmation of sending a transaction on the starknet contract
|
|
140
|
-
*/
|
|
141
|
-
public abstract declare(
|
|
142
|
-
contractPayload: DeclareContractPayload,
|
|
143
|
-
transactionsDetail?: InvocationsDetails
|
|
144
|
-
): Promise<DeclareContractResponse>;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Deploys a declared contract to starknet - using Universal Deployer Contract (UDC)
|
|
148
|
-
* support multicall
|
|
149
|
-
*
|
|
150
|
-
* @param payload -
|
|
151
|
-
* - classHash: computed class hash of compiled contract
|
|
152
|
-
* - [constructorCalldata] contract constructor calldata
|
|
153
|
-
* - [salt=pseudorandom] deploy address salt
|
|
154
|
-
* - [unique=true] ensure unique salt
|
|
155
|
-
* @param details -
|
|
156
|
-
* - [nonce=getNonce]
|
|
157
|
-
* - [version=transactionVersion]
|
|
158
|
-
* - [maxFee=getSuggestedMaxFee]
|
|
159
|
-
* @returns
|
|
160
|
-
* - contract_address[]
|
|
161
|
-
* - transaction_hash
|
|
162
|
-
*/
|
|
163
|
-
public abstract deploy(
|
|
164
|
-
payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[],
|
|
165
|
-
details?: InvocationsDetails | undefined
|
|
166
|
-
): Promise<MultiDeployContractResponse>;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Simplify deploy simulating old DeployContract with same response + UDC specific response
|
|
170
|
-
* Internal wait for L2 transaction, support multicall
|
|
171
|
-
*
|
|
172
|
-
* @param payload -
|
|
173
|
-
* - classHash: computed class hash of compiled contract
|
|
174
|
-
* - [constructorCalldata] contract constructor calldata
|
|
175
|
-
* - [salt=pseudorandom] deploy address salt
|
|
176
|
-
* - [unique=true] ensure unique salt
|
|
177
|
-
* @param details -
|
|
178
|
-
* - [nonce=getNonce]
|
|
179
|
-
* - [version=transactionVersion]
|
|
180
|
-
* - [maxFee=getSuggestedMaxFee]
|
|
181
|
-
* @returns
|
|
182
|
-
* - contract_address
|
|
183
|
-
* - transaction_hash
|
|
184
|
-
* - address
|
|
185
|
-
* - deployer
|
|
186
|
-
* - unique
|
|
187
|
-
* - classHash
|
|
188
|
-
* - calldata_len
|
|
189
|
-
* - calldata
|
|
190
|
-
* - salt
|
|
191
|
-
*/
|
|
192
|
-
public abstract deployContract(
|
|
193
|
-
payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[],
|
|
194
|
-
details?: InvocationsDetails | undefined
|
|
195
|
-
): Promise<DeployContractUDCResponse>;
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Declares and Deploy a given compiled contract (json) to starknet using UDC
|
|
199
|
-
* Internal wait for L2 transaction, do not support multicall
|
|
200
|
-
*
|
|
201
|
-
* @param containing
|
|
202
|
-
* - contract: compiled contract code
|
|
203
|
-
* - classHash: computed class hash of compiled contract
|
|
204
|
-
* - [constructorCalldata] contract constructor calldata
|
|
205
|
-
* - [salt=pseudorandom] deploy address salt
|
|
206
|
-
* - [unique=true] ensure unique salt
|
|
207
|
-
* @param details
|
|
208
|
-
* - [nonce=getNonce]
|
|
209
|
-
* - [version=transactionVersion]
|
|
210
|
-
* - [maxFee=getSuggestedMaxFee]
|
|
211
|
-
* @returns
|
|
212
|
-
* - declare
|
|
213
|
-
* - transaction_hash
|
|
214
|
-
* - deploy
|
|
215
|
-
* - contract_address
|
|
216
|
-
* - transaction_hash
|
|
217
|
-
* - address
|
|
218
|
-
* - deployer
|
|
219
|
-
* - unique
|
|
220
|
-
* - classHash
|
|
221
|
-
* - calldata_len
|
|
222
|
-
* - calldata
|
|
223
|
-
* - salt
|
|
224
|
-
*/
|
|
225
|
-
public abstract declareDeploy(
|
|
226
|
-
payload: DeclareDeployContractPayload,
|
|
227
|
-
details?: InvocationsDetails | undefined
|
|
228
|
-
): Promise<DeclareDeployUDCResponse>;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Deploy the account on Starknet
|
|
232
|
-
*
|
|
233
|
-
* @param contractPayload transaction payload to be deployed containing:
|
|
234
|
-
- classHash: computed class hash of compiled contract
|
|
235
|
-
- optional constructor calldata
|
|
236
|
-
- optional address salt
|
|
237
|
-
- optional contractAddress
|
|
238
|
-
* @param transactionsDetail Invocation Details containing:
|
|
239
|
-
- optional nonce
|
|
240
|
-
- optional version
|
|
241
|
-
- optional maxFee
|
|
242
|
-
* @returns a confirmation of sending a transaction on the starknet contract
|
|
243
|
-
*/
|
|
244
|
-
public abstract deployAccount(
|
|
245
|
-
contractPayload: DeployAccountContractPayload,
|
|
246
|
-
transactionsDetail?: InvocationsDetails
|
|
247
|
-
): Promise<DeployContractResponse>;
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Sign an JSON object for off-chain usage with the starknet private key and return the signature
|
|
251
|
-
* This adds a message prefix so it cant be interchanged with transactions
|
|
252
|
-
*
|
|
253
|
-
* @param json - JSON object to be signed
|
|
254
|
-
* @returns the signature of the JSON object
|
|
255
|
-
* @throws {Error} if the JSON object is not a valid JSON
|
|
256
|
-
*/
|
|
257
|
-
public abstract signMessage(typedData: TypedData): Promise<Signature>;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Hash a JSON object with pederson hash and return the hash
|
|
261
|
-
* This adds a message prefix so it cant be interchanged with transactions
|
|
262
|
-
*
|
|
263
|
-
* @param json - JSON object to be hashed
|
|
264
|
-
* @returns the hash of the JSON object
|
|
265
|
-
* @throws {Error} if the JSON object is not a valid JSON
|
|
266
|
-
*/
|
|
267
|
-
public abstract hashMessage(typedData: TypedData): Promise<string>;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Verify a signature of a JSON object
|
|
271
|
-
*
|
|
272
|
-
* @param typedData - JSON object to be verified
|
|
273
|
-
* @param signature - signature of the JSON object
|
|
274
|
-
* @returns true if the signature is valid, false otherwise
|
|
275
|
-
* @throws {Error} if the JSON object is not a valid JSON or the signature is not a valid signature
|
|
276
|
-
*/
|
|
277
|
-
public abstract verifyMessage(typedData: TypedData, signature: Signature): Promise<boolean>;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Verify a signature of a given hash
|
|
281
|
-
* @warning This method is not recommended, use verifyMessage instead
|
|
282
|
-
*
|
|
283
|
-
* @param hash - hash to be verified
|
|
284
|
-
* @param signature - signature of the hash
|
|
285
|
-
* @returns true if the signature is valid, false otherwise
|
|
286
|
-
* @throws {Error} if the signature is not a valid signature
|
|
287
|
-
*/
|
|
288
|
-
public abstract verifyMessageHash(hash: BigNumberish, signature: Signature): Promise<boolean>;
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Gets the nonce of the account with respect to a specific block
|
|
292
|
-
*
|
|
293
|
-
* @param {BlockIdentifier} blockIdentifier - optional blockIdentifier. Defaults to 'pending'
|
|
294
|
-
* @returns nonce of the account
|
|
295
|
-
*/
|
|
296
|
-
public abstract getNonce(blockIdentifier?: BlockIdentifier): Promise<BigNumberish>;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Gets Suggested Max Fee based on the transaction type
|
|
300
|
-
*
|
|
301
|
-
* @param {EstimateFeeAction} estimateFeeAction
|
|
302
|
-
* @param {EstimateFeeDetails} details
|
|
303
|
-
* @returns suggestedMaxFee
|
|
304
|
-
*/
|
|
305
|
-
public abstract getSuggestedMaxFee(
|
|
306
|
-
estimateFeeAction: EstimateFeeAction,
|
|
307
|
-
details: EstimateFeeDetails
|
|
308
|
-
): Promise<BigNumberish>;
|
|
309
|
-
}
|