@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.
Binary file
@@ -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,21 +11,29 @@ export interface JsOutsideExecutionV3 {
19
11
  nonce: [JsFelt, JsFelt];
20
12
  }
21
13
 
22
- export type JsFelt = Felt;
23
-
24
- export type JsFeeSource = "PAYMASTER" | "CREDITS";
25
-
26
- export type Felts = 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[];
20
+ }
27
21
 
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 Owner {
35
- signer?: Signer;
36
- account?: JsFelt;
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,74 +42,56 @@ export interface CallPolicy {
42
42
  authorized?: boolean;
43
43
  }
44
44
 
45
- export interface TypedDataPolicy {
46
- scope_hash: 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 StarknetSigner {
45
+ export interface Credentials {
46
+ authorization: JsFelt[];
59
47
  privateKey: JsFelt;
60
48
  }
61
49
 
62
- export interface Signer {
63
- webauthns?: WebauthnSigner[];
64
- webauthn?: WebauthnSigner;
65
- starknet?: StarknetSigner;
66
- eip191?: Eip191Signer;
67
- }
68
-
69
- export type JsAddSignerInput = SignerInput;
70
-
71
50
  export interface Eip191Signer {
72
51
  address: string;
73
52
  }
74
53
 
75
- export interface WebauthnSigner {
76
- rpId: string;
77
- credentialId: string;
78
- publicKey: string;
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;
79
62
  }
80
63
 
81
- export type JsRemoveSignerInput = SignerInput;
82
-
83
- export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
64
+ export interface ImportedProvedPolicy {
65
+ policy: Policy;
66
+ proof: JsFelt[];
67
+ }
84
68
 
85
- export interface AuthorizedSession {
86
- session: Session;
87
- authorization: JsFelt[] | null;
88
- isRegistered: boolean;
69
+ export interface ImportedSession {
70
+ requestedPolicies: Policy[];
71
+ provedPolicies: ImportedProvedPolicy[];
89
72
  expiresAt: number;
90
73
  allowedPoliciesRoot: JsFelt;
91
74
  metadataHash: JsFelt;
92
75
  sessionKeyGuid: JsFelt;
93
76
  guardianKeyGuid: JsFelt;
77
+ metadata: string;
94
78
  }
95
79
 
96
- export interface Session {
97
- policies: Policy[];
98
- expiresAt: number;
99
- metadataHash: JsFelt;
100
- sessionKeyGuid: JsFelt;
101
- guardianKeyGuid: JsFelt;
80
+ export interface ImportedSessionMetadata {
81
+ session: ImportedSession;
82
+ maxFee?: JsFelt;
83
+ credentials?: Credentials;
84
+ isRegistered: boolean;
85
+ appId?: string;
86
+ policies?: Policy[];
102
87
  }
103
88
 
104
- export interface Credentials {
105
- authorization: JsFelt[];
106
- privateKey: JsFelt;
89
+ export interface JsCall {
90
+ contractAddress: JsFelt;
91
+ entrypoint: string;
92
+ calldata: JsFelt[];
107
93
  }
108
94
 
109
- export type JsRevokableSession = RevokableSession;
110
-
111
- export type JsPriceUnit = "WEI" | "FRI";
112
-
113
95
  export interface JsEstimateFeeDetails {
114
96
  nonce: JsFelt;
115
97
  }
@@ -124,106 +106,159 @@ export interface JsFeeEstimate {
124
106
  overall_fee: number;
125
107
  }
126
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
+
152
+ export type JsPriceUnit = "WEI" | "FRI";
153
+
127
154
  export type JsRegister = RegisterInput;
128
155
 
129
156
  export type JsRegisterResponse = ResponseData;
130
157
 
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;
165
+
131
166
 
132
167
  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>;
168
+ private constructor();
169
+ free(): void;
170
+ [Symbol.dispose](): void;
171
+ execute(calls: JsCall[]): Promise<any>;
172
+ executeFromOutside(calls: JsCall[]): Promise<any>;
173
+ static new(rpc_url: string, signer: JsFelt, address: JsFelt, chain_id: JsFelt, session_authorization: JsFelt[], session: Session): CartridgeSessionAccount;
174
+ static newAsRegistered(rpc_url: string, signer: JsFelt, address: JsFelt, owner_guid: JsFelt, chain_id: JsFelt, session: Session): CartridgeSessionAccount;
175
+ sign(hash: JsFelt, calls: JsCall[]): Promise<Felts>;
141
176
  }
142
177
 
143
178
  export enum ErrorCode {
144
- StarknetFailedToReceiveTransaction = 1,
145
- StarknetContractNotFound = 20,
146
- StarknetBlockNotFound = 24,
147
- StarknetInvalidTransactionIndex = 27,
148
- StarknetClassHashNotFound = 28,
149
- StarknetTransactionHashNotFound = 29,
150
- StarknetPageSizeTooBig = 31,
151
- StarknetNoBlocks = 32,
152
- StarknetInvalidContinuationToken = 33,
153
- StarknetTooManyKeysInFilter = 34,
154
- StarknetContractError = 40,
155
- StarknetTransactionExecutionError = 41,
156
- StarknetClassAlreadyDeclared = 51,
157
- StarknetInvalidTransactionNonce = 52,
158
- StarknetInsufficientMaxFee = 53,
159
- StarknetInsufficientAccountBalance = 54,
160
- StarknetValidationFailure = 55,
161
- StarknetCompilationFailed = 56,
162
- StarknetContractClassSizeIsTooLarge = 57,
163
- StarknetNonAccount = 58,
164
- StarknetDuplicateTx = 59,
165
- StarknetCompiledClassHashMismatch = 60,
166
- StarknetUnsupportedTxVersion = 61,
167
- StarknetUnsupportedContractClassVersion = 62,
168
- StarknetUnexpectedError = 63,
169
- StarknetNoTraceAvailable = 10,
170
- StarknetReplacementTransactionUnderpriced = 64,
171
- StarknetFeeBelowMinimum = 65,
172
- SignError = 101,
173
- StorageError = 102,
174
- AccountFactoryError = 103,
175
- PaymasterExecutionTimeNotReached = 104,
176
- PaymasterExecutionTimePassed = 105,
177
- PaymasterInvalidCaller = 106,
178
- PaymasterRateLimitExceeded = 107,
179
- PaymasterNotSupported = 108,
180
- PaymasterHttp = 109,
181
- PaymasterExcecution = 110,
182
- PaymasterSerialization = 111,
183
- CartridgeControllerNotDeployed = 112,
184
- InsufficientBalance = 113,
185
- OriginError = 114,
186
- EncodingError = 115,
187
- SerdeWasmBindgenError = 116,
188
- CairoSerdeError = 117,
189
- CairoShortStringToFeltError = 118,
190
- DeviceCreateCredential = 119,
191
- DeviceGetAssertion = 120,
192
- DeviceBadAssertion = 121,
193
- DeviceChannel = 122,
194
- DeviceOrigin = 123,
195
- AccountSigning = 124,
196
- AccountProvider = 125,
197
- AccountClassHashCalculation = 126,
198
- AccountFeeOutOfRange = 128,
199
- ProviderRateLimited = 129,
200
- ProviderArrayLengthMismatch = 130,
201
- ProviderOther = 131,
202
- SessionAlreadyRegistered = 132,
203
- UrlParseError = 133,
204
- Base64DecodeError = 134,
205
- CoseError = 135,
206
- PolicyChainIdMismatch = 136,
207
- InvalidOwner = 137,
208
- GasPriceTooHigh = 138,
209
- TransactionTimeout = 139,
210
- ConversionError = 140,
211
- InvalidChainId = 141,
212
- SessionRefreshRequired = 142,
213
- ManualExecutionRequired = 143,
214
- ForbiddenEntrypoint = 144,
215
- GasAmountTooHigh = 145,
216
- ApproveExecutionRequired = 146,
179
+ StarknetFailedToReceiveTransaction = 1,
180
+ StarknetContractNotFound = 20,
181
+ StarknetBlockNotFound = 24,
182
+ StarknetInvalidTransactionIndex = 27,
183
+ StarknetClassHashNotFound = 28,
184
+ StarknetTransactionHashNotFound = 29,
185
+ StarknetPageSizeTooBig = 31,
186
+ StarknetNoBlocks = 32,
187
+ StarknetInvalidContinuationToken = 33,
188
+ StarknetTooManyKeysInFilter = 34,
189
+ StarknetContractError = 40,
190
+ StarknetTransactionExecutionError = 41,
191
+ StarknetClassAlreadyDeclared = 51,
192
+ StarknetInvalidTransactionNonce = 52,
193
+ StarknetInsufficientMaxFee = 53,
194
+ StarknetInsufficientAccountBalance = 54,
195
+ StarknetValidationFailure = 55,
196
+ StarknetCompilationFailed = 56,
197
+ StarknetContractClassSizeIsTooLarge = 57,
198
+ StarknetNonAccount = 58,
199
+ StarknetDuplicateTx = 59,
200
+ StarknetCompiledClassHashMismatch = 60,
201
+ StarknetUnsupportedTxVersion = 61,
202
+ StarknetUnsupportedContractClassVersion = 62,
203
+ StarknetUnexpectedError = 63,
204
+ StarknetNoTraceAvailable = 10,
205
+ StarknetReplacementTransactionUnderpriced = 64,
206
+ StarknetFeeBelowMinimum = 65,
207
+ SignError = 101,
208
+ StorageError = 102,
209
+ AccountFactoryError = 103,
210
+ PaymasterExecutionTimeNotReached = 104,
211
+ PaymasterExecutionTimePassed = 105,
212
+ PaymasterInvalidCaller = 106,
213
+ PaymasterRateLimitExceeded = 107,
214
+ PaymasterNotSupported = 108,
215
+ PaymasterHttp = 109,
216
+ PaymasterExcecution = 110,
217
+ PaymasterSerialization = 111,
218
+ CartridgeControllerNotDeployed = 112,
219
+ InsufficientBalance = 113,
220
+ OriginError = 114,
221
+ EncodingError = 115,
222
+ SerdeWasmBindgenError = 116,
223
+ CairoSerdeError = 117,
224
+ CairoShortStringToFeltError = 118,
225
+ DeviceCreateCredential = 119,
226
+ DeviceGetAssertion = 120,
227
+ DeviceBadAssertion = 121,
228
+ DeviceChannel = 122,
229
+ DeviceOrigin = 123,
230
+ AccountSigning = 124,
231
+ AccountProvider = 125,
232
+ AccountClassHashCalculation = 126,
233
+ AccountFeeOutOfRange = 128,
234
+ ProviderRateLimited = 129,
235
+ ProviderArrayLengthMismatch = 130,
236
+ ProviderOther = 131,
237
+ SessionAlreadyRegistered = 132,
238
+ UrlParseError = 133,
239
+ Base64DecodeError = 134,
240
+ CoseError = 135,
241
+ PolicyChainIdMismatch = 136,
242
+ InvalidOwner = 137,
243
+ GasPriceTooHigh = 138,
244
+ TransactionTimeout = 139,
245
+ ConversionError = 140,
246
+ InvalidChainId = 141,
247
+ SessionRefreshRequired = 142,
248
+ ManualExecutionRequired = 143,
249
+ ForbiddenEntrypoint = 144,
250
+ GasAmountTooHigh = 145,
251
+ ApproveExecutionRequired = 146,
217
252
  }
218
253
 
219
254
  export class JsControllerError {
220
- private constructor();
221
- free(): void;
222
- [Symbol.dispose](): void;
223
- code: ErrorCode;
224
- message: string;
225
- get data(): string | undefined;
226
- set data(value: string | null | undefined);
255
+ private constructor();
256
+ free(): void;
257
+ [Symbol.dispose](): void;
258
+ code: ErrorCode;
259
+ get data(): string | undefined;
260
+ set data(value: string | null | undefined);
261
+ message: string;
227
262
  }
228
263
 
229
264
  export function signerToGuid(signer: Signer): JsFelt;
@@ -1,4 +1,9 @@
1
+ /* @ts-self-types="./session_wasm.d.ts" */
2
+
1
3
  import * as wasm from "./session_wasm_bg.wasm";
2
- export * from "./session_wasm_bg.js";
3
4
  import { __wbg_set_wasm } from "./session_wasm_bg.js";
4
- __wbg_set_wasm(wasm);
5
+ __wbg_set_wasm(wasm);
6
+
7
+ export {
8
+ CartridgeSessionAccount, ErrorCode, JsControllerError, signerToGuid, subscribeCreateSession
9
+ } from "./session_wasm_bg.js";