@aztec/aztec.js 0.0.1-commit.24de95ac → 0.0.1-commit.2e2504e2
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 +2 -2
- package/dest/api/keys.js +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 +3 -3
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +2 -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 +27 -0
- package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/auth-registry.js +558 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts +26 -0
- package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
- package/dest/contract/protocol_contracts/contract-class-registry.js +385 -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 +585 -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 +593 -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/capabilities.d.ts +444 -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 +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 +2 -2
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +1 -1
- package/dest/wallet/wallet.d.ts +1577 -1465
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +200 -111
- package/package.json +26 -14
- 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/keys.ts +2 -2
- 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 +47 -8
- 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 +351 -0
- package/src/contract/protocol_contracts/contract-class-registry.ts +241 -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 +332 -0
- package/src/contract/protocol_contracts/public-checks.ts +316 -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/capabilities.ts +491 -0
- package/src/wallet/deploy_account_method.ts +41 -16
- package/src/wallet/index.ts +1 -1
- package/src/wallet/wallet.ts +322 -151
- 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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { AuthWitnessProvider
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { AuthWitnessProvider } from '@aztec/entrypoints/interfaces';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
4
4
|
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
5
5
|
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
6
6
|
import { deriveKeys } from '@aztec/stdlib/keys';
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { Account } from './account.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* An account contract instance. Knows its artifact, deployment arguments, how to create
|
|
@@ -31,14 +31,13 @@ export interface AccountContract {
|
|
|
31
31
|
>;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Returns the account
|
|
35
|
-
* The account
|
|
34
|
+
* Returns the account implementation for this account contract given an instance at the provided address.
|
|
35
|
+
* The account is responsible for assembling tx requests given requested function calls, and
|
|
36
36
|
* for creating signed auth witnesses given action identifiers (message hashes).
|
|
37
37
|
* @param address - Address of this account contract.
|
|
38
|
-
* @
|
|
39
|
-
* @returns An account interface instance for creating tx requests and authorizing actions.
|
|
38
|
+
* @returns An account instance for creating tx requests and authorizing actions.
|
|
40
39
|
*/
|
|
41
|
-
|
|
40
|
+
getAccount(address: CompleteAddress): Account;
|
|
42
41
|
|
|
43
42
|
/**
|
|
44
43
|
* Returns the auth witness provider for the given address.
|
|
@@ -1,23 +1,48 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
6
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
2
7
|
import { computeAddressSecret, deriveMasterIncomingViewingSecretKey } from '@aztec/stdlib/keys';
|
|
8
|
+
import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
3
9
|
|
|
4
|
-
import {
|
|
5
|
-
import type { Salt } from './index.js';
|
|
6
|
-
import type { AccountInterface } from './interface.js';
|
|
10
|
+
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
11
|
+
import type { Account, Salt } from './index.js';
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
|
-
* Extends {@link
|
|
14
|
+
* Extends {@link BaseAccount} with the encryption private key. Not required for
|
|
10
15
|
* implementing the wallet interface but useful for testing purposes or exporting
|
|
11
16
|
* an account to another pxe.
|
|
12
17
|
*/
|
|
13
|
-
export class AccountWithSecretKey
|
|
18
|
+
export class AccountWithSecretKey implements Account {
|
|
14
19
|
constructor(
|
|
15
|
-
account:
|
|
20
|
+
private account: Account,
|
|
16
21
|
private secretKey: Fr,
|
|
17
22
|
/** Deployment salt for this account contract. */
|
|
18
23
|
public readonly salt: Salt,
|
|
19
|
-
) {
|
|
20
|
-
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
createTxExecutionRequest(
|
|
27
|
+
exec: ExecutionPayload,
|
|
28
|
+
gasSettings: GasSettings,
|
|
29
|
+
chainInfo: ChainInfo,
|
|
30
|
+
options?: any,
|
|
31
|
+
): Promise<TxExecutionRequest> {
|
|
32
|
+
return this.account.createTxExecutionRequest(exec, gasSettings, chainInfo, options);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
wrapExecutionPayload(exec: ExecutionPayload, options?: any): Promise<ExecutionPayload> {
|
|
36
|
+
return this.account.wrapExecutionPayload(exec, options);
|
|
37
|
+
}
|
|
38
|
+
createAuthWit(intent: IntentInnerHash | CallIntent, chainInfo: ChainInfo): Promise<AuthWitness> {
|
|
39
|
+
return this.account.createAuthWit(intent, chainInfo);
|
|
40
|
+
}
|
|
41
|
+
getCompleteAddress(): CompleteAddress {
|
|
42
|
+
return this.account.getCompleteAddress();
|
|
43
|
+
}
|
|
44
|
+
getAddress(): AztecAddress {
|
|
45
|
+
return this.account.getAddress();
|
|
21
46
|
}
|
|
22
47
|
|
|
23
48
|
/** Returns the encryption private key associated with this account. */
|
package/src/account/index.ts
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
import type { Fr } from '@aztec/foundation/
|
|
6
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
7
|
|
|
8
8
|
export { type AccountContract, getAccountContractAddress } from './account_contract.js';
|
|
9
|
-
export { type
|
|
9
|
+
export { type Account, BaseAccount, type AuthorizationProvider } from './account.js';
|
|
10
|
+
export { AccountWithSecretKey } from './account_with_secret_key.js';
|
|
10
11
|
|
|
11
12
|
/** A contract deployment salt. */
|
|
12
13
|
export type Salt = Fr | number | bigint;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { ChainInfo, EntrypointInterface } from '@aztec/entrypoints/interfaces';
|
|
2
2
|
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
3
|
-
import type {
|
|
4
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
4
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
6
|
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
8
7
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
9
|
-
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
8
|
+
import type { ExecutionPayload, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
10
9
|
|
|
11
10
|
import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
|
|
12
11
|
import type { Account } from './account.js';
|
|
@@ -16,20 +15,25 @@ import type { Account } from './account.js';
|
|
|
16
15
|
*/
|
|
17
16
|
export class SignerlessAccount implements Account {
|
|
18
17
|
private entrypoint: EntrypointInterface;
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
constructor() {
|
|
20
|
+
this.entrypoint = new DefaultMultiCallEntrypoint();
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
createTxExecutionRequest(
|
|
24
|
-
|
|
23
|
+
createTxExecutionRequest(
|
|
24
|
+
exec: ExecutionPayload,
|
|
25
|
+
gasSettings: GasSettings,
|
|
26
|
+
chainInfo: ChainInfo,
|
|
27
|
+
): Promise<TxExecutionRequest> {
|
|
28
|
+
return this.entrypoint.createTxExecutionRequest(exec, gasSettings, chainInfo);
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
wrapExecutionPayload(exec: ExecutionPayload, options?: any): Promise<ExecutionPayload> {
|
|
32
|
+
return this.entrypoint.wrapExecutionPayload(exec, options);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
throw new Error('SignerlessAccount: Method
|
|
35
|
+
createAuthWit(_intent: Fr | Buffer | IntentInnerHash | CallIntent): Promise<AuthWitness> {
|
|
36
|
+
throw new Error('SignerlessAccount: Method createAuthWit not implemented.');
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
getCompleteAddress(): CompleteAddress {
|
|
@@ -39,8 +43,4 @@ export class SignerlessAccount implements Account {
|
|
|
39
43
|
getAddress(): AztecAddress {
|
|
40
44
|
throw new Error('SignerlessAccount: Method getAddress not implemented.');
|
|
41
45
|
}
|
|
42
|
-
|
|
43
|
-
createAuthWit(_intent: Fr | Buffer | IntentInnerHash | CallIntent): Promise<AuthWitness> {
|
|
44
|
-
throw new Error('SignerlessAccount: Method createAuthWit not implemented.');
|
|
45
|
-
}
|
|
46
46
|
}
|
package/src/api/account.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {
|
|
2
|
+
type Account,
|
|
3
|
+
type AccountContract,
|
|
4
|
+
AccountWithSecretKey,
|
|
5
|
+
BaseAccount,
|
|
6
|
+
type AuthorizationProvider,
|
|
7
|
+
getAccountContractAddress,
|
|
8
|
+
type Salt,
|
|
9
|
+
} from '../account/index.js';
|
|
2
10
|
export type { AuthWitnessProvider, ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
11
|
+
export { ChainInfoSchema } from '@aztec/entrypoints/interfaces';
|
|
3
12
|
|
|
4
|
-
export { AccountWithSecretKey } from '../account/account_with_secret_key.js';
|
|
5
|
-
export { type Account, BaseAccount } from '../account/account.js';
|
|
6
13
|
export { SignerlessAccount } from '../account/signerless_account.js';
|
package/src/api/authorization.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
|
2
2
|
export {
|
|
3
3
|
SetPublicAuthwitContractInteraction,
|
|
4
4
|
type ContractFunctionInteractionCallIntent,
|
|
5
|
+
isContractFunctionInteractionCallIntent,
|
|
5
6
|
getMessageHashFromIntent,
|
|
6
7
|
computeAuthWitMessageHash,
|
|
7
8
|
computeInnerAuthWitHashFromAction,
|
package/src/api/contract.ts
CHANGED
|
@@ -10,13 +10,21 @@
|
|
|
10
10
|
* or can be queried via `simulate()`.
|
|
11
11
|
*
|
|
12
12
|
* ```ts
|
|
13
|
-
*
|
|
13
|
+
* // Deploy and get the contract instance directly (default behavior)
|
|
14
|
+
* const contract = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs]).send({ from: accountAddress });
|
|
14
15
|
* console.log(`Contract deployed at ${contract.address}`);
|
|
16
|
+
*
|
|
17
|
+
* // Or get the full receipt with contract and instance
|
|
18
|
+
* const receipt = await Contract.deploy(wallet, MyContractArtifact, [...constructorArgs]).send({
|
|
19
|
+
* from: accountAddress,
|
|
20
|
+
* wait: { returnReceipt: true }
|
|
21
|
+
* });
|
|
22
|
+
* console.log(`Contract deployed at ${receipt.contract.address}`);
|
|
15
23
|
* ```
|
|
16
24
|
*
|
|
17
25
|
* ```ts
|
|
18
|
-
* const contract =
|
|
19
|
-
* await contract.methods.mint(1000, owner).send()
|
|
26
|
+
* const contract = Contract.at(address, MyContractArtifact, wallet);
|
|
27
|
+
* await contract.methods.mint(1000, owner).send({ from: accountAddress });
|
|
20
28
|
* console.log(`Total supply is now ${await contract.methods.totalSupply().simulate()}`);
|
|
21
29
|
* ```
|
|
22
30
|
*
|
|
@@ -25,9 +33,8 @@
|
|
|
25
33
|
* a transaction to the network via the `send` method, but you can also `simulate` it without sending,
|
|
26
34
|
* or obtaining the `request` for aggregating into a {@link BatchCall}.
|
|
27
35
|
*
|
|
28
|
-
* The
|
|
29
|
-
*
|
|
30
|
-
* has synchronized its changes.
|
|
36
|
+
* The `send` method returns a {@link TxReceipt} by default (waits for the transaction to be mined).
|
|
37
|
+
* If you pass `wait: NO_WAIT` in the options, it will return a {@link TxHash} immediately without waiting.
|
|
31
38
|
*
|
|
32
39
|
* @remarks If you are using typescript, consider using the
|
|
33
40
|
* {@link https://docs.aztec.network/developers/aztec-nr/how_to_compile_contract#use-generated-interfaces | autogenerated type-safe interfaces}
|
|
@@ -39,26 +46,35 @@ export { Contract } from '../contract/contract.js';
|
|
|
39
46
|
export { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
40
47
|
|
|
41
48
|
export {
|
|
49
|
+
NO_WAIT,
|
|
50
|
+
type NoWait,
|
|
42
51
|
type RequestInteractionOptions,
|
|
43
52
|
type SendInteractionOptions,
|
|
44
53
|
type ProfileInteractionOptions,
|
|
45
54
|
type SimulateInteractionOptions,
|
|
46
55
|
type InteractionFeeOptions,
|
|
56
|
+
type InteractionWaitOptions,
|
|
57
|
+
type GasSettingsOption,
|
|
58
|
+
type SendReturn,
|
|
59
|
+
type SimulationReturn,
|
|
47
60
|
toProfileOptions,
|
|
48
61
|
toSendOptions,
|
|
49
62
|
toSimulateOptions,
|
|
50
63
|
} from '../contract/interaction_options.js';
|
|
51
64
|
|
|
52
|
-
export { DefaultWaitOpts,
|
|
65
|
+
export { DefaultWaitOpts, type WaitOpts } from '../contract/wait_opts.js';
|
|
53
66
|
export { ContractBase, type ContractMethod, type ContractStorageLayout } from '../contract/contract_base.js';
|
|
54
67
|
export { BatchCall } from '../contract/batch_call.js';
|
|
55
68
|
export {
|
|
56
69
|
type DeployOptions,
|
|
70
|
+
type DeployReturn,
|
|
71
|
+
type DeployTxReceipt,
|
|
72
|
+
type DeployWaitOptions,
|
|
73
|
+
type DeployInteractionWaitOptions,
|
|
57
74
|
DeployMethod,
|
|
58
75
|
type RequestDeployOptions,
|
|
59
76
|
type SimulateDeployOptions,
|
|
60
77
|
} from '../contract/deploy_method.js';
|
|
61
|
-
export { DeploySentTx } from '../contract/deploy_sent_tx.js';
|
|
62
78
|
export { waitForProven, type WaitForProvenOpts, DefaultWaitForProvenOpts } from '../contract/wait_for_proven.js';
|
|
63
79
|
export { getGasLimits } from '../contract/get_gas_limits.js';
|
|
64
80
|
|
package/src/api/fields.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Fr, Fq } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
export { GrumpkinScalar, Point } from '@aztec/foundation/curves/grumpkin';
|
package/src/api/keys.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { type PublicKey, PublicKeys } from '@aztec/stdlib/keys';
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
computeAppNullifierHidingKey,
|
|
4
4
|
deriveKeys,
|
|
5
5
|
deriveMasterIncomingViewingSecretKey,
|
|
6
|
-
|
|
6
|
+
deriveMasterNullifierHidingKey,
|
|
7
7
|
} from '@aztec/stdlib/keys';
|
|
8
8
|
export { generatePublicKey } from '../utils/pub_key.js';
|
package/src/api/node.ts
CHANGED
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The primary function is {@link createAztecNodeClient}, which creates a JSON-RPC client
|
|
5
5
|
* that connects to a running Aztec node instance. Use {@link waitForNode} to wait for
|
|
6
|
-
* the node to be ready before proceeding
|
|
6
|
+
* the node to be ready before proceeding, and {@link waitForTx} to wait for a transaction
|
|
7
|
+
* to be mined.
|
|
7
8
|
*
|
|
8
9
|
* @example
|
|
9
10
|
* ```ts
|
|
10
|
-
* import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
|
|
11
|
+
* import { createAztecNodeClient, waitForNode, waitForTx } from '@aztec/aztec.js/node';
|
|
11
12
|
*
|
|
12
13
|
* const node = createAztecNodeClient('http://localhost:8080');
|
|
13
14
|
* await waitForNode(node);
|
|
14
15
|
* const blockNumber = await node.getBlockNumber();
|
|
16
|
+
*
|
|
17
|
+
* // Wait for a transaction
|
|
18
|
+
* const receipt = await waitForTx(node, txHash);
|
|
15
19
|
* ```
|
|
16
20
|
*
|
|
17
21
|
* @packageDocumentation
|
|
18
22
|
*/
|
|
19
|
-
export { createAztecNodeClient, waitForNode, type AztecNode } from '../utils/node.js';
|
|
23
|
+
export { createAztecNodeClient, waitForNode, waitForTx, type AztecNode } from '../utils/node.js';
|
|
20
24
|
export { type NodeInfo } from '@aztec/stdlib/contract';
|
package/src/api/note.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Comparator, Note } from '@aztec/stdlib/note';
|
package/src/api/protocol.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
2
|
export { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
3
|
+
|
|
4
|
+
export { AuthRegistryContract } from '../contract/protocol_contracts/auth-registry.js';
|
|
5
|
+
export { ContractClassRegistryContract } from '../contract/protocol_contracts/contract-class-registry.js';
|
|
6
|
+
export { ContractInstanceRegistryContract } from '../contract/protocol_contracts/contract-instance-registry.js';
|
|
7
|
+
export { FeeJuiceContract } from '../contract/protocol_contracts/fee-juice.js';
|
|
8
|
+
export { MultiCallEntrypointContract } from '../contract/protocol_contracts/multi-call-entrypoint.js';
|
|
9
|
+
export { PublicChecksContract } from '../contract/protocol_contracts/public-checks.js';
|
package/src/api/tx.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export {
|
|
2
2
|
Tx,
|
|
3
3
|
TxExecutionRequest,
|
|
4
|
+
TxExecutionResult,
|
|
4
5
|
TxHash,
|
|
5
6
|
TxReceipt,
|
|
6
7
|
TxStatus,
|
|
8
|
+
SortedTxStatuses,
|
|
7
9
|
Capsule,
|
|
8
10
|
HashedValues,
|
|
9
11
|
GlobalVariables,
|
|
10
12
|
TxProfileResult,
|
|
13
|
+
ExecutionPayload,
|
|
14
|
+
mergeExecutionPayloads,
|
|
11
15
|
} from '@aztec/stdlib/tx';
|
package/src/api/wallet.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export {
|
|
2
2
|
type Aliased,
|
|
3
|
-
type ContractInstanceAndArtifact,
|
|
4
|
-
type UserFeeOptions,
|
|
5
3
|
type SimulateOptions,
|
|
6
4
|
type ProfileOptions,
|
|
7
5
|
type SendOptions,
|
|
@@ -11,24 +9,65 @@ export {
|
|
|
11
9
|
type BatchedMethodResultWrapper,
|
|
12
10
|
type BatchResults,
|
|
13
11
|
type Wallet,
|
|
14
|
-
|
|
12
|
+
type PrivateEvent,
|
|
13
|
+
type PrivateEventFilter,
|
|
14
|
+
type ContractMetadata,
|
|
15
|
+
type ContractClassMetadata,
|
|
16
|
+
AppCapabilitiesSchema,
|
|
17
|
+
WalletCapabilitiesSchema,
|
|
15
18
|
FunctionCallSchema,
|
|
16
19
|
ExecutionPayloadSchema,
|
|
17
|
-
|
|
20
|
+
GasSettingsOptionSchema,
|
|
18
21
|
WalletSimulationFeeOptionSchema,
|
|
22
|
+
WaitOptsSchema,
|
|
19
23
|
SendOptionsSchema,
|
|
20
24
|
SimulateOptionsSchema,
|
|
21
25
|
ProfileOptionsSchema,
|
|
22
|
-
InstanceDataSchema,
|
|
23
26
|
MessageHashOrIntentSchema,
|
|
24
27
|
BatchedMethodSchema,
|
|
25
|
-
ContractMetadataSchema,
|
|
26
|
-
ContractClassMetadataSchema,
|
|
27
28
|
EventMetadataDefinitionSchema,
|
|
29
|
+
PrivateEventSchema,
|
|
30
|
+
PrivateEventFilterSchema,
|
|
31
|
+
ContractClassMetadataSchema,
|
|
32
|
+
ContractMetadataSchema,
|
|
28
33
|
WalletSchema,
|
|
34
|
+
ContractFunctionPatternSchema,
|
|
35
|
+
AccountsCapabilitySchema,
|
|
36
|
+
GrantedAccountsCapabilitySchema,
|
|
37
|
+
ContractsCapabilitySchema,
|
|
38
|
+
GrantedContractsCapabilitySchema,
|
|
39
|
+
ContractClassesCapabilitySchema,
|
|
40
|
+
GrantedContractClassesCapabilitySchema,
|
|
41
|
+
SimulationCapabilitySchema,
|
|
42
|
+
GrantedSimulationCapabilitySchema,
|
|
43
|
+
TransactionCapabilitySchema,
|
|
44
|
+
GrantedTransactionCapabilitySchema,
|
|
45
|
+
DataCapabilitySchema,
|
|
46
|
+
GrantedDataCapabilitySchema,
|
|
47
|
+
CapabilitySchema,
|
|
48
|
+
GrantedCapabilitySchema,
|
|
29
49
|
} from '../wallet/wallet.js';
|
|
30
50
|
|
|
31
|
-
export {
|
|
51
|
+
export {
|
|
52
|
+
type AppCapabilities,
|
|
53
|
+
type WalletCapabilities,
|
|
54
|
+
CAPABILITY_VERSION,
|
|
55
|
+
type Capability,
|
|
56
|
+
type GrantedCapability,
|
|
57
|
+
type ContractFunctionPattern,
|
|
58
|
+
type AccountsCapability,
|
|
59
|
+
type GrantedAccountsCapability,
|
|
60
|
+
type ContractsCapability,
|
|
61
|
+
type GrantedContractsCapability,
|
|
62
|
+
type ContractClassesCapability,
|
|
63
|
+
type GrantedContractClassesCapability,
|
|
64
|
+
type SimulationCapability,
|
|
65
|
+
type GrantedSimulationCapability,
|
|
66
|
+
type TransactionCapability,
|
|
67
|
+
type GrantedTransactionCapability,
|
|
68
|
+
type DataCapability,
|
|
69
|
+
type GrantedDataCapability,
|
|
70
|
+
} from '../wallet/capabilities.js';
|
|
32
71
|
|
|
33
72
|
export { AccountManager } from '../wallet/account_manager.js';
|
|
34
73
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FieldReader } from '@aztec/foundation/serialize';
|
|
3
3
|
import { AuthorizationSelector, FunctionSelector } from '@aztec/stdlib/abi';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
2
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
-
import type { Capsule } from '@aztec/stdlib/tx';
|
|
3
|
+
import type { Capsule, ExecutionPayload, TxReceipt } from '@aztec/stdlib/tx';
|
|
5
4
|
|
|
6
5
|
import type { Wallet } from '../wallet/wallet.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import {
|
|
7
|
+
type InteractionWaitOptions,
|
|
8
|
+
type RequestInteractionOptions,
|
|
9
|
+
type SendInteractionOptions,
|
|
10
|
+
type SendInteractionOptionsWithoutWait,
|
|
11
|
+
type SendReturn,
|
|
12
|
+
toSendOptions,
|
|
13
|
+
} from './interaction_options.js';
|
|
9
14
|
|
|
10
15
|
/**
|
|
11
16
|
* Base class for an interaction with a contract, be it a deployment, a function call, or a batch.
|
|
@@ -31,20 +36,26 @@ export abstract class BaseContractInteraction {
|
|
|
31
36
|
// docs:start:send
|
|
32
37
|
/**
|
|
33
38
|
* Sends a transaction to the contract function with the specified options.
|
|
34
|
-
*
|
|
35
|
-
* It creates and signs the transaction if necessary, and returns a SentTx instance,
|
|
36
|
-
* which can be used to track the transaction status, receipt, and events.
|
|
39
|
+
* By default, waits for the transaction to be mined and returns the receipt (or custom type).
|
|
37
40
|
* @param options - An object containing 'from' property representing
|
|
38
|
-
* the AztecAddress of the sender and optional
|
|
39
|
-
* @returns
|
|
41
|
+
* the AztecAddress of the sender, optional fee configuration, and optional wait settings
|
|
42
|
+
* @returns TReturn (if wait is undefined/WaitOpts) or TxHash (if wait is NO_WAIT)
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
// Overload for when wait is not specified at all - returns TReturn
|
|
45
|
+
public send<TReturn = TxReceipt>(options: SendInteractionOptionsWithoutWait): Promise<TReturn>;
|
|
46
|
+
// Generic overload for explicit wait values
|
|
47
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
48
|
+
public send<TReturn = TxReceipt, W extends InteractionWaitOptions = undefined>(
|
|
49
|
+
options: SendInteractionOptions<W>,
|
|
50
|
+
): Promise<SendReturn<W, TReturn>>;
|
|
51
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
52
|
+
public async send<TReturn = TxReceipt>(
|
|
53
|
+
options: SendInteractionOptions<InteractionWaitOptions>,
|
|
54
|
+
): Promise<SendReturn<typeof options.wait, TReturn>> {
|
|
42
55
|
// docs:end:send
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
return new SentTx(this.wallet, sendTx);
|
|
56
|
+
const executionPayload = await this.request(options);
|
|
57
|
+
const sendOptions = toSendOptions(options);
|
|
58
|
+
|
|
59
|
+
return (await this.wallet.sendTx(executionPayload, sendOptions as any)) as SendReturn<typeof options.wait, TReturn>;
|
|
49
60
|
}
|
|
50
61
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
|
|
2
1
|
import { type FunctionCall, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import {
|
|
3
|
+
ExecutionPayload,
|
|
4
|
+
TxSimulationResult,
|
|
5
|
+
UtilitySimulationResult,
|
|
6
|
+
mergeExecutionPayloads,
|
|
7
|
+
} from '@aztec/stdlib/tx';
|
|
3
8
|
|
|
4
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
9
|
+
import type { BatchedMethod, Wallet } from '../wallet/wallet.js';
|
|
5
10
|
import { BaseContractInteraction } from './base_contract_interaction.js';
|
|
6
11
|
import {
|
|
7
12
|
type RequestInteractionOptions,
|
|
@@ -10,6 +15,7 @@ import {
|
|
|
10
15
|
} from './interaction_options.js';
|
|
11
16
|
|
|
12
17
|
/** A batch of function calls to be sent as a single transaction through a wallet. */
|
|
18
|
+
// docs:start:batch_call_class
|
|
13
19
|
export class BatchCall extends BaseContractInteraction {
|
|
14
20
|
constructor(
|
|
15
21
|
wallet: Wallet,
|
|
@@ -17,6 +23,7 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
17
23
|
) {
|
|
18
24
|
super(wallet);
|
|
19
25
|
}
|
|
26
|
+
// docs:end:batch_call_class
|
|
20
27
|
|
|
21
28
|
/**
|
|
22
29
|
* Returns an execution request that represents this operation.
|
|
@@ -35,13 +42,12 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* @
|
|
44
|
-
* @returns The result of the transaction as returned by the contract function.
|
|
45
|
+
* Simulates the batch, supporting private, public and utility functions. Although this is a single
|
|
46
|
+
* interaction with the wallet, private and public functions will be grouped into a single ExecutionPayload
|
|
47
|
+
* that the wallet will simulate as a single transaction. Utility function calls will simply be executed
|
|
48
|
+
* one by one.
|
|
49
|
+
* @param options - An optional object containing additional configuration for the interaction.
|
|
50
|
+
* @returns The results of all the interactions that make up the batch
|
|
45
51
|
*/
|
|
46
52
|
public async simulate(options: SimulateInteractionOptions): Promise<any> {
|
|
47
53
|
const { indexedExecutionPayloads, utility } = (await this.getExecutionPayloads()).reduce<{
|
|
@@ -70,52 +76,65 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
70
76
|
{ indexedExecutionPayloads: [], utility: [], publicIndex: 0, privateIndex: 0 },
|
|
71
77
|
);
|
|
72
78
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const batchRequests: BatchedMethod[] = [];
|
|
80
|
+
|
|
81
|
+
// Add utility calls to batch
|
|
82
|
+
for (const [call] of utility) {
|
|
83
|
+
batchRequests.push({
|
|
84
|
+
name: 'simulateUtility' as const,
|
|
85
|
+
args: [call, options?.authWitnesses],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
// Add tx simulation to batch if there are any private/public calls
|
|
90
|
+
if (indexedExecutionPayloads.length > 0) {
|
|
91
|
+
const payloads = indexedExecutionPayloads.map(([request]) => request);
|
|
92
|
+
const combinedPayload = mergeExecutionPayloads(payloads);
|
|
93
|
+
const executionPayload = new ExecutionPayload(
|
|
94
|
+
combinedPayload.calls,
|
|
95
|
+
combinedPayload.authWitnesses.concat(options.authWitnesses ?? []),
|
|
96
|
+
combinedPayload.capsules.concat(options.capsules ?? []),
|
|
97
|
+
combinedPayload.extraHashedArgs,
|
|
98
|
+
);
|
|
91
99
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
batchRequests.push({
|
|
101
|
+
name: 'simulateTx' as const,
|
|
102
|
+
args: [executionPayload, toSimulateOptions(options)],
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const batchResults = batchRequests.length > 0 ? await this.wallet.batch(batchRequests) : [];
|
|
98
107
|
|
|
99
108
|
const results: any[] = [];
|
|
100
109
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
// Process utility results (they come first in batch results)
|
|
111
|
+
for (let i = 0; i < utility.length; i++) {
|
|
112
|
+
const [call, resultIndex] = utility[i];
|
|
113
|
+
const wrappedResult = batchResults[i];
|
|
114
|
+
if (wrappedResult.name === 'simulateUtility') {
|
|
115
|
+
const rawReturnValues = (wrappedResult.result as UtilitySimulationResult).result;
|
|
116
|
+
results[resultIndex] = rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
105
119
|
|
|
106
|
-
if
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
// Process tx simulation result (it comes last if present)
|
|
121
|
+
if (indexedExecutionPayloads.length > 0) {
|
|
122
|
+
const txResultWrapper = batchResults[utility.length];
|
|
123
|
+
if (txResultWrapper.name === 'simulateTx') {
|
|
124
|
+
const simulatedTx = txResultWrapper.result as TxSimulationResult;
|
|
125
|
+
indexedExecutionPayloads.forEach(([request, callIndex, resultIndex]) => {
|
|
126
|
+
const call = request.calls[0];
|
|
127
|
+
// As account entrypoints are private, for private functions we retrieve the return values from the first nested call
|
|
128
|
+
// since we're interested in the first set of values AFTER the account entrypoint
|
|
129
|
+
// For public functions we retrieve the first values directly from the public output.
|
|
130
|
+
const rawReturnValues =
|
|
131
|
+
call.type == FunctionType.PRIVATE
|
|
132
|
+
? simulatedTx.getPrivateReturnValues()?.nested?.[resultIndex].values
|
|
133
|
+
: simulatedTx.getPublicReturnValues()?.[resultIndex].values;
|
|
116
134
|
|
|
117
|
-
|
|
118
|
-
|
|
135
|
+
results[callIndex] = rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [];
|
|
136
|
+
});
|
|
137
|
+
}
|
|
119
138
|
}
|
|
120
139
|
|
|
121
140
|
return results;
|