@cartridge/controller-wasm 0.7.14-3b036eb → 0.7.14-44f18f37
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 +7 -4
- package/pkg-controller/account_wasm.d.ts +367 -299
- package/pkg-controller/account_wasm.js +7 -2
- package/pkg-controller/account_wasm_bg.js +1093 -1142
- package/pkg-controller/account_wasm_bg.wasm +0 -0
- package/pkg-session/session_wasm.d.ts +190 -155
- package/pkg-session/session_wasm.js +7 -2
- package/pkg-session/session_wasm_bg.js +696 -777
- package/pkg-session/session_wasm_bg.wasm +0 -0
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Result type for signExecuteFromOutside containing both the OutsideExecution and signature
|
|
5
|
-
*/
|
|
6
|
-
export interface JsSignedOutsideExecution {
|
|
7
|
-
outside_execution: JsOutsideExecutionV3;
|
|
8
|
-
signature: JsFelt[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
3
|
/**
|
|
12
4
|
* JavaScript-friendly OutsideExecution V3 structure
|
|
13
5
|
*/
|
|
@@ -19,34 +11,29 @@ export interface JsOutsideExecutionV3 {
|
|
|
19
11
|
nonce: [JsFelt, JsFelt];
|
|
20
12
|
}
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export interface JsCall {
|
|
29
|
-
contractAddress: JsFelt;
|
|
30
|
-
entrypoint: string;
|
|
31
|
-
calldata: JsFelt[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface Owner {
|
|
35
|
-
signer?: Signer;
|
|
36
|
-
account?: JsFelt;
|
|
14
|
+
/**
|
|
15
|
+
* Result type for signExecuteFromOutside containing both the OutsideExecution and signature
|
|
16
|
+
*/
|
|
17
|
+
export interface JsSignedOutsideExecution {
|
|
18
|
+
outside_execution: JsOutsideExecutionV3;
|
|
19
|
+
signature: JsFelt[];
|
|
37
20
|
}
|
|
38
21
|
|
|
39
|
-
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
40
|
-
|
|
41
22
|
export interface ApprovalPolicy {
|
|
42
23
|
target: JsFelt;
|
|
43
24
|
spender: JsFelt;
|
|
44
25
|
amount: JsFelt;
|
|
45
26
|
}
|
|
46
27
|
|
|
47
|
-
export interface
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
export interface AuthorizedSession {
|
|
29
|
+
session: Session;
|
|
30
|
+
authorization: JsFelt[] | null;
|
|
31
|
+
isRegistered: boolean;
|
|
32
|
+
expiresAt: number;
|
|
33
|
+
allowedPoliciesRoot: JsFelt;
|
|
34
|
+
metadataHash: JsFelt;
|
|
35
|
+
sessionKeyGuid: JsFelt;
|
|
36
|
+
guardianKeyGuid: JsFelt;
|
|
50
37
|
}
|
|
51
38
|
|
|
52
39
|
export interface CallPolicy {
|
|
@@ -55,57 +42,54 @@ export interface CallPolicy {
|
|
|
55
42
|
authorized?: boolean;
|
|
56
43
|
}
|
|
57
44
|
|
|
58
|
-
export interface
|
|
45
|
+
export interface Credentials {
|
|
46
|
+
authorization: JsFelt[];
|
|
59
47
|
privateKey: JsFelt;
|
|
60
48
|
}
|
|
61
49
|
|
|
62
|
-
export type JsAddSignerInput = SignerInput;
|
|
63
|
-
|
|
64
50
|
export interface Eip191Signer {
|
|
65
51
|
address: string;
|
|
66
52
|
}
|
|
67
53
|
|
|
68
|
-
export interface
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
export interface ImportedControllerMetadata {
|
|
55
|
+
username: string;
|
|
56
|
+
classHash: JsFelt;
|
|
57
|
+
rpcUrl: string;
|
|
58
|
+
salt: JsFelt;
|
|
59
|
+
owner: Owner;
|
|
60
|
+
address: JsFelt;
|
|
61
|
+
chainId: JsFelt;
|
|
73
62
|
}
|
|
74
63
|
|
|
75
|
-
export interface
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
publicKey: string;
|
|
64
|
+
export interface ImportedProvedPolicy {
|
|
65
|
+
policy: Policy;
|
|
66
|
+
proof: JsFelt[];
|
|
79
67
|
}
|
|
80
68
|
|
|
81
|
-
export
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
session: Session;
|
|
85
|
-
authorization: JsFelt[] | null;
|
|
86
|
-
isRegistered: boolean;
|
|
69
|
+
export interface ImportedSession {
|
|
70
|
+
requestedPolicies: Policy[];
|
|
71
|
+
provedPolicies: ImportedProvedPolicy[];
|
|
87
72
|
expiresAt: number;
|
|
88
73
|
allowedPoliciesRoot: JsFelt;
|
|
89
74
|
metadataHash: JsFelt;
|
|
90
75
|
sessionKeyGuid: JsFelt;
|
|
91
76
|
guardianKeyGuid: JsFelt;
|
|
77
|
+
metadata: string;
|
|
92
78
|
}
|
|
93
79
|
|
|
94
|
-
export
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
metadataHash: JsFelt;
|
|
102
|
-
sessionKeyGuid: JsFelt;
|
|
103
|
-
guardianKeyGuid: JsFelt;
|
|
80
|
+
export interface ImportedSessionMetadata {
|
|
81
|
+
session: ImportedSession;
|
|
82
|
+
maxFee?: JsFelt;
|
|
83
|
+
credentials?: Credentials;
|
|
84
|
+
isRegistered: boolean;
|
|
85
|
+
appId?: string;
|
|
86
|
+
policies?: Policy[];
|
|
104
87
|
}
|
|
105
88
|
|
|
106
|
-
export interface
|
|
107
|
-
|
|
108
|
-
|
|
89
|
+
export interface JsCall {
|
|
90
|
+
contractAddress: JsFelt;
|
|
91
|
+
entrypoint: string;
|
|
92
|
+
calldata: JsFelt[];
|
|
109
93
|
}
|
|
110
94
|
|
|
111
95
|
export interface JsEstimateFeeDetails {
|
|
@@ -122,280 +106,364 @@ export interface JsFeeEstimate {
|
|
|
122
106
|
overall_fee: number;
|
|
123
107
|
}
|
|
124
108
|
|
|
109
|
+
export interface Owner {
|
|
110
|
+
signer?: Signer;
|
|
111
|
+
account?: JsFelt;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface Session {
|
|
115
|
+
policies: Policy[];
|
|
116
|
+
expiresAt: number;
|
|
117
|
+
metadataHash: JsFelt;
|
|
118
|
+
sessionKeyGuid: JsFelt;
|
|
119
|
+
guardianKeyGuid: JsFelt;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface Signer {
|
|
123
|
+
webauthns?: WebauthnSigner[];
|
|
124
|
+
webauthn?: WebauthnSigner;
|
|
125
|
+
starknet?: StarknetSigner;
|
|
126
|
+
eip191?: Eip191Signer;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface StarknetSigner {
|
|
130
|
+
privateKey: JsFelt;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface TypedDataPolicy {
|
|
134
|
+
scope_hash: JsFelt;
|
|
135
|
+
authorized?: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface WebauthnSigner {
|
|
139
|
+
rpId: string;
|
|
140
|
+
credentialId: string;
|
|
141
|
+
publicKey: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type Felts = JsFelt[];
|
|
145
|
+
|
|
146
|
+
export type JsAddSignerInput = SignerInput;
|
|
147
|
+
|
|
148
|
+
export type JsFeeSource = "PAYMASTER" | "CREDITS";
|
|
149
|
+
|
|
150
|
+
export type JsFelt = Felt;
|
|
151
|
+
|
|
125
152
|
export type JsPriceUnit = "WEI" | "FRI";
|
|
126
153
|
|
|
154
|
+
export type JsRegister = RegisterInput;
|
|
155
|
+
|
|
127
156
|
export type JsRegisterResponse = ResponseData;
|
|
128
157
|
|
|
129
|
-
export type
|
|
158
|
+
export type JsRemoveSignerInput = SignerInput;
|
|
159
|
+
|
|
160
|
+
export type JsRevokableSession = RevokableSession;
|
|
161
|
+
|
|
162
|
+
export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
|
|
163
|
+
|
|
164
|
+
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
130
165
|
|
|
131
166
|
|
|
132
167
|
export class CartridgeAccount {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
168
|
+
private constructor();
|
|
169
|
+
free(): void;
|
|
170
|
+
[Symbol.dispose](): void;
|
|
171
|
+
addOwner(owner?: Signer | null, signer_input?: JsAddSignerInput | null, rp_id?: string | null): Promise<void>;
|
|
172
|
+
createPasskeySigner(rp_id: string): Promise<JsAddSignerInput>;
|
|
173
|
+
createSession(app_id: string, policies: Policy[], expires_at: bigint, authorize_user_execution?: boolean | null): Promise<AuthorizedSession | undefined>;
|
|
174
|
+
delegateAccount(): Promise<JsFelt>;
|
|
175
|
+
deploySelf(max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
176
|
+
disconnect(): Promise<void>;
|
|
177
|
+
estimateInvokeFee(calls: JsCall[]): Promise<JsFeeEstimate>;
|
|
178
|
+
execute(calls: JsCall[], max_fee?: JsFeeEstimate | null, fee_source?: JsFeeSource | null): Promise<any>;
|
|
179
|
+
executeFromOutsideV2(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
180
|
+
executeFromOutsideV3(calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
181
|
+
exportAuthorizedSession(app_id?: string | null): Promise<ImportedSessionMetadata | undefined>;
|
|
182
|
+
exportMetadata(): Promise<ImportedControllerMetadata>;
|
|
183
|
+
static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
|
|
184
|
+
getNonce(): Promise<any>;
|
|
185
|
+
hasAuthorizedPoliciesForCalls(app_id: string, calls: JsCall[]): Promise<boolean>;
|
|
186
|
+
hasAuthorizedPoliciesForMessage(app_id: string, typed_data: string): Promise<boolean>;
|
|
187
|
+
/**
|
|
188
|
+
* Checks if there are stored policies for a given app_id.
|
|
189
|
+
*
|
|
190
|
+
* # Parameters
|
|
191
|
+
* - `app_id`: The application identifier to check for stored policies
|
|
192
|
+
*
|
|
193
|
+
* # Returns
|
|
194
|
+
* `true` if policies exist for the given app_id, `false` otherwise
|
|
195
|
+
*/
|
|
196
|
+
hasPoliciesForAppId(app_id: string): Promise<boolean>;
|
|
197
|
+
hasRequestedSession(app_id: string, policies: Policy[]): Promise<boolean>;
|
|
198
|
+
importSession(imported_session: ImportedSessionMetadata): Promise<void>;
|
|
199
|
+
isRegisteredSessionAuthorized(policies: Policy[], public_key?: JsFelt | null): Promise<AuthorizedSession | undefined>;
|
|
200
|
+
/**
|
|
201
|
+
* Creates a new `CartridgeAccount` instance.
|
|
202
|
+
*
|
|
203
|
+
* # Parameters
|
|
204
|
+
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
205
|
+
* - `address`: The blockchain address associated with the account.
|
|
206
|
+
* - `username`: Username associated with the account.
|
|
207
|
+
* - `owner`: A Owner struct containing the owner signer and associated data.
|
|
208
|
+
*/
|
|
209
|
+
static new(class_hash: JsFelt, rpc_url: string, address: JsFelt, username: string, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
210
|
+
/**
|
|
211
|
+
* Creates a new `CartridgeAccount` instance with a randomly generated Starknet signer.
|
|
212
|
+
* The controller address is computed internally based on the generated signer.
|
|
213
|
+
*
|
|
214
|
+
* # Parameters
|
|
215
|
+
* - `rpc_url`: The URL of the JSON-RPC endpoint.
|
|
216
|
+
* - `username`: Username associated with the account.
|
|
217
|
+
*/
|
|
218
|
+
static newHeadless(class_hash: JsFelt, rpc_url: string, username: string, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
219
|
+
register(register: JsRegister): Promise<JsRegisterResponse>;
|
|
220
|
+
registerSession(app_id: string, policies: Policy[], expires_at: bigint, public_key: JsFelt, max_fee?: JsFeeEstimate | null): Promise<any>;
|
|
221
|
+
registerSessionCalldata(policies: Policy[], expires_at: bigint, public_key: JsFelt): Promise<any>;
|
|
222
|
+
removeOwner(signer: JsRemoveSignerInput): Promise<void>;
|
|
223
|
+
revokeSession(session: JsRevokableSession): Promise<void>;
|
|
224
|
+
revokeSessions(sessions: JsRevokableSession[]): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Signs an OutsideExecution V3 transaction and returns both the OutsideExecution object and its signature.
|
|
227
|
+
*
|
|
228
|
+
* # Parameters
|
|
229
|
+
* - `calls`: Array of calls to execute from outside
|
|
230
|
+
*
|
|
231
|
+
* # Returns
|
|
232
|
+
* A `JsSignedOutsideExecution` containing the OutsideExecution V3 object and its signature
|
|
233
|
+
*/
|
|
234
|
+
signExecuteFromOutside(calls: JsCall[]): Promise<JsSignedOutsideExecution>;
|
|
235
|
+
signMessage(typed_data: string): Promise<Felts>;
|
|
236
|
+
skipSession(app_id: string, policies: Policy[]): Promise<void>;
|
|
237
|
+
trySessionExecute(app_id: string, calls: JsCall[], fee_source?: JsFeeSource | null): Promise<any>;
|
|
238
|
+
upgrade(new_class_hash: JsFelt): Promise<JsCall>;
|
|
201
239
|
}
|
|
202
240
|
|
|
241
|
+
/**
|
|
242
|
+
* A type for accessing fixed attributes of `CartridgeAccount`.
|
|
243
|
+
*
|
|
244
|
+
* This type exists as concurrent mutable and immutable calls to `CartridgeAccount` are guarded
|
|
245
|
+
* with `WasmMutex`, which only operates under an `async` context. If these getters were directly
|
|
246
|
+
* implemented under `CartridgeAccount`:
|
|
247
|
+
*
|
|
248
|
+
* - calls to them would unnecessarily have to be `async` as well;
|
|
249
|
+
* - there would be excessive locking.
|
|
250
|
+
*
|
|
251
|
+
* This type is supposed to only ever be borrowed immutably. So no concurrent access control would
|
|
252
|
+
* be needed.
|
|
253
|
+
*/
|
|
203
254
|
export class CartridgeAccountMeta {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
255
|
+
private constructor();
|
|
256
|
+
free(): void;
|
|
257
|
+
[Symbol.dispose](): void;
|
|
258
|
+
address(): string;
|
|
259
|
+
chainId(): string;
|
|
260
|
+
classHash(): string;
|
|
261
|
+
owner(): Owner;
|
|
262
|
+
ownerGuid(): JsFelt;
|
|
263
|
+
rpcUrl(): string;
|
|
264
|
+
username(): string;
|
|
214
265
|
}
|
|
215
266
|
|
|
267
|
+
/**
|
|
268
|
+
* A type used as the return type for constructing `CartridgeAccount` to provide an extra,
|
|
269
|
+
* separately borrowable `meta` field for synchronously accessing fixed fields.
|
|
270
|
+
*
|
|
271
|
+
* This type exists instead of simply having `CartridgeAccount::new()` return a tuple as tuples
|
|
272
|
+
* don't implement `IntoWasmAbi` which is needed for crossing JS-WASM boundary.
|
|
273
|
+
*/
|
|
216
274
|
export class CartridgeAccountWithMeta {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
275
|
+
private constructor();
|
|
276
|
+
free(): void;
|
|
277
|
+
[Symbol.dispose](): void;
|
|
278
|
+
intoAccount(): CartridgeAccount;
|
|
279
|
+
meta(): CartridgeAccountMeta;
|
|
222
280
|
}
|
|
223
281
|
|
|
224
282
|
export class ControllerFactory {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
283
|
+
private constructor();
|
|
284
|
+
free(): void;
|
|
285
|
+
[Symbol.dispose](): void;
|
|
286
|
+
/**
|
|
287
|
+
* This should only be used with webauthn signers
|
|
288
|
+
*/
|
|
289
|
+
static apiLogin(username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
290
|
+
static fromMetadata(metadata: ImportedControllerMetadata, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
291
|
+
static fromStorage(cartridge_api_url: string): Promise<CartridgeAccountWithMeta | undefined>;
|
|
292
|
+
/**
|
|
293
|
+
* Login to an existing controller account.
|
|
294
|
+
*
|
|
295
|
+
* # Parameters
|
|
296
|
+
*
|
|
297
|
+
* * `create_wildcard_session` - Whether to create a wildcard session on login. Defaults to `true`
|
|
298
|
+
* for backward compatibility. Set to `false` when using the `register_session` flow where
|
|
299
|
+
* specific policies will be registered instead of using a wildcard session.
|
|
300
|
+
*
|
|
301
|
+
* # Returns
|
|
302
|
+
*
|
|
303
|
+
* Returns a `LoginResult` containing:
|
|
304
|
+
* * `account` - The controller account
|
|
305
|
+
* * `session` - Optional session (Some if `create_wildcard_session` is true, None otherwise)
|
|
306
|
+
*
|
|
307
|
+
* # Testing
|
|
308
|
+
*
|
|
309
|
+
* The core logic is tested in the SDK layer:
|
|
310
|
+
* * `account_sdk::tests::session_test::test_wildcard_session_creation` - Tests session creation
|
|
311
|
+
* * `account_sdk::tests::session_test::test_login_with_wildcard_session_and_execute` - Tests login with session + execution
|
|
312
|
+
* * `account_sdk::tests::session_test::test_login_without_session_can_still_execute` - Tests login without session + execution
|
|
313
|
+
*
|
|
314
|
+
* The WASM layer is a thin wrapper that:
|
|
315
|
+
* 1. Converts WASM types to SDK types
|
|
316
|
+
* 2. Calls `Controller::new` and optionally `create_wildcard_session`
|
|
317
|
+
* 3. Handles WebAuthn signer updates when multiple signers are present
|
|
318
|
+
* 4. Registers the session with Cartridge API if requested
|
|
319
|
+
*/
|
|
320
|
+
static login(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, create_wildcard_session?: boolean | null, app_id?: string | null): Promise<LoginResult>;
|
|
262
321
|
}
|
|
263
322
|
|
|
264
323
|
export enum ErrorCode {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
324
|
+
StarknetFailedToReceiveTransaction = 1,
|
|
325
|
+
StarknetContractNotFound = 20,
|
|
326
|
+
StarknetBlockNotFound = 24,
|
|
327
|
+
StarknetInvalidTransactionIndex = 27,
|
|
328
|
+
StarknetClassHashNotFound = 28,
|
|
329
|
+
StarknetTransactionHashNotFound = 29,
|
|
330
|
+
StarknetPageSizeTooBig = 31,
|
|
331
|
+
StarknetNoBlocks = 32,
|
|
332
|
+
StarknetInvalidContinuationToken = 33,
|
|
333
|
+
StarknetTooManyKeysInFilter = 34,
|
|
334
|
+
StarknetContractError = 40,
|
|
335
|
+
StarknetTransactionExecutionError = 41,
|
|
336
|
+
StarknetClassAlreadyDeclared = 51,
|
|
337
|
+
StarknetInvalidTransactionNonce = 52,
|
|
338
|
+
StarknetInsufficientMaxFee = 53,
|
|
339
|
+
StarknetInsufficientAccountBalance = 54,
|
|
340
|
+
StarknetValidationFailure = 55,
|
|
341
|
+
StarknetCompilationFailed = 56,
|
|
342
|
+
StarknetContractClassSizeIsTooLarge = 57,
|
|
343
|
+
StarknetNonAccount = 58,
|
|
344
|
+
StarknetDuplicateTx = 59,
|
|
345
|
+
StarknetCompiledClassHashMismatch = 60,
|
|
346
|
+
StarknetUnsupportedTxVersion = 61,
|
|
347
|
+
StarknetUnsupportedContractClassVersion = 62,
|
|
348
|
+
StarknetUnexpectedError = 63,
|
|
349
|
+
StarknetNoTraceAvailable = 10,
|
|
350
|
+
StarknetReplacementTransactionUnderpriced = 64,
|
|
351
|
+
StarknetFeeBelowMinimum = 65,
|
|
352
|
+
SignError = 101,
|
|
353
|
+
StorageError = 102,
|
|
354
|
+
AccountFactoryError = 103,
|
|
355
|
+
PaymasterExecutionTimeNotReached = 104,
|
|
356
|
+
PaymasterExecutionTimePassed = 105,
|
|
357
|
+
PaymasterInvalidCaller = 106,
|
|
358
|
+
PaymasterRateLimitExceeded = 107,
|
|
359
|
+
PaymasterNotSupported = 108,
|
|
360
|
+
PaymasterHttp = 109,
|
|
361
|
+
PaymasterExcecution = 110,
|
|
362
|
+
PaymasterSerialization = 111,
|
|
363
|
+
CartridgeControllerNotDeployed = 112,
|
|
364
|
+
InsufficientBalance = 113,
|
|
365
|
+
OriginError = 114,
|
|
366
|
+
EncodingError = 115,
|
|
367
|
+
SerdeWasmBindgenError = 116,
|
|
368
|
+
CairoSerdeError = 117,
|
|
369
|
+
CairoShortStringToFeltError = 118,
|
|
370
|
+
DeviceCreateCredential = 119,
|
|
371
|
+
DeviceGetAssertion = 120,
|
|
372
|
+
DeviceBadAssertion = 121,
|
|
373
|
+
DeviceChannel = 122,
|
|
374
|
+
DeviceOrigin = 123,
|
|
375
|
+
AccountSigning = 124,
|
|
376
|
+
AccountProvider = 125,
|
|
377
|
+
AccountClassHashCalculation = 126,
|
|
378
|
+
AccountFeeOutOfRange = 128,
|
|
379
|
+
ProviderRateLimited = 129,
|
|
380
|
+
ProviderArrayLengthMismatch = 130,
|
|
381
|
+
ProviderOther = 131,
|
|
382
|
+
SessionAlreadyRegistered = 132,
|
|
383
|
+
UrlParseError = 133,
|
|
384
|
+
Base64DecodeError = 134,
|
|
385
|
+
CoseError = 135,
|
|
386
|
+
PolicyChainIdMismatch = 136,
|
|
387
|
+
InvalidOwner = 137,
|
|
388
|
+
GasPriceTooHigh = 138,
|
|
389
|
+
TransactionTimeout = 139,
|
|
390
|
+
ConversionError = 140,
|
|
391
|
+
InvalidChainId = 141,
|
|
392
|
+
SessionRefreshRequired = 142,
|
|
393
|
+
ManualExecutionRequired = 143,
|
|
394
|
+
ForbiddenEntrypoint = 144,
|
|
395
|
+
GasAmountTooHigh = 145,
|
|
396
|
+
ApproveExecutionRequired = 146,
|
|
338
397
|
}
|
|
339
398
|
|
|
399
|
+
/**
|
|
400
|
+
* JavaScript-friendly chain configuration
|
|
401
|
+
*/
|
|
340
402
|
export class JsChainConfig {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
403
|
+
free(): void;
|
|
404
|
+
[Symbol.dispose](): void;
|
|
405
|
+
constructor(class_hash: JsFelt, rpc_url: string, owner: Owner, address?: JsFelt | null);
|
|
406
|
+
readonly address: JsFelt | undefined;
|
|
407
|
+
readonly class_hash: JsFelt;
|
|
408
|
+
readonly owner: Owner;
|
|
409
|
+
readonly rpc_url: string;
|
|
348
410
|
}
|
|
349
411
|
|
|
350
412
|
export class JsControllerError {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
413
|
+
private constructor();
|
|
414
|
+
free(): void;
|
|
415
|
+
[Symbol.dispose](): void;
|
|
416
|
+
code: ErrorCode;
|
|
417
|
+
get data(): string | undefined;
|
|
418
|
+
set data(value: string | null | undefined);
|
|
419
|
+
message: string;
|
|
358
420
|
}
|
|
359
421
|
|
|
360
422
|
export class LoginResult {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
423
|
+
private constructor();
|
|
424
|
+
free(): void;
|
|
425
|
+
[Symbol.dispose](): void;
|
|
426
|
+
intoValues(): Array<any>;
|
|
365
427
|
}
|
|
366
428
|
|
|
429
|
+
/**
|
|
430
|
+
* WASM bindings for MultiChainController
|
|
431
|
+
*/
|
|
367
432
|
export class MultiChainAccount {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
433
|
+
private constructor();
|
|
434
|
+
free(): void;
|
|
435
|
+
[Symbol.dispose](): void;
|
|
436
|
+
/**
|
|
437
|
+
* Adds a new chain configuration
|
|
438
|
+
*/
|
|
439
|
+
addChain(config: JsChainConfig): Promise<void>;
|
|
440
|
+
/**
|
|
441
|
+
* Gets an account instance for a specific chain
|
|
442
|
+
*/
|
|
443
|
+
controller(chain_id: JsFelt): Promise<CartridgeAccount>;
|
|
444
|
+
/**
|
|
445
|
+
* Creates a new MultiChainAccount with multiple chain configurations
|
|
446
|
+
*/
|
|
447
|
+
static create(username: string, chain_configs: JsChainConfig[], cartridge_api_url: string): Promise<MultiChainAccount>;
|
|
448
|
+
/**
|
|
449
|
+
* Loads a MultiChainAccount from storage
|
|
450
|
+
*/
|
|
451
|
+
static fromStorage(cartridge_api_url: string): Promise<MultiChainAccount | undefined>;
|
|
452
|
+
/**
|
|
453
|
+
* Removes a chain configuration
|
|
454
|
+
*/
|
|
455
|
+
removeChain(chain_id: JsFelt): Promise<void>;
|
|
391
456
|
}
|
|
392
457
|
|
|
458
|
+
/**
|
|
459
|
+
* Metadata for displaying multi-chain information
|
|
460
|
+
*/
|
|
393
461
|
export class MultiChainAccountMeta {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
462
|
+
private constructor();
|
|
463
|
+
free(): void;
|
|
464
|
+
[Symbol.dispose](): void;
|
|
465
|
+
readonly chains: JsFelt[];
|
|
466
|
+
readonly username: string;
|
|
399
467
|
}
|
|
400
468
|
|
|
401
469
|
/**
|