@cartridge/controller-wasm 0.3.6 → 0.3.7

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.6",
3
+ "version": "0.3.7",
4
4
  "description": "Wasm bindings for Cartridge Controller and Session Account",
5
5
  "type": "module",
6
6
  "main": "./pkg-controller/account_wasm.js",
@@ -90,6 +90,8 @@ export enum ErrorCode {
90
90
  TransactionTimeout = 139,
91
91
  ConversionError = 140,
92
92
  InvalidChainId = 141,
93
+ SessionRefreshRequired = 142,
94
+ ManualExecutionRequired = 143,
93
95
  }
94
96
  export interface JsCall {
95
97
  contractAddress: JsFelt;
@@ -216,18 +218,18 @@ export interface Credentials {
216
218
  export class CartridgeAccount {
217
219
  private constructor();
218
220
  free(): void;
221
+ [Symbol.dispose](): void;
219
222
  /**
220
223
  * Creates a new `CartridgeAccount` instance.
221
224
  *
222
225
  * # Parameters
223
226
  * - `app_id`: Application identifier.
224
227
  * - `rpc_url`: The URL of the JSON-RPC endpoint.
225
- * - `chain_id`: Identifier of the blockchain network to interact with.
226
228
  * - `address`: The blockchain address associated with the account.
227
229
  * - `username`: Username associated with the account.
228
230
  * - `owner`: A Owner struct containing the owner signer and associated data.
229
231
  */
230
- static new(app_id: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): CartridgeAccountWithMeta;
232
+ static new(app_id: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
231
233
  /**
232
234
  * Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
233
235
  * The controller address is computed internally based on the generated signer.
@@ -235,11 +237,10 @@ export class CartridgeAccount {
235
237
  * # Parameters
236
238
  * - `app_id`: Application identifier.
237
239
  * - `rpc_url`: The URL of the JSON-RPC endpoint.
238
- * - `chain_id`: Identifier of the blockchain network to interact with.
239
240
  * - `username`: Username associated with the account.
240
241
  */
241
- static newHeadless(app_id: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, username: string, cartridge_api_url: string): CartridgeAccountWithMeta;
242
- static fromStorage(app_id: string, cartridge_api_url: string): CartridgeAccountWithMeta | undefined;
242
+ static newHeadless(app_id: string, class_hash: JsFelt, rpc_url: string, username: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
243
+ static fromStorage(app_id: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
243
244
  disconnect(): Promise<void>;
244
245
  registerSession(policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
245
246
  registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
@@ -254,6 +255,7 @@ export class CartridgeAccount {
254
255
  execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
255
256
  executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
256
257
  executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
258
+ trySessionExecute(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
257
259
  isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
258
260
  hasRequestedSession(policies: Policy[]): Promise<boolean>;
259
261
  revokeSession(session: JsRevokableSession): Promise<void>;
@@ -291,6 +293,7 @@ export class CartridgeAccount {
291
293
  export class CartridgeAccountMeta {
292
294
  private constructor();
293
295
  free(): void;
296
+ [Symbol.dispose](): void;
294
297
  appId(): string;
295
298
  username(): string;
296
299
  address(): string;
@@ -310,22 +313,25 @@ export class CartridgeAccountMeta {
310
313
  export class CartridgeAccountWithMeta {
311
314
  private constructor();
312
315
  free(): void;
316
+ [Symbol.dispose](): void;
313
317
  meta(): CartridgeAccountMeta;
314
318
  intoAccount(): CartridgeAccount;
315
319
  }
316
320
  export class ControllerFactory {
317
321
  private constructor();
318
322
  free(): void;
319
- static fromStorage(app_id: string, cartridge_api_url: string): CartridgeAccountWithMeta | undefined;
320
- static login(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, address: JsFelt, owner: Owner, cartridge_api_url: string, session_expires_at_s: bigint, is_controller_registered?: boolean | null): Promise<LoginResult>;
323
+ [Symbol.dispose](): void;
324
+ static fromStorage(app_id: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
325
+ static login(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string, session_expires_at_s: bigint, is_controller_registered?: boolean | null): Promise<LoginResult>;
321
326
  /**
322
327
  * This should only be used with webauthn signers
323
328
  */
324
- static apiLogin(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, chain_id: JsFelt, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
329
+ static apiLogin(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
325
330
  }
326
331
  export class JsControllerError {
327
332
  private constructor();
328
333
  free(): void;
334
+ [Symbol.dispose](): void;
329
335
  code: ErrorCode;
330
336
  message: string;
331
337
  get data(): string | undefined;
@@ -334,5 +340,6 @@ export class JsControllerError {
334
340
  export class LoginResult {
335
341
  private constructor();
336
342
  free(): void;
343
+ [Symbol.dispose](): void;
337
344
  intoValues(): Array<any>;
338
345
  }