@cartridge/controller-wasm 0.2.7 → 0.3.0

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.7",
3
+ "version": "0.3.0",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -42,6 +42,8 @@ export enum ErrorCode {
42
42
  StarknetUnsupportedContractClassVersion = 62,
43
43
  StarknetUnexpectedError = 63,
44
44
  StarknetNoTraceAvailable = 10,
45
+ StarknetReplacementTransactionUnderpriced = 64,
46
+ StarknetFeeBelowMinimum = 65,
45
47
  SignError = 101,
46
48
  StorageError = 102,
47
49
  AccountFactoryError = 103,
@@ -100,7 +102,6 @@ export interface JsFeeEstimate {
100
102
  l1_data_gas_consumed: number;
101
103
  l1_data_gas_price: number;
102
104
  overall_fee: number;
103
- unit: JsPriceUnit;
104
105
  }
105
106
 
106
107
  export interface Owner {
@@ -156,6 +157,8 @@ export type Felts = JsFelt[];
156
157
 
157
158
  export type JsFeeSource = "PAYMASTER" | "CREDITS";
158
159
 
160
+ export type JsSubscribeSessionResult = ResponseData;
161
+
159
162
  export type JsRevokableSession = RevokableSession;
160
163
 
161
164
  export interface AuthorizedSession {
@@ -234,6 +237,7 @@ export class CartridgeAccount {
234
237
  delegateAccount(): Promise<JsFelt>;
235
238
  hasAuthorizedPoliciesForCalls(calls: JsCall[]): Promise<boolean>;
236
239
  hasAuthorizedPoliciesForMessage(typed_data: string): Promise<boolean>;
240
+ subscribeCreateSession(controller_id: string, session_key_guid: JsFelt): Promise<JsSubscribeSessionResult>;
237
241
  }
238
242
  /**
239
243
  * A type for accessing fixed attributes of `CartridgeAccount`.
@@ -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_277(arg0, arg1, arg2, arg3) {
318
+ function __wbg_adapter_280(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 | 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}
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}
324
324
  */
325
325
  export const ErrorCode = Object.freeze({
326
326
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -349,6 +349,8 @@ export const ErrorCode = Object.freeze({
349
349
  StarknetUnsupportedContractClassVersion: 62, "62": "StarknetUnsupportedContractClassVersion",
350
350
  StarknetUnexpectedError: 63, "63": "StarknetUnexpectedError",
351
351
  StarknetNoTraceAvailable: 10, "10": "StarknetNoTraceAvailable",
352
+ StarknetReplacementTransactionUnderpriced: 64, "64": "StarknetReplacementTransactionUnderpriced",
353
+ StarknetFeeBelowMinimum: 65, "65": "StarknetFeeBelowMinimum",
352
354
  SignError: 101, "101": "SignError",
353
355
  StorageError: 102, "102": "StorageError",
354
356
  AccountFactoryError: 103, "103": "AccountFactoryError",
@@ -388,6 +390,8 @@ export const ErrorCode = Object.freeze({
388
390
  GasPriceTooHigh: 138, "138": "GasPriceTooHigh",
389
391
  });
390
392
 
393
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
394
+
391
395
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
392
396
 
393
397
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
@@ -768,6 +772,17 @@ export class CartridgeAccount {
768
772
  const ret = wasm.cartridgeaccount_hasAuthorizedPoliciesForMessage(this.__wbg_ptr, ptr0, len0);
769
773
  return takeObject(ret);
770
774
  }
775
+ /**
776
+ * @param {string} controller_id
777
+ * @param {JsFelt} session_key_guid
778
+ * @returns {Promise<JsSubscribeSessionResult>}
779
+ */
780
+ subscribeCreateSession(controller_id, session_key_guid) {
781
+ const ptr0 = passStringToWasm0(controller_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
782
+ const len0 = WASM_VECTOR_LEN;
783
+ const ret = wasm.cartridgeaccount_subscribeCreateSession(this.__wbg_ptr, ptr0, len0, addHeapObject(session_key_guid));
784
+ return takeObject(ret);
785
+ }
771
786
  }
772
787
 
773
788
  const CartridgeAccountMetaFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1123,7 +1138,7 @@ export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg
1123
1138
  return addHeapObject(ret);
1124
1139
  }, arguments) };
1125
1140
 
1126
- export function __wbg_clearTimeout_0b53d391c1b94dda(arg0) {
1141
+ export function __wbg_clearTimeout_6222fede17abcb1a(arg0) {
1127
1142
  const ret = clearTimeout(takeObject(arg0));
1128
1143
  return addHeapObject(ret);
1129
1144
  };
@@ -1161,13 +1176,13 @@ export function __wbg_error_524f506f44df1645(arg0) {
1161
1176
  console.error(getObject(arg0));
1162
1177
  };
1163
1178
 
1164
- export function __wbg_fetch_11bff8299d0ecd2b(arg0) {
1165
- const ret = fetch(getObject(arg0));
1179
+ export function __wbg_fetch_509096533071c657(arg0, arg1) {
1180
+ const ret = getObject(arg0).fetch(getObject(arg1));
1166
1181
  return addHeapObject(ret);
1167
1182
  };
1168
1183
 
1169
- export function __wbg_fetch_509096533071c657(arg0, arg1) {
1170
- const ret = getObject(arg0).fetch(getObject(arg1));
1184
+ export function __wbg_fetch_f156d10be9a5c88a(arg0) {
1185
+ const ret = fetch(getObject(arg0));
1171
1186
  return addHeapObject(ret);
1172
1187
  };
1173
1188
 
@@ -1345,7 +1360,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
1345
1360
  const a = state0.a;
1346
1361
  state0.a = 0;
1347
1362
  try {
1348
- return __wbg_adapter_277(a, state0.b, arg0, arg1);
1363
+ return __wbg_adapter_280(a, state0.b, arg0, arg1);
1349
1364
  } finally {
1350
1365
  state0.a = a;
1351
1366
  }
@@ -1498,7 +1513,7 @@ export function __wbg_setItem_212ecc915942ab0a() { return handleError(function (
1498
1513
  getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
1499
1514
  }, arguments) };
1500
1515
 
1501
- export function __wbg_setTimeout_73ce8df12de4f2f2(arg0, arg1) {
1516
+ export function __wbg_setTimeout_2b339866a2aa3789(arg0, arg1) {
1502
1517
  const ret = setTimeout(getObject(arg0), arg1);
1503
1518
  return addHeapObject(ret);
1504
1519
  };
@@ -1543,6 +1558,10 @@ export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
1543
1558
  getObject(arg0).body = getObject(arg1);
1544
1559
  };
1545
1560
 
1561
+ export function __wbg_setcache_12f17c3a980650e4(arg0, arg1) {
1562
+ getObject(arg0).cache = __wbindgen_enum_RequestCache[arg1];
1563
+ };
1564
+
1546
1565
  export function __wbg_setcredentials_c3a22f1cd105a2c6(arg0, arg1) {
1547
1566
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
1548
1567
  };
@@ -1683,18 +1702,18 @@ export function __wbindgen_cb_drop(arg0) {
1683
1702
  return ret;
1684
1703
  };
1685
1704
 
1686
- export function __wbindgen_closure_wrapper1288(arg0, arg1, arg2) {
1687
- const ret = makeClosure(arg0, arg1, 26, __wbg_adapter_44);
1705
+ export function __wbindgen_closure_wrapper2565(arg0, arg1, arg2) {
1706
+ const ret = makeClosure(arg0, arg1, 33, __wbg_adapter_44);
1688
1707
  return addHeapObject(ret);
1689
1708
  };
1690
1709
 
1691
- export function __wbindgen_closure_wrapper5858(arg0, arg1, arg2) {
1692
- const ret = makeMutClosure(arg0, arg1, 684, __wbg_adapter_47);
1710
+ export function __wbindgen_closure_wrapper8144(arg0, arg1, arg2) {
1711
+ const ret = makeMutClosure(arg0, arg1, 871, __wbg_adapter_47);
1693
1712
  return addHeapObject(ret);
1694
1713
  };
1695
1714
 
1696
- export function __wbindgen_closure_wrapper6004(arg0, arg1, arg2) {
1697
- const ret = makeMutClosure(arg0, arg1, 717, __wbg_adapter_50);
1715
+ export function __wbindgen_closure_wrapper8293(arg0, arg1, arg2) {
1716
+ const ret = makeMutClosure(arg0, arg1, 905, __wbg_adapter_50);
1698
1717
  return addHeapObject(ret);
1699
1718
  };
1700
1719
 
Binary file
@@ -27,6 +27,8 @@ export enum ErrorCode {
27
27
  StarknetUnsupportedContractClassVersion = 62,
28
28
  StarknetUnexpectedError = 63,
29
29
  StarknetNoTraceAvailable = 10,
30
+ StarknetReplacementTransactionUnderpriced = 64,
31
+ StarknetFeeBelowMinimum = 65,
30
32
  SignError = 101,
31
33
  StorageError = 102,
32
34
  AccountFactoryError = 103,
@@ -85,7 +87,6 @@ export interface JsFeeEstimate {
85
87
  l1_data_gas_consumed: number;
86
88
  l1_data_gas_price: number;
87
89
  overall_fee: number;
88
- unit: JsPriceUnit;
89
90
  }
90
91
 
91
92
  export interface Owner {
@@ -141,6 +142,8 @@ export type Felts = JsFelt[];
141
142
 
142
143
  export type JsFeeSource = "PAYMASTER" | "CREDITS";
143
144
 
145
+ export type JsSubscribeSessionResult = ResponseData;
146
+
144
147
  export type JsRevokableSession = RevokableSession;
145
148
 
146
149
  export interface AuthorizedSession {
@@ -247,12 +247,12 @@ function __wbg_adapter_45(arg0, arg1, arg2) {
247
247
  wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
248
248
  }
249
249
 
250
- function __wbg_adapter_199(arg0, arg1, arg2, arg3) {
250
+ function __wbg_adapter_201(arg0, arg1, arg2, arg3) {
251
251
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2), addHeapObject(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 | 137 | 138}
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}
256
256
  */
257
257
  export const ErrorCode = Object.freeze({
258
258
  StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
@@ -281,6 +281,8 @@ export const ErrorCode = Object.freeze({
281
281
  StarknetUnsupportedContractClassVersion: 62, "62": "StarknetUnsupportedContractClassVersion",
282
282
  StarknetUnexpectedError: 63, "63": "StarknetUnexpectedError",
283
283
  StarknetNoTraceAvailable: 10, "10": "StarknetNoTraceAvailable",
284
+ StarknetReplacementTransactionUnderpriced: 64, "64": "StarknetReplacementTransactionUnderpriced",
285
+ StarknetFeeBelowMinimum: 65, "65": "StarknetFeeBelowMinimum",
284
286
  SignError: 101, "101": "SignError",
285
287
  StorageError: 102, "102": "StorageError",
286
288
  AccountFactoryError: 103, "103": "AccountFactoryError",
@@ -320,6 +322,8 @@ export const ErrorCode = Object.freeze({
320
322
  GasPriceTooHigh: 138, "138": "GasPriceTooHigh",
321
323
  });
322
324
 
325
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
326
+
323
327
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
324
328
 
325
329
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
@@ -570,7 +574,7 @@ export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg
570
574
  return addHeapObject(ret);
571
575
  }, arguments) };
572
576
 
573
- export function __wbg_clearTimeout_0b53d391c1b94dda(arg0) {
577
+ export function __wbg_clearTimeout_6222fede17abcb1a(arg0) {
574
578
  const ret = clearTimeout(takeObject(arg0));
575
579
  return addHeapObject(ret);
576
580
  };
@@ -590,13 +594,13 @@ export function __wbg_done_769e5ede4b31c67b(arg0) {
590
594
  return ret;
591
595
  };
592
596
 
593
- export function __wbg_fetch_11bff8299d0ecd2b(arg0) {
594
- const ret = fetch(getObject(arg0));
597
+ export function __wbg_fetch_509096533071c657(arg0, arg1) {
598
+ const ret = getObject(arg0).fetch(getObject(arg1));
595
599
  return addHeapObject(ret);
596
600
  };
597
601
 
598
- export function __wbg_fetch_509096533071c657(arg0, arg1) {
599
- const ret = getObject(arg0).fetch(getObject(arg1));
602
+ export function __wbg_fetch_f156d10be9a5c88a(arg0) {
603
+ const ret = fetch(getObject(arg0));
600
604
  return addHeapObject(ret);
601
605
  };
602
606
 
@@ -750,7 +754,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
750
754
  const a = state0.a;
751
755
  state0.a = 0;
752
756
  try {
753
- return __wbg_adapter_199(a, state0.b, arg0, arg1);
757
+ return __wbg_adapter_201(a, state0.b, arg0, arg1);
754
758
  } finally {
755
759
  state0.a = a;
756
760
  }
@@ -868,7 +872,7 @@ export function __wbg_resolve_4851785c9c5f573d(arg0) {
868
872
  return addHeapObject(ret);
869
873
  };
870
874
 
871
- export function __wbg_setTimeout_73ce8df12de4f2f2(arg0, arg1) {
875
+ export function __wbg_setTimeout_2b339866a2aa3789(arg0, arg1) {
872
876
  const ret = setTimeout(getObject(arg0), arg1);
873
877
  return addHeapObject(ret);
874
878
  };
@@ -898,6 +902,10 @@ export function __wbg_setbody_5923b78a95eedf29(arg0, arg1) {
898
902
  getObject(arg0).body = getObject(arg1);
899
903
  };
900
904
 
905
+ export function __wbg_setcache_12f17c3a980650e4(arg0, arg1) {
906
+ getObject(arg0).cache = __wbindgen_enum_RequestCache[arg1];
907
+ };
908
+
901
909
  export function __wbg_setcredentials_c3a22f1cd105a2c6(arg0, arg1) {
902
910
  getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
903
911
  };
@@ -1025,13 +1033,13 @@ export function __wbindgen_cb_drop(arg0) {
1025
1033
  return ret;
1026
1034
  };
1027
1035
 
1028
- export function __wbindgen_closure_wrapper2850(arg0, arg1, arg2) {
1029
- const ret = makeMutClosure(arg0, arg1, 362, __wbg_adapter_42);
1036
+ export function __wbindgen_closure_wrapper3363(arg0, arg1, arg2) {
1037
+ const ret = makeMutClosure(arg0, arg1, 401, __wbg_adapter_42);
1030
1038
  return addHeapObject(ret);
1031
1039
  };
1032
1040
 
1033
- export function __wbindgen_closure_wrapper2983(arg0, arg1, arg2) {
1034
- const ret = makeMutClosure(arg0, arg1, 395, __wbg_adapter_45);
1041
+ export function __wbindgen_closure_wrapper3499(arg0, arg1, arg2) {
1042
+ const ret = makeMutClosure(arg0, arg1, 436, __wbg_adapter_45);
1035
1043
  return addHeapObject(ret);
1036
1044
  };
1037
1045
 
Binary file