@aztec/aztec.js 3.0.0-canary.a9708bd → 3.0.0-devnet.2
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 +60 -0
- package/dest/account/account.d.ts.map +1 -0
- package/dest/account/account.js +59 -0
- package/dest/account/account_contract.d.ts +5 -5
- package/dest/account/account_contract.d.ts.map +1 -1
- package/dest/account/account_contract.js +0 -1
- package/dest/{wallet/account_wallet_with_private_key.d.ts → account/account_with_secret_key.d.ts} +7 -8
- package/dest/account/account_with_secret_key.d.ts.map +1 -0
- package/dest/{wallet/account_wallet_with_private_key.js → account/account_with_secret_key.js} +5 -5
- package/dest/account/index.d.ts +1 -4
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +1 -4
- package/dest/account/signerless_account.d.ts +24 -0
- package/dest/account/signerless_account.d.ts.map +1 -0
- package/dest/account/signerless_account.js +27 -0
- package/dest/api/abi.d.ts +1 -0
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/account.d.ts +4 -2
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +3 -1
- package/dest/api/addresses.d.ts +1 -0
- package/dest/api/addresses.d.ts.map +1 -1
- package/dest/api/addresses.js +1 -0
- package/dest/api/authorization.d.ts +2 -0
- package/dest/api/authorization.d.ts.map +1 -1
- package/dest/api/authorization.js +2 -0
- package/dest/api/block.d.ts +3 -0
- package/dest/api/block.d.ts.map +1 -0
- package/dest/api/block.js +2 -0
- package/dest/api/contract.d.ts +4 -5
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +3 -3
- package/dest/api/crypto.d.ts +2 -0
- package/dest/api/crypto.d.ts.map +1 -0
- package/dest/api/crypto.js +1 -0
- package/dest/api/ethereum.d.ts +0 -1
- package/dest/api/ethereum.d.ts.map +1 -1
- package/dest/api/ethereum.js +0 -1
- package/dest/api/events.d.ts +12 -0
- package/dest/api/events.d.ts.map +1 -0
- package/dest/api/events.js +30 -0
- package/dest/api/fee.d.ts +1 -2
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/fee.js +0 -1
- package/dest/api/keys.d.ts +4 -0
- package/dest/api/keys.d.ts.map +1 -0
- package/dest/api/keys.js +3 -0
- package/dest/api/log.d.ts +1 -0
- package/dest/api/log.d.ts.map +1 -1
- package/dest/api/log.js +1 -0
- package/dest/api/messaging.d.ts +3 -0
- package/dest/api/messaging.d.ts.map +1 -0
- package/dest/api/messaging.js +2 -0
- package/dest/api/node.d.ts +21 -0
- package/dest/api/node.d.ts.map +1 -0
- package/dest/api/node.js +18 -0
- package/dest/api/note.d.ts +2 -0
- package/dest/api/note.d.ts.map +1 -0
- package/dest/api/note.js +1 -0
- package/dest/api/protocol.d.ts +3 -0
- package/dest/api/protocol.d.ts.map +1 -0
- package/dest/api/protocol.js +2 -0
- package/dest/api/trees.d.ts +3 -0
- package/dest/api/trees.d.ts.map +1 -0
- package/dest/api/trees.js +2 -0
- package/dest/api/tx.d.ts +2 -0
- package/dest/api/tx.d.ts.map +1 -0
- package/dest/api/tx.js +1 -0
- package/dest/api/utils.d.ts +10 -6
- package/dest/api/utils.d.ts.map +1 -1
- package/dest/api/utils.js +10 -5
- package/dest/api/wallet.d.ts +4 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +4 -1
- package/dest/contract/base_contract_interaction.d.ts +6 -48
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +6 -106
- package/dest/contract/batch_call.d.ts +6 -14
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +42 -52
- package/dest/contract/contract.d.ts +1 -1
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +2 -12
- 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 +29 -40
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +41 -53
- package/dest/contract/deploy_method.d.ts +63 -56
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +68 -86
- package/dest/contract/deploy_sent_tx.d.ts +0 -1
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +7 -10
- package/dest/contract/interaction_options.d.ts +74 -19
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +51 -3
- package/dest/contract/sent_tx.d.ts +3 -3
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +5 -5
- package/dest/contract/wait_for_proven.d.ts +3 -3
- package/dest/contract/wait_for_proven.d.ts.map +1 -1
- package/dest/contract/wait_for_proven.js +2 -2
- package/dest/deployment/publish_instance.d.ts +1 -1
- package/dest/deployment/publish_instance.d.ts.map +1 -1
- package/dest/deployment/publish_instance.js +2 -5
- package/dest/ethereum/portal_manager.d.ts +3 -4
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +3 -5
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +12 -7
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +21 -12
- package/dest/fee/fee_payment_method.d.ts +26 -0
- package/dest/fee/fee_payment_method.d.ts.map +1 -0
- package/dest/fee/fee_payment_method.js +3 -0
- package/dest/fee/private_fee_payment_method.d.ts +22 -5
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +34 -13
- package/dest/fee/public_fee_payment_method.d.ts +22 -5
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +37 -14
- package/dest/fee/sponsored_fee_payment.d.ts +2 -0
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
- package/dest/fee/sponsored_fee_payment.js +4 -0
- package/dest/utils/authwit.d.ts +77 -25
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +219 -24
- package/dest/utils/cross_chain.d.ts +24 -0
- package/dest/utils/cross_chain.d.ts.map +1 -0
- package/dest/utils/cross_chain.js +30 -0
- package/dest/utils/fee_juice.d.ts +3 -2
- package/dest/utils/fee_juice.d.ts.map +1 -1
- package/dest/utils/fee_juice.js +3 -2
- package/dest/{fee → wallet}/account_entrypoint_meta_payment_method.d.ts +13 -10
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.js +76 -0
- package/dest/wallet/account_manager.d.ts +69 -0
- package/dest/wallet/account_manager.d.ts.map +1 -0
- package/dest/wallet/account_manager.js +113 -0
- package/dest/wallet/base_wallet.d.ts +78 -35
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +216 -48
- package/dest/wallet/deploy_account_method.d.ts +52 -0
- package/dest/wallet/deploy_account_method.d.ts.map +1 -0
- package/dest/wallet/deploy_account_method.js +77 -0
- package/dest/wallet/index.d.ts +2 -15
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +2 -19
- package/dest/wallet/wallet.d.ts +2473 -6
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +202 -3
- package/package.json +25 -21
- package/src/account/account.ts +97 -0
- package/src/account/account_contract.ts +4 -6
- package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +6 -8
- package/src/account/index.ts +1 -4
- package/src/account/signerless_account.ts +46 -0
- package/src/api/abi.ts +11 -0
- package/src/api/account.ts +4 -2
- package/src/api/addresses.ts +1 -0
- package/src/api/authorization.ts +11 -0
- package/src/api/block.ts +2 -0
- package/src/api/contract.ts +16 -8
- package/src/api/crypto.ts +1 -0
- package/src/api/ethereum.ts +0 -1
- package/src/api/events.ts +44 -0
- package/src/api/fee.ts +1 -2
- package/src/api/keys.ts +8 -0
- package/src/api/log.ts +1 -0
- package/src/api/messaging.ts +2 -0
- package/src/api/node.ts +20 -0
- package/src/api/note.ts +1 -0
- package/src/api/protocol.ts +2 -0
- package/src/api/trees.ts +2 -0
- package/src/api/tx.ts +11 -0
- package/src/api/utils.ts +12 -19
- package/src/api/wallet.ts +33 -5
- package/src/contract/base_contract_interaction.ts +9 -138
- package/src/contract/batch_call.ts +52 -61
- package/src/contract/contract.ts +2 -12
- package/src/contract/contract_function_interaction.ts +65 -97
- package/src/contract/deploy_method.ts +117 -99
- package/src/contract/deploy_sent_tx.ts +4 -10
- package/src/contract/interaction_options.ts +126 -24
- package/src/contract/sent_tx.ts +4 -4
- package/src/contract/wait_for_proven.ts +4 -4
- package/src/deployment/publish_instance.ts +3 -8
- package/src/ethereum/portal_manager.ts +4 -12
- package/src/fee/fee_juice_payment_method_with_claim.ts +26 -17
- package/src/fee/fee_payment_method.ts +26 -0
- package/src/fee/private_fee_payment_method.ts +60 -41
- package/src/fee/public_fee_payment_method.ts +73 -49
- package/src/fee/sponsored_fee_payment.ts +6 -0
- package/src/utils/authwit.ts +250 -38
- package/src/utils/cross_chain.ts +53 -0
- package/src/utils/fee_juice.ts +4 -3
- package/src/wallet/account_entrypoint_meta_payment_method.ts +105 -0
- package/src/wallet/account_manager.ts +154 -0
- package/src/wallet/base_wallet.ts +287 -78
- package/src/wallet/deploy_account_method.ts +125 -0
- package/src/wallet/index.ts +2 -32
- package/src/wallet/wallet.ts +357 -29
- package/dest/account_manager/account_manager.d.ts +0 -119
- package/dest/account_manager/account_manager.d.ts.map +0 -1
- package/dest/account_manager/account_manager.js +0 -202
- package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
- package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
- package/dest/account_manager/deploy_account_sent_tx.js +0 -29
- package/dest/account_manager/index.d.ts +0 -3
- package/dest/account_manager/index.d.ts.map +0 -1
- package/dest/account_manager/index.js +0 -2
- package/dest/api/interfaces.d.ts +0 -2
- package/dest/api/interfaces.d.ts.map +0 -1
- package/dest/api/interfaces.js +0 -1
- package/dest/api/log_id.d.ts +0 -2
- package/dest/api/log_id.d.ts.map +0 -1
- package/dest/api/log_id.js +0 -1
- package/dest/api/rpc.d.ts +0 -3
- package/dest/api/rpc.d.ts.map +0 -1
- package/dest/api/rpc.js +0 -2
- package/dest/api/tx_hash.d.ts +0 -2
- package/dest/api/tx_hash.d.ts.map +0 -1
- package/dest/api/tx_hash.js +0 -1
- package/dest/contract/deploy_proven_tx.d.ts +0 -21
- package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
- package/dest/contract/deploy_proven_tx.js +0 -21
- package/dest/contract/proven_tx.d.ts +0 -21
- package/dest/contract/proven_tx.d.ts.map +0 -1
- package/dest/contract/proven_tx.js +0 -23
- package/dest/ethereum/l1_contracts.d.ts +0 -3
- package/dest/ethereum/l1_contracts.d.ts.map +0 -1
- package/dest/ethereum/l1_contracts.js +0 -13
- package/dest/fee/account_entrypoint_meta_payment_method.d.ts.map +0 -1
- package/dest/fee/account_entrypoint_meta_payment_method.js +0 -64
- package/dest/fee/fee_juice_payment_method.d.ts +0 -14
- package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
- package/dest/fee/fee_juice_payment_method.js +0 -21
- package/dest/fee/utils.d.ts +0 -13
- package/dest/fee/utils.d.ts.map +0 -1
- package/dest/fee/utils.js +0 -32
- package/dest/index.d.ts +0 -59
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -62
- package/dest/rpc_clients/node/index.d.ts +0 -12
- package/dest/rpc_clients/node/index.d.ts.map +0 -1
- package/dest/rpc_clients/node/index.js +0 -72
- package/dest/rpc_clients/pxe_client.d.ts +0 -10
- package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
- package/dest/rpc_clients/pxe_client.js +0 -23
- package/dest/utils/pxe.d.ts +0 -4
- package/dest/utils/pxe.d.ts.map +0 -1
- package/dest/utils/pxe.js +0 -14
- package/dest/wallet/account_wallet.d.ts +0 -74
- package/dest/wallet/account_wallet.d.ts.map +0 -1
- package/dest/wallet/account_wallet.js +0 -232
- package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
- package/dest/wallet/signerless_wallet.d.ts +0 -23
- package/dest/wallet/signerless_wallet.d.ts.map +0 -1
- package/dest/wallet/signerless_wallet.js +0 -33
- package/src/account_manager/account_manager.ts +0 -276
- package/src/account_manager/deploy_account_sent_tx.ts +0 -46
- package/src/account_manager/index.ts +0 -2
- package/src/api/interfaces.ts +0 -1
- package/src/api/log_id.ts +0 -1
- package/src/api/rpc.ts +0 -2
- package/src/api/tx_hash.ts +0 -1
- package/src/contract/deploy_proven_tx.ts +0 -45
- package/src/contract/proven_tx.ts +0 -36
- package/src/ethereum/l1_contracts.ts +0 -21
- package/src/fee/account_entrypoint_meta_payment_method.ts +0 -89
- package/src/fee/fee_juice_payment_method.ts +0 -25
- package/src/fee/utils.ts +0 -39
- package/src/index.ts +0 -85
- package/src/rpc_clients/node/index.ts +0 -77
- package/src/rpc_clients/pxe_client.ts +0 -25
- package/src/utils/pxe.ts +0 -17
- package/src/wallet/account_wallet.ts +0 -246
- package/src/wallet/signerless_wallet.ts +0 -56
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
4
|
-
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
5
|
-
import { deriveKeys } from '@aztec/stdlib/keys';
|
|
6
|
-
import { Contract } from '../contract/contract.js';
|
|
7
|
-
import { DeployMethod } from '../contract/deploy_method.js';
|
|
8
|
-
import { DefaultWaitOpts } from '../contract/sent_tx.js';
|
|
9
|
-
import { AccountEntrypointMetaPaymentMethod } from '../fee/account_entrypoint_meta_payment_method.js';
|
|
10
|
-
import { AztecAddress, FeeJuicePaymentMethod } from '../index.js';
|
|
11
|
-
import { AccountWalletWithSecretKey, SignerlessWallet } from '../wallet/index.js';
|
|
12
|
-
import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
|
|
13
|
-
/**
|
|
14
|
-
* Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
|
|
15
|
-
* and creating and registering the user wallet in the PXE Service.
|
|
16
|
-
*/ export class AccountManager {
|
|
17
|
-
pxe;
|
|
18
|
-
secretKey;
|
|
19
|
-
accountContract;
|
|
20
|
-
instance;
|
|
21
|
-
salt;
|
|
22
|
-
constructor(pxe, secretKey, accountContract, instance, /**
|
|
23
|
-
* Contract instantiation salt for the account contract
|
|
24
|
-
*/ salt){
|
|
25
|
-
this.pxe = pxe;
|
|
26
|
-
this.secretKey = secretKey;
|
|
27
|
-
this.accountContract = accountContract;
|
|
28
|
-
this.instance = instance;
|
|
29
|
-
this.salt = salt;
|
|
30
|
-
}
|
|
31
|
-
static async create(pxe, secretKey, accountContract, salt) {
|
|
32
|
-
const { publicKeys } = await deriveKeys(secretKey);
|
|
33
|
-
salt = salt !== undefined ? new Fr(salt) : Fr.random();
|
|
34
|
-
const { constructorName, constructorArgs } = await accountContract.getInitializationFunctionAndArgs() ?? {
|
|
35
|
-
constructorName: undefined,
|
|
36
|
-
constructorArgs: undefined
|
|
37
|
-
};
|
|
38
|
-
const artifact = await accountContract.getContractArtifact();
|
|
39
|
-
const instance = await getContractInstanceFromInstantiationParams(artifact, {
|
|
40
|
-
constructorArtifact: constructorName,
|
|
41
|
-
constructorArgs,
|
|
42
|
-
salt: salt,
|
|
43
|
-
publicKeys
|
|
44
|
-
});
|
|
45
|
-
return new AccountManager(pxe, secretKey, accountContract, instance, salt);
|
|
46
|
-
}
|
|
47
|
-
getPublicKeys() {
|
|
48
|
-
return this.instance.publicKeys;
|
|
49
|
-
}
|
|
50
|
-
getPublicKeysHash() {
|
|
51
|
-
return this.getPublicKeys().hash();
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Returns the entrypoint for this account as defined by its account contract.
|
|
55
|
-
* @returns An entrypoint.
|
|
56
|
-
*/ async getAccount() {
|
|
57
|
-
const nodeInfo = await this.pxe.getNodeInfo();
|
|
58
|
-
const completeAddress = await this.getCompleteAddress();
|
|
59
|
-
return this.accountContract.getInterface(completeAddress, nodeInfo);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Gets the calculated complete address associated with this account.
|
|
63
|
-
* Does not require the account to have been published for public execution.
|
|
64
|
-
* @returns The address, partial address, and encryption public key.
|
|
65
|
-
*/ getCompleteAddress() {
|
|
66
|
-
return CompleteAddress.fromSecretKeyAndInstance(this.secretKey, this.instance);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Gets the address for this given account.
|
|
70
|
-
* Does not require the account to have been published for public execution.
|
|
71
|
-
* @returns The address.
|
|
72
|
-
*/ getAddress() {
|
|
73
|
-
return this.instance.address;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Returns the contract instance definition associated with this account.
|
|
77
|
-
* Does not require the account to have been published for public execution.
|
|
78
|
-
* @returns ContractInstance instance.
|
|
79
|
-
*/ getInstance() {
|
|
80
|
-
return this.instance;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Returns a Wallet instance associated with this account. Use it to create Contract
|
|
84
|
-
* instances to be interacted with from this account.
|
|
85
|
-
* @returns A Wallet instance.
|
|
86
|
-
*/ async getWallet() {
|
|
87
|
-
const entrypoint = await this.getAccount();
|
|
88
|
-
return new AccountWalletWithSecretKey(this.pxe, entrypoint, this.secretKey, this.salt);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Add this account in the PXE Service and returns the associated wallet. Adding
|
|
92
|
-
* the account to the PXE Service is required for managing private state associated with it.
|
|
93
|
-
* Use the returned wallet to create Contract instances to be interacted with from this account.
|
|
94
|
-
* @param opts - Options to wait for the account to be synched.
|
|
95
|
-
* @returns A Wallet instance.
|
|
96
|
-
*/ async register() {
|
|
97
|
-
await this.pxe.registerContract({
|
|
98
|
-
artifact: await this.accountContract.getContractArtifact(),
|
|
99
|
-
instance: this.getInstance()
|
|
100
|
-
});
|
|
101
|
-
await this.pxe.registerAccount(this.secretKey, (await this.getCompleteAddress()).partialAddress);
|
|
102
|
-
return this.getWallet();
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Returns the pre-populated ContractSetupMethods which can prepare a tx to
|
|
106
|
-
* initialize and/or publish this account's account contract (depending on the contract's design).
|
|
107
|
-
* If no wallet is provided, it uses a signerless wallet with the multi call entrypoint
|
|
108
|
-
* @param deployWallet - Wallet used for any txs that are needed to
|
|
109
|
-
* set up the account contract for use.
|
|
110
|
-
* @returns A ContractSetupMethods instance that can set up this account contract for use
|
|
111
|
-
*/ async getDeployMethod(deployWallet) {
|
|
112
|
-
const artifact = await this.accountContract.getContractArtifact();
|
|
113
|
-
if (!await this.hasInitializer()) {
|
|
114
|
-
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/15576):
|
|
115
|
-
// there should be a path which enables an account contract's class & instance to be published,
|
|
116
|
-
// even if the account contract doesn't have an initializer function. This should not throw.
|
|
117
|
-
throw new Error(`Account contract ${artifact.name} does not have an initializer function to call.`);
|
|
118
|
-
}
|
|
119
|
-
const completeAddress = await this.getCompleteAddress();
|
|
120
|
-
await this.pxe.registerAccount(this.secretKey, completeAddress.partialAddress);
|
|
121
|
-
const { constructorName, constructorArgs } = await this.accountContract.getInitializationFunctionAndArgs() ?? {
|
|
122
|
-
constructorName: undefined,
|
|
123
|
-
constructorArgs: undefined
|
|
124
|
-
};
|
|
125
|
-
if (deployWallet) {
|
|
126
|
-
// If deploying using an existing wallet/account, treat it like regular contract deployment.
|
|
127
|
-
const thisWallet = await this.getWallet();
|
|
128
|
-
return new DeployMethod(this.getPublicKeys(), deployWallet, artifact, (address)=>Contract.at(address, artifact, thisWallet), constructorArgs, constructorName);
|
|
129
|
-
}
|
|
130
|
-
const { l1ChainId: chainId, rollupVersion } = await this.pxe.getNodeInfo();
|
|
131
|
-
// We use a signerless wallet with the multi call entrypoint in order to make multiple calls in one go.
|
|
132
|
-
// If we used getWallet, the deployment would get routed via the account contract entrypoint
|
|
133
|
-
// and it can't be used unless the contract is initialized.
|
|
134
|
-
const wallet = new SignerlessWallet(this.pxe, new DefaultMultiCallEntrypoint(chainId, rollupVersion));
|
|
135
|
-
return new DeployMethod(this.getPublicKeys(), wallet, artifact, (address)=>Contract.at(address, artifact, wallet), constructorArgs, constructorName);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Returns a FeePaymentMethod that routes the original one provided as an argument
|
|
139
|
-
* through the account's entrypoint. This allows an account contract to pay
|
|
140
|
-
* for its own deployment and initialization.
|
|
141
|
-
*
|
|
142
|
-
* For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
|
|
143
|
-
*
|
|
144
|
-
* @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
|
|
145
|
-
* @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
|
|
146
|
-
*/ async getSelfPaymentMethod(originalPaymentMethod) {
|
|
147
|
-
const artifact = await this.accountContract.getContractArtifact();
|
|
148
|
-
const wallet = await this.getWallet();
|
|
149
|
-
const address = wallet.getAddress();
|
|
150
|
-
return new AccountEntrypointMetaPaymentMethod(artifact, wallet, 'entrypoint', address, originalPaymentMethod ?? new FeeJuicePaymentMethod(address));
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Submits a tx to initialize and/or publish this account's account contract
|
|
154
|
-
* (depending on the contract's design).
|
|
155
|
-
* Doesn't necessarily publish the class nor publish the instance.
|
|
156
|
-
* Uses the salt provided in the constructor or a randomly generated one.
|
|
157
|
-
* Adds the account to the PXE Service first.
|
|
158
|
-
* @param opts - Fee options to be used for the deployment.
|
|
159
|
-
* @returns A SentTx object that can be waited to get the associated Wallet.
|
|
160
|
-
*/ deploy(opts) {
|
|
161
|
-
let deployMethod;
|
|
162
|
-
const sendTx = ()=>this.getDeployMethod(opts?.deployWallet).then((method)=>{
|
|
163
|
-
deployMethod = method;
|
|
164
|
-
if (!opts?.deployWallet && opts?.fee) {
|
|
165
|
-
return this.getSelfPaymentMethod(opts?.fee?.paymentMethod);
|
|
166
|
-
}
|
|
167
|
-
}).then((maybeWrappedPaymentMethod)=>{
|
|
168
|
-
let fee = opts?.fee;
|
|
169
|
-
if (maybeWrappedPaymentMethod) {
|
|
170
|
-
fee = {
|
|
171
|
-
...opts?.fee,
|
|
172
|
-
paymentMethod: maybeWrappedPaymentMethod
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
return deployMethod.send({
|
|
176
|
-
from: opts?.deployWallet?.getAddress() ?? AztecAddress.ZERO,
|
|
177
|
-
contractAddressSalt: new Fr(this.salt),
|
|
178
|
-
skipClassPublication: opts?.skipClassPublication ?? true,
|
|
179
|
-
skipInstancePublication: opts?.skipInstancePublication ?? true,
|
|
180
|
-
skipInitialization: opts?.skipInitialization ?? false,
|
|
181
|
-
universalDeploy: true,
|
|
182
|
-
fee
|
|
183
|
-
});
|
|
184
|
-
}).then((tx)=>tx.getTxHash());
|
|
185
|
-
return new DeployAccountSentTx(this.pxe, sendTx, this.getWallet());
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Deploys the account contract that backs this account if needed and awaits the tx to be mined.
|
|
189
|
-
* Uses the salt provided in the constructor or a randomly generated one. If no initialization
|
|
190
|
-
* is required it skips the transaction, and only registers the account in the PXE Service.
|
|
191
|
-
* @param opts - Options to wait for the tx to be mined.
|
|
192
|
-
* @returns A Wallet instance.
|
|
193
|
-
*/ async waitSetup(opts = DefaultWaitOpts) {
|
|
194
|
-
await (await this.hasInitializer() ? this.deploy(opts).wait(opts) : this.register());
|
|
195
|
-
return this.getWallet();
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Returns whether this account contract has an initializer function.
|
|
199
|
-
*/ async hasInitializer() {
|
|
200
|
-
return await this.accountContract.getInitializationFunctionAndArgs() !== undefined;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
2
|
-
import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
|
|
3
|
-
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
4
|
-
import { SentTx, type WaitOpts } from '../contract/sent_tx.js';
|
|
5
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
6
|
-
/** Extends a transaction receipt with a wallet instance for the newly deployed contract. */
|
|
7
|
-
export type DeployAccountTxReceipt = FieldsOf<TxReceipt> & {
|
|
8
|
-
/** Wallet that corresponds to the newly deployed account contract. */
|
|
9
|
-
wallet: Wallet;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* A deployment transaction for an account contract sent to the network, extending SentTx with methods to get the resulting wallet.
|
|
13
|
-
*/
|
|
14
|
-
export declare class DeployAccountSentTx extends SentTx {
|
|
15
|
-
private getWalletPromise;
|
|
16
|
-
constructor(pxeOrNode: AztecNode | PXE, sendTx: () => Promise<TxHash>, getWalletPromise: Promise<Wallet>);
|
|
17
|
-
/**
|
|
18
|
-
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
19
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
20
|
-
* @returns The deployed contract instance.
|
|
21
|
-
*/
|
|
22
|
-
getWallet(opts?: WaitOpts): Promise<Wallet>;
|
|
23
|
-
/**
|
|
24
|
-
* Awaits for the tx to be mined and returns the receipt along with a wallet instance. Throws if tx is not mined.
|
|
25
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
26
|
-
* @returns The transaction receipt with the wallet for the deployed account contract.
|
|
27
|
-
*/
|
|
28
|
-
wait(opts?: WaitOpts): Promise<DeployAccountTxReceipt>;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=deploy_account_sent_tx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account_sent_tx.d.ts","sourceRoot":"","sources":["../../src/account_manager/deploy_account_sent_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAmB,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,4FAA4F;AAC5F,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG;IACzD,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,MAAM;IAI3C,OAAO,CAAC,gBAAgB;gBAFxB,SAAS,EAAE,SAAS,GAAG,GAAG,EAC1B,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACrB,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC;IAK3C;;;;OAIG;IACU,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAKxD;;;;OAIG;IACmB,IAAI,CAAC,IAAI,GAAE,QAA0B,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAK9F"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { DefaultWaitOpts, SentTx } from '../contract/sent_tx.js';
|
|
2
|
-
/**
|
|
3
|
-
* A deployment transaction for an account contract sent to the network, extending SentTx with methods to get the resulting wallet.
|
|
4
|
-
*/ export class DeployAccountSentTx extends SentTx {
|
|
5
|
-
getWalletPromise;
|
|
6
|
-
constructor(pxeOrNode, sendTx, getWalletPromise){
|
|
7
|
-
super(pxeOrNode, sendTx), this.getWalletPromise = getWalletPromise;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
|
|
11
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
12
|
-
* @returns The deployed contract instance.
|
|
13
|
-
*/ async getWallet(opts) {
|
|
14
|
-
const receipt = await this.wait(opts);
|
|
15
|
-
return receipt.wallet;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Awaits for the tx to be mined and returns the receipt along with a wallet instance. Throws if tx is not mined.
|
|
19
|
-
* @param opts - Options for configuring the waiting for the tx to be mined.
|
|
20
|
-
* @returns The transaction receipt with the wallet for the deployed account contract.
|
|
21
|
-
*/ async wait(opts = DefaultWaitOpts) {
|
|
22
|
-
const receipt = await super.wait(opts);
|
|
23
|
-
const wallet = await this.getWalletPromise;
|
|
24
|
-
return {
|
|
25
|
-
...receipt,
|
|
26
|
-
wallet
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account_manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,KAAK,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dest/api/interfaces.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/api/interfaces.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dest/api/interfaces.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dest/api/log_id.d.ts
DELETED
package/dest/api/log_id.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log_id.d.ts","sourceRoot":"","sources":["../../src/api/log_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dest/api/log_id.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { LogId } from '@aztec/stdlib/logs';
|
package/dest/api/rpc.d.ts
DELETED
package/dest/api/rpc.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/api/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/dest/api/rpc.js
DELETED
package/dest/api/tx_hash.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tx_hash.d.ts","sourceRoot":"","sources":["../../src/api/tx_hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dest/api/tx_hash.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TxHash } from '@aztec/stdlib/tx';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
-
import type { ProvingStats, TxProvingResult } from '@aztec/stdlib/tx';
|
|
4
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
5
|
-
import type { Contract } from './contract.js';
|
|
6
|
-
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
7
|
-
import { ProvenTx } from './proven_tx.js';
|
|
8
|
-
/**
|
|
9
|
-
* A proven transaction that can be sent to the network. Returned by the `prove` method of a contract deployment.
|
|
10
|
-
*/
|
|
11
|
-
export declare class DeployProvenTx<TContract extends Contract = Contract> extends ProvenTx {
|
|
12
|
-
private postDeployCtor;
|
|
13
|
-
private instanceGetter;
|
|
14
|
-
private constructor();
|
|
15
|
-
static fromProvingResult<TContract extends Contract = Contract>(wallet: Wallet, txProvingResult: TxProvingResult, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>, instanceGetter: () => Promise<ContractInstanceWithAddress>, stats?: ProvingStats): Promise<DeployProvenTx<TContract>>;
|
|
16
|
-
/**
|
|
17
|
-
* Sends the transaction to the network via the provided wallet.
|
|
18
|
-
*/
|
|
19
|
-
send(): DeploySentTx<TContract>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=deploy_proven_tx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAkB,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;GAEG;AACH,qBAAa,cAAc,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,QAAQ;IAK/E,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;IALxB,OAAO;WAWM,iBAAiB,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,EAClE,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,EAC7E,cAAc,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,EAC1D,KAAK,CAAC,EAAE,YAAY,GACnB,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAKrC;;OAEG;IACa,IAAI,IAAI,YAAY,CAAC,SAAS,CAAC;CAKhD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
2
|
-
import { ProvenTx } from './proven_tx.js';
|
|
3
|
-
/**
|
|
4
|
-
* A proven transaction that can be sent to the network. Returned by the `prove` method of a contract deployment.
|
|
5
|
-
*/ export class DeployProvenTx extends ProvenTx {
|
|
6
|
-
postDeployCtor;
|
|
7
|
-
instanceGetter;
|
|
8
|
-
constructor(wallet, tx, offchainEffects, postDeployCtor, instanceGetter, stats){
|
|
9
|
-
super(wallet, tx, offchainEffects, stats), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter;
|
|
10
|
-
}
|
|
11
|
-
static async fromProvingResult(wallet, txProvingResult, postDeployCtor, instanceGetter, stats) {
|
|
12
|
-
const tx = await txProvingResult.toTx();
|
|
13
|
-
return new DeployProvenTx(wallet, tx, txProvingResult.getOffchainEffects(), postDeployCtor, instanceGetter, stats);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Sends the transaction to the network via the provided wallet.
|
|
17
|
-
*/ send() {
|
|
18
|
-
const sendTx = ()=>this.wallet.sendTx(this);
|
|
19
|
-
return new DeploySentTx(this.wallet, sendTx, this.postDeployCtor, this.instanceGetter);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type OffchainEffect, type ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
2
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
3
|
-
import { SentTx } from './sent_tx.js';
|
|
4
|
-
/**
|
|
5
|
-
* A proven transaction that can be sent to the network. Returned by the `prove` method of a contract interaction.
|
|
6
|
-
*/
|
|
7
|
-
export declare class ProvenTx extends Tx {
|
|
8
|
-
#private;
|
|
9
|
-
/** The offchain effects emitted during the execution of the transaction. */
|
|
10
|
-
offchainEffects: OffchainEffect[];
|
|
11
|
-
stats?: ProvingStats | undefined;
|
|
12
|
-
constructor(wallet: Wallet, tx: Tx,
|
|
13
|
-
/** The offchain effects emitted during the execution of the transaction. */
|
|
14
|
-
offchainEffects: OffchainEffect[], stats?: ProvingStats | undefined);
|
|
15
|
-
protected get wallet(): Wallet;
|
|
16
|
-
/**
|
|
17
|
-
* Sends the transaction to the network via the provided wallet.
|
|
18
|
-
*/
|
|
19
|
-
send(): SentTx;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=proven_tx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proven_tx.d.ts","sourceRoot":"","sources":["../../src/contract/proven_tx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;GAEG;AACH,qBAAa,QAAS,SAAQ,EAAE;;IAM5B,4EAA4E;IACrE,eAAe,EAAE,cAAc,EAAE;IAEjC,KAAK,CAAC,EAAE,YAAY;gBAL3B,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,EAAE;IACN,4EAA4E;IACrE,eAAe,EAAE,cAAc,EAAE,EAEjC,KAAK,CAAC,EAAE,YAAY,YAAA;IAM7B,SAAS,KAAK,MAAM,IAAI,MAAM,CAE7B;IAED;;OAEG;IACI,IAAI,IAAI,MAAM;CAKtB"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Tx } from '@aztec/stdlib/tx';
|
|
2
|
-
import { SentTx } from './sent_tx.js';
|
|
3
|
-
/**
|
|
4
|
-
* A proven transaction that can be sent to the network. Returned by the `prove` method of a contract interaction.
|
|
5
|
-
*/ export class ProvenTx extends Tx {
|
|
6
|
-
offchainEffects;
|
|
7
|
-
stats;
|
|
8
|
-
#wallet;
|
|
9
|
-
constructor(wallet, tx, /** The offchain effects emitted during the execution of the transaction. */ offchainEffects, // eslint-disable-next-line jsdoc/require-jsdoc
|
|
10
|
-
stats){
|
|
11
|
-
super(tx.txHash, tx.data, tx.clientIvcProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.offchainEffects = offchainEffects, this.stats = stats;
|
|
12
|
-
this.#wallet = wallet;
|
|
13
|
-
}
|
|
14
|
-
get wallet() {
|
|
15
|
-
return this.#wallet;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Sends the transaction to the network via the provided wallet.
|
|
19
|
-
*/ send() {
|
|
20
|
-
const sendTx = ()=>this.#wallet.sendTx(this);
|
|
21
|
-
return new SentTx(this.#wallet, sendTx);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"l1_contracts.d.ts","sourceRoot":"","sources":["../../src/ethereum/l1_contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAKjF,eAAO,MAAM,sBAAsB,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,mBAAmB,CAerF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
2
|
-
import { createPXEClient } from '../rpc_clients/pxe_client.js';
|
|
3
|
-
export const getL1ContractAddresses = async (url)=>{
|
|
4
|
-
const pxeClient = createPXEClient(url, {});
|
|
5
|
-
const response = await retryUntil(async ()=>{
|
|
6
|
-
try {
|
|
7
|
-
return (await pxeClient.getNodeInfo()).l1ContractAddresses;
|
|
8
|
-
} catch {
|
|
9
|
-
// do nothing
|
|
10
|
-
}
|
|
11
|
-
}, 'isNodeReady', 120, 1);
|
|
12
|
-
return response;
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account_entrypoint_meta_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/account_entrypoint_meta_payment_method.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAKtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,qBAAa,kCAAmC,YAAW,gBAAgB;IAEvE,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,mBAAmB;IAC3B,OAAO,CAAC,wBAAwB;IAChC,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,aAAa;gBAJb,QAAQ,EAAE,gBAAgB,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,wBAAwB,EAAE,MAAM,GAAG,gBAAgB,EACnD,cAAc,EAAE,YAAY,EAC5B,aAAa,EAAE,gBAAgB;IAGzC,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAI3B,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAwC9E,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;CAG7D"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { EncodedAppEntrypointCalls, EncodedCallsForEntrypoint, computeCombinedPayloadHash } from '@aztec/entrypoints/encoding';
|
|
2
|
-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
|
-
import { FunctionCall, FunctionSelector, encodeArguments, getFunctionArtifactByName } from '@aztec/stdlib/abi';
|
|
4
|
-
/**
|
|
5
|
-
* Fee payment method that allows a contract to pay for its own deployment
|
|
6
|
-
* It works by rerouting the provided fee payment method through the account's entrypoint,
|
|
7
|
-
* which sets itself as fee payer.
|
|
8
|
-
*
|
|
9
|
-
* Usually, in order to pay fees it is necessary to obtain an ExecutionPayload that encodes the necessary information
|
|
10
|
-
* that is sent to the user's account entrypoint, that has plumbing to handle a fee payload.
|
|
11
|
-
* If there's no account contract yet (it's being deployed) a MultiCallContract is used, which doesn't have a concept of fees or
|
|
12
|
-
* how to handle this payload.
|
|
13
|
-
* HOWEVER, the account contract's entrypoint does, so this method reshapes that fee payload into a call to the account contract entrypoint
|
|
14
|
-
* being deployed with the original fee payload.
|
|
15
|
-
*
|
|
16
|
-
* This class can be seen in action in AccountManager.ts#getSelfPaymentMethod
|
|
17
|
-
*/ export class AccountEntrypointMetaPaymentMethod {
|
|
18
|
-
artifact;
|
|
19
|
-
authWitnessProvider;
|
|
20
|
-
feePaymentNameOrArtifact;
|
|
21
|
-
accountAddress;
|
|
22
|
-
paymentMethod;
|
|
23
|
-
constructor(artifact, authWitnessProvider, feePaymentNameOrArtifact, accountAddress, paymentMethod){
|
|
24
|
-
this.artifact = artifact;
|
|
25
|
-
this.authWitnessProvider = authWitnessProvider;
|
|
26
|
-
this.feePaymentNameOrArtifact = feePaymentNameOrArtifact;
|
|
27
|
-
this.accountAddress = accountAddress;
|
|
28
|
-
this.paymentMethod = paymentMethod;
|
|
29
|
-
}
|
|
30
|
-
getAsset() {
|
|
31
|
-
return this.paymentMethod.getAsset();
|
|
32
|
-
}
|
|
33
|
-
async getExecutionPayload(gasSettings) {
|
|
34
|
-
const emptyAppCalls = await EncodedAppEntrypointCalls.fromAppExecution([]);
|
|
35
|
-
// Get the execution payload for the fee, it includes the calls and potentially authWitnesses
|
|
36
|
-
const { calls: feeCalls, authWitnesses: feeAuthwitnesses } = await this.paymentMethod.getExecutionPayload(gasSettings);
|
|
37
|
-
// Encode the calls for the fee
|
|
38
|
-
const feePayer = await this.paymentMethod.getFeePayer(gasSettings);
|
|
39
|
-
const isFeePayer = feePayer.equals(this.accountAddress);
|
|
40
|
-
const feeEncodedCalls = await EncodedCallsForEntrypoint.fromFeeCalls(feeCalls, isFeePayer);
|
|
41
|
-
// Get the entrypoint args
|
|
42
|
-
const args = [
|
|
43
|
-
emptyAppCalls,
|
|
44
|
-
feeEncodedCalls,
|
|
45
|
-
false
|
|
46
|
-
];
|
|
47
|
-
const feePaymentArtifact = typeof this.feePaymentNameOrArtifact === 'string' ? getFunctionArtifactByName(this.artifact, this.feePaymentNameOrArtifact) : this.feePaymentNameOrArtifact;
|
|
48
|
-
const entrypointCall = new FunctionCall(feePaymentArtifact.name, this.accountAddress, await FunctionSelector.fromNameAndParameters(feePaymentArtifact.name, feePaymentArtifact.parameters), feePaymentArtifact.functionType, feePaymentArtifact.isStatic, encodeArguments(feePaymentArtifact, args), feePaymentArtifact.returnTypes);
|
|
49
|
-
// Compute the authwitness required to verify the combined payload
|
|
50
|
-
const combinedPayloadAuthWitness = await this.authWitnessProvider.createAuthWit(await computeCombinedPayloadHash(emptyAppCalls, feeEncodedCalls));
|
|
51
|
-
return new ExecutionPayload([
|
|
52
|
-
entrypointCall
|
|
53
|
-
], [
|
|
54
|
-
combinedPayloadAuthWitness,
|
|
55
|
-
...feeAuthwitnesses
|
|
56
|
-
], [], [
|
|
57
|
-
...emptyAppCalls.hashedArguments,
|
|
58
|
-
...feeEncodedCalls.hashedArguments
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
61
|
-
getFeePayer(gasSettings) {
|
|
62
|
-
return this.paymentMethod.getFeePayer(gasSettings);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { FeePaymentMethod } from '@aztec/entrypoints/interfaces';
|
|
2
|
-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
/**
|
|
5
|
-
* Pay fee directly in the Fee Juice.
|
|
6
|
-
*/
|
|
7
|
-
export declare class FeeJuicePaymentMethod implements FeePaymentMethod {
|
|
8
|
-
protected sender: AztecAddress;
|
|
9
|
-
constructor(sender: AztecAddress);
|
|
10
|
-
getAsset(): Promise<AztecAddress>;
|
|
11
|
-
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
12
|
-
getFeePayer(): Promise<AztecAddress>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=fee_juice_payment_method.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fee_juice_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/fee_juice_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE;;GAEG;AACH,qBAAa,qBAAsB,YAAW,gBAAgB;IAEhD,SAAS,CAAC,MAAM,EAAE,YAAY;gBAApB,MAAM,EAAE,YAAY;IAE1C,QAAQ;IAIR,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAIhD,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;CAGrC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
|
-
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
3
|
-
// docs:start:fee_juice_method
|
|
4
|
-
/**
|
|
5
|
-
* Pay fee directly in the Fee Juice.
|
|
6
|
-
*/ export class FeeJuicePaymentMethod {
|
|
7
|
-
sender;
|
|
8
|
-
// docs:end:fee_juice_method
|
|
9
|
-
constructor(sender){
|
|
10
|
-
this.sender = sender;
|
|
11
|
-
}
|
|
12
|
-
getAsset() {
|
|
13
|
-
return Promise.resolve(ProtocolContractAddress.FeeJuice);
|
|
14
|
-
}
|
|
15
|
-
getExecutionPayload() {
|
|
16
|
-
return Promise.resolve(ExecutionPayload.empty());
|
|
17
|
-
}
|
|
18
|
-
getFeePayer() {
|
|
19
|
-
return Promise.resolve(this.sender);
|
|
20
|
-
}
|
|
21
|
-
}
|
package/dest/fee/utils.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type FunctionAbi } from '@aztec/stdlib/abi';
|
|
2
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
import type { Wallet } from '../wallet/wallet.js';
|
|
4
|
-
/**
|
|
5
|
-
* Use a wallet to simulate a function avoiding the wallet's entrypoint, as a SignerlessWallet would do
|
|
6
|
-
* @param wallet - The wallet to use for the simulation.
|
|
7
|
-
* @param contractAddress - The address of the contract to call.
|
|
8
|
-
* @param abi - The ABI of the function to simulate.
|
|
9
|
-
* @param args - The arguments to pass to the function.
|
|
10
|
-
* @returns The return values of the function call.
|
|
11
|
-
*/
|
|
12
|
-
export declare function simulateWithoutSignature(wallet: Wallet, contractAddress: AztecAddress, abi: FunctionAbi, args: any[]): Promise<import("@aztec/stdlib/abi").AbiDecoded>;
|
|
13
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dest/fee/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/fee/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAI3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,YAAY,EAC7B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,GAAG,EAAE,mDAiBZ"}
|
package/dest/fee/utils.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
2
|
-
import { decodeFromAbi } from '@aztec/stdlib/abi';
|
|
3
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
5
|
-
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
6
|
-
import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
7
|
-
/**
|
|
8
|
-
* Use a wallet to simulate a function avoiding the wallet's entrypoint, as a SignerlessWallet would do
|
|
9
|
-
* @param wallet - The wallet to use for the simulation.
|
|
10
|
-
* @param contractAddress - The address of the contract to call.
|
|
11
|
-
* @param abi - The ABI of the function to simulate.
|
|
12
|
-
* @param args - The arguments to pass to the function.
|
|
13
|
-
* @returns The return values of the function call.
|
|
14
|
-
*/ export async function simulateWithoutSignature(wallet, contractAddress, abi, args) {
|
|
15
|
-
const interaction = new ContractFunctionInteraction(wallet, contractAddress, abi, args);
|
|
16
|
-
const request = await interaction.request();
|
|
17
|
-
const maxFeesPerGas = (await wallet.getCurrentBaseFees()).mul(1.5);
|
|
18
|
-
const paymentMethod = new FeeJuicePaymentMethod(AztecAddress.ZERO);
|
|
19
|
-
const gasSettings = GasSettings.default({
|
|
20
|
-
maxFeesPerGas
|
|
21
|
-
});
|
|
22
|
-
const fee = {
|
|
23
|
-
gasSettings,
|
|
24
|
-
paymentMethod
|
|
25
|
-
};
|
|
26
|
-
const { l1ChainId: chainId, rollupVersion } = await wallet.getNodeInfo();
|
|
27
|
-
const entrypoint = new DefaultEntrypoint(chainId, rollupVersion);
|
|
28
|
-
const signerlessTxExecutionRequest = await entrypoint.createTxExecutionRequest(request, fee, {});
|
|
29
|
-
const simulationResult = await wallet.simulateTx(signerlessTxExecutionRequest, false, undefined, true);
|
|
30
|
-
const rawReturnValues = simulationResult.getPrivateReturnValues().values;
|
|
31
|
-
return decodeFromAbi(abi.returnTypes, rawReturnValues);
|
|
32
|
-
}
|