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