@cartridge/controller-wasm 0.3.1 → 0.3.3

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.1",
3
+ "version": "0.3.3",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -83,6 +83,7 @@ export enum ErrorCode {
83
83
  GasPriceTooHigh = 138,
84
84
  TransactionTimeout = 139,
85
85
  ConversionError = 140,
86
+ InvalidChainId = 141,
86
87
  }
87
88
  export interface JsCall {
88
89
  contractAddress: JsFelt;
@@ -281,8 +282,12 @@ export class CartridgeAccountWithMeta {
281
282
  export class ControllerFactory {
282
283
  private constructor();
283
284
  free(): void;
284
- static from_storage(app_id: string, cartridge_api_url: string): CartridgeAccountWithMeta | undefined;
285
+ static fromStorage(app_id: string, cartridge_api_url: string): CartridgeAccountWithMeta | undefined;
285
286
  static login(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, address: JsFelt, owner: Owner, cartridge_api_url: string, session_expires_at_s: bigint, is_controller_registered?: boolean | null): Promise<LoginResult>;
287
+ /**
288
+ * This should only be used with webauthn signers
289
+ */
290
+ static apiLogin(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
286
291
  }
287
292
  export class JsControllerError {
288
293
  private constructor();
@@ -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_286(arg0, arg1, arg2, arg3) {
318
+ function __wbg_adapter_287(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 | 64 | 65 | 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 | 139 | 140}
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 | 64 | 65 | 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 | 139 | 140 | 141}
324
324
  */
325
325
  export const ErrorCode = Object.freeze({
326
326
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -390,6 +390,7 @@ export const ErrorCode = Object.freeze({
390
390
  GasPriceTooHigh: 138, "138": "GasPriceTooHigh",
391
391
  TransactionTimeout: 139, "139": "TransactionTimeout",
392
392
  ConversionError: 140, "140": "ConversionError",
393
+ InvalidChainId: 141, "141": "InvalidChainId",
393
394
  });
394
395
 
395
396
  const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
@@ -1014,7 +1015,7 @@ export class ControllerFactory {
1014
1015
  * @param {string} cartridge_api_url
1015
1016
  * @returns {CartridgeAccountWithMeta | undefined}
1016
1017
  */
1017
- static from_storage(app_id, cartridge_api_url) {
1018
+ static fromStorage(app_id, cartridge_api_url) {
1018
1019
  try {
1019
1020
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1020
1021
  const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -1058,6 +1059,30 @@ export class ControllerFactory {
1058
1059
  const ret = wasm.controllerfactory_login(ptr0, len0, ptr1, len1, addHeapObject(class_hash), ptr2, len2, addHeapObject(chain_id), addHeapObject(address), addHeapObject(owner), ptr3, len3, session_expires_at_s, isLikeNone(is_controller_registered) ? 0xFFFFFF : is_controller_registered ? 1 : 0);
1059
1060
  return takeObject(ret);
1060
1061
  }
1062
+ /**
1063
+ * This should only be used with webauthn signers
1064
+ * @param {string} app_id
1065
+ * @param {string} username
1066
+ * @param {JsFelt} class_hash
1067
+ * @param {string} rpc_url
1068
+ * @param {JsFelt} chain_id
1069
+ * @param {JsFelt} address
1070
+ * @param {Owner} owner
1071
+ * @param {string} cartridge_api_url
1072
+ * @returns {Promise<CartridgeAccountWithMeta>}
1073
+ */
1074
+ static apiLogin(app_id, username, class_hash, rpc_url, chain_id, address, owner, cartridge_api_url) {
1075
+ const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1076
+ const len0 = WASM_VECTOR_LEN;
1077
+ const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1078
+ const len1 = WASM_VECTOR_LEN;
1079
+ const ptr2 = passStringToWasm0(rpc_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1080
+ const len2 = WASM_VECTOR_LEN;
1081
+ const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1082
+ const len3 = WASM_VECTOR_LEN;
1083
+ const ret = wasm.controllerfactory_apiLogin(ptr0, len0, ptr1, len1, addHeapObject(class_hash), ptr2, len2, addHeapObject(chain_id), addHeapObject(address), addHeapObject(owner), ptr3, len3);
1084
+ return takeObject(ret);
1085
+ }
1061
1086
  }
1062
1087
 
1063
1088
  const JsControllerErrorFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1465,7 +1490,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1465
1490
  const a = state0.a;
1466
1491
  state0.a = 0;
1467
1492
  try {
1468
- return __wbg_adapter_286(a, state0.b, arg0, arg1);
1493
+ return __wbg_adapter_287(a, state0.b, arg0, arg1);
1469
1494
  } finally {
1470
1495
  state0.a = a;
1471
1496
  }
@@ -1807,18 +1832,18 @@ export function __wbindgen_cb_drop(arg0) {
1807
1832
  return ret;
1808
1833
  };
1809
1834
 
1810
- export function __wbindgen_closure_wrapper2570(arg0, arg1, arg2) {
1835
+ export function __wbindgen_closure_wrapper2599(arg0, arg1, arg2) {
1811
1836
  const ret = makeClosure(arg0, arg1, 33, __wbg_adapter_44);
1812
1837
  return addHeapObject(ret);
1813
1838
  };
1814
1839
 
1815
- export function __wbindgen_closure_wrapper8191(arg0, arg1, arg2) {
1816
- const ret = makeMutClosure(arg0, arg1, 871, __wbg_adapter_47);
1840
+ export function __wbindgen_closure_wrapper8294(arg0, arg1, arg2) {
1841
+ const ret = makeMutClosure(arg0, arg1, 880, __wbg_adapter_47);
1817
1842
  return addHeapObject(ret);
1818
1843
  };
1819
1844
 
1820
- export function __wbindgen_closure_wrapper8340(arg0, arg1, arg2) {
1821
- const ret = makeMutClosure(arg0, arg1, 905, __wbg_adapter_50);
1845
+ export function __wbindgen_closure_wrapper8443(arg0, arg1, arg2) {
1846
+ const ret = makeMutClosure(arg0, arg1, 914, __wbg_adapter_50);
1822
1847
  return addHeapObject(ret);
1823
1848
  };
1824
1849
 
Binary file
@@ -68,6 +68,7 @@ export enum ErrorCode {
68
68
  GasPriceTooHigh = 138,
69
69
  TransactionTimeout = 139,
70
70
  ConversionError = 140,
71
+ InvalidChainId = 141,
71
72
  }
72
73
  export interface JsCall {
73
74
  contractAddress: JsFelt;
@@ -252,7 +252,7 @@ function __wbg_adapter_201(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 | 64 | 65 | 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 | 139 | 140}
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 | 64 | 65 | 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 | 139 | 140 | 141}
256
256
  */
257
257
  export const ErrorCode = Object.freeze({
258
258
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -322,6 +322,7 @@ export const ErrorCode = Object.freeze({
322
322
  GasPriceTooHigh: 138, "138": "GasPriceTooHigh",
323
323
  TransactionTimeout: 139, "139": "TransactionTimeout",
324
324
  ConversionError: 140, "140": "ConversionError",
325
+ InvalidChainId: 141, "141": "InvalidChainId",
325
326
  });
326
327
 
327
328
  const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
@@ -1035,12 +1036,12 @@ export function __wbindgen_cb_drop(arg0) {
1035
1036
  return ret;
1036
1037
  };
1037
1038
 
1038
- export function __wbindgen_closure_wrapper3365(arg0, arg1, arg2) {
1039
+ export function __wbindgen_closure_wrapper3371(arg0, arg1, arg2) {
1039
1040
  const ret = makeMutClosure(arg0, arg1, 401, __wbg_adapter_42);
1040
1041
  return addHeapObject(ret);
1041
1042
  };
1042
1043
 
1043
- export function __wbindgen_closure_wrapper3501(arg0, arg1, arg2) {
1044
+ export function __wbindgen_closure_wrapper3507(arg0, arg1, arg2) {
1044
1045
  const ret = makeMutClosure(arg0, arg1, 436, __wbg_adapter_45);
1045
1046
  return addHeapObject(ret);
1046
1047
  };
Binary file