@aztec/aztec.js 0.0.1-commit.b655e406 → 0.0.1-commit.c31f2472
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/dest/account/account.d.ts +26 -42
- package/dest/account/account.d.ts.map +1 -1
- package/dest/account/account.js +19 -47
- package/dest/account/account_contract.d.ts +9 -10
- package/dest/account/account_contract.d.ts.map +1 -1
- package/dest/account/account_with_secret_key.d.ts +20 -9
- package/dest/account/account_with_secret_key.d.ts.map +1 -1
- package/dest/account/account_with_secret_key.js +21 -4
- package/dest/account/index.d.ts +4 -3
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +2 -0
- package/dest/account/signerless_account.d.ts +7 -9
- package/dest/account/signerless_account.d.ts.map +1 -1
- package/dest/account/signerless_account.js +8 -11
- package/dest/api/abi.d.ts +1 -1
- package/dest/api/account.d.ts +3 -4
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +2 -3
- package/dest/api/addresses.d.ts +1 -1
- package/dest/api/authorization.d.ts +2 -2
- package/dest/api/authorization.d.ts.map +1 -1
- package/dest/api/authorization.js +1 -1
- package/dest/api/block.d.ts +1 -1
- package/dest/api/contract.d.ts +17 -11
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +15 -9
- package/dest/api/crypto.d.ts +1 -1
- package/dest/api/deployment.d.ts +1 -1
- package/dest/api/eth_address.d.ts +1 -1
- package/dest/api/ethereum.d.ts +1 -1
- package/dest/api/events.d.ts +1 -1
- package/dest/api/fee.d.ts +1 -1
- package/dest/api/fee_testing.d.ts +1 -1
- package/dest/api/fields.d.ts +3 -2
- package/dest/api/fields.d.ts.map +1 -1
- package/dest/api/fields.js +2 -1
- package/dest/api/keys.d.ts +1 -1
- package/dest/api/log.d.ts +1 -1
- package/dest/api/messaging.d.ts +1 -1
- package/dest/api/node.d.ts +8 -4
- package/dest/api/node.d.ts.map +1 -1
- package/dest/api/node.js +7 -3
- package/dest/api/note.d.ts +2 -2
- package/dest/api/note.d.ts.map +1 -1
- package/dest/api/note.js +1 -1
- package/dest/api/protocol.d.ts +7 -1
- package/dest/api/protocol.d.ts.map +1 -1
- package/dest/api/protocol.js +6 -0
- package/dest/api/trees.d.ts +1 -1
- package/dest/api/tx.d.ts +2 -2
- package/dest/api/tx.d.ts.map +1 -1
- package/dest/api/tx.js +1 -1
- package/dest/api/utils.d.ts +1 -1
- package/dest/api/wallet.d.ts +2 -3
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -2
- package/dest/authorization/call_authorization_request.d.ts +2 -2
- package/dest/authorization/call_authorization_request.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.d.ts +8 -11
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +5 -17
- package/dest/contract/batch_call.d.ts +8 -9
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +54 -34
- package/dest/contract/checker.d.ts +1 -1
- package/dest/contract/contract.d.ts +2 -2
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +4 -5
- package/dest/contract/contract_base.d.ts +6 -10
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +5 -12
- package/dest/contract/contract_function_interaction.d.ts +3 -3
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +9 -6
- package/dest/contract/deploy_method.d.ts +71 -23
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +49 -29
- package/dest/contract/get_gas_limits.d.ts +1 -1
- package/dest/contract/interaction_options.d.ts +44 -7
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +12 -11
- package/dest/contract/protocol_contracts/auth-registry.d.ts +36 -0
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/auth-registry.js +963 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +35 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-class-registry.js +784 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +31 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.js +866 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts +30 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/fee-juice.js +827 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/multi-call-entrypoint.js +563 -0
- package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
- package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/public-checks.js +579 -0
- package/dest/contract/wait_for_proven.d.ts +2 -2
- package/dest/contract/wait_for_proven.d.ts.map +1 -1
- package/dest/contract/wait_for_proven.js +1 -1
- package/dest/contract/wait_opts.d.ts +16 -0
- package/dest/contract/wait_opts.d.ts.map +1 -0
- package/dest/contract/wait_opts.js +5 -0
- package/dest/deployment/broadcast_function.d.ts +1 -1
- package/dest/deployment/broadcast_function.js +4 -4
- package/dest/deployment/contract_deployer.d.ts +1 -1
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/contract_deployer.js +1 -1
- package/dest/deployment/publish_class.d.ts +1 -1
- package/dest/deployment/publish_class.js +3 -3
- package/dest/deployment/publish_instance.d.ts +2 -2
- package/dest/deployment/publish_instance.d.ts.map +1 -1
- package/dest/deployment/publish_instance.js +3 -3
- package/dest/ethereum/portal_manager.d.ts +7 -6
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +48 -22
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +2 -2
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +3 -3
- package/dest/fee/fee_payment_method.d.ts +2 -2
- package/dest/fee/fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.d.ts +2 -2
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +4 -4
- package/dest/fee/public_fee_payment_method.d.ts +2 -2
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +4 -4
- package/dest/fee/sponsored_fee_payment.d.ts +2 -2
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
- package/dest/fee/sponsored_fee_payment.js +2 -2
- package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
- package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
- package/dest/scripts/generate_protocol_contract_types.js +120 -0
- package/dest/utils/abi_types.d.ts +2 -2
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/authwit.d.ts +14 -12
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +27 -20
- package/dest/utils/cross_chain.d.ts +2 -2
- package/dest/utils/cross_chain.d.ts.map +1 -1
- package/dest/utils/fee_juice.d.ts +2 -2
- package/dest/utils/fee_juice.js +2 -2
- package/dest/utils/field_compressed_string.d.ts +1 -1
- package/dest/utils/field_compressed_string.d.ts.map +1 -1
- package/dest/utils/field_compressed_string.js +1 -1
- package/dest/utils/node.d.ts +13 -2
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +46 -0
- package/dest/utils/pub_key.d.ts +2 -2
- package/dest/utils/pub_key.d.ts.map +1 -1
- package/dest/utils/pub_key.js +1 -1
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +6 -9
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
- package/dest/wallet/account_entrypoint_meta_payment_method.js +29 -44
- package/dest/wallet/account_manager.d.ts +3 -9
- package/dest/wallet/account_manager.d.ts.map +1 -1
- package/dest/wallet/account_manager.js +6 -12
- package/dest/wallet/deploy_account_method.d.ts +37 -9
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.js +9 -7
- package/dest/wallet/index.d.ts +1 -2
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +0 -1
- package/dest/wallet/wallet.d.ts +323 -1504
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +85 -115
- package/package.json +16 -13
- package/src/account/account.ts +35 -60
- package/src/account/account_contract.ts +7 -8
- package/src/account/account_with_secret_key.ts +34 -9
- package/src/account/index.ts +3 -2
- package/src/account/signerless_account.ts +15 -15
- package/src/api/account.ts +10 -3
- package/src/api/authorization.ts +1 -0
- package/src/api/contract.ts +24 -8
- package/src/api/fields.ts +2 -1
- package/src/api/node.ts +7 -3
- package/src/api/note.ts +1 -1
- package/src/api/protocol.ts +7 -0
- package/src/api/tx.ts +4 -0
- package/src/api/wallet.ts +10 -9
- package/src/authorization/call_authorization_request.ts +1 -1
- package/src/contract/base_contract_interaction.ts +27 -16
- package/src/contract/batch_call.ts +67 -48
- package/src/contract/contract.ts +7 -5
- package/src/contract/contract_base.ts +5 -15
- package/src/contract/contract_function_interaction.ts +10 -11
- package/src/contract/deploy_method.ts +134 -40
- package/src/contract/interaction_options.ts +52 -13
- package/src/contract/protocol_contracts/auth-registry.ts +545 -0
- package/src/contract/protocol_contracts/contract-class-registry.ts +433 -0
- package/src/contract/protocol_contracts/contract-instance-registry.ts +495 -0
- package/src/contract/protocol_contracts/fee-juice.ts +457 -0
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +329 -0
- package/src/contract/protocol_contracts/public-checks.ts +315 -0
- package/src/contract/wait_for_proven.ts +1 -1
- package/src/contract/wait_opts.ts +21 -0
- package/src/deployment/broadcast_function.ts +4 -4
- package/src/deployment/contract_deployer.ts +3 -2
- package/src/deployment/publish_class.ts +3 -3
- package/src/deployment/publish_instance.ts +3 -6
- package/src/ethereum/portal_manager.ts +65 -34
- package/src/fee/fee_juice_payment_method_with_claim.ts +4 -2
- package/src/fee/fee_payment_method.ts +1 -1
- package/src/fee/private_fee_payment_method.ts +5 -3
- package/src/fee/public_fee_payment_method.ts +5 -3
- package/src/fee/sponsored_fee_payment.ts +3 -1
- package/src/scripts/generate_protocol_contract_types.ts +150 -0
- package/src/utils/abi_types.ts +1 -1
- package/src/utils/authwit.ts +40 -22
- package/src/utils/cross_chain.ts +1 -1
- package/src/utils/fee_juice.ts +2 -2
- package/src/utils/field_compressed_string.ts +1 -1
- package/src/utils/node.ts +62 -0
- package/src/utils/pub_key.ts +2 -2
- package/src/wallet/account_entrypoint_meta_payment_method.ts +29 -60
- package/src/wallet/account_manager.ts +7 -15
- package/src/wallet/deploy_account_method.ts +41 -16
- package/src/wallet/index.ts +0 -1
- package/src/wallet/wallet.ts +207 -152
- package/dest/account/interface.d.ts +0 -19
- package/dest/account/interface.d.ts.map +0 -1
- package/dest/account/interface.js +0 -5
- package/dest/contract/deploy_sent_tx.d.ts +0 -43
- package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
- package/dest/contract/deploy_sent_tx.js +0 -40
- package/dest/contract/protocol_contracts.d.ts +0 -9
- package/dest/contract/protocol_contracts.d.ts.map +0 -1
- package/dest/contract/protocol_contracts.js +0 -26
- package/dest/contract/sent_tx.d.ts +0 -51
- package/dest/contract/sent_tx.d.ts.map +0 -1
- package/dest/contract/sent_tx.js +0 -90
- package/dest/contract/unsafe_contract.d.ts +0 -15
- package/dest/contract/unsafe_contract.d.ts.map +0 -1
- package/dest/contract/unsafe_contract.js +0 -6
- package/dest/wallet/base_wallet.d.ts +0 -91
- package/dest/wallet/base_wallet.d.ts.map +0 -1
- package/dest/wallet/base_wallet.js +0 -238
- package/src/account/interface.ts +0 -25
- package/src/contract/deploy_sent_tx.ts +0 -68
- package/src/contract/protocol_contracts.ts +0 -35
- package/src/contract/sent_tx.ts +0 -130
- package/src/contract/unsafe_contract.ts +0 -19
- package/src/wallet/base_wallet.ts +0 -350
package/src/wallet/wallet.ts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
2
|
-
import
|
|
3
|
-
import type { Fr } from '@aztec/foundation/
|
|
2
|
+
import { BlockNumber, BlockNumberPositiveSchema } from '@aztec/foundation/branded-types';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import {
|
|
5
|
+
type AbiDecoded,
|
|
5
6
|
AbiTypeSchema,
|
|
6
7
|
type ContractArtifact,
|
|
7
8
|
ContractArtifactSchema,
|
|
8
9
|
type EventMetadataDefinition,
|
|
9
|
-
|
|
10
|
+
type FunctionCall,
|
|
10
11
|
FunctionType,
|
|
11
12
|
} from '@aztec/stdlib/abi';
|
|
12
13
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
13
14
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
14
|
-
import {
|
|
15
|
-
type ContractClassMetadata,
|
|
16
|
-
ContractClassWithIdSchema,
|
|
17
|
-
type ContractInstanceWithAddress,
|
|
18
|
-
ContractInstanceWithAddressSchema,
|
|
19
|
-
type ContractInstantiationData,
|
|
20
|
-
type ContractMetadata,
|
|
21
|
-
} from '@aztec/stdlib/contract';
|
|
15
|
+
import { type ContractInstanceWithAddress, ContractInstanceWithAddressSchema } from '@aztec/stdlib/contract';
|
|
22
16
|
import { Gas } from '@aztec/stdlib/gas';
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
17
|
+
import { AbiDecodedSchema, type ApiSchemaFor, optional, schemas, zodFor } from '@aztec/stdlib/schemas';
|
|
18
|
+
import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
|
|
25
19
|
import {
|
|
26
20
|
Capsule,
|
|
27
21
|
HashedValues,
|
|
@@ -30,17 +24,20 @@ import {
|
|
|
30
24
|
TxReceipt,
|
|
31
25
|
TxSimulationResult,
|
|
32
26
|
UtilitySimulationResult,
|
|
27
|
+
inTxSchema,
|
|
33
28
|
} from '@aztec/stdlib/tx';
|
|
34
29
|
|
|
35
30
|
import { z } from 'zod';
|
|
36
31
|
|
|
37
|
-
import
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
import {
|
|
33
|
+
type FeeEstimationOptions,
|
|
34
|
+
type GasSettingsOption,
|
|
35
|
+
type InteractionWaitOptions,
|
|
36
|
+
NO_WAIT,
|
|
37
|
+
type ProfileInteractionOptions,
|
|
38
|
+
type SendInteractionOptionsWithoutWait,
|
|
39
|
+
type SendReturn,
|
|
40
|
+
type SimulateInteractionOptions,
|
|
44
41
|
} from '../contract/interaction_options.js';
|
|
45
42
|
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
46
43
|
|
|
@@ -58,80 +55,76 @@ export type Aliased<T> = {
|
|
|
58
55
|
item: T;
|
|
59
56
|
};
|
|
60
57
|
|
|
61
|
-
/**
|
|
62
|
-
* A reduced representation of a Contract, only including its instance and artifact
|
|
63
|
-
*/
|
|
64
|
-
export type ContractInstanceAndArtifact = Pick<Contract, 'artifact' | 'instance'>;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Options that can be provided to the wallet for configuration of the fee payment.
|
|
68
|
-
*/
|
|
69
|
-
export type UserFeeOptions = {
|
|
70
|
-
/**
|
|
71
|
-
* Informs the wallet that the crafted tx already contains the necessary calls to pay for its fee
|
|
72
|
-
* and who is paying
|
|
73
|
-
*/
|
|
74
|
-
embeddedPaymentMethodFeePayer?: AztecAddress;
|
|
75
|
-
} & GasSettingsOption;
|
|
76
|
-
|
|
77
58
|
/**
|
|
78
59
|
* Options for simulating interactions with the wallet. Overrides the fee settings of an interaction with
|
|
79
|
-
* a simplified version that only hints at the wallet
|
|
60
|
+
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
80
61
|
* fee payment method or not
|
|
81
62
|
*/
|
|
82
63
|
export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
|
|
83
64
|
/** The fee options */
|
|
84
|
-
fee?:
|
|
65
|
+
fee?: GasSettingsOption & FeeEstimationOptions;
|
|
85
66
|
};
|
|
86
67
|
|
|
87
68
|
/**
|
|
88
69
|
* Options for profiling interactions with the wallet. Overrides the fee settings of an interaction with
|
|
89
|
-
* a simplified version that only hints at the wallet
|
|
70
|
+
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
90
71
|
* fee payment method or not
|
|
91
72
|
*/
|
|
92
73
|
export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
|
|
93
74
|
/** The fee options */
|
|
94
|
-
fee?:
|
|
75
|
+
fee?: GasSettingsOption;
|
|
95
76
|
};
|
|
96
77
|
|
|
97
78
|
/**
|
|
98
79
|
* Options for sending/proving interactions with the wallet. Overrides the fee settings of an interaction with
|
|
99
|
-
* a simplified version that only hints at the wallet
|
|
80
|
+
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
100
81
|
* fee payment method or not
|
|
101
82
|
*/
|
|
102
|
-
export type SendOptions =
|
|
83
|
+
export type SendOptions<W extends InteractionWaitOptions = undefined> = Omit<
|
|
84
|
+
SendInteractionOptionsWithoutWait,
|
|
85
|
+
'fee'
|
|
86
|
+
> & {
|
|
103
87
|
/** The fee options */
|
|
104
|
-
fee?:
|
|
88
|
+
fee?: GasSettingsOption;
|
|
89
|
+
/** Whether to wait for the transaction to be mined */
|
|
90
|
+
wait?: W;
|
|
105
91
|
};
|
|
106
92
|
|
|
107
93
|
/**
|
|
108
|
-
* Helper type that represents all methods that can be batched.
|
|
94
|
+
* Helper type that represents all methods that can be batched (all methods except batch itself).
|
|
109
95
|
*/
|
|
110
|
-
export type BatchableMethods =
|
|
96
|
+
export type BatchableMethods = Omit<Wallet, 'batch'>;
|
|
111
97
|
|
|
112
98
|
/**
|
|
113
|
-
*
|
|
114
|
-
* This is what the wallet will accept as arguments to the `batch` method.
|
|
99
|
+
* A method call with its name and arguments.
|
|
115
100
|
*/
|
|
116
|
-
|
|
101
|
+
type BatchedMethodInternal<T extends keyof BatchableMethods> = {
|
|
117
102
|
/** The method name */
|
|
118
103
|
name: T;
|
|
119
104
|
/** The method arguments */
|
|
120
105
|
args: Parameters<BatchableMethods[T]>;
|
|
121
106
|
};
|
|
122
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Union of all possible batched method calls.
|
|
110
|
+
* This ensures type safety: the `args` must match the specific `name`.
|
|
111
|
+
*/
|
|
112
|
+
export type BatchedMethod = {
|
|
113
|
+
[K in keyof BatchableMethods]: BatchedMethodInternal<K>;
|
|
114
|
+
}[keyof BatchableMethods];
|
|
115
|
+
|
|
123
116
|
/**
|
|
124
117
|
* Helper type to extract the return type of a batched method
|
|
125
118
|
*/
|
|
126
119
|
export type BatchedMethodResult<T> =
|
|
127
|
-
T extends
|
|
120
|
+
T extends BatchedMethodInternal<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
|
|
128
121
|
|
|
129
122
|
/**
|
|
130
123
|
* Wrapper type for batch results that includes the method name for discriminated union deserialization.
|
|
131
124
|
* Each result is wrapped as \{ name: 'methodName', result: ActualResult \} to allow proper deserialization
|
|
132
125
|
* when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).
|
|
133
126
|
*/
|
|
134
|
-
export type BatchedMethodResultWrapper<T extends BatchedMethod
|
|
127
|
+
export type BatchedMethodResultWrapper<T extends BatchedMethod> = {
|
|
135
128
|
/** The method name */
|
|
136
129
|
name: T['name'];
|
|
137
130
|
/** The method result */
|
|
@@ -141,66 +134,98 @@ export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMe
|
|
|
141
134
|
/**
|
|
142
135
|
* Maps a tuple of BatchedMethod to a tuple of their wrapped return types
|
|
143
136
|
*/
|
|
144
|
-
export type BatchResults<T extends readonly BatchedMethod
|
|
137
|
+
export type BatchResults<T extends readonly BatchedMethod[]> = {
|
|
145
138
|
[K in keyof T]: BatchedMethodResultWrapper<T[K]>;
|
|
146
139
|
};
|
|
147
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Filter options when querying private events.
|
|
143
|
+
*/
|
|
144
|
+
export type PrivateEventFilter = {
|
|
145
|
+
/** The address of the contract that emitted the events. */
|
|
146
|
+
contractAddress: AztecAddress;
|
|
147
|
+
/** Addresses of accounts that are in scope for this filter. */
|
|
148
|
+
scopes: AztecAddress[];
|
|
149
|
+
/** Transaction in which the events were emitted. */
|
|
150
|
+
txHash?: TxHash;
|
|
151
|
+
/** The block number from which to start fetching events (inclusive).
|
|
152
|
+
* Optional. If provided, it must be greater or equal than 1.
|
|
153
|
+
* Defaults to the initial L2 block number (INITIAL_L2_BLOCK_NUM).
|
|
154
|
+
* */
|
|
155
|
+
fromBlock?: BlockNumber;
|
|
156
|
+
/** The block number until which to fetch logs (not inclusive).
|
|
157
|
+
* Optional. If provided, it must be greater than fromBlock.
|
|
158
|
+
* Defaults to the latest known block to PXE + 1.
|
|
159
|
+
*/
|
|
160
|
+
toBlock?: BlockNumber;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* An ABI decoded private event with associated metadata.
|
|
165
|
+
*/
|
|
166
|
+
export type PrivateEvent<T> = {
|
|
167
|
+
/** The ABI decoded event */
|
|
168
|
+
event: T;
|
|
169
|
+
/** Metadata describing event context information such as tx and block */
|
|
170
|
+
metadata: InTx;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Contract metadata including deployment and registration status.
|
|
175
|
+
*/
|
|
176
|
+
export type ContractMetadata = {
|
|
177
|
+
/** The contract instance */
|
|
178
|
+
instance?: ContractInstanceWithAddress;
|
|
179
|
+
/** Whether the contract has been initialized (init nullifier exists) */
|
|
180
|
+
isContractInitialized: boolean;
|
|
181
|
+
/** Whether the contract instance is publicly deployed on-chain */
|
|
182
|
+
isContractPublished: boolean;
|
|
183
|
+
/** Whether the contract has been updated to a different class */
|
|
184
|
+
isContractUpdated: boolean;
|
|
185
|
+
/** The updated contract class ID if the contract has been updated */
|
|
186
|
+
updatedContractClassId?: Fr | undefined;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Contract class metadata.
|
|
191
|
+
*/
|
|
192
|
+
export type ContractClassMetadata = {
|
|
193
|
+
/** Whether the artifact is registered in the wallet */
|
|
194
|
+
isArtifactRegistered: boolean;
|
|
195
|
+
/** Whether the contract class is publicly registered on-chain */
|
|
196
|
+
isContractClassPubliclyRegistered: boolean;
|
|
197
|
+
};
|
|
198
|
+
|
|
148
199
|
/**
|
|
149
200
|
* The wallet interface.
|
|
150
201
|
*/
|
|
151
202
|
export type Wallet = {
|
|
152
|
-
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
|
|
153
|
-
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
154
203
|
getPrivateEvents<T>(
|
|
155
|
-
contractAddress: AztecAddress,
|
|
156
204
|
eventMetadata: EventMetadataDefinition,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
recipients: AztecAddress[],
|
|
160
|
-
): Promise<T[]>;
|
|
205
|
+
eventFilter: PrivateEventFilter,
|
|
206
|
+
): Promise<PrivateEvent<T>[]>;
|
|
161
207
|
getChainInfo(): Promise<ChainInfo>;
|
|
162
|
-
|
|
208
|
+
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
209
|
+
getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
|
|
163
210
|
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
|
|
164
211
|
getAddressBook(): Promise<Aliased<AztecAddress>[]>;
|
|
165
212
|
getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
166
213
|
registerContract(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
registerContract(
|
|
171
|
-
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
|
|
172
|
-
artifact: ContractArtifact,
|
|
173
|
-
): Promise<ContractInstanceWithAddress>;
|
|
174
|
-
registerContract(
|
|
175
|
-
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
|
|
176
|
-
artifact: ContractArtifact | undefined,
|
|
177
|
-
secretKey: Fr | undefined,
|
|
214
|
+
instance: ContractInstanceWithAddress,
|
|
215
|
+
artifact?: ContractArtifact,
|
|
216
|
+
secretKey?: Fr,
|
|
178
217
|
): Promise<ContractInstanceWithAddress>;
|
|
179
218
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
180
|
-
simulateUtility(
|
|
181
|
-
functionName: string,
|
|
182
|
-
args: any[],
|
|
183
|
-
to: AztecAddress,
|
|
184
|
-
authwits?: AuthWitness[],
|
|
185
|
-
): Promise<UtilitySimulationResult>;
|
|
219
|
+
simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
|
|
186
220
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
187
|
-
sendTx
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
): Promise<AuthWitness>;
|
|
192
|
-
batch<const T extends readonly BatchedMethod
|
|
221
|
+
sendTx<W extends InteractionWaitOptions = undefined>(
|
|
222
|
+
exec: ExecutionPayload,
|
|
223
|
+
opts: SendOptions<W>,
|
|
224
|
+
): Promise<SendReturn<W>>;
|
|
225
|
+
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
|
|
226
|
+
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
|
|
193
227
|
};
|
|
194
228
|
|
|
195
|
-
export const ContractInstantiationDataSchema = z.object({
|
|
196
|
-
constructorArtifact: optional(z.union([FunctionAbiSchema, z.string()])),
|
|
197
|
-
constructorArgs: optional(z.array(z.any())),
|
|
198
|
-
skipArgsDecoding: optional(z.boolean()),
|
|
199
|
-
salt: schemas.Fr,
|
|
200
|
-
publicKeys: optional(PublicKeys.schema),
|
|
201
|
-
deployer: optional(schemas.AztecAddress),
|
|
202
|
-
});
|
|
203
|
-
|
|
204
229
|
export const FunctionCallSchema = z.object({
|
|
205
230
|
name: z.string(),
|
|
206
231
|
to: schemas.AztecAddress,
|
|
@@ -217,9 +242,10 @@ export const ExecutionPayloadSchema = z.object({
|
|
|
217
242
|
authWitnesses: z.array(AuthWitness.schema),
|
|
218
243
|
capsules: z.array(Capsule.schema),
|
|
219
244
|
extraHashedArgs: z.array(HashedValues.schema),
|
|
245
|
+
feePayer: optional(schemas.AztecAddress),
|
|
220
246
|
});
|
|
221
247
|
|
|
222
|
-
export const
|
|
248
|
+
export const GasSettingsOptionSchema = z.object({
|
|
223
249
|
gasSettings: optional(
|
|
224
250
|
z.object({
|
|
225
251
|
gasLimits: optional(Gas.schema),
|
|
@@ -228,19 +254,26 @@ export const UserFeeOptionsSchema = z.object({
|
|
|
228
254
|
maxPriorityFeePerGas: optional(z.object({ feePerDaGas: schemas.BigInt, feePerL2Gas: schemas.BigInt })),
|
|
229
255
|
}),
|
|
230
256
|
),
|
|
231
|
-
embeddedPaymentMethodFeePayer: optional(schemas.AztecAddress),
|
|
232
257
|
});
|
|
233
258
|
|
|
234
|
-
export const WalletSimulationFeeOptionSchema =
|
|
259
|
+
export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
|
|
235
260
|
estimatedGasPadding: optional(z.number()),
|
|
236
261
|
estimateGas: optional(z.boolean()),
|
|
237
262
|
});
|
|
238
263
|
|
|
264
|
+
export const WaitOptsSchema = z.object({
|
|
265
|
+
ignoreDroppedReceiptsFor: optional(z.number()),
|
|
266
|
+
timeout: optional(z.number()),
|
|
267
|
+
interval: optional(z.number()),
|
|
268
|
+
dontThrowOnRevert: optional(z.boolean()),
|
|
269
|
+
});
|
|
270
|
+
|
|
239
271
|
export const SendOptionsSchema = z.object({
|
|
240
272
|
from: schemas.AztecAddress,
|
|
241
273
|
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
242
274
|
capsules: optional(z.array(Capsule.schema)),
|
|
243
|
-
fee: optional(
|
|
275
|
+
fee: optional(GasSettingsOptionSchema),
|
|
276
|
+
wait: optional(z.union([z.literal(NO_WAIT), WaitOptsSchema])),
|
|
244
277
|
});
|
|
245
278
|
|
|
246
279
|
export const SimulateOptionsSchema = z.object({
|
|
@@ -258,72 +291,63 @@ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
|
258
291
|
skipProofGeneration: optional(z.boolean()),
|
|
259
292
|
});
|
|
260
293
|
|
|
261
|
-
export const InstanceDataSchema = z.union([
|
|
262
|
-
schemas.AztecAddress,
|
|
263
|
-
ContractInstanceWithAddressSchema,
|
|
264
|
-
ContractInstantiationDataSchema,
|
|
265
|
-
z.object({ instance: ContractInstanceWithAddressSchema, artifact: ContractArtifactSchema }),
|
|
266
|
-
]);
|
|
267
|
-
|
|
268
294
|
export const MessageHashOrIntentSchema = z.union([
|
|
269
|
-
schemas.Fr,
|
|
270
|
-
schemas.Buffer,
|
|
271
|
-
z.object({ consumer: schemas.AztecAddress, innerHash: z.union([schemas.Buffer, schemas.Fr]) }),
|
|
295
|
+
z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
|
|
272
296
|
z.object({
|
|
273
297
|
caller: schemas.AztecAddress,
|
|
274
298
|
call: FunctionCallSchema,
|
|
275
299
|
}),
|
|
276
300
|
]);
|
|
277
301
|
|
|
278
|
-
export const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
args: z.tuple([InstanceDataSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
|
|
286
|
-
}),
|
|
287
|
-
z.object({
|
|
288
|
-
name: z.literal('sendTx'),
|
|
289
|
-
args: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]),
|
|
290
|
-
}),
|
|
302
|
+
export const EventMetadataDefinitionSchema = z.object({
|
|
303
|
+
eventSelector: schemas.EventSelector,
|
|
304
|
+
abiType: AbiTypeSchema,
|
|
305
|
+
fieldNames: z.array(z.string()),
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
export const PrivateEventSchema: z.ZodType<any> = zodFor<PrivateEvent<AbiDecoded>>()(
|
|
291
309
|
z.object({
|
|
292
|
-
|
|
293
|
-
|
|
310
|
+
event: AbiDecodedSchema,
|
|
311
|
+
metadata: inTxSchema(),
|
|
294
312
|
}),
|
|
295
|
-
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
export const PrivateEventFilterSchema = z.object({
|
|
316
|
+
contractAddress: schemas.AztecAddress,
|
|
317
|
+
scopes: z.array(schemas.AztecAddress),
|
|
318
|
+
txHash: optional(TxHash.schema),
|
|
319
|
+
fromBlock: optional(BlockNumberPositiveSchema),
|
|
320
|
+
toBlock: optional(BlockNumberPositiveSchema),
|
|
321
|
+
});
|
|
296
322
|
|
|
297
323
|
export const ContractMetadataSchema = z.object({
|
|
298
|
-
|
|
324
|
+
instance: optional(ContractInstanceWithAddressSchema),
|
|
299
325
|
isContractInitialized: z.boolean(),
|
|
300
326
|
isContractPublished: z.boolean(),
|
|
301
|
-
|
|
327
|
+
isContractUpdated: z.boolean(),
|
|
328
|
+
updatedContractClassId: optional(schemas.Fr),
|
|
329
|
+
});
|
|
302
330
|
|
|
303
331
|
export const ContractClassMetadataSchema = z.object({
|
|
304
|
-
|
|
332
|
+
isArtifactRegistered: z.boolean(),
|
|
305
333
|
isContractClassPubliclyRegistered: z.boolean(),
|
|
306
|
-
artifact: z.union([ContractArtifactSchema, z.undefined()]),
|
|
307
|
-
}) satisfies ZodFor<ContractClassMetadata>;
|
|
308
|
-
|
|
309
|
-
export const EventMetadataDefinitionSchema = z.object({
|
|
310
|
-
eventSelector: schemas.EventSelector,
|
|
311
|
-
abiType: AbiTypeSchema,
|
|
312
|
-
fieldNames: z.array(z.string()),
|
|
313
334
|
});
|
|
314
335
|
|
|
315
|
-
|
|
336
|
+
/**
|
|
337
|
+
* Record of all wallet method schemas (excluding batch).
|
|
338
|
+
* This is the single source of truth for method schemas - batch schemas are derived from this.
|
|
339
|
+
*/
|
|
340
|
+
const WalletMethodSchemas = {
|
|
316
341
|
getChainInfo: z
|
|
317
342
|
.function()
|
|
318
343
|
.args()
|
|
319
344
|
.returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
|
|
320
|
-
getContractClassMetadata: z.function().args(schemas.Fr, optional(z.boolean())).returns(ContractClassMetadataSchema),
|
|
321
345
|
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
322
|
-
|
|
346
|
+
getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
|
|
323
347
|
getPrivateEvents: z
|
|
324
348
|
.function()
|
|
325
|
-
.args(
|
|
326
|
-
.returns(z.array(
|
|
349
|
+
.args(EventMetadataDefinitionSchema, PrivateEventFilterSchema)
|
|
350
|
+
.returns(z.array(PrivateEventSchema)),
|
|
327
351
|
registerSender: z.function().args(schemas.AztecAddress, optional(z.string())).returns(schemas.AztecAddress),
|
|
328
352
|
getAddressBook: z
|
|
329
353
|
.function()
|
|
@@ -335,28 +359,59 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
|
|
|
335
359
|
.returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
|
|
336
360
|
registerContract: z
|
|
337
361
|
.function()
|
|
338
|
-
.args(
|
|
362
|
+
.args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
|
|
339
363
|
.returns(ContractInstanceWithAddressSchema),
|
|
340
364
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
341
365
|
simulateUtility: z
|
|
342
366
|
.function()
|
|
343
|
-
.args(
|
|
367
|
+
.args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
|
|
344
368
|
.returns(UtilitySimulationResult.schema),
|
|
345
369
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
346
|
-
sendTx: z
|
|
370
|
+
sendTx: z
|
|
371
|
+
.function()
|
|
372
|
+
.args(ExecutionPayloadSchema, SendOptionsSchema)
|
|
373
|
+
.returns(z.union([TxHash.schema, TxReceipt.schema])),
|
|
347
374
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Creates batch schemas from the individual wallet methods.
|
|
379
|
+
* This allows us to define them once and derive batch schemas automatically,
|
|
380
|
+
* reducing duplication and ensuring consistency.
|
|
381
|
+
*/
|
|
382
|
+
function createBatchSchemas<T extends Record<string, z.ZodFunction<z.ZodTuple<any, any>, z.ZodTypeAny>>>(
|
|
383
|
+
methodSchemas: T,
|
|
384
|
+
) {
|
|
385
|
+
const names = Object.keys(methodSchemas) as (keyof T)[];
|
|
386
|
+
|
|
387
|
+
const namesAndArgs = names.map(name =>
|
|
388
|
+
z.object({
|
|
389
|
+
name: z.literal(name),
|
|
390
|
+
args: methodSchemas[name].parameters(),
|
|
391
|
+
}),
|
|
392
|
+
);
|
|
393
|
+
|
|
394
|
+
const namesAndReturns = names.map(name =>
|
|
395
|
+
z.object({
|
|
396
|
+
name: z.literal(name),
|
|
397
|
+
result: methodSchemas[name].returnType(),
|
|
398
|
+
}),
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
// Type assertion needed because discriminatedUnion expects a tuple type [T, T, ...T[]]
|
|
402
|
+
// but we're building the array dynamically. The runtime behavior is correct.
|
|
403
|
+
return {
|
|
404
|
+
input: z.discriminatedUnion('name', namesAndArgs as [(typeof namesAndArgs)[0], ...typeof namesAndArgs]),
|
|
405
|
+
output: z.discriminatedUnion('name', namesAndReturns as [(typeof namesAndReturns)[0], ...typeof namesAndReturns]),
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const { input: BatchedMethodSchema, output: BatchedResultSchema } = createBatchSchemas(WalletMethodSchemas);
|
|
410
|
+
|
|
411
|
+
export { BatchedMethodSchema, BatchedResultSchema };
|
|
412
|
+
|
|
413
|
+
export const WalletSchema: ApiSchemaFor<Wallet> = {
|
|
414
|
+
...WalletMethodSchemas,
|
|
348
415
|
// @ts-expect-error - ApiSchemaFor cannot properly type generic methods with readonly arrays
|
|
349
|
-
batch: z
|
|
350
|
-
.function()
|
|
351
|
-
.args(z.array(BatchedMethodSchema))
|
|
352
|
-
.returns(
|
|
353
|
-
z.array(
|
|
354
|
-
z.discriminatedUnion('name', [
|
|
355
|
-
z.object({ name: z.literal('registerSender'), result: schemas.AztecAddress }),
|
|
356
|
-
z.object({ name: z.literal('registerContract'), result: ContractInstanceWithAddressSchema }),
|
|
357
|
-
z.object({ name: z.literal('sendTx'), result: TxHash.schema }),
|
|
358
|
-
z.object({ name: z.literal('simulateUtility'), result: UtilitySimulationResult.schema }),
|
|
359
|
-
]),
|
|
360
|
-
),
|
|
361
|
-
),
|
|
416
|
+
batch: z.function().args(z.array(BatchedMethodSchema)).returns(z.array(BatchedResultSchema)),
|
|
362
417
|
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AuthWitnessProvider, EntrypointInterface } from '@aztec/entrypoints/interfaces';
|
|
2
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
5
|
-
/**
|
|
6
|
-
* Handler for interfacing with an account. Knows how to create transaction execution
|
|
7
|
-
* requests and authorize actions for its corresponding account.
|
|
8
|
-
*/
|
|
9
|
-
export interface AccountInterface extends EntrypointInterface, AuthWitnessProvider {
|
|
10
|
-
/** Returns the complete address for this account. */
|
|
11
|
-
getCompleteAddress(): CompleteAddress;
|
|
12
|
-
/** Returns the address for this account. */
|
|
13
|
-
getAddress(): AztecAddress;
|
|
14
|
-
/** Returns the chain id for this account */
|
|
15
|
-
getChainId(): Fr;
|
|
16
|
-
/** Returns the rollup version for this account */
|
|
17
|
-
getVersion(): Fr;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/account/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB,EAAE,mBAAmB;IAChF,qDAAqD;IACrD,kBAAkB,IAAI,eAAe,CAAC;IAEtC,4CAA4C;IAC5C,UAAU,IAAI,YAAY,CAAC;IAE3B,4CAA4C;IAC5C,UAAU,IAAI,EAAE,CAAC;IAEjB,kDAAkD;IAClD,UAAU,IAAI,EAAE,CAAC;CAClB"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
2
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
4
|
-
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
5
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
6
|
-
import type { Contract } from './contract.js';
|
|
7
|
-
import type { ContractBase } from './contract_base.js';
|
|
8
|
-
import { SentTx, type WaitOpts } from './sent_tx.js';
|
|
9
|
-
/** Options related to waiting for a deployment tx. */
|
|
10
|
-
export type DeployedWaitOpts = WaitOpts & {
|
|
11
|
-
/** Wallet to use for creating a contract instance. Uses the one set in the deployer constructor if not set. */
|
|
12
|
-
wallet?: Wallet;
|
|
13
|
-
};
|
|
14
|
-
/** Extends a transaction receipt with a contract instance that represents the newly deployed contract. */
|
|
15
|
-
export type DeployTxReceipt<TContract extends ContractBase = Contract> = FieldsOf<TxReceipt> & {
|
|
16
|
-
/** Instance of the newly deployed contract. */
|
|
17
|
-
contract: TContract;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
|
|
21
|
-
*/
|
|
22
|
-
export declare class DeploySentTx<TContract extends Contract = Contract> extends SentTx {
|
|
23
|
-
private postDeployCtor;
|
|
24
|
-
/** A getter for the deployed contract instance */
|
|
25
|
-
instanceGetter: () => Promise<ContractInstanceWithAddress>;
|
|
26
|
-
private log;
|
|
27
|
-
constructor(wallet: Wallet, sendTx: () => Promise<TxHash>, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
|
|
28
|
-
/** A getter for the deployed contract instance */
|
|
29
|
-
instanceGetter: () => Promise<ContractInstanceWithAddress>);
|
|
30
|
-
/**
|
|
31
|
-
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
32
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
33
|
-
* @returns The deployed contract instance.
|
|
34
|
-
*/
|
|
35
|
-
deployed(opts?: DeployedWaitOpts): Promise<TContract>;
|
|
36
|
-
/**
|
|
37
|
-
* Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
|
|
38
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
39
|
-
* @returns The transaction receipt with the deployed contract instance.
|
|
40
|
-
*/
|
|
41
|
-
wait(opts?: DeployedWaitOpts): Promise<DeployTxReceipt<TContract>>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=deploy_sent_tx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_sent_tx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAErD,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACxC,+GAA+G;IAC/G,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,0GAA0G;AAC1G,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,YAAY,GAAG,QAAQ,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG;IAC7F,+CAA+C;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAY,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,MAAM;IAM3E,OAAO,CAAC,cAAc;IACtB,kDAAkD;IAC3C,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC;IAPnE,OAAO,CAAC,GAAG,CAA0C;gBAGnD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACrB,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC;IACrF,kDAAkD;IAC3C,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC;IAKnE;;;;OAIG;IACU,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAOlE;;;;OAIG;IACmB,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;CAWzF"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
-
import { SentTx } from './sent_tx.js';
|
|
3
|
-
/**
|
|
4
|
-
* A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
|
|
5
|
-
*/ export class DeploySentTx extends SentTx {
|
|
6
|
-
postDeployCtor;
|
|
7
|
-
instanceGetter;
|
|
8
|
-
log;
|
|
9
|
-
constructor(wallet, sendTx, postDeployCtor, /** A getter for the deployed contract instance */ instanceGetter){
|
|
10
|
-
super(wallet, sendTx), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter, this.log = createLogger('aztecjs:deploy_sent_tx');
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
14
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
15
|
-
* @returns The deployed contract instance.
|
|
16
|
-
*/ async deployed(opts) {
|
|
17
|
-
const receipt = await this.wait(opts);
|
|
18
|
-
const instance = await this.instanceGetter();
|
|
19
|
-
this.log.info(`Contract ${instance.address.toString()} successfully deployed.`);
|
|
20
|
-
return receipt.contract;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
|
|
24
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
25
|
-
* @returns The transaction receipt with the deployed contract instance.
|
|
26
|
-
*/ async wait(opts) {
|
|
27
|
-
const receipt = await super.wait(opts);
|
|
28
|
-
// In the case of DeploySentTx we have a guarantee that this.walletOrNode is a Wallet so we can cast it to Wallet.
|
|
29
|
-
const contractWallet = opts?.wallet ?? this.walletOrNode;
|
|
30
|
-
if (!contractWallet) {
|
|
31
|
-
throw new Error(`A wallet is required for creating a contract instance`);
|
|
32
|
-
}
|
|
33
|
-
const instance = await this.instanceGetter();
|
|
34
|
-
const contract = await this.postDeployCtor(instance.address, contractWallet);
|
|
35
|
-
return {
|
|
36
|
-
...receipt,
|
|
37
|
-
contract
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
2
|
-
import { UnsafeContract } from './unsafe_contract.js';
|
|
3
|
-
/** Returns a Contract wrapper for the contract class registry. */
|
|
4
|
-
export declare function getClassRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
|
|
5
|
-
/** Returns a Contract wrapper for the contract instance registry. */
|
|
6
|
-
export declare function getInstanceRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
|
|
7
|
-
/** Returns a Contract wrapper for the fee juice contract */
|
|
8
|
-
export declare function getFeeJuice(wallet: Wallet): Promise<UnsafeContract>;
|
|
9
|
-
//# sourceMappingURL=protocol_contracts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/protocol_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,kEAAkE;AAClE,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,2BAQ5D;AAED,qEAAqE;AACrE,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,MAAM,2BAO/D;AAED,4DAA4D;AAC5D,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,2BAO/C"}
|