@cartridge/controller-wasm 0.3.5 → 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 +1 -1
- package/pkg-controller/account_wasm.d.ts +23 -11
- package/pkg-controller/account_wasm_bg.js +341 -374
- package/pkg-controller/account_wasm_bg.wasm +0 -0
- package/pkg-session/session_wasm.d.ts +12 -1
- package/pkg-session/session_wasm_bg.js +216 -196
- package/pkg-session/session_wasm_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function signerToGuid(signer: Signer): JsFelt;
|
|
4
3
|
/**
|
|
5
4
|
* Computes the Starknet contract address for a controller account without needing a full instance.
|
|
6
5
|
*
|
|
@@ -15,6 +14,13 @@ export function signerToGuid(signer: Signer): JsFelt;
|
|
|
15
14
|
* The computed Starknet contract address as a `JsFelt`.
|
|
16
15
|
*/
|
|
17
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;
|
|
18
24
|
export enum ErrorCode {
|
|
19
25
|
StarknetFailedToReceiveTransaction = 1,
|
|
20
26
|
StarknetContractNotFound = 20,
|
|
@@ -84,6 +90,8 @@ export enum ErrorCode {
|
|
|
84
90
|
TransactionTimeout = 139,
|
|
85
91
|
ConversionError = 140,
|
|
86
92
|
InvalidChainId = 141,
|
|
93
|
+
SessionRefreshRequired = 142,
|
|
94
|
+
ManualExecutionRequired = 143,
|
|
87
95
|
}
|
|
88
96
|
export interface JsCall {
|
|
89
97
|
contractAddress: JsFelt;
|
|
@@ -179,7 +187,7 @@ export type Felts = JsFelt[];
|
|
|
179
187
|
|
|
180
188
|
export type JsFeeSource = "PAYMASTER" | "CREDITS";
|
|
181
189
|
|
|
182
|
-
export type JsSubscribeSessionResult =
|
|
190
|
+
export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
|
|
183
191
|
|
|
184
192
|
export type JsRevokableSession = RevokableSession;
|
|
185
193
|
|
|
@@ -210,18 +218,18 @@ export interface Credentials {
|
|
|
210
218
|
export class CartridgeAccount {
|
|
211
219
|
private constructor();
|
|
212
220
|
free(): void;
|
|
221
|
+
[Symbol.dispose](): void;
|
|
213
222
|
/**
|
|
214
223
|
* Creates a new `CartridgeAccount` instance.
|
|
215
224
|
*
|
|
216
225
|
* # Parameters
|
|
217
226
|
* - `app_id`: Application identifier.
|
|
218
227
|
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
219
|
-
* - `chain_id`: Identifier of the blockchain network to interact with.
|
|
220
228
|
* - `address`: The blockchain address associated with the account.
|
|
221
229
|
* - `username`: Username associated with the account.
|
|
222
230
|
* - `owner`: A Owner struct containing the owner signer and associated data.
|
|
223
231
|
*/
|
|
224
|
-
static new(app_id: string, class_hash: JsFelt, rpc_url: string,
|
|
232
|
+
static new(app_id: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
225
233
|
/**
|
|
226
234
|
* Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
|
|
227
235
|
* The controller address is computed internally based on the generated signer.
|
|
@@ -229,11 +237,10 @@ export class CartridgeAccount {
|
|
|
229
237
|
* # Parameters
|
|
230
238
|
* - `app_id`: Application identifier.
|
|
231
239
|
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
232
|
-
* - `chain_id`: Identifier of the blockchain network to interact with.
|
|
233
240
|
* - `username`: Username associated with the account.
|
|
234
241
|
*/
|
|
235
|
-
static newHeadless(app_id: string, class_hash: JsFelt, rpc_url: string,
|
|
236
|
-
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>;
|
|
237
244
|
disconnect(): Promise<void>;
|
|
238
245
|
registerSession(policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
239
246
|
registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
|
|
@@ -248,6 +255,7 @@ export class CartridgeAccount {
|
|
|
248
255
|
execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
|
|
249
256
|
executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
250
257
|
executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
258
|
+
trySessionExecute(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
251
259
|
isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
|
|
252
260
|
hasRequestedSession(policies: Policy[]): Promise<boolean>;
|
|
253
261
|
revokeSession(session: JsRevokableSession): Promise<void>;
|
|
@@ -258,7 +266,6 @@ export class CartridgeAccount {
|
|
|
258
266
|
delegateAccount(): Promise<JsFelt>;
|
|
259
267
|
hasAuthorizedPoliciesForCalls(calls: JsCall[]): Promise<boolean>;
|
|
260
268
|
hasAuthorizedPoliciesForMessage(typed_data: string): Promise<boolean>;
|
|
261
|
-
subscribeCreateSession(controller_id: string, session_key_guid: JsFelt): Promise<JsSubscribeSessionResult>;
|
|
262
269
|
/**
|
|
263
270
|
* Signs an OutsideExecution V3 transaction and returns both the OutsideExecution object and its signature.
|
|
264
271
|
*
|
|
@@ -286,6 +293,7 @@ export class CartridgeAccount {
|
|
|
286
293
|
export class CartridgeAccountMeta {
|
|
287
294
|
private constructor();
|
|
288
295
|
free(): void;
|
|
296
|
+
[Symbol.dispose](): void;
|
|
289
297
|
appId(): string;
|
|
290
298
|
username(): string;
|
|
291
299
|
address(): string;
|
|
@@ -305,22 +313,25 @@ export class CartridgeAccountMeta {
|
|
|
305
313
|
export class CartridgeAccountWithMeta {
|
|
306
314
|
private constructor();
|
|
307
315
|
free(): void;
|
|
316
|
+
[Symbol.dispose](): void;
|
|
308
317
|
meta(): CartridgeAccountMeta;
|
|
309
318
|
intoAccount(): CartridgeAccount;
|
|
310
319
|
}
|
|
311
320
|
export class ControllerFactory {
|
|
312
321
|
private constructor();
|
|
313
322
|
free(): void;
|
|
314
|
-
|
|
315
|
-
static
|
|
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>;
|
|
316
326
|
/**
|
|
317
327
|
* This should only be used with webauthn signers
|
|
318
328
|
*/
|
|
319
|
-
static apiLogin(app_id: string, username: string, class_hash: JsFelt, rpc_url: string,
|
|
329
|
+
static apiLogin(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
320
330
|
}
|
|
321
331
|
export class JsControllerError {
|
|
322
332
|
private constructor();
|
|
323
333
|
free(): void;
|
|
334
|
+
[Symbol.dispose](): void;
|
|
324
335
|
code: ErrorCode;
|
|
325
336
|
message: string;
|
|
326
337
|
get data(): string | undefined;
|
|
@@ -329,5 +340,6 @@ export class JsControllerError {
|
|
|
329
340
|
export class LoginResult {
|
|
330
341
|
private constructor();
|
|
331
342
|
free(): void;
|
|
343
|
+
[Symbol.dispose](): void;
|
|
332
344
|
intoValues(): Array<any>;
|
|
333
345
|
}
|