@cartridge/controller-wasm 0.7.14-0df5a4c → 0.7.14-3b036eb
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 +108 -108
- package/pkg-controller/account_wasm_bg.js +292 -292
- package/pkg-controller/account_wasm_bg.wasm +0 -0
- package/pkg-session/session_wasm.d.ts +51 -51
- package/pkg-session/session_wasm_bg.js +37 -37
- package/pkg-session/session_wasm_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export type JsPriceUnit = "WEI" | "FRI";
|
|
10
|
-
|
|
11
|
-
export interface JsEstimateFeeDetails {
|
|
12
|
-
nonce: JsFelt;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface JsFeeEstimate {
|
|
16
|
-
l1_gas_consumed: number;
|
|
17
|
-
l1_gas_price: number;
|
|
18
|
-
l2_gas_consumed: number;
|
|
19
|
-
l2_gas_price: number;
|
|
20
|
-
l1_data_gas_consumed: number;
|
|
21
|
-
l1_data_gas_price: number;
|
|
22
|
-
overall_fee: number;
|
|
3
|
+
/**
|
|
4
|
+
* Result type for signExecuteFromOutside containing both the OutsideExecution and signature
|
|
5
|
+
*/
|
|
6
|
+
export interface JsSignedOutsideExecution {
|
|
7
|
+
outside_execution: JsOutsideExecutionV3;
|
|
8
|
+
signature: JsFelt[];
|
|
23
9
|
}
|
|
24
10
|
|
|
25
11
|
/**
|
|
@@ -33,12 +19,16 @@ export interface JsOutsideExecutionV3 {
|
|
|
33
19
|
nonce: [JsFelt, JsFelt];
|
|
34
20
|
}
|
|
35
21
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
export type Felts = JsFelt[];
|
|
23
|
+
|
|
24
|
+
export type JsFelt = Felt;
|
|
25
|
+
|
|
26
|
+
export type JsFeeSource = "PAYMASTER" | "CREDITS";
|
|
27
|
+
|
|
28
|
+
export interface JsCall {
|
|
29
|
+
contractAddress: JsFelt;
|
|
30
|
+
entrypoint: string;
|
|
31
|
+
calldata: JsFelt[];
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
export interface Owner {
|
|
@@ -46,10 +36,12 @@ export interface Owner {
|
|
|
46
36
|
account?: JsFelt;
|
|
47
37
|
}
|
|
48
38
|
|
|
49
|
-
export
|
|
39
|
+
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
40
|
+
|
|
41
|
+
export interface ApprovalPolicy {
|
|
50
42
|
target: JsFelt;
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
spender: JsFelt;
|
|
44
|
+
amount: JsFelt;
|
|
53
45
|
}
|
|
54
46
|
|
|
55
47
|
export interface TypedDataPolicy {
|
|
@@ -57,28 +49,18 @@ export interface TypedDataPolicy {
|
|
|
57
49
|
authorized?: boolean;
|
|
58
50
|
}
|
|
59
51
|
|
|
60
|
-
export interface
|
|
52
|
+
export interface CallPolicy {
|
|
61
53
|
target: JsFelt;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
67
|
-
|
|
68
|
-
export type JsRegister = RegisterInput;
|
|
69
|
-
|
|
70
|
-
export type JsRegisterResponse = ResponseData;
|
|
71
|
-
|
|
72
|
-
export interface WebauthnSigner {
|
|
73
|
-
rpId: string;
|
|
74
|
-
credentialId: string;
|
|
75
|
-
publicKey: string;
|
|
54
|
+
method: JsFelt;
|
|
55
|
+
authorized?: boolean;
|
|
76
56
|
}
|
|
77
57
|
|
|
78
58
|
export interface StarknetSigner {
|
|
79
59
|
privateKey: JsFelt;
|
|
80
60
|
}
|
|
81
61
|
|
|
62
|
+
export type JsAddSignerInput = SignerInput;
|
|
63
|
+
|
|
82
64
|
export interface Eip191Signer {
|
|
83
65
|
address: string;
|
|
84
66
|
}
|
|
@@ -90,20 +72,14 @@ export interface Signer {
|
|
|
90
72
|
eip191?: Eip191Signer;
|
|
91
73
|
}
|
|
92
74
|
|
|
93
|
-
export
|
|
75
|
+
export interface WebauthnSigner {
|
|
76
|
+
rpId: string;
|
|
77
|
+
credentialId: string;
|
|
78
|
+
publicKey: string;
|
|
79
|
+
}
|
|
94
80
|
|
|
95
81
|
export type JsRemoveSignerInput = SignerInput;
|
|
96
82
|
|
|
97
|
-
export type JsFelt = Felt;
|
|
98
|
-
|
|
99
|
-
export type Felts = JsFelt[];
|
|
100
|
-
|
|
101
|
-
export type JsFeeSource = "PAYMASTER" | "CREDITS";
|
|
102
|
-
|
|
103
|
-
export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
|
|
104
|
-
|
|
105
|
-
export type JsRevokableSession = RevokableSession;
|
|
106
|
-
|
|
107
83
|
export interface AuthorizedSession {
|
|
108
84
|
session: Session;
|
|
109
85
|
authorization: JsFelt[] | null;
|
|
@@ -115,6 +91,10 @@ export interface AuthorizedSession {
|
|
|
115
91
|
guardianKeyGuid: JsFelt;
|
|
116
92
|
}
|
|
117
93
|
|
|
94
|
+
export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
|
|
95
|
+
|
|
96
|
+
export type JsRevokableSession = RevokableSession;
|
|
97
|
+
|
|
118
98
|
export interface Session {
|
|
119
99
|
policies: Policy[];
|
|
120
100
|
expiresAt: number;
|
|
@@ -128,21 +108,34 @@ export interface Credentials {
|
|
|
128
108
|
privateKey: JsFelt;
|
|
129
109
|
}
|
|
130
110
|
|
|
111
|
+
export interface JsEstimateFeeDetails {
|
|
112
|
+
nonce: JsFelt;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface JsFeeEstimate {
|
|
116
|
+
l1_gas_consumed: number;
|
|
117
|
+
l1_gas_price: number;
|
|
118
|
+
l2_gas_consumed: number;
|
|
119
|
+
l2_gas_price: number;
|
|
120
|
+
l1_data_gas_consumed: number;
|
|
121
|
+
l1_data_gas_price: number;
|
|
122
|
+
overall_fee: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type JsPriceUnit = "WEI" | "FRI";
|
|
126
|
+
|
|
127
|
+
export type JsRegisterResponse = ResponseData;
|
|
128
|
+
|
|
129
|
+
export type JsRegister = RegisterInput;
|
|
130
|
+
|
|
131
131
|
|
|
132
132
|
export class CartridgeAccount {
|
|
133
133
|
private constructor();
|
|
134
134
|
free(): void;
|
|
135
135
|
[Symbol.dispose](): void;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* # Parameters
|
|
140
|
-
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
141
|
-
* - `address`: The blockchain address associated with the account.
|
|
142
|
-
* - `username`: Username associated with the account.
|
|
143
|
-
* - `owner`: A Owner struct containing the owner signer and associated data.
|
|
144
|
-
*/
|
|
145
|
-
static new(class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
136
|
+
disconnect(): Promise<void>;
|
|
137
|
+
deploySelf(max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
138
|
+
static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
|
|
146
139
|
/**
|
|
147
140
|
* Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
|
|
148
141
|
* The controller address is computed internally based on the generated signer.
|
|
@@ -152,32 +145,31 @@ export class CartridgeAccount {
|
|
|
152
145
|
* - `username`: Username associated with the account.
|
|
153
146
|
*/
|
|
154
147
|
static newHeadless(class_hash: JsFelt, rpc_url: string, username: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
155
|
-
static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
|
|
156
|
-
disconnect(): Promise<void>;
|
|
157
|
-
registerSession(app_id: string, policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
158
|
-
registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
|
|
159
|
-
upgrade(new_class_hash: JsFelt): Promise<JsCall>;
|
|
160
|
-
register(register: JsRegister): Promise<JsRegisterResponse>;
|
|
161
|
-
createSession(app_id: string, policies: Policy[], expires_at: bigint, authorize_user_execution?: boolean | null): Promise<AuthorizedSession | undefined>;
|
|
162
|
-
skipSession(app_id: string, policies: Policy[]): Promise<void>;
|
|
163
|
-
addOwner(owner?: Signer | null, signer_input?: JsAddSignerInput | null, rp_id?: string | null): Promise<void>;
|
|
164
148
|
removeOwner(signer: JsRemoveSignerInput): Promise<void>;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
169
|
-
executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
170
|
-
trySessionExecute(app_id: string, calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
171
|
-
isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
|
|
172
|
-
hasRequestedSession(app_id: string, policies: Policy[]): Promise<boolean>;
|
|
149
|
+
signMessage(typed_data: string): Promise<Felts>;
|
|
150
|
+
skipSession(app_id: string, policies: Policy[]): Promise<void>;
|
|
151
|
+
createSession(app_id: string, policies: Policy[], expires_at: bigint, authorize_user_execution?: boolean | null): Promise<AuthorizedSession | undefined>;
|
|
173
152
|
revokeSession(session: JsRevokableSession): Promise<void>;
|
|
174
153
|
revokeSessions(sessions: JsRevokableSession[]): Promise<void>;
|
|
175
|
-
signMessage(typed_data: string): Promise<Felts>;
|
|
176
|
-
getNonce(): Promise<any>;
|
|
177
|
-
deploySelf(max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
178
154
|
delegateAccount(): Promise<JsFelt>;
|
|
179
|
-
|
|
180
|
-
|
|
155
|
+
registerSession(app_id: string, policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
156
|
+
estimateInvokeFee(calls: JsCall[]): Promise<JsFeeEstimate>;
|
|
157
|
+
trySessionExecute(app_id: string, calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
158
|
+
createPasskeySigner(rp_id: string): Promise<JsAddSignerInput>;
|
|
159
|
+
hasRequestedSession(app_id: string, policies: Policy[]): Promise<boolean>;
|
|
160
|
+
executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
161
|
+
executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
162
|
+
/**
|
|
163
|
+
* Checks if there are stored policies for a given app_id.
|
|
164
|
+
*
|
|
165
|
+
* # Parameters
|
|
166
|
+
* - `app_id`: The application identifier to check for stored policies
|
|
167
|
+
*
|
|
168
|
+
* # Returns
|
|
169
|
+
* `true` if policies exist for the given app_id, `false` otherwise
|
|
170
|
+
*/
|
|
171
|
+
hasPoliciesForAppId(app_id: string): Promise<boolean>;
|
|
172
|
+
registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
|
|
181
173
|
/**
|
|
182
174
|
* Signs an OutsideExecution V3 transaction and returns both the OutsideExecution object and its signature.
|
|
183
175
|
*
|
|
@@ -188,37 +180,45 @@ export class CartridgeAccount {
|
|
|
188
180
|
* A `JsSignedOutsideExecution` containing the OutsideExecution V3 object and its signature
|
|
189
181
|
*/
|
|
190
182
|
signExecuteFromOutside(calls: JsCall[]): Promise<JsSignedOutsideExecution>;
|
|
183
|
+
isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
|
|
184
|
+
hasAuthorizedPoliciesForCalls(app_id: string, calls: JsCall[]): Promise<boolean>;
|
|
185
|
+
hasAuthorizedPoliciesForMessage(app_id: string, typed_data: string): Promise<boolean>;
|
|
191
186
|
/**
|
|
192
|
-
*
|
|
187
|
+
* Creates a new `CartridgeAccount` instance.
|
|
193
188
|
*
|
|
194
189
|
* # Parameters
|
|
195
|
-
* - `
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* `
|
|
190
|
+
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
191
|
+
* - `address`: The blockchain address associated with the account.
|
|
192
|
+
* - `username`: Username associated with the account.
|
|
193
|
+
* - `owner`: A Owner struct containing the owner signer and associated data.
|
|
199
194
|
*/
|
|
200
|
-
|
|
195
|
+
static new(class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
196
|
+
execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
|
|
197
|
+
upgrade(new_class_hash: JsFelt): Promise<JsCall>;
|
|
198
|
+
register(register: JsRegister): Promise<JsRegisterResponse>;
|
|
199
|
+
addOwner(owner?: Signer | null, signer_input?: JsAddSignerInput | null, rp_id?: string | null): Promise<void>;
|
|
200
|
+
getNonce(): Promise<any>;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
export class CartridgeAccountMeta {
|
|
204
204
|
private constructor();
|
|
205
205
|
free(): void;
|
|
206
206
|
[Symbol.dispose](): void;
|
|
207
|
-
username(): string;
|
|
208
|
-
address(): string;
|
|
209
207
|
classHash(): string;
|
|
208
|
+
ownerGuid(): JsFelt;
|
|
209
|
+
owner(): Owner;
|
|
210
|
+
address(): string;
|
|
210
211
|
rpcUrl(): string;
|
|
211
212
|
chainId(): string;
|
|
212
|
-
|
|
213
|
-
ownerGuid(): JsFelt;
|
|
213
|
+
username(): string;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
export class CartridgeAccountWithMeta {
|
|
217
217
|
private constructor();
|
|
218
218
|
free(): void;
|
|
219
219
|
[Symbol.dispose](): void;
|
|
220
|
-
meta(): CartridgeAccountMeta;
|
|
221
220
|
intoAccount(): CartridgeAccount;
|
|
221
|
+
meta(): CartridgeAccountMeta;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
export class ControllerFactory {
|
|
@@ -342,9 +342,9 @@ export class JsChainConfig {
|
|
|
342
342
|
[Symbol.dispose](): void;
|
|
343
343
|
constructor(class_hash: JsFelt, rpc_url: string, owner: Owner, address?: JsFelt | null);
|
|
344
344
|
readonly class_hash: JsFelt;
|
|
345
|
-
readonly rpc_url: string;
|
|
346
345
|
readonly owner: Owner;
|
|
347
346
|
readonly address: JsFelt | undefined;
|
|
347
|
+
readonly rpc_url: string;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
export class JsControllerError {
|
|
@@ -369,33 +369,33 @@ export class MultiChainAccount {
|
|
|
369
369
|
free(): void;
|
|
370
370
|
[Symbol.dispose](): void;
|
|
371
371
|
/**
|
|
372
|
-
*
|
|
372
|
+
* Gets an account instance for a specific chain
|
|
373
373
|
*/
|
|
374
|
-
|
|
374
|
+
controller(chain_id: JsFelt): Promise<CartridgeAccount>;
|
|
375
375
|
/**
|
|
376
376
|
* Loads a MultiChainAccount from storage
|
|
377
377
|
*/
|
|
378
378
|
static fromStorage(cartridge_api_url: string): Promise<MultiChainAccount | undefined>;
|
|
379
|
-
/**
|
|
380
|
-
* Adds a new chain configuration
|
|
381
|
-
*/
|
|
382
|
-
addChain(config: JsChainConfig): Promise<void>;
|
|
383
379
|
/**
|
|
384
380
|
* Removes a chain configuration
|
|
385
381
|
*/
|
|
386
382
|
removeChain(chain_id: JsFelt): Promise<void>;
|
|
387
383
|
/**
|
|
388
|
-
*
|
|
384
|
+
* Creates a new MultiChainAccount with multiple chain configurations
|
|
389
385
|
*/
|
|
390
|
-
|
|
386
|
+
static create(username: string, chain_configs: JsChainConfig[], cartridge_api_url: string): Promise<MultiChainAccount>;
|
|
387
|
+
/**
|
|
388
|
+
* Adds a new chain configuration
|
|
389
|
+
*/
|
|
390
|
+
addChain(config: JsChainConfig): Promise<void>;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
export class MultiChainAccountMeta {
|
|
394
394
|
private constructor();
|
|
395
395
|
free(): void;
|
|
396
396
|
[Symbol.dispose](): void;
|
|
397
|
-
readonly username: string;
|
|
398
397
|
readonly chains: JsFelt[];
|
|
398
|
+
readonly username: string;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
/**
|