@aztec/test-wallet 0.0.1-commit.b655e406 → 0.0.1-commit.d1f2d6c
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 +2 -2
- package/dest/bundle.d.ts.map +1 -1
- package/dest/bundle.js +1 -1
- package/dest/lazy.d.ts +2 -2
- package/dest/lazy.d.ts.map +1 -1
- package/dest/lazy.js +1 -1
- package/dest/server.d.ts +2 -2
- package/dest/server.d.ts.map +1 -1
- package/dest/server.js +1 -1
- package/dest/utils.d.ts +33 -8
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +31 -13
- package/dest/wallet/bundle.d.ts +8 -2
- package/dest/wallet/bundle.d.ts.map +1 -1
- package/dest/wallet/bundle.js +15 -4
- package/dest/wallet/lazy.d.ts +8 -2
- package/dest/wallet/lazy.d.ts.map +1 -1
- package/dest/wallet/lazy.js +15 -4
- package/dest/wallet/server.d.ts +8 -2
- package/dest/wallet/server.d.ts.map +1 -1
- package/dest/wallet/server.js +15 -4
- package/dest/wallet/test_wallet.d.ts +26 -13
- package/dest/wallet/test_wallet.d.ts.map +1 -1
- package/dest/wallet/test_wallet.js +37 -18
- package/package.json +14 -11
- package/src/bundle.ts +1 -1
- package/src/lazy.ts +1 -1
- package/src/server.ts +1 -1
- package/src/utils.ts +64 -19
- package/src/wallet/bundle.ts +16 -4
- package/src/wallet/lazy.ts +16 -4
- package/src/wallet/server.ts +16 -4
- package/src/wallet/test_wallet.ts +52 -24
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,
|
|
4
|
-
//# sourceMappingURL=
|
|
3
|
+
export { deployFundedSchnorrAccounts, registerInitialLocalNetworkAccountsInWallet, ProvenTx, proveInteraction, } from './utils.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYnVuZGxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNoRCxPQUFPLEVBQUUsS0FBSyxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEVBQ0wsMkJBQTJCLEVBQzNCLDJDQUEyQyxFQUMzQyxRQUFRLEVBQ1IsZ0JBQWdCLEdBQ2pCLE1BQU0sWUFBWSxDQUFDIn0=
|
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,EACL,2BAA2B,EAC3B,
|
|
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,2CAA2C,EAC3C,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,
|
|
2
|
+
export { deployFundedSchnorrAccounts, registerInitialLocalNetworkAccountsInWallet, 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,
|
|
4
|
-
//# sourceMappingURL=
|
|
3
|
+
export { deployFundedSchnorrAccounts, registerInitialLocalNetworkAccountsInWallet, ProvenTx, proveInteraction, } from './utils.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2xhenkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQzlDLE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFDTCwyQkFBMkIsRUFDM0IsMkNBQTJDLEVBQzNDLFFBQVEsRUFDUixnQkFBZ0IsR0FDakIsTUFBTSxZQUFZLENBQUMifQ==
|
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,EACL,2BAA2B,EAC3B,
|
|
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,2CAA2C,EAC3C,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,
|
|
2
|
+
export { deployFundedSchnorrAccounts, registerInitialLocalNetworkAccountsInWallet, 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,
|
|
4
|
-
//# sourceMappingURL=
|
|
3
|
+
export { deployFundedSchnorrAccounts, registerInitialLocalNetworkAccountsInWallet, ProvenTx, proveInteraction, } from './utils.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvc2VydmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUNoRCxPQUFPLEVBQUUsS0FBSyxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRCxPQUFPLEVBQ0wsMkJBQTJCLEVBQzNCLDJDQUEyQyxFQUMzQyxRQUFRLEVBQ1IsZ0JBQWdCLEdBQ2pCLE1BQU0sWUFBWSxDQUFDIn0=
|
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,EACL,2BAA2B,EAC3B,
|
|
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,2CAA2C,EAC3C,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,
|
|
2
|
+
export { deployFundedSchnorrAccounts, registerInitialLocalNetworkAccountsInWallet, ProvenTx, proveInteraction } from './utils.js';
|
package/dest/utils.d.ts
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { ContractFunctionInteraction, DeployMethod, type DeployOptions, type
|
|
4
|
-
import type
|
|
5
|
-
import { type OffchainEffect, type ProvingStats, Tx } from '@aztec/stdlib/tx';
|
|
3
|
+
import { ContractFunctionInteraction, DeployMethod, type DeployOptions, type NoWait, type SendInteractionOptions, type WaitOpts } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { type AztecNode } from '@aztec/aztec.js/node';
|
|
5
|
+
import { type OffchainEffect, type ProvingStats, Tx, TxHash, type TxReceipt } from '@aztec/stdlib/tx';
|
|
6
6
|
import type { BaseTestWallet } from './wallet/test_wallet.js';
|
|
7
|
+
/**
|
|
8
|
+
* Options for sending a proven transaction.
|
|
9
|
+
*/
|
|
10
|
+
export type ProvenTxSendOpts = {
|
|
11
|
+
/**
|
|
12
|
+
* Whether to wait for the transaction to be mined.
|
|
13
|
+
* - undefined (default): wait with default options and return TxReceipt
|
|
14
|
+
* - WaitOpts object: wait with custom options and return TxReceipt
|
|
15
|
+
* - NO_WAIT: return txHash immediately without waiting
|
|
16
|
+
*/
|
|
17
|
+
wait?: NoWait | WaitOpts;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Return type for ProvenTx.send based on wait option.
|
|
21
|
+
*/
|
|
22
|
+
export type ProvenTxSendReturn<T extends NoWait | WaitOpts | undefined> = T extends NoWait ? TxHash : TxReceipt;
|
|
7
23
|
/**
|
|
8
24
|
* Deploys the SchnorrAccount contracts backed by prefunded addresses
|
|
9
25
|
* at genesis. This can be directly used to pay for transactions in FeeJuice.
|
|
10
26
|
*/
|
|
11
|
-
export declare function deployFundedSchnorrAccounts(wallet: BaseTestWallet,
|
|
27
|
+
export declare function deployFundedSchnorrAccounts(wallet: BaseTestWallet, accountsData: InitialAccountData[], waitOptions?: WaitOpts): Promise<import("@aztec/aztec.js/wallet").AccountManager[]>;
|
|
12
28
|
/**
|
|
13
|
-
* Registers the initial
|
|
29
|
+
* Registers the initial local network accounts in the wallet.
|
|
14
30
|
* @param wallet - Test wallet to use to register the accounts.
|
|
15
31
|
* @returns Addresses of the registered accounts.
|
|
16
32
|
*/
|
|
17
|
-
export declare function
|
|
33
|
+
export declare function registerInitialLocalNetworkAccountsInWallet(wallet: BaseTestWallet): Promise<AztecAddress[]>;
|
|
18
34
|
/**
|
|
19
35
|
* A proven transaction that can be sent to the network. Returned by the `prove` method of the test wallet
|
|
20
36
|
*/
|
|
@@ -26,7 +42,16 @@ export declare class ProvenTx extends Tx {
|
|
|
26
42
|
constructor(node: AztecNode, tx: Tx,
|
|
27
43
|
/** The offchain effects emitted during the execution of the transaction. */
|
|
28
44
|
offchainEffects: OffchainEffect[], stats?: ProvingStats | undefined);
|
|
29
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Sends the transaction to the network.
|
|
47
|
+
* @param options - Send options including whether to wait.
|
|
48
|
+
* @returns The transaction receipt if waiting, or the transaction hash if not.
|
|
49
|
+
*/
|
|
50
|
+
send(options?: Omit<ProvenTxSendOpts, 'wait'>): Promise<TxReceipt>;
|
|
51
|
+
send<W extends ProvenTxSendOpts['wait']>(options: ProvenTxSendOpts & {
|
|
52
|
+
wait: W;
|
|
53
|
+
}): Promise<ProvenTxSendReturn<W>>;
|
|
54
|
+
private contextualizeError;
|
|
30
55
|
}
|
|
31
56
|
/**
|
|
32
57
|
* Helper function to prove an interaction via a TestWallet
|
|
@@ -36,4 +61,4 @@ export declare class ProvenTx extends Tx {
|
|
|
36
61
|
* @returns - A proven transaction ready do be sent to the network
|
|
37
62
|
*/
|
|
38
63
|
export declare function proveInteraction(wallet: BaseTestWallet, interaction: ContractFunctionInteraction | DeployMethod, options: SendInteractionOptions | DeployOptions): Promise<ProvenTx>;
|
|
39
|
-
//# sourceMappingURL=
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRWxFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEVBQ0wsMkJBQTJCLEVBQzNCLFlBQVksRUFDWixLQUFLLGFBQWEsRUFFbEIsS0FBSyxNQUFNLEVBQ1gsS0FBSyxzQkFBc0IsRUFDM0IsS0FBSyxRQUFRLEVBRWQsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEVBQUUsS0FBSyxTQUFTLEVBQWEsTUFBTSxzQkFBc0IsQ0FBQztBQUVqRSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQUUsS0FBSyxZQUFZLEVBQUUsRUFBRSxFQUFFLE1BQU0sRUFBRSxLQUFLLFNBQVMsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBSXRHLE9BQU8s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sU0FBUyxDQUFDLENBQUM7SUFFbkUsSUFBSSxDQUFDLENBQUMsU0FBUyxnQkFBZ0IsQ0FBQyxNQUFNLENBQUMsRUFBRSxPQUFPLEVBQUUsZ0JBQWdCLEdBQUc7UUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFBO0tBQUUsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQWVsSCxPQUFPLENBQUMsa0JBQWtCO0NBVTNCO0FBRUQ7Ozs7OztHQU1HO0FBQ0gsd0JBQXNCLGdCQUFnQixDQUNwQyxNQUFNLEVBQUUsY0FBYyxFQUN0QixXQUFXLEVBQUUsMkJBQTJCLEdBQUcsWUFBWSxFQUN2RCxPQUFPLEVBQUUsc0JBQXNCLEdBQUcsYUFBYSxxQkFTaEQifQ==
|
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,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,2BAA2B,EAC3B,YAAY,EACZ,KAAK,aAAa,
|
|
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,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,2BAA2B,EAC3B,YAAY,EACZ,KAAK,aAAa,EAElB,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EAEd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,KAAK,cAAc,EAAE,K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AAkB;CAU3B;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,11 +1,14 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing/lazy';
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { DeployMethod,
|
|
3
|
+
import { DeployMethod, NO_WAIT, toSendOptions } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { waitForTx } from '@aztec/aztec.js/node';
|
|
5
|
+
import { SimulationError } from '@aztec/stdlib/errors';
|
|
4
6
|
import { Tx } from '@aztec/stdlib/tx';
|
|
7
|
+
import { inspect } from 'util';
|
|
5
8
|
/**
|
|
6
9
|
* Deploys the SchnorrAccount contracts backed by prefunded addresses
|
|
7
10
|
* at genesis. This can be directly used to pay for transactions in FeeJuice.
|
|
8
|
-
*/ export async function deployFundedSchnorrAccounts(wallet,
|
|
11
|
+
*/ export async function deployFundedSchnorrAccounts(wallet, accountsData, waitOptions) {
|
|
9
12
|
const accountManagers = [];
|
|
10
13
|
// Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
|
|
11
14
|
for(let i = 0; i < accountsData.length; i++){
|
|
@@ -14,17 +17,18 @@ import { Tx } from '@aztec/stdlib/tx';
|
|
|
14
17
|
const deployMethod = await accountManager.getDeployMethod();
|
|
15
18
|
await deployMethod.send({
|
|
16
19
|
from: AztecAddress.ZERO,
|
|
17
|
-
skipClassPublication: i !== 0
|
|
18
|
-
|
|
20
|
+
skipClassPublication: i !== 0,
|
|
21
|
+
wait: waitOptions
|
|
22
|
+
});
|
|
19
23
|
accountManagers.push(accountManager);
|
|
20
24
|
}
|
|
21
25
|
return accountManagers;
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
|
-
* Registers the initial
|
|
28
|
+
* Registers the initial local network accounts in the wallet.
|
|
25
29
|
* @param wallet - Test wallet to use to register the accounts.
|
|
26
30
|
* @returns Addresses of the registered accounts.
|
|
27
|
-
*/ export async function
|
|
31
|
+
*/ export async function registerInitialLocalNetworkAccountsInWallet(wallet) {
|
|
28
32
|
const testAccounts = await getInitialTestAccountsData();
|
|
29
33
|
return Promise.all(testAccounts.map(async (account)=>{
|
|
30
34
|
return (await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey)).address;
|
|
@@ -40,12 +44,26 @@ import { Tx } from '@aztec/stdlib/tx';
|
|
|
40
44
|
stats){
|
|
41
45
|
super(tx.getTxHash(), tx.data, tx.chonkProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.node = node, this.offchainEffects = offchainEffects, this.stats = stats;
|
|
42
46
|
}
|
|
43
|
-
send() {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
|
|
47
|
+
async send(options) {
|
|
48
|
+
const txHash = this.getTxHash();
|
|
49
|
+
await this.node.sendTx(this).catch((err)=>{
|
|
50
|
+
throw this.contextualizeError(err, inspect(this));
|
|
51
|
+
});
|
|
52
|
+
if (options?.wait === NO_WAIT) {
|
|
53
|
+
return txHash;
|
|
54
|
+
}
|
|
55
|
+
const waitOpts = typeof options?.wait === 'object' ? options.wait : undefined;
|
|
56
|
+
return await waitForTx(this.node, txHash, waitOpts);
|
|
57
|
+
}
|
|
58
|
+
contextualizeError(err, ...context) {
|
|
59
|
+
let contextStr = '';
|
|
60
|
+
if (context.length > 0) {
|
|
61
|
+
contextStr = `\nContext:\n${context.join('\n')}`;
|
|
62
|
+
}
|
|
63
|
+
if (err instanceof SimulationError) {
|
|
64
|
+
err.setAztecContext(contextStr);
|
|
65
|
+
}
|
|
66
|
+
return err;
|
|
49
67
|
}
|
|
50
68
|
}
|
|
51
69
|
/**
|
|
@@ -61,5 +79,5 @@ import { Tx } from '@aztec/stdlib/tx';
|
|
|
61
79
|
} else {
|
|
62
80
|
execPayload = await interaction.request(options);
|
|
63
81
|
}
|
|
64
|
-
return wallet.proveTx(execPayload,
|
|
82
|
+
return wallet.proveTx(execPayload, toSendOptions(options));
|
|
65
83
|
}
|
package/dest/wallet/bundle.d.ts
CHANGED
|
@@ -14,10 +14,16 @@ export declare class TestWallet extends BaseTestWallet {
|
|
|
14
14
|
createSchnorrAccount(secret: Fr, salt: Fr, signingKey?: Fq): Promise<AccountManager>;
|
|
15
15
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
16
16
|
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
19
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
20
|
+
* @param address - The address of the account to impersonate
|
|
21
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
22
|
+
*/
|
|
17
23
|
getFakeAccountDataFor(address: AztecAddress): Promise<{
|
|
18
24
|
account: import("@aztec/aztec.js/account").BaseAccount;
|
|
19
25
|
instance: import("@aztec/aztec.js/contracts").ContractInstanceWithAddress;
|
|
20
|
-
artifact: import("@aztec/
|
|
26
|
+
artifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
21
27
|
}>;
|
|
22
28
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FsbGV0L2J1bmRsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUU5RCxPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxNQUFNLHdC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
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/wallet/bundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/wallet/bundle.ts"],"names":[],"mappings":"AAIA,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;IAC5C,OAAa,MAAM,CACjB,IAAI,EAAE,SAAS,EACf,iBAAiB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EACtC,OAAO,GAAE,kBAAoC,GAC5C,OAAO,CAAC,UAAU,CAAC,CAOrB;IAED,oBAAoB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAQnF;IAED,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAOrF;IAED,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAOrF;IAED;;;;;OAKG;IACG,qBAAqB,CAAC,OAAO,EAAE,YAAY;;;;OAsBhD;CACF"}
|
package/dest/wallet/bundle.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { SignerlessAccount } from '@aztec/aztec.js/account';
|
|
4
5
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
6
7
|
import { createPXE, getPXEConfig } from '@aztec/pxe/client/bundle';
|
|
@@ -46,15 +47,25 @@ import { BaseTestWallet } from './test_wallet.js';
|
|
|
46
47
|
};
|
|
47
48
|
return this.createAccount(accountData);
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
52
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
53
|
+
* @param address - The address of the account to impersonate
|
|
54
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
55
|
+
*/ async getFakeAccountDataFor(address) {
|
|
51
56
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
57
|
+
// Account contracts can only be overridden if they have an associated address
|
|
58
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
59
|
+
// since it has no authorization mechanism.
|
|
60
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
61
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
62
|
+
}
|
|
52
63
|
const originalAddress = originalAccount.getCompleteAddress();
|
|
53
|
-
const
|
|
64
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
54
65
|
if (!contractInstance) {
|
|
55
66
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
56
67
|
}
|
|
57
|
-
const stubAccount = createStubAccount(originalAddress
|
|
68
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
58
69
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
59
70
|
salt: Fr.random()
|
|
60
71
|
});
|
package/dest/wallet/lazy.d.ts
CHANGED
|
@@ -14,10 +14,16 @@ export declare class TestWallet extends BaseTestWallet {
|
|
|
14
14
|
createSchnorrAccount(secret: Fr, salt: Fr, signingKey?: Fq): Promise<AccountManager>;
|
|
15
15
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
16
16
|
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
19
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
20
|
+
* @param address - The address of the account to impersonate
|
|
21
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
22
|
+
*/
|
|
17
23
|
getFakeAccountDataFor(address: AztecAddress): Promise<{
|
|
18
24
|
account: import("@aztec/aztec.js/account").BaseAccount;
|
|
19
25
|
instance: import("@aztec/aztec.js/contracts").ContractInstanceWithAddress;
|
|
20
|
-
artifact: import("@aztec/
|
|
26
|
+
artifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
21
27
|
}>;
|
|
22
28
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3dhbGxldC9sYXp5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRTlELE9BQU8sRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDaEQsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFF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ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/wallet/lazy.ts"],"names":[],"mappings":"AAIA,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;IAC5C,OAAa,MAAM,CACjB,IAAI,EAAE,SAAS,EACf,iBAAiB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EACtC,OAAO,GAAE,kBAAoC,GAC5C,OAAO,CAAC,UAAU,CAAC,CAOrB;IAED,oBAAoB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAQnF;IAED,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAOrF;IAED,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAOrF;IAED;;;;;OAKG;IACG,qBAAqB,CAAC,OAAO,EAAE,YAAY;;;;OAuBhD;CACF"}
|
package/dest/wallet/lazy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { SignerlessAccount } from '@aztec/aztec.js/account';
|
|
4
5
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
6
7
|
import { createPXE, getPXEConfig } from '@aztec/pxe/client/lazy';
|
|
@@ -46,15 +47,25 @@ import { BaseTestWallet } from './test_wallet.js';
|
|
|
46
47
|
};
|
|
47
48
|
return this.createAccount(accountData);
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
52
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
53
|
+
* @param address - The address of the account to impersonate
|
|
54
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
55
|
+
*/ async getFakeAccountDataFor(address) {
|
|
51
56
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
57
|
+
// Account contracts can only be overridden if they have an associated address
|
|
58
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
59
|
+
// since it has no authorization mechanism.
|
|
60
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
61
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
62
|
+
}
|
|
52
63
|
const originalAddress = originalAccount.getCompleteAddress();
|
|
53
|
-
const
|
|
64
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
54
65
|
if (!contractInstance) {
|
|
55
66
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
56
67
|
}
|
|
57
|
-
const stubAccount = createStubAccount(originalAddress
|
|
68
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
58
69
|
const StubAccountContractArtifact = await getStubAccountContractArtifact();
|
|
59
70
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
60
71
|
salt: Fr.random()
|
package/dest/wallet/server.d.ts
CHANGED
|
@@ -14,10 +14,16 @@ export declare class TestWallet extends BaseTestWallet {
|
|
|
14
14
|
createSchnorrAccount(secret: Fr, salt: Fr, signingKey?: Fq): Promise<AccountManager>;
|
|
15
15
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
16
16
|
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
19
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
20
|
+
* @param address - The address of the account to impersonate
|
|
21
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
22
|
+
*/
|
|
17
23
|
getFakeAccountDataFor(address: AztecAddress): Promise<{
|
|
18
24
|
account: import("@aztec/aztec.js/account").BaseAccount;
|
|
19
25
|
instance: import("@aztec/aztec.js/contracts").ContractInstanceWithAddress;
|
|
20
|
-
artifact: import("@aztec/
|
|
26
|
+
artifact: import("@aztec/stdlib/abi").ContractArtifact;
|
|
21
27
|
}>;
|
|
22
28
|
}
|
|
23
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvd2FsbGV0L3NlcnZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUU5RCxPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ2hELE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNCQUFzQixD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
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/wallet/server.ts"],"names":[],"mappings":"AAIA,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;IAC5C,OAAa,MAAM,CACjB,IAAI,EAAE,SAAS,EACf,iBAAiB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,EACtC,OAAO,GAAE,kBAAoC,GAC5C,OAAO,CAAC,UAAU,CAAC,CAOrB;IAED,oBAAoB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAQnF;IAED,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAOrF;IAED,mBAAmB,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAOrF;IAED;;;;;OAKG;IACG,qBAAqB,CAAC,OAAO,EAAE,YAAY;;;;OAsBhD;CACF"}
|
package/dest/wallet/server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { SignerlessAccount } from '@aztec/aztec.js/account';
|
|
4
5
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
5
6
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
6
7
|
import { createPXE, getPXEConfig } from '@aztec/pxe/server';
|
|
@@ -46,15 +47,25 @@ import { BaseTestWallet } from './test_wallet.js';
|
|
|
46
47
|
};
|
|
47
48
|
return this.createAccount(accountData);
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
52
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
53
|
+
* @param address - The address of the account to impersonate
|
|
54
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
55
|
+
*/ async getFakeAccountDataFor(address) {
|
|
51
56
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
57
|
+
// Account contracts can only be overridden if they have an associated address
|
|
58
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
59
|
+
// since it has no authorization mechanism.
|
|
60
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
61
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
62
|
+
}
|
|
52
63
|
const originalAddress = originalAccount.getCompleteAddress();
|
|
53
|
-
const
|
|
64
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
54
65
|
if (!contractInstance) {
|
|
55
66
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
56
67
|
}
|
|
57
|
-
const stubAccount = createStubAccount(originalAddress
|
|
68
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
58
69
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
59
70
|
salt: Fr.random()
|
|
60
71
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
2
|
import { type Account, type AccountContract } from '@aztec/aztec.js/account';
|
|
3
3
|
import { type CallIntent, type ContractFunctionInteractionCallIntent, type IntentInnerHash, SetPublicAuthwitContractInteraction } from '@aztec/aztec.js/authorization';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
7
|
-
import { Fq, Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { AccountManager, type SendOptions, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
5
|
+
import { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
8
6
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
9
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
8
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
11
|
-
import type {
|
|
12
|
-
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
9
|
+
import type { NoteDao, NotesFilter } from '@aztec/stdlib/note';
|
|
10
|
+
import type { TxHash, TxReceipt, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
11
|
+
import { ExecutionPayload } from '@aztec/stdlib/tx';
|
|
12
|
+
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
13
13
|
import { ProvenTx } from '../utils.js';
|
|
14
14
|
/**
|
|
15
15
|
* Data for generating an account.
|
|
@@ -55,7 +55,7 @@ export declare abstract class BaseTestWallet extends BaseWallet {
|
|
|
55
55
|
enableSimulatedSimulations(): void;
|
|
56
56
|
/** Disable the "simulated simulation" path for simulateTx. */
|
|
57
57
|
disableSimulatedSimulations(): void;
|
|
58
|
-
|
|
58
|
+
setMinFeePadding(value?: number): void;
|
|
59
59
|
protected getAccountFromAddress(address: AztecAddress): Promise<Account>;
|
|
60
60
|
getAccounts(): Promise<{
|
|
61
61
|
alias: string;
|
|
@@ -96,15 +96,21 @@ export declare abstract class BaseTestWallet extends BaseWallet {
|
|
|
96
96
|
* @param messageHashOrIntent - The action to authorize/revoke
|
|
97
97
|
* @param authorized - Whether the action can be performed or not
|
|
98
98
|
*/
|
|
99
|
-
setPublicAuthWit(from: AztecAddress, messageHashOrIntent: Fr |
|
|
99
|
+
setPublicAuthWit(from: AztecAddress, messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent, authorized: boolean): Promise<SetPublicAuthwitContractInteraction>;
|
|
100
100
|
/**
|
|
101
101
|
* Creates and returns an authwit according the the rules
|
|
102
102
|
* of the provided account. This authwit can be verified
|
|
103
103
|
* by the account contract
|
|
104
104
|
* @param from - The address authorizing the action
|
|
105
|
-
* @param
|
|
105
|
+
* @param intent - The action to authorize
|
|
106
|
+
*/
|
|
107
|
+
createAuthWit(from: AztecAddress, intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent): Promise<AuthWitness>;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
110
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
111
|
+
* @param address - The address of the account to impersonate
|
|
112
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
106
113
|
*/
|
|
107
|
-
createAuthWit(from: AztecAddress, messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent): Promise<AuthWitness>;
|
|
108
114
|
abstract getFakeAccountDataFor(address: AztecAddress): Promise<{
|
|
109
115
|
account: Account;
|
|
110
116
|
instance: ContractInstanceWithAddress;
|
|
@@ -120,7 +126,14 @@ export declare abstract class BaseTestWallet extends BaseWallet {
|
|
|
120
126
|
* @param opts - The options to configure the interaction
|
|
121
127
|
* @returns - A proven tx ready to be sent to the network
|
|
122
128
|
*/
|
|
123
|
-
proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<ProvenTx>;
|
|
129
|
+
proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<ProvenTx>;
|
|
130
|
+
/**
|
|
131
|
+
* Retrieves the transaction receipt for a given transaction hash.
|
|
132
|
+
* This is a passthrough to the underlying node, provided for convenience in testing.
|
|
133
|
+
* @param txHash - The hash of the transaction.
|
|
134
|
+
* @returns The transaction receipt.
|
|
135
|
+
*/
|
|
136
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
|
|
124
137
|
/**
|
|
125
138
|
* A debugging utility to get notes based on the provided filter.
|
|
126
139
|
*
|
|
@@ -132,7 +145,7 @@ export declare abstract class BaseTestWallet extends BaseWallet {
|
|
|
132
145
|
* @param filter - The filter to apply to the notes.
|
|
133
146
|
* @returns The requested notes.
|
|
134
147
|
*/
|
|
135
|
-
getNotes(filter: NotesFilter): Promise<
|
|
148
|
+
getNotes(filter: NotesFilter): Promise<NoteDao[]>;
|
|
136
149
|
/**
|
|
137
150
|
* Stops the internal job queue.
|
|
138
151
|
*
|
|
@@ -140,4 +153,4 @@ export declare abstract class BaseTestWallet extends BaseWallet {
|
|
|
140
153
|
*/
|
|
141
154
|
stop(): Promise<void>;
|
|
142
155
|
}
|
|
143
|
-
//# sourceMappingURL=
|
|
156
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdF93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93YWxsZXQvdGVzdF93YWxsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM1RCxPQUFPLEVBQUUsS0FBSyxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXFCLE1BQU0seUJBQXlCLENBQUM7QUFDaEcsT0FBTyxFQUNMLEtBQUssVUFBVSxFQUNmLEtBQUsscUNBQXFDLEVBQzFDLEtBQUssZUFBZSxFQUNwQixtQ0FB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BQyxRQUFRLENBQUMsQ0FVeEY7SUFFRDs7Ozs7T0FLRztJQUNILFlBQVksQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FFL0M7SUFFRDs7Ozs7Ozs7OztPQVVHO0lBQ0gsUUFBUSxDQUFDLE1BQU0sRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBRWhEO0lBRUQ7Ozs7T0FJRztJQUNILElBQUksSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBRXBCO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EAIpC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEhG,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,4B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gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAUxF;IAED;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE/C;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEhD;IAED;;;;OAIG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpB;CACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { SignerlessAccount } from '@aztec/aztec.js/account';
|
|
3
|
-
import { SetPublicAuthwitContractInteraction,
|
|
4
|
-
import { BaseWallet } from '@aztec/aztec.js/wallet';
|
|
3
|
+
import { SetPublicAuthwitContractInteraction, computeInnerAuthWitHashFromAction, isContractFunctionInteractionCallIntent, lookupValidity } from '@aztec/aztec.js/authorization';
|
|
5
4
|
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
8
7
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
+
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
9
|
+
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
9
10
|
import { ProvenTx } from '../utils.js';
|
|
10
11
|
/**
|
|
11
12
|
* Wallet implementation that stores accounts in memory and allows allows their creation
|
|
@@ -34,21 +35,20 @@ import { ProvenTx } from '../utils.js';
|
|
|
34
35
|
/** Disable the "simulated simulation" path for simulateTx. */ disableSimulatedSimulations() {
|
|
35
36
|
this.simulatedSimulations = false;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
this.
|
|
38
|
+
setMinFeePadding(value) {
|
|
39
|
+
this.minFeePadding = value ?? 0.5;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
getAccountFromAddress(address) {
|
|
41
42
|
let account;
|
|
42
43
|
if (address.equals(AztecAddress.ZERO)) {
|
|
43
|
-
|
|
44
|
-
account = new SignerlessAccount(chainInfo);
|
|
44
|
+
account = new SignerlessAccount();
|
|
45
45
|
} else {
|
|
46
46
|
account = this.accounts.get(address?.toString() ?? '');
|
|
47
47
|
}
|
|
48
48
|
if (!account) {
|
|
49
49
|
throw new Error(`Account not found in wallet for address: ${address}`);
|
|
50
50
|
}
|
|
51
|
-
return account;
|
|
51
|
+
return Promise.resolve(account);
|
|
52
52
|
}
|
|
53
53
|
getAccounts() {
|
|
54
54
|
return Promise.resolve(Array.from(this.accounts.values()).map((acc)=>({
|
|
@@ -102,18 +102,28 @@ import { ProvenTx } from '../utils.js';
|
|
|
102
102
|
* of the provided account. This authwit can be verified
|
|
103
103
|
* by the account contract
|
|
104
104
|
* @param from - The address authorizing the action
|
|
105
|
-
* @param
|
|
106
|
-
*/ async createAuthWit(from,
|
|
105
|
+
* @param intent - The action to authorize
|
|
106
|
+
*/ async createAuthWit(from, intent) {
|
|
107
107
|
const account = await this.getAccountFromAddress(from);
|
|
108
108
|
const chainInfo = await this.getChainInfo();
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
let intentInnerHash;
|
|
110
|
+
if ('caller' in intent) {
|
|
111
|
+
const call = isContractFunctionInteractionCallIntent(intent) ? await intent.action.getFunctionCall() : intent.call;
|
|
112
|
+
const innerHash = await computeInnerAuthWitHashFromAction(intent.caller, call);
|
|
113
|
+
intentInnerHash = {
|
|
114
|
+
innerHash,
|
|
115
|
+
consumer: call.to
|
|
116
|
+
};
|
|
117
|
+
} else {
|
|
118
|
+
intentInnerHash = intent;
|
|
119
|
+
}
|
|
120
|
+
return account.createAuthWit(intentInnerHash, chainInfo);
|
|
111
121
|
}
|
|
112
122
|
async simulateTx(executionPayload, opts) {
|
|
113
123
|
if (!this.simulatedSimulations) {
|
|
114
124
|
return super.simulateTx(executionPayload, opts);
|
|
115
125
|
} else {
|
|
116
|
-
const feeOptions = opts.fee?.estimateGas ? await this.
|
|
126
|
+
const feeOptions = opts.fee?.estimateGas ? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings) : await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
117
127
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
118
128
|
const executionOptions = {
|
|
119
129
|
txNonce: Fr.random(),
|
|
@@ -125,7 +135,8 @@ import { ProvenTx } from '../utils.js';
|
|
|
125
135
|
executionPayload
|
|
126
136
|
]) : executionPayload;
|
|
127
137
|
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
|
|
128
|
-
const
|
|
138
|
+
const chainInfo = await this.getChainInfo();
|
|
139
|
+
const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
129
140
|
const contractOverrides = {
|
|
130
141
|
[opts.from.toString()]: {
|
|
131
142
|
instance,
|
|
@@ -146,12 +157,20 @@ import { ProvenTx } from '../utils.js';
|
|
|
146
157
|
* @param opts - The options to configure the interaction
|
|
147
158
|
* @returns - A proven tx ready to be sent to the network
|
|
148
159
|
*/ async proveTx(exec, opts) {
|
|
149
|
-
const fee = await this.
|
|
160
|
+
const fee = await this.completeFeeOptions(opts.from, exec.feePayer, opts.fee?.gasSettings);
|
|
150
161
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
151
162
|
const txProvingResult = await this.pxe.proveTx(txRequest);
|
|
152
163
|
return new ProvenTx(this.aztecNode, await txProvingResult.toTx(), txProvingResult.getOffchainEffects(), txProvingResult.stats);
|
|
153
164
|
}
|
|
154
165
|
/**
|
|
166
|
+
* Retrieves the transaction receipt for a given transaction hash.
|
|
167
|
+
* This is a passthrough to the underlying node, provided for convenience in testing.
|
|
168
|
+
* @param txHash - The hash of the transaction.
|
|
169
|
+
* @returns The transaction receipt.
|
|
170
|
+
*/ getTxReceipt(txHash) {
|
|
171
|
+
return this.aztecNode.getTxReceipt(txHash);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
155
174
|
* A debugging utility to get notes based on the provided filter.
|
|
156
175
|
*
|
|
157
176
|
* Note that this should not be used in production code because the structure of notes is considered to be
|
|
@@ -162,7 +181,7 @@ import { ProvenTx } from '../utils.js';
|
|
|
162
181
|
* @param filter - The filter to apply to the notes.
|
|
163
182
|
* @returns The requested notes.
|
|
164
183
|
*/ getNotes(filter) {
|
|
165
|
-
return this.pxe.getNotes(filter);
|
|
184
|
+
return this.pxe.debug.getNotes(filter);
|
|
166
185
|
}
|
|
167
186
|
/**
|
|
168
187
|
* Stops the internal job queue.
|
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": "0.0.1-commit.
|
|
4
|
+
"version": "0.0.1-commit.d1f2d6c",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./client/bundle": "./dest/bundle.js",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"tsconfig": "./tsconfig.json"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "yarn clean && tsc
|
|
19
|
-
"build:dev": "tsc
|
|
20
|
-
"build:ts": "tsc
|
|
18
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
19
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
20
|
+
"build:ts": "../scripts/tsc.sh",
|
|
21
21
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
22
22
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
23
23
|
},
|
|
@@ -62,19 +62,22 @@
|
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
66
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
67
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
68
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
69
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
70
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
71
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
65
|
+
"@aztec/accounts": "0.0.1-commit.d1f2d6c",
|
|
66
|
+
"@aztec/aztec.js": "0.0.1-commit.d1f2d6c",
|
|
67
|
+
"@aztec/entrypoints": "0.0.1-commit.d1f2d6c",
|
|
68
|
+
"@aztec/foundation": "0.0.1-commit.d1f2d6c",
|
|
69
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.d1f2d6c",
|
|
70
|
+
"@aztec/pxe": "0.0.1-commit.d1f2d6c",
|
|
71
|
+
"@aztec/stdlib": "0.0.1-commit.d1f2d6c",
|
|
72
|
+
"@aztec/wallet-sdk": "0.0.1-commit.d1f2d6c"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
75
|
"@jest/globals": "^30.0.0",
|
|
75
76
|
"@types/jest": "^30.0.0",
|
|
76
77
|
"@types/node": "^22.15.17",
|
|
78
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
77
79
|
"jest": "^30.0.0",
|
|
80
|
+
"jest-mock-extended": "^4.0.0",
|
|
78
81
|
"resolve-typescript-plugin": "^2.0.1",
|
|
79
82
|
"ts-loader": "^9.5.4",
|
|
80
83
|
"ts-node": "^10.9.1",
|
package/src/bundle.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { TestWallet } from './wallet/bundle.js';
|
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
3
|
export {
|
|
4
4
|
deployFundedSchnorrAccounts,
|
|
5
|
-
|
|
5
|
+
registerInitialLocalNetworkAccountsInWallet,
|
|
6
6
|
ProvenTx,
|
|
7
7
|
proveInteraction,
|
|
8
8
|
} from './utils.js';
|
package/src/lazy.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { TestWallet } from './wallet/lazy.js';
|
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
3
|
export {
|
|
4
4
|
deployFundedSchnorrAccounts,
|
|
5
|
-
|
|
5
|
+
registerInitialLocalNetworkAccountsInWallet,
|
|
6
6
|
ProvenTx,
|
|
7
7
|
proveInteraction,
|
|
8
8
|
} from './utils.js';
|
package/src/server.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { TestWallet } from './wallet/server.js';
|
|
|
2
2
|
export { type AccountData } from './wallet/test_wallet.js';
|
|
3
3
|
export {
|
|
4
4
|
deployFundedSchnorrAccounts,
|
|
5
|
-
|
|
5
|
+
registerInitialLocalNetworkAccountsInWallet,
|
|
6
6
|
ProvenTx,
|
|
7
7
|
proveInteraction,
|
|
8
8
|
} from './utils.js';
|
package/src/utils.ts
CHANGED
|
@@ -5,23 +5,44 @@ import {
|
|
|
5
5
|
ContractFunctionInteraction,
|
|
6
6
|
DeployMethod,
|
|
7
7
|
type DeployOptions,
|
|
8
|
+
NO_WAIT,
|
|
9
|
+
type NoWait,
|
|
8
10
|
type SendInteractionOptions,
|
|
9
|
-
SentTx,
|
|
10
11
|
type WaitOpts,
|
|
11
12
|
toSendOptions,
|
|
12
13
|
} from '@aztec/aztec.js/contracts';
|
|
13
|
-
import type
|
|
14
|
-
import {
|
|
14
|
+
import { type AztecNode, waitForTx } from '@aztec/aztec.js/node';
|
|
15
|
+
import { SimulationError } from '@aztec/stdlib/errors';
|
|
16
|
+
import { type OffchainEffect, type ProvingStats, Tx, TxHash, type TxReceipt } from '@aztec/stdlib/tx';
|
|
17
|
+
|
|
18
|
+
import { inspect } from 'util';
|
|
15
19
|
|
|
16
20
|
import type { BaseTestWallet } from './wallet/test_wallet.js';
|
|
17
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Options for sending a proven transaction.
|
|
24
|
+
*/
|
|
25
|
+
export type ProvenTxSendOpts = {
|
|
26
|
+
/**
|
|
27
|
+
* Whether to wait for the transaction to be mined.
|
|
28
|
+
* - undefined (default): wait with default options and return TxReceipt
|
|
29
|
+
* - WaitOpts object: wait with custom options and return TxReceipt
|
|
30
|
+
* - NO_WAIT: return txHash immediately without waiting
|
|
31
|
+
*/
|
|
32
|
+
wait?: NoWait | WaitOpts;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Return type for ProvenTx.send based on wait option.
|
|
37
|
+
*/
|
|
38
|
+
export type ProvenTxSendReturn<T extends NoWait | WaitOpts | undefined> = T extends NoWait ? TxHash : TxReceipt;
|
|
39
|
+
|
|
18
40
|
/**
|
|
19
41
|
* Deploys the SchnorrAccount contracts backed by prefunded addresses
|
|
20
42
|
* at genesis. This can be directly used to pay for transactions in FeeJuice.
|
|
21
43
|
*/
|
|
22
44
|
export async function deployFundedSchnorrAccounts(
|
|
23
45
|
wallet: BaseTestWallet,
|
|
24
|
-
aztecNode: AztecNode,
|
|
25
46
|
accountsData: InitialAccountData[],
|
|
26
47
|
waitOptions?: WaitOpts,
|
|
27
48
|
) {
|
|
@@ -31,23 +52,22 @@ export async function deployFundedSchnorrAccounts(
|
|
|
31
52
|
const { secret, salt, signingKey } = accountsData[i];
|
|
32
53
|
const accountManager = await wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
33
54
|
const deployMethod = await accountManager.getDeployMethod();
|
|
34
|
-
await deployMethod
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.wait(waitOptions);
|
|
55
|
+
await deployMethod.send({
|
|
56
|
+
from: AztecAddress.ZERO,
|
|
57
|
+
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
58
|
+
wait: waitOptions,
|
|
59
|
+
});
|
|
40
60
|
accountManagers.push(accountManager);
|
|
41
61
|
}
|
|
42
62
|
return accountManagers;
|
|
43
63
|
}
|
|
44
64
|
|
|
45
65
|
/**
|
|
46
|
-
* Registers the initial
|
|
66
|
+
* Registers the initial local network accounts in the wallet.
|
|
47
67
|
* @param wallet - Test wallet to use to register the accounts.
|
|
48
68
|
* @returns Addresses of the registered accounts.
|
|
49
69
|
*/
|
|
50
|
-
export async function
|
|
70
|
+
export async function registerInitialLocalNetworkAccountsInWallet(wallet: BaseTestWallet): Promise<AztecAddress[]> {
|
|
51
71
|
const testAccounts = await getInitialTestAccountsData();
|
|
52
72
|
return Promise.all(
|
|
53
73
|
testAccounts.map(async account => {
|
|
@@ -70,12 +90,37 @@ export class ProvenTx extends Tx {
|
|
|
70
90
|
super(tx.getTxHash(), tx.data, tx.chonkProof, tx.contractClassLogFields, tx.publicFunctionCalldata);
|
|
71
91
|
}
|
|
72
92
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Sends the transaction to the network.
|
|
95
|
+
* @param options - Send options including whether to wait.
|
|
96
|
+
* @returns The transaction receipt if waiting, or the transaction hash if not.
|
|
97
|
+
*/
|
|
98
|
+
send(options?: Omit<ProvenTxSendOpts, 'wait'>): Promise<TxReceipt>;
|
|
99
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
100
|
+
send<W extends ProvenTxSendOpts['wait']>(options: ProvenTxSendOpts & { wait: W }): Promise<ProvenTxSendReturn<W>>;
|
|
101
|
+
async send(options?: ProvenTxSendOpts): Promise<TxHash | TxReceipt> {
|
|
102
|
+
const txHash = this.getTxHash();
|
|
103
|
+
await this.node.sendTx(this).catch(err => {
|
|
104
|
+
throw this.contextualizeError(err, inspect(this));
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
if (options?.wait === NO_WAIT) {
|
|
108
|
+
return txHash;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const waitOpts = typeof options?.wait === 'object' ? options.wait : undefined;
|
|
112
|
+
return await waitForTx(this.node, txHash, waitOpts);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private contextualizeError(err: Error, ...context: string[]): Error {
|
|
116
|
+
let contextStr = '';
|
|
117
|
+
if (context.length > 0) {
|
|
118
|
+
contextStr = `\nContext:\n${context.join('\n')}`;
|
|
119
|
+
}
|
|
120
|
+
if (err instanceof SimulationError) {
|
|
121
|
+
err.setAztecContext(contextStr);
|
|
122
|
+
}
|
|
123
|
+
return err;
|
|
79
124
|
}
|
|
80
125
|
}
|
|
81
126
|
|
|
@@ -97,5 +142,5 @@ export async function proveInteraction(
|
|
|
97
142
|
} else {
|
|
98
143
|
execPayload = await interaction.request(options);
|
|
99
144
|
}
|
|
100
|
-
return wallet.proveTx(execPayload,
|
|
145
|
+
return wallet.proveTx(execPayload, toSendOptions(options));
|
|
101
146
|
}
|
package/src/wallet/bundle.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { type Account, SignerlessAccount } from '@aztec/aztec.js/account';
|
|
4
5
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
5
6
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
6
7
|
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
@@ -58,15 +59,26 @@ export class TestWallet extends BaseTestWallet {
|
|
|
58
59
|
return this.createAccount(accountData);
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
64
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
65
|
+
* @param address - The address of the account to impersonate
|
|
66
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
67
|
+
*/
|
|
61
68
|
async getFakeAccountDataFor(address: AztecAddress) {
|
|
62
|
-
const chainInfo = await this.getChainInfo();
|
|
63
69
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
// Account contracts can only be overridden if they have an associated address
|
|
71
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
72
|
+
// since it has no authorization mechanism.
|
|
73
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
74
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
75
|
+
}
|
|
76
|
+
const originalAddress = (originalAccount as Account).getCompleteAddress();
|
|
77
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
66
78
|
if (!contractInstance) {
|
|
67
79
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
68
80
|
}
|
|
69
|
-
const stubAccount = createStubAccount(originalAddress
|
|
81
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
70
82
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
71
83
|
salt: Fr.random(),
|
|
72
84
|
});
|
package/src/wallet/lazy.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { type Account, SignerlessAccount } from '@aztec/aztec.js/account';
|
|
4
5
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
5
6
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
6
7
|
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
@@ -58,15 +59,26 @@ export class TestWallet extends BaseTestWallet {
|
|
|
58
59
|
return this.createAccount(accountData);
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
64
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
65
|
+
* @param address - The address of the account to impersonate
|
|
66
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
67
|
+
*/
|
|
61
68
|
async getFakeAccountDataFor(address: AztecAddress) {
|
|
62
|
-
const chainInfo = await this.getChainInfo();
|
|
63
69
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
// Account contracts can only be overridden if they have an associated address
|
|
71
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
72
|
+
// since it has no authorization mechanism.
|
|
73
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
74
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
75
|
+
}
|
|
76
|
+
const originalAddress = (originalAccount as Account).getCompleteAddress();
|
|
77
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
66
78
|
if (!contractInstance) {
|
|
67
79
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
68
80
|
}
|
|
69
|
-
const stubAccount = createStubAccount(originalAddress
|
|
81
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
70
82
|
const StubAccountContractArtifact = await getStubAccountContractArtifact();
|
|
71
83
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
72
84
|
salt: Fr.random(),
|
package/src/wallet/server.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 { type Account, SignerlessAccount } from '@aztec/aztec.js/account';
|
|
4
5
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
5
6
|
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
6
7
|
import { Fq, Fr } from '@aztec/aztec.js/fields';
|
|
@@ -58,15 +59,26 @@ export class TestWallet extends BaseTestWallet {
|
|
|
58
59
|
return this.createAccount(accountData);
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
64
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
65
|
+
* @param address - The address of the account to impersonate
|
|
66
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
67
|
+
*/
|
|
61
68
|
async getFakeAccountDataFor(address: AztecAddress) {
|
|
62
|
-
const chainInfo = await this.getChainInfo();
|
|
63
69
|
const originalAccount = await this.getAccountFromAddress(address);
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
// Account contracts can only be overridden if they have an associated address
|
|
71
|
+
// Overwriting SignerlessAccount is not supported, and does not really make sense
|
|
72
|
+
// since it has no authorization mechanism.
|
|
73
|
+
if (originalAccount instanceof SignerlessAccount) {
|
|
74
|
+
throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
|
|
75
|
+
}
|
|
76
|
+
const originalAddress = (originalAccount as Account).getCompleteAddress();
|
|
77
|
+
const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
|
|
66
78
|
if (!contractInstance) {
|
|
67
79
|
throw new Error(`No contract instance found for address: ${originalAddress.address}`);
|
|
68
80
|
}
|
|
69
|
-
const stubAccount = createStubAccount(originalAddress
|
|
81
|
+
const stubAccount = createStubAccount(originalAddress);
|
|
70
82
|
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
71
83
|
salt: Fr.random(),
|
|
72
84
|
});
|
|
@@ -6,19 +6,21 @@ import {
|
|
|
6
6
|
type ContractFunctionInteractionCallIntent,
|
|
7
7
|
type IntentInnerHash,
|
|
8
8
|
SetPublicAuthwitContractInteraction,
|
|
9
|
-
|
|
9
|
+
computeInnerAuthWitHashFromAction,
|
|
10
|
+
isContractFunctionInteractionCallIntent,
|
|
10
11
|
lookupValidity,
|
|
11
12
|
} from '@aztec/aztec.js/authorization';
|
|
12
|
-
import {
|
|
13
|
-
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
13
|
+
import { AccountManager, type SendOptions, type SimulateOptions } from '@aztec/aztec.js/wallet';
|
|
14
14
|
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
16
|
+
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
17
17
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
18
18
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
19
19
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
20
|
-
import type {
|
|
21
|
-
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
20
|
+
import type { NoteDao, NotesFilter } from '@aztec/stdlib/note';
|
|
21
|
+
import type { TxHash, TxReceipt, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
22
|
+
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
23
|
+
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
22
24
|
|
|
23
25
|
import { ProvenTx } from '../utils.js';
|
|
24
26
|
|
|
@@ -75,15 +77,14 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
75
77
|
this.simulatedSimulations = false;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
this.
|
|
80
|
+
setMinFeePadding(value?: number) {
|
|
81
|
+
this.minFeePadding = value ?? 0.5;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
protected
|
|
84
|
+
protected getAccountFromAddress(address: AztecAddress): Promise<Account> {
|
|
83
85
|
let account: Account | undefined;
|
|
84
86
|
if (address.equals(AztecAddress.ZERO)) {
|
|
85
|
-
|
|
86
|
-
account = new SignerlessAccount(chainInfo);
|
|
87
|
+
account = new SignerlessAccount();
|
|
87
88
|
} else {
|
|
88
89
|
account = this.accounts.get(address?.toString() ?? '');
|
|
89
90
|
}
|
|
@@ -92,7 +93,7 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
92
93
|
throw new Error(`Account not found in wallet for address: ${address}`);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
return account;
|
|
96
|
+
return Promise.resolve(account);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
getAccounts() {
|
|
@@ -162,7 +163,7 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
162
163
|
*/
|
|
163
164
|
public setPublicAuthWit(
|
|
164
165
|
from: AztecAddress,
|
|
165
|
-
messageHashOrIntent: Fr |
|
|
166
|
+
messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
|
|
166
167
|
authorized: boolean,
|
|
167
168
|
): Promise<SetPublicAuthwitContractInteraction> {
|
|
168
169
|
return SetPublicAuthwitContractInteraction.create(this, from, messageHashOrIntent, authorized);
|
|
@@ -173,18 +174,33 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
173
174
|
* of the provided account. This authwit can be verified
|
|
174
175
|
* by the account contract
|
|
175
176
|
* @param from - The address authorizing the action
|
|
176
|
-
* @param
|
|
177
|
+
* @param intent - The action to authorize
|
|
177
178
|
*/
|
|
178
179
|
public override async createAuthWit(
|
|
179
180
|
from: AztecAddress,
|
|
180
|
-
|
|
181
|
+
intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
|
|
181
182
|
): Promise<AuthWitness> {
|
|
182
183
|
const account = await this.getAccountFromAddress(from);
|
|
183
184
|
const chainInfo = await this.getChainInfo();
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
let intentInnerHash: IntentInnerHash;
|
|
186
|
+
if ('caller' in intent) {
|
|
187
|
+
const call = isContractFunctionInteractionCallIntent(intent)
|
|
188
|
+
? await intent.action.getFunctionCall()
|
|
189
|
+
: intent.call;
|
|
190
|
+
const innerHash = await computeInnerAuthWitHashFromAction(intent.caller, call);
|
|
191
|
+
intentInnerHash = { innerHash, consumer: call.to };
|
|
192
|
+
} else {
|
|
193
|
+
intentInnerHash = intent;
|
|
194
|
+
}
|
|
195
|
+
return account.createAuthWit(intentInnerHash, chainInfo);
|
|
186
196
|
}
|
|
187
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Creates a stub account that impersonates the given address, allowing kernelless simulations
|
|
200
|
+
* to bypass the account's authorization mechanisms via contract overrides.
|
|
201
|
+
* @param address - The address of the account to impersonate
|
|
202
|
+
* @returns The stub account, contract instance, and artifact for simulation
|
|
203
|
+
*/
|
|
188
204
|
abstract getFakeAccountDataFor(
|
|
189
205
|
address: AztecAddress, // eslint-disable-next-line jsdoc/require-jsdoc
|
|
190
206
|
): Promise<{ account: Account; instance: ContractInstanceWithAddress; artifact: ContractArtifact }>;
|
|
@@ -194,8 +210,8 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
194
210
|
return super.simulateTx(executionPayload, opts);
|
|
195
211
|
} else {
|
|
196
212
|
const feeOptions = opts.fee?.estimateGas
|
|
197
|
-
? await this.
|
|
198
|
-
: await this.
|
|
213
|
+
? await this.completeFeeOptionsForEstimation(opts.from, executionPayload.feePayer, opts.fee?.gasSettings)
|
|
214
|
+
: await this.completeFeeOptions(opts.from, executionPayload.feePayer, opts.fee?.gasSettings);
|
|
199
215
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
200
216
|
const executionOptions: DefaultAccountEntrypointOptions = {
|
|
201
217
|
txNonce: Fr.random(),
|
|
@@ -206,9 +222,11 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
206
222
|
? mergeExecutionPayloads([feeExecutionPayload, executionPayload])
|
|
207
223
|
: executionPayload;
|
|
208
224
|
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(opts.from);
|
|
225
|
+
const chainInfo = await this.getChainInfo();
|
|
209
226
|
const txRequest = await fromAccount.createTxExecutionRequest(
|
|
210
227
|
finalExecutionPayload,
|
|
211
228
|
feeOptions.gasSettings,
|
|
229
|
+
chainInfo,
|
|
212
230
|
executionOptions,
|
|
213
231
|
);
|
|
214
232
|
const contractOverrides = {
|
|
@@ -227,8 +245,8 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
227
245
|
* @param opts - The options to configure the interaction
|
|
228
246
|
* @returns - A proven tx ready to be sent to the network
|
|
229
247
|
*/
|
|
230
|
-
async proveTx(exec: ExecutionPayload, opts: SendOptions): Promise<ProvenTx> {
|
|
231
|
-
const fee = await this.
|
|
248
|
+
async proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<ProvenTx> {
|
|
249
|
+
const fee = await this.completeFeeOptions(opts.from, exec.feePayer, opts.fee?.gasSettings);
|
|
232
250
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
233
251
|
const txProvingResult = await this.pxe.proveTx(txRequest);
|
|
234
252
|
return new ProvenTx(
|
|
@@ -239,6 +257,16 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
239
257
|
);
|
|
240
258
|
}
|
|
241
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Retrieves the transaction receipt for a given transaction hash.
|
|
262
|
+
* This is a passthrough to the underlying node, provided for convenience in testing.
|
|
263
|
+
* @param txHash - The hash of the transaction.
|
|
264
|
+
* @returns The transaction receipt.
|
|
265
|
+
*/
|
|
266
|
+
getTxReceipt(txHash: TxHash): Promise<TxReceipt> {
|
|
267
|
+
return this.aztecNode.getTxReceipt(txHash);
|
|
268
|
+
}
|
|
269
|
+
|
|
242
270
|
/**
|
|
243
271
|
* A debugging utility to get notes based on the provided filter.
|
|
244
272
|
*
|
|
@@ -250,8 +278,8 @@ export abstract class BaseTestWallet extends BaseWallet {
|
|
|
250
278
|
* @param filter - The filter to apply to the notes.
|
|
251
279
|
* @returns The requested notes.
|
|
252
280
|
*/
|
|
253
|
-
getNotes(filter: NotesFilter): Promise<
|
|
254
|
-
return this.pxe.getNotes(filter);
|
|
281
|
+
getNotes(filter: NotesFilter): Promise<NoteDao[]> {
|
|
282
|
+
return this.pxe.debug.getNotes(filter);
|
|
255
283
|
}
|
|
256
284
|
|
|
257
285
|
/**
|