@cartridge/controller-wasm 0.3.18 → 0.7.14-3d082f2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartridge/controller-wasm",
3
- "version": "0.3.18",
3
+ "version": "0.7.14-3d082f2",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -232,31 +232,29 @@ export class CartridgeAccount {
232
232
  * Creates a new `CartridgeAccount` instance.
233
233
  *
234
234
  * # Parameters
235
- * - `app_id`: Application identifier.
236
235
  * - `rpc_url`: The URL of the JSON-RPC endpoint.
237
236
  * - `address`: The blockchain address associated with the account.
238
237
  * - `username`: Username associated with the account.
239
238
  * - `owner`: A Owner struct containing the owner signer and associated data.
240
239
  */
241
- static new(app_id: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
240
+ static new(class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
242
241
  /**
243
242
  * Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
244
243
  * The controller address is computed internally based on the generated signer.
245
244
  *
246
245
  * # Parameters
247
- * - `app_id`: Application identifier.
248
246
  * - `rpc_url`: The URL of the JSON-RPC endpoint.
249
247
  * - `username`: Username associated with the account.
250
248
  */
251
- static newHeadless(app_id: string, class_hash: JsFelt, rpc_url: string, username: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
252
- static fromStorage(app_id: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
249
+ 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>;
253
251
  disconnect(): Promise<void>;
254
- registerSession(policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
252
+ registerSession(app_id: string, policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
255
253
  registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
256
254
  upgrade(new_class_hash: JsFelt): Promise<JsCall>;
257
255
  register(register: JsRegister): Promise<JsRegisterResponse>;
258
- createSession(policies: Policy[], expires_at: bigint, authorize_user_execution?: boolean | null): Promise<AuthorizedSession | undefined>;
259
- skipSession(policies: Policy[]): Promise<void>;
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>;
260
258
  addOwner(owner?: Signer | null, signer_input?: JsAddSignerInput | null, rp_id?: string | null): Promise<void>;
261
259
  removeOwner(signer: JsRemoveSignerInput): Promise<void>;
262
260
  createPasskeySigner(rp_id: string): Promise<JsAddSignerInput>;
@@ -264,17 +262,17 @@ export class CartridgeAccount {
264
262
  execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
265
263
  executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
266
264
  executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
267
- trySessionExecute(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
265
+ trySessionExecute(app_id: string, calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
268
266
  isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
269
- hasRequestedSession(policies: Policy[]): Promise<boolean>;
267
+ hasRequestedSession(app_id: string, policies: Policy[]): Promise<boolean>;
270
268
  revokeSession(session: JsRevokableSession): Promise<void>;
271
269
  revokeSessions(sessions: JsRevokableSession[]): Promise<void>;
272
270
  signMessage(typed_data: string): Promise<Felts>;
273
271
  getNonce(): Promise<any>;
274
272
  deploySelf(max_fee?: JsFeeEstimate | null): Promise<any>;
275
273
  delegateAccount(): Promise<JsFelt>;
276
- hasAuthorizedPoliciesForCalls(calls: JsCall[]): Promise<boolean>;
277
- hasAuthorizedPoliciesForMessage(typed_data: string): Promise<boolean>;
274
+ hasAuthorizedPoliciesForCalls(app_id: string, calls: JsCall[]): Promise<boolean>;
275
+ hasAuthorizedPoliciesForMessage(app_id: string, typed_data: string): Promise<boolean>;
278
276
  /**
279
277
  * Signs an OutsideExecution V3 transaction and returns both the OutsideExecution object and its signature.
280
278
  *
@@ -285,6 +283,16 @@ export class CartridgeAccount {
285
283
  * A `JsSignedOutsideExecution` containing the OutsideExecution V3 object and its signature
286
284
  */
287
285
  signExecuteFromOutside(calls: JsCall[]): Promise<JsSignedOutsideExecution>;
286
+ /**
287
+ * Checks if there are stored policies for a given app_id.
288
+ *
289
+ * # Parameters
290
+ * - `app_id`: The application identifier to check for stored policies
291
+ *
292
+ * # Returns
293
+ * `true` if policies exist for the given app_id, `false` otherwise
294
+ */
295
+ hasPoliciesForAppId(app_id: string): Promise<boolean>;
288
296
  }
289
297
  /**
290
298
  * A type for accessing fixed attributes of `CartridgeAccount`.
@@ -303,7 +311,6 @@ export class CartridgeAccountMeta {
303
311
  private constructor();
304
312
  free(): void;
305
313
  [Symbol.dispose](): void;
306
- appId(): string;
307
314
  username(): string;
308
315
  address(): string;
309
316
  classHash(): string;
@@ -330,7 +337,7 @@ export class ControllerFactory {
330
337
  private constructor();
331
338
  free(): void;
332
339
  [Symbol.dispose](): void;
333
- static fromStorage(app_id: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
340
+ static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
334
341
  /**
335
342
  * Login to an existing controller account.
336
343
  *
@@ -359,11 +366,11 @@ export class ControllerFactory {
359
366
  * 3. Handles WebAuthn signer updates when multiple signers are present
360
367
  * 4. Registers the session with Cartridge API if requested
361
368
  */
362
- static login(app_id: string, 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): Promise<LoginResult>;
369
+ 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>;
363
370
  /**
364
371
  * This should only be used with webauthn signers
365
372
  */
366
- static apiLogin(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
373
+ static apiLogin(username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
367
374
  }
368
375
  /**
369
376
  * JavaScript-friendly chain configuration
@@ -402,11 +409,11 @@ export class MultiChainAccount {
402
409
  /**
403
410
  * Creates a new MultiChainAccount with multiple chain configurations
404
411
  */
405
- static create(app_id: string, username: string, chain_configs: JsChainConfig[], cartridge_api_url: string): Promise<MultiChainAccount>;
412
+ static create(username: string, chain_configs: JsChainConfig[], cartridge_api_url: string): Promise<MultiChainAccount>;
406
413
  /**
407
414
  * Loads a MultiChainAccount from storage
408
415
  */
409
- static fromStorage(app_id: string, cartridge_api_url: string): Promise<MultiChainAccount | undefined>;
416
+ static fromStorage(cartridge_api_url: string): Promise<MultiChainAccount | undefined>;
410
417
  /**
411
418
  * Adds a new chain configuration
412
419
  */
@@ -427,7 +434,6 @@ export class MultiChainAccountMeta {
427
434
  private constructor();
428
435
  free(): void;
429
436
  [Symbol.dispose](): void;
430
- readonly app_id: string;
431
437
  readonly username: string;
432
438
  readonly chains: JsFelt[];
433
439
  }
@@ -359,20 +359,20 @@ export function signerToGuid(signer) {
359
359
  }
360
360
  }
361
361
 
362
- function __wasm_bindgen_func_elem_8699(arg0, arg1) {
363
- wasm.__wasm_bindgen_func_elem_8699(arg0, arg1);
362
+ function __wasm_bindgen_func_elem_8834(arg0, arg1, arg2) {
363
+ wasm.__wasm_bindgen_func_elem_8834(arg0, arg1, addHeapObject(arg2));
364
364
  }
365
365
 
366
- function __wasm_bindgen_func_elem_3189(arg0, arg1, arg2) {
367
- wasm.__wasm_bindgen_func_elem_3189(arg0, arg1, addHeapObject(arg2));
366
+ function __wasm_bindgen_func_elem_3186(arg0, arg1, arg2) {
367
+ wasm.__wasm_bindgen_func_elem_3186(arg0, arg1, addHeapObject(arg2));
368
368
  }
369
369
 
370
- function __wasm_bindgen_func_elem_8843(arg0, arg1, arg2) {
371
- wasm.__wasm_bindgen_func_elem_8843(arg0, arg1, addHeapObject(arg2));
370
+ function __wasm_bindgen_func_elem_8690(arg0, arg1) {
371
+ wasm.__wasm_bindgen_func_elem_8690(arg0, arg1);
372
372
  }
373
373
 
374
- function __wasm_bindgen_func_elem_10972(arg0, arg1, arg2, arg3) {
375
- wasm.__wasm_bindgen_func_elem_10972(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
374
+ function __wasm_bindgen_func_elem_10962(arg0, arg1, arg2, arg3) {
375
+ wasm.__wasm_bindgen_func_elem_10962(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
376
376
  }
377
377
 
378
378
  /**
@@ -489,12 +489,10 @@ export class CartridgeAccount {
489
489
  * Creates a new `CartridgeAccount` instance.
490
490
  *
491
491
  * # Parameters
492
- * - `app_id`: Application identifier.
493
492
  * - `rpc_url`: The URL of the JSON-RPC endpoint.
494
493
  * - `address`: The blockchain address associated with the account.
495
494
  * - `username`: Username associated with the account.
496
495
  * - `owner`: A Owner struct containing the owner signer and associated data.
497
- * @param {string} app_id
498
496
  * @param {JsFelt} class_hash
499
497
  * @param {string} rpc_url
500
498
  * @param {JsFelt} address
@@ -503,16 +501,14 @@ export class CartridgeAccount {
503
501
  * @param {string} cartridge_api_url
504
502
  * @returns {Promise<CartridgeAccountWithMeta>}
505
503
  */
506
- static new(app_id, class_hash, rpc_url, address, username, owner, cartridge_api_url) {
507
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
504
+ static new(class_hash, rpc_url, address, username, owner, cartridge_api_url) {
505
+ const ptr0 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
508
506
  const len0 = WASM_VECTOR_LEN;
509
- const ptr1 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
507
+ const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
510
508
  const len1 = WASM_VECTOR_LEN;
511
- const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
509
+ const ptr2 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
512
510
  const len2 = WASM_VECTOR_LEN;
513
- const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
514
- const len3 = WASM_VECTOR_LEN;
515
- const ret = wasm.cartridgeaccount_new(ptr0, len0, addHeapObject(class_hash), ptr1, len1, addHeapObject(address), ptr2, len2, addHeapObject(owner), ptr3, len3);
511
+ const ret = wasm.cartridgeaccount_new(addHeapObject(class_hash), ptr0, len0, addHeapObject(address), ptr1, len1, addHeapObject(owner), ptr2, len2);
516
512
  return takeObject(ret);
517
513
  }
518
514
  /**
@@ -520,39 +516,32 @@ export class CartridgeAccount {
520
516
  * The controller address is computed internally based on the generated signer.
521
517
  *
522
518
  * # Parameters
523
- * - `app_id`: Application identifier.
524
519
  * - `rpc_url`: The URL of the JSON-RPC endpoint.
525
520
  * - `username`: Username associated with the account.
526
- * @param {string} app_id
527
521
  * @param {JsFelt} class_hash
528
522
  * @param {string} rpc_url
529
523
  * @param {string} username
530
524
  * @param {string} cartridge_api_url
531
525
  * @returns {Promise<CartridgeAccountWithMeta>}
532
526
  */
533
- static newHeadless(app_id, class_hash, rpc_url, username, cartridge_api_url) {
534
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
527
+ static newHeadless(class_hash, rpc_url, username, cartridge_api_url) {
528
+ const ptr0 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
535
529
  const len0 = WASM_VECTOR_LEN;
536
- const ptr1 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
530
+ const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
537
531
  const len1 = WASM_VECTOR_LEN;
538
- const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
532
+ const ptr2 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
539
533
  const len2 = WASM_VECTOR_LEN;
540
- const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
541
- const len3 = WASM_VECTOR_LEN;
542
- const ret = wasm.cartridgeaccount_newHeadless(ptr0, len0, addHeapObject(class_hash), ptr1, len1, ptr2, len2, ptr3, len3);
534
+ const ret = wasm.cartridgeaccount_newHeadless(addHeapObject(class_hash), ptr0, len0, ptr1, len1, ptr2, len2);
543
535
  return takeObject(ret);
544
536
  }
545
537
  /**
546
- * @param {string} app_id
547
538
  * @param {string} cartridge_api_url
548
539
  * @returns {Promise<CartridgeAccountWithMeta | undefined>}
549
540
  */
550
- static fromStorage(app_id, cartridge_api_url) {
551
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
541
+ static fromStorage(cartridge_api_url) {
542
+ const ptr0 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
552
543
  const len0 = WASM_VECTOR_LEN;
553
- const ptr1 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
554
- const len1 = WASM_VECTOR_LEN;
555
- const ret = wasm.cartridgeaccount_fromStorage(ptr0, len0, ptr1, len1);
544
+ const ret = wasm.cartridgeaccount_fromStorage(ptr0, len0);
556
545
  return takeObject(ret);
557
546
  }
558
547
  /**
@@ -563,16 +552,19 @@ export class CartridgeAccount {
563
552
  return takeObject(ret);
564
553
  }
565
554
  /**
555
+ * @param {string} app_id
566
556
  * @param {Policy[]} policies
567
557
  * @param {bigint} expires_at
568
558
  * @param {JsFelt} public_key
569
559
  * @param {JsFeeEstimate | null} [max_fee]
570
560
  * @returns {Promise<any>}
571
561
  */
572
- registerSession(policies, expires_at, public_key, max_fee) {
573
- const ptr0 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
562
+ registerSession(app_id, policies, expires_at, public_key, max_fee) {
563
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
574
564
  const len0 = WASM_VECTOR_LEN;
575
- const ret = wasm.cartridgeaccount_registerSession(this.__wbg_ptr, ptr0, len0, expires_at, addHeapObject(public_key), isLikeNone(max_fee) ? 0 : addHeapObject(max_fee));
565
+ const ptr1 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
566
+ const len1 = WASM_VECTOR_LEN;
567
+ const ret = wasm.cartridgeaccount_registerSession(this.__wbg_ptr, ptr0, len0, ptr1, len1, expires_at, addHeapObject(public_key), isLikeNone(max_fee) ? 0 : addHeapObject(max_fee));
576
568
  return takeObject(ret);
577
569
  }
578
570
  /**
@@ -604,25 +596,31 @@ export class CartridgeAccount {
604
596
  return takeObject(ret);
605
597
  }
606
598
  /**
599
+ * @param {string} app_id
607
600
  * @param {Policy[]} policies
608
601
  * @param {bigint} expires_at
609
602
  * @param {boolean | null} [authorize_user_execution]
610
603
  * @returns {Promise<AuthorizedSession | undefined>}
611
604
  */
612
- createSession(policies, expires_at, authorize_user_execution) {
613
- const ptr0 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
605
+ createSession(app_id, policies, expires_at, authorize_user_execution) {
606
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
614
607
  const len0 = WASM_VECTOR_LEN;
615
- const ret = wasm.cartridgeaccount_createSession(this.__wbg_ptr, ptr0, len0, expires_at, isLikeNone(authorize_user_execution) ? 0xFFFFFF : authorize_user_execution ? 1 : 0);
608
+ const ptr1 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
609
+ const len1 = WASM_VECTOR_LEN;
610
+ const ret = wasm.cartridgeaccount_createSession(this.__wbg_ptr, ptr0, len0, ptr1, len1, expires_at, isLikeNone(authorize_user_execution) ? 0xFFFFFF : authorize_user_execution ? 1 : 0);
616
611
  return takeObject(ret);
617
612
  }
618
613
  /**
614
+ * @param {string} app_id
619
615
  * @param {Policy[]} policies
620
616
  * @returns {Promise<void>}
621
617
  */
622
- skipSession(policies) {
623
- const ptr0 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
618
+ skipSession(app_id, policies) {
619
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
624
620
  const len0 = WASM_VECTOR_LEN;
625
- const ret = wasm.cartridgeaccount_skipSession(this.__wbg_ptr, ptr0, len0);
621
+ const ptr1 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
622
+ const len1 = WASM_VECTOR_LEN;
623
+ const ret = wasm.cartridgeaccount_skipSession(this.__wbg_ptr, ptr0, len0, ptr1, len1);
626
624
  return takeObject(ret);
627
625
  }
628
626
  /**
@@ -700,14 +698,17 @@ export class CartridgeAccount {
700
698
  return takeObject(ret);
701
699
  }
702
700
  /**
701
+ * @param {string} app_id
703
702
  * @param {JsCall[]} calls
704
703
  * @param {JsFeeSource | null} [fee_source]
705
704
  * @returns {Promise<any>}
706
705
  */
707
- trySessionExecute(calls, fee_source) {
708
- const ptr0 = passArrayJsValueToWasm0(calls, wasm.__wbindgen_export);
706
+ trySessionExecute(app_id, calls, fee_source) {
707
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
709
708
  const len0 = WASM_VECTOR_LEN;
710
- const ret = wasm.cartridgeaccount_trySessionExecute(this.__wbg_ptr, ptr0, len0, isLikeNone(fee_source) ? 0 : addHeapObject(fee_source));
709
+ const ptr1 = passArrayJsValueToWasm0(calls, wasm.__wbindgen_export);
710
+ const len1 = WASM_VECTOR_LEN;
711
+ const ret = wasm.cartridgeaccount_trySessionExecute(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(fee_source) ? 0 : addHeapObject(fee_source));
711
712
  return takeObject(ret);
712
713
  }
713
714
  /**
@@ -722,13 +723,16 @@ export class CartridgeAccount {
722
723
  return takeObject(ret);
723
724
  }
724
725
  /**
726
+ * @param {string} app_id
725
727
  * @param {Policy[]} policies
726
728
  * @returns {Promise<boolean>}
727
729
  */
728
- hasRequestedSession(policies) {
729
- const ptr0 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
730
+ hasRequestedSession(app_id, policies) {
731
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
730
732
  const len0 = WASM_VECTOR_LEN;
731
- const ret = wasm.cartridgeaccount_hasRequestedSession(this.__wbg_ptr, ptr0, len0);
733
+ const ptr1 = passArrayJsValueToWasm0(policies, wasm.__wbindgen_export);
734
+ const len1 = WASM_VECTOR_LEN;
735
+ const ret = wasm.cartridgeaccount_hasRequestedSession(this.__wbg_ptr, ptr0, len0, ptr1, len1);
732
736
  return takeObject(ret);
733
737
  }
734
738
  /**
@@ -782,23 +786,29 @@ export class CartridgeAccount {
782
786
  return takeObject(ret);
783
787
  }
784
788
  /**
789
+ * @param {string} app_id
785
790
  * @param {JsCall[]} calls
786
791
  * @returns {Promise<boolean>}
787
792
  */
788
- hasAuthorizedPoliciesForCalls(calls) {
789
- const ptr0 = passArrayJsValueToWasm0(calls, wasm.__wbindgen_export);
793
+ hasAuthorizedPoliciesForCalls(app_id, calls) {
794
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
790
795
  const len0 = WASM_VECTOR_LEN;
791
- const ret = wasm.cartridgeaccount_hasAuthorizedPoliciesForCalls(this.__wbg_ptr, ptr0, len0);
796
+ const ptr1 = passArrayJsValueToWasm0(calls, wasm.__wbindgen_export);
797
+ const len1 = WASM_VECTOR_LEN;
798
+ const ret = wasm.cartridgeaccount_hasAuthorizedPoliciesForCalls(this.__wbg_ptr, ptr0, len0, ptr1, len1);
792
799
  return takeObject(ret);
793
800
  }
794
801
  /**
802
+ * @param {string} app_id
795
803
  * @param {string} typed_data
796
804
  * @returns {Promise<boolean>}
797
805
  */
798
- hasAuthorizedPoliciesForMessage(typed_data) {
799
- const ptr0 = passStringToWasm0(typed_data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
806
+ hasAuthorizedPoliciesForMessage(app_id, typed_data) {
807
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
800
808
  const len0 = WASM_VECTOR_LEN;
801
- const ret = wasm.cartridgeaccount_hasAuthorizedPoliciesForMessage(this.__wbg_ptr, ptr0, len0);
809
+ const ptr1 = passStringToWasm0(typed_data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
810
+ const len1 = WASM_VECTOR_LEN;
811
+ const ret = wasm.cartridgeaccount_hasAuthorizedPoliciesForMessage(this.__wbg_ptr, ptr0, len0, ptr1, len1);
802
812
  return takeObject(ret);
803
813
  }
804
814
  /**
@@ -818,6 +828,23 @@ export class CartridgeAccount {
818
828
  const ret = wasm.cartridgeaccount_signExecuteFromOutside(this.__wbg_ptr, ptr0, len0);
819
829
  return takeObject(ret);
820
830
  }
831
+ /**
832
+ * Checks if there are stored policies for a given app_id.
833
+ *
834
+ * # Parameters
835
+ * - `app_id`: The application identifier to check for stored policies
836
+ *
837
+ * # Returns
838
+ * `true` if policies exist for the given app_id, `false` otherwise
839
+ * @param {string} app_id
840
+ * @returns {Promise<boolean>}
841
+ */
842
+ hasPoliciesForAppId(app_id) {
843
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
844
+ const len0 = WASM_VECTOR_LEN;
845
+ const ret = wasm.cartridgeaccount_hasPoliciesForAppId(this.__wbg_ptr, ptr0, len0);
846
+ return takeObject(ret);
847
+ }
821
848
  }
822
849
  if (Symbol.dispose) CartridgeAccount.prototype[Symbol.dispose] = CartridgeAccount.prototype.free;
823
850
 
@@ -858,25 +885,6 @@ export class CartridgeAccountMeta {
858
885
  const ptr = this.__destroy_into_raw();
859
886
  wasm.__wbg_cartridgeaccountmeta_free(ptr, 0);
860
887
  }
861
- /**
862
- * @returns {string}
863
- */
864
- appId() {
865
- let deferred1_0;
866
- let deferred1_1;
867
- try {
868
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
869
- wasm.cartridgeaccountmeta_appId(retptr, this.__wbg_ptr);
870
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
871
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
872
- deferred1_0 = r0;
873
- deferred1_1 = r1;
874
- return getStringFromWasm0(r0, r1);
875
- } finally {
876
- wasm.__wbindgen_add_to_stack_pointer(16);
877
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
878
- }
879
- }
880
888
  /**
881
889
  * @returns {string}
882
890
  */
@@ -1056,16 +1064,13 @@ export class ControllerFactory {
1056
1064
  wasm.__wbg_controllerfactory_free(ptr, 0);
1057
1065
  }
1058
1066
  /**
1059
- * @param {string} app_id
1060
1067
  * @param {string} cartridge_api_url
1061
1068
  * @returns {Promise<CartridgeAccountWithMeta | undefined>}
1062
1069
  */
1063
- static fromStorage(app_id, cartridge_api_url) {
1064
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1070
+ static fromStorage(cartridge_api_url) {
1071
+ const ptr0 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1065
1072
  const len0 = WASM_VECTOR_LEN;
1066
- const ptr1 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1067
- const len1 = WASM_VECTOR_LEN;
1068
- const ret = wasm.controllerfactory_fromStorage(ptr0, len0, ptr1, len1);
1073
+ const ret = wasm.controllerfactory_fromStorage(ptr0, len0);
1069
1074
  return takeObject(ret);
1070
1075
  }
1071
1076
  /**
@@ -1095,7 +1100,6 @@ export class ControllerFactory {
1095
1100
  * 2. Calls `Controller::new` and optionally `create_wildcard_session`
1096
1101
  * 3. Handles WebAuthn signer updates when multiple signers are present
1097
1102
  * 4. Registers the session with Cartridge API if requested
1098
- * @param {string} app_id
1099
1103
  * @param {string} username
1100
1104
  * @param {JsFelt} class_hash
1101
1105
  * @param {string} rpc_url
@@ -1105,23 +1109,23 @@ export class ControllerFactory {
1105
1109
  * @param {bigint} session_expires_at_s
1106
1110
  * @param {boolean | null} [is_controller_registered]
1107
1111
  * @param {boolean | null} [create_wildcard_session]
1112
+ * @param {string | null} [app_id]
1108
1113
  * @returns {Promise<LoginResult>}
1109
1114
  */
1110
- static login(app_id, username, class_hash, rpc_url, address, owner, cartridge_api_url, session_expires_at_s, is_controller_registered, create_wildcard_session) {
1111
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1115
+ static login(username, class_hash, rpc_url, address, owner, cartridge_api_url, session_expires_at_s, is_controller_registered, create_wildcard_session, app_id) {
1116
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1112
1117
  const len0 = WASM_VECTOR_LEN;
1113
- const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1118
+ const ptr1 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1114
1119
  const len1 = WASM_VECTOR_LEN;
1115
- const ptr2 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1120
+ const ptr2 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1116
1121
  const len2 = WASM_VECTOR_LEN;
1117
- const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1118
- const len3 = WASM_VECTOR_LEN;
1119
- const ret = wasm.controllerfactory_login(ptr0, len0, ptr1, len1, addHeapObject(class_hash), ptr2, len2, addHeapObject(address), addHeapObject(owner), ptr3, len3, session_expires_at_s, isLikeNone(is_controller_registered) ? 0xFFFFFF : is_controller_registered ? 1 : 0, isLikeNone(create_wildcard_session) ? 0xFFFFFF : create_wildcard_session ? 1 : 0);
1122
+ var ptr3 = isLikeNone(app_id) ? 0 : passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1123
+ var len3 = WASM_VECTOR_LEN;
1124
+ const ret = wasm.controllerfactory_login(ptr0, len0, addHeapObject(class_hash), ptr1, len1, addHeapObject(address), addHeapObject(owner), ptr2, len2, session_expires_at_s, isLikeNone(is_controller_registered) ? 0xFFFFFF : is_controller_registered ? 1 : 0, isLikeNone(create_wildcard_session) ? 0xFFFFFF : create_wildcard_session ? 1 : 0, ptr3, len3);
1120
1125
  return takeObject(ret);
1121
1126
  }
1122
1127
  /**
1123
1128
  * This should only be used with webauthn signers
1124
- * @param {string} app_id
1125
1129
  * @param {string} username
1126
1130
  * @param {JsFelt} class_hash
1127
1131
  * @param {string} rpc_url
@@ -1130,16 +1134,14 @@ export class ControllerFactory {
1130
1134
  * @param {string} cartridge_api_url
1131
1135
  * @returns {Promise<CartridgeAccountWithMeta>}
1132
1136
  */
1133
- static apiLogin(app_id, username, class_hash, rpc_url, address, owner, cartridge_api_url) {
1134
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1137
+ static apiLogin(username, class_hash, rpc_url, address, owner, cartridge_api_url) {
1138
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1135
1139
  const len0 = WASM_VECTOR_LEN;
1136
- const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1140
+ const ptr1 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1137
1141
  const len1 = WASM_VECTOR_LEN;
1138
- const ptr2 = passStringToWasm0(rpc_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1142
+ const ptr2 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1139
1143
  const len2 = WASM_VECTOR_LEN;
1140
- const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1141
- const len3 = WASM_VECTOR_LEN;
1142
- const ret = wasm.controllerfactory_apiLogin(ptr0, len0, ptr1, len1, addHeapObject(class_hash), ptr2, len2, addHeapObject(address), addHeapObject(owner), ptr3, len3);
1144
+ const ret = wasm.controllerfactory_apiLogin(ptr0, len0, addHeapObject(class_hash), ptr1, len1, addHeapObject(address), addHeapObject(owner), ptr2, len2);
1143
1145
  return takeObject(ret);
1144
1146
  }
1145
1147
  }
@@ -1388,36 +1390,30 @@ export class MultiChainAccount {
1388
1390
  }
1389
1391
  /**
1390
1392
  * Creates a new MultiChainAccount with multiple chain configurations
1391
- * @param {string} app_id
1392
1393
  * @param {string} username
1393
1394
  * @param {JsChainConfig[]} chain_configs
1394
1395
  * @param {string} cartridge_api_url
1395
1396
  * @returns {Promise<MultiChainAccount>}
1396
1397
  */
1397
- static create(app_id, username, chain_configs, cartridge_api_url) {
1398
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1398
+ static create(username, chain_configs, cartridge_api_url) {
1399
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1399
1400
  const len0 = WASM_VECTOR_LEN;
1400
- const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1401
+ const ptr1 = passArrayJsValueToWasm0(chain_configs, wasm.__wbindgen_export);
1401
1402
  const len1 = WASM_VECTOR_LEN;
1402
- const ptr2 = passArrayJsValueToWasm0(chain_configs, wasm.__wbindgen_export);
1403
+ const ptr2 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1403
1404
  const len2 = WASM_VECTOR_LEN;
1404
- const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1405
- const len3 = WASM_VECTOR_LEN;
1406
- const ret = wasm.multichainaccount_create(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1405
+ const ret = wasm.multichainaccount_create(ptr0, len0, ptr1, len1, ptr2, len2);
1407
1406
  return takeObject(ret);
1408
1407
  }
1409
1408
  /**
1410
1409
  * Loads a MultiChainAccount from storage
1411
- * @param {string} app_id
1412
1410
  * @param {string} cartridge_api_url
1413
1411
  * @returns {Promise<MultiChainAccount | undefined>}
1414
1412
  */
1415
- static fromStorage(app_id, cartridge_api_url) {
1416
- const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1413
+ static fromStorage(cartridge_api_url) {
1414
+ const ptr0 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1417
1415
  const len0 = WASM_VECTOR_LEN;
1418
- const ptr1 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1419
- const len1 = WASM_VECTOR_LEN;
1420
- const ret = wasm.multichainaccount_fromStorage(ptr0, len0, ptr1, len1);
1416
+ const ret = wasm.multichainaccount_fromStorage(ptr0, len0);
1421
1417
  return takeObject(ret);
1422
1418
  }
1423
1419
  /**
@@ -1471,25 +1467,6 @@ export class MultiChainAccountMeta {
1471
1467
  const ptr = this.__destroy_into_raw();
1472
1468
  wasm.__wbg_multichainaccountmeta_free(ptr, 0);
1473
1469
  }
1474
- /**
1475
- * @returns {string}
1476
- */
1477
- get app_id() {
1478
- let deferred1_0;
1479
- let deferred1_1;
1480
- try {
1481
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1482
- wasm.multichainaccountmeta_app_id(retptr, this.__wbg_ptr);
1483
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1484
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1485
- deferred1_0 = r0;
1486
- deferred1_1 = r1;
1487
- return getStringFromWasm0(r0, r1);
1488
- } finally {
1489
- wasm.__wbindgen_add_to_stack_pointer(16);
1490
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1491
- }
1492
- }
1493
1470
  /**
1494
1471
  * @returns {string}
1495
1472
  */
@@ -1898,7 +1875,7 @@ export function __wbg_new_3c3d849046688a66(arg0, arg1) {
1898
1875
  const a = state0.a;
1899
1876
  state0.a = 0;
1900
1877
  try {
1901
- return __wasm_bindgen_func_elem_10972(a, state0.b, arg0, arg1);
1878
+ return __wasm_bindgen_func_elem_10962(a, state0.b, arg0, arg1);
1902
1879
  } finally {
1903
1880
  state0.a = a;
1904
1881
  }
@@ -2238,13 +2215,13 @@ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
2238
2215
 
2239
2216
  export function __wbindgen_cast_4082834687a71a5d(arg0, arg1) {
2240
2217
  // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
2241
- const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_225, __wasm_bindgen_func_elem_3189);
2218
+ const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_225, __wasm_bindgen_func_elem_3186);
2242
2219
  return addHeapObject(ret);
2243
2220
  };
2244
2221
 
2245
- export function __wbindgen_cast_448d871898ab3e4e(arg0, arg1) {
2246
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1001, function: Function { arguments: [Externref], shim_idx: 1002, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2247
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8828, __wasm_bindgen_func_elem_8843);
2222
+ export function __wbindgen_cast_838747baf6b6553b(arg0, arg1) {
2223
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1004, function: Function { arguments: [Externref], shim_idx: 1005, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2224
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8819, __wasm_bindgen_func_elem_8834);
2248
2225
  return addHeapObject(ret);
2249
2226
  };
2250
2227
 
@@ -2254,6 +2231,12 @@ export function __wbindgen_cast_9ae0607507abb057(arg0) {
2254
2231
  return addHeapObject(ret);
2255
2232
  };
2256
2233
 
2234
+ export function __wbindgen_cast_a572ca3f1306512c(arg0, arg1) {
2235
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 971, function: Function { arguments: [], shim_idx: 972, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2236
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8681, __wasm_bindgen_func_elem_8690);
2237
+ return addHeapObject(ret);
2238
+ };
2239
+
2257
2240
  export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
2258
2241
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
2259
2242
  const ret = getArrayU8FromWasm0(arg0, arg1);
@@ -2266,12 +2249,6 @@ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
2266
2249
  return addHeapObject(ret);
2267
2250
  };
2268
2251
 
2269
- export function __wbindgen_cast_f8c41a10414abe07(arg0, arg1) {
2270
- // Cast intrinsic for `Closure(Closure { dtor_idx: 968, function: Function { arguments: [], shim_idx: 969, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2271
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_8690, __wasm_bindgen_func_elem_8699);
2272
- return addHeapObject(ret);
2273
- };
2274
-
2275
2252
  export function __wbindgen_object_clone_ref(arg0) {
2276
2253
  const ret = getObject(arg0);
2277
2254
  return addHeapObject(ret);
Binary file
@@ -286,16 +286,16 @@ export function signerToGuid(signer) {
286
286
  }
287
287
  }
288
288
 
289
- function __wasm_bindgen_func_elem_4063(arg0, arg1, arg2) {
290
- wasm.__wasm_bindgen_func_elem_4063(arg0, arg1, addHeapObject(arg2));
289
+ function __wasm_bindgen_func_elem_3921(arg0, arg1) {
290
+ wasm.__wasm_bindgen_func_elem_3921(arg0, arg1);
291
291
  }
292
292
 
293
- function __wasm_bindgen_func_elem_3924(arg0, arg1) {
294
- wasm.__wasm_bindgen_func_elem_3924(arg0, arg1);
293
+ function __wasm_bindgen_func_elem_4060(arg0, arg1, arg2) {
294
+ wasm.__wasm_bindgen_func_elem_4060(arg0, arg1, addHeapObject(arg2));
295
295
  }
296
296
 
297
- function __wasm_bindgen_func_elem_5876(arg0, arg1, arg2, arg3) {
298
- wasm.__wasm_bindgen_func_elem_5876(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
297
+ function __wasm_bindgen_func_elem_5872(arg0, arg1, arg2, arg3) {
298
+ wasm.__wasm_bindgen_func_elem_5872(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
299
299
  }
300
300
 
301
301
  /**
@@ -890,7 +890,7 @@ export function __wbg_new_3c3d849046688a66(arg0, arg1) {
890
890
  const a = state0.a;
891
891
  state0.a = 0;
892
892
  try {
893
- return __wasm_bindgen_func_elem_5876(a, state0.b, arg0, arg1);
893
+ return __wasm_bindgen_func_elem_5872(a, state0.b, arg0, arg1);
894
894
  } finally {
895
895
  state0.a = a;
896
896
  }
@@ -1172,7 +1172,7 @@ export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
1172
1172
 
1173
1173
  export function __wbindgen_cast_84b1c647b29b7771(arg0, arg1) {
1174
1174
  // Cast intrinsic for `Closure(Closure { dtor_idx: 491, function: Function { arguments: [Externref], shim_idx: 492, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1175
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4048, __wasm_bindgen_func_elem_4063);
1175
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4045, __wasm_bindgen_func_elem_4060);
1176
1176
  return addHeapObject(ret);
1177
1177
  };
1178
1178
 
@@ -1184,7 +1184,7 @@ export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
1184
1184
 
1185
1185
  export function __wbindgen_cast_cbae8fdbdf7d2814(arg0, arg1) {
1186
1186
  // Cast intrinsic for `Closure(Closure { dtor_idx: 458, function: Function { arguments: [], shim_idx: 459, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1187
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3915, __wasm_bindgen_func_elem_3924);
1187
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3912, __wasm_bindgen_func_elem_3921);
1188
1188
  return addHeapObject(ret);
1189
1189
  };
1190
1190
 
Binary file