@cartridge/controller-wasm 0.2.0 → 0.2.1

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.0",
3
+ "version": "0.2.1",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function signerToGuid(signer: Signer): JsFelt;
3
4
  /**
4
5
  * Computes the Starknet contract address for a controller account without needing a full instance.
5
6
  *
@@ -76,6 +77,7 @@ export enum ErrorCode {
76
77
  Base64DecodeError = 134,
77
78
  CoseError = 135,
78
79
  PolicyChainIdMismatch = 136,
80
+ InvalidOwner = 137,
79
81
  }
80
82
  export interface JsCall {
81
83
  contractAddress: JsFelt;
@@ -142,6 +144,8 @@ export interface Signer {
142
144
  eip191?: Eip191Signer;
143
145
  }
144
146
 
147
+ export type JsSignerInput = SignerInput;
148
+
145
149
  export type JsFelt = Felt;
146
150
 
147
151
  export type Felts = JsFelt[];
@@ -198,6 +202,7 @@ export class CartridgeAccount {
198
202
  register(register: JsRegister): Promise<JsRegisterResponse>;
199
203
  createSession(policies: Policy[], expires_at: bigint): Promise<AuthorizedSession | undefined>;
200
204
  skipSession(policies: Policy[]): Promise<void>;
205
+ addOwner(owner: Signer, signer_input: JsSignerInput): Promise<void>;
201
206
  estimateInvokeFee(calls: JsCall[]): Promise<JsFeeEstimate>;
202
207
  execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
203
208
  executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
@@ -239,6 +239,15 @@ function passArrayJsValueToWasm0(array, malloc) {
239
239
  WASM_VECTOR_LEN = array.length;
240
240
  return ptr;
241
241
  }
242
+ /**
243
+ * @param {Signer} signer
244
+ * @returns {JsFelt}
245
+ */
246
+ export function signerToGuid(signer) {
247
+ const ret = wasm.signerToGuid(addHeapObject(signer));
248
+ return takeObject(ret);
249
+ }
250
+
242
251
  /**
243
252
  * Computes the Starknet contract address for a controller account without needing a full instance.
244
253
  *
@@ -272,20 +281,20 @@ export function computeAccountAddress(class_hash, owner, salt) {
272
281
  }
273
282
  }
274
283
 
275
- function __wbg_adapter_42(arg0, arg1) {
284
+ function __wbg_adapter_44(arg0, arg1) {
276
285
  wasm.__wbindgen_export_5(arg0, arg1);
277
286
  }
278
287
 
279
- function __wbg_adapter_45(arg0, arg1, arg2) {
288
+ function __wbg_adapter_47(arg0, arg1, arg2) {
280
289
  wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
281
290
  }
282
291
 
283
- function __wbg_adapter_241(arg0, arg1, arg2, arg3) {
292
+ function __wbg_adapter_253(arg0, arg1, arg2, arg3) {
284
293
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
285
294
  }
286
295
 
287
296
  /**
288
- * @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}
297
+ * @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}
289
298
  */
290
299
  export const ErrorCode = Object.freeze({
291
300
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -349,6 +358,7 @@ export const ErrorCode = Object.freeze({
349
358
  Base64DecodeError: 134, "134": "Base64DecodeError",
350
359
  CoseError: 135, "135": "CoseError",
351
360
  PolicyChainIdMismatch: 136, "136": "PolicyChainIdMismatch",
361
+ InvalidOwner: 137, "137": "InvalidOwner",
352
362
  });
353
363
 
354
364
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -525,6 +535,15 @@ export class CartridgeAccount {
525
535
  const ret = wasm.cartridgeaccount_skipSession(this.__wbg_ptr, ptr0, len0);
526
536
  return takeObject(ret);
527
537
  }
538
+ /**
539
+ * @param {Signer} owner
540
+ * @param {JsSignerInput} signer_input
541
+ * @returns {Promise<void>}
542
+ */
543
+ addOwner(owner, signer_input) {
544
+ const ret = wasm.cartridgeaccount_addOwner(this.__wbg_ptr, addHeapObject(owner), addHeapObject(signer_input));
545
+ return takeObject(ret);
546
+ }
528
547
  /**
529
548
  * @param {JsCall[]} calls
530
549
  * @returns {Promise<JsFeeEstimate>}
@@ -1011,7 +1030,7 @@ export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg
1011
1030
  return addHeapObject(ret);
1012
1031
  }, arguments) };
1013
1032
 
1014
- export function __wbg_clearTimeout_b1115618e821c3b2(arg0) {
1033
+ export function __wbg_clearTimeout_0b53d391c1b94dda(arg0) {
1015
1034
  const ret = clearTimeout(takeObject(arg0));
1016
1035
  return addHeapObject(ret);
1017
1036
  };
@@ -1020,6 +1039,11 @@ export function __wbg_clear_dbb26f24a86a04a0() { return handleError(function (ar
1020
1039
  getObject(arg0).clear();
1021
1040
  }, arguments) };
1022
1041
 
1042
+ export function __wbg_create_1e1fa47bcba4f67f() { return handleError(function (arg0, arg1) {
1043
+ const ret = getObject(arg0).create(getObject(arg1));
1044
+ return addHeapObject(ret);
1045
+ }, arguments) };
1046
+
1023
1047
  export function __wbg_credentials_f1256c3bb1216690(arg0) {
1024
1048
  const ret = getObject(arg0).credentials;
1025
1049
  return addHeapObject(ret);
@@ -1039,7 +1063,7 @@ export function __wbg_error_524f506f44df1645(arg0) {
1039
1063
  console.error(getObject(arg0));
1040
1064
  };
1041
1065
 
1042
- export function __wbg_fetch_3afbdcc7ddbf16fe(arg0) {
1066
+ export function __wbg_fetch_11bff8299d0ecd2b(arg0) {
1043
1067
  const ret = fetch(getObject(arg0));
1044
1068
  return addHeapObject(ret);
1045
1069
  };
@@ -1212,7 +1236,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1212
1236
  const a = state0.a;
1213
1237
  state0.a = 0;
1214
1238
  try {
1215
- return __wbg_adapter_241(a, state0.b, arg0, arg1);
1239
+ return __wbg_adapter_253(a, state0.b, arg0, arg1);
1216
1240
  } finally {
1217
1241
  state0.a = a;
1218
1242
  }
@@ -1234,6 +1258,11 @@ export function __wbg_new_405e22f390576ce2() {
1234
1258
  return addHeapObject(ret);
1235
1259
  };
1236
1260
 
1261
+ export function __wbg_new_5e0be73521bc8c17() {
1262
+ const ret = new Map();
1263
+ return addHeapObject(ret);
1264
+ };
1265
+
1237
1266
  export function __wbg_new_78feb108b6472713() {
1238
1267
  const ret = new Array();
1239
1268
  return addHeapObject(ret);
@@ -1338,11 +1367,16 @@ export function __wbg_setItem_212ecc915942ab0a() { return handleError(function (
1338
1367
  getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1339
1368
  }, arguments) };
1340
1369
 
1341
- export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
1370
+ export function __wbg_setTimeout_73ce8df12de4f2f2(arg0, arg1) {
1342
1371
  const ret = setTimeout(getObject(arg0), arg1);
1343
1372
  return addHeapObject(ret);
1344
1373
  };
1345
1374
 
1375
+ export function __wbg_setTimeout_f2fe5af8e3debeb3() { return handleError(function (arg0, arg1, arg2) {
1376
+ const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
1377
+ return ret;
1378
+ }, arguments) };
1379
+
1346
1380
  export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
1347
1381
  getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1348
1382
  };
@@ -1359,6 +1393,11 @@ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
1359
1393
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1360
1394
  };
1361
1395
 
1396
+ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
1397
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1398
+ return addHeapObject(ret);
1399
+ };
1400
+
1362
1401
  export function __wbg_set_bb8cecf6a62b9f46() { return handleError(function (arg0, arg1, arg2) {
1363
1402
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1364
1403
  return ret;
@@ -1479,6 +1518,11 @@ export function __wbg_versions_c01dfd4722a88165(arg0) {
1479
1518
  return addHeapObject(ret);
1480
1519
  };
1481
1520
 
1521
+ export function __wbindgen_bigint_from_i64(arg0) {
1522
+ const ret = arg0;
1523
+ return addHeapObject(ret);
1524
+ };
1525
+
1482
1526
  export function __wbindgen_boolean_get(arg0) {
1483
1527
  const v = getObject(arg0);
1484
1528
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
@@ -1495,13 +1539,13 @@ export function __wbindgen_cb_drop(arg0) {
1495
1539
  return ret;
1496
1540
  };
1497
1541
 
1498
- export function __wbindgen_closure_wrapper4692(arg0, arg1, arg2) {
1499
- const ret = makeMutClosure(arg0, arg1, 583, __wbg_adapter_42);
1542
+ export function __wbindgen_closure_wrapper5264(arg0, arg1, arg2) {
1543
+ const ret = makeMutClosure(arg0, arg1, 629, __wbg_adapter_44);
1500
1544
  return addHeapObject(ret);
1501
1545
  };
1502
1546
 
1503
- export function __wbindgen_closure_wrapper4838(arg0, arg1, arg2) {
1504
- const ret = makeMutClosure(arg0, arg1, 617, __wbg_adapter_45);
1547
+ export function __wbindgen_closure_wrapper5410(arg0, arg1, arg2) {
1548
+ const ret = makeMutClosure(arg0, arg1, 662, __wbg_adapter_47);
1505
1549
  return addHeapObject(ret);
1506
1550
  };
1507
1551
 
Binary file
@@ -62,6 +62,7 @@ export enum ErrorCode {
62
62
  Base64DecodeError = 134,
63
63
  CoseError = 135,
64
64
  PolicyChainIdMismatch = 136,
65
+ InvalidOwner = 137,
65
66
  }
66
67
  export interface JsCall {
67
68
  contractAddress: JsFelt;
@@ -128,6 +129,8 @@ export interface Signer {
128
129
  eip191?: Eip191Signer;
129
130
  }
130
131
 
132
+ export type JsSignerInput = SignerInput;
133
+
131
134
  export type JsFelt = Felt;
132
135
 
133
136
  export type Felts = 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}
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}
256
256
  */
257
257
  export const ErrorCode = Object.freeze({
258
258
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -316,6 +316,7 @@ export const ErrorCode = Object.freeze({
316
316
  Base64DecodeError: 134, "134": "Base64DecodeError",
317
317
  CoseError: 135, "135": "CoseError",
318
318
  PolicyChainIdMismatch: 136, "136": "PolicyChainIdMismatch",
319
+ InvalidOwner: 137, "137": "InvalidOwner",
319
320
  });
320
321
 
321
322
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -568,7 +569,7 @@ export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg
568
569
  return addHeapObject(ret);
569
570
  }, arguments) };
570
571
 
571
- export function __wbg_clearTimeout_b1115618e821c3b2(arg0) {
572
+ export function __wbg_clearTimeout_0b53d391c1b94dda(arg0) {
572
573
  const ret = clearTimeout(takeObject(arg0));
573
574
  return addHeapObject(ret);
574
575
  };
@@ -588,7 +589,7 @@ export function __wbg_done_769e5ede4b31c67b(arg0) {
588
589
  return ret;
589
590
  };
590
591
 
591
- export function __wbg_fetch_3afbdcc7ddbf16fe(arg0) {
592
+ export function __wbg_fetch_11bff8299d0ecd2b(arg0) {
592
593
  const ret = fetch(getObject(arg0));
593
594
  return addHeapObject(ret);
594
595
  };
@@ -866,7 +867,7 @@ export function __wbg_resolve_4851785c9c5f573d(arg0) {
866
867
  return addHeapObject(ret);
867
868
  };
868
869
 
869
- export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
870
+ export function __wbg_setTimeout_73ce8df12de4f2f2(arg0, arg1) {
870
871
  const ret = setTimeout(getObject(arg0), arg1);
871
872
  return addHeapObject(ret);
872
873
  };
@@ -1023,13 +1024,13 @@ export function __wbindgen_cb_drop(arg0) {
1023
1024
  return ret;
1024
1025
  };
1025
1026
 
1026
- export function __wbindgen_closure_wrapper2803(arg0, arg1, arg2) {
1027
- const ret = makeMutClosure(arg0, arg1, 363, __wbg_adapter_42);
1027
+ export function __wbindgen_closure_wrapper2805(arg0, arg1, arg2) {
1028
+ const ret = makeMutClosure(arg0, arg1, 361, __wbg_adapter_42);
1028
1029
  return addHeapObject(ret);
1029
1030
  };
1030
1031
 
1031
- export function __wbindgen_closure_wrapper2936(arg0, arg1, arg2) {
1032
- const ret = makeMutClosure(arg0, arg1, 397, __wbg_adapter_45);
1032
+ export function __wbindgen_closure_wrapper2938(arg0, arg1, arg2) {
1033
+ const ret = makeMutClosure(arg0, arg1, 395, __wbg_adapter_45);
1033
1034
  return addHeapObject(ret);
1034
1035
  };
1035
1036
 
Binary file