@cartridge/controller-wasm 0.7.14-0df5a4c → 0.7.14-24e7b0f

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.7.14-0df5a4c",
3
+ "version": "0.7.14-24e7b0f",
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,101 @@
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
+ }
3
99
  export interface JsCall {
4
100
  contractAddress: JsFelt;
5
101
  entrypoint: string;
@@ -128,7 +224,6 @@ export interface Credentials {
128
224
  privateKey: JsFelt;
129
225
  }
130
226
 
131
-
132
227
  export class CartridgeAccount {
133
228
  private constructor();
134
229
  free(): void;
@@ -199,7 +294,19 @@ export class CartridgeAccount {
199
294
  */
200
295
  hasPoliciesForAppId(app_id: string): Promise<boolean>;
201
296
  }
202
-
297
+ /**
298
+ * A type for accessing fixed attributes of `CartridgeAccount`.
299
+ *
300
+ * This type exists as concurrent mutable and immutable calls to `CartridgeAccount` are guarded
301
+ * with `WasmMutex`, which only operates under an `async` context. If these getters were directly
302
+ * implemented under `CartridgeAccount`:
303
+ *
304
+ * - calls to them would unnecessarily have to be `async` as well;
305
+ * - there would be excessive locking.
306
+ *
307
+ * This type is supposed to only ever be borrowed immutably. So no concurrent access control would
308
+ * be needed.
309
+ */
203
310
  export class CartridgeAccountMeta {
204
311
  private constructor();
205
312
  free(): void;
@@ -212,7 +319,13 @@ export class CartridgeAccountMeta {
212
319
  owner(): Owner;
213
320
  ownerGuid(): JsFelt;
214
321
  }
215
-
322
+ /**
323
+ * A type used as the return type for constructing `CartridgeAccount` to provide an extra,
324
+ * separately borrowable `meta` field for synchronously accessing fixed fields.
325
+ *
326
+ * This type exists instead of simply having `CartridgeAccount::new()` return a tuple as tuples
327
+ * don't implement `IntoWasmAbi` which is needed for crossing JS-WASM boundary.
328
+ */
216
329
  export class CartridgeAccountWithMeta {
217
330
  private constructor();
218
331
  free(): void;
@@ -220,7 +333,6 @@ export class CartridgeAccountWithMeta {
220
333
  meta(): CartridgeAccountMeta;
221
334
  intoAccount(): CartridgeAccount;
222
335
  }
223
-
224
336
  export class ControllerFactory {
225
337
  private constructor();
226
338
  free(): void;
@@ -260,83 +372,9 @@ export class ControllerFactory {
260
372
  */
261
373
  static apiLogin(username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
262
374
  }
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
-
375
+ /**
376
+ * JavaScript-friendly chain configuration
377
+ */
340
378
  export class JsChainConfig {
341
379
  free(): void;
342
380
  [Symbol.dispose](): void;
@@ -346,7 +384,6 @@ export class JsChainConfig {
346
384
  readonly owner: Owner;
347
385
  readonly address: JsFelt | undefined;
348
386
  }
349
-
350
387
  export class JsControllerError {
351
388
  private constructor();
352
389
  free(): void;
@@ -356,14 +393,15 @@ export class JsControllerError {
356
393
  get data(): string | undefined;
357
394
  set data(value: string | null | undefined);
358
395
  }
359
-
360
396
  export class LoginResult {
361
397
  private constructor();
362
398
  free(): void;
363
399
  [Symbol.dispose](): void;
364
400
  intoValues(): Array<any>;
365
401
  }
366
-
402
+ /**
403
+ * WASM bindings for MultiChainController
404
+ */
367
405
  export class MultiChainAccount {
368
406
  private constructor();
369
407
  free(): void;
@@ -389,7 +427,9 @@ export class MultiChainAccount {
389
427
  */
390
428
  controller(chain_id: JsFelt): Promise<CartridgeAccount>;
391
429
  }
392
-
430
+ /**
431
+ * Metadata for displaying multi-chain information
432
+ */
393
433
  export class MultiChainAccountMeta {
394
434
  private constructor();
395
435
  free(): void;
@@ -397,27 +437,3 @@ export class MultiChainAccountMeta {
397
437
  readonly username: string;
398
438
  readonly chains: JsFelt[];
399
439
  }
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>;