@aztec/test-wallet 3.0.0-nightly.20251016 → 3.0.0-nightly.20251023
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/bundle.d.ts +1 -1
- package/dest/bundle.d.ts.map +1 -1
- package/dest/bundle.js +1 -1
- package/dest/lazy.d.ts +1 -1
- package/dest/lazy.d.ts.map +1 -1
- package/dest/lazy.js +1 -1
- package/dest/server.d.ts +1 -1
- package/dest/server.d.ts.map +1 -1
- package/dest/server.js +1 -1
- package/dest/utils.d.ts +23 -1
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +34 -1
- package/dest/wallet/test_wallet.d.ts +12 -1
- package/dest/wallet/test_wallet.d.ts.map +1 -1
- package/dest/wallet/test_wallet.js +15 -0
- package/package.json +8 -8
- package/src/bundle.ts +6 -1
- package/src/lazy.ts +6 -1
- package/src/server.ts +6 -1
- package/src/utils.ts +57 -1
- package/src/wallet/test_wallet.ts +24 -0
package/dest/bundle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/bundle.js';
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
|
-
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet } from './utils.js';
|
|
3
|
+
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet, ProvenTx, proveInteraction, } from './utils.js';
|
|
4
4
|
//# sourceMappingURL=bundle.d.ts.map
|
package/dest/bundle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,2BAA2B,EAC3B,sCAAsC,EACtC,QAAQ,EACR,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
package/dest/bundle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/bundle.js';
|
|
2
|
-
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet } from './utils.js';
|
|
2
|
+
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet, ProvenTx, proveInteraction } from './utils.js';
|
package/dest/lazy.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/lazy.js';
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
|
-
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet } from './utils.js';
|
|
3
|
+
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet, ProvenTx, proveInteraction, } from './utils.js';
|
|
4
4
|
//# sourceMappingURL=lazy.d.ts.map
|
package/dest/lazy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../src/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../src/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,2BAA2B,EAC3B,sCAAsC,EACtC,QAAQ,EACR,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
package/dest/lazy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/lazy.js';
|
|
2
|
-
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet } from './utils.js';
|
|
2
|
+
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet, ProvenTx, proveInteraction } from './utils.js';
|
package/dest/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/server.js';
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
|
-
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet } from './utils.js';
|
|
3
|
+
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet, ProvenTx, proveInteraction, } from './utils.js';
|
|
4
4
|
//# sourceMappingURL=server.d.ts.map
|
package/dest/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,2BAA2B,EAC3B,sCAAsC,EACtC,QAAQ,EACR,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
|
package/dest/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/server.js';
|
|
2
|
-
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet } from './utils.js';
|
|
2
|
+
export { deployFundedSchnorrAccounts, registerInitialSandboxAccountsInWallet, ProvenTx, proveInteraction } from './utils.js';
|
package/dest/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import { AztecAddress, type AztecNode, type WaitOpts } from '@aztec/aztec.js';
|
|
2
|
+
import { AztecAddress, type AztecNode, ContractFunctionInteraction, DeployMethod, type DeployOptions, type SendInteractionOptions, SentTx, Tx, type WaitOpts } from '@aztec/aztec.js';
|
|
3
|
+
import type { OffchainEffect, ProvingStats } from '@aztec/stdlib/tx';
|
|
3
4
|
import type { BaseTestWallet } from './wallet/test_wallet.js';
|
|
4
5
|
/**
|
|
5
6
|
* Deploys the SchnorrAccount contracts backed by prefunded addresses
|
|
@@ -12,4 +13,25 @@ export declare function deployFundedSchnorrAccounts(wallet: BaseTestWallet, azte
|
|
|
12
13
|
* @returns Addresses of the registered accounts.
|
|
13
14
|
*/
|
|
14
15
|
export declare function registerInitialSandboxAccountsInWallet(wallet: BaseTestWallet): Promise<AztecAddress[]>;
|
|
16
|
+
/**
|
|
17
|
+
* A proven transaction that can be sent to the network. Returned by the `prove` method of the test wallet
|
|
18
|
+
*/
|
|
19
|
+
export declare class ProvenTx extends Tx {
|
|
20
|
+
private node;
|
|
21
|
+
/** The offchain effects emitted during the execution of the transaction. */
|
|
22
|
+
offchainEffects: OffchainEffect[];
|
|
23
|
+
stats?: ProvingStats | undefined;
|
|
24
|
+
constructor(node: AztecNode, tx: Tx,
|
|
25
|
+
/** The offchain effects emitted during the execution of the transaction. */
|
|
26
|
+
offchainEffects: OffchainEffect[], stats?: ProvingStats | undefined);
|
|
27
|
+
send(): SentTx;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Helper function to prove an interaction via a TestWallet
|
|
31
|
+
* @param wallet - The TestWallet to use
|
|
32
|
+
* @param interaction - The interaction to prove
|
|
33
|
+
* @param options - Either SendInteractionOptions (for ContractFunctionInteraction) or DeployOptions (for DeployMethod)
|
|
34
|
+
* @returns - A proven transaction ready do be sent to the network
|
|
35
|
+
*/
|
|
36
|
+
export declare function proveInteraction(wallet: BaseTestWallet, interaction: ContractFunctionInteraction | DeployMethod, options: SendInteractionOptions | DeployOptions): Promise<ProvenTx>;
|
|
15
37
|
//# sourceMappingURL=utils.d.ts.map
|
package/dest/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,2BAA2B,EAC3B,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,MAAM,EACN,EAAE,EACF,KAAK,QAAQ,EAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,kBAAkB,EAAE,EAClC,WAAW,CAAC,EAAE,QAAQ,uDAiBvB;AAED;;;;GAIG;AACH,wBAAsB,sCAAsC,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAO5G;AACD;;GAEG;AACH,qBAAa,QAAS,SAAQ,EAAE;IAE5B,OAAO,CAAC,IAAI;IAEZ,4EAA4E;IACrE,eAAe,EAAE,cAAc,EAAE;IAEjC,KAAK,CAAC,EAAE,YAAY;gBALnB,IAAI,EAAE,SAAS,EACvB,EAAE,EAAE,EAAE;IACN,4EAA4E;IACrE,eAAe,EAAE,cAAc,EAAE,EAEjC,KAAK,CAAC,EAAE,YAAY,YAAA;IAK7B,IAAI;CAOL;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,2BAA2B,GAAG,YAAY,EACvD,OAAO,EAAE,sBAAsB,GAAG,aAAa,qBAShD"}
|
package/dest/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing/lazy';
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js';
|
|
2
|
+
import { AztecAddress, DeployMethod, SentTx, Tx, toSendOptions } from '@aztec/aztec.js';
|
|
3
3
|
/**
|
|
4
4
|
* Deploys the SchnorrAccount contracts backed by prefunded addresses
|
|
5
5
|
* at genesis. This can be directly used to pay for transactions in FeeJuice.
|
|
@@ -28,3 +28,36 @@ import { AztecAddress } from '@aztec/aztec.js';
|
|
|
28
28
|
return (await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey)).address;
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* A proven transaction that can be sent to the network. Returned by the `prove` method of the test wallet
|
|
33
|
+
*/ export class ProvenTx extends Tx {
|
|
34
|
+
node;
|
|
35
|
+
offchainEffects;
|
|
36
|
+
stats;
|
|
37
|
+
constructor(node, tx, /** The offchain effects emitted during the execution of the transaction. */ offchainEffects, // eslint-disable-next-line jsdoc/require-jsdoc
|
|
38
|
+
stats){
|
|
39
|
+
super(tx.getTxHash(), tx.data, tx.clientIvcProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.node = node, this.offchainEffects = offchainEffects, this.stats = stats;
|
|
40
|
+
}
|
|
41
|
+
send() {
|
|
42
|
+
const sendTx = async ()=>{
|
|
43
|
+
await this.node.sendTx(this);
|
|
44
|
+
return this.getTxHash();
|
|
45
|
+
};
|
|
46
|
+
return new SentTx(this.node, sendTx);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to prove an interaction via a TestWallet
|
|
51
|
+
* @param wallet - The TestWallet to use
|
|
52
|
+
* @param interaction - The interaction to prove
|
|
53
|
+
* @param options - Either SendInteractionOptions (for ContractFunctionInteraction) or DeployOptions (for DeployMethod)
|
|
54
|
+
* @returns - A proven transaction ready do be sent to the network
|
|
55
|
+
*/ export async function proveInteraction(wallet, interaction, options) {
|
|
56
|
+
let execPayload;
|
|
57
|
+
if (interaction instanceof DeployMethod) {
|
|
58
|
+
execPayload = await interaction.request(interaction.convertDeployOptionsToRequestOptions(options));
|
|
59
|
+
} else {
|
|
60
|
+
execPayload = await interaction.request(options);
|
|
61
|
+
}
|
|
62
|
+
return wallet.proveTx(execPayload, await toSendOptions(options));
|
|
63
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Account, type AccountContract, AccountManager, BaseWallet, type CallIntent, type ContractArtifact, type ContractFunctionInteractionCallIntent, type IntentInnerHash, SetPublicAuthwitContractInteraction, type SimulateOptions } from '@aztec/aztec.js';
|
|
1
|
+
import { type Account, type AccountContract, AccountManager, BaseWallet, type CallIntent, type ContractArtifact, type ContractFunctionInteractionCallIntent, type IntentInnerHash, type SendOptions, SetPublicAuthwitContractInteraction, type SimulateOptions } from '@aztec/aztec.js';
|
|
2
2
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
3
|
import { Fq, Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
@@ -6,6 +6,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
6
6
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
7
7
|
import type { NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
8
8
|
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
9
|
+
import { ProvenTx } from '../utils.js';
|
|
9
10
|
/**
|
|
10
11
|
* Data for generating an account.
|
|
11
12
|
*/
|
|
@@ -106,6 +107,16 @@ export declare abstract class BaseTestWallet extends BaseWallet {
|
|
|
106
107
|
artifact: ContractArtifact;
|
|
107
108
|
}>;
|
|
108
109
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
110
|
+
/**
|
|
111
|
+
* A utility to prove a transaction using this wallet and return it to be sent by a different entity on their own accord
|
|
112
|
+
*
|
|
113
|
+
* Note that this should not be used in production code since a proven transaction could be sent to a malicious
|
|
114
|
+
* node to index and track. It also makes it very difficult for the wallet to keep track of the interaction.
|
|
115
|
+
* @param exec - The execution payload to prove.
|
|
116
|
+
* @param opts - The options to configure the interaction
|
|
117
|
+
* @returns - A proven tx ready to be sent to the network
|
|
118
|
+
*/
|
|
119
|
+
proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<ProvenTx>;
|
|
109
120
|
/**
|
|
110
121
|
* A debugging utility to get notes based on the provided filter.
|
|
111
122
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/test_wallet.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,cAAc,EACd,UAAU,EACV,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,qCAAqC,EAC1C,KAAK,eAAe,EACpB,mCAAmC,EAEnC,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAA0B,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,EAAE,EAAE,EAAE,EAAkB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,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AU,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6BjH;;;;;;;;OAQG;IACG,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAY3E;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIpD;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGtB"}
|
|
@@ -3,6 +3,7 @@ import { AccountManager, BaseWallet, SetPublicAuthwitContractInteraction, Signer
|
|
|
3
3
|
import { mergeExecutionPayloads } from '@aztec/entrypoints/payload';
|
|
4
4
|
import { Fr, GrumpkinScalar } from '@aztec/foundation/fields';
|
|
5
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import { ProvenTx } from '../utils.js';
|
|
6
7
|
/**
|
|
7
8
|
* Wallet implementation that stores accounts in memory and allows allows their creation
|
|
8
9
|
* from the outside (which is something actual wallets shouldn't allow!)
|
|
@@ -134,6 +135,20 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
138
|
+
* A utility to prove a transaction using this wallet and return it to be sent by a different entity on their own accord
|
|
139
|
+
*
|
|
140
|
+
* Note that this should not be used in production code since a proven transaction could be sent to a malicious
|
|
141
|
+
* node to index and track. It also makes it very difficult for the wallet to keep track of the interaction.
|
|
142
|
+
* @param exec - The execution payload to prove.
|
|
143
|
+
* @param opts - The options to configure the interaction
|
|
144
|
+
* @returns - A proven tx ready to be sent to the network
|
|
145
|
+
*/ async proveTx(exec, opts) {
|
|
146
|
+
const fee = await this.getDefaultFeeOptions(opts.from, opts.fee);
|
|
147
|
+
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
148
|
+
const txProvingResult = await this.pxe.proveTx(txRequest);
|
|
149
|
+
return new ProvenTx(this.aztecNode, await txProvingResult.toTx(), txProvingResult.getOffchainEffects(), txProvingResult.stats);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
137
152
|
* A debugging utility to get notes based on the provided filter.
|
|
138
153
|
*
|
|
139
154
|
* Note that this should not be used in production code because the structure of notes is considered to be
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/test-wallet",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/test-wallet",
|
|
4
|
-
"version": "3.0.0-nightly.
|
|
4
|
+
"version": "3.0.0-nightly.20251023",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./client/bundle": "./dest/bundle.js",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
66
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
67
|
-
"@aztec/entrypoints": "3.0.0-nightly.
|
|
68
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
69
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
70
|
-
"@aztec/pxe": "3.0.0-nightly.
|
|
71
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
65
|
+
"@aztec/accounts": "3.0.0-nightly.20251023",
|
|
66
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251023",
|
|
67
|
+
"@aztec/entrypoints": "3.0.0-nightly.20251023",
|
|
68
|
+
"@aztec/foundation": "3.0.0-nightly.20251023",
|
|
69
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251023",
|
|
70
|
+
"@aztec/pxe": "3.0.0-nightly.20251023",
|
|
71
|
+
"@aztec/stdlib": "3.0.0-nightly.20251023"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@jest/globals": "^30.0.0",
|
package/src/bundle.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/bundle.js';
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
deployFundedSchnorrAccounts,
|
|
5
|
+
registerInitialSandboxAccountsInWallet,
|
|
6
|
+
ProvenTx,
|
|
7
|
+
proveInteraction,
|
|
8
|
+
} from './utils.js';
|
package/src/lazy.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/lazy.js';
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
deployFundedSchnorrAccounts,
|
|
5
|
+
registerInitialSandboxAccountsInWallet,
|
|
6
|
+
ProvenTx,
|
|
7
|
+
proveInteraction,
|
|
8
|
+
} from './utils.js';
|
package/src/server.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export { TestWallet } from './wallet/server.js';
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
deployFundedSchnorrAccounts,
|
|
5
|
+
registerInitialSandboxAccountsInWallet,
|
|
6
|
+
ProvenTx,
|
|
7
|
+
proveInteraction,
|
|
8
|
+
} from './utils.js';
|
package/src/utils.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing/lazy';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
AztecAddress,
|
|
5
|
+
type AztecNode,
|
|
6
|
+
ContractFunctionInteraction,
|
|
7
|
+
DeployMethod,
|
|
8
|
+
type DeployOptions,
|
|
9
|
+
type SendInteractionOptions,
|
|
10
|
+
SentTx,
|
|
11
|
+
Tx,
|
|
12
|
+
type WaitOpts,
|
|
13
|
+
toSendOptions,
|
|
14
|
+
} from '@aztec/aztec.js';
|
|
15
|
+
import type { OffchainEffect, ProvingStats } from '@aztec/stdlib/tx';
|
|
4
16
|
|
|
5
17
|
import type { BaseTestWallet } from './wallet/test_wallet.js';
|
|
6
18
|
|
|
@@ -44,3 +56,47 @@ export async function registerInitialSandboxAccountsInWallet(wallet: BaseTestWal
|
|
|
44
56
|
}),
|
|
45
57
|
);
|
|
46
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* A proven transaction that can be sent to the network. Returned by the `prove` method of the test wallet
|
|
61
|
+
*/
|
|
62
|
+
export class ProvenTx extends Tx {
|
|
63
|
+
constructor(
|
|
64
|
+
private node: AztecNode,
|
|
65
|
+
tx: Tx,
|
|
66
|
+
/** The offchain effects emitted during the execution of the transaction. */
|
|
67
|
+
public offchainEffects: OffchainEffect[],
|
|
68
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
69
|
+
public stats?: ProvingStats,
|
|
70
|
+
) {
|
|
71
|
+
super(tx.getTxHash(), tx.data, tx.clientIvcProof, tx.contractClassLogFields, tx.publicFunctionCalldata);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
send() {
|
|
75
|
+
const sendTx = async () => {
|
|
76
|
+
await this.node.sendTx(this);
|
|
77
|
+
return this.getTxHash();
|
|
78
|
+
};
|
|
79
|
+
return new SentTx(this.node, sendTx);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Helper function to prove an interaction via a TestWallet
|
|
85
|
+
* @param wallet - The TestWallet to use
|
|
86
|
+
* @param interaction - The interaction to prove
|
|
87
|
+
* @param options - Either SendInteractionOptions (for ContractFunctionInteraction) or DeployOptions (for DeployMethod)
|
|
88
|
+
* @returns - A proven transaction ready do be sent to the network
|
|
89
|
+
*/
|
|
90
|
+
export async function proveInteraction(
|
|
91
|
+
wallet: BaseTestWallet,
|
|
92
|
+
interaction: ContractFunctionInteraction | DeployMethod,
|
|
93
|
+
options: SendInteractionOptions | DeployOptions,
|
|
94
|
+
) {
|
|
95
|
+
let execPayload;
|
|
96
|
+
if (interaction instanceof DeployMethod) {
|
|
97
|
+
execPayload = await interaction.request(interaction.convertDeployOptionsToRequestOptions(options));
|
|
98
|
+
} else {
|
|
99
|
+
execPayload = await interaction.request(options);
|
|
100
|
+
}
|
|
101
|
+
return wallet.proveTx(execPayload, await toSendOptions(options));
|
|
102
|
+
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type ContractArtifact,
|
|
9
9
|
type ContractFunctionInteractionCallIntent,
|
|
10
10
|
type IntentInnerHash,
|
|
11
|
+
type SendOptions,
|
|
11
12
|
SetPublicAuthwitContractInteraction,
|
|
12
13
|
SignerlessAccount,
|
|
13
14
|
type SimulateOptions,
|
|
@@ -23,6 +24,8 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
|
23
24
|
import type { NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
24
25
|
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
25
26
|
|
|
27
|
+
import { ProvenTx } from '../utils.js';
|
|
28
|
+
|
|
26
29
|
/**
|
|
27
30
|
* Data for generating an account.
|
|
28
31
|
*/
|
|
@@ -219,6 +222,27 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
224
|
|
|
225
|
+
/**
|
|
226
|
+
* A utility to prove a transaction using this wallet and return it to be sent by a different entity on their own accord
|
|
227
|
+
*
|
|
228
|
+
* Note that this should not be used in production code since a proven transaction could be sent to a malicious
|
|
229
|
+
* node to index and track. It also makes it very difficult for the wallet to keep track of the interaction.
|
|
230
|
+
* @param exec - The execution payload to prove.
|
|
231
|
+
* @param opts - The options to configure the interaction
|
|
232
|
+
* @returns - A proven tx ready to be sent to the network
|
|
233
|
+
*/
|
|
234
|
+
async proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<ProvenTx> {
|
|
235
|
+
const fee = await this.getDefaultFeeOptions(opts.from, opts.fee);
|
|
236
|
+
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
237
|
+
const txProvingResult = await this.pxe.proveTx(txRequest);
|
|
238
|
+
return new ProvenTx(
|
|
239
|
+
this.aztecNode,
|
|
240
|
+
await txProvingResult.toTx(),
|
|
241
|
+
txProvingResult.getOffchainEffects(),
|
|
242
|
+
txProvingResult.stats,
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
222
246
|
/**
|
|
223
247
|
* A debugging utility to get notes based on the provided filter.
|
|
224
248
|
*
|