@cartridge/controller-wasm 0.2.4 → 0.2.5

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.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -78,6 +78,7 @@ export enum ErrorCode {
78
78
  CoseError = 135,
79
79
  PolicyChainIdMismatch = 136,
80
80
  InvalidOwner = 137,
81
+ GasPriceTooHigh = 138,
81
82
  }
82
83
  export interface JsCall {
83
84
  contractAddress: JsFelt;
@@ -194,6 +195,17 @@ export class CartridgeAccount {
194
195
  * - `owner`: A Owner struct containing the owner signer and associated data.
195
196
  */
196
197
  static new(app_id: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): CartridgeAccountWithMeta;
198
+ /**
199
+ * Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
200
+ * The controller address is computed internally based on the generated signer.
201
+ *
202
+ * # Parameters
203
+ * - `app_id`: Application identifier.
204
+ * - `rpc_url`: The URL of the JSON-RPC endpoint.
205
+ * - `chain_id`: Identifier of the blockchain network to interact with.
206
+ * - `username`: Username associated with the account.
207
+ */
208
+ static newHeadless(app_id: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, username: string, cartridge_api_url: string): CartridgeAccountWithMeta;
197
209
  static fromStorage(app_id: string, cartridge_api_url: string): CartridgeAccountWithMeta | undefined;
198
210
  disconnect(): Promise<void>;
199
211
  registerSession(policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
@@ -315,12 +315,12 @@ function __wbg_adapter_50(arg0, arg1, arg2) {
315
315
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
316
316
  }
317
317
 
318
- function __wbg_adapter_275(arg0, arg1, arg2, arg3) {
318
+ function __wbg_adapter_276(arg0, arg1, arg2, arg3) {
319
319
  wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
320
320
  }
321
321
 
322
322
  /**
323
- * @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137}
323
+ * @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138}
324
324
  */
325
325
  export const ErrorCode = Object.freeze({
326
326
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -385,6 +385,7 @@ export const ErrorCode = Object.freeze({
385
385
  CoseError: 135, "135": "CoseError",
386
386
  PolicyChainIdMismatch: 136, "136": "PolicyChainIdMismatch",
387
387
  InvalidOwner: 137, "137": "InvalidOwner",
388
+ GasPriceTooHigh: 138, "138": "GasPriceTooHigh",
388
389
  });
389
390
 
390
391
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -459,6 +460,46 @@ export class CartridgeAccount {
459
460
  wasm.__wbindgen_add_to_stack_pointer(16);
460
461
  }
461
462
  }
463
+ /**
464
+ * Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
465
+ * The controller address is computed internally based on the generated signer.
466
+ *
467
+ * # Parameters
468
+ * - `app_id`: Application identifier.
469
+ * - `rpc_url`: The URL of the JSON-RPC endpoint.
470
+ * - `chain_id`: Identifier of the blockchain network to interact with.
471
+ * - `username`: Username associated with the account.
472
+ * @param {string} app_id
473
+ * @param {JsFelt} class_hash
474
+ * @param {string} rpc_url
475
+ * @param {JsFelt} chain_id
476
+ * @param {string} username
477
+ * @param {string} cartridge_api_url
478
+ * @returns {CartridgeAccountWithMeta}
479
+ */
480
+ static newHeadless(app_id, class_hash, rpc_url, chain_id, username, cartridge_api_url) {
481
+ try {
482
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
483
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
484
+ const len0 = WASM_VECTOR_LEN;
485
+ const ptr1 = passStringToWasm0(rpc_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
486
+ const len1 = WASM_VECTOR_LEN;
487
+ const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
488
+ const len2 = WASM_VECTOR_LEN;
489
+ const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
490
+ const len3 = WASM_VECTOR_LEN;
491
+ wasm.cartridgeaccount_newHeadless(retptr, ptr0, len0, addHeapObject(class_hash), ptr1, len1, addHeapObject(chain_id), ptr2, len2, ptr3, len3);
492
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
493
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
494
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
495
+ if (r2) {
496
+ throw takeObject(r1);
497
+ }
498
+ return CartridgeAccountWithMeta.__wrap(r0);
499
+ } finally {
500
+ wasm.__wbindgen_add_to_stack_pointer(16);
501
+ }
502
+ }
462
503
  /**
463
504
  * @param {string} app_id
464
505
  * @param {string} cartridge_api_url
@@ -1296,7 +1337,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1296
1337
  const a = state0.a;
1297
1338
  state0.a = 0;
1298
1339
  try {
1299
- return __wbg_adapter_275(a, state0.b, arg0, arg1);
1340
+ return __wbg_adapter_276(a, state0.b, arg0, arg1);
1300
1341
  } finally {
1301
1342
  state0.a = a;
1302
1343
  }
@@ -1634,18 +1675,18 @@ export function __wbindgen_cb_drop(arg0) {
1634
1675
  return ret;
1635
1676
  };
1636
1677
 
1637
- export function __wbindgen_closure_wrapper1270(arg0, arg1, arg2) {
1638
- const ret = makeClosure(arg0, arg1, 25, __wbg_adapter_44);
1678
+ export function __wbindgen_closure_wrapper1273(arg0, arg1, arg2) {
1679
+ const ret = makeClosure(arg0, arg1, 26, __wbg_adapter_44);
1639
1680
  return addHeapObject(ret);
1640
1681
  };
1641
1682
 
1642
- export function __wbindgen_closure_wrapper5777(arg0, arg1, arg2) {
1643
- const ret = makeMutClosure(arg0, arg1, 674, __wbg_adapter_47);
1683
+ export function __wbindgen_closure_wrapper5787(arg0, arg1, arg2) {
1684
+ const ret = makeMutClosure(arg0, arg1, 676, __wbg_adapter_47);
1644
1685
  return addHeapObject(ret);
1645
1686
  };
1646
1687
 
1647
- export function __wbindgen_closure_wrapper5923(arg0, arg1, arg2) {
1648
- const ret = makeMutClosure(arg0, arg1, 707, __wbg_adapter_50);
1688
+ export function __wbindgen_closure_wrapper5933(arg0, arg1, arg2) {
1689
+ const ret = makeMutClosure(arg0, arg1, 709, __wbg_adapter_50);
1649
1690
  return addHeapObject(ret);
1650
1691
  };
1651
1692
 
Binary file
@@ -63,6 +63,7 @@ export enum ErrorCode {
63
63
  CoseError = 135,
64
64
  PolicyChainIdMismatch = 136,
65
65
  InvalidOwner = 137,
66
+ GasPriceTooHigh = 138,
66
67
  }
67
68
  export interface JsCall {
68
69
  contractAddress: JsFelt;
@@ -252,7 +252,7 @@ function __wbg_adapter_199(arg0, arg1, arg2, arg3) {
252
252
  }
253
253
 
254
254
  /**
255
- * @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137}
255
+ * @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138}
256
256
  */
257
257
  export const ErrorCode = Object.freeze({
258
258
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -317,6 +317,7 @@ export const ErrorCode = Object.freeze({
317
317
  CoseError: 135, "135": "CoseError",
318
318
  PolicyChainIdMismatch: 136, "136": "PolicyChainIdMismatch",
319
319
  InvalidOwner: 137, "137": "InvalidOwner",
320
+ GasPriceTooHigh: 138, "138": "GasPriceTooHigh",
320
321
  });
321
322
 
322
323
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -1024,12 +1025,12 @@ export function __wbindgen_cb_drop(arg0) {
1024
1025
  return ret;
1025
1026
  };
1026
1027
 
1027
- export function __wbindgen_closure_wrapper2833(arg0, arg1, arg2) {
1028
+ export function __wbindgen_closure_wrapper2837(arg0, arg1, arg2) {
1028
1029
  const ret = makeMutClosure(arg0, arg1, 361, __wbg_adapter_42);
1029
1030
  return addHeapObject(ret);
1030
1031
  };
1031
1032
 
1032
- export function __wbindgen_closure_wrapper2966(arg0, arg1, arg2) {
1033
+ export function __wbindgen_closure_wrapper2970(arg0, arg1, arg2) {
1033
1034
  const ret = makeMutClosure(arg0, arg1, 394, __wbg_adapter_45);
1034
1035
  return addHeapObject(ret);
1035
1036
  };
Binary file