@azguardwallet/types 0.4.1 → 0.5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AuthwitContent } from "./authwit-content";
2
2
  /** Action kind */
3
- export type ActionKind = "add_capsule" | "add_private_authwit" | "add_public_authwit" | "call" | "encoded_call";
3
+ export type ActionKind = Action["kind"];
4
4
  /** A request to perform some action */
5
5
  export type Action = AddCapsuleAction | AddPrivateAuthwitAction | AddPublicAuthwitAction | CallAction | EncodedCallAction;
6
6
  /** A request to add a capsule to PXE */
@@ -8,7 +8,7 @@ export type CaipAccount = `${CaipChain}:${string}`;
8
8
  /** DApp metadata */
9
9
  export type DappMetadata = {
10
10
  /** Name */
11
- name: string;
11
+ name?: string;
12
12
  /** Short description */
13
13
  description?: string;
14
14
  /** Logo URI */
@@ -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 = "add_note" | "get_complete_address" | "register_contract" | "register_sender" | "register_token" | "send_transaction" | "simulate_transaction" | "simulate_utility" | "simulate_views";
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 | AztecSimulateTxOperation | AztecSimulateUtilityOperation | AztecProfileTxOperation | AztecSendTxOperation | AztecGetContractClassMetadataOperation | AztecGetContractMetadataOperation | AztecRegisterContractOperation | AztecRegisterContractClassOperation | AztecProveTxOperation | AztecGetNodeInfoOperation | AztecGetPXEInfoOperation | AztecGetCurrentBaseFeesOperation | AztecUpdateContractOperation | AztecRegisterSenderOperation | AztecGetSendersOperation | AztecRemoveSenderOperation | AztecGetTxReceiptOperation | AztecGetPrivateEventsOperation | AztecGetPublicEventsOperation | AztecGetCompleteAddressOperation | AztecGetAddressOperation | AztecGetChainIdOperation | AztecGetVersionOperation | AztecCreateTxExecutionRequestOperation | 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<AztecSimulateTxResult> | Result<AztecSimulateUtilityResult> | Result<AztecProfileTxResult> | Result<AztecSendTxResult> | Result<AztecGetContractClassMetadataResult> | Result<AztecGetContractMetadataResult> | Result<AztecRegisterContractResult> | Result<AztecRegisterContractClassResult> | Result<AztecProveTxResult> | Result<AztecGetNodeInfoResult> | Result<AztecGetPXEInfoResult> | Result<AztecGetCurrentBaseFeesResult> | Result<AztecUpdateContractResult> | Result<AztecRegisterSenderResult> | Result<AztecGetSendersResult> | Result<AztecRemoveSenderResult> | Result<AztecGetTxReceiptResult> | Result<AztecGetPrivateEventsResult> | Result<AztecGetPublicEventsResult> | Result<AztecGetCompleteAddressResult> | Result<AztecGetAddressResult> | Result<AztecGetChainIdResult> | Result<AztecGetVersionResult> | Result<AztecCreateTxExecutionRequestResult> | Result<AztecCreateAuthWitResult>;
10
10
  /** A request to get complete address of the specified account */
11
11
  export type GetCompleteAddressOperation = {
12
12
  /** Operation kind */
@@ -137,3 +137,345 @@ export type SimulateViewsResult = {
137
137
  /** List of results, decoded with function return types ABI (AbiDecoded[]) */
138
138
  decoded: unknown[];
139
139
  };
140
+ /** Aztec.js Wallet request */
141
+ export type AztecSimulateTxOperation = {
142
+ /** Operation kind */
143
+ kind: "aztec_simulateTx";
144
+ /** Chain to execute PXE request for */
145
+ chain: CaipChain;
146
+ /** An authenticated tx request ready for simulation (TxExecutionRequest) */
147
+ txRequest: unknown;
148
+ /** Whether to simulate the public part of the transaction */
149
+ simulatePublic: boolean;
150
+ /** (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state */
151
+ skipTxValidation?: boolean;
152
+ /** (Optional) If false, fees are enforced */
153
+ skipFeeEnforcement?: boolean;
154
+ /** (Optional) State overrides for the simulation, such as msgSender, contract instances and artifacts (SimulationOverrides) */
155
+ overrides?: unknown;
156
+ /** (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all (AztecAddress[]) */
157
+ scopes?: unknown[];
158
+ };
159
+ /** A result of the "aztec_simulateTx" operation (TxSimulationResult) */
160
+ export type AztecSimulateTxResult = unknown;
161
+ /** Aztec.js Wallet request */
162
+ export type AztecSimulateUtilityOperation = {
163
+ /** Operation kind */
164
+ kind: "aztec_simulateUtility";
165
+ /** Chain to execute PXE request for */
166
+ chain: CaipChain;
167
+ /** The name of the utility contract function to be called */
168
+ functionName: string;
169
+ /** The arguments to be provided to the function */
170
+ args: any[];
171
+ /** The address of the contract to be called (AztecAddress) */
172
+ to: unknown;
173
+ /** (Optional) The authentication witnesses required for the function call (AuthWitness[]) */
174
+ authwits?: unknown[];
175
+ /** (Optional) The msg sender to set for the call (AztecAddress) */
176
+ from?: unknown;
177
+ /** (Optional) The accounts whose notes we can access in this call. Currently optional and will default to all (AztecAddress[]) */
178
+ scopes?: unknown[];
179
+ };
180
+ /** A result of the "aztec_simulateUtility" operation (UtilitySimulationResult) */
181
+ export type AztecSimulateUtilityResult = unknown;
182
+ /** Aztec.js Wallet request */
183
+ export type AztecProfileTxOperation = {
184
+ /** Operation kind */
185
+ kind: "aztec_profileTx";
186
+ /** Chain to execute PXE request for */
187
+ chain: CaipChain;
188
+ /** An authenticated tx request ready for simulation (TxExecutionRequest) */
189
+ txRequest: unknown;
190
+ /** Profile mode */
191
+ profileMode: "gates" | "execution-steps" | "full";
192
+ /** (Optional) The message sender to use for the simulation */
193
+ skipProofGeneration?: boolean;
194
+ /** (Optional) If false, this function throws if the transaction is unable to be included in a block at the current state (AztecAddress) */
195
+ msgSender?: unknown;
196
+ };
197
+ /** A result of the "aztec_profileTx" operation (TxProfileResult) */
198
+ export type AztecProfileTxResult = unknown;
199
+ /** Aztec.js Wallet request */
200
+ export type AztecSendTxOperation = {
201
+ /** Operation kind */
202
+ kind: "aztec_sendTx";
203
+ /** Chain to execute PXE request for */
204
+ chain: CaipChain;
205
+ /** The transaction as created via `proveTx` (Tx) */
206
+ tx: unknown;
207
+ };
208
+ /** A result of the "aztec_sendTx" operation (TxHash) */
209
+ export type AztecSendTxResult = unknown;
210
+ /** Aztec.js Wallet request */
211
+ export type AztecGetContractClassMetadataOperation = {
212
+ /** Operation kind */
213
+ kind: "aztec_getContractClassMetadata";
214
+ /** Chain to execute PXE request for */
215
+ chain: CaipChain;
216
+ /** Identifier of the class (Fr) */
217
+ id: unknown;
218
+ /** Whether or not to also return contract artifact */
219
+ includeArtifact?: boolean;
220
+ };
221
+ /** A result of the "aztec_getContractClassMetadata" operation (ContractClassMetadata) */
222
+ export type AztecGetContractClassMetadataResult = unknown;
223
+ /** Aztec.js Wallet request */
224
+ export type AztecGetContractMetadataOperation = {
225
+ /** Operation kind */
226
+ kind: "aztec_getContractMetadata";
227
+ /** Chain to execute PXE request for */
228
+ chain: CaipChain;
229
+ /** The address that the contract instance resides at (AztecAddress) */
230
+ address: unknown;
231
+ };
232
+ /** A result of the "aztec_getContractMetadata" operation (ContractMetadata) */
233
+ export type AztecGetContractMetadataResult = unknown;
234
+ /** Aztec.js Wallet request */
235
+ export type AztecRegisterContractOperation = {
236
+ /** Operation kind */
237
+ kind: "aztec_registerContract";
238
+ /** Chain to execute PXE request for */
239
+ chain: CaipChain;
240
+ /** A contract instance to register, with an optional artifact which can be omitted if the contract class has already been registered */
241
+ contract: {
242
+ /** Contract instance (ContractInstanceWithAddress) */
243
+ instance: unknown;
244
+ /** Contract artifact (ContractArtifact) */
245
+ artifact?: unknown;
246
+ };
247
+ };
248
+ /** A result of the "aztec_registerContract" operation */
249
+ export type AztecRegisterContractResult = void;
250
+ /** Aztec.js Wallet request */
251
+ export type AztecRegisterContractClassOperation = {
252
+ /** Operation kind */
253
+ kind: "aztec_registerContractClass";
254
+ /** Chain to execute PXE request for */
255
+ chain: CaipChain;
256
+ /** The build artifact for the contract class (ContractArtifact) */
257
+ artifact: unknown;
258
+ };
259
+ /** A result of the "aztec_registerContractClass" operation */
260
+ export type AztecRegisterContractClassResult = void;
261
+ /** Aztec.js Wallet request */
262
+ export type AztecProveTxOperation = {
263
+ /** Operation kind */
264
+ kind: "aztec_proveTx";
265
+ /** Chain to execute PXE request for */
266
+ chain: CaipChain;
267
+ /** An authenticated tx request ready for simulation (TxExecutionRequest) */
268
+ txRequest: unknown;
269
+ /** (Optional) The result of the private execution of the transaction. The txRequest will be executed if not provided (PrivateExecutionResult) */
270
+ privateExecutionResult?: unknown;
271
+ };
272
+ /** A result of the "aztec_proveTx" operation (TxProvingResult) */
273
+ export type AztecProveTxResult = unknown;
274
+ /** Aztec.js Wallet request */
275
+ export type AztecGetNodeInfoOperation = {
276
+ /** Operation kind */
277
+ kind: "aztec_getNodeInfo";
278
+ /** Chain to execute PXE request for */
279
+ chain: CaipChain;
280
+ };
281
+ /** A result of the "aztec_getNodeInfo" operation (NodeInfo) */
282
+ export type AztecGetNodeInfoResult = unknown;
283
+ /** Aztec.js Wallet request */
284
+ export type AztecGetPXEInfoOperation = {
285
+ /** Operation kind */
286
+ kind: "aztec_getPXEInfo";
287
+ /** Chain to execute PXE request for */
288
+ chain: CaipChain;
289
+ };
290
+ /** A result of the "aztec_getPXEInfo" operation (PXEInfo) */
291
+ export type AztecGetPXEInfoResult = unknown;
292
+ /** Aztec.js Wallet request */
293
+ export type AztecGetCurrentBaseFeesOperation = {
294
+ /** Operation kind */
295
+ kind: "aztec_getCurrentBaseFees";
296
+ /** Chain to execute PXE request for */
297
+ chain: CaipChain;
298
+ };
299
+ /** A result of the "aztec_getCurrentBaseFees" operation (GasFees) */
300
+ export type AztecGetCurrentBaseFeesResult = unknown;
301
+ /** Aztec.js Wallet request */
302
+ export type AztecUpdateContractOperation = {
303
+ /** Operation kind */
304
+ kind: "aztec_updateContract";
305
+ /** Chain to execute PXE request for */
306
+ chain: CaipChain;
307
+ /** The address of the contract to update (AztecAddress) */
308
+ contractAddress: unknown;
309
+ /** The updated artifact for the contract (ContractArtifact) */
310
+ artifact: unknown;
311
+ };
312
+ /** A result of the "aztec_updateContract" operation */
313
+ export type AztecUpdateContractResult = void;
314
+ /** Aztec.js Wallet request */
315
+ export type AztecRegisterSenderOperation = {
316
+ /** Operation kind */
317
+ kind: "aztec_registerSender";
318
+ /** Chain to execute PXE request for */
319
+ chain: CaipChain;
320
+ /** Address of the user to add to the address book (AztecAddress) */
321
+ address: unknown;
322
+ };
323
+ /** A result of the "aztec_registerSender" operation (AztecAddress) */
324
+ export type AztecRegisterSenderResult = unknown;
325
+ /** Aztec.js Wallet request */
326
+ export type AztecGetSendersOperation = {
327
+ /** Operation kind */
328
+ kind: "aztec_getSenders";
329
+ /** Chain to execute PXE request for */
330
+ chain: CaipChain;
331
+ };
332
+ /** A result of the "aztec_getSenders" operation (AztecAddress[]) */
333
+ export type AztecGetSendersResult = unknown;
334
+ /** Aztec.js Wallet request */
335
+ export type AztecRemoveSenderOperation = {
336
+ /** Operation kind */
337
+ kind: "aztec_removeSender";
338
+ /** Chain to execute PXE request for */
339
+ chain: CaipChain;
340
+ /** Address of the user to remove from the address book (AztecAddress) */
341
+ address: unknown;
342
+ };
343
+ /** A result of the "aztec_removeSender" operation */
344
+ export type AztecRemoveSenderResult = void;
345
+ /** Aztec.js Wallet request */
346
+ export type AztecGetTxReceiptOperation = {
347
+ /** Operation kind */
348
+ kind: "aztec_getTxReceipt";
349
+ /** Chain to execute PXE request for */
350
+ chain: CaipChain;
351
+ /** The transaction hash (TxHash) */
352
+ txHash: unknown;
353
+ };
354
+ /** A result of the "aztec_getTxReceipt" operation (TxReceipt) */
355
+ export type AztecGetTxReceiptResult = unknown;
356
+ /** Aztec.js Wallet request */
357
+ export type AztecGetPrivateEventsOperation = {
358
+ /** Operation kind */
359
+ kind: "aztec_getPrivateEvents";
360
+ /** Chain to execute PXE request for */
361
+ chain: CaipChain;
362
+ /** The address of the contract to get events from (AztecAddress) */
363
+ contractAddress: unknown;
364
+ /** Metadata of the event. This should be the class generated from the contract. e.g. Contract.events.Event (EventMetadataDefinition) */
365
+ eventMetadata: unknown;
366
+ /** The block number to search from */
367
+ from: number;
368
+ /** The amount of blocks to search */
369
+ numBlocks: number;
370
+ /** The addresses that decrypted the logs (AztecAddress[]) */
371
+ recipients: unknown[];
372
+ };
373
+ /** A result of the "aztec_getPrivateEvents" operation (T[]) */
374
+ export type AztecGetPrivateEventsResult = unknown;
375
+ /** Aztec.js Wallet request */
376
+ export type AztecGetPublicEventsOperation = {
377
+ /** Operation kind */
378
+ kind: "aztec_getPublicEvents";
379
+ /** Chain to execute PXE request for */
380
+ chain: CaipChain;
381
+ /** Metadata of the event. This should be the class generated from the contract. e.g. Contract.events.Event (EventMetadataDefinition) */
382
+ eventMetadata: unknown;
383
+ /** The block number to search from */
384
+ from: number;
385
+ /** The amount of blocks to search */
386
+ limit: number;
387
+ };
388
+ /** A result of the "aztec_getPublicEvents" operation (T[]) */
389
+ export type AztecGetPublicEventsResult = unknown;
390
+ /** Aztec.js Wallet request */
391
+ export type AztecGetCompleteAddressOperation = {
392
+ /** Operation kind */
393
+ kind: "aztec_getCompleteAddress";
394
+ /** Address of the account */
395
+ account: CaipAccount;
396
+ };
397
+ /** A result of the "aztec_getCompleteAddress" operation (CompleteAddress) */
398
+ export type AztecGetCompleteAddressResult = unknown;
399
+ /** Aztec.js Wallet request */
400
+ export type AztecGetAddressOperation = {
401
+ /** Operation kind */
402
+ kind: "aztec_getAddress";
403
+ /** Address of the account ¯\_(ツ)_/¯ */
404
+ account: CaipAccount;
405
+ };
406
+ /** A result of the "aztec_getAddress" operation (AztecAddress) */
407
+ export type AztecGetAddressResult = unknown;
408
+ /** Aztec.js Wallet request */
409
+ export type AztecGetChainIdOperation = {
410
+ /** Operation kind */
411
+ kind: "aztec_getChainId";
412
+ /** Chain to execute PXE request for */
413
+ chain: CaipChain;
414
+ };
415
+ /** A result of the "aztec_getChainId" operation (Fr) */
416
+ export type AztecGetChainIdResult = unknown;
417
+ /** Aztec.js Wallet request */
418
+ export type AztecGetVersionOperation = {
419
+ /** Operation kind */
420
+ kind: "aztec_getVersion";
421
+ /** Chain to execute PXE request for */
422
+ chain: CaipChain;
423
+ };
424
+ /** A result of the "aztec_getVersion" operation (Fr) */
425
+ export type AztecGetVersionResult = unknown;
426
+ /** Aztec.js Wallet request */
427
+ export type AztecCreateTxExecutionRequestOperation = {
428
+ /** Operation kind */
429
+ kind: "aztec_createTxExecutionRequest";
430
+ /** Address of the account to create tx request for */
431
+ account: CaipAccount;
432
+ /** Execution payload (ExecutionPayload) */
433
+ exec: unknown;
434
+ /** Fee options */
435
+ fee: FeeOptionsDto;
436
+ /** Execution options (TxExecutionOptions) */
437
+ options: unknown;
438
+ };
439
+ /** Transferrable version of FeeOptions */
440
+ export type FeeOptionsDto = {
441
+ /** Fee payment method */
442
+ paymentMethod: FeePaymentMethodDto;
443
+ /** Gas settings (GasSettings) */
444
+ gasSettings: unknown;
445
+ };
446
+ /** Transferrable version of FeePaymentMethod */
447
+ export type FeePaymentMethodDto = {
448
+ /** Address of the assset contract (AztecAddress) */
449
+ asset?: unknown;
450
+ /** Execution payload (ExecutionPayload) */
451
+ executionPayload: unknown;
452
+ /** Address of the fee payer (AztecAddress) */
453
+ feePayer: unknown;
454
+ };
455
+ /** A result of the "aztec_createTxExecutionRequest" operation (TxExecutionRequest) */
456
+ export type AztecCreateTxExecutionRequestResult = unknown;
457
+ /** Aztec.js Wallet request */
458
+ export type AztecCreateAuthWitOperation = {
459
+ /** Operation kind */
460
+ kind: "aztec_createAuthWit";
461
+ /** Address of the account to create authwit for */
462
+ account: CaipAccount;
463
+ /** Intent or message hash (Fr) */
464
+ messageHashOrIntent: unknown | IntentInnerHashDto | IntentActionDto;
465
+ };
466
+ /** Transferrable version of IntentInnerHash */
467
+ export type IntentInnerHashDto = {
468
+ /** Address of the authwit consumer (AztecAddress) */
469
+ consumer: unknown;
470
+ /** Intent hash (Fr) */
471
+ innerHash: unknown;
472
+ };
473
+ /** Transferrable version of IntentAction */
474
+ export type IntentActionDto = {
475
+ /** Address of the caller (AztecAddress) */
476
+ caller: unknown;
477
+ /** Function call (FunctionCall) */
478
+ action: unknown;
479
+ };
480
+ /** A result of the "aztec_createAuthWit" operation (AuthWitness) */
481
+ 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.4.1",
3
+ "version": "0.5.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
+ }