@cartridge/controller-wasm 0.7.14-3d082f2 → 0.7.14-634aa73
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.
- package/package.json +1 -1
- package/pkg-controller/account_wasm.d.ts +209 -225
- package/pkg-controller/account_wasm_bg.js +727 -754
- package/pkg-controller/account_wasm_bg.wasm +0 -0
- package/pkg-session/session_wasm.d.ts +144 -139
- package/pkg-session/session_wasm_bg.js +377 -391
- package/pkg-session/session_wasm_bg.wasm +0 -0
|
Binary file
|
|
@@ -1,107 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
StarknetFailedToReceiveTransaction = 1,
|
|
12
|
-
StarknetContractNotFound = 20,
|
|
13
|
-
StarknetBlockNotFound = 24,
|
|
14
|
-
StarknetInvalidTransactionIndex = 27,
|
|
15
|
-
StarknetClassHashNotFound = 28,
|
|
16
|
-
StarknetTransactionHashNotFound = 29,
|
|
17
|
-
StarknetPageSizeTooBig = 31,
|
|
18
|
-
StarknetNoBlocks = 32,
|
|
19
|
-
StarknetInvalidContinuationToken = 33,
|
|
20
|
-
StarknetTooManyKeysInFilter = 34,
|
|
21
|
-
StarknetContractError = 40,
|
|
22
|
-
StarknetTransactionExecutionError = 41,
|
|
23
|
-
StarknetClassAlreadyDeclared = 51,
|
|
24
|
-
StarknetInvalidTransactionNonce = 52,
|
|
25
|
-
StarknetInsufficientMaxFee = 53,
|
|
26
|
-
StarknetInsufficientAccountBalance = 54,
|
|
27
|
-
StarknetValidationFailure = 55,
|
|
28
|
-
StarknetCompilationFailed = 56,
|
|
29
|
-
StarknetContractClassSizeIsTooLarge = 57,
|
|
30
|
-
StarknetNonAccount = 58,
|
|
31
|
-
StarknetDuplicateTx = 59,
|
|
32
|
-
StarknetCompiledClassHashMismatch = 60,
|
|
33
|
-
StarknetUnsupportedTxVersion = 61,
|
|
34
|
-
StarknetUnsupportedContractClassVersion = 62,
|
|
35
|
-
StarknetUnexpectedError = 63,
|
|
36
|
-
StarknetNoTraceAvailable = 10,
|
|
37
|
-
StarknetReplacementTransactionUnderpriced = 64,
|
|
38
|
-
StarknetFeeBelowMinimum = 65,
|
|
39
|
-
SignError = 101,
|
|
40
|
-
StorageError = 102,
|
|
41
|
-
AccountFactoryError = 103,
|
|
42
|
-
PaymasterExecutionTimeNotReached = 104,
|
|
43
|
-
PaymasterExecutionTimePassed = 105,
|
|
44
|
-
PaymasterInvalidCaller = 106,
|
|
45
|
-
PaymasterRateLimitExceeded = 107,
|
|
46
|
-
PaymasterNotSupported = 108,
|
|
47
|
-
PaymasterHttp = 109,
|
|
48
|
-
PaymasterExcecution = 110,
|
|
49
|
-
PaymasterSerialization = 111,
|
|
50
|
-
CartridgeControllerNotDeployed = 112,
|
|
51
|
-
InsufficientBalance = 113,
|
|
52
|
-
OriginError = 114,
|
|
53
|
-
EncodingError = 115,
|
|
54
|
-
SerdeWasmBindgenError = 116,
|
|
55
|
-
CairoSerdeError = 117,
|
|
56
|
-
CairoShortStringToFeltError = 118,
|
|
57
|
-
DeviceCreateCredential = 119,
|
|
58
|
-
DeviceGetAssertion = 120,
|
|
59
|
-
DeviceBadAssertion = 121,
|
|
60
|
-
DeviceChannel = 122,
|
|
61
|
-
DeviceOrigin = 123,
|
|
62
|
-
AccountSigning = 124,
|
|
63
|
-
AccountProvider = 125,
|
|
64
|
-
AccountClassHashCalculation = 126,
|
|
65
|
-
AccountFeeOutOfRange = 128,
|
|
66
|
-
ProviderRateLimited = 129,
|
|
67
|
-
ProviderArrayLengthMismatch = 130,
|
|
68
|
-
ProviderOther = 131,
|
|
69
|
-
SessionAlreadyRegistered = 132,
|
|
70
|
-
UrlParseError = 133,
|
|
71
|
-
Base64DecodeError = 134,
|
|
72
|
-
CoseError = 135,
|
|
73
|
-
PolicyChainIdMismatch = 136,
|
|
74
|
-
InvalidOwner = 137,
|
|
75
|
-
GasPriceTooHigh = 138,
|
|
76
|
-
TransactionTimeout = 139,
|
|
77
|
-
ConversionError = 140,
|
|
78
|
-
InvalidChainId = 141,
|
|
79
|
-
SessionRefreshRequired = 142,
|
|
80
|
-
ManualExecutionRequired = 143,
|
|
81
|
-
ForbiddenEntrypoint = 144,
|
|
82
|
-
GasAmountTooHigh = 145,
|
|
83
|
-
ApproveExecutionRequired = 146,
|
|
84
|
-
}
|
|
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;
|
|
6
|
+
export interface JsSignedOutsideExecution {
|
|
7
|
+
outside_execution: JsOutsideExecutionV3;
|
|
8
|
+
signature: JsFelt[];
|
|
105
9
|
}
|
|
106
10
|
|
|
107
11
|
/**
|
|
@@ -115,12 +19,16 @@ export interface JsOutsideExecutionV3 {
|
|
|
115
19
|
nonce: [JsFelt, JsFelt];
|
|
116
20
|
}
|
|
117
21
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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[];
|
|
124
32
|
}
|
|
125
33
|
|
|
126
34
|
export interface Owner {
|
|
@@ -134,28 +42,20 @@ export interface CallPolicy {
|
|
|
134
42
|
authorized?: boolean;
|
|
135
43
|
}
|
|
136
44
|
|
|
137
|
-
export interface TypedDataPolicy {
|
|
138
|
-
scope_hash: JsFelt;
|
|
139
|
-
authorized?: boolean;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
45
|
export interface ApprovalPolicy {
|
|
143
46
|
target: JsFelt;
|
|
144
47
|
spender: JsFelt;
|
|
145
48
|
amount: JsFelt;
|
|
146
49
|
}
|
|
147
50
|
|
|
148
|
-
export
|
|
149
|
-
|
|
150
|
-
|
|
51
|
+
export interface TypedDataPolicy {
|
|
52
|
+
scope_hash: JsFelt;
|
|
53
|
+
authorized?: boolean;
|
|
54
|
+
}
|
|
151
55
|
|
|
152
|
-
export type
|
|
56
|
+
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
153
57
|
|
|
154
|
-
export
|
|
155
|
-
rpId: string;
|
|
156
|
-
credentialId: string;
|
|
157
|
-
publicKey: string;
|
|
158
|
-
}
|
|
58
|
+
export type JsAddSignerInput = SignerInput;
|
|
159
59
|
|
|
160
60
|
export interface StarknetSigner {
|
|
161
61
|
privateKey: JsFelt;
|
|
@@ -165,6 +65,14 @@ export interface Eip191Signer {
|
|
|
165
65
|
address: string;
|
|
166
66
|
}
|
|
167
67
|
|
|
68
|
+
export interface WebauthnSigner {
|
|
69
|
+
rpId: string;
|
|
70
|
+
credentialId: string;
|
|
71
|
+
publicKey: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type JsRemoveSignerInput = SignerInput;
|
|
75
|
+
|
|
168
76
|
export interface Signer {
|
|
169
77
|
webauthns?: WebauthnSigner[];
|
|
170
78
|
webauthn?: WebauthnSigner;
|
|
@@ -172,20 +80,6 @@ export interface Signer {
|
|
|
172
80
|
eip191?: Eip191Signer;
|
|
173
81
|
}
|
|
174
82
|
|
|
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
83
|
export interface AuthorizedSession {
|
|
190
84
|
session: Session;
|
|
191
85
|
authorization: JsFelt[] | null;
|
|
@@ -197,6 +91,11 @@ export interface AuthorizedSession {
|
|
|
197
91
|
guardianKeyGuid: JsFelt;
|
|
198
92
|
}
|
|
199
93
|
|
|
94
|
+
export interface Credentials {
|
|
95
|
+
authorization: JsFelt[];
|
|
96
|
+
privateKey: JsFelt;
|
|
97
|
+
}
|
|
98
|
+
|
|
200
99
|
export interface Session {
|
|
201
100
|
policies: Policy[];
|
|
202
101
|
expiresAt: number;
|
|
@@ -205,21 +104,118 @@ export interface Session {
|
|
|
205
104
|
guardianKeyGuid: JsFelt;
|
|
206
105
|
}
|
|
207
106
|
|
|
208
|
-
export
|
|
209
|
-
|
|
210
|
-
|
|
107
|
+
export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
|
|
108
|
+
|
|
109
|
+
export type JsRevokableSession = RevokableSession;
|
|
110
|
+
|
|
111
|
+
export type JsPriceUnit = "WEI" | "FRI";
|
|
112
|
+
|
|
113
|
+
export interface JsFeeEstimate {
|
|
114
|
+
l1_gas_consumed: number;
|
|
115
|
+
l1_gas_price: number;
|
|
116
|
+
l2_gas_consumed: number;
|
|
117
|
+
l2_gas_price: number;
|
|
118
|
+
l1_data_gas_consumed: number;
|
|
119
|
+
l1_data_gas_price: number;
|
|
120
|
+
overall_fee: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface JsEstimateFeeDetails {
|
|
124
|
+
nonce: JsFelt;
|
|
211
125
|
}
|
|
212
126
|
|
|
127
|
+
export type JsRegister = RegisterInput;
|
|
128
|
+
|
|
129
|
+
export type JsRegisterResponse = ResponseData;
|
|
130
|
+
|
|
131
|
+
|
|
213
132
|
export class CartridgeSessionAccount {
|
|
214
133
|
private constructor();
|
|
215
134
|
free(): void;
|
|
216
135
|
[Symbol.dispose](): void;
|
|
217
|
-
static new(rpc_url: string, signer: JsFelt, address: JsFelt, chain_id: JsFelt, session_authorization: JsFelt[], session: Session): CartridgeSessionAccount;
|
|
218
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;
|
|
219
139
|
sign(hash: JsFelt, calls: JsCall[]): Promise<Felts>;
|
|
220
140
|
execute(calls: JsCall[]): Promise<any>;
|
|
221
|
-
executeFromOutside(calls: JsCall[]): Promise<any>;
|
|
222
141
|
}
|
|
142
|
+
|
|
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,
|
|
217
|
+
}
|
|
218
|
+
|
|
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>;
|