@cartridge/controller-wasm 0.8.0 → 0.9.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/package.json +1 -1
- package/pkg-controller/account_wasm.d.ts +211 -227
- package/pkg-controller/account_wasm_bg.js +727 -754
- package/pkg-controller/account_wasm_bg.wasm +0 -0
- package/pkg-session/session_wasm.d.ts +137 -132
- package/pkg-session/session_wasm_bg.js +377 -391
- package/pkg-session/session_wasm_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,123 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Computes the Starknet contract address for a controller account without needing a full instance.
|
|
5
|
-
*
|
|
6
|
-
* # Arguments
|
|
7
|
-
*
|
|
8
|
-
* * `class_hash` - The class hash of the account contract (JsFelt).
|
|
9
|
-
* * `owner` - The owner configuration for the account.
|
|
10
|
-
* * `salt` - The salt used for address calculation (JsFelt).
|
|
11
|
-
*
|
|
12
|
-
* # Returns
|
|
13
|
-
*
|
|
14
|
-
* The computed Starknet contract address as a `JsFelt`.
|
|
15
|
-
*/
|
|
16
|
-
export function computeAccountAddress(class_hash: JsFelt, owner: Owner, salt: JsFelt): JsFelt;
|
|
17
|
-
/**
|
|
18
|
-
* Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
|
|
19
|
-
* The goal of this function is to know from any place when the register session flow has been completed, and to
|
|
20
|
-
* get the authorization.
|
|
21
|
-
*/
|
|
22
|
-
export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;
|
|
23
|
-
export function signerToGuid(signer: Signer): JsFelt;
|
|
24
|
-
export enum ErrorCode {
|
|
25
|
-
StarknetFailedToReceiveTransaction = 1,
|
|
26
|
-
StarknetContractNotFound = 20,
|
|
27
|
-
StarknetBlockNotFound = 24,
|
|
28
|
-
StarknetInvalidTransactionIndex = 27,
|
|
29
|
-
StarknetClassHashNotFound = 28,
|
|
30
|
-
StarknetTransactionHashNotFound = 29,
|
|
31
|
-
StarknetPageSizeTooBig = 31,
|
|
32
|
-
StarknetNoBlocks = 32,
|
|
33
|
-
StarknetInvalidContinuationToken = 33,
|
|
34
|
-
StarknetTooManyKeysInFilter = 34,
|
|
35
|
-
StarknetContractError = 40,
|
|
36
|
-
StarknetTransactionExecutionError = 41,
|
|
37
|
-
StarknetClassAlreadyDeclared = 51,
|
|
38
|
-
StarknetInvalidTransactionNonce = 52,
|
|
39
|
-
StarknetInsufficientMaxFee = 53,
|
|
40
|
-
StarknetInsufficientAccountBalance = 54,
|
|
41
|
-
StarknetValidationFailure = 55,
|
|
42
|
-
StarknetCompilationFailed = 56,
|
|
43
|
-
StarknetContractClassSizeIsTooLarge = 57,
|
|
44
|
-
StarknetNonAccount = 58,
|
|
45
|
-
StarknetDuplicateTx = 59,
|
|
46
|
-
StarknetCompiledClassHashMismatch = 60,
|
|
47
|
-
StarknetUnsupportedTxVersion = 61,
|
|
48
|
-
StarknetUnsupportedContractClassVersion = 62,
|
|
49
|
-
StarknetUnexpectedError = 63,
|
|
50
|
-
StarknetNoTraceAvailable = 10,
|
|
51
|
-
StarknetReplacementTransactionUnderpriced = 64,
|
|
52
|
-
StarknetFeeBelowMinimum = 65,
|
|
53
|
-
SignError = 101,
|
|
54
|
-
StorageError = 102,
|
|
55
|
-
AccountFactoryError = 103,
|
|
56
|
-
PaymasterExecutionTimeNotReached = 104,
|
|
57
|
-
PaymasterExecutionTimePassed = 105,
|
|
58
|
-
PaymasterInvalidCaller = 106,
|
|
59
|
-
PaymasterRateLimitExceeded = 107,
|
|
60
|
-
PaymasterNotSupported = 108,
|
|
61
|
-
PaymasterHttp = 109,
|
|
62
|
-
PaymasterExcecution = 110,
|
|
63
|
-
PaymasterSerialization = 111,
|
|
64
|
-
CartridgeControllerNotDeployed = 112,
|
|
65
|
-
InsufficientBalance = 113,
|
|
66
|
-
OriginError = 114,
|
|
67
|
-
EncodingError = 115,
|
|
68
|
-
SerdeWasmBindgenError = 116,
|
|
69
|
-
CairoSerdeError = 117,
|
|
70
|
-
CairoShortStringToFeltError = 118,
|
|
71
|
-
DeviceCreateCredential = 119,
|
|
72
|
-
DeviceGetAssertion = 120,
|
|
73
|
-
DeviceBadAssertion = 121,
|
|
74
|
-
DeviceChannel = 122,
|
|
75
|
-
DeviceOrigin = 123,
|
|
76
|
-
AccountSigning = 124,
|
|
77
|
-
AccountProvider = 125,
|
|
78
|
-
AccountClassHashCalculation = 126,
|
|
79
|
-
AccountFeeOutOfRange = 128,
|
|
80
|
-
ProviderRateLimited = 129,
|
|
81
|
-
ProviderArrayLengthMismatch = 130,
|
|
82
|
-
ProviderOther = 131,
|
|
83
|
-
SessionAlreadyRegistered = 132,
|
|
84
|
-
UrlParseError = 133,
|
|
85
|
-
Base64DecodeError = 134,
|
|
86
|
-
CoseError = 135,
|
|
87
|
-
PolicyChainIdMismatch = 136,
|
|
88
|
-
InvalidOwner = 137,
|
|
89
|
-
GasPriceTooHigh = 138,
|
|
90
|
-
TransactionTimeout = 139,
|
|
91
|
-
ConversionError = 140,
|
|
92
|
-
InvalidChainId = 141,
|
|
93
|
-
SessionRefreshRequired = 142,
|
|
94
|
-
ManualExecutionRequired = 143,
|
|
95
|
-
ForbiddenEntrypoint = 144,
|
|
96
|
-
GasAmountTooHigh = 145,
|
|
97
|
-
ApproveExecutionRequired = 146,
|
|
98
|
-
}
|
|
99
|
-
export interface JsCall {
|
|
100
|
-
contractAddress: JsFelt;
|
|
101
|
-
entrypoint: string;
|
|
102
|
-
calldata: JsFelt[];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type JsPriceUnit = "WEI" | "FRI";
|
|
106
|
-
|
|
107
|
-
export interface JsEstimateFeeDetails {
|
|
108
|
-
nonce: JsFelt;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface JsFeeEstimate {
|
|
112
|
-
l1_gas_consumed: number;
|
|
113
|
-
l1_gas_price: number;
|
|
114
|
-
l2_gas_consumed: number;
|
|
115
|
-
l2_gas_price: number;
|
|
116
|
-
l1_data_gas_consumed: number;
|
|
117
|
-
l1_data_gas_price: number;
|
|
118
|
-
overall_fee: number;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
3
|
/**
|
|
122
4
|
* JavaScript-friendly OutsideExecution V3 structure
|
|
123
5
|
*/
|
|
@@ -137,6 +19,18 @@ export interface JsSignedOutsideExecution {
|
|
|
137
19
|
signature: JsFelt[];
|
|
138
20
|
}
|
|
139
21
|
|
|
22
|
+
export type JsFeeSource = "PAYMASTER" | "CREDITS";
|
|
23
|
+
|
|
24
|
+
export type Felts = JsFelt[];
|
|
25
|
+
|
|
26
|
+
export type JsFelt = Felt;
|
|
27
|
+
|
|
28
|
+
export interface JsCall {
|
|
29
|
+
contractAddress: JsFelt;
|
|
30
|
+
entrypoint: string;
|
|
31
|
+
calldata: JsFelt[];
|
|
32
|
+
}
|
|
33
|
+
|
|
140
34
|
export interface Owner {
|
|
141
35
|
signer?: Signer;
|
|
142
36
|
account?: JsFelt;
|
|
@@ -161,9 +55,7 @@ export interface ApprovalPolicy {
|
|
|
161
55
|
|
|
162
56
|
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
163
57
|
|
|
164
|
-
export type
|
|
165
|
-
|
|
166
|
-
export type JsRegisterResponse = ResponseData;
|
|
58
|
+
export type JsAddSignerInput = SignerInput;
|
|
167
59
|
|
|
168
60
|
export interface WebauthnSigner {
|
|
169
61
|
rpId: string;
|
|
@@ -171,14 +63,6 @@ export interface WebauthnSigner {
|
|
|
171
63
|
publicKey: string;
|
|
172
64
|
}
|
|
173
65
|
|
|
174
|
-
export interface StarknetSigner {
|
|
175
|
-
privateKey: JsFelt;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface Eip191Signer {
|
|
179
|
-
address: string;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
66
|
export interface Signer {
|
|
183
67
|
webauthns?: WebauthnSigner[];
|
|
184
68
|
webauthn?: WebauthnSigner;
|
|
@@ -186,19 +70,32 @@ export interface Signer {
|
|
|
186
70
|
eip191?: Eip191Signer;
|
|
187
71
|
}
|
|
188
72
|
|
|
189
|
-
export type JsAddSignerInput = SignerInput;
|
|
190
|
-
|
|
191
73
|
export type JsRemoveSignerInput = SignerInput;
|
|
192
74
|
|
|
193
|
-
export
|
|
75
|
+
export interface StarknetSigner {
|
|
76
|
+
privateKey: JsFelt;
|
|
77
|
+
}
|
|
194
78
|
|
|
195
|
-
export
|
|
79
|
+
export interface Eip191Signer {
|
|
80
|
+
address: string;
|
|
81
|
+
}
|
|
196
82
|
|
|
197
|
-
export type
|
|
83
|
+
export type JsRevokableSession = RevokableSession;
|
|
198
84
|
|
|
199
|
-
export
|
|
85
|
+
export interface Session {
|
|
86
|
+
policies: Policy[];
|
|
87
|
+
expiresAt: number;
|
|
88
|
+
metadataHash: JsFelt;
|
|
89
|
+
sessionKeyGuid: JsFelt;
|
|
90
|
+
guardianKeyGuid: JsFelt;
|
|
91
|
+
}
|
|
200
92
|
|
|
201
|
-
export
|
|
93
|
+
export interface Credentials {
|
|
94
|
+
authorization: JsFelt[];
|
|
95
|
+
privateKey: JsFelt;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
|
|
202
99
|
|
|
203
100
|
export interface AuthorizedSession {
|
|
204
101
|
session: Session;
|
|
@@ -211,33 +108,34 @@ export interface AuthorizedSession {
|
|
|
211
108
|
guardianKeyGuid: JsFelt;
|
|
212
109
|
}
|
|
213
110
|
|
|
214
|
-
export interface
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
111
|
+
export interface JsFeeEstimate {
|
|
112
|
+
l1_gas_consumed: number;
|
|
113
|
+
l1_gas_price: number;
|
|
114
|
+
l2_gas_consumed: number;
|
|
115
|
+
l2_gas_price: number;
|
|
116
|
+
l1_data_gas_consumed: number;
|
|
117
|
+
l1_data_gas_price: number;
|
|
118
|
+
overall_fee: number;
|
|
220
119
|
}
|
|
221
120
|
|
|
222
|
-
export
|
|
223
|
-
|
|
224
|
-
|
|
121
|
+
export type JsPriceUnit = "WEI" | "FRI";
|
|
122
|
+
|
|
123
|
+
export interface JsEstimateFeeDetails {
|
|
124
|
+
nonce: JsFelt;
|
|
225
125
|
}
|
|
226
126
|
|
|
127
|
+
export type JsRegister = RegisterInput;
|
|
128
|
+
|
|
129
|
+
export type JsRegisterResponse = ResponseData;
|
|
130
|
+
|
|
131
|
+
|
|
227
132
|
export class CartridgeAccount {
|
|
228
133
|
private constructor();
|
|
229
134
|
free(): void;
|
|
230
135
|
[Symbol.dispose](): void;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
* # Parameters
|
|
235
|
-
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
236
|
-
* - `address`: The blockchain address associated with the account.
|
|
237
|
-
* - `username`: Username associated with the account.
|
|
238
|
-
* - `owner`: A Owner struct containing the owner signer and associated data.
|
|
239
|
-
*/
|
|
240
|
-
static new(class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
136
|
+
disconnect(): Promise<void>;
|
|
137
|
+
deploySelf(max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
138
|
+
static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
|
|
241
139
|
/**
|
|
242
140
|
* Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
|
|
243
141
|
* The controller address is computed internally based on the generated signer.
|
|
@@ -247,32 +145,31 @@ export class CartridgeAccount {
|
|
|
247
145
|
* - `username`: Username associated with the account.
|
|
248
146
|
*/
|
|
249
147
|
static newHeadless(class_hash: JsFelt, rpc_url: string, username: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
250
|
-
static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
|
|
251
|
-
disconnect(): Promise<void>;
|
|
252
|
-
registerSession(app_id: string, policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
253
|
-
registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
|
|
254
|
-
upgrade(new_class_hash: JsFelt): Promise<JsCall>;
|
|
255
|
-
register(register: JsRegister): Promise<JsRegisterResponse>;
|
|
256
|
-
createSession(app_id: string, policies: Policy[], expires_at: bigint, authorize_user_execution?: boolean | null): Promise<AuthorizedSession | undefined>;
|
|
257
|
-
skipSession(app_id: string, policies: Policy[]): Promise<void>;
|
|
258
|
-
addOwner(owner?: Signer | null, signer_input?: JsAddSignerInput | null, rp_id?: string | null): Promise<void>;
|
|
259
148
|
removeOwner(signer: JsRemoveSignerInput): Promise<void>;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
264
|
-
executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
265
|
-
trySessionExecute(app_id: string, calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
266
|
-
isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
|
|
267
|
-
hasRequestedSession(app_id: string, policies: Policy[]): Promise<boolean>;
|
|
149
|
+
signMessage(typed_data: string): Promise<Felts>;
|
|
150
|
+
skipSession(app_id: string, policies: Policy[]): Promise<void>;
|
|
151
|
+
createSession(app_id: string, policies: Policy[], expires_at: bigint, authorize_user_execution?: boolean | null): Promise<AuthorizedSession | undefined>;
|
|
268
152
|
revokeSession(session: JsRevokableSession): Promise<void>;
|
|
269
153
|
revokeSessions(sessions: JsRevokableSession[]): Promise<void>;
|
|
270
|
-
signMessage(typed_data: string): Promise<Felts>;
|
|
271
|
-
getNonce(): Promise<any>;
|
|
272
|
-
deploySelf(max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
273
154
|
delegateAccount(): Promise<JsFelt>;
|
|
274
|
-
|
|
275
|
-
|
|
155
|
+
registerSession(app_id: string, policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
156
|
+
estimateInvokeFee(calls: JsCall[]): Promise<JsFeeEstimate>;
|
|
157
|
+
trySessionExecute(app_id: string, calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
158
|
+
createPasskeySigner(rp_id: string): Promise<JsAddSignerInput>;
|
|
159
|
+
hasRequestedSession(app_id: string, policies: Policy[]): Promise<boolean>;
|
|
160
|
+
executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
161
|
+
executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
162
|
+
/**
|
|
163
|
+
* Checks if there are stored policies for a given app_id.
|
|
164
|
+
*
|
|
165
|
+
* # Parameters
|
|
166
|
+
* - `app_id`: The application identifier to check for stored policies
|
|
167
|
+
*
|
|
168
|
+
* # Returns
|
|
169
|
+
* `true` if policies exist for the given app_id, `false` otherwise
|
|
170
|
+
*/
|
|
171
|
+
hasPoliciesForAppId(app_id: string): Promise<boolean>;
|
|
172
|
+
registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
|
|
276
173
|
/**
|
|
277
174
|
* Signs an OutsideExecution V3 transaction and returns both the OutsideExecution object and its signature.
|
|
278
175
|
*
|
|
@@ -283,56 +180,47 @@ export class CartridgeAccount {
|
|
|
283
180
|
* A `JsSignedOutsideExecution` containing the OutsideExecution V3 object and its signature
|
|
284
181
|
*/
|
|
285
182
|
signExecuteFromOutside(calls: JsCall[]): Promise<JsSignedOutsideExecution>;
|
|
183
|
+
isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
|
|
184
|
+
hasAuthorizedPoliciesForCalls(app_id: string, calls: JsCall[]): Promise<boolean>;
|
|
185
|
+
hasAuthorizedPoliciesForMessage(app_id: string, typed_data: string): Promise<boolean>;
|
|
286
186
|
/**
|
|
287
|
-
*
|
|
187
|
+
* Creates a new `CartridgeAccount` instance.
|
|
288
188
|
*
|
|
289
189
|
* # Parameters
|
|
290
|
-
* - `
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* `
|
|
190
|
+
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
191
|
+
* - `address`: The blockchain address associated with the account.
|
|
192
|
+
* - `username`: Username associated with the account.
|
|
193
|
+
* - `owner`: A Owner struct containing the owner signer and associated data.
|
|
294
194
|
*/
|
|
295
|
-
|
|
195
|
+
static new(class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
196
|
+
execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
|
|
197
|
+
upgrade(new_class_hash: JsFelt): Promise<JsCall>;
|
|
198
|
+
register(register: JsRegister): Promise<JsRegisterResponse>;
|
|
199
|
+
addOwner(owner?: Signer | null, signer_input?: JsAddSignerInput | null, rp_id?: string | null): Promise<void>;
|
|
200
|
+
getNonce(): Promise<any>;
|
|
296
201
|
}
|
|
297
|
-
|
|
298
|
-
* A type for accessing fixed attributes of `CartridgeAccount`.
|
|
299
|
-
*
|
|
300
|
-
* This type exists as concurrent mutable and immutable calls to `CartridgeAccount` are guarded
|
|
301
|
-
* with `WasmMutex`, which only operates under an `async` context. If these getters were directly
|
|
302
|
-
* implemented under `CartridgeAccount`:
|
|
303
|
-
*
|
|
304
|
-
* - calls to them would unnecessarily have to be `async` as well;
|
|
305
|
-
* - there would be excessive locking.
|
|
306
|
-
*
|
|
307
|
-
* This type is supposed to only ever be borrowed immutably. So no concurrent access control would
|
|
308
|
-
* be needed.
|
|
309
|
-
*/
|
|
202
|
+
|
|
310
203
|
export class CartridgeAccountMeta {
|
|
311
204
|
private constructor();
|
|
312
205
|
free(): void;
|
|
313
206
|
[Symbol.dispose](): void;
|
|
314
|
-
username(): string;
|
|
315
|
-
address(): string;
|
|
316
207
|
classHash(): string;
|
|
208
|
+
ownerGuid(): JsFelt;
|
|
209
|
+
owner(): Owner;
|
|
210
|
+
address(): string;
|
|
317
211
|
rpcUrl(): string;
|
|
318
212
|
chainId(): string;
|
|
319
|
-
|
|
320
|
-
ownerGuid(): JsFelt;
|
|
213
|
+
username(): string;
|
|
321
214
|
}
|
|
322
|
-
|
|
323
|
-
* A type used as the return type for constructing `CartridgeAccount` to provide an extra,
|
|
324
|
-
* separately borrowable `meta` field for synchronously accessing fixed fields.
|
|
325
|
-
*
|
|
326
|
-
* This type exists instead of simply having `CartridgeAccount::new()` return a tuple as tuples
|
|
327
|
-
* don't implement `IntoWasmAbi` which is needed for crossing JS-WASM boundary.
|
|
328
|
-
*/
|
|
215
|
+
|
|
329
216
|
export class CartridgeAccountWithMeta {
|
|
330
217
|
private constructor();
|
|
331
218
|
free(): void;
|
|
332
219
|
[Symbol.dispose](): void;
|
|
333
|
-
meta(): CartridgeAccountMeta;
|
|
334
220
|
intoAccount(): CartridgeAccount;
|
|
221
|
+
meta(): CartridgeAccountMeta;
|
|
335
222
|
}
|
|
223
|
+
|
|
336
224
|
export class ControllerFactory {
|
|
337
225
|
private constructor();
|
|
338
226
|
free(): void;
|
|
@@ -372,18 +260,93 @@ export class ControllerFactory {
|
|
|
372
260
|
*/
|
|
373
261
|
static apiLogin(username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
374
262
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
263
|
+
|
|
264
|
+
export enum ErrorCode {
|
|
265
|
+
StarknetFailedToReceiveTransaction = 1,
|
|
266
|
+
StarknetContractNotFound = 20,
|
|
267
|
+
StarknetBlockNotFound = 24,
|
|
268
|
+
StarknetInvalidTransactionIndex = 27,
|
|
269
|
+
StarknetClassHashNotFound = 28,
|
|
270
|
+
StarknetTransactionHashNotFound = 29,
|
|
271
|
+
StarknetPageSizeTooBig = 31,
|
|
272
|
+
StarknetNoBlocks = 32,
|
|
273
|
+
StarknetInvalidContinuationToken = 33,
|
|
274
|
+
StarknetTooManyKeysInFilter = 34,
|
|
275
|
+
StarknetContractError = 40,
|
|
276
|
+
StarknetTransactionExecutionError = 41,
|
|
277
|
+
StarknetClassAlreadyDeclared = 51,
|
|
278
|
+
StarknetInvalidTransactionNonce = 52,
|
|
279
|
+
StarknetInsufficientMaxFee = 53,
|
|
280
|
+
StarknetInsufficientAccountBalance = 54,
|
|
281
|
+
StarknetValidationFailure = 55,
|
|
282
|
+
StarknetCompilationFailed = 56,
|
|
283
|
+
StarknetContractClassSizeIsTooLarge = 57,
|
|
284
|
+
StarknetNonAccount = 58,
|
|
285
|
+
StarknetDuplicateTx = 59,
|
|
286
|
+
StarknetCompiledClassHashMismatch = 60,
|
|
287
|
+
StarknetUnsupportedTxVersion = 61,
|
|
288
|
+
StarknetUnsupportedContractClassVersion = 62,
|
|
289
|
+
StarknetUnexpectedError = 63,
|
|
290
|
+
StarknetNoTraceAvailable = 10,
|
|
291
|
+
StarknetReplacementTransactionUnderpriced = 64,
|
|
292
|
+
StarknetFeeBelowMinimum = 65,
|
|
293
|
+
SignError = 101,
|
|
294
|
+
StorageError = 102,
|
|
295
|
+
AccountFactoryError = 103,
|
|
296
|
+
PaymasterExecutionTimeNotReached = 104,
|
|
297
|
+
PaymasterExecutionTimePassed = 105,
|
|
298
|
+
PaymasterInvalidCaller = 106,
|
|
299
|
+
PaymasterRateLimitExceeded = 107,
|
|
300
|
+
PaymasterNotSupported = 108,
|
|
301
|
+
PaymasterHttp = 109,
|
|
302
|
+
PaymasterExcecution = 110,
|
|
303
|
+
PaymasterSerialization = 111,
|
|
304
|
+
CartridgeControllerNotDeployed = 112,
|
|
305
|
+
InsufficientBalance = 113,
|
|
306
|
+
OriginError = 114,
|
|
307
|
+
EncodingError = 115,
|
|
308
|
+
SerdeWasmBindgenError = 116,
|
|
309
|
+
CairoSerdeError = 117,
|
|
310
|
+
CairoShortStringToFeltError = 118,
|
|
311
|
+
DeviceCreateCredential = 119,
|
|
312
|
+
DeviceGetAssertion = 120,
|
|
313
|
+
DeviceBadAssertion = 121,
|
|
314
|
+
DeviceChannel = 122,
|
|
315
|
+
DeviceOrigin = 123,
|
|
316
|
+
AccountSigning = 124,
|
|
317
|
+
AccountProvider = 125,
|
|
318
|
+
AccountClassHashCalculation = 126,
|
|
319
|
+
AccountFeeOutOfRange = 128,
|
|
320
|
+
ProviderRateLimited = 129,
|
|
321
|
+
ProviderArrayLengthMismatch = 130,
|
|
322
|
+
ProviderOther = 131,
|
|
323
|
+
SessionAlreadyRegistered = 132,
|
|
324
|
+
UrlParseError = 133,
|
|
325
|
+
Base64DecodeError = 134,
|
|
326
|
+
CoseError = 135,
|
|
327
|
+
PolicyChainIdMismatch = 136,
|
|
328
|
+
InvalidOwner = 137,
|
|
329
|
+
GasPriceTooHigh = 138,
|
|
330
|
+
TransactionTimeout = 139,
|
|
331
|
+
ConversionError = 140,
|
|
332
|
+
InvalidChainId = 141,
|
|
333
|
+
SessionRefreshRequired = 142,
|
|
334
|
+
ManualExecutionRequired = 143,
|
|
335
|
+
ForbiddenEntrypoint = 144,
|
|
336
|
+
GasAmountTooHigh = 145,
|
|
337
|
+
ApproveExecutionRequired = 146,
|
|
338
|
+
}
|
|
339
|
+
|
|
378
340
|
export class JsChainConfig {
|
|
379
341
|
free(): void;
|
|
380
342
|
[Symbol.dispose](): void;
|
|
381
343
|
constructor(class_hash: JsFelt, rpc_url: string, owner: Owner, address?: JsFelt | null);
|
|
382
344
|
readonly class_hash: JsFelt;
|
|
383
|
-
readonly rpc_url: string;
|
|
384
345
|
readonly owner: Owner;
|
|
385
346
|
readonly address: JsFelt | undefined;
|
|
347
|
+
readonly rpc_url: string;
|
|
386
348
|
}
|
|
349
|
+
|
|
387
350
|
export class JsControllerError {
|
|
388
351
|
private constructor();
|
|
389
352
|
free(): void;
|
|
@@ -393,47 +356,68 @@ export class JsControllerError {
|
|
|
393
356
|
get data(): string | undefined;
|
|
394
357
|
set data(value: string | null | undefined);
|
|
395
358
|
}
|
|
359
|
+
|
|
396
360
|
export class LoginResult {
|
|
397
361
|
private constructor();
|
|
398
362
|
free(): void;
|
|
399
363
|
[Symbol.dispose](): void;
|
|
400
364
|
intoValues(): Array<any>;
|
|
401
365
|
}
|
|
402
|
-
|
|
403
|
-
* WASM bindings for MultiChainController
|
|
404
|
-
*/
|
|
366
|
+
|
|
405
367
|
export class MultiChainAccount {
|
|
406
368
|
private constructor();
|
|
407
369
|
free(): void;
|
|
408
370
|
[Symbol.dispose](): void;
|
|
409
371
|
/**
|
|
410
|
-
*
|
|
372
|
+
* Gets an account instance for a specific chain
|
|
411
373
|
*/
|
|
412
|
-
|
|
374
|
+
controller(chain_id: JsFelt): Promise<CartridgeAccount>;
|
|
413
375
|
/**
|
|
414
376
|
* Loads a MultiChainAccount from storage
|
|
415
377
|
*/
|
|
416
378
|
static fromStorage(cartridge_api_url: string): Promise<MultiChainAccount | undefined>;
|
|
417
|
-
/**
|
|
418
|
-
* Adds a new chain configuration
|
|
419
|
-
*/
|
|
420
|
-
addChain(config: JsChainConfig): Promise<void>;
|
|
421
379
|
/**
|
|
422
380
|
* Removes a chain configuration
|
|
423
381
|
*/
|
|
424
382
|
removeChain(chain_id: JsFelt): Promise<void>;
|
|
425
383
|
/**
|
|
426
|
-
*
|
|
384
|
+
* Creates a new MultiChainAccount with multiple chain configurations
|
|
427
385
|
*/
|
|
428
|
-
|
|
386
|
+
static create(username: string, chain_configs: JsChainConfig[], cartridge_api_url: string): Promise<MultiChainAccount>;
|
|
387
|
+
/**
|
|
388
|
+
* Adds a new chain configuration
|
|
389
|
+
*/
|
|
390
|
+
addChain(config: JsChainConfig): Promise<void>;
|
|
429
391
|
}
|
|
430
|
-
|
|
431
|
-
* Metadata for displaying multi-chain information
|
|
432
|
-
*/
|
|
392
|
+
|
|
433
393
|
export class MultiChainAccountMeta {
|
|
434
394
|
private constructor();
|
|
435
395
|
free(): void;
|
|
436
396
|
[Symbol.dispose](): void;
|
|
437
|
-
readonly username: string;
|
|
438
397
|
readonly chains: JsFelt[];
|
|
398
|
+
readonly username: string;
|
|
439
399
|
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Computes the Starknet contract address for a controller account without needing a full instance.
|
|
403
|
+
*
|
|
404
|
+
* # Arguments
|
|
405
|
+
*
|
|
406
|
+
* * `class_hash` - The class hash of the account contract (JsFelt).
|
|
407
|
+
* * `owner` - The owner configuration for the account.
|
|
408
|
+
* * `salt` - The salt used for address calculation (JsFelt).
|
|
409
|
+
*
|
|
410
|
+
* # Returns
|
|
411
|
+
*
|
|
412
|
+
* The computed Starknet contract address as a `JsFelt`.
|
|
413
|
+
*/
|
|
414
|
+
export function computeAccountAddress(class_hash: JsFelt, owner: Owner, salt: JsFelt): JsFelt;
|
|
415
|
+
|
|
416
|
+
export function signerToGuid(signer: Signer): JsFelt;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
|
|
420
|
+
* The goal of this function is to know from any place when the register session flow has been completed, and to
|
|
421
|
+
* get the authorization.
|
|
422
|
+
*/
|
|
423
|
+
export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;
|