starknet 6.4.2 → 6.6.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 +26 -0
- package/dist/index.d.ts +468 -4
- package/dist/index.global.js +280 -50
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +296 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# [6.6.0](https://github.com/starknet-io/starknet.js/compare/v6.5.0...v6.6.0) (2024-03-19)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- second option bump semantic release to 0.5 ([c90f9b2](https://github.com/starknet-io/starknet.js/commit/c90f9b285afb455d2404bff67137d5e6ae44cd5f))
|
|
6
|
+
- test ci fix ([3a6c924](https://github.com/starknet-io/starknet.js/commit/3a6c9247717cb979842d9b37905ae423267959a5))
|
|
7
|
+
- update to latest get-starknet dev ([017702f](https://github.com/starknet-io/starknet.js/commit/017702fd8c579ab62c98bc78fd6e8dd3022ef9ec))
|
|
8
|
+
- wallet circular dependency fix ([621ae2d](https://github.com/starknet-io/starknet.js/commit/621ae2d4a015f3bb3b2e63ddbaeb5fa843509a88))
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
- get-starknet-core repacked for mjs, and initial implementation ([ab7fa19](https://github.com/starknet-io/starknet.js/commit/ab7fa19f44ad1fc27292313589247b74943fe3d0))
|
|
13
|
+
- the WalletAccount handle changed channel ([73603e1](https://github.com/starknet-io/starknet.js/commit/73603e175bcc7925aa896be81fb666ffb225890d))
|
|
14
|
+
- wallet deploy contract and patches ([dbf53b6](https://github.com/starknet-io/starknet.js/commit/dbf53b6e57948e433186cae6209998dece04fe4a))
|
|
15
|
+
- walletAccount extract methods and update new ones ([0dfb5db](https://github.com/starknet-io/starknet.js/commit/0dfb5db1032dd7c946ee514647e8abb3eda87996))
|
|
16
|
+
|
|
17
|
+
# [6.5.0](https://github.com/starknet-io/starknet.js/compare/v6.4.2...v6.5.0) (2024-03-14)
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- adjust max amount bound calculation for RPC v0.7.0 ([dd34cdb](https://github.com/starknet-io/starknet.js/commit/dd34cdb8b9817a55a16a97d960b1544d75c0059a))
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
- make fee margins configurable ([cedd984](https://github.com/starknet-io/starknet.js/commit/cedd984e1106db5b73d17630e282eb956d344a97))
|
|
26
|
+
|
|
1
27
|
## [6.4.2](https://github.com/starknet-io/starknet.js/compare/v6.4.1...v6.4.2) (2024-03-14)
|
|
2
28
|
|
|
3
29
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,320 @@ import * as poseidon from '@noble/curves/abstract/poseidon';
|
|
|
5
5
|
import * as json$1 from 'lossless-json';
|
|
6
6
|
import * as starknet from '@scure/starknet';
|
|
7
7
|
|
|
8
|
+
declare enum StarknetChainId$1 {
|
|
9
|
+
SN_MAIN = "0x534e5f4d41494e",
|
|
10
|
+
SN_GOERLI = "0x534e5f474f45524c49",
|
|
11
|
+
SN_SEPOLIA = "0x534e5f5345504f4c4941"
|
|
12
|
+
}
|
|
13
|
+
declare enum Permission {
|
|
14
|
+
Accounts = "accounts"
|
|
15
|
+
}
|
|
16
|
+
type FELT$3 = string;
|
|
17
|
+
type Call$1 = {
|
|
18
|
+
contract_address: FELT$3;
|
|
19
|
+
entrypoint: string;
|
|
20
|
+
calldata?: FELT$3[];
|
|
21
|
+
};
|
|
22
|
+
type SIERRA_ENTRY_POINT$2 = {
|
|
23
|
+
selector: FELT$3;
|
|
24
|
+
function_idx: number;
|
|
25
|
+
};
|
|
26
|
+
type StarknetMerkleType = {
|
|
27
|
+
name: string;
|
|
28
|
+
type: 'merkletree';
|
|
29
|
+
contains: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types.
|
|
33
|
+
*
|
|
34
|
+
* Note that the `uint` and `int` aliases like in Solidity, and fixed point numbers are not supported by the EIP-712
|
|
35
|
+
* standard.
|
|
36
|
+
*/
|
|
37
|
+
type StarknetType = {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
} | StarknetMerkleType;
|
|
41
|
+
/**
|
|
42
|
+
* The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field.
|
|
43
|
+
*/
|
|
44
|
+
interface StarknetDomain extends Record<string, unknown> {
|
|
45
|
+
name?: string;
|
|
46
|
+
version?: string;
|
|
47
|
+
chainId?: string | number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The complete typed data, with all the structs, domain data, primary type of the message, and the message itself.
|
|
51
|
+
*/
|
|
52
|
+
interface TypedData$1 {
|
|
53
|
+
types: Record<string, StarknetType[]>;
|
|
54
|
+
primaryType: string;
|
|
55
|
+
domain: StarknetDomain;
|
|
56
|
+
message: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* INVOKE_TXN_V1
|
|
60
|
+
* @see https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json
|
|
61
|
+
*/
|
|
62
|
+
interface AddInvokeTransactionParameters {
|
|
63
|
+
/**
|
|
64
|
+
* Calls to invoke by the account
|
|
65
|
+
*/
|
|
66
|
+
calls: Call$1[];
|
|
67
|
+
}
|
|
68
|
+
interface AddInvokeTransactionResult {
|
|
69
|
+
/**
|
|
70
|
+
* The hash of the invoke transaction
|
|
71
|
+
*/
|
|
72
|
+
transaction_hash: FELT$3;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* BROADCASTED_DECLARE_TXN_V2
|
|
76
|
+
* @see https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json
|
|
77
|
+
*/
|
|
78
|
+
interface AddDeclareTransactionParameters {
|
|
79
|
+
/**
|
|
80
|
+
* The hash of the Cairo assembly resulting from the Sierra compilation
|
|
81
|
+
*/
|
|
82
|
+
compiled_class_hash: FELT$3;
|
|
83
|
+
contract_class: {
|
|
84
|
+
/**
|
|
85
|
+
* The list of Sierra instructions of which the program consists
|
|
86
|
+
*/
|
|
87
|
+
sierra_program: FELT$3[];
|
|
88
|
+
/**
|
|
89
|
+
* The version of the contract class object. Currently, the Starknet OS supports version 0.1.0
|
|
90
|
+
*/
|
|
91
|
+
contract_class_version: string;
|
|
92
|
+
/**
|
|
93
|
+
* Entry points by type
|
|
94
|
+
*/
|
|
95
|
+
entry_points_by_type: {
|
|
96
|
+
CONSTRUCTOR: SIERRA_ENTRY_POINT$2[];
|
|
97
|
+
EXTERNAL: SIERRA_ENTRY_POINT$2[];
|
|
98
|
+
L1_HANDLER: SIERRA_ENTRY_POINT$2[];
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* The class ABI, as supplied by the user declaring the class
|
|
102
|
+
*/
|
|
103
|
+
abi?: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
interface AddDeclareTransactionResult {
|
|
107
|
+
/**
|
|
108
|
+
* The hash of the declare transaction
|
|
109
|
+
*/
|
|
110
|
+
transaction_hash: FELT$3;
|
|
111
|
+
/**
|
|
112
|
+
* The hash of the declared class
|
|
113
|
+
*/
|
|
114
|
+
class_hash: FELT$3;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* DEPLOY_ACCOUNT_TXN_V1
|
|
118
|
+
* @see https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json
|
|
119
|
+
*/
|
|
120
|
+
interface AddDeployAccountTransactionParameters {
|
|
121
|
+
/**
|
|
122
|
+
* The salt for the address of the deployed contract
|
|
123
|
+
*/
|
|
124
|
+
contract_address_salt: FELT$3;
|
|
125
|
+
/**
|
|
126
|
+
* The parameters passed to the constructor
|
|
127
|
+
*/
|
|
128
|
+
constructor_calldata: FELT$3[];
|
|
129
|
+
/**
|
|
130
|
+
* The hash of the deployed contract's class
|
|
131
|
+
*/
|
|
132
|
+
class_hash: FELT$3;
|
|
133
|
+
}
|
|
134
|
+
interface AddDeployAccountTransactionResult {
|
|
135
|
+
/**
|
|
136
|
+
* The hash of the deploy transaction
|
|
137
|
+
*/
|
|
138
|
+
transaction_hash: FELT$3;
|
|
139
|
+
/**
|
|
140
|
+
* The address of the new contract
|
|
141
|
+
*/
|
|
142
|
+
contract_address: FELT$3;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* EIP-1102:
|
|
146
|
+
* @see https://eips.ethereum.org/EIPS/eip-1102
|
|
147
|
+
*/
|
|
148
|
+
interface RequestAccountsParameters {
|
|
149
|
+
/**
|
|
150
|
+
* If true, the wallet will not show the wallet-unlock UI in case of a locked wallet,
|
|
151
|
+
* nor the dApp-approve UI in case of a non-allowed dApp.
|
|
152
|
+
*/
|
|
153
|
+
silentMode?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* EIP-747:
|
|
157
|
+
* @see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-747.md
|
|
158
|
+
*/
|
|
159
|
+
interface WatchAssetParameters {
|
|
160
|
+
type: 'ERC20';
|
|
161
|
+
options: {
|
|
162
|
+
address: string;
|
|
163
|
+
symbol?: string;
|
|
164
|
+
decimals?: number;
|
|
165
|
+
image?: string;
|
|
166
|
+
name?: string;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* EIP-3085:
|
|
171
|
+
* @see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3085.md
|
|
172
|
+
*/
|
|
173
|
+
interface AddStarknetChainParameters {
|
|
174
|
+
id: string;
|
|
175
|
+
chainId: string;
|
|
176
|
+
chainName: string;
|
|
177
|
+
rpcUrls?: string[];
|
|
178
|
+
blockExplorerUrls?: string[];
|
|
179
|
+
nativeCurrency?: {
|
|
180
|
+
address: string;
|
|
181
|
+
name: string;
|
|
182
|
+
symbol: string;
|
|
183
|
+
decimals: number;
|
|
184
|
+
};
|
|
185
|
+
iconUrls?: string[];
|
|
186
|
+
}
|
|
187
|
+
interface SwitchStarknetChainParameters {
|
|
188
|
+
chainId: string;
|
|
189
|
+
}
|
|
190
|
+
interface GetDeploymentDataResult {
|
|
191
|
+
address: FELT$3;
|
|
192
|
+
class_hash: FELT$3;
|
|
193
|
+
salt: FELT$3;
|
|
194
|
+
calldata: FELT$3[];
|
|
195
|
+
sigdata?: FELT$3[];
|
|
196
|
+
version: 0 | 1;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Maps each RPC message type to its corresponding parameters and result type.
|
|
200
|
+
*/
|
|
201
|
+
interface RpcTypeToMessageMap {
|
|
202
|
+
/**
|
|
203
|
+
* Get permissions from the wallet.
|
|
204
|
+
* @returns An array of permissions.
|
|
205
|
+
*/
|
|
206
|
+
wallet_getPermissions: {
|
|
207
|
+
params?: never;
|
|
208
|
+
result: Permission[];
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Request accounts from the wallet.
|
|
212
|
+
* @param params Optional parameters for requesting accounts.
|
|
213
|
+
* @returns An array of account addresses as strings.
|
|
214
|
+
*/
|
|
215
|
+
wallet_requestAccounts: {
|
|
216
|
+
params?: RequestAccountsParameters;
|
|
217
|
+
result: string[];
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Watch an asset in the wallet.
|
|
221
|
+
* @param params The parameters required to watch an asset.
|
|
222
|
+
* @returns A boolean indicating if the operation was successful.
|
|
223
|
+
*/
|
|
224
|
+
wallet_watchAsset: {
|
|
225
|
+
params: WatchAssetParameters;
|
|
226
|
+
result: boolean;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Add a new Starknet chain to the wallet.
|
|
230
|
+
* @param params The parameters required to add a new chain.
|
|
231
|
+
* @returns A boolean indicating if the operation was successful.
|
|
232
|
+
*/
|
|
233
|
+
wallet_addStarknetChain: {
|
|
234
|
+
params: AddStarknetChainParameters;
|
|
235
|
+
result: boolean;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Switch the current Starknet chain in the wallet.
|
|
239
|
+
* @param params The parameters required to switch chains.
|
|
240
|
+
* @returns A boolean indicating if the operation was successful.
|
|
241
|
+
*/
|
|
242
|
+
wallet_switchStarknetChain: {
|
|
243
|
+
params: SwitchStarknetChainParameters;
|
|
244
|
+
result: boolean;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Request the current chain ID from the wallet.
|
|
248
|
+
* @returns The current Starknet chain ID.
|
|
249
|
+
*/
|
|
250
|
+
wallet_requestChainId: {
|
|
251
|
+
params?: never;
|
|
252
|
+
result: StarknetChainId$1;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Get deployment data for a contract.
|
|
256
|
+
* @returns The deployment data result.
|
|
257
|
+
*/
|
|
258
|
+
wallet_deploymentData: {
|
|
259
|
+
params?: never;
|
|
260
|
+
result: GetDeploymentDataResult;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Add an invoke transaction to the wallet.
|
|
264
|
+
* @param params The parameters required for the invoke transaction.
|
|
265
|
+
* @returns The result of adding the invoke transaction.
|
|
266
|
+
*/
|
|
267
|
+
starknet_addInvokeTransaction: {
|
|
268
|
+
params: AddInvokeTransactionParameters;
|
|
269
|
+
result: AddInvokeTransactionResult;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Add a declare transaction to the wallet.
|
|
273
|
+
* @param params The parameters required for the declare transaction.
|
|
274
|
+
* @returns The result of adding the declare transaction.
|
|
275
|
+
*/
|
|
276
|
+
starknet_addDeclareTransaction: {
|
|
277
|
+
params: AddDeclareTransactionParameters;
|
|
278
|
+
result: AddDeclareTransactionResult;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Add a deploy account transaction to the wallet.
|
|
282
|
+
* @param params The parameters required for the deploy account transaction.
|
|
283
|
+
* @returns The result of adding the deploy account transaction.
|
|
284
|
+
*/
|
|
285
|
+
starknet_addDeployAccountTransaction: {
|
|
286
|
+
params: AddDeployAccountTransactionParameters;
|
|
287
|
+
result: AddDeployAccountTransactionResult;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Sign typed data using the wallet.
|
|
291
|
+
* @param params The typed data to sign.
|
|
292
|
+
* @returns An array of signatures as strings.
|
|
293
|
+
*/
|
|
294
|
+
starknet_signTypedData: {
|
|
295
|
+
params: TypedData$1;
|
|
296
|
+
result: string[];
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Get the list of supported specifications.
|
|
300
|
+
* @returns An array of supported specification strings.
|
|
301
|
+
*/
|
|
302
|
+
starknet_supportedSpecs: {
|
|
303
|
+
params?: never;
|
|
304
|
+
result: string[];
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
type RpcMessage = {
|
|
308
|
+
[K in keyof RpcTypeToMessageMap]: {
|
|
309
|
+
type: K;
|
|
310
|
+
} & RpcTypeToMessageMap[K];
|
|
311
|
+
}[keyof RpcTypeToMessageMap];
|
|
312
|
+
type IsParamsOptional<T extends keyof RpcTypeToMessageMap> = undefined extends RpcTypeToMessageMap[T]['params'] ? true : false;
|
|
313
|
+
type RequestFnCall<T extends RpcMessage['type']> = {
|
|
314
|
+
type: T;
|
|
315
|
+
} & (IsParamsOptional<T> extends true ? {
|
|
316
|
+
params?: RpcTypeToMessageMap[T]['params'];
|
|
317
|
+
} : {
|
|
318
|
+
params: RpcTypeToMessageMap[T]['params'];
|
|
319
|
+
});
|
|
320
|
+
type RequestFn = <T extends RpcMessage['type']>(call: RequestFnCall<T>) => Promise<RpcTypeToMessageMap[T]['result']>;
|
|
321
|
+
|
|
8
322
|
type RequestBody = {
|
|
9
323
|
id: number | string;
|
|
10
324
|
jsonrpc: '2.0';
|
|
@@ -2450,11 +2764,16 @@ declare enum TransactionHashPrefix {
|
|
|
2450
2764
|
INVOKE = "0x696e766f6b65",// encodeShortString('invoke'),
|
|
2451
2765
|
L1_HANDLER = "0x6c315f68616e646c6572"
|
|
2452
2766
|
}
|
|
2767
|
+
declare const enum feeMarginPercentage {
|
|
2768
|
+
L1_BOUND_MAX_AMOUNT = 50,
|
|
2769
|
+
L1_BOUND_MAX_PRICE_PER_UNIT = 50,
|
|
2770
|
+
MAX_FEE = 50
|
|
2771
|
+
}
|
|
2453
2772
|
declare const UDC: {
|
|
2454
2773
|
ADDRESS: string;
|
|
2455
2774
|
ENTRYPOINT: string;
|
|
2456
2775
|
};
|
|
2457
|
-
declare const RPC_DEFAULT_VERSION = "
|
|
2776
|
+
declare const RPC_DEFAULT_VERSION = "v0_7";
|
|
2458
2777
|
declare const RPC_NODES: {
|
|
2459
2778
|
SN_GOERLI: string[];
|
|
2460
2779
|
SN_MAIN: string[];
|
|
@@ -2479,8 +2798,10 @@ type constants_TransactionHashPrefix = TransactionHashPrefix;
|
|
|
2479
2798
|
declare const constants_TransactionHashPrefix: typeof TransactionHashPrefix;
|
|
2480
2799
|
declare const constants_UDC: typeof UDC;
|
|
2481
2800
|
declare const constants_ZERO: typeof ZERO;
|
|
2801
|
+
type constants_feeMarginPercentage = feeMarginPercentage;
|
|
2802
|
+
declare const constants_feeMarginPercentage: typeof feeMarginPercentage;
|
|
2482
2803
|
declare namespace constants {
|
|
2483
|
-
export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, constants_BaseUrl as BaseUrl, constants_IS_BROWSER as IS_BROWSER, constants_MASK_250 as MASK_250, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, constants_NetworkName as NetworkName, constants_RPC_DEFAULT_VERSION as RPC_DEFAULT_VERSION, constants_RPC_NODES as RPC_NODES, constants_StarknetChainId as StarknetChainId, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, ETransactionVersion as TRANSACTION_VERSION, constants_TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
|
|
2804
|
+
export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, constants_BaseUrl as BaseUrl, constants_IS_BROWSER as IS_BROWSER, constants_MASK_250 as MASK_250, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, constants_NetworkName as NetworkName, constants_RPC_DEFAULT_VERSION as RPC_DEFAULT_VERSION, constants_RPC_NODES as RPC_NODES, constants_StarknetChainId as StarknetChainId, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, ETransactionVersion as TRANSACTION_VERSION, constants_TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO, constants_feeMarginPercentage as feeMarginPercentage };
|
|
2484
2805
|
}
|
|
2485
2806
|
|
|
2486
2807
|
declare const ec_weierstrass: typeof weierstrass;
|
|
@@ -3007,6 +3328,11 @@ type RpcProviderOptions = {
|
|
|
3007
3328
|
specVersion?: string;
|
|
3008
3329
|
default?: boolean;
|
|
3009
3330
|
waitMode?: boolean;
|
|
3331
|
+
feeMarginPercentage?: {
|
|
3332
|
+
l1BoundMaxAmount: number;
|
|
3333
|
+
l1BoundMaxPricePerUnit: number;
|
|
3334
|
+
maxFee: number;
|
|
3335
|
+
};
|
|
3010
3336
|
};
|
|
3011
3337
|
|
|
3012
3338
|
type Simplify<T> = {
|
|
@@ -3515,6 +3841,7 @@ declare class RpcChannel$1 {
|
|
|
3515
3841
|
private specVersion?;
|
|
3516
3842
|
readonly waitMode: Boolean;
|
|
3517
3843
|
constructor(optionsOrProvider?: RpcProviderOptions);
|
|
3844
|
+
setChainId(chainId: StarknetChainId): void;
|
|
3518
3845
|
fetch(method: string, params?: object, id?: string | number): any;
|
|
3519
3846
|
protected errorHandler(method: string, params: any, rpcError?: Error$1, otherError?: any): void;
|
|
3520
3847
|
protected fetchEndpoint<T extends keyof Methods$1>(method: T, params?: Methods$1[T]['params']): Promise<Methods$1[T]['result']>;
|
|
@@ -3594,6 +3921,7 @@ declare class RpcChannel {
|
|
|
3594
3921
|
private speckVersion?;
|
|
3595
3922
|
readonly waitMode: Boolean;
|
|
3596
3923
|
constructor(optionsOrProvider?: RpcProviderOptions);
|
|
3924
|
+
setChainId(chainId: StarknetChainId): void;
|
|
3597
3925
|
fetch(method: string, params?: object, id?: string | number): any;
|
|
3598
3926
|
protected errorHandler(method: string, params: any, rpcError?: Error$1, otherError?: any): void;
|
|
3599
3927
|
protected fetchEndpoint<T extends keyof Methods>(method: T, params?: Methods[T]['params']): Promise<Methods[T]['result']>;
|
|
@@ -6171,6 +6499,133 @@ declare class Account extends RpcProvider implements AccountInterface {
|
|
|
6171
6499
|
StarknetIdContract?: string): Promise<string>;
|
|
6172
6500
|
}
|
|
6173
6501
|
|
|
6502
|
+
type AccountChangeEventHandler = (accounts?: string[]) => void;
|
|
6503
|
+
type NetworkChangeEventHandler = (chainId?: StarknetChainId$1, accounts?: string[]) => void;
|
|
6504
|
+
interface WalletEventHandlers {
|
|
6505
|
+
accountsChanged: AccountChangeEventHandler;
|
|
6506
|
+
networkChanged: NetworkChangeEventHandler;
|
|
6507
|
+
}
|
|
6508
|
+
|
|
6509
|
+
type WalletEventListener = <E extends keyof WalletEventHandlers>(event: E, handleEvent: WalletEventHandlers[E]) => void;
|
|
6510
|
+
interface StarknetWindowObject {
|
|
6511
|
+
id: string;
|
|
6512
|
+
name: string;
|
|
6513
|
+
version: string;
|
|
6514
|
+
icon: string | {
|
|
6515
|
+
dark: string;
|
|
6516
|
+
light: string;
|
|
6517
|
+
};
|
|
6518
|
+
request: RequestFn;
|
|
6519
|
+
on: WalletEventListener;
|
|
6520
|
+
off: WalletEventListener;
|
|
6521
|
+
}
|
|
6522
|
+
declare global {
|
|
6523
|
+
interface Window {
|
|
6524
|
+
[key: `starknet_${string}`]: StarknetWindowObject | undefined;
|
|
6525
|
+
}
|
|
6526
|
+
}
|
|
6527
|
+
|
|
6528
|
+
interface StarknetWalletProvider extends StarknetWindowObject {
|
|
6529
|
+
}
|
|
6530
|
+
|
|
6531
|
+
declare class WalletAccount extends Account implements AccountInterface {
|
|
6532
|
+
address: string;
|
|
6533
|
+
walletProvider: StarknetWalletProvider;
|
|
6534
|
+
constructor(providerOrOptions: ProviderOptions | ProviderInterface, walletProvider: StarknetWalletProvider, cairoVersion?: CairoVersion);
|
|
6535
|
+
/**
|
|
6536
|
+
* WALLET EVENTS
|
|
6537
|
+
*/
|
|
6538
|
+
onAccountChange(callback: AccountChangeEventHandler): void;
|
|
6539
|
+
onNetworkChanged(callback: NetworkChangeEventHandler): void;
|
|
6540
|
+
/**
|
|
6541
|
+
* WALLET SPECIFIC METHODS
|
|
6542
|
+
*/
|
|
6543
|
+
requestAccounts(silentMode?: boolean): Promise<string[]>;
|
|
6544
|
+
getPermissions(): Promise<Permission[]>;
|
|
6545
|
+
switchStarknetChain(chainId: StarknetChainId): Promise<boolean>;
|
|
6546
|
+
watchAsset(asset: WatchAssetParameters): Promise<boolean>;
|
|
6547
|
+
addStarknetChain(chain: AddStarknetChainParameters): Promise<boolean>;
|
|
6548
|
+
/**
|
|
6549
|
+
* ACCOUNT METHODS
|
|
6550
|
+
*/
|
|
6551
|
+
execute(calls: AllowArray<Call>): Promise<AddInvokeTransactionResult>;
|
|
6552
|
+
declare(payload: DeclareContractPayload): Promise<AddDeclareTransactionResult>;
|
|
6553
|
+
deploy(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[]): Promise<MultiDeployContractResponse>;
|
|
6554
|
+
deployAccount(payload: DeployAccountContractPayload): Promise<AddDeployAccountTransactionResult>;
|
|
6555
|
+
signMessage(typedData: TypedData): Promise<string[]>;
|
|
6556
|
+
}
|
|
6557
|
+
|
|
6558
|
+
/**
|
|
6559
|
+
* Request Permission for wallet account, return addresses that are allowed by user
|
|
6560
|
+
* @param silentMode false: request user interaction allowance. true: return only pre-allowed
|
|
6561
|
+
* @returns allowed accounts addresses
|
|
6562
|
+
*/
|
|
6563
|
+
declare function requestAccounts(swo: StarknetWindowObject, silentMode?: boolean): Promise<string[]>;
|
|
6564
|
+
/**
|
|
6565
|
+
* Request Permission for wallet account
|
|
6566
|
+
* @returns allowed accounts addresses
|
|
6567
|
+
*/
|
|
6568
|
+
declare function getPermissions(swo: StarknetWindowObject): Promise<Permission[]>;
|
|
6569
|
+
/**
|
|
6570
|
+
* Request adding ERC20 Token to Wallet List
|
|
6571
|
+
* @param asset WatchAssetParameters
|
|
6572
|
+
* @returns boolean
|
|
6573
|
+
*/
|
|
6574
|
+
declare function watchAsset(swo: StarknetWindowObject, asset: WatchAssetParameters): Promise<boolean>;
|
|
6575
|
+
/**
|
|
6576
|
+
* Request adding custom Starknet chain
|
|
6577
|
+
* @param chain AddStarknetChainParameters
|
|
6578
|
+
* @returns boolean
|
|
6579
|
+
*/
|
|
6580
|
+
declare function addStarknetChain(swo: StarknetWindowObject, chain: AddStarknetChainParameters): Promise<boolean>;
|
|
6581
|
+
/**
|
|
6582
|
+
* Request Wallet Network change
|
|
6583
|
+
* @param chainId StarknetChainId
|
|
6584
|
+
* @returns boolean
|
|
6585
|
+
*/
|
|
6586
|
+
declare function switchStarknetChain(swo: StarknetWindowObject, chainId: StarknetChainId$1): Promise<boolean>;
|
|
6587
|
+
/**
|
|
6588
|
+
* Request the current chain ID from the wallet.
|
|
6589
|
+
* @returns The current Starknet chain ID.
|
|
6590
|
+
*/
|
|
6591
|
+
declare function requestChainId(swo: StarknetWindowObject): Promise<StarknetChainId$1>;
|
|
6592
|
+
/**
|
|
6593
|
+
* Get deployment data for a contract.
|
|
6594
|
+
* @returns The deployment data result.
|
|
6595
|
+
*/
|
|
6596
|
+
declare function deploymentData(swo: StarknetWindowObject): Promise<GetDeploymentDataResult>;
|
|
6597
|
+
/**
|
|
6598
|
+
* Add an invoke transaction to the wallet.
|
|
6599
|
+
* @param params The parameters required for the invoke transaction.
|
|
6600
|
+
* @returns The result of adding the invoke transaction.
|
|
6601
|
+
*/
|
|
6602
|
+
declare function addInvokeTransaction(swo: StarknetWindowObject, params: AddInvokeTransactionParameters): Promise<AddInvokeTransactionResult>;
|
|
6603
|
+
/**
|
|
6604
|
+
* Add a declare transaction to the wallet.
|
|
6605
|
+
* @param params The parameters required for the declare transaction.
|
|
6606
|
+
* @returns The result of adding the declare transaction.
|
|
6607
|
+
*/
|
|
6608
|
+
declare function addDeclareTransaction(swo: StarknetWindowObject, params: AddDeclareTransactionParameters): Promise<AddDeclareTransactionResult>;
|
|
6609
|
+
/**
|
|
6610
|
+
* Add a deploy account transaction to the wallet.
|
|
6611
|
+
* @param params The parameters required for the deploy account transaction.
|
|
6612
|
+
* @returns The result of adding the deploy account transaction.
|
|
6613
|
+
*/
|
|
6614
|
+
declare function addDeployAccountTransaction(swo: StarknetWindowObject, params: AddDeployAccountTransactionParameters): Promise<AddDeployAccountTransactionResult>;
|
|
6615
|
+
/**
|
|
6616
|
+
* Sign typed data using the wallet.
|
|
6617
|
+
* @param params The typed data to sign.
|
|
6618
|
+
* @returns An array of signatures as strings.
|
|
6619
|
+
*/
|
|
6620
|
+
declare function signMessage(swo: StarknetWindowObject, typedData: TypedData$1): Promise<string[]>;
|
|
6621
|
+
/**
|
|
6622
|
+
* Get the list of supported specifications.
|
|
6623
|
+
* @returns An array of supported specification strings.
|
|
6624
|
+
*/
|
|
6625
|
+
declare function supportedSpecs(swo: StarknetWindowObject): Promise<string[]>;
|
|
6626
|
+
declare function onAccountChange(swo: StarknetWindowObject, callback: AccountChangeEventHandler): void;
|
|
6627
|
+
declare function onNetworkChanged(swo: StarknetWindowObject, callback: NetworkChangeEventHandler): void;
|
|
6628
|
+
|
|
6174
6629
|
declare module 'abi-wan-kanabi' {
|
|
6175
6630
|
interface Config<OptionT = any, ResultT = any, ErrorT = any> {
|
|
6176
6631
|
FeltType: BigNumberish;
|
|
@@ -6838,6 +7293,14 @@ declare const fromCallsToExecuteCalldata_cairo1: (calls: Call[]) => Calldata;
|
|
|
6838
7293
|
* Create `__execute__` Calldata from Calls based on Cairo versions
|
|
6839
7294
|
*/
|
|
6840
7295
|
declare const getExecuteCalldata: (calls: Call[], cairoVersion?: CairoVersion) => Calldata;
|
|
7296
|
+
declare function buildUDCCall(payload: UniversalDeployerContractPayload | UniversalDeployerContractPayload[], address: string): {
|
|
7297
|
+
calls: {
|
|
7298
|
+
contractAddress: string;
|
|
7299
|
+
entrypoint: string;
|
|
7300
|
+
calldata: BigNumberish[];
|
|
7301
|
+
}[];
|
|
7302
|
+
addresses: string[];
|
|
7303
|
+
};
|
|
6841
7304
|
/**
|
|
6842
7305
|
* Return transaction versions based on version type, default version type is 'transaction'
|
|
6843
7306
|
*/
|
|
@@ -6847,6 +7310,7 @@ declare function getVersionsByType(versionType?: 'fee' | 'transaction'): {
|
|
|
6847
7310
|
v3: ETransactionVersion;
|
|
6848
7311
|
};
|
|
6849
7312
|
|
|
7313
|
+
declare const transaction_buildUDCCall: typeof buildUDCCall;
|
|
6850
7314
|
declare const transaction_fromCallsToExecuteCalldata: typeof fromCallsToExecuteCalldata;
|
|
6851
7315
|
declare const transaction_fromCallsToExecuteCalldataWithNonce: typeof fromCallsToExecuteCalldataWithNonce;
|
|
6852
7316
|
declare const transaction_fromCallsToExecuteCalldata_cairo1: typeof fromCallsToExecuteCalldata_cairo1;
|
|
@@ -6855,7 +7319,7 @@ declare const transaction_getVersionsByType: typeof getVersionsByType;
|
|
|
6855
7319
|
declare const transaction_transformCallsToMulticallArrays: typeof transformCallsToMulticallArrays;
|
|
6856
7320
|
declare const transaction_transformCallsToMulticallArrays_cairo1: typeof transformCallsToMulticallArrays_cairo1;
|
|
6857
7321
|
declare namespace transaction {
|
|
6858
|
-
export { transaction_fromCallsToExecuteCalldata as fromCallsToExecuteCalldata, transaction_fromCallsToExecuteCalldataWithNonce as fromCallsToExecuteCalldataWithNonce, transaction_fromCallsToExecuteCalldata_cairo1 as fromCallsToExecuteCalldata_cairo1, transaction_getExecuteCalldata as getExecuteCalldata, transaction_getVersionsByType as getVersionsByType, transaction_transformCallsToMulticallArrays as transformCallsToMulticallArrays, transaction_transformCallsToMulticallArrays_cairo1 as transformCallsToMulticallArrays_cairo1 };
|
|
7322
|
+
export { transaction_buildUDCCall as buildUDCCall, transaction_fromCallsToExecuteCalldata as fromCallsToExecuteCalldata, transaction_fromCallsToExecuteCalldataWithNonce as fromCallsToExecuteCalldataWithNonce, transaction_fromCallsToExecuteCalldata_cairo1 as fromCallsToExecuteCalldata_cairo1, transaction_getExecuteCalldata as getExecuteCalldata, transaction_getVersionsByType as getVersionsByType, transaction_transformCallsToMulticallArrays as transformCallsToMulticallArrays, transaction_transformCallsToMulticallArrays_cairo1 as transformCallsToMulticallArrays_cairo1 };
|
|
6859
7323
|
}
|
|
6860
7324
|
|
|
6861
7325
|
/**
|
|
@@ -7598,4 +8062,4 @@ declare function parseUDCEvent(txReceipt: InvokeTransactionReceiptResponse): {
|
|
|
7598
8062
|
/** @deprecated prefer the 'num' naming */
|
|
7599
8063
|
declare const number: typeof num;
|
|
7600
8064
|
|
|
7601
|
-
export { type Abi, type AbiEntry, type AbiEnums, type AbiEvents, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type Cairo1Event, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallStruct, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, CustomError, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransactionReceiptResponse, type Details, EntryPointType, type EntryPointsByType, type EnumAbi, type EstimateFee, type EstimateFeeAction, type EstimateFeeBulk, type EstimateFeeDetails, type EstimateFeeResponse, type EstimateFeeResponseBulk, EthSigner, type EventAbi, type EventEntry, type FeeEstimate, type FunctionAbi, GatewayError, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type HexCalldata, HttpError, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeOptions, type InvokeTransactionReceiptResponse, type L1HandlerTransactionReceiptResponse, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type MultiDeployContractResponse, type MultiType, type Nonce, type OptionalPayload, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PendingBlock, type PendingStateUpdate, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type PythonicHints, index$3 as RPC, rpc_0_6 as RPC06, rpc_0_7 as RPC07, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, type Result, RpcChannel, RpcProvider, type RpcProviderOptions, SIMULATION_FLAG, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type SimulateTransactionDetails, type SimulateTransactionResponse, type SimulatedTransaction, type SimulationFlags, type StarkNetDomain, type StarkNetEnumType, type StarkNetMerkleType, type StarkNetType, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type StructAbi, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, TransactionStatus, TransactionType, type Tupled, type TypedContractV2, type TypedData, TypedDataRevision, Uint, type Uint256, type UniversalDeployerContractPayload, type UniversalDetails, type V2DeclareSignerDetails, type V2DeployAccountSignerDetails, type V2InvocationsSignerDetails, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, type WeierstrassSignatureType, addAddressPadding, buildUrl, byteArray, cairo, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, ec, encode, eth, index as events, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, type getSimulateTransactionOptions, index$1 as hash, isSierra, isUrl, json, merkle, num, number, parseUDCEvent, provider, selector, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index$2 as types, uint256$1 as uint256, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, type waitForTransactionOptions };
|
|
8065
|
+
export { type Abi, type AbiEntry, type AbiEnums, type AbiEvents, type AbiStructs, Account, AccountInterface, type AccountInvocationItem, type AccountInvocations, type AccountInvocationsFactoryDetails, type AllowArray, type Args, type ArgsOrCalldata, type ArgsOrCalldataWithOptions, type ArraySignatureType, type AsyncContractFunction, type BigNumberish, type Block$1 as Block, type BlockIdentifier, type BlockNumber, BlockStatus, BlockTag, type BlockWithTxHashes, type Builtins, type ByteArray, type ByteCode, type Cairo1Event, type CairoAssembly, type CairoContract, CairoCustomEnum, type CairoEnum, type CairoEnumRaw, CairoOption, CairoOptionVariant, CairoResult, CairoResultVariant, type CairoVersion, type Call, type CallContractResponse, CallData, type CallDetails, type CallOptions, type CallStruct, type Calldata, type CompiledContract, type CompiledSierra, type CompiledSierraCasm, type CompilerVersion, type CompleteDeclareContractPayload, type CompressedProgram, Contract, type ContractClass, type ContractClassPayload, type ContractClassResponse, type ContractEntryPointFields, ContractFactory, type ContractFactoryParams, type ContractFunction, ContractInterface, type ContractOptions, type ContractVersion, CustomError, type DeclareAndDeployContractPayload, type DeclareContractPayload, type DeclareContractResponse, type DeclareContractTransaction, type DeclareDeployUDCResponse, type DeclareSignerDetails, type DeclareTransactionReceiptResponse, type DeployAccountContractPayload, type DeployAccountContractTransaction, type DeployAccountSignerDetails, type DeployAccountTransactionReceiptResponse, type DeployContractResponse, type DeployContractUDCResponse, type DeployTransactionReceiptResponse, type Details, EntryPointType, type EntryPointsByType, type EnumAbi, type EstimateFee, type EstimateFeeAction, type EstimateFeeBulk, type EstimateFeeDetails, type EstimateFeeResponse, type EstimateFeeResponseBulk, EthSigner, type EventAbi, type EventEntry, type FeeEstimate, type FunctionAbi, GatewayError, type GetBlockResponse, type GetTransactionReceiptResponse, type GetTransactionResponse, type HexCalldata, HttpError, type Invocation, type Invocations, type InvocationsDetails, type InvocationsDetailsWithNonce, type InvocationsSignerDetails, type InvokeFunctionResponse, type InvokeOptions, type InvokeTransactionReceiptResponse, type L1HandlerTransactionReceiptResponse, type LegacyCompiledContract, type LegacyContractClass, type LegacyEvent, LibraryError, Literal, type MultiDeployContractResponse, type MultiType, type Nonce, type OptionalPayload, type ParsedEvent, type ParsedEvents, type ParsedStruct, type PendingBlock, type PendingStateUpdate, type Program, RpcProvider as Provider, ProviderInterface, type ProviderOptions, type PythonicHints, index$3 as RPC, rpc_0_6 as RPC06, rpc_0_7 as RPC07, type RawArgs, type RawArgsArray, type RawArgsObject, type RawCalldata, type Result, RpcChannel, RpcProvider, type RpcProviderOptions, SIMULATION_FLAG, type SierraContractClass, type SierraContractEntryPointFields, type SierraEntryPointsByType, type SierraProgramDebugInfo, type Signature, Signer, SignerInterface, type SimulateTransactionDetails, type SimulateTransactionResponse, type SimulatedTransaction, type SimulationFlags, type StarkNetDomain, type StarkNetEnumType, type StarkNetMerkleType, type StarkNetType, type StarkProfile, type StateUpdate, type StateUpdateResponse, type Storage, type StructAbi, TransactionExecutionStatus, TransactionFinalityStatus, type TransactionReceipt, TransactionStatus, TransactionType, type Tupled, type TypedContractV2, type TypedData, TypedDataRevision, Uint, type Uint256, type UniversalDeployerContractPayload, type UniversalDetails, type V2DeclareSignerDetails, type V2DeployAccountSignerDetails, type V2InvocationsSignerDetails, type V3DeclareSignerDetails, type V3DeployAccountSignerDetails, type V3InvocationsSignerDetails, type V3TransactionDetails, ValidateType, WalletAccount, type WeierstrassSignatureType, addAddressPadding, addDeclareTransaction, addDeployAccountTransaction, addInvokeTransaction, addStarknetChain, buildUrl, byteArray, cairo, constants, contractClassResponseToLegacyCompiledContract, defaultProvider, deploymentData, ec, encode, eth, index as events, extractContractHashes, fixProto, fixStack, getCalldata, getChecksumAddress, type getContractVersionOptions, type getEstimateFeeBulkOptions, getPermissions, type getSimulateTransactionOptions, index$1 as hash, isSierra, isUrl, json, merkle, num, number, onAccountChange, onNetworkChanged, parseUDCEvent, provider, requestAccounts, requestChainId, selector, shortString, signMessage, splitArgsAndOptions, stark, starknetId, supportedSpecs, switchStarknetChain, transaction, typedData, index$2 as types, uint256$1 as uint256, v2 as v2hash, v3 as v3hash, validateAndParseAddress, validateChecksumAddress, type waitForTransactionOptions, watchAsset };
|