@cartridge/controller-wasm 0.7.14-3d082f2 → 0.7.14-4ec2e4fc
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 +7 -4
- package/pkg-controller/account_wasm.d.ts +382 -330
- package/pkg-controller/account_wasm.js +7 -2
- package/pkg-controller/account_wasm_bg.js +1274 -1353
- package/pkg-controller/account_wasm_bg.wasm +0 -0
- package/pkg-session/session_wasm.d.ts +205 -165
- package/pkg-session/session_wasm.js +7 -2
- package/pkg-session/session_wasm_bg.js +842 -940
- package/pkg-session/session_wasm_bg.wasm +0 -0
|
Binary file
|
|
@@ -1,109 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
|
|
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.
|
|
7
|
-
*/
|
|
8
|
-
export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;
|
|
9
|
-
export function signerToGuid(signer: Signer): JsFelt;
|
|
10
|
-
export enum ErrorCode {
|
|
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;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
3
|
/**
|
|
108
4
|
* JavaScript-friendly OutsideExecution V3 structure
|
|
109
5
|
*/
|
|
@@ -123,9 +19,21 @@ export interface JsSignedOutsideExecution {
|
|
|
123
19
|
signature: JsFelt[];
|
|
124
20
|
}
|
|
125
21
|
|
|
126
|
-
export interface
|
|
127
|
-
|
|
128
|
-
|
|
22
|
+
export interface ApprovalPolicy {
|
|
23
|
+
target: JsFelt;
|
|
24
|
+
spender: JsFelt;
|
|
25
|
+
amount: JsFelt;
|
|
26
|
+
}
|
|
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;
|
|
129
37
|
}
|
|
130
38
|
|
|
131
39
|
export interface CallPolicy {
|
|
@@ -134,35 +42,81 @@ export interface CallPolicy {
|
|
|
134
42
|
authorized?: boolean;
|
|
135
43
|
}
|
|
136
44
|
|
|
137
|
-
export interface
|
|
138
|
-
|
|
139
|
-
|
|
45
|
+
export interface Credentials {
|
|
46
|
+
authorization: JsFelt[];
|
|
47
|
+
privateKey: JsFelt;
|
|
140
48
|
}
|
|
141
49
|
|
|
142
|
-
export interface
|
|
143
|
-
|
|
144
|
-
spender: JsFelt;
|
|
145
|
-
amount: JsFelt;
|
|
50
|
+
export interface Eip191Signer {
|
|
51
|
+
address: string;
|
|
146
52
|
}
|
|
147
53
|
|
|
148
|
-
export
|
|
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;
|
|
62
|
+
}
|
|
149
63
|
|
|
150
|
-
export
|
|
64
|
+
export interface ImportedProvedPolicy {
|
|
65
|
+
policy: Policy;
|
|
66
|
+
proof: JsFelt[];
|
|
67
|
+
}
|
|
151
68
|
|
|
152
|
-
export
|
|
69
|
+
export interface ImportedSession {
|
|
70
|
+
requestedPolicies: Policy[];
|
|
71
|
+
provedPolicies: ImportedProvedPolicy[];
|
|
72
|
+
expiresAt: number;
|
|
73
|
+
allowedPoliciesRoot: JsFelt;
|
|
74
|
+
metadataHash: JsFelt;
|
|
75
|
+
sessionKeyGuid: JsFelt;
|
|
76
|
+
guardianKeyGuid: JsFelt;
|
|
77
|
+
metadata: string;
|
|
78
|
+
}
|
|
153
79
|
|
|
154
|
-
export interface
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
80
|
+
export interface ImportedSessionMetadata {
|
|
81
|
+
session: ImportedSession;
|
|
82
|
+
maxFee?: JsFelt;
|
|
83
|
+
credentials?: Credentials;
|
|
84
|
+
isRegistered: boolean;
|
|
85
|
+
appId?: string;
|
|
86
|
+
policies?: Policy[];
|
|
158
87
|
}
|
|
159
88
|
|
|
160
|
-
export interface
|
|
161
|
-
|
|
89
|
+
export interface JsCall {
|
|
90
|
+
contractAddress: JsFelt;
|
|
91
|
+
entrypoint: string;
|
|
92
|
+
calldata: JsFelt[];
|
|
162
93
|
}
|
|
163
94
|
|
|
164
|
-
export interface
|
|
165
|
-
|
|
95
|
+
export interface JsEstimateFeeDetails {
|
|
96
|
+
nonce: JsFelt;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface JsFeeEstimate {
|
|
100
|
+
l1_gas_consumed: number;
|
|
101
|
+
l1_gas_price: number;
|
|
102
|
+
l2_gas_consumed: number;
|
|
103
|
+
l2_gas_price: number;
|
|
104
|
+
l1_data_gas_consumed: number;
|
|
105
|
+
l1_data_gas_price: number;
|
|
106
|
+
overall_fee: number;
|
|
107
|
+
}
|
|
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;
|
|
166
120
|
}
|
|
167
121
|
|
|
168
122
|
export interface Signer {
|
|
@@ -172,60 +126,146 @@ export interface Signer {
|
|
|
172
126
|
eip191?: Eip191Signer;
|
|
173
127
|
}
|
|
174
128
|
|
|
175
|
-
export
|
|
129
|
+
export interface StarknetSigner {
|
|
130
|
+
privateKey: JsFelt;
|
|
131
|
+
}
|
|
176
132
|
|
|
177
|
-
export
|
|
133
|
+
export interface TypedDataPolicy {
|
|
134
|
+
scope_hash: JsFelt;
|
|
135
|
+
authorized?: boolean;
|
|
136
|
+
}
|
|
178
137
|
|
|
179
|
-
export
|
|
138
|
+
export interface WebauthnSigner {
|
|
139
|
+
rpId: string;
|
|
140
|
+
credentialId: string;
|
|
141
|
+
publicKey: string;
|
|
142
|
+
}
|
|
180
143
|
|
|
181
144
|
export type Felts = JsFelt[];
|
|
182
145
|
|
|
146
|
+
export type JsAddSignerInput = SignerInput;
|
|
147
|
+
|
|
183
148
|
export type JsFeeSource = "PAYMASTER" | "CREDITS";
|
|
184
149
|
|
|
185
|
-
export type
|
|
150
|
+
export type JsFelt = Felt;
|
|
151
|
+
|
|
152
|
+
export type JsPriceUnit = "WEI" | "FRI";
|
|
153
|
+
|
|
154
|
+
export type JsRegister = RegisterInput;
|
|
155
|
+
|
|
156
|
+
export type JsRegisterResponse = ResponseData;
|
|
157
|
+
|
|
158
|
+
export type JsRemoveSignerInput = SignerInput;
|
|
186
159
|
|
|
187
160
|
export type JsRevokableSession = RevokableSession;
|
|
188
161
|
|
|
189
|
-
export
|
|
190
|
-
session: Session;
|
|
191
|
-
authorization: JsFelt[] | null;
|
|
192
|
-
isRegistered: boolean;
|
|
193
|
-
expiresAt: number;
|
|
194
|
-
allowedPoliciesRoot: JsFelt;
|
|
195
|
-
metadataHash: JsFelt;
|
|
196
|
-
sessionKeyGuid: JsFelt;
|
|
197
|
-
guardianKeyGuid: JsFelt;
|
|
198
|
-
}
|
|
162
|
+
export type JsSubscribeSessionResult = SubscribeCreateSessionSubscribeCreateSession;
|
|
199
163
|
|
|
200
|
-
export
|
|
201
|
-
policies: Policy[];
|
|
202
|
-
expiresAt: number;
|
|
203
|
-
metadataHash: JsFelt;
|
|
204
|
-
sessionKeyGuid: JsFelt;
|
|
205
|
-
guardianKeyGuid: JsFelt;
|
|
206
|
-
}
|
|
164
|
+
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
207
165
|
|
|
208
|
-
export interface Credentials {
|
|
209
|
-
authorization: JsFelt[];
|
|
210
|
-
privateKey: JsFelt;
|
|
211
|
-
}
|
|
212
166
|
|
|
213
167
|
export class CartridgeSessionAccount {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
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>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export enum ErrorCode {
|
|
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,
|
|
222
252
|
}
|
|
253
|
+
|
|
223
254
|
export class JsControllerError {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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;
|
|
231
262
|
}
|
|
263
|
+
|
|
264
|
+
export function signerToGuid(signer: Signer): JsFelt;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
|
|
268
|
+
* The goal of this function is to know from any place when the register session flow has been completed, and to
|
|
269
|
+
* get the authorization.
|
|
270
|
+
*/
|
|
271
|
+
export function subscribeCreateSession(session_key_guid: JsFelt, cartridge_api_url: string): Promise<JsSubscribeSessionResult>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./session_wasm.d.ts" */
|
|
1
2
|
import * as wasm from "./session_wasm_bg.wasm";
|
|
2
|
-
export * from "./session_wasm_bg.js";
|
|
3
3
|
import { __wbg_set_wasm } from "./session_wasm_bg.js";
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
CartridgeSessionAccount, ErrorCode, JsControllerError, signerToGuid, subscribeCreateSession
|
|
9
|
+
} from "./session_wasm_bg.js";
|