@cartridge/controller-wasm 0.7.14-24e7b0f → 0.7.14-de92897

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-24e7b0f",
3
+ "version": "0.7.14-de92897",
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;
@@ -294,19 +199,7 @@ export class CartridgeAccount {
294
199
  */
295
200
  hasPoliciesForAppId(app_id: string): Promise<boolean>;
296
201
  }
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
- */
202
+
310
203
  export class CartridgeAccountMeta {
311
204
  private constructor();
312
205
  free(): void;
@@ -319,13 +212,7 @@ export class CartridgeAccountMeta {
319
212
  owner(): Owner;
320
213
  ownerGuid(): JsFelt;
321
214
  }
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
- */
215
+
329
216
  export class CartridgeAccountWithMeta {
330
217
  private constructor();
331
218
  free(): void;
@@ -333,6 +220,7 @@ export class CartridgeAccountWithMeta {
333
220
  meta(): CartridgeAccountMeta;
334
221
  intoAccount(): CartridgeAccount;
335
222
  }
223
+
336
224
  export class ControllerFactory {
337
225
  private constructor();
338
226
  free(): void;
@@ -372,9 +260,83 @@ export class ControllerFactory {
372
260
  */
373
261
  static apiLogin(username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
374
262
  }
375
- /**
376
- * JavaScript-friendly chain configuration
377
- */
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
+
378
340
  export class JsChainConfig {
379
341
  free(): void;
380
342
  [Symbol.dispose](): void;
@@ -384,6 +346,7 @@ export class JsChainConfig {
384
346
  readonly owner: Owner;
385
347
  readonly address: JsFelt | undefined;
386
348
  }
349
+
387
350
  export class JsControllerError {
388
351
  private constructor();
389
352
  free(): void;
@@ -393,15 +356,14 @@ export class JsControllerError {
393
356
  get data(): string | undefined;
394
357
  set data(value: string | null | undefined);
395
358
  }
359
+
396
360
  export class LoginResult {
397
361
  private constructor();
398
362
  free(): void;
399
363
  [Symbol.dispose](): void;
400
364
  intoValues(): Array<any>;
401
365
  }
402
- /**
403
- * WASM bindings for MultiChainController
404
- */
366
+
405
367
  export class MultiChainAccount {
406
368
  private constructor();
407
369
  free(): void;
@@ -427,9 +389,7 @@ export class MultiChainAccount {
427
389
  */
428
390
  controller(chain_id: JsFelt): Promise<CartridgeAccount>;
429
391
  }
430
- /**
431
- * Metadata for displaying multi-chain information
432
- */
392
+
433
393
  export class MultiChainAccountMeta {
434
394
  private constructor();
435
395
  free(): void;
@@ -437,3 +397,27 @@ export class MultiChainAccountMeta {
437
397
  readonly username: string;
438
398
  readonly chains: JsFelt[];
439
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>;