@cartridge/controller-wasm 0.3.4 → 0.3.6

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.4",
3
+ "version": "0.3.6",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -1,6 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function signerToGuid(signer: Signer): JsFelt;
4
3
  /**
5
4
  * Computes the Starknet contract address for a controller account without needing a full instance.
6
5
  *
@@ -15,6 +14,13 @@ export function signerToGuid(signer: Signer): JsFelt;
15
14
  * The computed Starknet contract address as a `JsFelt`.
16
15
  */
17
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;
18
24
  export enum ErrorCode {
19
25
  StarknetFailedToReceiveTransaction = 1,
20
26
  StarknetContractNotFound = 20,
@@ -179,7 +185,7 @@ export type Felts = JsFelt[];
179
185
 
180
186
  export type JsFeeSource = "PAYMASTER" | "CREDITS";
181
187
 
182
- export type JsSubscribeSessionResult = ResponseData;
188
+ export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
183
189
 
184
190
  export type JsRevokableSession = RevokableSession;
185
191
 
@@ -258,7 +264,6 @@ export class CartridgeAccount {
258
264
  delegateAccount(): Promise<JsFelt>;
259
265
  hasAuthorizedPoliciesForCalls(calls: JsCall[]): Promise<boolean>;
260
266
  hasAuthorizedPoliciesForMessage(typed_data: string): Promise<boolean>;
261
- subscribeCreateSession(controller_id: string, session_key_guid: JsFelt): Promise<JsSubscribeSessionResult>;
262
267
  /**
263
268
  * Signs an OutsideExecution V3 transaction and returns both the OutsideExecution object and its signature.
264
269
  *
@@ -278,15 +278,6 @@ function passArrayJsValueToWasm0(array, malloc) {
278
278
  WASM_VECTOR_LEN = array.length;
279
279
  return ptr;
280
280
  }
281
- /**
282
- * @param {Signer} signer
283
- * @returns {JsFelt}
284
- */
285
- export function signerToGuid(signer) {
286
- const ret = wasm.signerToGuid(addHeapObject(signer));
287
- return takeObject(ret);
288
- }
289
-
290
281
  /**
291
282
  * Computes the Starknet contract address for a controller account without needing a full instance.
292
283
  *
@@ -320,6 +311,30 @@ export function computeAccountAddress(class_hash, owner, salt) {
320
311
  }
321
312
  }
322
313
 
314
+ /**
315
+ * Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
316
+ * The goal of this function is to know from any place when the register session flow has been completed, and to
317
+ * get the authorization.
318
+ * @param {JsFelt} session_key_guid
319
+ * @param {string} cartridge_api_url
320
+ * @returns {Promise<JsSubscribeSessionResult>}
321
+ */
322
+ export function subscribeCreateSession(session_key_guid, cartridge_api_url) {
323
+ const ptr0 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ const ret = wasm.subscribeCreateSession(addHeapObject(session_key_guid), ptr0, len0);
326
+ return takeObject(ret);
327
+ }
328
+
329
+ /**
330
+ * @param {Signer} signer
331
+ * @returns {JsFelt}
332
+ */
333
+ export function signerToGuid(signer) {
334
+ const ret = wasm.signerToGuid(addHeapObject(signer));
335
+ return takeObject(ret);
336
+ }
337
+
323
338
  function __wbg_adapter_38(arg0, arg1, arg2) {
324
339
  wasm.__wbindgen_export_5(arg0, arg1, addHeapObject(arg2));
325
340
  }
@@ -782,17 +797,6 @@ export class CartridgeAccount {
782
797
  const ret = wasm.cartridgeaccount_hasAuthorizedPoliciesForMessage(this.__wbg_ptr, ptr0, len0);
783
798
  return takeObject(ret);
784
799
  }
785
- /**
786
- * @param {string} controller_id
787
- * @param {JsFelt} session_key_guid
788
- * @returns {Promise<JsSubscribeSessionResult>}
789
- */
790
- subscribeCreateSession(controller_id, session_key_guid) {
791
- const ptr0 = passStringToWasm0(controller_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
792
- const len0 = WASM_VECTOR_LEN;
793
- const ret = wasm.cartridgeaccount_subscribeCreateSession(this.__wbg_ptr, ptr0, len0, addHeapObject(session_key_guid));
794
- return takeObject(ret);
795
- }
796
800
  /**
797
801
  * Signs an OutsideExecution V3 transaction and returns both the OutsideExecution object and its signature.
798
802
  *
@@ -1897,18 +1901,18 @@ export function __wbindgen_cb_drop(arg0) {
1897
1901
  return ret;
1898
1902
  };
1899
1903
 
1900
- export function __wbindgen_closure_wrapper2606(arg0, arg1, arg2) {
1904
+ export function __wbindgen_closure_wrapper3255(arg0, arg1, arg2) {
1901
1905
  const ret = makeClosure(arg0, arg1, 32, __wbg_adapter_38);
1902
1906
  return addHeapObject(ret);
1903
1907
  };
1904
1908
 
1905
- export function __wbindgen_closure_wrapper8316(arg0, arg1, arg2) {
1906
- const ret = makeMutClosure(arg0, arg1, 882, __wbg_adapter_41);
1909
+ export function __wbindgen_closure_wrapper8269(arg0, arg1, arg2) {
1910
+ const ret = makeMutClosure(arg0, arg1, 877, __wbg_adapter_41);
1907
1911
  return addHeapObject(ret);
1908
1912
  };
1909
1913
 
1910
- export function __wbindgen_closure_wrapper8459(arg0, arg1, arg2) {
1911
- const ret = makeMutClosure(arg0, arg1, 915, __wbg_adapter_44);
1914
+ export function __wbindgen_closure_wrapper8415(arg0, arg1, arg2) {
1915
+ const ret = makeMutClosure(arg0, arg1, 909, __wbg_adapter_44);
1912
1916
  return addHeapObject(ret);
1913
1917
  };
1914
1918
 
Binary file
@@ -1,5 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
5
+ * The goal of this function is to know from any place when the register session flow has been completed, and to
6
+ * get the authorization.
7
+ */
8
+ export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;
9
+ export function signerToGuid(signer: Signer): JsFelt;
3
10
  export enum ErrorCode {
4
11
  StarknetFailedToReceiveTransaction = 1,
5
12
  StarknetContractNotFound = 20,
@@ -164,7 +171,7 @@ export type Felts = JsFelt[];
164
171
 
165
172
  export type JsFeeSource = "PAYMASTER" | "CREDITS";
166
173
 
167
- export type JsSubscribeSessionResult = ResponseData;
174
+ export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
168
175
 
169
176
  export type JsRevokableSession = RevokableSession;
170
177
 
@@ -256,6 +256,30 @@ function passArrayJsValueToWasm0(array, malloc) {
256
256
  WASM_VECTOR_LEN = array.length;
257
257
  return ptr;
258
258
  }
259
+ /**
260
+ * Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
261
+ * The goal of this function is to know from any place when the register session flow has been completed, and to
262
+ * get the authorization.
263
+ * @param {JsFelt} session_key_guid
264
+ * @param {string} cartridge_api_url
265
+ * @returns {Promise<JsSubscribeSessionResult>}
266
+ */
267
+ export function subscribeCreateSession(session_key_guid, cartridge_api_url) {
268
+ const ptr0 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ret = wasm.subscribeCreateSession(addHeapObject(session_key_guid), ptr0, len0);
271
+ return takeObject(ret);
272
+ }
273
+
274
+ /**
275
+ * @param {Signer} signer
276
+ * @returns {JsFelt}
277
+ */
278
+ export function signerToGuid(signer) {
279
+ const ret = wasm.signerToGuid(addHeapObject(signer));
280
+ return takeObject(ret);
281
+ }
282
+
259
283
  function __wbg_adapter_36(arg0, arg1) {
260
284
  wasm.__wbindgen_export_5(arg0, arg1);
261
285
  }
@@ -264,7 +288,7 @@ function __wbg_adapter_39(arg0, arg1, arg2) {
264
288
  wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
265
289
  }
266
290
 
267
- function __wbg_adapter_195(arg0, arg1, arg2, arg3) {
291
+ function __wbg_adapter_197(arg0, arg1, arg2, arg3) {
268
292
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
269
293
  }
270
294
 
@@ -799,7 +823,7 @@ export function __wbg_new_e30c39c06edaabf2(arg0, arg1) {
799
823
  const a = state0.a;
800
824
  state0.a = 0;
801
825
  try {
802
- return __wbg_adapter_195(a, state0.b, arg0, arg1);
826
+ return __wbg_adapter_197(a, state0.b, arg0, arg1);
803
827
  } finally {
804
828
  state0.a = a;
805
829
  }
@@ -1084,13 +1108,13 @@ export function __wbindgen_cb_drop(arg0) {
1084
1108
  return ret;
1085
1109
  };
1086
1110
 
1087
- export function __wbindgen_closure_wrapper3365(arg0, arg1, arg2) {
1088
- const ret = makeMutClosure(arg0, arg1, 400, __wbg_adapter_36);
1111
+ export function __wbindgen_closure_wrapper3889(arg0, arg1, arg2) {
1112
+ const ret = makeMutClosure(arg0, arg1, 464, __wbg_adapter_36);
1089
1113
  return addHeapObject(ret);
1090
1114
  };
1091
1115
 
1092
- export function __wbindgen_closure_wrapper3495(arg0, arg1, arg2) {
1093
- const ret = makeMutClosure(arg0, arg1, 434, __wbg_adapter_39);
1116
+ export function __wbindgen_closure_wrapper4030(arg0, arg1, arg2) {
1117
+ const ret = makeMutClosure(arg0, arg1, 496, __wbg_adapter_39);
1094
1118
  return addHeapObject(ret);
1095
1119
  };
1096
1120
 
Binary file