@aztec/test-wallet 3.0.0-nightly.20251022 → 3.0.0-nightly.20251024
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 +26 -2
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +36 -1
- package/dest/wallet/bundle.d.ts +7 -4
- package/dest/wallet/bundle.d.ts.map +1 -1
- package/dest/wallet/bundle.js +2 -1
- package/dest/wallet/lazy.d.ts +7 -4
- package/dest/wallet/lazy.d.ts.map +1 -1
- package/dest/wallet/lazy.js +2 -1
- package/dest/wallet/server.d.ts +7 -4
- package/dest/wallet/server.d.ts.map +1 -1
- package/dest/wallet/server.js +2 -1
- package/dest/wallet/test_wallet.d.ts +16 -1
- package/dest/wallet/test_wallet.d.ts.map +1 -1
- package/dest/wallet/test_wallet.js +19 -1
- 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 +56 -1
- package/src/wallet/bundle.ts +5 -8
- package/src/wallet/lazy.ts +5 -8
- package/src/wallet/server.ts +5 -8
- package/src/wallet/test_wallet.ts +28 -8
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,15 +1,39 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import { AztecAddress
|
|
2
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { ContractFunctionInteraction, DeployMethod, type DeployOptions, type SendInteractionOptions, SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
|
+
import { type OffchainEffect, type ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
3
6
|
import type { BaseTestWallet } from './wallet/test_wallet.js';
|
|
4
7
|
/**
|
|
5
8
|
* Deploys the SchnorrAccount contracts backed by prefunded addresses
|
|
6
9
|
* at genesis. This can be directly used to pay for transactions in FeeJuice.
|
|
7
10
|
*/
|
|
8
|
-
export declare function deployFundedSchnorrAccounts(wallet: BaseTestWallet, aztecNode: AztecNode, accountsData: InitialAccountData[], waitOptions?: WaitOpts): Promise<import("@aztec/aztec.js").AccountManager[]>;
|
|
11
|
+
export declare function deployFundedSchnorrAccounts(wallet: BaseTestWallet, aztecNode: AztecNode, accountsData: InitialAccountData[], waitOptions?: WaitOpts): Promise<import("@aztec/aztec.js/wallet").AccountManager[]>;
|
|
9
12
|
/**
|
|
10
13
|
* Registers the initial sandbox accounts in the wallet.
|
|
11
14
|
* @param wallet - Test wallet to use to register the accounts.
|
|
12
15
|
* @returns Addresses of the registered accounts.
|
|
13
16
|
*/
|
|
14
17
|
export declare function registerInitialSandboxAccountsInWallet(wallet: BaseTestWallet): Promise<AztecAddress[]>;
|
|
18
|
+
/**
|
|
19
|
+
* A proven transaction that can be sent to the network. Returned by the `prove` method of the test wallet
|
|
20
|
+
*/
|
|
21
|
+
export declare class ProvenTx extends Tx {
|
|
22
|
+
private node;
|
|
23
|
+
/** The offchain effects emitted during the execution of the transaction. */
|
|
24
|
+
offchainEffects: OffchainEffect[];
|
|
25
|
+
stats?: ProvingStats | undefined;
|
|
26
|
+
constructor(node: AztecNode, tx: Tx,
|
|
27
|
+
/** The offchain effects emitted during the execution of the transaction. */
|
|
28
|
+
offchainEffects: OffchainEffect[], stats?: ProvingStats | undefined);
|
|
29
|
+
send(): SentTx;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Helper function to prove an interaction via a TestWallet
|
|
33
|
+
* @param wallet - The TestWallet to use
|
|
34
|
+
* @param interaction - The interaction to prove
|
|
35
|
+
* @param options - Either SendInteractionOptions (for ContractFunctionInteraction) or DeployOptions (for DeployMethod)
|
|
36
|
+
* @returns - A proven transaction ready do be sent to the network
|
|
37
|
+
*/
|
|
38
|
+
export declare function proveInteraction(wallet: BaseTestWallet, interaction: ContractFunctionInteraction | DeployMethod, options: SendInteractionOptions | DeployOptions): Promise<ProvenTx>;
|
|
15
39
|
//# 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,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"utils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5 +1,7 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing/lazy';
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js';
|
|
2
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { DeployMethod, SentTx, toSendOptions } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
3
5
|
/**
|
|
4
6
|
* Deploys the SchnorrAccount contracts backed by prefunded addresses
|
|
5
7
|
* at genesis. This can be directly used to pay for transactions in FeeJuice.
|
|
@@ -28,3 +30,36 @@ import { AztecAddress } from '@aztec/aztec.js';
|
|
|
28
30
|
return (await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey)).address;
|
|
29
31
|
}));
|
|
30
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A proven transaction that can be sent to the network. Returned by the `prove` method of the test wallet
|
|
35
|
+
*/ export class ProvenTx extends Tx {
|
|
36
|
+
node;
|
|
37
|
+
offchainEffects;
|
|
38
|
+
stats;
|
|
39
|
+
constructor(node, tx, /** The offchain effects emitted during the execution of the transaction. */ offchainEffects, // eslint-disable-next-line jsdoc/require-jsdoc
|
|
40
|
+
stats){
|
|
41
|
+
super(tx.getTxHash(), tx.data, tx.clientIvcProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.node = node, this.offchainEffects = offchainEffects, this.stats = stats;
|
|
42
|
+
}
|
|
43
|
+
send() {
|
|
44
|
+
const sendTx = async ()=>{
|
|
45
|
+
await this.node.sendTx(this);
|
|
46
|
+
return this.getTxHash();
|
|
47
|
+
};
|
|
48
|
+
return new SentTx(this.node, sendTx);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Helper function to prove an interaction via a TestWallet
|
|
53
|
+
* @param wallet - The TestWallet to use
|
|
54
|
+
* @param interaction - The interaction to prove
|
|
55
|
+
* @param options - Either SendInteractionOptions (for ContractFunctionInteraction) or DeployOptions (for DeployMethod)
|
|
56
|
+
* @returns - A proven transaction ready do be sent to the network
|
|
57
|
+
*/ export async function proveInteraction(wallet, interaction, options) {
|
|
58
|
+
let execPayload;
|
|
59
|
+
if (interaction instanceof DeployMethod) {
|
|
60
|
+
execPayload = await interaction.request(interaction.convertDeployOptionsToRequestOptions(options));
|
|
61
|
+
} else {
|
|
62
|
+
execPayload = await interaction.request(options);
|
|
63
|
+
}
|
|
64
|
+
return wallet.proveTx(execPayload, await toSendOptions(options));
|
|
65
|
+
}
|
package/dest/wallet/bundle.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
2
5
|
import { type PXEConfig, type PXECreationOptions } from '@aztec/pxe/client/bundle';
|
|
3
6
|
import { BaseTestWallet } from './test_wallet.js';
|
|
4
7
|
/**
|
|
@@ -12,9 +15,9 @@ export declare class TestWallet extends BaseTestWallet {
|
|
|
12
15
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
13
16
|
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
14
17
|
getFakeAccountDataFor(address: AztecAddress): Promise<{
|
|
15
|
-
account: import("@aztec/aztec.js").BaseAccount;
|
|
16
|
-
instance: import("@aztec/aztec.js").ContractInstanceWithAddress;
|
|
17
|
-
artifact: import("@aztec/aztec.js").ContractArtifact;
|
|
18
|
+
account: import("@aztec/aztec.js/account").BaseAccount;
|
|
19
|
+
instance: import("@aztec/aztec.js/contracts").ContractInstanceWithAddress;
|
|
20
|
+
artifact: import("@aztec/aztec.js/abi").ContractArtifact;
|
|
18
21
|
}>;
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/wallet/bundle.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/wallet/bundle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAA2B,MAAM,0BAA0B,CAAC;AAG5G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,cAAc;WAC/B,MAAM,CACjB,IAAI,EAAE,SAAS,EACf,iBAAiB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EACtC,OAAO,GAAE,kBAAoC,GAC5C,OAAO,CAAC,UAAU,CAAC;IAStB,oBAAoB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAUpF,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAStF,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAShF,qBAAqB,CAAC,OAAO,EAAE,YAAY;;;;;CAkBlD"}
|
package/dest/wallet/bundle.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
3
3
|
import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
|
|
4
|
-
import {
|
|
4
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
6
|
import { createPXE, getPXEConfig } from '@aztec/pxe/client/bundle';
|
|
6
7
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
7
8
|
import { BaseTestWallet } from './test_wallet.js';
|
package/dest/wallet/lazy.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
2
5
|
import { type PXEConfig, type PXECreationOptions } from '@aztec/pxe/client/lazy';
|
|
3
6
|
import { BaseTestWallet } from './test_wallet.js';
|
|
4
7
|
/**
|
|
@@ -12,9 +15,9 @@ export declare class TestWallet extends BaseTestWallet {
|
|
|
12
15
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
13
16
|
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
14
17
|
getFakeAccountDataFor(address: AztecAddress): Promise<{
|
|
15
|
-
account: import("@aztec/aztec.js").BaseAccount;
|
|
16
|
-
instance: import("@aztec/aztec.js").ContractInstanceWithAddress;
|
|
17
|
-
artifact: import("@aztec/aztec.js").ContractArtifact;
|
|
18
|
+
account: import("@aztec/aztec.js/account").BaseAccount;
|
|
19
|
+
instance: import("@aztec/aztec.js/contracts").ContractInstanceWithAddress;
|
|
20
|
+
artifact: import("@aztec/aztec.js/abi").ContractArtifact;
|
|
18
21
|
}>;
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/wallet/lazy.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/wallet/lazy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAA2B,MAAM,wBAAwB,CAAC;AAG1G,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,cAAc;WAC/B,MAAM,CACjB,IAAI,EAAE,SAAS,EACf,iBAAiB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EACtC,OAAO,GAAE,kBAAoC,GAC5C,OAAO,CAAC,UAAU,CAAC;IAStB,oBAAoB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAUpF,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAStF,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAShF,qBAAqB,CAAC,OAAO,EAAE,YAAY;;;;;CAmBlD"}
|
package/dest/wallet/lazy.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa/lazy';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr/lazy';
|
|
3
3
|
import { createStubAccount, getStubAccountContractArtifact } from '@aztec/accounts/stub/lazy';
|
|
4
|
-
import {
|
|
4
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
6
|
import { createPXE, getPXEConfig } from '@aztec/pxe/client/lazy';
|
|
6
7
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
7
8
|
import { BaseTestWallet } from './test_wallet.js';
|
package/dest/wallet/server.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
2
5
|
import { type PXEConfig, type PXECreationOptions } from '@aztec/pxe/server';
|
|
3
6
|
import { BaseTestWallet } from './test_wallet.js';
|
|
4
7
|
/**
|
|
@@ -12,9 +15,9 @@ export declare class TestWallet extends BaseTestWallet {
|
|
|
12
15
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
13
16
|
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
14
17
|
getFakeAccountDataFor(address: AztecAddress): Promise<{
|
|
15
|
-
account: import("@aztec/aztec.js").BaseAccount;
|
|
16
|
-
instance: import("@aztec/aztec.js").ContractInstanceWithAddress;
|
|
17
|
-
artifact: import("@aztec/aztec.js").ContractArtifact;
|
|
18
|
+
account: import("@aztec/aztec.js/account").BaseAccount;
|
|
19
|
+
instance: import("@aztec/aztec.js/contracts").ContractInstanceWithAddress;
|
|
20
|
+
artifact: import("@aztec/aztec.js/abi").ContractArtifact;
|
|
18
21
|
}>;
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/wallet/server.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/wallet/server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAA2B,MAAM,mBAAmB,CAAC;AAGrG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,cAAc;WAC/B,MAAM,CACjB,IAAI,EAAE,SAAS,EACf,iBAAiB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EACtC,OAAO,GAAE,kBAAoC,GAC5C,OAAO,CAAC,UAAU,CAAC;IAStB,oBAAoB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAUpF,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAStF,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAShF,qBAAqB,CAAC,OAAO,EAAE,YAAY;;;;;CAkBlD"}
|
package/dest/wallet/server.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
3
3
|
import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
|
|
4
|
-
import {
|
|
4
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
6
|
import { createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
6
7
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
7
8
|
import { BaseTestWallet } from './test_wallet.js';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { type Account, type AccountContract } from '@aztec/aztec.js/account';
|
|
3
|
+
import { type CallIntent, type ContractFunctionInteractionCallIntent, type IntentInnerHash, SetPublicAuthwitContractInteraction } from '@aztec/aztec.js/authorization';
|
|
4
|
+
import { BaseWallet, type SendOptions, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
2
6
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
7
|
import { Fq, Fr } from '@aztec/foundation/fields';
|
|
4
8
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
@@ -6,6 +10,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
6
10
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
7
11
|
import type { NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
8
12
|
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
13
|
+
import { ProvenTx } from '../utils.js';
|
|
9
14
|
/**
|
|
10
15
|
* Data for generating an account.
|
|
11
16
|
*/
|
|
@@ -106,6 +111,16 @@ export declare abstract class BaseTestWallet extends BaseWallet {
|
|
|
106
111
|
artifact: ContractArtifact;
|
|
107
112
|
}>;
|
|
108
113
|
simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
114
|
+
/**
|
|
115
|
+
* A utility to prove a transaction using this wallet and return it to be sent by a different entity on their own accord
|
|
116
|
+
*
|
|
117
|
+
* Note that this should not be used in production code since a proven transaction could be sent to a malicious
|
|
118
|
+
* node to index and track. It also makes it very difficult for the wallet to keep track of the interaction.
|
|
119
|
+
* @param exec - The execution payload to prove.
|
|
120
|
+
* @param opts - The options to configure the interaction
|
|
121
|
+
* @returns - A proven tx ready to be sent to the network
|
|
122
|
+
*/
|
|
123
|
+
proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<ProvenTx>;
|
|
109
124
|
/**
|
|
110
125
|
* A debugging utility to get notes based on the provided filter.
|
|
111
126
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/test_wallet.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"test_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/test_wallet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,yBAAyB,CAAC;AAChG,OAAO,EACL,KAAK,UAAU,EACf,KAAK,qCAAqC,EAC1C,KAAK,eAAe,EACpB,mCAAmC,EAGpC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,E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jH;;;;;;;;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"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
-
import {
|
|
2
|
+
import { SignerlessAccount } from '@aztec/aztec.js/account';
|
|
3
|
+
import { SetPublicAuthwitContractInteraction, getMessageHashFromIntent, lookupValidity } from '@aztec/aztec.js/authorization';
|
|
4
|
+
import { BaseWallet } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
3
6
|
import { mergeExecutionPayloads } from '@aztec/entrypoints/payload';
|
|
4
7
|
import { Fr, GrumpkinScalar } from '@aztec/foundation/fields';
|
|
5
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
+
import { ProvenTx } from '../utils.js';
|
|
6
10
|
/**
|
|
7
11
|
* Wallet implementation that stores accounts in memory and allows allows their creation
|
|
8
12
|
* from the outside (which is something actual wallets shouldn't allow!)
|
|
@@ -134,6 +138,20 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
/**
|
|
141
|
+
* A utility to prove a transaction using this wallet and return it to be sent by a different entity on their own accord
|
|
142
|
+
*
|
|
143
|
+
* Note that this should not be used in production code since a proven transaction could be sent to a malicious
|
|
144
|
+
* node to index and track. It also makes it very difficult for the wallet to keep track of the interaction.
|
|
145
|
+
* @param exec - The execution payload to prove.
|
|
146
|
+
* @param opts - The options to configure the interaction
|
|
147
|
+
* @returns - A proven tx ready to be sent to the network
|
|
148
|
+
*/ async proveTx(exec, opts) {
|
|
149
|
+
const fee = await this.getDefaultFeeOptions(opts.from, opts.fee);
|
|
150
|
+
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
151
|
+
const txProvingResult = await this.pxe.proveTx(txRequest);
|
|
152
|
+
return new ProvenTx(this.aztecNode, await txProvingResult.toTx(), txProvingResult.getOffchainEffects(), txProvingResult.stats);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
137
155
|
* A debugging utility to get notes based on the provided filter.
|
|
138
156
|
*
|
|
139
157
|
* 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.20251024",
|
|
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.20251024",
|
|
66
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251024",
|
|
67
|
+
"@aztec/entrypoints": "3.0.0-nightly.20251024",
|
|
68
|
+
"@aztec/foundation": "3.0.0-nightly.20251024",
|
|
69
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251024",
|
|
70
|
+
"@aztec/pxe": "3.0.0-nightly.20251024",
|
|
71
|
+
"@aztec/stdlib": "3.0.0-nightly.20251024"
|
|
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,17 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing/lazy';
|
|
3
|
-
import { AztecAddress
|
|
3
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
+
import {
|
|
5
|
+
ContractFunctionInteraction,
|
|
6
|
+
DeployMethod,
|
|
7
|
+
type DeployOptions,
|
|
8
|
+
type SendInteractionOptions,
|
|
9
|
+
SentTx,
|
|
10
|
+
type WaitOpts,
|
|
11
|
+
toSendOptions,
|
|
12
|
+
} from '@aztec/aztec.js/contracts';
|
|
13
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
14
|
+
import { type OffchainEffect, type ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
4
15
|
|
|
5
16
|
import type { BaseTestWallet } from './wallet/test_wallet.js';
|
|
6
17
|
|
|
@@ -44,3 +55,47 @@ export async function registerInitialSandboxAccountsInWallet(wallet: BaseTestWal
|
|
|
44
55
|
}),
|
|
45
56
|
);
|
|
46
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* A proven transaction that can be sent to the network. Returned by the `prove` method of the test wallet
|
|
60
|
+
*/
|
|
61
|
+
export class ProvenTx extends Tx {
|
|
62
|
+
constructor(
|
|
63
|
+
private node: AztecNode,
|
|
64
|
+
tx: Tx,
|
|
65
|
+
/** The offchain effects emitted during the execution of the transaction. */
|
|
66
|
+
public offchainEffects: OffchainEffect[],
|
|
67
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
68
|
+
public stats?: ProvingStats,
|
|
69
|
+
) {
|
|
70
|
+
super(tx.getTxHash(), tx.data, tx.clientIvcProof, tx.contractClassLogFields, tx.publicFunctionCalldata);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
send() {
|
|
74
|
+
const sendTx = async () => {
|
|
75
|
+
await this.node.sendTx(this);
|
|
76
|
+
return this.getTxHash();
|
|
77
|
+
};
|
|
78
|
+
return new SentTx(this.node, sendTx);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Helper function to prove an interaction via a TestWallet
|
|
84
|
+
* @param wallet - The TestWallet to use
|
|
85
|
+
* @param interaction - The interaction to prove
|
|
86
|
+
* @param options - Either SendInteractionOptions (for ContractFunctionInteraction) or DeployOptions (for DeployMethod)
|
|
87
|
+
* @returns - A proven transaction ready do be sent to the network
|
|
88
|
+
*/
|
|
89
|
+
export async function proveInteraction(
|
|
90
|
+
wallet: BaseTestWallet,
|
|
91
|
+
interaction: ContractFunctionInteraction | DeployMethod,
|
|
92
|
+
options: SendInteractionOptions | DeployOptions,
|
|
93
|
+
) {
|
|
94
|
+
let execPayload;
|
|
95
|
+
if (interaction instanceof DeployMethod) {
|
|
96
|
+
execPayload = await interaction.request(interaction.convertDeployOptionsToRequestOptions(options));
|
|
97
|
+
} else {
|
|
98
|
+
execPayload = await interaction.request(options);
|
|
99
|
+
}
|
|
100
|
+
return wallet.proveTx(execPayload, await toSendOptions(options));
|
|
101
|
+
}
|
package/src/wallet/bundle.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
3
3
|
import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Fr,
|
|
10
|
-
getContractInstanceFromInstantiationParams,
|
|
11
|
-
} from '@aztec/aztec.js';
|
|
4
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
5
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
6
|
+
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
7
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
8
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
12
9
|
import { type PXEConfig, type PXECreationOptions, createPXE, getPXEConfig } from '@aztec/pxe/client/bundle';
|
|
13
10
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
14
11
|
|
package/src/wallet/lazy.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa/lazy';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr/lazy';
|
|
3
3
|
import { createStubAccount, getStubAccountContractArtifact } from '@aztec/accounts/stub/lazy';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Fr,
|
|
10
|
-
getContractInstanceFromInstantiationParams,
|
|
11
|
-
} from '@aztec/aztec.js';
|
|
4
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
5
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
6
|
+
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
7
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
8
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
12
9
|
import { type PXEConfig, type PXECreationOptions, createPXE, getPXEConfig } from '@aztec/pxe/client/lazy';
|
|
13
10
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
14
11
|
|
package/src/wallet/server.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
3
3
|
import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Fr,
|
|
10
|
-
getContractInstanceFromInstantiationParams,
|
|
11
|
-
} from '@aztec/aztec.js';
|
|
4
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
5
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
6
|
+
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
7
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
8
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
12
9
|
import { type PXEConfig, type PXECreationOptions, createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
13
10
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
14
11
|
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
3
|
+
import { type Account, type AccountContract, SignerlessAccount } from '@aztec/aztec.js/account';
|
|
2
4
|
import {
|
|
3
|
-
type Account,
|
|
4
|
-
type AccountContract,
|
|
5
|
-
AccountManager,
|
|
6
|
-
BaseWallet,
|
|
7
5
|
type CallIntent,
|
|
8
|
-
type ContractArtifact,
|
|
9
6
|
type ContractFunctionInteractionCallIntent,
|
|
10
7
|
type IntentInnerHash,
|
|
11
8
|
SetPublicAuthwitContractInteraction,
|
|
12
|
-
SignerlessAccount,
|
|
13
|
-
type SimulateOptions,
|
|
14
9
|
getMessageHashFromIntent,
|
|
15
10
|
lookupValidity,
|
|
16
|
-
} from '@aztec/aztec.js';
|
|
11
|
+
} from '@aztec/aztec.js/authorization';
|
|
12
|
+
import { BaseWallet, type SendOptions, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
13
|
+
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
17
14
|
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
18
15
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
|
|
19
16
|
import { Fq, Fr, GrumpkinScalar } from '@aztec/foundation/fields';
|
|
@@ -23,6 +20,8 @@ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
|
23
20
|
import type { NotesFilter, UniqueNote } from '@aztec/stdlib/note';
|
|
24
21
|
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
25
22
|
|
|
23
|
+
import { ProvenTx } from '../utils.js';
|
|
24
|
+
|
|
26
25
|
/**
|
|
27
26
|
* Data for generating an account.
|
|
28
27
|
*/
|
|
@@ -219,6 +218,27 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
219
218
|
}
|
|
220
219
|
}
|
|
221
220
|
|
|
221
|
+
/**
|
|
222
|
+
* A utility to prove a transaction using this wallet and return it to be sent by a different entity on their own accord
|
|
223
|
+
*
|
|
224
|
+
* Note that this should not be used in production code since a proven transaction could be sent to a malicious
|
|
225
|
+
* node to index and track. It also makes it very difficult for the wallet to keep track of the interaction.
|
|
226
|
+
* @param exec - The execution payload to prove.
|
|
227
|
+
* @param opts - The options to configure the interaction
|
|
228
|
+
* @returns - A proven tx ready to be sent to the network
|
|
229
|
+
*/
|
|
230
|
+
async proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<ProvenTx> {
|
|
231
|
+
const fee = await this.getDefaultFeeOptions(opts.from, opts.fee);
|
|
232
|
+
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
233
|
+
const txProvingResult = await this.pxe.proveTx(txRequest);
|
|
234
|
+
return new ProvenTx(
|
|
235
|
+
this.aztecNode,
|
|
236
|
+
await txProvingResult.toTx(),
|
|
237
|
+
txProvingResult.getOffchainEffects(),
|
|
238
|
+
txProvingResult.stats,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
222
242
|
/**
|
|
223
243
|
* A debugging utility to get notes based on the provided filter.
|
|
224
244
|
*
|