@cartridge/controller-wasm 0.7.14-24e7b0f → 0.7.14-3a84802

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.
Binary file
@@ -1,12 +1,145 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
5
- * The goal of this function is to know from any place when the register session flow has been completed, and to
6
- * get the authorization.
4
+ * Result type for signExecuteFromOutside containing both the OutsideExecution and signature
7
5
  */
8
- export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;
9
- export function signerToGuid(signer: Signer): JsFelt;
6
+ export interface JsSignedOutsideExecution {
7
+ outside_execution: JsOutsideExecutionV3;
8
+ signature: JsFelt[];
9
+ }
10
+
11
+ /**
12
+ * JavaScript-friendly OutsideExecution V3 structure
13
+ */
14
+ export interface JsOutsideExecutionV3 {
15
+ caller: JsFelt;
16
+ execute_after: number;
17
+ execute_before: number;
18
+ calls: JsCall[];
19
+ nonce: [JsFelt, JsFelt];
20
+ }
21
+
22
+ export type JsFelt = Felt;
23
+
24
+ export type JsFeeSource = "PAYMASTER" | "CREDITS";
25
+
26
+ export type Felts = JsFelt[];
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;
37
+ }
38
+
39
+ export interface TypedDataPolicy {
40
+ scope_hash: JsFelt;
41
+ authorized?: boolean;
42
+ }
43
+
44
+ export interface CallPolicy {
45
+ target: JsFelt;
46
+ method: JsFelt;
47
+ authorized?: boolean;
48
+ }
49
+
50
+ export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
51
+
52
+ export interface ApprovalPolicy {
53
+ target: JsFelt;
54
+ spender: JsFelt;
55
+ amount: JsFelt;
56
+ }
57
+
58
+ export interface Signer {
59
+ webauthns?: WebauthnSigner[];
60
+ webauthn?: WebauthnSigner;
61
+ starknet?: StarknetSigner;
62
+ eip191?: Eip191Signer;
63
+ }
64
+
65
+ export type JsRemoveSignerInput = SignerInput;
66
+
67
+ export type JsAddSignerInput = SignerInput;
68
+
69
+ export interface Eip191Signer {
70
+ address: string;
71
+ }
72
+
73
+ export interface WebauthnSigner {
74
+ rpId: string;
75
+ credentialId: string;
76
+ publicKey: string;
77
+ }
78
+
79
+ export interface StarknetSigner {
80
+ privateKey: JsFelt;
81
+ }
82
+
83
+ export type JsRevokableSession = RevokableSession;
84
+
85
+ export interface Session {
86
+ policies: Policy[];
87
+ expiresAt: number;
88
+ metadataHash: JsFelt;
89
+ sessionKeyGuid: JsFelt;
90
+ guardianKeyGuid: JsFelt;
91
+ }
92
+
93
+ export interface Credentials {
94
+ authorization: JsFelt[];
95
+ privateKey: JsFelt;
96
+ }
97
+
98
+ export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
99
+
100
+ export interface AuthorizedSession {
101
+ session: Session;
102
+ authorization: JsFelt[] | null;
103
+ isRegistered: boolean;
104
+ expiresAt: number;
105
+ allowedPoliciesRoot: JsFelt;
106
+ metadataHash: JsFelt;
107
+ sessionKeyGuid: JsFelt;
108
+ guardianKeyGuid: JsFelt;
109
+ }
110
+
111
+ export interface JsEstimateFeeDetails {
112
+ nonce: JsFelt;
113
+ }
114
+
115
+ export type JsPriceUnit = "WEI" | "FRI";
116
+
117
+ export interface JsFeeEstimate {
118
+ l1_gas_consumed: number;
119
+ l1_gas_price: number;
120
+ l2_gas_consumed: number;
121
+ l2_gas_price: number;
122
+ l1_data_gas_consumed: number;
123
+ l1_data_gas_price: number;
124
+ overall_fee: number;
125
+ }
126
+
127
+ export type JsRegister = RegisterInput;
128
+
129
+ export type JsRegisterResponse = ResponseData;
130
+
131
+
132
+ export class CartridgeSessionAccount {
133
+ private constructor();
134
+ free(): void;
135
+ [Symbol.dispose](): void;
136
+ static newAsRegistered(rpc_url: string, signer: JsFelt, address: JsFelt, owner_guid: JsFelt, chain_id: JsFelt, session: Session): CartridgeSessionAccount;
137
+ executeFromOutside(calls: JsCall[]): Promise<any>;
138
+ static new(rpc_url: string, signer: JsFelt, address: JsFelt, chain_id: JsFelt, session_authorization: JsFelt[], session: Session): CartridgeSessionAccount;
139
+ sign(hash: JsFelt, calls: JsCall[]): Promise<Felts>;
140
+ execute(calls: JsCall[]): Promise<any>;
141
+ }
142
+
10
143
  export enum ErrorCode {
11
144
  StarknetFailedToReceiveTransaction = 1,
12
145
  StarknetContractNotFound = 20,
@@ -82,144 +215,7 @@ export enum ErrorCode {
82
215
  GasAmountTooHigh = 145,
83
216
  ApproveExecutionRequired = 146,
84
217
  }
85
- export interface JsCall {
86
- contractAddress: JsFelt;
87
- entrypoint: string;
88
- calldata: JsFelt[];
89
- }
90
-
91
- export type JsPriceUnit = "WEI" | "FRI";
92
-
93
- export interface JsEstimateFeeDetails {
94
- nonce: JsFelt;
95
- }
96
-
97
- export interface JsFeeEstimate {
98
- l1_gas_consumed: number;
99
- l1_gas_price: number;
100
- l2_gas_consumed: number;
101
- l2_gas_price: number;
102
- l1_data_gas_consumed: number;
103
- l1_data_gas_price: number;
104
- overall_fee: number;
105
- }
106
-
107
- /**
108
- * JavaScript-friendly OutsideExecution V3 structure
109
- */
110
- export interface JsOutsideExecutionV3 {
111
- caller: JsFelt;
112
- execute_after: number;
113
- execute_before: number;
114
- calls: JsCall[];
115
- nonce: [JsFelt, JsFelt];
116
- }
117
-
118
- /**
119
- * Result type for signExecuteFromOutside containing both the OutsideExecution and signature
120
- */
121
- export interface JsSignedOutsideExecution {
122
- outside_execution: JsOutsideExecutionV3;
123
- signature: JsFelt[];
124
- }
125
-
126
- export interface Owner {
127
- signer?: Signer;
128
- account?: JsFelt;
129
- }
130
-
131
- export interface CallPolicy {
132
- target: JsFelt;
133
- method: JsFelt;
134
- authorized?: boolean;
135
- }
136
-
137
- export interface TypedDataPolicy {
138
- scope_hash: JsFelt;
139
- authorized?: boolean;
140
- }
141
-
142
- export interface ApprovalPolicy {
143
- target: JsFelt;
144
- spender: JsFelt;
145
- amount: JsFelt;
146
- }
147
-
148
- export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
149
-
150
- export type JsRegister = RegisterInput;
151
-
152
- export type JsRegisterResponse = ResponseData;
153
-
154
- export interface WebauthnSigner {
155
- rpId: string;
156
- credentialId: string;
157
- publicKey: string;
158
- }
159
218
 
160
- export interface StarknetSigner {
161
- privateKey: JsFelt;
162
- }
163
-
164
- export interface Eip191Signer {
165
- address: string;
166
- }
167
-
168
- export interface Signer {
169
- webauthns?: WebauthnSigner[];
170
- webauthn?: WebauthnSigner;
171
- starknet?: StarknetSigner;
172
- eip191?: Eip191Signer;
173
- }
174
-
175
- export type JsAddSignerInput = SignerInput;
176
-
177
- export type JsRemoveSignerInput = SignerInput;
178
-
179
- export type JsFelt = Felt;
180
-
181
- export type Felts = JsFelt[];
182
-
183
- export type JsFeeSource = "PAYMASTER" | "CREDITS";
184
-
185
- export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
186
-
187
- export type JsRevokableSession = RevokableSession;
188
-
189
- export interface AuthorizedSession {
190
- session: Session;
191
- authorization: JsFelt[] | null;
192
- isRegistered: boolean;
193
- expiresAt: number;
194
- allowedPoliciesRoot: JsFelt;
195
- metadataHash: JsFelt;
196
- sessionKeyGuid: JsFelt;
197
- guardianKeyGuid: JsFelt;
198
- }
199
-
200
- export interface Session {
201
- policies: Policy[];
202
- expiresAt: number;
203
- metadataHash: JsFelt;
204
- sessionKeyGuid: JsFelt;
205
- guardianKeyGuid: JsFelt;
206
- }
207
-
208
- export interface Credentials {
209
- authorization: JsFelt[];
210
- privateKey: JsFelt;
211
- }
212
-
213
- export class CartridgeSessionAccount {
214
- private constructor();
215
- free(): void;
216
- [Symbol.dispose](): void;
217
- static new(rpc_url: string, signer: JsFelt, address: JsFelt, chain_id: JsFelt, session_authorization: JsFelt[], session: Session): CartridgeSessionAccount;
218
- static newAsRegistered(rpc_url: string, signer: JsFelt, address: JsFelt, owner_guid: JsFelt, chain_id: JsFelt, session: Session): CartridgeSessionAccount;
219
- sign(hash: JsFelt, calls: JsCall[]): Promise<Felts>;
220
- execute(calls: JsCall[]): Promise<any>;
221
- executeFromOutside(calls: JsCall[]): Promise<any>;
222
- }
223
219
  export class JsControllerError {
224
220
  private constructor();
225
221
  free(): void;
@@ -229,3 +225,12 @@ export class JsControllerError {
229
225
  get data(): string | undefined;
230
226
  set data(value: string | null | undefined);
231
227
  }
228
+
229
+ export function signerToGuid(signer: Signer): JsFelt;
230
+
231
+ /**
232
+ * Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
233
+ * The goal of this function is to know from any place when the register session flow has been completed, and to
234
+ * get the authorization.
235
+ */
236
+ export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;