@aztec/aztec.js 0.0.1-commit.fce3e4f → 0.0.1-commit.ff7989d6c
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 +25 -40
- 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 +21 -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 +6 -7
- package/dest/account/signerless_account.d.ts.map +1 -1
- package/dest/account/signerless_account.js +8 -11
- package/dest/api/account.d.ts +2 -4
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +1 -3
- 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/contract.d.ts +18 -12
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +16 -10
- package/dest/api/deployment.d.ts +1 -2
- package/dest/api/deployment.d.ts.map +1 -1
- package/dest/api/deployment.js +0 -1
- package/dest/api/events.d.ts +10 -6
- package/dest/api/events.d.ts.map +1 -1
- package/dest/api/events.js +30 -20
- package/dest/api/fields.d.ts +4 -2
- package/dest/api/fields.d.ts.map +1 -1
- package/dest/api/fields.js +3 -1
- package/dest/api/keys.d.ts +1 -1
- package/dest/api/keys.js +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/protocol.d.ts +7 -1
- package/dest/api/protocol.d.ts.map +1 -1
- package/dest/api/protocol.js +6 -0
- 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/wallet.d.ts +3 -2
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +2 -1
- package/dest/authorization/call_authorization_request.d.ts +23 -2
- package/dest/authorization/call_authorization_request.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.d.ts +8 -10
- 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 +3 -3
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +11 -6
- package/dest/contract/contract_base.d.ts +4 -1
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.d.ts +3 -12
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +10 -7
- package/dest/contract/deploy_method.d.ts +77 -18
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +56 -30
- package/dest/contract/interaction_options.d.ts +49 -5
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +8 -1
- 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 +997 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +15 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-class-registry.js +139 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +22 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-instance-registry.js +465 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts +21 -0
- package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/fee-juice.js +426 -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 +593 -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 +601 -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/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 +9 -6
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +17 -18
- package/dest/fee/fee_juice_payment_method_with_claim.js +7 -7
- package/dest/fee/private_fee_payment_method.js +11 -11
- package/dest/fee/public_fee_payment_method.js +11 -11
- package/dest/fee/sponsored_fee_payment.js +3 -3
- 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 +6 -10
- package/dest/utils/cross_chain.d.ts +2 -2
- package/dest/utils/cross_chain.d.ts.map +1 -1
- package/dest/utils/fee_juice.js +1 -1
- package/dest/utils/field_compressed_string.js +1 -1
- package/dest/utils/node.d.ts +12 -1
- 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 +5 -8
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
- package/dest/wallet/account_entrypoint_meta_payment_method.js +28 -43
- package/dest/wallet/account_manager.d.ts +6 -9
- package/dest/wallet/account_manager.d.ts.map +1 -1
- package/dest/wallet/account_manager.js +6 -12
- package/dest/wallet/capabilities.d.ts +452 -0
- package/dest/wallet/capabilities.d.ts.map +1 -0
- package/dest/wallet/capabilities.js +3 -0
- package/dest/wallet/deploy_account_method.d.ts +47 -8
- package/dest/wallet/deploy_account_method.d.ts.map +1 -1
- package/dest/wallet/deploy_account_method.js +34 -6
- package/dest/wallet/index.d.ts +2 -1
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +1 -0
- package/dest/wallet/wallet.d.ts +1817 -984
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +216 -101
- package/package.json +25 -14
- package/src/account/account.ts +34 -58
- 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 +14 -13
- package/src/api/account.ts +9 -3
- package/src/api/authorization.ts +1 -0
- package/src/api/contract.ts +24 -9
- package/src/api/deployment.ts +0 -1
- package/src/api/events.ts +35 -27
- package/src/api/fields.ts +3 -1
- package/src/api/keys.ts +2 -2
- package/src/api/node.ts +7 -3
- package/src/api/protocol.ts +7 -0
- package/src/api/tx.ts +2 -0
- package/src/api/wallet.ts +52 -3
- package/src/authorization/call_authorization_request.ts +1 -1
- package/src/contract/base_contract_interaction.ts +27 -15
- package/src/contract/batch_call.ts +10 -13
- package/src/contract/contract_function_interaction.ts +17 -7
- package/src/contract/deploy_method.ts +146 -36
- package/src/contract/interaction_options.ts +56 -4
- package/src/contract/protocol_contracts/auth-registry.ts +551 -0
- package/src/contract/protocol_contracts/contract-class-registry.ts +99 -0
- package/src/contract/protocol_contracts/contract-instance-registry.ts +302 -0
- package/src/contract/protocol_contracts/fee-juice.ts +264 -0
- package/src/contract/protocol_contracts/multi-call-entrypoint.ts +334 -0
- package/src/contract/protocol_contracts/public-checks.ts +318 -0
- package/src/contract/wait_for_proven.ts +1 -1
- package/src/contract/wait_opts.ts +21 -0
- package/src/deployment/publish_class.ts +3 -3
- package/src/deployment/publish_instance.ts +3 -6
- package/src/ethereum/portal_manager.ts +20 -24
- package/src/fee/fee_juice_payment_method_with_claim.ts +6 -6
- package/src/fee/private_fee_payment_method.ts +8 -8
- package/src/fee/public_fee_payment_method.ts +9 -9
- package/src/fee/sponsored_fee_payment.ts +3 -3
- package/src/scripts/generate_protocol_contract_types.ts +150 -0
- package/src/utils/abi_types.ts +1 -1
- package/src/utils/authwit.ts +20 -8
- package/src/utils/cross_chain.ts +1 -1
- package/src/utils/fee_juice.ts +1 -1
- 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 +28 -60
- package/src/wallet/account_manager.ts +6 -14
- package/src/wallet/capabilities.ts +500 -0
- package/src/wallet/deploy_account_method.ts +75 -14
- package/src/wallet/index.ts +1 -0
- package/src/wallet/wallet.ts +375 -110
- 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 -48
- package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
- package/dest/contract/deploy_sent_tx.js +0 -46
- 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/deployment/broadcast_function.d.ts +0 -24
- package/dest/deployment/broadcast_function.d.ts.map +0 -1
- package/dest/deployment/broadcast_function.js +0 -74
- package/src/account/interface.ts +0 -25
- package/src/contract/deploy_sent_tx.ts +0 -75
- 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/deployment/broadcast_function.ts +0 -148
|
@@ -1,34 +1,69 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { ContractArtifact, FunctionArtifact } from '@aztec/stdlib/abi';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
5
5
|
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
6
6
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
7
7
|
|
|
8
|
+
import type { Account } from '../account/account.js';
|
|
8
9
|
import type { Contract } from '../contract/contract.js';
|
|
9
10
|
import type { ContractBase } from '../contract/contract_base.js';
|
|
10
11
|
import {
|
|
12
|
+
type DeployInteractionWaitOptions,
|
|
11
13
|
DeployMethod,
|
|
12
14
|
type DeployOptions,
|
|
15
|
+
type DeployOptionsWithoutWait,
|
|
13
16
|
type RequestDeployOptions,
|
|
14
17
|
type SimulateDeployOptions,
|
|
15
18
|
} from '../contract/deploy_method.js';
|
|
19
|
+
import type {
|
|
20
|
+
FeePaymentMethodOption,
|
|
21
|
+
InteractionWaitOptions,
|
|
22
|
+
ProfileInteractionOptions,
|
|
23
|
+
} from '../contract/interaction_options.js';
|
|
24
|
+
import type { WaitOpts } from '../contract/wait_opts.js';
|
|
16
25
|
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
17
26
|
import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
|
|
18
|
-
import type { Wallet } from './index.js';
|
|
27
|
+
import type { ProfileOptions, SendOptions, SimulateOptions, Wallet } from './index.js';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Extended fee payment method option for account deployments that includes entrypoint wrapping options
|
|
31
|
+
*/
|
|
32
|
+
export type DeployAccountFeePaymentMethodOption = FeePaymentMethodOption & {
|
|
33
|
+
/** Optional entrypoint-specific options for wrapping execution payloads */
|
|
34
|
+
feeEntrypointOptions?: unknown;
|
|
35
|
+
};
|
|
19
36
|
|
|
20
37
|
/**
|
|
21
38
|
* The configuration options for the request method. Omits the contractAddressSalt, since
|
|
22
39
|
* for account contracts that is fixed in the constructor
|
|
23
40
|
*/
|
|
24
|
-
export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt'
|
|
41
|
+
export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt' | 'fee'> & {
|
|
42
|
+
/** Fee options specific to account deployment */
|
|
43
|
+
fee?: DeployAccountFeePaymentMethodOption;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Base configuration options for the send/prove methods without wait parameter. Omits:
|
|
48
|
+
* - The contractAddressSalt, since for account contracts that is fixed in the constructor.
|
|
49
|
+
* - UniversalDeployment flag, since account contracts are always deployed with it set to true
|
|
50
|
+
*/
|
|
51
|
+
export type DeployAccountOptionsWithoutWait = Omit<DeployOptionsWithoutWait, 'contractAddressSalt' | 'universalDeploy'>;
|
|
25
52
|
|
|
26
53
|
/**
|
|
27
54
|
* The configuration options for the send/prove methods. Omits:
|
|
28
55
|
* - The contractAddressSalt, since for account contracts that is fixed in the constructor.
|
|
29
56
|
* - UniversalDeployment flag, since account contracts are always deployed with it set to true
|
|
30
57
|
*/
|
|
31
|
-
export type DeployAccountOptions =
|
|
58
|
+
export type DeployAccountOptions<W extends InteractionWaitOptions = undefined> = DeployAccountOptionsWithoutWait & {
|
|
59
|
+
/**
|
|
60
|
+
* Whether to wait for the transaction to be mined.
|
|
61
|
+
* - undefined (default): wait with default options and return TxReceipt
|
|
62
|
+
* - WaitOpts object: wait with custom options and return TxReceipt
|
|
63
|
+
* - false: return txHash immediately without waiting
|
|
64
|
+
*/
|
|
65
|
+
wait?: W;
|
|
66
|
+
};
|
|
32
67
|
|
|
33
68
|
/**
|
|
34
69
|
* The configuration options for the simulate method. Omits the contractAddressSalt, since
|
|
@@ -47,6 +82,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
47
82
|
artifact: ContractArtifact,
|
|
48
83
|
postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
|
|
49
84
|
private salt: Fr,
|
|
85
|
+
private account: Account,
|
|
50
86
|
args: any[] = [],
|
|
51
87
|
constructorNameOrArtifact?: string | FunctionArtifact,
|
|
52
88
|
) {
|
|
@@ -61,19 +97,14 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
61
97
|
* For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
|
|
62
98
|
*
|
|
63
99
|
* @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
|
|
100
|
+
* @param feeEntrypointOptions - Optional entrypoint-specific options for wrapping. If not provided, will be auto-computed based on the payment method.
|
|
64
101
|
* @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
|
|
65
102
|
*/
|
|
66
|
-
private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod) {
|
|
103
|
+
private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod, feeEntrypointOptions?: any) {
|
|
67
104
|
if (!this.address) {
|
|
68
105
|
throw new Error('Instance is not yet constructed. This is a bug!');
|
|
69
106
|
}
|
|
70
|
-
return new AccountEntrypointMetaPaymentMethod(
|
|
71
|
-
this.wallet,
|
|
72
|
-
this.artifact,
|
|
73
|
-
'entrypoint',
|
|
74
|
-
this.address,
|
|
75
|
-
originalPaymentMethod,
|
|
76
|
-
);
|
|
107
|
+
return new AccountEntrypointMetaPaymentMethod(this.account, originalPaymentMethod, feeEntrypointOptions);
|
|
77
108
|
}
|
|
78
109
|
|
|
79
110
|
/**
|
|
@@ -97,7 +128,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
97
128
|
const executionPayloads = [deploymentExecutionPayload];
|
|
98
129
|
// If this is a self-deployment, manage the fee accordingly
|
|
99
130
|
if (opts?.deployer?.equals(AztecAddress.ZERO)) {
|
|
100
|
-
const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod);
|
|
131
|
+
const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod, opts?.fee?.feeEntrypointOptions);
|
|
101
132
|
const feeExecutionPayload = await feePaymentMethod.getExecutionPayload();
|
|
102
133
|
// Notice they are reversed (fee payment usually goes first):
|
|
103
134
|
// this is because we need to construct the contract BEFORE it can pay for its own fee
|
|
@@ -113,7 +144,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
113
144
|
return mergeExecutionPayloads(executionPayloads);
|
|
114
145
|
}
|
|
115
146
|
|
|
116
|
-
override convertDeployOptionsToRequestOptions(options:
|
|
147
|
+
override convertDeployOptionsToRequestOptions(options: DeployAccountOptionsWithoutWait): RequestDeployOptions {
|
|
117
148
|
return {
|
|
118
149
|
...options,
|
|
119
150
|
// Deployer is handled in the request method and forcibly set to undefined,
|
|
@@ -123,4 +154,34 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
|
|
|
123
154
|
deployer: options.from,
|
|
124
155
|
};
|
|
125
156
|
}
|
|
157
|
+
|
|
158
|
+
protected override convertDeployOptionsToSendOptions<W extends DeployInteractionWaitOptions>(
|
|
159
|
+
options: DeployOptions<W>,
|
|
160
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
161
|
+
): SendOptions<W extends { returnReceipt: true } ? WaitOpts : W> {
|
|
162
|
+
return super.convertDeployOptionsToSendOptions(this.injectContractAddressIntoScopes(options));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
protected override convertDeployOptionsToSimulateOptions(options: SimulateDeployOptions): SimulateOptions {
|
|
166
|
+
return super.convertDeployOptionsToSimulateOptions(this.injectContractAddressIntoScopes(options));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
protected override convertDeployOptionsToProfileOptions(
|
|
170
|
+
options: DeployOptionsWithoutWait & ProfileInteractionOptions,
|
|
171
|
+
): ProfileOptions {
|
|
172
|
+
return super.convertDeployOptionsToProfileOptions(this.injectContractAddressIntoScopes(options));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Injects the contract's own address into scopes so the constructor can access its own keys.
|
|
177
|
+
* @param options - The deploy options to augment with the contract address.
|
|
178
|
+
*/
|
|
179
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
180
|
+
private injectContractAddressIntoScopes<T extends { additionalScopes?: AztecAddress[] }>(options: T): T {
|
|
181
|
+
if (!this.address) {
|
|
182
|
+
throw new Error('Instance not yet constructed. This is a bug!');
|
|
183
|
+
}
|
|
184
|
+
const existing = options.additionalScopes ?? [];
|
|
185
|
+
return { ...options, additionalScopes: [...existing, this.address] };
|
|
186
|
+
}
|
|
126
187
|
}
|
package/src/wallet/index.ts
CHANGED