@azguardwallet/types 0.4.1 → 0.6.0
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/dist/action.d.ts +13 -2
- package/dist/authwit-content.d.ts +5 -24
- package/dist/dapp-session.d.ts +1 -1
- package/dist/operation.d.ts +194 -15
- package/dist/result.d.ts +2 -2
- package/package.json +2 -2
package/dist/action.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AuthwitContent } from "./authwit-content";
|
|
2
2
|
/** Action kind */
|
|
3
|
-
export type ActionKind = "
|
|
3
|
+
export type ActionKind = Action["kind"];
|
|
4
4
|
/** A request to perform some action */
|
|
5
|
-
export type Action = AddCapsuleAction | AddPrivateAuthwitAction | AddPublicAuthwitAction | CallAction | EncodedCallAction;
|
|
5
|
+
export type Action = AddCapsuleAction | AddExtraArgsAction | AddPrivateAuthwitAction | AddPublicAuthwitAction | CallAction | EncodedCallAction;
|
|
6
6
|
/** A request to add a capsule to PXE */
|
|
7
7
|
export type AddCapsuleAction = {
|
|
8
8
|
/** Action kind */
|
|
@@ -14,6 +14,13 @@ export type AddCapsuleAction = {
|
|
|
14
14
|
/** Capsule to be added (Fr[]) */
|
|
15
15
|
capsule: string[];
|
|
16
16
|
};
|
|
17
|
+
/** A request to add extra args to be available during execution */
|
|
18
|
+
export type AddExtraArgsAction = {
|
|
19
|
+
/** Action kind */
|
|
20
|
+
kind: "add_extra_args";
|
|
21
|
+
/** Args (Fr[]) */
|
|
22
|
+
args: string[];
|
|
23
|
+
};
|
|
17
24
|
/** A request to add an authwit for the message hash computed from the given content to PXE */
|
|
18
25
|
export type AddPrivateAuthwitAction = {
|
|
19
26
|
/** Action kind */
|
|
@@ -43,6 +50,8 @@ export type CallAction = {
|
|
|
43
50
|
method: string;
|
|
44
51
|
/** Arguments (unencoded) */
|
|
45
52
|
args: any[];
|
|
53
|
+
/** Whether or not the caller's address should be hidden from the called contract */
|
|
54
|
+
hideSender?: boolean;
|
|
46
55
|
};
|
|
47
56
|
/** A request to call a contract with encoded args (matches FunctionCall from aztec.js) */
|
|
48
57
|
export type EncodedCallAction = {
|
|
@@ -56,6 +65,8 @@ export type EncodedCallAction = {
|
|
|
56
65
|
selector: string;
|
|
57
66
|
/** Type of the function (FunctionType) */
|
|
58
67
|
type?: string;
|
|
68
|
+
/** Whether or not the caller's address should be hidden from the called contract */
|
|
69
|
+
hideMsgSender?: boolean;
|
|
59
70
|
/** Whether this call can makes modifications to state or not */
|
|
60
71
|
isStatic?: boolean;
|
|
61
72
|
/** Encoded arguments (Fr[]) */
|
|
@@ -1,38 +1,19 @@
|
|
|
1
|
+
import { CallAction, EncodedCallAction } from "./action";
|
|
1
2
|
/** Content to add authwitness for. */
|
|
2
3
|
export type AuthwitContent = CallAuthwitContent | EncodedCallAuthwitContent | IntentAuthwitContent | MessageHashAuthwitContent;
|
|
3
4
|
/** Contract call to be authorized */
|
|
4
|
-
export type CallAuthwitContent = {
|
|
5
|
+
export type CallAuthwitContent = Omit<CallAction, "kind"> & {
|
|
5
6
|
/** Authwit content kind */
|
|
6
|
-
kind: "call";
|
|
7
|
+
readonly kind: "call";
|
|
7
8
|
/** Address of the caller (AztecAddress) */
|
|
8
|
-
caller: string;
|
|
9
|
-
/** Address of the contract (AztecAddress) */
|
|
10
|
-
contract: string;
|
|
11
|
-
/** Name of the function */
|
|
12
|
-
method: string;
|
|
13
|
-
/** Arguments (unencoded) */
|
|
14
|
-
args: any[];
|
|
9
|
+
readonly caller: string;
|
|
15
10
|
};
|
|
16
11
|
/** Encoded contract call to be authorized */
|
|
17
|
-
export type EncodedCallAuthwitContent = {
|
|
12
|
+
export type EncodedCallAuthwitContent = Omit<EncodedCallAction, "kind"> & {
|
|
18
13
|
/** Authwit content kind */
|
|
19
14
|
kind: "encoded_call";
|
|
20
15
|
/** Address of the caller (AztecAddress) */
|
|
21
16
|
caller: string;
|
|
22
|
-
/** Name of the function */
|
|
23
|
-
name?: string;
|
|
24
|
-
/** Address of the contract (AztecAddress) */
|
|
25
|
-
to: string;
|
|
26
|
-
/** Selector of the function (FunctionSelector) */
|
|
27
|
-
selector: string;
|
|
28
|
-
/** Type of the function (FunctionType) */
|
|
29
|
-
type?: string;
|
|
30
|
-
/** Whether this call can makes modifications to state or not */
|
|
31
|
-
isStatic?: boolean;
|
|
32
|
-
/** Encoded arguments (Fr[]) */
|
|
33
|
-
args: string[];
|
|
34
|
-
/** Return types for decoding (AbiType[]) */
|
|
35
|
-
returnTypes?: unknown[];
|
|
36
17
|
};
|
|
37
18
|
/** Arbitrary intent to be authorized */
|
|
38
19
|
export type IntentAuthwitContent = {
|
package/dist/dapp-session.d.ts
CHANGED
package/dist/operation.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { Action, CallAction, EncodedCallAction } from "./action";
|
|
|
2
2
|
import { Result } from "./result";
|
|
3
3
|
import { CaipAccount, CaipChain } from "./dapp-session";
|
|
4
4
|
/** Operation kind */
|
|
5
|
-
export type OperationKind = "
|
|
5
|
+
export type OperationKind = Operation["kind"];
|
|
6
6
|
/** A request to perform some operation */
|
|
7
|
-
export type Operation = GetCompleteAddressOperation | RegisterContractOperation | RegisterSenderOperation | RegisterTokenOperation | SendTransactionOperation | SimulateTransactionOperation | SimulateUtilityOperation | SimulateViewsOperation;
|
|
7
|
+
export type Operation = GetCompleteAddressOperation | RegisterContractOperation | RegisterSenderOperation | RegisterTokenOperation | SendTransactionOperation | SimulateTransactionOperation | SimulateUtilityOperation | SimulateViewsOperation | AztecGetContractClassMetadataOperation | AztecGetContractMetadataOperation | AztecGetPrivateEventsOperation | AztecGetChainInfoOperation | AztecGetTxReceiptOperation | AztecRegisterSenderOperation | AztecGetAddressBookOperation | AztecRegisterContractOperation | AztecSimulateTxOperation | AztecSimulateUtilityOperation | AztecProfileTxOperation | AztecSendTxOperation | AztecCreateAuthWitOperation;
|
|
8
8
|
/** Operation result */
|
|
9
|
-
export type OperationResult = Result<GetCompleteAddressResult> | Result<RegisterContractResult> | Result<RegisterSenderResult> | Result<RegisterTokenResult> | Result<SendTransactionResult> | Result<SimulateTransactionResult> | Result<SimulateUtilityResult> | Result<SimulateViewsResult>;
|
|
9
|
+
export type OperationResult = Result<GetCompleteAddressResult> | Result<RegisterContractResult> | Result<RegisterSenderResult> | Result<RegisterTokenResult> | Result<SendTransactionResult> | Result<SimulateTransactionResult> | Result<SimulateUtilityResult> | Result<SimulateViewsResult> | Result<AztecGetContractClassMetadataResult> | Result<AztecGetContractMetadataResult> | Result<AztecGetPrivateEventsResult> | Result<AztecGetChainInfoResult> | Result<AztecGetTxReceiptResult> | Result<AztecRegisterSenderResult> | Result<AztecGetAddressBookResult> | Result<AztecRegisterContractResult> | Result<AztecSimulateTxResult> | Result<AztecSimulateUtilityResult> | Result<AztecProfileTxResult> | Result<AztecSendTxResult> | Result<AztecCreateAuthWitResult>;
|
|
10
10
|
/** A request to get complete address of the specified account */
|
|
11
11
|
export type GetCompleteAddressOperation = {
|
|
12
12
|
/** Operation kind */
|
|
@@ -59,6 +59,24 @@ export type RegisterTokenOperation = {
|
|
|
59
59
|
};
|
|
60
60
|
/** A result of the "register_token" operation */
|
|
61
61
|
export type RegisterTokenResult = Result<void>;
|
|
62
|
+
/** Fees and gas options */
|
|
63
|
+
export type FeeOptions = {
|
|
64
|
+
/** Tells if fee payment payload (either fee juice with claim or fpc) is included */
|
|
65
|
+
readonly embeddedFeePayment?: "fjwc" | "fpc";
|
|
66
|
+
/** Suggest gas limits to be used at the first step of estimation */
|
|
67
|
+
readonly gasLimits?: GasLimits;
|
|
68
|
+
/** Suggest teardown gas limits to be used at the first step of estimation */
|
|
69
|
+
readonly teardownGasLimits?: GasLimits;
|
|
70
|
+
/** Multiplier for the simulated gas */
|
|
71
|
+
readonly gasPadding?: number;
|
|
72
|
+
};
|
|
73
|
+
/** Gas limits */
|
|
74
|
+
export type GasLimits = {
|
|
75
|
+
/** DA gas */
|
|
76
|
+
readonly daGas: number;
|
|
77
|
+
/** L2 gas */
|
|
78
|
+
readonly l2Gas: number;
|
|
79
|
+
};
|
|
62
80
|
/** A request to send the transaction */
|
|
63
81
|
export type SendTransactionOperation = {
|
|
64
82
|
/** Operation kind */
|
|
@@ -66,15 +84,12 @@ export type SendTransactionOperation = {
|
|
|
66
84
|
/** Address of the account to send transaction from */
|
|
67
85
|
account: CaipAccount;
|
|
68
86
|
/**
|
|
69
|
-
* Batch of calls to be passed to the account contract
|
|
87
|
+
* Batch of calls to be passed to the account contract
|
|
70
88
|
* and additional actions, that may be needed for its execution
|
|
71
89
|
* */
|
|
72
90
|
actions: Action[];
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
* and additional actions, that may be needed for its execution
|
|
76
|
-
* */
|
|
77
|
-
setup?: Action[];
|
|
91
|
+
/** Fees and gas options */
|
|
92
|
+
fee?: FeeOptions;
|
|
78
93
|
};
|
|
79
94
|
/** A result of the "send_transaction" operation (TxHash) */
|
|
80
95
|
export type SendTransactionResult = string;
|
|
@@ -85,15 +100,12 @@ export type SimulateTransactionOperation = {
|
|
|
85
100
|
/** Address of the account to send transaction from */
|
|
86
101
|
account: CaipAccount;
|
|
87
102
|
/**
|
|
88
|
-
* Batch of calls to be passed to the account contract
|
|
103
|
+
* Batch of calls to be passed to the account contract
|
|
89
104
|
* and additional actions, that may be needed for its execution
|
|
90
105
|
* */
|
|
91
106
|
actions: Action[];
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
* and additional actions, that may be needed for its execution
|
|
95
|
-
* */
|
|
96
|
-
setup?: Action[];
|
|
107
|
+
/** Fees and gas options */
|
|
108
|
+
fee?: FeeOptions;
|
|
97
109
|
/** Whether to also simulate enqueued public calls or not */
|
|
98
110
|
simulatePublic?: boolean;
|
|
99
111
|
};
|
|
@@ -137,3 +149,170 @@ export type SimulateViewsResult = {
|
|
|
137
149
|
/** List of results, decoded with function return types ABI (AbiDecoded[]) */
|
|
138
150
|
decoded: unknown[];
|
|
139
151
|
};
|
|
152
|
+
/** Aztec.js Wallet request */
|
|
153
|
+
export type AztecGetContractClassMetadataOperation = {
|
|
154
|
+
/** Operation kind */
|
|
155
|
+
kind: "aztec_getContractClassMetadata";
|
|
156
|
+
/** Chain to execute request for */
|
|
157
|
+
chain: CaipChain;
|
|
158
|
+
/** Identifier of the class (Fr) */
|
|
159
|
+
id: unknown;
|
|
160
|
+
/** Whether or not to also return contract artifact */
|
|
161
|
+
includeArtifact?: boolean;
|
|
162
|
+
};
|
|
163
|
+
/** A result of the "aztec_getContractClassMetadata" operation (ContractClassMetadata) */
|
|
164
|
+
export type AztecGetContractClassMetadataResult = unknown;
|
|
165
|
+
/** Aztec.js Wallet request */
|
|
166
|
+
export type AztecGetContractMetadataOperation = {
|
|
167
|
+
/** Operation kind */
|
|
168
|
+
kind: "aztec_getContractMetadata";
|
|
169
|
+
/** Chain to execute request for */
|
|
170
|
+
chain: CaipChain;
|
|
171
|
+
/** The address that the contract instance resides at (AztecAddress) */
|
|
172
|
+
address: unknown;
|
|
173
|
+
};
|
|
174
|
+
/** A result of the "aztec_getContractMetadata" operation (ContractMetadata) */
|
|
175
|
+
export type AztecGetContractMetadataResult = unknown;
|
|
176
|
+
/** Aztec.js Wallet request */
|
|
177
|
+
export type AztecGetPrivateEventsOperation = {
|
|
178
|
+
/** Operation kind */
|
|
179
|
+
kind: "aztec_getPrivateEvents";
|
|
180
|
+
/** Chain to execute request for */
|
|
181
|
+
chain: CaipChain;
|
|
182
|
+
/** The address of the contract to get events from (AztecAddress) */
|
|
183
|
+
contractAddress: unknown;
|
|
184
|
+
/** Metadata of the event. This should be the class generated from the contract. e.g. Contract.events.Event (EventMetadataDefinition) */
|
|
185
|
+
eventMetadata: unknown;
|
|
186
|
+
/** The block number to search from */
|
|
187
|
+
from: number;
|
|
188
|
+
/** The amount of blocks to search */
|
|
189
|
+
numBlocks: number;
|
|
190
|
+
/** The addresses that decrypted the logs (AztecAddress[]) */
|
|
191
|
+
recipients: unknown[];
|
|
192
|
+
};
|
|
193
|
+
/** A result of the "aztec_getPrivateEvents" operation (T[]) */
|
|
194
|
+
export type AztecGetPrivateEventsResult = unknown;
|
|
195
|
+
/** Aztec.js Wallet request */
|
|
196
|
+
export type AztecGetChainInfoOperation = {
|
|
197
|
+
/** Operation kind */
|
|
198
|
+
kind: "aztec_getChainInfo";
|
|
199
|
+
/** Chain to execute request for */
|
|
200
|
+
chain: CaipChain;
|
|
201
|
+
};
|
|
202
|
+
/** A result of the "aztec_getChainInfo" operation (ChainInfo) */
|
|
203
|
+
export type AztecGetChainInfoResult = unknown;
|
|
204
|
+
/** Aztec.js Wallet request */
|
|
205
|
+
export type AztecGetTxReceiptOperation = {
|
|
206
|
+
/** Operation kind */
|
|
207
|
+
kind: "aztec_getTxReceipt";
|
|
208
|
+
/** Chain to execute request for */
|
|
209
|
+
chain: CaipChain;
|
|
210
|
+
/** The transaction hash (TxHash) */
|
|
211
|
+
txHash: unknown;
|
|
212
|
+
};
|
|
213
|
+
/** A result of the "aztec_getTxReceipt" operation (TxReceipt) */
|
|
214
|
+
export type AztecGetTxReceiptResult = unknown;
|
|
215
|
+
/** Aztec.js Wallet request */
|
|
216
|
+
export type AztecRegisterSenderOperation = {
|
|
217
|
+
/** Operation kind */
|
|
218
|
+
kind: "aztec_registerSender";
|
|
219
|
+
/** Chain to execute request for */
|
|
220
|
+
chain: CaipChain;
|
|
221
|
+
/** Address of the user to add to the address book (AztecAddress) */
|
|
222
|
+
address: unknown;
|
|
223
|
+
/** Optional alias for the sender's address */
|
|
224
|
+
alias?: string;
|
|
225
|
+
};
|
|
226
|
+
/** A result of the "aztec_registerSender" operation (AztecAddress) */
|
|
227
|
+
export type AztecRegisterSenderResult = unknown;
|
|
228
|
+
/** Aztec.js Wallet request */
|
|
229
|
+
export type AztecGetAddressBookOperation = {
|
|
230
|
+
/** Operation kind */
|
|
231
|
+
kind: "aztec_getAddressBook";
|
|
232
|
+
/** Chain to execute request for */
|
|
233
|
+
chain: CaipChain;
|
|
234
|
+
};
|
|
235
|
+
/** A result of the "aztec_getAddressBook" operation (Aliased<AztecAddress>[]) */
|
|
236
|
+
export type AztecGetAddressBookResult = unknown;
|
|
237
|
+
/** Aztec.js Wallet request */
|
|
238
|
+
export type AztecRegisterContractOperation = {
|
|
239
|
+
/** Operation kind */
|
|
240
|
+
kind: "aztec_registerContract";
|
|
241
|
+
/** Chain to execute request for */
|
|
242
|
+
chain: CaipChain;
|
|
243
|
+
/** Contract instance (AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact) */
|
|
244
|
+
instanceData: unknown;
|
|
245
|
+
/** Contract artifact (ContractArtifact) */
|
|
246
|
+
artifact?: unknown;
|
|
247
|
+
/** Secret key (Fr) */
|
|
248
|
+
secretKey?: unknown;
|
|
249
|
+
};
|
|
250
|
+
/** A result of the "aztec_registerContract" operation (ContractInstanceWithAddress) */
|
|
251
|
+
export type AztecRegisterContractResult = unknown;
|
|
252
|
+
/** Aztec.js Wallet request */
|
|
253
|
+
export type AztecSimulateTxOperation = {
|
|
254
|
+
/** Operation kind */
|
|
255
|
+
kind: "aztec_simulateTx";
|
|
256
|
+
/** Address of the account to simulate transaction from */
|
|
257
|
+
account: CaipAccount;
|
|
258
|
+
/** Payload (ExecutionPayload) */
|
|
259
|
+
exec: unknown;
|
|
260
|
+
/** Options (SimulateOptions) */
|
|
261
|
+
opts: unknown;
|
|
262
|
+
};
|
|
263
|
+
/** A result of the "aztec_simulateTx" operation (TxSimulationResult) */
|
|
264
|
+
export type AztecSimulateTxResult = unknown;
|
|
265
|
+
/** Aztec.js Wallet request */
|
|
266
|
+
export type AztecSimulateUtilityOperation = {
|
|
267
|
+
/** Operation kind */
|
|
268
|
+
kind: "aztec_simulateUtility";
|
|
269
|
+
/** Address of the account to simulate utility function from */
|
|
270
|
+
account: CaipAccount;
|
|
271
|
+
/** The name of the utility contract function to be called */
|
|
272
|
+
functionName: string;
|
|
273
|
+
/** The arguments to be provided to the function */
|
|
274
|
+
args: any[];
|
|
275
|
+
/** The address of the contract to be called (AztecAddress) */
|
|
276
|
+
to: unknown;
|
|
277
|
+
/** (Optional) The authentication witnesses required for the function call (AuthWitness[]) */
|
|
278
|
+
authwits?: unknown[];
|
|
279
|
+
};
|
|
280
|
+
/** A result of the "aztec_simulateUtility" operation (UtilitySimulationResult) */
|
|
281
|
+
export type AztecSimulateUtilityResult = unknown;
|
|
282
|
+
/** Aztec.js Wallet request */
|
|
283
|
+
export type AztecProfileTxOperation = {
|
|
284
|
+
/** Operation kind */
|
|
285
|
+
kind: "aztec_profileTx";
|
|
286
|
+
/** Address of the account to profile tx from */
|
|
287
|
+
account: CaipAccount;
|
|
288
|
+
/** Payload (ExecutionPayload) */
|
|
289
|
+
exec: unknown;
|
|
290
|
+
/** Options (ProfileOptions) */
|
|
291
|
+
opts: unknown;
|
|
292
|
+
};
|
|
293
|
+
/** A result of the "aztec_profileTx" operation (TxProfileResult) */
|
|
294
|
+
export type AztecProfileTxResult = unknown;
|
|
295
|
+
/** Aztec.js Wallet request */
|
|
296
|
+
export type AztecSendTxOperation = {
|
|
297
|
+
/** Operation kind */
|
|
298
|
+
kind: "aztec_sendTx";
|
|
299
|
+
/** Address of the account to send tx from */
|
|
300
|
+
account: CaipAccount;
|
|
301
|
+
/** Payload (ExecutionPayload) */
|
|
302
|
+
exec: unknown;
|
|
303
|
+
/** Options (SendOptions) */
|
|
304
|
+
opts: unknown;
|
|
305
|
+
};
|
|
306
|
+
/** A result of the "aztec_sendTx" operation (TxHash) */
|
|
307
|
+
export type AztecSendTxResult = unknown;
|
|
308
|
+
/** Aztec.js Wallet request */
|
|
309
|
+
export type AztecCreateAuthWitOperation = {
|
|
310
|
+
/** Operation kind */
|
|
311
|
+
kind: "aztec_createAuthWit";
|
|
312
|
+
/** Address of the account to create authwit for */
|
|
313
|
+
account: CaipAccount;
|
|
314
|
+
/** Intent or message hash (Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent) */
|
|
315
|
+
messageHashOrIntent: unknown;
|
|
316
|
+
};
|
|
317
|
+
/** A result of the "aztec_createAuthWit" operation (AuthWitness) */
|
|
318
|
+
export type AztecCreateAuthWitResult = unknown;
|
package/dist/result.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Result object */
|
|
2
|
-
export type Result<T> = OkResult<T> | FailedResult | SkippedResult;
|
|
2
|
+
export type Result<T = unknown> = OkResult<T> | FailedResult | SkippedResult;
|
|
3
3
|
/** Successful result, containing returned value */
|
|
4
|
-
export type OkResult<T> = {
|
|
4
|
+
export type OkResult<T = unknown> = {
|
|
5
5
|
/** Result status */
|
|
6
6
|
status: "ok";
|
|
7
7
|
/** Returned value */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azguardwallet/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Typings for Azguard Wallet inpage RPC client",
|
|
5
5
|
"author": "Azguard Wallet",
|
|
6
6
|
"homepage": "https://github.com/AzguardWallet/azguard-wallet-types",
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "rm -rf dist && tsc"
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}
|