@cartridge/controller-wasm 0.2.2 → 0.2.4

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.2",
3
+ "version": "0.2.4",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -203,7 +203,8 @@ export class CartridgeAccount {
203
203
  register(register: JsRegister): Promise<JsRegisterResponse>;
204
204
  createSession(policies: Policy[], expires_at: bigint): Promise<AuthorizedSession | undefined>;
205
205
  skipSession(policies: Policy[]): Promise<void>;
206
- addOwner(owner: Signer, signer_input: JsSignerInput): Promise<void>;
206
+ addOwner(owner?: Signer | null, signer_input?: JsSignerInput | null, rp_id?: string | null): Promise<void>;
207
+ createPasskeySigner(rp_id: string): Promise<JsSignerInput>;
207
208
  estimateInvokeFee(calls: JsCall[]): Promise<JsFeeEstimate>;
208
209
  execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
209
210
  executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
@@ -140,6 +140,28 @@ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
140
140
  wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b)
141
141
  });
142
142
 
143
+ function makeClosure(arg0, arg1, dtor, f) {
144
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
145
+ const real = (...args) => {
146
+ // First up with a closure we increment the internal reference
147
+ // count. This ensures that the Rust closure environment won't
148
+ // be deallocated while we're invoking it.
149
+ state.cnt++;
150
+ try {
151
+ return f(state.a, state.b, ...args);
152
+ } finally {
153
+ if (--state.cnt === 0) {
154
+ wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b);
155
+ state.a = 0;
156
+ CLOSURE_DTORS.unregister(state);
157
+ }
158
+ }
159
+ };
160
+ real.original = state;
161
+ CLOSURE_DTORS.register(real, state, state);
162
+ return real;
163
+ }
164
+
143
165
  function makeMutClosure(arg0, arg1, dtor, f) {
144
166
  const state = { a: arg0, b: arg1, cnt: 1, dtor };
145
167
  const real = (...args) => {
@@ -281,16 +303,20 @@ export function computeAccountAddress(class_hash, owner, salt) {
281
303
  }
282
304
  }
283
305
 
284
- function __wbg_adapter_44(arg0, arg1) {
285
- wasm.__wbindgen_export_5(arg0, arg1);
306
+ function __wbg_adapter_44(arg0, arg1, arg2) {
307
+ wasm.__wbindgen_export_5(arg0, arg1, addHeapObject(arg2));
308
+ }
309
+
310
+ function __wbg_adapter_47(arg0, arg1) {
311
+ wasm.__wbindgen_export_6(arg0, arg1);
286
312
  }
287
313
 
288
- function __wbg_adapter_47(arg0, arg1, arg2) {
289
- wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
314
+ function __wbg_adapter_50(arg0, arg1, arg2) {
315
+ wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
290
316
  }
291
317
 
292
- function __wbg_adapter_259(arg0, arg1, arg2, arg3) {
293
- wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
318
+ function __wbg_adapter_275(arg0, arg1, arg2, arg3) {
319
+ wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
294
320
  }
295
321
 
296
322
  /**
@@ -537,12 +563,25 @@ export class CartridgeAccount {
537
563
  return takeObject(ret);
538
564
  }
539
565
  /**
540
- * @param {Signer} owner
541
- * @param {JsSignerInput} signer_input
566
+ * @param {Signer | null} [owner]
567
+ * @param {JsSignerInput | null} [signer_input]
568
+ * @param {string | null} [rp_id]
542
569
  * @returns {Promise<void>}
543
570
  */
544
- addOwner(owner, signer_input) {
545
- const ret = wasm.cartridgeaccount_addOwner(this.__wbg_ptr, addHeapObject(owner), addHeapObject(signer_input));
571
+ addOwner(owner, signer_input, rp_id) {
572
+ var ptr0 = isLikeNone(rp_id) ? 0 : passStringToWasm0(rp_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
573
+ var len0 = WASM_VECTOR_LEN;
574
+ const ret = wasm.cartridgeaccount_addOwner(this.__wbg_ptr, isLikeNone(owner) ? 0 : addHeapObject(owner), isLikeNone(signer_input) ? 0 : addHeapObject(signer_input), ptr0, len0);
575
+ return takeObject(ret);
576
+ }
577
+ /**
578
+ * @param {string} rp_id
579
+ * @returns {Promise<JsSignerInput>}
580
+ */
581
+ createPasskeySigner(rp_id) {
582
+ const ptr0 = passStringToWasm0(rp_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
583
+ const len0 = WASM_VECTOR_LEN;
584
+ const ret = wasm.cartridgeaccount_createPasskeySigner(this.__wbg_ptr, ptr0, len0);
546
585
  return takeObject(ret);
547
586
  }
548
587
  /**
@@ -1007,6 +1046,10 @@ export function __wbg_abort_775ef1d17fc65868(arg0) {
1007
1046
  getObject(arg0).abort();
1008
1047
  };
1009
1048
 
1049
+ export function __wbg_addEventListener_90e553fdce254421() { return handleError(function (arg0, arg1, arg2, arg3) {
1050
+ getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
1051
+ }, arguments) };
1052
+
1010
1053
  export function __wbg_append_8c7dd8d641a5f01b() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
1011
1054
  getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1012
1055
  }, arguments) };
@@ -1055,6 +1098,11 @@ export function __wbg_crypto_574e78ad8b13b65f(arg0) {
1055
1098
  return addHeapObject(ret);
1056
1099
  };
1057
1100
 
1101
+ export function __wbg_data_432d9c3df2630942(arg0) {
1102
+ const ret = getObject(arg0).data;
1103
+ return addHeapObject(ret);
1104
+ };
1105
+
1058
1106
  export function __wbg_done_769e5ede4b31c67b(arg0) {
1059
1107
  const ret = getObject(arg0).done;
1060
1108
  return ret;
@@ -1248,7 +1296,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1248
1296
  const a = state0.a;
1249
1297
  state0.a = 0;
1250
1298
  try {
1251
- return __wbg_adapter_259(a, state0.b, arg0, arg1);
1299
+ return __wbg_adapter_275(a, state0.b, arg0, arg1);
1252
1300
  } finally {
1253
1301
  state0.a = a;
1254
1302
  }
@@ -1335,6 +1383,19 @@ export function __wbg_obtain_a9626b3b96e6dc2c(arg0) {
1335
1383
  return addHeapObject(ret);
1336
1384
  };
1337
1385
 
1386
+ export function __wbg_open_133269b8b8f0081c() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
1387
+ const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
1388
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1389
+ }, arguments) };
1390
+
1391
+ export function __wbg_origin_1d664917fb08d320(arg0, arg1) {
1392
+ const ret = getObject(arg1).origin;
1393
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1394
+ const len1 = WASM_VECTOR_LEN;
1395
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1396
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1397
+ };
1398
+
1338
1399
  export function __wbg_origin_7c5d649acdace3ea() { return handleError(function (arg0, arg1) {
1339
1400
  const ret = getObject(arg1).origin;
1340
1401
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -1366,6 +1427,10 @@ export function __wbg_randomFillSync_ac0988aba3254290() { return handleError(fun
1366
1427
  getObject(arg0).randomFillSync(takeObject(arg1));
1367
1428
  }, arguments) };
1368
1429
 
1430
+ export function __wbg_removeEventListener_056dfe8c3d6c58f9() { return handleError(function (arg0, arg1, arg2, arg3) {
1431
+ getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3));
1432
+ }, arguments) };
1433
+
1369
1434
  export function __wbg_removeItem_9d2669ee3bba6f7d() { return handleError(function (arg0, arg1, arg2) {
1370
1435
  getObject(arg0).removeItem(getStringFromWasm0(arg1, arg2));
1371
1436
  }, arguments) };
@@ -1530,6 +1595,14 @@ export function __wbg_url_ae10c34ca209681d(arg0, arg1) {
1530
1595
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1531
1596
  };
1532
1597
 
1598
+ export function __wbg_userAgent_12e9d8e62297563f() { return handleError(function (arg0, arg1) {
1599
+ const ret = getObject(arg1).userAgent;
1600
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
1601
+ const len1 = WASM_VECTOR_LEN;
1602
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1603
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1604
+ }, arguments) };
1605
+
1533
1606
  export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
1534
1607
  const ret = getObject(arg0).value;
1535
1608
  return addHeapObject(ret);
@@ -1561,13 +1634,18 @@ export function __wbindgen_cb_drop(arg0) {
1561
1634
  return ret;
1562
1635
  };
1563
1636
 
1564
- export function __wbindgen_closure_wrapper5664(arg0, arg1, arg2) {
1565
- const ret = makeMutClosure(arg0, arg1, 663, __wbg_adapter_44);
1637
+ export function __wbindgen_closure_wrapper1270(arg0, arg1, arg2) {
1638
+ const ret = makeClosure(arg0, arg1, 25, __wbg_adapter_44);
1639
+ return addHeapObject(ret);
1640
+ };
1641
+
1642
+ export function __wbindgen_closure_wrapper5777(arg0, arg1, arg2) {
1643
+ const ret = makeMutClosure(arg0, arg1, 674, __wbg_adapter_47);
1566
1644
  return addHeapObject(ret);
1567
1645
  };
1568
1646
 
1569
- export function __wbindgen_closure_wrapper5810(arg0, arg1, arg2) {
1570
- const ret = makeMutClosure(arg0, arg1, 696, __wbg_adapter_47);
1647
+ export function __wbindgen_closure_wrapper5923(arg0, arg1, arg2) {
1648
+ const ret = makeMutClosure(arg0, arg1, 707, __wbg_adapter_50);
1571
1649
  return addHeapObject(ret);
1572
1650
  };
1573
1651
 
Binary file
@@ -1024,13 +1024,13 @@ export function __wbindgen_cb_drop(arg0) {
1024
1024
  return ret;
1025
1025
  };
1026
1026
 
1027
- export function __wbindgen_closure_wrapper2845(arg0, arg1, arg2) {
1028
- const ret = makeMutClosure(arg0, arg1, 363, __wbg_adapter_42);
1027
+ export function __wbindgen_closure_wrapper2833(arg0, arg1, arg2) {
1028
+ const ret = makeMutClosure(arg0, arg1, 361, __wbg_adapter_42);
1029
1029
  return addHeapObject(ret);
1030
1030
  };
1031
1031
 
1032
- export function __wbindgen_closure_wrapper2978(arg0, arg1, arg2) {
1033
- const ret = makeMutClosure(arg0, arg1, 396, __wbg_adapter_45);
1032
+ export function __wbindgen_closure_wrapper2966(arg0, arg1, arg2) {
1033
+ const ret = makeMutClosure(arg0, arg1, 394, __wbg_adapter_45);
1034
1034
  return addHeapObject(ret);
1035
1035
  };
1036
1036
 
Binary file