@cartridge/controller-wasm 0.2.0 → 0.2.2

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.2",
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;
@@ -137,11 +139,14 @@ export interface Eip191Signer {
137
139
  }
138
140
 
139
141
  export interface Signer {
142
+ webauthns?: WebauthnSigner[];
140
143
  webauthn?: WebauthnSigner;
141
144
  starknet?: StarknetSigner;
142
145
  eip191?: Eip191Signer;
143
146
  }
144
147
 
148
+ export type JsSignerInput = SignerInput;
149
+
145
150
  export type JsFelt = Felt;
146
151
 
147
152
  export type Felts = JsFelt[];
@@ -194,10 +199,11 @@ export class CartridgeAccount {
194
199
  registerSession(policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
195
200
  registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
196
201
  upgrade(new_class_hash: JsFelt): Promise<JsCall>;
197
- login(expires_at: bigint, is_controller_registered?: boolean | null): Promise<AuthorizedSession>;
202
+ login(expires_at: bigint, is_controller_registered?: boolean | null, signers?: Signer | null): Promise<AuthorizedSession>;
198
203
  register(register: JsRegister): Promise<JsRegisterResponse>;
199
204
  createSession(policies: Policy[], expires_at: bigint): Promise<AuthorizedSession | undefined>;
200
205
  skipSession(policies: Policy[]): Promise<void>;
206
+ addOwner(owner: Signer, signer_input: JsSignerInput): Promise<void>;
201
207
  estimateInvokeFee(calls: JsCall[]): Promise<JsFeeEstimate>;
202
208
  execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
203
209
  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_259(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"];
@@ -490,10 +500,11 @@ export class CartridgeAccount {
490
500
  /**
491
501
  * @param {bigint} expires_at
492
502
  * @param {boolean | null} [is_controller_registered]
503
+ * @param {Signer | null} [signers]
493
504
  * @returns {Promise<AuthorizedSession>}
494
505
  */
495
- login(expires_at, is_controller_registered) {
496
- const ret = wasm.cartridgeaccount_login(this.__wbg_ptr, expires_at, isLikeNone(is_controller_registered) ? 0xFFFFFF : is_controller_registered ? 1 : 0);
506
+ login(expires_at, is_controller_registered, signers) {
507
+ const ret = wasm.cartridgeaccount_login(this.__wbg_ptr, expires_at, isLikeNone(is_controller_registered) ? 0xFFFFFF : is_controller_registered ? 1 : 0, isLikeNone(signers) ? 0 : addHeapObject(signers));
497
508
  return takeObject(ret);
498
509
  }
499
510
  /**
@@ -525,6 +536,15 @@ export class CartridgeAccount {
525
536
  const ret = wasm.cartridgeaccount_skipSession(this.__wbg_ptr, ptr0, len0);
526
537
  return takeObject(ret);
527
538
  }
539
+ /**
540
+ * @param {Signer} owner
541
+ * @param {JsSignerInput} signer_input
542
+ * @returns {Promise<void>}
543
+ */
544
+ addOwner(owner, signer_input) {
545
+ const ret = wasm.cartridgeaccount_addOwner(this.__wbg_ptr, addHeapObject(owner), addHeapObject(signer_input));
546
+ return takeObject(ret);
547
+ }
528
548
  /**
529
549
  * @param {JsCall[]} calls
530
550
  * @returns {Promise<JsFeeEstimate>}
@@ -1011,7 +1031,7 @@ export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg
1011
1031
  return addHeapObject(ret);
1012
1032
  }, arguments) };
1013
1033
 
1014
- export function __wbg_clearTimeout_b1115618e821c3b2(arg0) {
1034
+ export function __wbg_clearTimeout_0b53d391c1b94dda(arg0) {
1015
1035
  const ret = clearTimeout(takeObject(arg0));
1016
1036
  return addHeapObject(ret);
1017
1037
  };
@@ -1020,6 +1040,11 @@ export function __wbg_clear_dbb26f24a86a04a0() { return handleError(function (ar
1020
1040
  getObject(arg0).clear();
1021
1041
  }, arguments) };
1022
1042
 
1043
+ export function __wbg_create_1e1fa47bcba4f67f() { return handleError(function (arg0, arg1) {
1044
+ const ret = getObject(arg0).create(getObject(arg1));
1045
+ return addHeapObject(ret);
1046
+ }, arguments) };
1047
+
1023
1048
  export function __wbg_credentials_f1256c3bb1216690(arg0) {
1024
1049
  const ret = getObject(arg0).credentials;
1025
1050
  return addHeapObject(ret);
@@ -1039,7 +1064,7 @@ export function __wbg_error_524f506f44df1645(arg0) {
1039
1064
  console.error(getObject(arg0));
1040
1065
  };
1041
1066
 
1042
- export function __wbg_fetch_3afbdcc7ddbf16fe(arg0) {
1067
+ export function __wbg_fetch_11bff8299d0ecd2b(arg0) {
1043
1068
  const ret = fetch(getObject(arg0));
1044
1069
  return addHeapObject(ret);
1045
1070
  };
@@ -1156,6 +1181,17 @@ export function __wbg_instanceof_Window_def73ea0955fc569(arg0) {
1156
1181
  return ret;
1157
1182
  };
1158
1183
 
1184
+ export function __wbg_instanceof_WorkerGlobalScope_dbdbdea7e3b56493(arg0) {
1185
+ let result;
1186
+ try {
1187
+ result = getObject(arg0) instanceof WorkerGlobalScope;
1188
+ } catch (_) {
1189
+ result = false;
1190
+ }
1191
+ const ret = result;
1192
+ return ret;
1193
+ };
1194
+
1159
1195
  export function __wbg_iterator_9a24c88df860dc65() {
1160
1196
  const ret = Symbol.iterator;
1161
1197
  return addHeapObject(ret);
@@ -1212,7 +1248,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1212
1248
  const a = state0.a;
1213
1249
  state0.a = 0;
1214
1250
  try {
1215
- return __wbg_adapter_241(a, state0.b, arg0, arg1);
1251
+ return __wbg_adapter_259(a, state0.b, arg0, arg1);
1216
1252
  } finally {
1217
1253
  state0.a = a;
1218
1254
  }
@@ -1234,6 +1270,11 @@ export function __wbg_new_405e22f390576ce2() {
1234
1270
  return addHeapObject(ret);
1235
1271
  };
1236
1272
 
1273
+ export function __wbg_new_5e0be73521bc8c17() {
1274
+ const ret = new Map();
1275
+ return addHeapObject(ret);
1276
+ };
1277
+
1237
1278
  export function __wbg_new_78feb108b6472713() {
1238
1279
  const ret = new Array();
1239
1280
  return addHeapObject(ret);
@@ -1284,6 +1325,11 @@ export function __wbg_node_905d3e251edff8a2(arg0) {
1284
1325
  return addHeapObject(ret);
1285
1326
  };
1286
1327
 
1328
+ export function __wbg_now_807e54c39636c349() {
1329
+ const ret = Date.now();
1330
+ return ret;
1331
+ };
1332
+
1287
1333
  export function __wbg_obtain_a9626b3b96e6dc2c(arg0) {
1288
1334
  const ret = getObject(arg0).obtain();
1289
1335
  return addHeapObject(ret);
@@ -1338,11 +1384,21 @@ export function __wbg_setItem_212ecc915942ab0a() { return handleError(function (
1338
1384
  getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1339
1385
  }, arguments) };
1340
1386
 
1341
- export function __wbg_setTimeout_ca12ead8b48245e2(arg0, arg1) {
1387
+ export function __wbg_setTimeout_73ce8df12de4f2f2(arg0, arg1) {
1342
1388
  const ret = setTimeout(getObject(arg0), arg1);
1343
1389
  return addHeapObject(ret);
1344
1390
  };
1345
1391
 
1392
+ export function __wbg_setTimeout_b4ee584b3f982e97() { return handleError(function (arg0, arg1, arg2) {
1393
+ const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
1394
+ return ret;
1395
+ }, arguments) };
1396
+
1397
+ export function __wbg_setTimeout_f2fe5af8e3debeb3() { return handleError(function (arg0, arg1, arg2) {
1398
+ const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
1399
+ return ret;
1400
+ }, arguments) };
1401
+
1346
1402
  export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
1347
1403
  getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1348
1404
  };
@@ -1359,6 +1415,11 @@ export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
1359
1415
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1360
1416
  };
1361
1417
 
1418
+ export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
1419
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1420
+ return addHeapObject(ret);
1421
+ };
1422
+
1362
1423
  export function __wbg_set_bb8cecf6a62b9f46() { return handleError(function (arg0, arg1, arg2) {
1363
1424
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1364
1425
  return ret;
@@ -1479,6 +1540,11 @@ export function __wbg_versions_c01dfd4722a88165(arg0) {
1479
1540
  return addHeapObject(ret);
1480
1541
  };
1481
1542
 
1543
+ export function __wbindgen_bigint_from_i64(arg0) {
1544
+ const ret = arg0;
1545
+ return addHeapObject(ret);
1546
+ };
1547
+
1482
1548
  export function __wbindgen_boolean_get(arg0) {
1483
1549
  const v = getObject(arg0);
1484
1550
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
@@ -1495,13 +1561,13 @@ export function __wbindgen_cb_drop(arg0) {
1495
1561
  return ret;
1496
1562
  };
1497
1563
 
1498
- export function __wbindgen_closure_wrapper4692(arg0, arg1, arg2) {
1499
- const ret = makeMutClosure(arg0, arg1, 583, __wbg_adapter_42);
1564
+ export function __wbindgen_closure_wrapper5664(arg0, arg1, arg2) {
1565
+ const ret = makeMutClosure(arg0, arg1, 663, __wbg_adapter_44);
1500
1566
  return addHeapObject(ret);
1501
1567
  };
1502
1568
 
1503
- export function __wbindgen_closure_wrapper4838(arg0, arg1, arg2) {
1504
- const ret = makeMutClosure(arg0, arg1, 617, __wbg_adapter_45);
1569
+ export function __wbindgen_closure_wrapper5810(arg0, arg1, arg2) {
1570
+ const ret = makeMutClosure(arg0, arg1, 696, __wbg_adapter_47);
1505
1571
  return addHeapObject(ret);
1506
1572
  };
1507
1573
 
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;
@@ -123,11 +124,14 @@ export interface Eip191Signer {
123
124
  }
124
125
 
125
126
  export interface Signer {
127
+ webauthns?: WebauthnSigner[];
126
128
  webauthn?: WebauthnSigner;
127
129
  starknet?: StarknetSigner;
128
130
  eip191?: Eip191Signer;
129
131
  }
130
132
 
133
+ export type JsSignerInput = SignerInput;
134
+
131
135
  export type JsFelt = Felt;
132
136
 
133
137
  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
+ export function __wbindgen_closure_wrapper2845(arg0, arg1, arg2) {
1027
1028
  const ret = makeMutClosure(arg0, arg1, 363, __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_wrapper2978(arg0, arg1, arg2) {
1033
+ const ret = makeMutClosure(arg0, arg1, 396, __wbg_adapter_45);
1033
1034
  return addHeapObject(ret);
1034
1035
  };
1035
1036
 
Binary file