@aztec/aztec.js 0.0.1-commit.24de95ac → 0.0.1-commit.3469e52
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 +2 -2
- package/dest/api/block.d.ts.map +1 -1
- package/dest/api/block.js +1 -1
- package/dest/api/contract.d.ts +3 -3
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +1 -1
- 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 +1 -1
- 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 +2 -3
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +1 -1
- 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 +9 -8
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +14 -11
- package/dest/contract/deploy_sent_tx.d.ts +12 -7
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +10 -4
- package/dest/contract/get_gas_limits.d.ts +1 -1
- package/dest/contract/interaction_options.d.ts +4 -4
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +4 -10
- 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 +976 -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 +797 -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 +871 -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 +840 -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 +576 -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 +592 -0
- package/dest/contract/sent_tx.d.ts +2 -3
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +1 -1
- package/dest/contract/wait_for_proven.d.ts +2 -2
- package/dest/contract/wait_for_proven.d.ts.map +1 -1
- 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 +9 -7
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +25 -14
- 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 +2 -2
- package/dest/utils/node.d.ts.map +1 -1
- 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 +20 -6
- 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 +273 -1499
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +71 -114
- 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/block.ts +1 -1
- package/src/api/contract.ts +2 -1
- package/src/api/fields.ts +2 -1
- package/src/api/note.ts +1 -1
- package/src/api/protocol.ts +7 -0
- package/src/api/tx.ts +2 -0
- package/src/api/wallet.ts +5 -9
- package/src/authorization/call_authorization_request.ts +1 -1
- package/src/contract/base_contract_interaction.ts +2 -3
- 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 +20 -18
- package/src/contract/deploy_sent_tx.ts +17 -10
- package/src/contract/interaction_options.ts +4 -10
- package/src/contract/protocol_contracts/auth-registry.ts +554 -0
- package/src/contract/protocol_contracts/contract-class-registry.ts +442 -0
- package/src/contract/protocol_contracts/contract-instance-registry.ts +502 -0
- package/src/contract/protocol_contracts/fee-juice.ts +466 -0
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +338 -0
- package/src/contract/protocol_contracts/public-checks.ts +324 -0
- package/src/contract/sent_tx.ts +2 -3
- 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 +24 -18
- 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/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 +23 -13
- package/src/wallet/index.ts +0 -1
- package/src/wallet/wallet.ts +177 -142
- 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/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/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/protocol_contracts.ts +0 -35
- 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,20 @@
|
|
|
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 { AbiDecodedSchema, type ApiSchemaFor, type ZodFor, optional, schemas } from '@aztec/stdlib/schemas';
|
|
17
|
+
import { AbiDecodedSchema, type ApiSchemaFor, optional, schemas, zodFor } from '@aztec/stdlib/schemas';
|
|
25
18
|
import {
|
|
26
19
|
Capsule,
|
|
27
20
|
HashedValues,
|
|
@@ -30,11 +23,12 @@ import {
|
|
|
30
23
|
TxReceipt,
|
|
31
24
|
TxSimulationResult,
|
|
32
25
|
UtilitySimulationResult,
|
|
26
|
+
inTxSchema,
|
|
33
27
|
} from '@aztec/stdlib/tx';
|
|
28
|
+
import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
|
|
34
29
|
|
|
35
30
|
import { z } from 'zod';
|
|
36
31
|
|
|
37
|
-
import type { Contract } from '../contract/contract.js';
|
|
38
32
|
import type {
|
|
39
33
|
FeeEstimationOptions,
|
|
40
34
|
GasSettingsOption,
|
|
@@ -58,80 +52,71 @@ export type Aliased<T> = {
|
|
|
58
52
|
item: T;
|
|
59
53
|
};
|
|
60
54
|
|
|
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
55
|
/**
|
|
78
56
|
* 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
|
|
57
|
+
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
80
58
|
* fee payment method or not
|
|
81
59
|
*/
|
|
82
60
|
export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
|
|
83
61
|
/** The fee options */
|
|
84
|
-
fee?:
|
|
62
|
+
fee?: GasSettingsOption & FeeEstimationOptions;
|
|
85
63
|
};
|
|
86
64
|
|
|
87
65
|
/**
|
|
88
66
|
* 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
|
|
67
|
+
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
90
68
|
* fee payment method or not
|
|
91
69
|
*/
|
|
92
70
|
export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
|
|
93
71
|
/** The fee options */
|
|
94
|
-
fee?:
|
|
72
|
+
fee?: GasSettingsOption;
|
|
95
73
|
};
|
|
96
74
|
|
|
97
75
|
/**
|
|
98
76
|
* 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
|
|
77
|
+
* a simplified version that only hints at the wallet whether the interaction contains a
|
|
100
78
|
* fee payment method or not
|
|
101
79
|
*/
|
|
102
80
|
export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
|
|
103
81
|
/** The fee options */
|
|
104
|
-
fee?:
|
|
82
|
+
fee?: GasSettingsOption;
|
|
105
83
|
};
|
|
106
84
|
|
|
107
85
|
/**
|
|
108
|
-
* Helper type that represents all methods that can be batched.
|
|
86
|
+
* Helper type that represents all methods that can be batched (all methods except batch itself).
|
|
109
87
|
*/
|
|
110
|
-
export type BatchableMethods =
|
|
88
|
+
export type BatchableMethods = Omit<Wallet, 'batch'>;
|
|
111
89
|
|
|
112
90
|
/**
|
|
113
|
-
*
|
|
114
|
-
* This is what the wallet will accept as arguments to the `batch` method.
|
|
91
|
+
* A method call with its name and arguments.
|
|
115
92
|
*/
|
|
116
|
-
|
|
93
|
+
type BatchedMethodInternal<T extends keyof BatchableMethods> = {
|
|
117
94
|
/** The method name */
|
|
118
95
|
name: T;
|
|
119
96
|
/** The method arguments */
|
|
120
97
|
args: Parameters<BatchableMethods[T]>;
|
|
121
98
|
};
|
|
122
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Union of all possible batched method calls.
|
|
102
|
+
* This ensures type safety: the `args` must match the specific `name`.
|
|
103
|
+
*/
|
|
104
|
+
export type BatchedMethod = {
|
|
105
|
+
[K in keyof BatchableMethods]: BatchedMethodInternal<K>;
|
|
106
|
+
}[keyof BatchableMethods];
|
|
107
|
+
|
|
123
108
|
/**
|
|
124
109
|
* Helper type to extract the return type of a batched method
|
|
125
110
|
*/
|
|
126
111
|
export type BatchedMethodResult<T> =
|
|
127
|
-
T extends
|
|
112
|
+
T extends BatchedMethodInternal<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
|
|
128
113
|
|
|
129
114
|
/**
|
|
130
115
|
* Wrapper type for batch results that includes the method name for discriminated union deserialization.
|
|
131
116
|
* Each result is wrapped as \{ name: 'methodName', result: ActualResult \} to allow proper deserialization
|
|
132
117
|
* when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).
|
|
133
118
|
*/
|
|
134
|
-
export type BatchedMethodResultWrapper<T extends BatchedMethod
|
|
119
|
+
export type BatchedMethodResultWrapper<T extends BatchedMethod> = {
|
|
135
120
|
/** The method name */
|
|
136
121
|
name: T['name'];
|
|
137
122
|
/** The method result */
|
|
@@ -141,66 +126,96 @@ export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMe
|
|
|
141
126
|
/**
|
|
142
127
|
* Maps a tuple of BatchedMethod to a tuple of their wrapped return types
|
|
143
128
|
*/
|
|
144
|
-
export type BatchResults<T extends readonly BatchedMethod
|
|
129
|
+
export type BatchResults<T extends readonly BatchedMethod[]> = {
|
|
145
130
|
[K in keyof T]: BatchedMethodResultWrapper<T[K]>;
|
|
146
131
|
};
|
|
147
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Filter options when querying private events.
|
|
135
|
+
*/
|
|
136
|
+
export type PrivateEventFilter = {
|
|
137
|
+
/** The address of the contract that emitted the events. */
|
|
138
|
+
contractAddress: AztecAddress;
|
|
139
|
+
/** Addresses of accounts that are in scope for this filter. */
|
|
140
|
+
scopes: AztecAddress[];
|
|
141
|
+
/** Transaction in which the events were emitted. */
|
|
142
|
+
txHash?: TxHash;
|
|
143
|
+
/** The block number from which to start fetching events (inclusive).
|
|
144
|
+
* Optional. If provided, it must be greater or equal than 1.
|
|
145
|
+
* Defaults to the initial L2 block number (INITIAL_L2_BLOCK_NUM).
|
|
146
|
+
* */
|
|
147
|
+
fromBlock?: BlockNumber;
|
|
148
|
+
/** The block number until which to fetch logs (not inclusive).
|
|
149
|
+
* Optional. If provided, it must be greater than fromBlock.
|
|
150
|
+
* Defaults to the latest known block to PXE + 1.
|
|
151
|
+
*/
|
|
152
|
+
toBlock?: BlockNumber;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* An ABI decoded private event with associated metadata.
|
|
157
|
+
*/
|
|
158
|
+
export type PrivateEvent<T> = {
|
|
159
|
+
/** The ABI decoded event */
|
|
160
|
+
event: T;
|
|
161
|
+
/** Metadata describing event context information such as tx and block */
|
|
162
|
+
metadata: InTx;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Contract metadata including deployment and registration status.
|
|
167
|
+
*/
|
|
168
|
+
export type ContractMetadata = {
|
|
169
|
+
/** The contract instance */
|
|
170
|
+
instance?: ContractInstanceWithAddress;
|
|
171
|
+
/** Whether the contract has been initialized (init nullifier exists) */
|
|
172
|
+
isContractInitialized: boolean;
|
|
173
|
+
/** Whether the contract instance is publicly deployed on-chain */
|
|
174
|
+
isContractPublished: boolean;
|
|
175
|
+
/** Whether the contract has been updated to a different class */
|
|
176
|
+
isContractUpdated: boolean;
|
|
177
|
+
/** The updated contract class ID if the contract has been updated */
|
|
178
|
+
updatedContractClassId?: Fr | undefined;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Contract class metadata.
|
|
183
|
+
*/
|
|
184
|
+
export type ContractClassMetadata = {
|
|
185
|
+
/** Whether the artifact is registered in the wallet */
|
|
186
|
+
isArtifactRegistered: boolean;
|
|
187
|
+
/** Whether the contract class is publicly registered on-chain */
|
|
188
|
+
isContractClassPubliclyRegistered: boolean;
|
|
189
|
+
};
|
|
190
|
+
|
|
148
191
|
/**
|
|
149
192
|
* The wallet interface.
|
|
150
193
|
*/
|
|
151
194
|
export type Wallet = {
|
|
152
|
-
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
|
|
153
|
-
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
154
195
|
getPrivateEvents<T>(
|
|
155
|
-
contractAddress: AztecAddress,
|
|
156
196
|
eventMetadata: EventMetadataDefinition,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
recipients: AztecAddress[],
|
|
160
|
-
): Promise<T[]>;
|
|
197
|
+
eventFilter: PrivateEventFilter,
|
|
198
|
+
): Promise<PrivateEvent<T>[]>;
|
|
161
199
|
getChainInfo(): Promise<ChainInfo>;
|
|
162
200
|
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
201
|
+
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
|
|
202
|
+
getContractClassMetadata(id: Fr): Promise<ContractClassMetadata>;
|
|
163
203
|
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
|
|
164
204
|
getAddressBook(): Promise<Aliased<AztecAddress>[]>;
|
|
165
205
|
getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
166
206
|
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,
|
|
207
|
+
instance: ContractInstanceWithAddress,
|
|
208
|
+
artifact?: ContractArtifact,
|
|
209
|
+
secretKey?: Fr,
|
|
178
210
|
): Promise<ContractInstanceWithAddress>;
|
|
179
211
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
180
|
-
simulateUtility(
|
|
181
|
-
functionName: string,
|
|
182
|
-
args: any[],
|
|
183
|
-
to: AztecAddress,
|
|
184
|
-
authwits?: AuthWitness[],
|
|
185
|
-
): Promise<UtilitySimulationResult>;
|
|
212
|
+
simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
|
|
186
213
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
187
214
|
sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
|
|
188
|
-
createAuthWit(
|
|
189
|
-
|
|
190
|
-
messageHashOrIntent: Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent,
|
|
191
|
-
): Promise<AuthWitness>;
|
|
192
|
-
batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
|
|
215
|
+
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
|
|
216
|
+
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
|
|
193
217
|
};
|
|
194
218
|
|
|
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
219
|
export const FunctionCallSchema = z.object({
|
|
205
220
|
name: z.string(),
|
|
206
221
|
to: schemas.AztecAddress,
|
|
@@ -217,9 +232,10 @@ export const ExecutionPayloadSchema = z.object({
|
|
|
217
232
|
authWitnesses: z.array(AuthWitness.schema),
|
|
218
233
|
capsules: z.array(Capsule.schema),
|
|
219
234
|
extraHashedArgs: z.array(HashedValues.schema),
|
|
235
|
+
feePayer: optional(schemas.AztecAddress),
|
|
220
236
|
});
|
|
221
237
|
|
|
222
|
-
export const
|
|
238
|
+
export const GasSettingsOptionSchema = z.object({
|
|
223
239
|
gasSettings: optional(
|
|
224
240
|
z.object({
|
|
225
241
|
gasLimits: optional(Gas.schema),
|
|
@@ -228,10 +244,9 @@ export const UserFeeOptionsSchema = z.object({
|
|
|
228
244
|
maxPriorityFeePerGas: optional(z.object({ feePerDaGas: schemas.BigInt, feePerL2Gas: schemas.BigInt })),
|
|
229
245
|
}),
|
|
230
246
|
),
|
|
231
|
-
embeddedPaymentMethodFeePayer: optional(schemas.AztecAddress),
|
|
232
247
|
});
|
|
233
248
|
|
|
234
|
-
export const WalletSimulationFeeOptionSchema =
|
|
249
|
+
export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
|
|
235
250
|
estimatedGasPadding: optional(z.number()),
|
|
236
251
|
estimateGas: optional(z.boolean()),
|
|
237
252
|
});
|
|
@@ -240,7 +255,7 @@ export const SendOptionsSchema = z.object({
|
|
|
240
255
|
from: schemas.AztecAddress,
|
|
241
256
|
authWitnesses: optional(z.array(AuthWitness.schema)),
|
|
242
257
|
capsules: optional(z.array(Capsule.schema)),
|
|
243
|
-
fee: optional(
|
|
258
|
+
fee: optional(GasSettingsOptionSchema),
|
|
244
259
|
});
|
|
245
260
|
|
|
246
261
|
export const SimulateOptionsSchema = z.object({
|
|
@@ -258,72 +273,64 @@ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
|
|
|
258
273
|
skipProofGeneration: optional(z.boolean()),
|
|
259
274
|
});
|
|
260
275
|
|
|
261
|
-
export const InstanceDataSchema = z.union([
|
|
262
|
-
schemas.AztecAddress,
|
|
263
|
-
ContractInstanceWithAddressSchema,
|
|
264
|
-
ContractInstantiationDataSchema,
|
|
265
|
-
z.object({ instance: ContractInstanceWithAddressSchema, artifact: ContractArtifactSchema }),
|
|
266
|
-
]);
|
|
267
|
-
|
|
268
276
|
export const MessageHashOrIntentSchema = z.union([
|
|
269
|
-
schemas.Fr,
|
|
270
|
-
schemas.Buffer,
|
|
271
|
-
z.object({ consumer: schemas.AztecAddress, innerHash: z.union([schemas.Buffer, schemas.Fr]) }),
|
|
277
|
+
z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
|
|
272
278
|
z.object({
|
|
273
279
|
caller: schemas.AztecAddress,
|
|
274
280
|
call: FunctionCallSchema,
|
|
275
281
|
}),
|
|
276
282
|
]);
|
|
277
283
|
|
|
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
|
-
}),
|
|
284
|
+
export const EventMetadataDefinitionSchema = z.object({
|
|
285
|
+
eventSelector: schemas.EventSelector,
|
|
286
|
+
abiType: AbiTypeSchema,
|
|
287
|
+
fieldNames: z.array(z.string()),
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
export const PrivateEventSchema: z.ZodType<any> = zodFor<PrivateEvent<AbiDecoded>>()(
|
|
291
291
|
z.object({
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
event: AbiDecodedSchema,
|
|
293
|
+
metadata: inTxSchema(),
|
|
294
294
|
}),
|
|
295
|
-
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
export const PrivateEventFilterSchema = z.object({
|
|
298
|
+
contractAddress: schemas.AztecAddress,
|
|
299
|
+
scopes: z.array(schemas.AztecAddress),
|
|
300
|
+
txHash: optional(TxHash.schema),
|
|
301
|
+
fromBlock: optional(BlockNumberPositiveSchema),
|
|
302
|
+
toBlock: optional(BlockNumberPositiveSchema),
|
|
303
|
+
});
|
|
296
304
|
|
|
297
305
|
export const ContractMetadataSchema = z.object({
|
|
298
|
-
|
|
306
|
+
instance: optional(ContractInstanceWithAddressSchema),
|
|
299
307
|
isContractInitialized: z.boolean(),
|
|
300
308
|
isContractPublished: z.boolean(),
|
|
301
|
-
|
|
309
|
+
isContractUpdated: z.boolean(),
|
|
310
|
+
updatedContractClassId: optional(schemas.Fr),
|
|
311
|
+
});
|
|
302
312
|
|
|
303
313
|
export const ContractClassMetadataSchema = z.object({
|
|
304
|
-
|
|
314
|
+
isArtifactRegistered: z.boolean(),
|
|
305
315
|
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
316
|
});
|
|
314
317
|
|
|
315
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Record of all wallet method schemas (excluding batch).
|
|
320
|
+
* This is the single source of truth for method schemas - batch schemas are derived from this.
|
|
321
|
+
*/
|
|
322
|
+
const WalletMethodSchemas = {
|
|
316
323
|
getChainInfo: z
|
|
317
324
|
.function()
|
|
318
325
|
.args()
|
|
319
326
|
.returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
|
|
320
|
-
getContractClassMetadata: z.function().args(schemas.Fr, optional(z.boolean())).returns(ContractClassMetadataSchema),
|
|
321
|
-
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
322
327
|
getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
|
|
328
|
+
getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
|
|
329
|
+
getContractClassMetadata: z.function().args(schemas.Fr).returns(ContractClassMetadataSchema),
|
|
323
330
|
getPrivateEvents: z
|
|
324
331
|
.function()
|
|
325
|
-
.args(
|
|
326
|
-
.returns(z.array(
|
|
332
|
+
.args(EventMetadataDefinitionSchema, PrivateEventFilterSchema)
|
|
333
|
+
.returns(z.array(PrivateEventSchema)),
|
|
327
334
|
registerSender: z.function().args(schemas.AztecAddress, optional(z.string())).returns(schemas.AztecAddress),
|
|
328
335
|
getAddressBook: z
|
|
329
336
|
.function()
|
|
@@ -335,28 +342,56 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
|
|
|
335
342
|
.returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
|
|
336
343
|
registerContract: z
|
|
337
344
|
.function()
|
|
338
|
-
.args(
|
|
345
|
+
.args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
|
|
339
346
|
.returns(ContractInstanceWithAddressSchema),
|
|
340
347
|
simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
|
|
341
348
|
simulateUtility: z
|
|
342
349
|
.function()
|
|
343
|
-
.args(
|
|
350
|
+
.args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
|
|
344
351
|
.returns(UtilitySimulationResult.schema),
|
|
345
352
|
profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
|
|
346
353
|
sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
|
|
347
354
|
createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Creates batch schemas from the individual wallet methods.
|
|
359
|
+
* This allows us to define them once and derive batch schemas automatically,
|
|
360
|
+
* reducing duplication and ensuring consistency.
|
|
361
|
+
*/
|
|
362
|
+
function createBatchSchemas<T extends Record<string, z.ZodFunction<z.ZodTuple<any, any>, z.ZodTypeAny>>>(
|
|
363
|
+
methodSchemas: T,
|
|
364
|
+
) {
|
|
365
|
+
const names = Object.keys(methodSchemas) as (keyof T)[];
|
|
366
|
+
|
|
367
|
+
const namesAndArgs = names.map(name =>
|
|
368
|
+
z.object({
|
|
369
|
+
name: z.literal(name),
|
|
370
|
+
args: methodSchemas[name].parameters(),
|
|
371
|
+
}),
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
const namesAndReturns = names.map(name =>
|
|
375
|
+
z.object({
|
|
376
|
+
name: z.literal(name),
|
|
377
|
+
result: methodSchemas[name].returnType(),
|
|
378
|
+
}),
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
// Type assertion needed because discriminatedUnion expects a tuple type [T, T, ...T[]]
|
|
382
|
+
// but we're building the array dynamically. The runtime behavior is correct.
|
|
383
|
+
return {
|
|
384
|
+
input: z.discriminatedUnion('name', namesAndArgs as [(typeof namesAndArgs)[0], ...typeof namesAndArgs]),
|
|
385
|
+
output: z.discriminatedUnion('name', namesAndReturns as [(typeof namesAndReturns)[0], ...typeof namesAndReturns]),
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const { input: BatchedMethodSchema, output: BatchedResultSchema } = createBatchSchemas(WalletMethodSchemas);
|
|
390
|
+
|
|
391
|
+
export { BatchedMethodSchema, BatchedResultSchema };
|
|
392
|
+
|
|
393
|
+
export const WalletSchema: ApiSchemaFor<Wallet> = {
|
|
394
|
+
...WalletMethodSchemas,
|
|
348
395
|
// @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
|
-
),
|
|
396
|
+
batch: z.function().args(z.array(BatchedMethodSchema)).returns(z.array(BatchedResultSchema)),
|
|
362
397
|
};
|
|
@@ -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,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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
|
-
import { UnsafeContract } from './unsafe_contract.js';
|
|
3
|
-
/** Returns a Contract wrapper for the contract class registry. */ export async function getClassRegistryContract(wallet) {
|
|
4
|
-
const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegistry);
|
|
5
|
-
if (!contractInstance) {
|
|
6
|
-
throw new Error("ContractClassRegistry is not registered in this wallet's instance");
|
|
7
|
-
}
|
|
8
|
-
const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
|
|
9
|
-
return new UnsafeContract(contractInstance, artifact, wallet);
|
|
10
|
-
}
|
|
11
|
-
/** Returns a Contract wrapper for the contract instance registry. */ export async function getInstanceRegistryContract(wallet) {
|
|
12
|
-
const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceRegistry);
|
|
13
|
-
if (!contractInstance) {
|
|
14
|
-
throw new Error("ContractInstanceRegistry is not registered in this wallet's instance");
|
|
15
|
-
}
|
|
16
|
-
const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
|
|
17
|
-
return new UnsafeContract(contractInstance, artifact, wallet);
|
|
18
|
-
}
|
|
19
|
-
/** Returns a Contract wrapper for the fee juice contract */ export async function getFeeJuice(wallet) {
|
|
20
|
-
const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.FeeJuice);
|
|
21
|
-
if (!contractInstance) {
|
|
22
|
-
throw new Error("FeeJuice is not registered in this wallet's instance");
|
|
23
|
-
}
|
|
24
|
-
const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
|
|
25
|
-
return new UnsafeContract(contractInstance, artifact, wallet);
|
|
26
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
4
|
-
import { ContractBase } from './contract_base.js';
|
|
5
|
-
/** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */
|
|
6
|
-
export declare class UnsafeContract extends ContractBase {
|
|
7
|
-
constructor(
|
|
8
|
-
/** The deployed contract instance definition. */
|
|
9
|
-
instance: ContractInstanceWithAddress,
|
|
10
|
-
/** The Application Binary Interface for the contract. */
|
|
11
|
-
artifact: ContractArtifact,
|
|
12
|
-
/** The wallet used for interacting with this contract. */
|
|
13
|
-
wallet: Wallet);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=unsafe_contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unsafe_contract.d.ts","sourceRoot":"","sources":["../../src/contract/unsafe_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,iHAAiH;AACjH,qBAAa,cAAe,SAAQ,YAAY;;IAE5C,iDAAiD;IACjD,QAAQ,EAAE,2BAA2B;IACrC,yDAAyD;IACzD,QAAQ,EAAE,gBAAgB;IAC1B,0DAA0D;IAC1D,MAAM,EAAE,MAAM;CAIjB"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ContractBase } from './contract_base.js';
|
|
2
|
-
/** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */ export class UnsafeContract extends ContractBase {
|
|
3
|
-
constructor(/** The deployed contract instance definition. */ instance, /** The Application Binary Interface for the contract. */ artifact, /** The wallet used for interacting with this contract. */ wallet){
|
|
4
|
-
super(instance, artifact, wallet);
|
|
5
|
-
}
|
|
6
|
-
}
|