@aztec/aztec.js 0.80.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.
Files changed (185) hide show
  1. package/dest/account/{contract.d.ts → account_contract.d.ts} +11 -5
  2. package/dest/account/account_contract.d.ts.map +1 -0
  3. package/dest/account/{contract.js → account_contract.js} +5 -1
  4. package/dest/account/index.d.ts +2 -3
  5. package/dest/account/index.d.ts.map +1 -1
  6. package/dest/account/index.js +1 -2
  7. package/dest/account/interface.d.ts +1 -13
  8. package/dest/account/interface.d.ts.map +1 -1
  9. package/dest/account/interface.js +1 -0
  10. package/dest/account_manager/account_manager.d.ts +105 -0
  11. package/dest/account_manager/account_manager.d.ts.map +1 -0
  12. package/dest/account_manager/account_manager.js +165 -0
  13. package/dest/account_manager/deploy_account_method.d.ts +4 -4
  14. package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
  15. package/dest/account_manager/deploy_account_method.js +28 -13
  16. package/dest/account_manager/deploy_account_sent_tx.d.ts +3 -3
  17. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +1 -1
  18. package/dest/account_manager/deploy_account_sent_tx.js +2 -2
  19. package/dest/account_manager/index.d.ts +1 -104
  20. package/dest/account_manager/index.d.ts.map +1 -1
  21. package/dest/account_manager/index.js +1 -157
  22. package/dest/api/account.d.ts +2 -1
  23. package/dest/api/account.d.ts.map +1 -1
  24. package/dest/api/contract.d.ts +4 -1
  25. package/dest/api/contract.d.ts.map +1 -1
  26. package/dest/api/contract.js +3 -0
  27. package/dest/api/fee.d.ts +1 -1
  28. package/dest/api/fee.d.ts.map +1 -1
  29. package/dest/api/utils.d.ts +2 -1
  30. package/dest/api/utils.d.ts.map +1 -1
  31. package/dest/api/utils.js +2 -1
  32. package/dest/api/wallet.d.ts +1 -1
  33. package/dest/api/wallet.d.ts.map +1 -1
  34. package/dest/contract/base_contract_interaction.d.ts +22 -57
  35. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  36. package/dest/contract/base_contract_interaction.js +12 -67
  37. package/dest/contract/batch_call.d.ts +6 -18
  38. package/dest/contract/batch_call.d.ts.map +1 -1
  39. package/dest/contract/batch_call.js +25 -54
  40. package/dest/contract/contract.d.ts +1 -1
  41. package/dest/contract/contract.d.ts.map +1 -1
  42. package/dest/contract/contract_base.d.ts +2 -2
  43. package/dest/contract/contract_base.d.ts.map +1 -1
  44. package/dest/contract/contract_function_interaction.d.ts +38 -18
  45. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  46. package/dest/contract/contract_function_interaction.js +34 -41
  47. package/dest/contract/deploy_method.d.ts +7 -8
  48. package/dest/contract/deploy_method.d.ts.map +1 -1
  49. package/dest/contract/deploy_method.js +27 -32
  50. package/dest/contract/deploy_proven_tx.d.ts +2 -3
  51. package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
  52. package/dest/contract/deploy_sent_tx.d.ts +2 -3
  53. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  54. package/dest/contract/deploy_sent_tx.js +4 -4
  55. package/dest/contract/protocol_contracts.d.ts +1 -1
  56. package/dest/contract/protocol_contracts.d.ts.map +1 -1
  57. package/dest/contract/proven_tx.d.ts +3 -4
  58. package/dest/contract/proven_tx.d.ts.map +1 -1
  59. package/dest/contract/sent_tx.d.ts +4 -16
  60. package/dest/contract/sent_tx.d.ts.map +1 -1
  61. package/dest/contract/sent_tx.js +6 -37
  62. package/dest/contract/unsafe_contract.d.ts +1 -1
  63. package/dest/contract/unsafe_contract.d.ts.map +1 -1
  64. package/dest/contract/wait_for_proven.d.ts +17 -0
  65. package/dest/contract/wait_for_proven.d.ts.map +1 -0
  66. package/dest/contract/wait_for_proven.js +17 -0
  67. package/dest/deployment/broadcast_function.js +12 -8
  68. package/dest/deployment/contract_deployer.d.ts +1 -1
  69. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  70. package/dest/deployment/register_class.d.ts +1 -1
  71. package/dest/deployment/register_class.d.ts.map +1 -1
  72. package/dest/deployment/register_class.js +6 -11
  73. package/dest/entrypoint/default_multi_call_entrypoint.d.ts +3 -2
  74. package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
  75. package/dest/entrypoint/default_multi_call_entrypoint.js +12 -8
  76. package/dest/ethereum/portal_manager.d.ts +20 -11
  77. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  78. package/dest/ethereum/portal_manager.js +64 -30
  79. package/dest/fee/fee_juice_payment_method.d.ts +3 -3
  80. package/dest/fee/fee_juice_payment_method.d.ts.map +1 -1
  81. package/dest/fee/fee_juice_payment_method.js +3 -2
  82. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +4 -4
  83. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  84. package/dest/fee/fee_juice_payment_method_with_claim.js +6 -5
  85. package/dest/fee/private_fee_payment_method.d.ts +6 -6
  86. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  87. package/dest/fee/private_fee_payment_method.js +13 -12
  88. package/dest/fee/public_fee_payment_method.d.ts +7 -7
  89. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  90. package/dest/fee/public_fee_payment_method.js +10 -11
  91. package/dest/fee/utils.d.ts +13 -0
  92. package/dest/fee/utils.d.ts.map +1 -0
  93. package/dest/fee/utils.js +32 -0
  94. package/dest/index.d.ts +1 -1
  95. package/dest/index.d.ts.map +1 -1
  96. package/dest/index.js +1 -1
  97. package/dest/test/aztec_cheat_codes.d.ts +2 -2
  98. package/dest/test/aztec_cheat_codes.d.ts.map +1 -1
  99. package/dest/test/aztec_cheat_codes.js +3 -3
  100. package/dest/utils/authwit.d.ts +16 -9
  101. package/dest/utils/authwit.d.ts.map +1 -1
  102. package/dest/utils/authwit.js +26 -35
  103. package/dest/wallet/account_wallet.d.ts +6 -6
  104. package/dest/wallet/account_wallet.d.ts.map +1 -1
  105. package/dest/wallet/account_wallet.js +15 -17
  106. package/dest/wallet/base_wallet.d.ts +12 -35
  107. package/dest/wallet/base_wallet.d.ts.map +1 -1
  108. package/dest/wallet/base_wallet.js +11 -64
  109. package/dest/wallet/index.d.ts +2 -2
  110. package/dest/wallet/index.d.ts.map +1 -1
  111. package/dest/wallet/index.js +1 -1
  112. package/dest/wallet/signerless_wallet.d.ts +3 -3
  113. package/dest/wallet/signerless_wallet.d.ts.map +1 -1
  114. package/dest/wallet/signerless_wallet.js +3 -6
  115. package/dest/wallet/wallet.d.ts +11 -0
  116. package/dest/wallet/wallet.d.ts.map +1 -0
  117. package/package.json +8 -7
  118. package/src/account/{contract.ts → account_contract.ts} +17 -4
  119. package/src/account/index.ts +2 -3
  120. package/src/account/interface.ts +1 -12
  121. package/src/account_manager/account_manager.ts +235 -0
  122. package/src/account_manager/deploy_account_method.ts +35 -15
  123. package/src/account_manager/deploy_account_sent_tx.ts +4 -4
  124. package/src/account_manager/index.ts +1 -227
  125. package/src/api/account.ts +2 -8
  126. package/src/api/contract.ts +5 -5
  127. package/src/api/fee.ts +1 -1
  128. package/src/api/utils.ts +1 -1
  129. package/src/api/wallet.ts +7 -1
  130. package/src/contract/base_contract_interaction.ts +32 -88
  131. package/src/contract/batch_call.ts +40 -43
  132. package/src/contract/contract.ts +1 -1
  133. package/src/contract/contract_base.ts +1 -1
  134. package/src/contract/contract_function_interaction.ts +85 -56
  135. package/src/contract/deploy_method.ts +24 -26
  136. package/src/contract/deploy_proven_tx.ts +2 -3
  137. package/src/contract/deploy_sent_tx.ts +6 -6
  138. package/src/contract/protocol_contracts.ts +1 -1
  139. package/src/contract/proven_tx.ts +2 -3
  140. package/src/contract/sent_tx.ts +6 -47
  141. package/src/contract/unsafe_contract.ts +1 -1
  142. package/src/contract/wait_for_proven.ts +38 -0
  143. package/src/deployment/broadcast_function.ts +40 -40
  144. package/src/deployment/contract_deployer.ts +1 -1
  145. package/src/deployment/register_class.ts +9 -22
  146. package/src/entrypoint/default_multi_call_entrypoint.ts +14 -7
  147. package/src/ethereum/portal_manager.ts +73 -24
  148. package/src/fee/fee_juice_payment_method.ts +4 -5
  149. package/src/fee/fee_juice_payment_method_with_claim.ts +24 -20
  150. package/src/fee/private_fee_payment_method.ts +29 -28
  151. package/src/fee/public_fee_payment_method.ts +29 -29
  152. package/src/fee/utils.ts +39 -0
  153. package/src/index.ts +1 -1
  154. package/src/test/aztec_cheat_codes.ts +3 -3
  155. package/src/utils/authwit.ts +32 -35
  156. package/src/wallet/account_wallet.ts +18 -17
  157. package/src/wallet/base_wallet.ts +27 -88
  158. package/src/wallet/index.ts +2 -2
  159. package/src/wallet/signerless_wallet.ts +9 -8
  160. package/src/wallet/wallet.ts +34 -0
  161. package/dest/account/contract.d.ts.map +0 -1
  162. package/dest/account/wallet.d.ts +0 -11
  163. package/dest/account/wallet.d.ts.map +0 -1
  164. package/dest/api/entrypoint.d.ts +0 -2
  165. package/dest/api/entrypoint.d.ts.map +0 -1
  166. package/dest/api/entrypoint.js +0 -1
  167. package/dest/entrypoint/default_entrypoint.d.ts +0 -12
  168. package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
  169. package/dest/entrypoint/default_entrypoint.js +0 -28
  170. package/dest/entrypoint/entrypoint.d.ts +0 -39
  171. package/dest/entrypoint/entrypoint.d.ts.map +0 -1
  172. package/dest/entrypoint/entrypoint.js +0 -20
  173. package/dest/entrypoint/payload.d.ts +0 -128
  174. package/dest/entrypoint/payload.d.ts.map +0 -1
  175. package/dest/entrypoint/payload.js +0 -143
  176. package/dest/fee/fee_payment_method.d.ts +0 -22
  177. package/dest/fee/fee_payment_method.d.ts.map +0 -1
  178. package/dest/fee/fee_payment_method.js +0 -3
  179. package/src/account/wallet.ts +0 -13
  180. package/src/api/entrypoint.ts +0 -1
  181. package/src/entrypoint/default_entrypoint.ts +0 -39
  182. package/src/entrypoint/entrypoint.ts +0 -60
  183. package/src/entrypoint/payload.ts +0 -238
  184. package/src/fee/fee_payment_method.ts +0 -22
  185. /package/dest/{account → wallet}/wallet.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRo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3B;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAMpD;;;;OAIG;IACI,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAIrD;;;;OAIG;IACI,UAAU;IAIjB;;;;OAIG;IACI,WAAW,IAAI,2BAA2B;IAIjD;;;;OAIG;IACU,SAAS,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAK7D;;;;;;OAMG;IACU,QAAQ,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAW5D;;;;;;OAMG;IACU,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM;IA2ClD;;;;;;;OAOG;IACI,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,mBAAmB;IAgB/D;;;;;;OAMG;IACU,SAAS,CAAC,IAAI,GAAE,oBAAoB,GAAG,QAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAKpH;;OAEG;IACU,YAAY;CAG1B;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,KAAK,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
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,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,KAAK,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,159 +1,3 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { CompleteAddress } from '@aztec/stdlib/contract';
3
- import { getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
4
- import { deriveKeys } from '@aztec/stdlib/keys';
5
- import { Contract } from '../contract/contract.js';
6
- import { DeployMethod } from '../contract/deploy_method.js';
7
- import { DefaultWaitOpts } from '../contract/sent_tx.js';
8
- import { DefaultMultiCallEntrypoint } from '../entrypoint/default_multi_call_entrypoint.js';
9
- import { AccountWalletWithSecretKey, SignerlessWallet } from '../wallet/index.js';
10
- import { DeployAccountMethod } from './deploy_account_method.js';
11
- import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
12
- /**
13
- * Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
14
- * and creating and registering the user wallet in the PXE Service.
15
- */ export class AccountManager {
16
- pxe;
17
- secretKey;
18
- accountContract;
19
- instance;
20
- salt;
21
- constructor(pxe, secretKey, accountContract, instance, /**
22
- * Deployment salt for the account contract
23
- */ salt){
24
- this.pxe = pxe;
25
- this.secretKey = secretKey;
26
- this.accountContract = accountContract;
27
- this.instance = instance;
28
- this.salt = salt;
29
- }
30
- static async create(pxe, secretKey, accountContract, salt) {
31
- const { publicKeys } = await deriveKeys(secretKey);
32
- salt = salt !== undefined ? new Fr(salt) : Fr.random();
33
- const artifact = await accountContract.getContractArtifact();
34
- const instance = await getContractInstanceFromDeployParams(artifact, {
35
- constructorArgs: await accountContract.getDeploymentArgs(),
36
- salt: salt,
37
- publicKeys
38
- });
39
- return new AccountManager(pxe, secretKey, accountContract, instance, salt);
40
- }
41
- getPublicKeys() {
42
- return this.instance.publicKeys;
43
- }
44
- getPublicKeysHash() {
45
- return this.getPublicKeys().hash();
46
- }
47
- /**
48
- * Returns the entrypoint for this account as defined by its account contract.
49
- * @returns An entrypoint.
50
- */ async getAccount() {
51
- const nodeInfo = await this.pxe.getNodeInfo();
52
- const completeAddress = await this.getCompleteAddress();
53
- return this.accountContract.getInterface(completeAddress, nodeInfo);
54
- }
55
- /**
56
- * Gets the calculated complete address associated with this account.
57
- * Does not require the account to be deployed or registered.
58
- * @returns The address, partial address, and encryption public key.
59
- */ getCompleteAddress() {
60
- return CompleteAddress.fromSecretKeyAndInstance(this.secretKey, this.instance);
61
- }
62
- /**
63
- * Gets the address for this given account.
64
- * Does not require the account to be deployed or registered.
65
- * @returns The address.
66
- */ getAddress() {
67
- return this.instance.address;
68
- }
69
- /**
70
- * Returns the contract instance definition associated with this account.
71
- * Does not require the account to be deployed or registered.
72
- * @returns ContractInstance instance.
73
- */ getInstance() {
74
- return this.instance;
75
- }
76
- /**
77
- * Returns a Wallet instance associated with this account. Use it to create Contract
78
- * instances to be interacted with from this account.
79
- * @returns A Wallet instance.
80
- */ async getWallet() {
81
- const entrypoint = await this.getAccount();
82
- return new AccountWalletWithSecretKey(this.pxe, entrypoint, this.secretKey, this.salt);
83
- }
84
- /**
85
- * Registers this account in the PXE Service and returns the associated wallet. Registering
86
- * the account on the PXE Service is required for managing private state associated with it.
87
- * Use the returned wallet to create Contract instances to be interacted with from this account.
88
- * @param opts - Options to wait for the account to be synched.
89
- * @returns A Wallet instance.
90
- */ async register() {
91
- await this.pxe.registerContract({
92
- artifact: await this.accountContract.getContractArtifact(),
93
- instance: this.getInstance()
94
- });
95
- await this.pxe.registerAccount(this.secretKey, (await this.getCompleteAddress()).partialAddress);
96
- return this.getWallet();
97
- }
98
- /**
99
- * Returns the pre-populated deployment method to deploy the account contract that backs this account.
100
- * Typically you will not need this method and can call `deploy` directly. Use this for having finer
101
- * grained control on when to create, simulate, and send the deployment tx.
102
- * @param deployWallet - Wallet used for deploying the account contract.
103
- * @returns A DeployMethod instance that deploys this account contract.
104
- */ async getDeployMethod(deployWallet) {
105
- const artifact = await this.accountContract.getContractArtifact();
106
- if (!await this.isDeployable()) {
107
- throw new Error(`Account contract ${artifact.name} does not require deployment.`);
108
- }
109
- const completeAddress = await this.getCompleteAddress();
110
- await this.pxe.registerAccount(this.secretKey, completeAddress.partialAddress);
111
- const args = await this.accountContract.getDeploymentArgs() ?? [];
112
- if (deployWallet) {
113
- // If deploying using an existing wallet/account, treat it like regular contract deployment.
114
- const thisWallet = await this.getWallet();
115
- return new DeployMethod(this.getPublicKeys(), deployWallet, artifact, (address)=>Contract.at(address, artifact, thisWallet), args, 'constructor');
116
- }
117
- const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo();
118
- // We use a signerless wallet with the multi call entrypoint in order to make multiple calls in one go.
119
- // If we used getWallet, the deployment would get routed via the account contract entrypoint
120
- // and it can't be used unless the contract is initialized.
121
- const wallet = new SignerlessWallet(this.pxe, new DefaultMultiCallEntrypoint(chainId, protocolVersion));
122
- return new DeployAccountMethod(this.accountContract.getAuthWitnessProvider(completeAddress), this.getPublicKeys(), wallet, artifact, args, 'constructor', 'entrypoint');
123
- }
124
- /**
125
- * Deploys the account contract that backs this account.
126
- * Does not register the associated class nor publicly deploy the instance by default.
127
- * Uses the salt provided in the constructor or a randomly generated one.
128
- * Registers the account in the PXE Service before deploying the contract.
129
- * @param opts - Fee options to be used for the deployment.
130
- * @returns A SentTx object that can be waited to get the associated Wallet.
131
- */ deploy(opts) {
132
- const sentTx = this.getDeployMethod(opts?.deployWallet).then((deployMethod)=>deployMethod.send({
133
- contractAddressSalt: new Fr(this.salt),
134
- skipClassRegistration: opts?.skipClassRegistration ?? true,
135
- skipPublicDeployment: opts?.skipPublicDeployment ?? true,
136
- skipInitialization: opts?.skipInitialization ?? false,
137
- universalDeploy: true,
138
- fee: opts?.fee
139
- })).then((tx)=>tx.getTxHash());
140
- return new DeployAccountSentTx(this.pxe, sentTx, this.getWallet());
141
- }
142
- /**
143
- * Deploys the account contract that backs this account if needed and awaits the tx to be mined.
144
- * Uses the salt provided in the constructor or a randomly generated one. If no initialization
145
- * is required it skips the transaction, and only registers the account in the PXE Service.
146
- * @param opts - Options to wait for the tx to be mined.
147
- * @returns A Wallet instance.
148
- */ async waitSetup(opts = DefaultWaitOpts) {
149
- await (await this.isDeployable() ? this.deploy(opts).wait(opts) : this.register());
150
- return this.getWallet();
151
- }
152
- /**
153
- * Returns whether this account contract has a constructor and needs deployment.
154
- */ async isDeployable() {
155
- return await this.accountContract.getDeploymentArgs() !== undefined;
156
- }
157
- }
1
+ export { AccountManager } from './account_manager.js';
158
2
  export { DeployAccountMethod } from './deploy_account_method.js';
159
3
  export { DeployAccountSentTx } from './deploy_account_sent_tx.js';
@@ -1,3 +1,4 @@
1
- export { type AccountContract, type AccountInterface, type AuthWitnessProvider, type Salt, type Wallet, getAccountContractAddress, } from '../account/index.js';
1
+ export { type AccountContract, type AccountInterface, type Salt, getAccountContractAddress } from '../account/index.js';
2
+ export type { AuthWitnessProvider } from '@aztec/entrypoints/interfaces';
2
3
  export { AccountManager, type DeployAccountOptions } from '../account_manager/index.js';
3
4
  //# sourceMappingURL=account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,IAAI,EACT,KAAK,MAAM,EACX,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/api/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,IAAI,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACxH,YAAY,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -36,11 +36,14 @@
36
36
  * @packageDocumentation
37
37
  */
38
38
  export { Contract } from '../contract/contract.js';
39
- export { ContractFunctionInteraction, type ProfileResult, type SendMethodOptions, } from '../contract/contract_function_interaction.js';
39
+ export { ContractFunctionInteraction, type SendMethodOptions } from '../contract/contract_function_interaction.js';
40
+ export { TxProfileResult } from '@aztec/stdlib/tx';
40
41
  export { DefaultWaitOpts, SentTx, type WaitOpts } from '../contract/sent_tx.js';
42
+ export { ProvenTx } from '../contract/proven_tx.js';
41
43
  export { ContractBase, type ContractMethod, type ContractNotes, type ContractStorageLayout, } from '../contract/contract_base.js';
42
44
  export { BatchCall } from '../contract/batch_call.js';
43
45
  export { type DeployOptions, DeployMethod } from '../contract/deploy_method.js';
44
46
  export { DeploySentTx } from '../contract/deploy_sent_tx.js';
47
+ export { waitForProven, type WaitForProvenOpts, DefaultWaitForProvenOpts } from '../contract/wait_for_proven.js';
45
48
  export { type PartialAddress, type ContractClassWithId, type ContractInstanceWithAddress, getContractClassFromArtifact, getContractInstanceFromDeployParams, type NodeInfo, } from '@aztec/stdlib/contract';
46
49
  //# sourceMappingURL=contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EACL,2BAA2B,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EACL,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,mCAAmC,EACnC,KAAK,QAAQ,GACd,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/api/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,KAAK,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEnH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,qBAAqB,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAEjH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,mCAAmC,EACnC,KAAK,QAAQ,GACd,MAAM,wBAAwB,CAAC"}
@@ -36,9 +36,12 @@
36
36
  * @packageDocumentation
37
37
  */ export { Contract } from '../contract/contract.js';
38
38
  export { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
39
+ export { TxProfileResult } from '@aztec/stdlib/tx';
39
40
  export { DefaultWaitOpts, SentTx } from '../contract/sent_tx.js';
41
+ export { ProvenTx } from '../contract/proven_tx.js';
40
42
  export { ContractBase } from '../contract/contract_base.js';
41
43
  export { BatchCall } from '../contract/batch_call.js';
42
44
  export { DeployMethod } from '../contract/deploy_method.js';
43
45
  export { DeploySentTx } from '../contract/deploy_sent_tx.js';
46
+ export { waitForProven, DefaultWaitForProvenOpts } from '../contract/wait_for_proven.js';
44
47
  export { getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
package/dest/api/fee.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { FeePaymentMethod } from '../fee/fee_payment_method.js';
1
+ export type { FeePaymentMethod } from '@aztec/entrypoints/interfaces';
2
2
  export { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
3
3
  export { PrivateFeePaymentMethod } from '../fee/private_fee_payment_method.js';
4
4
  export { PublicFeePaymentMethod } from '../fee/public_fee_payment_method.js';
@@ -1 +1 @@
1
- {"version":3,"file":"fee.d.ts","sourceRoot":"","sources":["../../src/api/fee.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC"}
1
+ {"version":3,"file":"fee.d.ts","sourceRoot":"","sources":["../../src/api/fee.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { generatePublicKey } from '../utils/pub_key.js';
2
2
  export { type AztecAddressLike, type EthAddressLike, type EventSelectorLike, type FieldLike, type FunctionSelectorLike, type U128Like, type WrappedFieldLike, } from '../utils/abi_types.js';
3
- export { computeAuthWitMessageHash, computeInnerAuthWitHash, computeInnerAuthWitHashFromAction, type IntentAction, type IntentInnerHash, } from '../utils/authwit.js';
3
+ export { computeAuthWitMessageHash, computeInnerAuthWitHashFromAction, type IntentAction, type IntentInnerHash, } from '../utils/authwit.js';
4
+ export { computeInnerAuthWitHash } from '@aztec/stdlib/auth-witness';
4
5
  export { waitForPXE } from '../utils/pxe.js';
5
6
  export { waitForNode, createAztecNodeClient, type AztecNode } from '../utils/node.js';
6
7
  export { getFeeJuiceBalance } from '../utils/fee_juice.js';
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,iCAAiC,EACjC,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,iCAAiC,EACjC,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC"}
package/dest/api/utils.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { generatePublicKey } from '../utils/pub_key.js';
2
- export { computeAuthWitMessageHash, computeInnerAuthWitHash, computeInnerAuthWitHashFromAction } from '../utils/authwit.js';
2
+ export { computeAuthWitMessageHash, computeInnerAuthWitHashFromAction } from '../utils/authwit.js';
3
+ export { computeInnerAuthWitHash } from '@aztec/stdlib/auth-witness';
3
4
  export { waitForPXE } from '../utils/pxe.js';
4
5
  export { waitForNode, createAztecNodeClient } from '../utils/node.js';
5
6
  export { getFeeJuiceBalance } from '../utils/fee_juice.js';
@@ -1,2 +1,2 @@
1
- export { AccountWallet, AccountWalletWithSecretKey, SignerlessWallet, getWallet } from '../wallet/index.js';
1
+ export { AccountWallet, AccountWalletWithSecretKey, SignerlessWallet, getWallet, type Wallet, } from '../wallet/index.js';
2
2
  //# sourceMappingURL=wallet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/api/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/api/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,gBAAgB,EAChB,SAAS,EACT,KAAK,MAAM,GACZ,MAAM,oBAAoB,CAAC"}
@@ -1,17 +1,26 @@
1
+ import type { FeeOptions, TxExecutionOptions, UserFeeOptions } from '@aztec/entrypoints/interfaces';
2
+ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
1
3
  import type { Fr } from '@aztec/foundation/fields';
2
4
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
3
5
  import { GasSettings } from '@aztec/stdlib/gas';
4
- import type { Capsule, HashedValues, TxExecutionRequest, TxProvingResult } from '@aztec/stdlib/tx';
5
- import type { Wallet } from '../account/wallet.js';
6
- import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
7
- import type { FeeOptions, UserFeeOptions } from '../entrypoint/payload.js';
6
+ import type { Capsule, TxExecutionRequest, TxProvingResult } from '@aztec/stdlib/tx';
7
+ import type { Wallet } from '../wallet/wallet.js';
8
8
  import { ProvenTx } from './proven_tx.js';
9
9
  import { SentTx } from './sent_tx.js';
10
+ /**
11
+ * Represents the options to configure a request from a contract interaction.
12
+ * Allows specifying additional auth witnesses and capsules to use during execution
13
+ */
14
+ export type RequestMethodOptions = {
15
+ /** Extra authwits to use during execution */
16
+ authWitnesses?: AuthWitness[];
17
+ /** Extra capsules to use during execution */
18
+ capsules?: Capsule[];
19
+ };
10
20
  /**
11
21
  * Represents options for calling a (constrained) function in a contract.
12
- * Allows the user to specify the sender address and nonce for a transaction.
13
22
  */
14
- export type SendMethodOptions = {
23
+ export type SendMethodOptions = RequestMethodOptions & {
15
24
  /** Wether to skip the simulation of the public part of the transaction. */
16
25
  skipPublicSimulation?: boolean;
17
26
  /** The fee options for the transaction. */
@@ -27,11 +36,10 @@ export type SendMethodOptions = {
27
36
  */
28
37
  export declare abstract class BaseContractInteraction {
29
38
  protected wallet: Wallet;
30
- protected log: import("@aztec/foundation/log").Logger;
31
39
  protected authWitnesses: AuthWitness[];
32
- protected hashedArguments: HashedValues[];
33
40
  protected capsules: Capsule[];
34
- constructor(wallet: Wallet);
41
+ protected log: import("@aztec/foundation/log").Logger;
42
+ constructor(wallet: Wallet, authWitnesses?: AuthWitness[], capsules?: Capsule[]);
35
43
  /**
36
44
  * Create a transaction execution request ready to be simulated.
37
45
  * @param options - An optional object containing additional configuration for the transaction.
@@ -44,7 +52,7 @@ export declare abstract class BaseContractInteraction {
44
52
  * @param options - An optional object containing additional configuration for the transaction.
45
53
  * @returns An execution request wrapped in promise.
46
54
  */
47
- abstract request(options?: SendMethodOptions): Promise<Omit<ExecutionRequestInit, 'fee'>>;
55
+ abstract request(options?: RequestMethodOptions): Promise<ExecutionPayload>;
48
56
  /**
49
57
  * Creates a transaction execution request, simulates and proves it. Differs from .prove in
50
58
  * that its result does not include the wallet nor the composed tx object, but only the proving result.
@@ -83,54 +91,11 @@ export declare abstract class BaseContractInteraction {
83
91
  protected getDefaultFeeOptions(fee: UserFeeOptions | undefined): Promise<FeeOptions>;
84
92
  /**
85
93
  * Return fee options based on the user opts, estimating tx gas if needed.
86
- * @param request - Request to execute for this interaction.
87
- * @param pad - Percentage to pad the suggested gas limits by, as decimal (e.g., 0.10 for 10%).
94
+ * @param executionPayload - Execution payload to get the fee for
95
+ * @param fee - User-provided fee options.
96
+ * @param options - Additional options for the transaction. They must faithfully represent the tx to get accurate fee estimates
88
97
  * @returns Fee options for the actual transaction.
89
98
  */
90
- protected getFeeOptions(request: Omit<ExecutionRequestInit, 'fee'> & {
91
- fee?: UserFeeOptions;
92
- }): Promise<FeeOptions>;
93
- /**
94
- * Add authWitness used in this contract interaction.
95
- * @param authWitness - authWitness used in the contract interaction.
96
- */
97
- addAuthWitness(authWitness: AuthWitness): void;
98
- /**
99
- * Add authWitness used in this contract interaction.
100
- * @param authWitnesses - authWitnesses used in the contract interaction.
101
- */
102
- addAuthWitnesses(authWitnesses: AuthWitness[]): void;
103
- /**
104
- * Return all authWitnesses added for this interaction.
105
- */
106
- getAuthWitnesses(): AuthWitness[];
107
- /**
108
- * Add hashedArgument used in this contract interaction.
109
- * @param hashedArgument - hashedArgument used in the contract interaction.
110
- */
111
- addHashedArgument(hashedArgument: HashedValues): void;
112
- /**
113
- * Add hashedArguments used in this contract interaction.
114
- * @param hashedArguments - hashedArguments used in the contract interaction.
115
- */
116
- addHashedArguments(hashedArguments: HashedValues[]): void;
117
- /**
118
- * Return all hashedArguments added for this interaction.
119
- */
120
- getHashedArguments(): HashedValues[];
121
- /**
122
- * Add data passed to the oracle calls during this contract interaction.
123
- * @param capsule - Data passed to oracle calls.
124
- */
125
- addCapsule(capsule: Capsule): void;
126
- /**
127
- * Add data passed to the oracle calls during this contract interaction.
128
- * @param capsules - Data passed to oracle calls.
129
- */
130
- addCapsules(capsules: Capsule[]): void;
131
- /**
132
- * Return all capsules added for this contract interaction.
133
- */
134
- getCapsules(): Capsule[];
99
+ protected getFeeOptions(executionPayload: ExecutionPayload, fee: UserFeeOptions | undefined, options: TxExecutionOptions): Promise<FeeOptions>;
135
100
  }
136
101
  //# sourceMappingURL=base_contract_interaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base_contract_interaction.d.ts","sourceRoot":"","sources":["../../src/contract/base_contract_interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BA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OxF;;;;OAIG;IACU,KAAK,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAOtE;;;;;;;;OAQG;IACI,IAAI,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM;IAUpD;;;;;OAKG;IACU,WAAW,CACtB,IAAI,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,sBAAsB,CAAC,GACrE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB,CAAC,CAAC;IAiBhE;;;OAGG;cACa,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAU1F;;;;;;OAMG;cACa,aAAa,CAC3B,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,4BAAqB,EACxB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,UAAU,CAAC;CA8BvB"}
@@ -9,16 +9,14 @@ import { SentTx } from './sent_tx.js';
9
9
  * Implements the sequence create/simulate/send.
10
10
  */ export class BaseContractInteraction {
11
11
  wallet;
12
- log;
13
12
  authWitnesses;
14
- hashedArguments;
15
13
  capsules;
16
- constructor(wallet){
14
+ log;
15
+ constructor(wallet, authWitnesses = [], capsules = []){
17
16
  this.wallet = wallet;
17
+ this.authWitnesses = authWitnesses;
18
+ this.capsules = capsules;
18
19
  this.log = createLogger('aztecjs:contract_interaction');
19
- this.authWitnesses = [];
20
- this.hashedArguments = [];
21
- this.capsules = [];
22
20
  }
23
21
  /**
24
22
  * Creates a transaction execution request, simulates and proves it. Differs from .prove in
@@ -99,27 +97,25 @@ import { SentTx } from './sent_tx.js';
99
97
  // docs:start:getFeeOptions
100
98
  /**
101
99
  * Return fee options based on the user opts, estimating tx gas if needed.
102
- * @param request - Request to execute for this interaction.
103
- * @param pad - Percentage to pad the suggested gas limits by, as decimal (e.g., 0.10 for 10%).
100
+ * @param executionPayload - Execution payload to get the fee for
101
+ * @param fee - User-provided fee options.
102
+ * @param options - Additional options for the transaction. They must faithfully represent the tx to get accurate fee estimates
104
103
  * @returns Fee options for the actual transaction.
105
- */ async getFeeOptions(request) {
104
+ */ async getFeeOptions(executionPayload, fee = {}, options) {
106
105
  // docs:end:getFeeOptions
107
- const defaultFeeOptions = await this.getDefaultFeeOptions(request.fee);
106
+ const defaultFeeOptions = await this.getDefaultFeeOptions(fee);
108
107
  const paymentMethod = defaultFeeOptions.paymentMethod;
109
108
  const maxFeesPerGas = defaultFeeOptions.gasSettings.maxFeesPerGas;
110
109
  const maxPriorityFeesPerGas = defaultFeeOptions.gasSettings.maxPriorityFeesPerGas;
111
110
  let gasSettings = defaultFeeOptions.gasSettings;
112
- if (request.fee?.estimateGas) {
111
+ if (fee?.estimateGas) {
113
112
  const feeForEstimation = {
114
113
  paymentMethod,
115
114
  gasSettings
116
115
  };
117
- const txRequest = await this.wallet.createTxExecutionRequest({
118
- ...request,
119
- fee: feeForEstimation
120
- });
116
+ const txRequest = await this.wallet.createTxExecutionRequest(executionPayload, feeForEstimation, options);
121
117
  const simulationResult = await this.wallet.simulateTx(txRequest, true, undefined /* msgSender */ , undefined /* skipTxValidation */ , true);
122
- const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(simulationResult, request.fee?.estimatedGasPadding);
118
+ const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(simulationResult, fee?.estimatedGasPadding);
123
119
  gasSettings = GasSettings.from({
124
120
  maxFeesPerGas,
125
121
  maxPriorityFeesPerGas,
@@ -133,55 +129,4 @@ import { SentTx } from './sent_tx.js';
133
129
  paymentMethod
134
130
  };
135
131
  }
136
- /**
137
- * Add authWitness used in this contract interaction.
138
- * @param authWitness - authWitness used in the contract interaction.
139
- */ addAuthWitness(authWitness) {
140
- this.authWitnesses.push(authWitness);
141
- }
142
- /**
143
- * Add authWitness used in this contract interaction.
144
- * @param authWitnesses - authWitnesses used in the contract interaction.
145
- */ addAuthWitnesses(authWitnesses) {
146
- this.authWitnesses.push(...authWitnesses);
147
- }
148
- /**
149
- * Return all authWitnesses added for this interaction.
150
- */ getAuthWitnesses() {
151
- return this.authWitnesses;
152
- }
153
- /**
154
- * Add hashedArgument used in this contract interaction.
155
- * @param hashedArgument - hashedArgument used in the contract interaction.
156
- */ addHashedArgument(hashedArgument) {
157
- this.hashedArguments.push(hashedArgument);
158
- }
159
- /**
160
- * Add hashedArguments used in this contract interaction.
161
- * @param hashedArguments - hashedArguments used in the contract interaction.
162
- */ addHashedArguments(hashedArguments) {
163
- this.hashedArguments.push(...hashedArguments);
164
- }
165
- /**
166
- * Return all hashedArguments added for this interaction.
167
- */ getHashedArguments() {
168
- return this.hashedArguments;
169
- }
170
- /**
171
- * Add data passed to the oracle calls during this contract interaction.
172
- * @param capsule - Data passed to oracle calls.
173
- */ addCapsule(capsule) {
174
- this.capsules.push(capsule);
175
- }
176
- /**
177
- * Add data passed to the oracle calls during this contract interaction.
178
- * @param capsules - Data passed to oracle calls.
179
- */ addCapsules(capsules) {
180
- this.capsules.push(...capsules);
181
- }
182
- /**
183
- * Return all capsules added for this contract interaction.
184
- */ getCapsules() {
185
- return this.capsules;
186
- }
187
132
  }
@@ -1,7 +1,7 @@
1
+ import { ExecutionPayload } from '@aztec/entrypoints/payload';
1
2
  import type { TxExecutionRequest } from '@aztec/stdlib/tx';
2
- import type { Wallet } from '../account/wallet.js';
3
- import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
4
- import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
3
+ import type { Wallet } from '../wallet/wallet.js';
4
+ import { BaseContractInteraction, type RequestMethodOptions, type SendMethodOptions } from './base_contract_interaction.js';
5
5
  import type { SimulateMethodOptions } from './contract_function_interaction.js';
6
6
  /** A batch of function calls to be sent as a single transaction through a wallet. */
7
7
  export declare class BatchCall extends BaseContractInteraction {
@@ -16,10 +16,10 @@ export declare class BatchCall extends BaseContractInteraction {
16
16
  create(options?: SendMethodOptions): Promise<TxExecutionRequest>;
17
17
  /**
18
18
  * Returns an execution request that represents this operation.
19
- * @param options - An optional object containing additional configuration for the transaction.
20
- * @returns An execution request wrapped in promise.
19
+ * @param options - An optional object containing additional configuration for the request generation.
20
+ * @returns An execution payload wrapped in promise.
21
21
  */
22
- request(options?: SendMethodOptions): Promise<Omit<ExecutionRequestInit, 'fee'>>;
22
+ request(options?: RequestMethodOptions): Promise<ExecutionPayload>;
23
23
  /**
24
24
  * Simulate a transaction and get its return values
25
25
  * Differs from prove in a few important ways:
@@ -30,18 +30,6 @@ export declare class BatchCall extends BaseContractInteraction {
30
30
  * @returns The result of the transaction as returned by the contract function.
31
31
  */
32
32
  simulate(options?: SimulateMethodOptions): Promise<any>;
33
- /**
34
- * Return all authWitnesses added for this interaction.
35
- */
36
- getAuthWitnesses(): import("@aztec/stdlib/auth-witness").AuthWitness[];
37
- /**
38
- * Return all hashedArguments added for this interaction.
39
- */
40
- getHashedArguments(): import("@aztec/stdlib/tx").HashedValues[];
41
- /**
42
- * Return all capsules added for this interaction.
43
- */
44
- getCapsules(): import("@aztec/stdlib/tx").Capsule[];
45
33
  private getRequests;
46
34
  }
47
35
  //# sourceMappingURL=batch_call.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch_call.d.ts","sourceRoot":"","sources":["../../src/contract/batch_call.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,KAAK,oBAAoB,EAA8B,MAAM,6BAA6B,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACjG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,qFAAqF;AACrF,qBAAa,SAAU,SAAQ,uBAAuB;IACxB,SAAS,CAAC,KAAK,EAAE,uBAAuB,EAAE;gBAA1D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