@aztec/aztec.js 0.81.0 → 0.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/account/{contract.d.ts → account_contract.d.ts} +3 -2
- package/dest/account/account_contract.d.ts.map +1 -0
- package/dest/account/index.d.ts +2 -3
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +1 -2
- package/dest/account/interface.d.ts +1 -13
- package/dest/account/interface.d.ts.map +1 -1
- package/dest/account/interface.js +1 -0
- package/dest/account_manager/account_manager.d.ts +105 -0
- package/dest/account_manager/account_manager.d.ts.map +1 -0
- package/dest/account_manager/account_manager.js +165 -0
- package/dest/account_manager/deploy_account_method.d.ts +4 -4
- package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_method.js +28 -13
- package/dest/account_manager/deploy_account_sent_tx.d.ts +3 -3
- package/dest/account_manager/deploy_account_sent_tx.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_sent_tx.js +2 -2
- package/dest/account_manager/index.d.ts +1 -104
- package/dest/account_manager/index.d.ts.map +1 -1
- package/dest/account_manager/index.js +1 -165
- package/dest/api/account.d.ts +2 -1
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/contract.d.ts +4 -1
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +3 -0
- package/dest/api/fee.d.ts +1 -1
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/utils.d.ts +2 -1
- package/dest/api/utils.d.ts.map +1 -1
- package/dest/api/utils.js +2 -1
- package/dest/api/wallet.d.ts +1 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.d.ts +22 -57
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +12 -67
- package/dest/contract/batch_call.d.ts +6 -18
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +25 -54
- package/dest/contract/contract.d.ts +1 -1
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract_base.d.ts +1 -1
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.d.ts +38 -18
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +34 -41
- package/dest/contract/deploy_method.d.ts +7 -8
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +27 -32
- package/dest/contract/deploy_proven_tx.d.ts +2 -3
- package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.d.ts +2 -3
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +4 -4
- package/dest/contract/protocol_contracts.d.ts +1 -1
- package/dest/contract/protocol_contracts.d.ts.map +1 -1
- package/dest/contract/proven_tx.d.ts +3 -4
- package/dest/contract/proven_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.d.ts +4 -16
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +6 -37
- package/dest/contract/unsafe_contract.d.ts +1 -1
- package/dest/contract/unsafe_contract.d.ts.map +1 -1
- package/dest/contract/wait_for_proven.d.ts +17 -0
- package/dest/contract/wait_for_proven.d.ts.map +1 -0
- package/dest/contract/wait_for_proven.js +17 -0
- package/dest/deployment/broadcast_function.js +12 -8
- package/dest/deployment/contract_deployer.d.ts +1 -1
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/register_class.d.ts +1 -1
- package/dest/deployment/register_class.d.ts.map +1 -1
- package/dest/deployment/register_class.js +6 -11
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts +3 -2
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/default_multi_call_entrypoint.js +12 -8
- package/dest/ethereum/portal_manager.d.ts +20 -11
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +64 -30
- package/dest/fee/fee_juice_payment_method.d.ts +3 -3
- package/dest/fee/fee_juice_payment_method.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method.js +3 -2
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +4 -4
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +6 -5
- package/dest/fee/private_fee_payment_method.d.ts +6 -6
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +13 -12
- package/dest/fee/public_fee_payment_method.d.ts +7 -7
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +10 -11
- package/dest/fee/utils.d.ts +13 -0
- package/dest/fee/utils.d.ts.map +1 -0
- package/dest/fee/utils.js +32 -0
- package/dest/utils/authwit.d.ts +16 -9
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +26 -35
- package/dest/wallet/account_wallet.d.ts +6 -6
- package/dest/wallet/account_wallet.d.ts.map +1 -1
- package/dest/wallet/account_wallet.js +15 -17
- package/dest/wallet/base_wallet.d.ts +12 -35
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +11 -64
- 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/signerless_wallet.d.ts +3 -3
- package/dest/wallet/signerless_wallet.d.ts.map +1 -1
- package/dest/wallet/signerless_wallet.js +3 -6
- package/dest/wallet/wallet.d.ts +11 -0
- package/dest/wallet/wallet.d.ts.map +1 -0
- package/package.json +8 -7
- package/src/account/{contract.ts → account_contract.ts} +2 -1
- package/src/account/index.ts +2 -3
- package/src/account/interface.ts +1 -12
- package/src/account_manager/account_manager.ts +235 -0
- package/src/account_manager/deploy_account_method.ts +35 -15
- package/src/account_manager/deploy_account_sent_tx.ts +4 -4
- package/src/account_manager/index.ts +1 -236
- package/src/api/account.ts +2 -8
- package/src/api/contract.ts +5 -5
- package/src/api/fee.ts +1 -1
- package/src/api/utils.ts +1 -1
- package/src/api/wallet.ts +7 -1
- package/src/contract/base_contract_interaction.ts +32 -88
- package/src/contract/batch_call.ts +40 -43
- package/src/contract/contract.ts +1 -1
- package/src/contract/contract_base.ts +1 -1
- package/src/contract/contract_function_interaction.ts +85 -56
- package/src/contract/deploy_method.ts +24 -26
- package/src/contract/deploy_proven_tx.ts +2 -3
- package/src/contract/deploy_sent_tx.ts +6 -6
- package/src/contract/protocol_contracts.ts +1 -1
- package/src/contract/proven_tx.ts +2 -3
- package/src/contract/sent_tx.ts +6 -47
- package/src/contract/unsafe_contract.ts +1 -1
- package/src/contract/wait_for_proven.ts +38 -0
- package/src/deployment/broadcast_function.ts +40 -40
- package/src/deployment/contract_deployer.ts +1 -1
- package/src/deployment/register_class.ts +9 -22
- package/src/entrypoint/default_multi_call_entrypoint.ts +14 -7
- package/src/ethereum/portal_manager.ts +73 -24
- package/src/fee/fee_juice_payment_method.ts +4 -5
- package/src/fee/fee_juice_payment_method_with_claim.ts +24 -20
- package/src/fee/private_fee_payment_method.ts +29 -28
- package/src/fee/public_fee_payment_method.ts +29 -29
- package/src/fee/utils.ts +39 -0
- package/src/utils/authwit.ts +32 -35
- package/src/wallet/account_wallet.ts +18 -17
- package/src/wallet/base_wallet.ts +27 -88
- package/src/wallet/index.ts +2 -2
- package/src/wallet/signerless_wallet.ts +9 -8
- package/src/wallet/wallet.ts +34 -0
- package/dest/account/contract.d.ts.map +0 -1
- package/dest/account/wallet.d.ts +0 -11
- package/dest/account/wallet.d.ts.map +0 -1
- package/dest/api/entrypoint.d.ts +0 -2
- package/dest/api/entrypoint.d.ts.map +0 -1
- package/dest/api/entrypoint.js +0 -1
- package/dest/entrypoint/default_entrypoint.d.ts +0 -12
- package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/default_entrypoint.js +0 -28
- package/dest/entrypoint/entrypoint.d.ts +0 -39
- package/dest/entrypoint/entrypoint.d.ts.map +0 -1
- package/dest/entrypoint/entrypoint.js +0 -20
- package/dest/entrypoint/payload.d.ts +0 -128
- package/dest/entrypoint/payload.d.ts.map +0 -1
- package/dest/entrypoint/payload.js +0 -143
- package/dest/fee/fee_payment_method.d.ts +0 -22
- package/dest/fee/fee_payment_method.d.ts.map +0 -1
- package/dest/fee/fee_payment_method.js +0 -3
- package/src/account/wallet.ts +0 -13
- package/src/api/entrypoint.ts +0 -1
- package/src/entrypoint/default_entrypoint.ts +0 -39
- package/src/entrypoint/entrypoint.ts +0 -60
- package/src/entrypoint/payload.ts +0 -238
- package/src/fee/fee_payment_method.ts +0 -22
- /package/dest/account/{contract.js → account_contract.js} +0 -0
- /package/dest/{account → wallet}/wallet.js +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import type { FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
2
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
1
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
4
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
5
|
import { type ABIParameterVisibility, type FunctionAbi, FunctionType } from '@aztec/stdlib/abi';
|
|
4
|
-
import
|
|
6
|
+
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
5
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
8
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
7
9
|
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
8
10
|
|
|
9
11
|
import type { AccountInterface } from '../account/interface.js';
|
|
10
12
|
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
11
|
-
import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
12
13
|
import {
|
|
13
14
|
type IntentAction,
|
|
14
15
|
type IntentInnerHash,
|
|
@@ -22,11 +23,15 @@ import { BaseWallet } from './base_wallet.js';
|
|
|
22
23
|
*/
|
|
23
24
|
export class AccountWallet extends BaseWallet {
|
|
24
25
|
constructor(pxe: PXE, protected account: AccountInterface) {
|
|
25
|
-
super(pxe
|
|
26
|
+
super(pxe);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
createTxExecutionRequest(
|
|
29
|
-
|
|
29
|
+
createTxExecutionRequest(
|
|
30
|
+
exec: ExecutionPayload,
|
|
31
|
+
fee: FeeOptions,
|
|
32
|
+
options: TxExecutionOptions,
|
|
33
|
+
): Promise<TxExecutionRequest> {
|
|
34
|
+
return this.account.createTxExecutionRequest(exec, fee, options);
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
getChainId(): Fr {
|
|
@@ -37,10 +42,6 @@ export class AccountWallet extends BaseWallet {
|
|
|
37
42
|
return this.account.getVersion();
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
override isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean> {
|
|
41
|
-
return this.pxe.isL1ToL2MessageSynced(l1ToL2Message);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
45
|
/**
|
|
45
46
|
* Computes an authentication witness from either a message hash or an intent.
|
|
46
47
|
*
|
|
@@ -61,9 +62,7 @@ export class AccountWallet extends BaseWallet {
|
|
|
61
62
|
messageHash = await this.getMessageHash(messageHashOrIntent);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
await this.pxe.addAuthWitness(witness);
|
|
66
|
-
return witness;
|
|
65
|
+
return this.account.createAuthWit(messageHash);
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
/**
|
|
@@ -132,12 +131,13 @@ export class AccountWallet extends BaseWallet {
|
|
|
132
131
|
*
|
|
133
132
|
* @param onBehalfOf - The address of the "approver"
|
|
134
133
|
* @param intent - The consumer and inner hash or the caller and action to lookup
|
|
135
|
-
*
|
|
134
|
+
* @param witness - The computed authentication witness to check
|
|
136
135
|
* @returns - A struct containing the validity of the authwit in private and public contexts.
|
|
137
136
|
*/
|
|
138
137
|
async lookupValidity(
|
|
139
138
|
onBehalfOf: AztecAddress,
|
|
140
139
|
intent: IntentInnerHash | IntentAction,
|
|
140
|
+
witness: AuthWitness,
|
|
141
141
|
): Promise<{
|
|
142
142
|
/** boolean flag indicating if the authwit is valid in private context */
|
|
143
143
|
isValidInPrivate: boolean;
|
|
@@ -150,13 +150,14 @@ export class AccountWallet extends BaseWallet {
|
|
|
150
150
|
const results = { isValidInPrivate: false, isValidInPublic: false };
|
|
151
151
|
|
|
152
152
|
// Check private
|
|
153
|
-
|
|
154
|
-
if (witness !== undefined) {
|
|
153
|
+
try {
|
|
155
154
|
results.isValidInPrivate = (await new ContractFunctionInteraction(this, onBehalfOf, this.getLookupValidityAbi(), [
|
|
156
155
|
consumer,
|
|
157
156
|
innerHash,
|
|
158
|
-
]).simulate()) as boolean;
|
|
159
|
-
|
|
157
|
+
]).simulate({ authWitnesses: [witness] })) as boolean;
|
|
158
|
+
// TODO: Narrow down the error to make sure simulation failed due to an invalid authwit
|
|
159
|
+
// eslint-disable-next-line no-empty
|
|
160
|
+
} catch {}
|
|
160
161
|
|
|
161
162
|
// check public
|
|
162
163
|
results.isValidInPublic = (await new ContractFunctionInteraction(
|
|
@@ -1,44 +1,37 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
2
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
3
|
import type { Fr, Point } from '@aztec/foundation/fields';
|
|
3
|
-
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
4
4
|
import type { AbiDecoded, ContractArtifact } from '@aztec/stdlib/abi';
|
|
5
5
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
6
6
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import type {
|
|
8
|
-
import type { CompleteAddress, ContractInstanceWithAddress, NodeInfo, PartialAddress } from '@aztec/stdlib/contract';
|
|
7
|
+
import type { CompleteAddress, ContractInstanceWithAddress, NodeInfo } from '@aztec/stdlib/contract';
|
|
9
8
|
import type { GasFees } from '@aztec/stdlib/gas';
|
|
10
9
|
import type {
|
|
11
10
|
ContractClassMetadata,
|
|
12
11
|
ContractMetadata,
|
|
13
12
|
EventMetadataDefinition,
|
|
14
|
-
GetContractClassLogsResponse,
|
|
15
|
-
GetPublicLogsResponse,
|
|
16
13
|
PXE,
|
|
17
14
|
PXEInfo,
|
|
18
15
|
} from '@aztec/stdlib/interfaces/client';
|
|
19
|
-
import type { LogFilter } from '@aztec/stdlib/logs';
|
|
20
|
-
import type { NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
21
16
|
import type {
|
|
22
17
|
PrivateExecutionResult,
|
|
23
18
|
Tx,
|
|
24
19
|
TxExecutionRequest,
|
|
25
20
|
TxHash,
|
|
21
|
+
TxProfileResult,
|
|
26
22
|
TxProvingResult,
|
|
27
23
|
TxReceipt,
|
|
28
24
|
TxSimulationResult,
|
|
29
25
|
} from '@aztec/stdlib/tx';
|
|
30
26
|
|
|
31
|
-
import type { Wallet } from '../account/wallet.js';
|
|
32
|
-
import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
33
27
|
import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
|
|
28
|
+
import type { Wallet } from './wallet.js';
|
|
34
29
|
|
|
35
30
|
/**
|
|
36
31
|
* A base class for Wallet implementations
|
|
37
32
|
*/
|
|
38
33
|
export abstract class BaseWallet implements Wallet {
|
|
39
|
-
constructor(protected readonly pxe: PXE
|
|
40
|
-
|
|
41
|
-
abstract isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean>;
|
|
34
|
+
constructor(protected readonly pxe: PXE) {}
|
|
42
35
|
|
|
43
36
|
abstract getCompleteAddress(): CompleteAddress;
|
|
44
37
|
|
|
@@ -46,30 +39,18 @@ export abstract class BaseWallet implements Wallet {
|
|
|
46
39
|
|
|
47
40
|
abstract getVersion(): Fr;
|
|
48
41
|
|
|
49
|
-
abstract createTxExecutionRequest(
|
|
42
|
+
abstract createTxExecutionRequest(
|
|
43
|
+
exec: ExecutionPayload,
|
|
44
|
+
fee: FeeOptions,
|
|
45
|
+
options: TxExecutionOptions,
|
|
46
|
+
): Promise<TxExecutionRequest>;
|
|
50
47
|
|
|
51
48
|
abstract createAuthWit(intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness>;
|
|
52
49
|
|
|
53
|
-
setScopes(scopes: AztecAddress[]) {
|
|
54
|
-
this.scopes = scopes;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
getScopes() {
|
|
58
|
-
return this.scopes;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
50
|
getAddress() {
|
|
62
51
|
return this.getCompleteAddress().address;
|
|
63
52
|
}
|
|
64
|
-
|
|
65
|
-
return this.pxe.storeCapsule(contract, storageSlot, capsule);
|
|
66
|
-
}
|
|
67
|
-
registerAccount(secretKey: Fr, partialAddress: PartialAddress): Promise<CompleteAddress> {
|
|
68
|
-
return this.pxe.registerAccount(secretKey, partialAddress);
|
|
69
|
-
}
|
|
70
|
-
getRegisteredAccounts(): Promise<CompleteAddress[]> {
|
|
71
|
-
return this.pxe.getRegisteredAccounts();
|
|
72
|
-
}
|
|
53
|
+
|
|
73
54
|
registerSender(address: AztecAddress): Promise<AztecAddress> {
|
|
74
55
|
return this.pxe.registerSender(address);
|
|
75
56
|
}
|
|
@@ -91,48 +72,28 @@ export abstract class BaseWallet implements Wallet {
|
|
|
91
72
|
updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void> {
|
|
92
73
|
return this.pxe.updateContract(contractAddress, artifact);
|
|
93
74
|
}
|
|
94
|
-
getContracts(): Promise<AztecAddress[]> {
|
|
95
|
-
return this.pxe.getContracts();
|
|
96
|
-
}
|
|
97
75
|
proveTx(txRequest: TxExecutionRequest, privateExecutionResult: PrivateExecutionResult): Promise<TxProvingResult> {
|
|
98
76
|
return this.pxe.proveTx(txRequest, privateExecutionResult);
|
|
99
77
|
}
|
|
78
|
+
profileTx(
|
|
79
|
+
txRequest: TxExecutionRequest,
|
|
80
|
+
profileMode: 'gates' | 'execution-steps' | 'full',
|
|
81
|
+
msgSender?: AztecAddress,
|
|
82
|
+
): Promise<TxProfileResult> {
|
|
83
|
+
return this.pxe.profileTx(txRequest, profileMode, msgSender);
|
|
84
|
+
}
|
|
100
85
|
simulateTx(
|
|
101
86
|
txRequest: TxExecutionRequest,
|
|
102
87
|
simulatePublic: boolean,
|
|
103
88
|
msgSender?: AztecAddress,
|
|
104
89
|
skipTxValidation?: boolean,
|
|
105
90
|
skipFeeEnforcement?: boolean,
|
|
106
|
-
profile?: boolean,
|
|
107
91
|
): Promise<TxSimulationResult> {
|
|
108
|
-
return this.pxe.simulateTx(
|
|
109
|
-
txRequest,
|
|
110
|
-
simulatePublic,
|
|
111
|
-
msgSender,
|
|
112
|
-
skipTxValidation,
|
|
113
|
-
skipFeeEnforcement,
|
|
114
|
-
profile,
|
|
115
|
-
this.scopes,
|
|
116
|
-
);
|
|
92
|
+
return this.pxe.simulateTx(txRequest, simulatePublic, msgSender, skipTxValidation, skipFeeEnforcement);
|
|
117
93
|
}
|
|
118
94
|
sendTx(tx: Tx): Promise<TxHash> {
|
|
119
95
|
return this.pxe.sendTx(tx);
|
|
120
96
|
}
|
|
121
|
-
getTxEffect(txHash: TxHash) {
|
|
122
|
-
return this.pxe.getTxEffect(txHash);
|
|
123
|
-
}
|
|
124
|
-
getTxReceipt(txHash: TxHash): Promise<TxReceipt> {
|
|
125
|
-
return this.pxe.getTxReceipt(txHash);
|
|
126
|
-
}
|
|
127
|
-
getNotes(filter: NotesFilter): Promise<UniqueNote[]> {
|
|
128
|
-
return this.pxe.getNotes(filter);
|
|
129
|
-
}
|
|
130
|
-
getPublicStorageAt(contract: AztecAddress, storageSlot: Fr): Promise<any> {
|
|
131
|
-
return this.pxe.getPublicStorageAt(contract, storageSlot);
|
|
132
|
-
}
|
|
133
|
-
getBlock(number: number): Promise<L2Block | undefined> {
|
|
134
|
-
return this.pxe.getBlock(number);
|
|
135
|
-
}
|
|
136
97
|
getCurrentBaseFees(): Promise<GasFees> {
|
|
137
98
|
return this.pxe.getCurrentBaseFees();
|
|
138
99
|
}
|
|
@@ -140,31 +101,14 @@ export abstract class BaseWallet implements Wallet {
|
|
|
140
101
|
functionName: string,
|
|
141
102
|
args: any[],
|
|
142
103
|
to: AztecAddress,
|
|
104
|
+
authwits?: AuthWitness[],
|
|
143
105
|
from?: AztecAddress | undefined,
|
|
144
106
|
): Promise<AbiDecoded> {
|
|
145
|
-
return this.pxe.simulateUnconstrained(functionName, args, to, from);
|
|
146
|
-
}
|
|
147
|
-
getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse> {
|
|
148
|
-
return this.pxe.getPublicLogs(filter);
|
|
149
|
-
}
|
|
150
|
-
getContractClassLogs(filter: LogFilter): Promise<GetContractClassLogsResponse> {
|
|
151
|
-
return this.pxe.getContractClassLogs(filter);
|
|
152
|
-
}
|
|
153
|
-
getBlockNumber(): Promise<number> {
|
|
154
|
-
return this.pxe.getBlockNumber();
|
|
155
|
-
}
|
|
156
|
-
getProvenBlockNumber(): Promise<number> {
|
|
157
|
-
return this.pxe.getProvenBlockNumber();
|
|
107
|
+
return this.pxe.simulateUnconstrained(functionName, args, to, authwits, from);
|
|
158
108
|
}
|
|
159
109
|
getNodeInfo(): Promise<NodeInfo> {
|
|
160
110
|
return this.pxe.getNodeInfo();
|
|
161
111
|
}
|
|
162
|
-
addAuthWitness(authWitness: AuthWitness) {
|
|
163
|
-
return this.pxe.addAuthWitness(authWitness);
|
|
164
|
-
}
|
|
165
|
-
getAuthWitness(messageHash: Fr) {
|
|
166
|
-
return this.pxe.getAuthWitness(messageHash);
|
|
167
|
-
}
|
|
168
112
|
getPXEInfo(): Promise<PXEInfo> {
|
|
169
113
|
return this.pxe.getPXEInfo();
|
|
170
114
|
}
|
|
@@ -174,6 +118,11 @@ export abstract class BaseWallet implements Wallet {
|
|
|
174
118
|
getContractMetadata(address: AztecAddress): Promise<ContractMetadata> {
|
|
175
119
|
return this.pxe.getContractMetadata(address);
|
|
176
120
|
}
|
|
121
|
+
|
|
122
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt> {
|
|
123
|
+
return this.pxe.getTxReceipt(txHash);
|
|
124
|
+
}
|
|
125
|
+
|
|
177
126
|
getPrivateEvents<T>(
|
|
178
127
|
event: EventMetadataDefinition,
|
|
179
128
|
from: number,
|
|
@@ -185,14 +134,4 @@ export abstract class BaseWallet implements Wallet {
|
|
|
185
134
|
getPublicEvents<T>(event: EventMetadataDefinition, from: number, limit: number): Promise<T[]> {
|
|
186
135
|
return this.pxe.getPublicEvents(event, from, limit);
|
|
187
136
|
}
|
|
188
|
-
public getL1ToL2MembershipWitness(
|
|
189
|
-
contractAddress: AztecAddress,
|
|
190
|
-
messageHash: Fr,
|
|
191
|
-
secret: Fr,
|
|
192
|
-
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>]> {
|
|
193
|
-
return this.pxe.getL1ToL2MembershipWitness(contractAddress, messageHash, secret);
|
|
194
|
-
}
|
|
195
|
-
getL2ToL1MembershipWitness(blockNumber: number, l2Tol1Message: Fr): Promise<[bigint, SiblingPath<number>]> {
|
|
196
|
-
return this.pxe.getL2ToL1MembershipWitness(blockNumber, l2Tol1Message);
|
|
197
|
-
}
|
|
198
137
|
}
|
package/src/wallet/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
3
|
|
|
4
|
-
import type { AccountContract } from '../account/
|
|
4
|
+
import type { AccountContract } from '../account/account_contract.js';
|
|
5
5
|
import { AccountWallet } from './account_wallet.js';
|
|
6
6
|
|
|
7
|
-
export * from '
|
|
7
|
+
export * from './wallet.js';
|
|
8
8
|
export * from './account_wallet.js';
|
|
9
9
|
export * from './account_wallet_with_private_key.js';
|
|
10
10
|
export * from './signerless_wallet.js';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
2
|
+
import type { EntrypointInterface, FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
|
|
3
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
1
4
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
5
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
3
6
|
import type { CompleteAddress } from '@aztec/stdlib/contract';
|
|
4
7
|
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
5
8
|
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
6
9
|
|
|
7
|
-
import { DefaultEntrypoint } from '../entrypoint/default_entrypoint.js';
|
|
8
|
-
import type { EntrypointInterface, ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
9
10
|
import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
|
|
10
11
|
import { BaseWallet } from './base_wallet.js';
|
|
11
12
|
|
|
@@ -16,14 +17,18 @@ export class SignerlessWallet extends BaseWallet {
|
|
|
16
17
|
constructor(pxe: PXE, private entrypoint?: EntrypointInterface) {
|
|
17
18
|
super(pxe);
|
|
18
19
|
}
|
|
19
|
-
async createTxExecutionRequest(
|
|
20
|
+
async createTxExecutionRequest(
|
|
21
|
+
execution: ExecutionPayload,
|
|
22
|
+
fee: FeeOptions,
|
|
23
|
+
options: TxExecutionOptions,
|
|
24
|
+
): Promise<TxExecutionRequest> {
|
|
20
25
|
let entrypoint = this.entrypoint;
|
|
21
26
|
if (!entrypoint) {
|
|
22
27
|
const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo();
|
|
23
28
|
entrypoint = new DefaultEntrypoint(chainId, protocolVersion);
|
|
24
29
|
}
|
|
25
30
|
|
|
26
|
-
return entrypoint.createTxExecutionRequest(execution);
|
|
31
|
+
return entrypoint.createTxExecutionRequest(execution, fee, options);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
getChainId(): Fr {
|
|
@@ -45,8 +50,4 @@ export class SignerlessWallet extends BaseWallet {
|
|
|
45
50
|
createAuthWit(_intent: Fr | Buffer | IntentInnerHash | IntentAction): Promise<AuthWitness> {
|
|
46
51
|
throw new Error('SignerlessWallet: Method createAuthWit not implemented.');
|
|
47
52
|
}
|
|
48
|
-
|
|
49
|
-
override isL1ToL2MessageSynced(l1ToL2Message: Fr): Promise<boolean> {
|
|
50
|
-
return this.pxe.isL1ToL2MessageSynced(l1ToL2Message);
|
|
51
|
-
}
|
|
52
53
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
2
|
+
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
|
|
4
|
+
import type { AccountInterface } from '../account/interface.js';
|
|
5
|
+
import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The wallet interface.
|
|
9
|
+
*/
|
|
10
|
+
export type Wallet = AccountInterface &
|
|
11
|
+
Pick<
|
|
12
|
+
PXE,
|
|
13
|
+
| 'simulateTx'
|
|
14
|
+
| 'simulateUnconstrained'
|
|
15
|
+
| 'profileTx'
|
|
16
|
+
| 'sendTx'
|
|
17
|
+
| 'getContractClassMetadata'
|
|
18
|
+
| 'getContractMetadata'
|
|
19
|
+
| 'registerContract'
|
|
20
|
+
| 'registerContractClass'
|
|
21
|
+
| 'proveTx'
|
|
22
|
+
| 'getNodeInfo'
|
|
23
|
+
| 'getPXEInfo'
|
|
24
|
+
| 'getCurrentBaseFees'
|
|
25
|
+
| 'updateContract'
|
|
26
|
+
| 'registerSender'
|
|
27
|
+
| 'getSenders'
|
|
28
|
+
| 'removeSender'
|
|
29
|
+
| 'getTxReceipt'
|
|
30
|
+
| 'getPrivateEvents'
|
|
31
|
+
| 'getPublicEvents'
|
|
32
|
+
> & {
|
|
33
|
+
createAuthWit(intent: IntentInnerHash | IntentAction): Promise<AuthWitness>;
|
|
34
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/account/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG5E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEjD;;OAEG;IACH,4BAA4B,IAAI,OAAO,CACnC;QACE,2DAA2D;QAC3D,eAAe,EAAE,MAAM,CAAC;QACxB,2DAA2D;QAC3D,eAAe,EAAE,GAAG,EAAE,CAAC;KACxB,GACD,SAAS,CACZ,CAAC;IAEF;;;;;;;OAOG;IACH,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IAE7E;;;OAGG;IACH,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB,CAAC;CACvE;AAGD;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,+CAcrG"}
|
package/dest/account/wallet.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
2
|
-
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
|
-
import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
|
|
4
|
-
import type { AccountInterface } from './interface.js';
|
|
5
|
-
/**
|
|
6
|
-
* The wallet interface.
|
|
7
|
-
*/
|
|
8
|
-
export type Wallet = AccountInterface & PXE & {
|
|
9
|
-
createAuthWit(intent: IntentInnerHash | IntentAction): Promise<AuthWitness>;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/account/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,gBAAgB,GACnC,GAAG,GAAG;IACJ,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC7E,CAAC"}
|
package/dest/api/entrypoint.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../src/api/entrypoint.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
|
package/dest/api/entrypoint.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../entrypoint/entrypoint.js';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
2
|
-
import type { EntrypointInterface, ExecutionRequestInit } from './entrypoint.js';
|
|
3
|
-
/**
|
|
4
|
-
* Default implementation of the entrypoint interface. It calls a function on a contract directly
|
|
5
|
-
*/
|
|
6
|
-
export declare class DefaultEntrypoint implements EntrypointInterface {
|
|
7
|
-
private chainId;
|
|
8
|
-
private protocolVersion;
|
|
9
|
-
constructor(chainId: number, protocolVersion: number);
|
|
10
|
-
createTxExecutionRequest(exec: ExecutionRequestInit): Promise<TxExecutionRequest>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=default_entrypoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default_entrypoint.d.ts","sourceRoot":"","sources":["../../src/entrypoint/default_entrypoint.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEjF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,mBAAmB;IAC/C,OAAO,CAAC,OAAO;IAAU,OAAO,CAAC,eAAe;gBAAxC,OAAO,EAAE,MAAM,EAAU,eAAe,EAAE,MAAM;IAE9D,wBAAwB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2BxF"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { FunctionType } from '@aztec/stdlib/abi';
|
|
2
|
-
import { HashedValues, TxContext, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
3
|
-
/**
|
|
4
|
-
* Default implementation of the entrypoint interface. It calls a function on a contract directly
|
|
5
|
-
*/ export class DefaultEntrypoint {
|
|
6
|
-
chainId;
|
|
7
|
-
protocolVersion;
|
|
8
|
-
constructor(chainId, protocolVersion){
|
|
9
|
-
this.chainId = chainId;
|
|
10
|
-
this.protocolVersion = protocolVersion;
|
|
11
|
-
}
|
|
12
|
-
async createTxExecutionRequest(exec) {
|
|
13
|
-
const { fee, calls, authWitnesses = [], hashedArguments = [], capsules = [] } = exec;
|
|
14
|
-
if (calls.length > 1) {
|
|
15
|
-
throw new Error(`Expected a single call, got ${calls.length}`);
|
|
16
|
-
}
|
|
17
|
-
const call = calls[0];
|
|
18
|
-
if (call.type !== FunctionType.PRIVATE) {
|
|
19
|
-
throw new Error('Public entrypoints are not allowed');
|
|
20
|
-
}
|
|
21
|
-
const entrypointHashedValues = await HashedValues.fromValues(call.args);
|
|
22
|
-
const txContext = new TxContext(this.chainId, this.protocolVersion, fee.gasSettings);
|
|
23
|
-
return Promise.resolve(new TxExecutionRequest(call.to, call.selector, entrypointHashedValues.hash, txContext, [
|
|
24
|
-
...hashedArguments,
|
|
25
|
-
entrypointHashedValues
|
|
26
|
-
], authWitnesses, capsules));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
3
|
-
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
-
import type { Capsule, HashedValues, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
5
|
-
import { EntrypointPayload, type FeeOptions, computeCombinedPayloadHash } from './payload.js';
|
|
6
|
-
export { EntrypointPayload, type FeeOptions, computeCombinedPayloadHash };
|
|
7
|
-
export { DefaultEntrypoint } from './default_entrypoint.js';
|
|
8
|
-
export { DefaultMultiCallEntrypoint } from './default_multi_call_entrypoint.js';
|
|
9
|
-
/** Encodes the calls to be done in a transaction. */
|
|
10
|
-
export type ExecutionRequestInit = {
|
|
11
|
-
/** The function calls to be executed. */
|
|
12
|
-
calls: FunctionCall[];
|
|
13
|
-
/** Any transient auth witnesses needed for this execution */
|
|
14
|
-
authWitnesses?: AuthWitness[];
|
|
15
|
-
/** Any transient hashed arguments for this execution */
|
|
16
|
-
hashedArguments?: HashedValues[];
|
|
17
|
-
/** Data passed through an oracle for this execution. */
|
|
18
|
-
capsules?: Capsule[];
|
|
19
|
-
/** How the fee is going to be payed */
|
|
20
|
-
fee: FeeOptions;
|
|
21
|
-
/** An optional nonce. Used to repeat a previous tx with a higher fee so that the first one is cancelled */
|
|
22
|
-
nonce?: Fr;
|
|
23
|
-
/** Whether the transaction can be cancelled. If true, an extra nullifier will be emitted: H(nonce, GENERATOR_INDEX__TX_NULLIFIER) */
|
|
24
|
-
cancellable?: boolean;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Merges an array of ExecutionRequestInits.
|
|
28
|
-
*/
|
|
29
|
-
export declare function mergeExecutionRequestInits(requests: Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>[], { nonce, cancellable }?: Pick<ExecutionRequestInit, 'nonce' | 'cancellable'>): Omit<ExecutionRequestInit, 'fee'>;
|
|
30
|
-
/** Creates transaction execution requests out of a set of function calls. */
|
|
31
|
-
export interface EntrypointInterface {
|
|
32
|
-
/**
|
|
33
|
-
* Generates an execution request out of set of function calls.
|
|
34
|
-
* @param execution - The execution intents to be run.
|
|
35
|
-
* @returns The authenticated transaction execution request.
|
|
36
|
-
*/
|
|
37
|
-
createTxExecutionRequest(execution: ExecutionRequestInit): Promise<TxExecutionRequest>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=entrypoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../src/entrypoint/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE9F,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,0BAA0B,EAAE,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF,qDAAqD;AACrD,MAAM,MAAM,oBAAoB,GAAG;IACjC,yCAAyC;IACzC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;IAC9B,wDAAwD;IACxD,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;IACjC,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,uCAAuC;IACvC,GAAG,EAAE,UAAU,CAAC;IAChB,2GAA2G;IAC3G,KAAK,CAAC,EAAE,EAAE,CAAC;IACX,qIAAqI;IACrI,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,eAAe,GAAG,iBAAiB,GAAG,UAAU,CAAC,EAAE,EAClG,EAAE,KAAK,EAAE,WAAW,EAAE,GAAE,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,aAAa,CAAM,GAC/E,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAanC;AAED,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,wBAAwB,CAAC,SAAS,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACxF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EntrypointPayload, computeCombinedPayloadHash } from './payload.js';
|
|
2
|
-
export { EntrypointPayload, computeCombinedPayloadHash };
|
|
3
|
-
export { DefaultEntrypoint } from './default_entrypoint.js';
|
|
4
|
-
export { DefaultMultiCallEntrypoint } from './default_multi_call_entrypoint.js';
|
|
5
|
-
/**
|
|
6
|
-
* Merges an array of ExecutionRequestInits.
|
|
7
|
-
*/ export function mergeExecutionRequestInits(requests, { nonce, cancellable } = {}) {
|
|
8
|
-
const calls = requests.map((r)=>r.calls).flat();
|
|
9
|
-
const authWitnesses = requests.map((r)=>r.authWitnesses ?? []).flat();
|
|
10
|
-
const hashedArguments = requests.map((r)=>r.hashedArguments ?? []).flat();
|
|
11
|
-
const capsules = requests.map((r)=>r.capsules ?? []).flat();
|
|
12
|
-
return {
|
|
13
|
-
calls,
|
|
14
|
-
authWitnesses,
|
|
15
|
-
hashedArguments,
|
|
16
|
-
capsules,
|
|
17
|
-
nonce,
|
|
18
|
-
cancellable
|
|
19
|
-
};
|
|
20
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type { Tuple } from '@aztec/foundation/serialize';
|
|
3
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
|
-
import { FunctionCall } from '@aztec/stdlib/abi';
|
|
5
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
7
|
-
import { HashedValues } from '@aztec/stdlib/tx';
|
|
8
|
-
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
9
|
-
/**
|
|
10
|
-
* Fee payment options for a transaction.
|
|
11
|
-
*/
|
|
12
|
-
export type FeeOptions = {
|
|
13
|
-
/** The fee payment method to use */
|
|
14
|
-
paymentMethod: FeePaymentMethod;
|
|
15
|
-
/** The gas settings */
|
|
16
|
-
gasSettings: GasSettings;
|
|
17
|
-
};
|
|
18
|
-
/** Fee options as set by a user. */
|
|
19
|
-
export type UserFeeOptions = {
|
|
20
|
-
/** The fee payment method to use */
|
|
21
|
-
paymentMethod?: FeePaymentMethod;
|
|
22
|
-
/** The gas settings */
|
|
23
|
-
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
24
|
-
/** Percentage to pad the base fee by, if empty, defaults to 0.5 */
|
|
25
|
-
baseFeePadding?: number;
|
|
26
|
-
/** Whether to run an initial simulation of the tx with high gas limit to figure out actual gas settings. */
|
|
27
|
-
estimateGas?: boolean;
|
|
28
|
-
/** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
|
|
29
|
-
estimatedGasPadding?: number;
|
|
30
|
-
};
|
|
31
|
-
/** Encoded function call for account contract entrypoint */
|
|
32
|
-
type EncodedFunctionCall = {
|
|
33
|
-
/** Arguments hash for the call */
|
|
34
|
-
args_hash: Fr;
|
|
35
|
-
/** Selector of the function to call */
|
|
36
|
-
function_selector: Fr;
|
|
37
|
-
/** Address of the contract to call */
|
|
38
|
-
target_address: Fr;
|
|
39
|
-
/** Whether the function is public or private */
|
|
40
|
-
is_public: boolean;
|
|
41
|
-
/** Whether the function can alter state */
|
|
42
|
-
is_static: boolean;
|
|
43
|
-
};
|
|
44
|
-
/** Assembles an entrypoint payload */
|
|
45
|
-
export declare abstract class EntrypointPayload {
|
|
46
|
-
private functionCalls;
|
|
47
|
-
private _hashedArguments;
|
|
48
|
-
private generatorIndex;
|
|
49
|
-
private _nonce;
|
|
50
|
-
protected constructor(functionCalls: EncodedFunctionCall[], _hashedArguments: HashedValues[], generatorIndex: number, _nonce: Fr);
|
|
51
|
-
protected static create(functionCalls: FunctionCall[]): Promise<{
|
|
52
|
-
encodedFunctionCalls: {
|
|
53
|
-
args_hash: Fr;
|
|
54
|
-
function_selector: Fr;
|
|
55
|
-
target_address: Fr;
|
|
56
|
-
is_public: boolean;
|
|
57
|
-
is_static: boolean;
|
|
58
|
-
}[];
|
|
59
|
-
hashedArguments: HashedValues[];
|
|
60
|
-
}>;
|
|
61
|
-
/**
|
|
62
|
-
* The function calls to execute. This uses snake_case naming so that it is compatible with Noir encoding
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
get function_calls(): EncodedFunctionCall[];
|
|
66
|
-
/**
|
|
67
|
-
* The nonce
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
get nonce(): Fr;
|
|
71
|
-
/**
|
|
72
|
-
* The hashed arguments for the function calls
|
|
73
|
-
*/
|
|
74
|
-
get hashedArguments(): HashedValues[];
|
|
75
|
-
/**
|
|
76
|
-
* Serializes the payload to an array of fields
|
|
77
|
-
* @returns The fields of the payload
|
|
78
|
-
*/
|
|
79
|
-
abstract toFields(): Fr[];
|
|
80
|
-
/**
|
|
81
|
-
* Hashes the payload
|
|
82
|
-
* @returns The hash of the payload
|
|
83
|
-
*/
|
|
84
|
-
hash(): Promise<Fr>;
|
|
85
|
-
/** Serializes the function calls to an array of fields. */
|
|
86
|
-
protected functionCallsToFields(): Fr[];
|
|
87
|
-
/**
|
|
88
|
-
* Creates an execution payload for a dapp from a set of function calls
|
|
89
|
-
* @param functionCalls - The function calls to execute
|
|
90
|
-
* @returns The execution payload
|
|
91
|
-
*/
|
|
92
|
-
static fromFunctionCalls(functionCalls: FunctionCall[]): Promise<AppEntrypointPayload>;
|
|
93
|
-
/**
|
|
94
|
-
* Creates an execution payload for the app-portion of a transaction from a set of function calls
|
|
95
|
-
* @param functionCalls - The function calls to execute
|
|
96
|
-
* @param nonce - The nonce for the payload, used to emit a nullifier identifying the call
|
|
97
|
-
* @returns The execution payload
|
|
98
|
-
*/
|
|
99
|
-
static fromAppExecution(functionCalls: FunctionCall[] | Tuple<FunctionCall, 4>, nonce?: Fr): Promise<AppEntrypointPayload>;
|
|
100
|
-
/**
|
|
101
|
-
* Creates an execution payload to pay the fee for a transaction
|
|
102
|
-
* @param sender - The address sending this payload
|
|
103
|
-
* @param feeOpts - The fee payment options
|
|
104
|
-
* @returns The execution payload
|
|
105
|
-
*/
|
|
106
|
-
static fromFeeOptions(sender: AztecAddress, feeOpts?: FeeOptions): Promise<FeeEntrypointPayload>;
|
|
107
|
-
}
|
|
108
|
-
/** Entrypoint payload for app phase execution. */
|
|
109
|
-
declare class AppEntrypointPayload extends EntrypointPayload {
|
|
110
|
-
toFields(): Fr[];
|
|
111
|
-
}
|
|
112
|
-
/** Entrypoint payload for fee payment to be run during setup phase. */
|
|
113
|
-
declare class FeeEntrypointPayload extends EntrypointPayload {
|
|
114
|
-
#private;
|
|
115
|
-
constructor(functionCalls: EncodedFunctionCall[], hashedArguments: HashedValues[], generatorIndex: number, nonce: Fr, isFeePayer: boolean);
|
|
116
|
-
toFields(): Fr[];
|
|
117
|
-
/** Whether the sender should be appointed as fee payer. */
|
|
118
|
-
get is_fee_payer(): boolean;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Computes a hash of a combined payload.
|
|
122
|
-
* @param appPayload - An app payload.
|
|
123
|
-
* @param feePayload - A fee payload.
|
|
124
|
-
* @returns A hash of a combined payload.
|
|
125
|
-
*/
|
|
126
|
-
export declare function computeCombinedPayloadHash(appPayload: AppEntrypointPayload, feePayload: FeeEntrypointPayload): Promise<Fr>;
|
|
127
|
-
export {};
|
|
128
|
-
//# sourceMappingURL=payload.d.ts.map
|