@cartridge/controller-wasm 0.3.19 → 0.7.14-0df5a4c

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.19",
3
+ "version": "0.7.14-0df5a4c",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -1,101 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Computes the Starknet contract address for a controller account without needing a full instance.
5
- *
6
- * # Arguments
7
- *
8
- * * `class_hash` - The class hash of the account contract (JsFelt).
9
- * * `owner` - The owner configuration for the account.
10
- * * `salt` - The salt used for address calculation (JsFelt).
11
- *
12
- * # Returns
13
- *
14
- * The computed Starknet contract address as a `JsFelt`.
15
- */
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;
24
- export enum ErrorCode {
25
- StarknetFailedToReceiveTransaction = 1,
26
- StarknetContractNotFound = 20,
27
- StarknetBlockNotFound = 24,
28
- StarknetInvalidTransactionIndex = 27,
29
- StarknetClassHashNotFound = 28,
30
- StarknetTransactionHashNotFound = 29,
31
- StarknetPageSizeTooBig = 31,
32
- StarknetNoBlocks = 32,
33
- StarknetInvalidContinuationToken = 33,
34
- StarknetTooManyKeysInFilter = 34,
35
- StarknetContractError = 40,
36
- StarknetTransactionExecutionError = 41,
37
- StarknetClassAlreadyDeclared = 51,
38
- StarknetInvalidTransactionNonce = 52,
39
- StarknetInsufficientMaxFee = 53,
40
- StarknetInsufficientAccountBalance = 54,
41
- StarknetValidationFailure = 55,
42
- StarknetCompilationFailed = 56,
43
- StarknetContractClassSizeIsTooLarge = 57,
44
- StarknetNonAccount = 58,
45
- StarknetDuplicateTx = 59,
46
- StarknetCompiledClassHashMismatch = 60,
47
- StarknetUnsupportedTxVersion = 61,
48
- StarknetUnsupportedContractClassVersion = 62,
49
- StarknetUnexpectedError = 63,
50
- StarknetNoTraceAvailable = 10,
51
- StarknetReplacementTransactionUnderpriced = 64,
52
- StarknetFeeBelowMinimum = 65,
53
- SignError = 101,
54
- StorageError = 102,
55
- AccountFactoryError = 103,
56
- PaymasterExecutionTimeNotReached = 104,
57
- PaymasterExecutionTimePassed = 105,
58
- PaymasterInvalidCaller = 106,
59
- PaymasterRateLimitExceeded = 107,
60
- PaymasterNotSupported = 108,
61
- PaymasterHttp = 109,
62
- PaymasterExcecution = 110,
63
- PaymasterSerialization = 111,
64
- CartridgeControllerNotDeployed = 112,
65
- InsufficientBalance = 113,
66
- OriginError = 114,
67
- EncodingError = 115,
68
- SerdeWasmBindgenError = 116,
69
- CairoSerdeError = 117,
70
- CairoShortStringToFeltError = 118,
71
- DeviceCreateCredential = 119,
72
- DeviceGetAssertion = 120,
73
- DeviceBadAssertion = 121,
74
- DeviceChannel = 122,
75
- DeviceOrigin = 123,
76
- AccountSigning = 124,
77
- AccountProvider = 125,
78
- AccountClassHashCalculation = 126,
79
- AccountFeeOutOfRange = 128,
80
- ProviderRateLimited = 129,
81
- ProviderArrayLengthMismatch = 130,
82
- ProviderOther = 131,
83
- SessionAlreadyRegistered = 132,
84
- UrlParseError = 133,
85
- Base64DecodeError = 134,
86
- CoseError = 135,
87
- PolicyChainIdMismatch = 136,
88
- InvalidOwner = 137,
89
- GasPriceTooHigh = 138,
90
- TransactionTimeout = 139,
91
- ConversionError = 140,
92
- InvalidChainId = 141,
93
- SessionRefreshRequired = 142,
94
- ManualExecutionRequired = 143,
95
- ForbiddenEntrypoint = 144,
96
- GasAmountTooHigh = 145,
97
- ApproveExecutionRequired = 146,
98
- }
99
3
  export interface JsCall {
100
4
  contractAddress: JsFelt;
101
5
  entrypoint: string;
@@ -224,6 +128,7 @@ export interface Credentials {
224
128
  privateKey: JsFelt;
225
129
  }
226
130
 
131
+
227
132
  export class CartridgeAccount {
228
133
  private constructor();
229
134
  free(): void;
@@ -283,20 +188,18 @@ export class CartridgeAccount {
283
188
  * A `JsSignedOutsideExecution` containing the OutsideExecution V3 object and its signature
284
189
  */
285
190
  signExecuteFromOutside(calls: JsCall[]): Promise<JsSignedOutsideExecution>;
191
+ /**
192
+ * Checks if there are stored policies for a given app_id.
193
+ *
194
+ * # Parameters
195
+ * - `app_id`: The application identifier to check for stored policies
196
+ *
197
+ * # Returns
198
+ * `true` if policies exist for the given app_id, `false` otherwise
199
+ */
200
+ hasPoliciesForAppId(app_id: string): Promise<boolean>;
286
201
  }
287
- /**
288
- * A type for accessing fixed attributes of `CartridgeAccount`.
289
- *
290
- * This type exists as concurrent mutable and immutable calls to `CartridgeAccount` are guarded
291
- * with `WasmMutex`, which only operates under an `async` context. If these getters were directly
292
- * implemented under `CartridgeAccount`:
293
- *
294
- * - calls to them would unnecessarily have to be `async` as well;
295
- * - there would be excessive locking.
296
- *
297
- * This type is supposed to only ever be borrowed immutably. So no concurrent access control would
298
- * be needed.
299
- */
202
+
300
203
  export class CartridgeAccountMeta {
301
204
  private constructor();
302
205
  free(): void;
@@ -309,13 +212,7 @@ export class CartridgeAccountMeta {
309
212
  owner(): Owner;
310
213
  ownerGuid(): JsFelt;
311
214
  }
312
- /**
313
- * A type used as the return type for constructing `CartridgeAccount` to provide an extra,
314
- * separately borrowable `meta` field for synchronously accessing fixed fields.
315
- *
316
- * This type exists instead of simply having `CartridgeAccount::new()` return a tuple as tuples
317
- * don't implement `IntoWasmAbi` which is needed for crossing JS-WASM boundary.
318
- */
215
+
319
216
  export class CartridgeAccountWithMeta {
320
217
  private constructor();
321
218
  free(): void;
@@ -323,6 +220,7 @@ export class CartridgeAccountWithMeta {
323
220
  meta(): CartridgeAccountMeta;
324
221
  intoAccount(): CartridgeAccount;
325
222
  }
223
+
326
224
  export class ControllerFactory {
327
225
  private constructor();
328
226
  free(): void;
@@ -362,9 +260,83 @@ export class ControllerFactory {
362
260
  */
363
261
  static apiLogin(username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
364
262
  }
365
- /**
366
- * JavaScript-friendly chain configuration
367
- */
263
+
264
+ export enum ErrorCode {
265
+ StarknetFailedToReceiveTransaction = 1,
266
+ StarknetContractNotFound = 20,
267
+ StarknetBlockNotFound = 24,
268
+ StarknetInvalidTransactionIndex = 27,
269
+ StarknetClassHashNotFound = 28,
270
+ StarknetTransactionHashNotFound = 29,
271
+ StarknetPageSizeTooBig = 31,
272
+ StarknetNoBlocks = 32,
273
+ StarknetInvalidContinuationToken = 33,
274
+ StarknetTooManyKeysInFilter = 34,
275
+ StarknetContractError = 40,
276
+ StarknetTransactionExecutionError = 41,
277
+ StarknetClassAlreadyDeclared = 51,
278
+ StarknetInvalidTransactionNonce = 52,
279
+ StarknetInsufficientMaxFee = 53,
280
+ StarknetInsufficientAccountBalance = 54,
281
+ StarknetValidationFailure = 55,
282
+ StarknetCompilationFailed = 56,
283
+ StarknetContractClassSizeIsTooLarge = 57,
284
+ StarknetNonAccount = 58,
285
+ StarknetDuplicateTx = 59,
286
+ StarknetCompiledClassHashMismatch = 60,
287
+ StarknetUnsupportedTxVersion = 61,
288
+ StarknetUnsupportedContractClassVersion = 62,
289
+ StarknetUnexpectedError = 63,
290
+ StarknetNoTraceAvailable = 10,
291
+ StarknetReplacementTransactionUnderpriced = 64,
292
+ StarknetFeeBelowMinimum = 65,
293
+ SignError = 101,
294
+ StorageError = 102,
295
+ AccountFactoryError = 103,
296
+ PaymasterExecutionTimeNotReached = 104,
297
+ PaymasterExecutionTimePassed = 105,
298
+ PaymasterInvalidCaller = 106,
299
+ PaymasterRateLimitExceeded = 107,
300
+ PaymasterNotSupported = 108,
301
+ PaymasterHttp = 109,
302
+ PaymasterExcecution = 110,
303
+ PaymasterSerialization = 111,
304
+ CartridgeControllerNotDeployed = 112,
305
+ InsufficientBalance = 113,
306
+ OriginError = 114,
307
+ EncodingError = 115,
308
+ SerdeWasmBindgenError = 116,
309
+ CairoSerdeError = 117,
310
+ CairoShortStringToFeltError = 118,
311
+ DeviceCreateCredential = 119,
312
+ DeviceGetAssertion = 120,
313
+ DeviceBadAssertion = 121,
314
+ DeviceChannel = 122,
315
+ DeviceOrigin = 123,
316
+ AccountSigning = 124,
317
+ AccountProvider = 125,
318
+ AccountClassHashCalculation = 126,
319
+ AccountFeeOutOfRange = 128,
320
+ ProviderRateLimited = 129,
321
+ ProviderArrayLengthMismatch = 130,
322
+ ProviderOther = 131,
323
+ SessionAlreadyRegistered = 132,
324
+ UrlParseError = 133,
325
+ Base64DecodeError = 134,
326
+ CoseError = 135,
327
+ PolicyChainIdMismatch = 136,
328
+ InvalidOwner = 137,
329
+ GasPriceTooHigh = 138,
330
+ TransactionTimeout = 139,
331
+ ConversionError = 140,
332
+ InvalidChainId = 141,
333
+ SessionRefreshRequired = 142,
334
+ ManualExecutionRequired = 143,
335
+ ForbiddenEntrypoint = 144,
336
+ GasAmountTooHigh = 145,
337
+ ApproveExecutionRequired = 146,
338
+ }
339
+
368
340
  export class JsChainConfig {
369
341
  free(): void;
370
342
  [Symbol.dispose](): void;
@@ -374,6 +346,7 @@ export class JsChainConfig {
374
346
  readonly owner: Owner;
375
347
  readonly address: JsFelt | undefined;
376
348
  }
349
+
377
350
  export class JsControllerError {
378
351
  private constructor();
379
352
  free(): void;
@@ -383,15 +356,14 @@ export class JsControllerError {
383
356
  get data(): string | undefined;
384
357
  set data(value: string | null | undefined);
385
358
  }
359
+
386
360
  export class LoginResult {
387
361
  private constructor();
388
362
  free(): void;
389
363
  [Symbol.dispose](): void;
390
364
  intoValues(): Array<any>;
391
365
  }
392
- /**
393
- * WASM bindings for MultiChainController
394
- */
366
+
395
367
  export class MultiChainAccount {
396
368
  private constructor();
397
369
  free(): void;
@@ -417,9 +389,7 @@ export class MultiChainAccount {
417
389
  */
418
390
  controller(chain_id: JsFelt): Promise<CartridgeAccount>;
419
391
  }
420
- /**
421
- * Metadata for displaying multi-chain information
422
- */
392
+
423
393
  export class MultiChainAccountMeta {
424
394
  private constructor();
425
395
  free(): void;
@@ -427,3 +397,27 @@ export class MultiChainAccountMeta {
427
397
  readonly username: string;
428
398
  readonly chains: JsFelt[];
429
399
  }
400
+
401
+ /**
402
+ * Computes the Starknet contract address for a controller account without needing a full instance.
403
+ *
404
+ * # Arguments
405
+ *
406
+ * * `class_hash` - The class hash of the account contract (JsFelt).
407
+ * * `owner` - The owner configuration for the account.
408
+ * * `salt` - The salt used for address calculation (JsFelt).
409
+ *
410
+ * # Returns
411
+ *
412
+ * The computed Starknet contract address as a `JsFelt`.
413
+ */
414
+ export function computeAccountAddress(class_hash: JsFelt, owner: Owner, salt: JsFelt): JsFelt;
415
+
416
+ export function signerToGuid(signer: Signer): JsFelt;
417
+
418
+ /**
419
+ * Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
420
+ * The goal of this function is to know from any place when the register session flow has been completed, and to
421
+ * get the authorization.
422
+ */
423
+ export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;