@cartridge/controller-wasm 0.9.1 → 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.
Binary file
@@ -19,53 +19,70 @@ export interface JsSignedOutsideExecution {
19
19
  signature: JsFelt[];
20
20
  }
21
21
 
22
- export type JsFelt = Felt;
23
-
24
- export type Felts = JsFelt[];
25
-
26
- export type JsFeeSource = "PAYMASTER" | "CREDITS";
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 type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
40
-
41
- export interface TypedDataPolicy {
42
- scope_hash: JsFelt;
43
- authorized?: boolean;
44
- }
45
-
46
22
  export interface ApprovalPolicy {
47
23
  target: JsFelt;
48
24
  spender: JsFelt;
49
25
  amount: JsFelt;
50
26
  }
51
27
 
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
+ }
38
+
52
39
  export interface CallPolicy {
53
40
  target: JsFelt;
54
41
  method: JsFelt;
55
42
  authorized?: boolean;
56
43
  }
57
44
 
45
+ export interface Credentials {
46
+ authorization: JsFelt[];
47
+ privateKey: JsFelt;
48
+ }
49
+
58
50
  export interface Eip191Signer {
59
51
  address: string;
60
52
  }
61
53
 
62
- export interface WebauthnSigner {
63
- rpId: string;
64
- credentialId: string;
65
- publicKey: string;
54
+ export interface JsCall {
55
+ contractAddress: JsFelt;
56
+ entrypoint: string;
57
+ calldata: JsFelt[];
66
58
  }
67
59
 
68
- export type JsAddSignerInput = SignerInput;
60
+ export interface JsEstimateFeeDetails {
61
+ nonce: JsFelt;
62
+ }
63
+
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;
72
+ }
73
+
74
+ export interface Owner {
75
+ signer?: Signer;
76
+ account?: JsFelt;
77
+ }
78
+
79
+ export interface Session {
80
+ policies: Policy[];
81
+ expiresAt: number;
82
+ metadataHash: JsFelt;
83
+ sessionKeyGuid: JsFelt;
84
+ guardianKeyGuid: JsFelt;
85
+ }
69
86
 
70
87
  export interface Signer {
71
88
  webauthns?: WebauthnSigner[];
@@ -74,156 +91,139 @@ export interface Signer {
74
91
  eip191?: Eip191Signer;
75
92
  }
76
93
 
77
- export type JsRemoveSignerInput = SignerInput;
78
-
79
94
  export interface StarknetSigner {
80
95
  privateKey: JsFelt;
81
96
  }
82
97
 
83
- export interface Credentials {
84
- authorization: JsFelt[];
85
- privateKey: JsFelt;
98
+ export interface TypedDataPolicy {
99
+ scope_hash: JsFelt;
100
+ authorized?: boolean;
86
101
  }
87
102
 
88
- export type JsRevokableSession = RevokableSession;
89
-
90
- export interface AuthorizedSession {
91
- session: Session;
92
- authorization: JsFelt[] | null;
93
- isRegistered: boolean;
94
- expiresAt: number;
95
- allowedPoliciesRoot: JsFelt;
96
- metadataHash: JsFelt;
97
- sessionKeyGuid: JsFelt;
98
- guardianKeyGuid: JsFelt;
103
+ export interface WebauthnSigner {
104
+ rpId: string;
105
+ credentialId: string;
106
+ publicKey: string;
99
107
  }
100
108
 
101
- export interface Session {
102
- policies: Policy[];
103
- expiresAt: number;
104
- metadataHash: JsFelt;
105
- sessionKeyGuid: JsFelt;
106
- guardianKeyGuid: JsFelt;
107
- }
109
+ export type Felts = JsFelt[];
108
110
 
109
- export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
111
+ export type JsAddSignerInput = SignerInput;
110
112
 
111
- export interface JsFeeEstimate {
112
- l1_gas_consumed: number;
113
- l1_gas_price: number;
114
- l2_gas_consumed: number;
115
- l2_gas_price: number;
116
- l1_data_gas_consumed: number;
117
- l1_data_gas_price: number;
118
- overall_fee: number;
119
- }
113
+ export type JsFeeSource = "PAYMASTER" | "CREDITS";
120
114
 
121
- export interface JsEstimateFeeDetails {
122
- nonce: JsFelt;
123
- }
115
+ export type JsFelt = Felt;
124
116
 
125
117
  export type JsPriceUnit = "WEI" | "FRI";
126
118
 
119
+ export type JsRegister = RegisterInput;
120
+
127
121
  export type JsRegisterResponse = ResponseData;
128
122
 
129
- export type JsRegister = RegisterInput;
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
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";