@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.
Binary file
@@ -19,78 +19,61 @@ export interface JsSignedOutsideExecution {
19
19
  signature: JsFelt[];
20
20
  }
21
21
 
22
- export type JsFeeSource = "PAYMASTER" | "CREDITS";
23
-
24
- export type Felts = JsFelt[];
25
-
26
- export type JsFelt = Felt;
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 type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
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
 
58
- export type JsAddSignerInput = SignerInput;
45
+ export interface Credentials {
46
+ authorization: JsFelt[];
47
+ privateKey: JsFelt;
48
+ }
59
49
 
60
50
  export interface Eip191Signer {
61
51
  address: string;
62
52
  }
63
53
 
64
- export interface WebauthnSigner {
65
- rpId: string;
66
- credentialId: string;
67
- publicKey: string;
54
+ export interface JsCall {
55
+ contractAddress: JsFelt;
56
+ entrypoint: string;
57
+ calldata: JsFelt[];
68
58
  }
69
59
 
70
- export interface Signer {
71
- webauthns?: WebauthnSigner[];
72
- webauthn?: WebauthnSigner;
73
- starknet?: StarknetSigner;
74
- eip191?: Eip191Signer;
60
+ export interface JsEstimateFeeDetails {
61
+ nonce: JsFelt;
75
62
  }
76
63
 
77
- export interface StarknetSigner {
78
- privateKey: JsFelt;
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 AuthorizedSession {
86
- session: Session;
87
- authorization: JsFelt[] | null;
88
- isRegistered: boolean;
89
- expiresAt: number;
90
- allowedPoliciesRoot: JsFelt;
91
- metadataHash: JsFelt;
92
- sessionKeyGuid: JsFelt;
93
- guardianKeyGuid: JsFelt;
74
+ export interface Owner {
75
+ signer?: Signer;
76
+ account?: JsFelt;
94
77
  }
95
78
 
96
79
  export interface Session {
@@ -101,129 +84,146 @@ export interface Session {
101
84
  guardianKeyGuid: JsFelt;
102
85
  }
103
86
 
104
- export type JsRevokableSession = RevokableSession;
87
+ export interface Signer {
88
+ webauthns?: WebauthnSigner[];
89
+ webauthn?: WebauthnSigner;
90
+ starknet?: StarknetSigner;
91
+ eip191?: Eip191Signer;
92
+ }
105
93
 
106
- export interface Credentials {
107
- authorization: JsFelt[];
94
+ export interface StarknetSigner {
108
95
  privateKey: JsFelt;
109
96
  }
110
97
 
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;
98
+ export interface TypedDataPolicy {
99
+ scope_hash: JsFelt;
100
+ authorized?: boolean;
119
101
  }
120
102
 
121
- export type JsPriceUnit = "WEI" | "FRI";
122
-
123
- export interface JsEstimateFeeDetails {
124
- nonce: JsFelt;
103
+ export interface WebauthnSigner {
104
+ rpId: string;
105
+ credentialId: string;
106
+ publicKey: string;
125
107
  }
126
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
+
117
+ export type JsPriceUnit = "WEI" | "FRI";
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";