@cartridge/controller-wasm 0.7.14-8688cb9 → 0.7.14-99bcc039

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
@@ -19,32 +19,21 @@ export interface JsSignedOutsideExecution {
19
19
  signature: JsFelt[];
20
20
  }
21
21
 
22
- export type JsFeeSource = "PAYMASTER" | "CREDITS";
23
-
24
- export type JsFelt = Felt;
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
22
  export interface ApprovalPolicy {
40
23
  target: JsFelt;
41
24
  spender: JsFelt;
42
25
  amount: JsFelt;
43
26
  }
44
27
 
45
- export interface TypedDataPolicy {
46
- scope_hash: JsFelt;
47
- authorized?: boolean;
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;
48
37
  }
49
38
 
50
39
  export interface CallPolicy {
@@ -53,42 +42,40 @@ export interface CallPolicy {
53
42
  authorized?: boolean;
54
43
  }
55
44
 
56
- export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
45
+ export interface Credentials {
46
+ authorization: JsFelt[];
47
+ privateKey: JsFelt;
48
+ }
57
49
 
58
50
  export interface Eip191Signer {
59
51
  address: string;
60
52
  }
61
53
 
62
- export type JsAddSignerInput = SignerInput;
63
-
64
- export interface StarknetSigner {
65
- privateKey: JsFelt;
54
+ export interface JsCall {
55
+ contractAddress: JsFelt;
56
+ entrypoint: string;
57
+ calldata: JsFelt[];
66
58
  }
67
59
 
68
- export interface Signer {
69
- webauthns?: WebauthnSigner[];
70
- webauthn?: WebauthnSigner;
71
- starknet?: StarknetSigner;
72
- eip191?: Eip191Signer;
60
+ export interface JsEstimateFeeDetails {
61
+ nonce: JsFelt;
73
62
  }
74
63
 
75
- export interface WebauthnSigner {
76
- rpId: string;
77
- credentialId: string;
78
- publicKey: string;
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;
79
72
  }
80
73
 
81
- export type JsRemoveSignerInput = SignerInput;
82
-
83
- export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
84
-
85
- export interface Credentials {
86
- authorization: JsFelt[];
87
- privateKey: JsFelt;
74
+ export interface Owner {
75
+ signer?: Signer;
76
+ account?: JsFelt;
88
77
  }
89
78
 
90
- export type JsRevokableSession = RevokableSession;
91
-
92
79
  export interface Session {
93
80
  policies: Policy[];
94
81
  expiresAt: number;
@@ -97,133 +84,146 @@ export interface Session {
97
84
  guardianKeyGuid: JsFelt;
98
85
  }
99
86
 
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;
87
+ export interface Signer {
88
+ webauthns?: WebauthnSigner[];
89
+ webauthn?: WebauthnSigner;
90
+ starknet?: StarknetSigner;
91
+ eip191?: Eip191Signer;
109
92
  }
110
93
 
111
- export interface JsEstimateFeeDetails {
112
- nonce: JsFelt;
94
+ export interface StarknetSigner {
95
+ privateKey: JsFelt;
113
96
  }
114
97
 
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;
98
+ export interface TypedDataPolicy {
99
+ scope_hash: JsFelt;
100
+ authorized?: boolean;
101
+ }
102
+
103
+ export interface WebauthnSigner {
104
+ rpId: string;
105
+ credentialId: string;
106
+ publicKey: string;
123
107
  }
124
108
 
109
+ export type Felts = JsFelt[];
110
+
111
+ export type JsAddSignerInput = SignerInput;
112
+
113
+ export type JsFeeSource = "PAYMASTER" | "CREDITS";
114
+
115
+ export type JsFelt = Felt;
116
+
125
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 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>;
133
+ private constructor();
134
+ free(): void;
135
+ [Symbol.dispose](): void;
136
+ execute(calls: JsCall[]): Promise<any>;
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
+ static newAsRegistered(rpc_url: string, signer: JsFelt, address: JsFelt, owner_guid: JsFelt, chain_id: JsFelt, session: Session): CartridgeSessionAccount;
140
+ sign(hash: JsFelt, calls: JsCall[]): Promise<Felts>;
141
141
  }
142
142
 
143
143
  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,
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,
217
217
  }
218
218
 
219
219
  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);
220
+ private constructor();
221
+ free(): void;
222
+ [Symbol.dispose](): void;
223
+ code: ErrorCode;
224
+ get data(): string | undefined;
225
+ set data(value: string | null | undefined);
226
+ message: string;
227
227
  }
228
228
 
229
229
  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";