@cartridge/controller-wasm 0.7.14-3b036eb → 0.7.14-44f18f37

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