@aztec/cli-wallet 0.0.1-commit.d431d1c → 0.0.1-commit.e310a4c8
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/cmds/authorize_action.js +4 -2
- package/dest/cmds/check_tx.js +4 -1
- package/dest/cmds/create_account.d.ts +1 -1
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +24 -18
- package/dest/cmds/deploy.d.ts +1 -1
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +46 -23
- package/dest/cmds/deploy_account.d.ts +1 -1
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +24 -18
- package/dest/cmds/send.d.ts +1 -1
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +28 -16
- package/dest/storage/wallet_db.d.ts +1 -1
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +46 -31
- package/package.json +14 -14
- package/src/cmds/authorize_action.ts +1 -1
- package/src/cmds/check_tx.ts +4 -1
- package/src/cmds/create_account.ts +23 -17
- package/src/cmds/deploy.ts +41 -22
- package/src/cmds/deploy_account.ts +23 -17
- package/src/cmds/send.ts +22 -10
- package/src/storage/wallet_db.ts +49 -36
|
@@ -13,8 +13,10 @@ export async function authorizeAction(wallet, from, functionName, caller, functi
|
|
|
13
13
|
caller,
|
|
14
14
|
action
|
|
15
15
|
}, true);
|
|
16
|
-
const witness = await setAuthwitnessInteraction.send(
|
|
17
|
-
|
|
16
|
+
const witness = await setAuthwitnessInteraction.send({
|
|
17
|
+
wait: {
|
|
18
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
19
|
+
}
|
|
18
20
|
});
|
|
19
21
|
log(`Authorized action ${functionName} on contract ${contractAddress} for caller ${caller}`);
|
|
20
22
|
return witness;
|
package/dest/cmds/check_tx.js
CHANGED
|
@@ -17,7 +17,10 @@ async function inspectTx(wallet, aztecNode, txHash, log) {
|
|
|
17
17
|
]);
|
|
18
18
|
// Base tx data
|
|
19
19
|
log(`Tx ${txHash.toString()}`);
|
|
20
|
-
log(` Status: ${receipt.status}
|
|
20
|
+
log(` Status: ${receipt.status}`);
|
|
21
|
+
if (receipt.executionResult) {
|
|
22
|
+
log(` Execution result: ${receipt.executionResult}`);
|
|
23
|
+
}
|
|
21
24
|
if (receipt.error) {
|
|
22
25
|
log(` Error: ${receipt.error}`);
|
|
23
26
|
}
|
|
@@ -11,4 +11,4 @@ export declare function createAccount(wallet: CLIWallet, aztecNode: AztecNode, a
|
|
|
11
11
|
secretKey: Fr;
|
|
12
12
|
salt: Fr;
|
|
13
13
|
}>;
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlX2FjY291bnQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbWRzL2NyZWF0ZV9hY2NvdW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV6RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd0RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSTNELE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3pELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUV0RCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFL0Msd0JBQXNCLGFBQWEsQ0FDakMsTUFBTSxFQUFFLFNBQVMsRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsV0FBVyxFQUFFLFdBQVcsRUFDeEIsU0FBUyxFQUFFLEVBQUUsR0FBRyxTQUFTLEVBQ3pCLFNBQVMsRUFBRSxNQUFNLEdBQUcsU0FBUyxFQUM3QixLQUFLLEVBQUUsTUFBTSxHQUFHLFNBQVMsRUFDekIsUUFBUSxFQUFFLFlBQVksR0FBRyxTQUFTLEVBQ2xDLFlBQVksRUFBRSxPQUFPLEVBQ3JCLGtCQUFrQixFQUFFLE9BQU8sRUFDM0IsWUFBWSxFQUFFLE9BQU8sRUFDckIsYUFBYSxFQUFFLE9BQU8sRUFDdEIsSUFBSSxFQUFFLE9BQU8sRUFDYixPQUFPLEVBQUUsVUFBVSxFQUNuQixJQUFJLEVBQUUsT0FBTyxFQUNiLE9BQU8sRUFBRSxPQUFPLEVBQ2hCLFdBQVcsRUFBRSxNQUFNLEVBQ25CLEdBQUcsRUFBRSxLQUFLOzs7OztHQXFIWCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"create_account.d.ts","sourceRoot":"","sources":["../../src/cmds/create_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,EAAE,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,YAAY,EAAE,OAAO,EACrB,kBAAkB,EAAE,OAAO,EAC3B,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK;;;;;GAqHX"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
3
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
5
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
@@ -29,7 +30,7 @@ export async function createAccount(wallet, aztecNode, accountType, secretKey, p
|
|
|
29
30
|
log(`Salt: ${salt.toString()}`);
|
|
30
31
|
log(`Init hash: ${account.getInstance().initializationHash.toString()}`);
|
|
31
32
|
}
|
|
32
|
-
let
|
|
33
|
+
let txHash;
|
|
33
34
|
let txReceipt;
|
|
34
35
|
if (!registerOnly) {
|
|
35
36
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
@@ -67,38 +68,43 @@ export async function createAccount(wallet, aztecNode, accountType, secretKey, p
|
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
} else {
|
|
70
|
-
|
|
71
|
+
if (verbose) {
|
|
72
|
+
printProfileResult(stats, log);
|
|
73
|
+
}
|
|
74
|
+
if (!json) {
|
|
75
|
+
log(`\nWaiting for account contract deployment...`);
|
|
76
|
+
}
|
|
77
|
+
const result = await deployMethod.send({
|
|
71
78
|
...deployAccountOpts,
|
|
72
79
|
fee: deployAccountOpts.fee ? {
|
|
73
80
|
...deployAccountOpts.fee,
|
|
74
81
|
gasSettings: estimatedGas
|
|
75
|
-
} : undefined
|
|
82
|
+
} : undefined,
|
|
83
|
+
wait: wait ? {
|
|
84
|
+
timeout: DEFAULT_TX_TIMEOUT_S,
|
|
85
|
+
returnReceipt: true
|
|
86
|
+
} : NO_WAIT
|
|
76
87
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
82
|
-
out.txHash = txHash;
|
|
83
|
-
if (wait) {
|
|
84
|
-
if (!json) {
|
|
85
|
-
log(`\nWaiting for account contract deployment...`);
|
|
86
|
-
}
|
|
87
|
-
txReceipt = await tx.wait({
|
|
88
|
-
timeout: DEFAULT_TX_TIMEOUT_S
|
|
89
|
-
});
|
|
88
|
+
const isReceipt = (data)=>'txHash' in data;
|
|
89
|
+
if (isReceipt(result)) {
|
|
90
|
+
txReceipt = result;
|
|
91
|
+
txHash = result.txHash;
|
|
90
92
|
out.txReceipt = {
|
|
91
93
|
status: txReceipt.status,
|
|
92
94
|
transactionFee: txReceipt.transactionFee
|
|
93
95
|
};
|
|
96
|
+
} else {
|
|
97
|
+
txHash = result;
|
|
94
98
|
}
|
|
99
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
100
|
+
out.txHash = txHash;
|
|
95
101
|
}
|
|
96
102
|
}
|
|
97
103
|
if (json) {
|
|
98
104
|
log(prettyPrintJSON(out));
|
|
99
105
|
} else {
|
|
100
|
-
if (
|
|
101
|
-
log(`Deploy tx hash: ${
|
|
106
|
+
if (txHash) {
|
|
107
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
102
108
|
}
|
|
103
109
|
if (txReceipt) {
|
|
104
110
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
package/dest/cmds/deploy.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ import { PublicKeys } from '@aztec/stdlib/keys';
|
|
|
6
6
|
import { CLIFeeArgs } from '../utils/options/fees.js';
|
|
7
7
|
import type { CLIWallet } from '../utils/wallet.js';
|
|
8
8
|
export declare function deploy(wallet: CLIWallet, node: AztecNode, deployer: AztecAddress, artifactPath: string, json: boolean, publicKeys: PublicKeys | undefined, rawArgs: any[], salt: Fr | undefined, initializer: string | undefined, skipInstancePublication: boolean, skipClassPublication: boolean, skipInitialization: boolean | undefined, wait: boolean, feeOpts: CLIFeeArgs, verbose: boolean, timeout: number | undefined, debugLogger: Logger, log: LogFn): Promise<AztecAddress | undefined>;
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY21kcy9kZXBsb3kudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBSXpELE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUM1QyxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV0RCxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFM0QsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBR2hELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUV0RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVwRCx3QkFBc0IsTUFBTSxDQUMxQixNQUFNLEVBQUUsU0FBUyxFQUNqQixJQUFJLEVBQUUsU0FBUyxFQUNmLFFBQVEsRUFBRSxZQUFZLEVBQ3RCLFlBQVksRUFBRSxNQUFNLEVBQ3BCLElBQUksRUFBRSxPQUFPLEVBQ2IsVUFBVSxFQUFFLFVBQVUsR0FBRyxTQUFTLEVBQ2xDLE9BQU8sRUFBRSxHQUFHLEVBQUUsRUFDZCxJQUFJLEVBQUUsRUFBRSxHQUFHLFNBQVMsRUFDcEIsV0FBVyxFQUFFLE1BQU0sR0FBRyxTQUFTLEVBQy9CLHVCQUF1QixFQUFFLE9BQU8sRUFDaEMsb0JBQW9CLEVBQUUsT0FBTyxFQUM3QixrQkFBa0IsRUFBRSxPQUFPLEdBQUcsU0FBUyxFQUN2QyxJQUFJLEVBQUUsT0FBTyxFQUNiLE9BQU8sRUFBRSxVQUFVLEVBQ25CLE9BQU8sRUFBRSxPQUFPLEVBQ2hCLE9BQU8sb0JBQStCLEVBQ3RDLFdBQVcsRUFBRSxNQUFNLEVBQ25CLEdBQUcsRUFBRSxLQUFLLHFDQWtIWCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,MAAM,CAC1B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,OAAO,EAAE,GAAG,EAAE,EACd,IAAI,EAAE,EAAE,GAAG,SAAS,EACpB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,uBAAuB,EAAE,OAAO,EAChC,oBAAoB,EAAE,OAAO,EAC7B,kBAAkB,EAAE,OAAO,GAAG,SAAS,EACvC,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,OAAO,EAChB,OAAO,oBAA+B,EACtC,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,qCAkHX"}
|
package/dest/cmds/deploy.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import { ContractDeployer } from '@aztec/aztec.js/deployment';
|
|
3
4
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
5
|
import { encodeArgs, getContractArtifact, prettyPrintJSON } from '@aztec/cli/utils';
|
|
@@ -58,38 +59,60 @@ export async function deploy(wallet, node, deployer, artifactPath, json, publicK
|
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
} else {
|
|
61
|
-
const tx = deploy1.send(deployOpts);
|
|
62
62
|
if (verbose) {
|
|
63
63
|
printProfileResult(stats, log);
|
|
64
64
|
}
|
|
65
|
-
const txHash = await tx.getTxHash();
|
|
66
|
-
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
67
|
-
out.hash = txHash;
|
|
68
65
|
const { address, partialAddress } = deploy1;
|
|
69
66
|
const instance = await deploy1.getInstance();
|
|
70
|
-
if (!json) {
|
|
71
|
-
log(`Contract deployed at ${address?.toString()}`);
|
|
72
|
-
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
73
|
-
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
74
|
-
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
75
|
-
log(`Deployment salt: ${salt.toString()}`);
|
|
76
|
-
log(`Deployer: ${instance.deployer.toString()}`);
|
|
77
|
-
} else {
|
|
78
|
-
out.contract = {
|
|
79
|
-
address: address?.toString(),
|
|
80
|
-
partialAddress: (await partialAddress)?.toString(),
|
|
81
|
-
initializationHash: instance.initializationHash.toString(),
|
|
82
|
-
salt: salt.toString()
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
67
|
if (wait) {
|
|
86
|
-
const
|
|
87
|
-
|
|
68
|
+
const receipt = await deploy1.send({
|
|
69
|
+
...deployOpts,
|
|
70
|
+
wait: {
|
|
71
|
+
timeout,
|
|
72
|
+
returnReceipt: true
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const txHash = receipt.txHash;
|
|
76
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
77
|
+
out.hash = txHash;
|
|
78
|
+
if (!json) {
|
|
79
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
80
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
81
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
82
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
83
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
84
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
85
|
+
log(`Transaction fee: ${receipt.transactionFee?.toString()}`);
|
|
86
|
+
} else {
|
|
87
|
+
out.contract = {
|
|
88
|
+
address: address?.toString(),
|
|
89
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
90
|
+
initializationHash: instance.initializationHash.toString(),
|
|
91
|
+
salt: salt.toString(),
|
|
92
|
+
transactionFee: receipt.transactionFee?.toString()
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
const txHash = await deploy1.send({
|
|
97
|
+
...deployOpts,
|
|
98
|
+
wait: NO_WAIT
|
|
88
99
|
});
|
|
100
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
101
|
+
out.hash = txHash;
|
|
89
102
|
if (!json) {
|
|
90
|
-
log(`
|
|
103
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
104
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
105
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
106
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
107
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
108
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
91
109
|
} else {
|
|
92
|
-
out.contract
|
|
110
|
+
out.contract = {
|
|
111
|
+
address: address?.toString(),
|
|
112
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
113
|
+
initializationHash: instance.initializationHash.toString(),
|
|
114
|
+
salt: salt.toString()
|
|
115
|
+
};
|
|
93
116
|
}
|
|
94
117
|
}
|
|
95
118
|
}
|
|
@@ -4,4 +4,4 @@ import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
|
4
4
|
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
5
5
|
import type { CLIWallet } from '../utils/wallet.js';
|
|
6
6
|
export declare function deployAccount(wallet: CLIWallet, aztecNode: AztecNode, address: AztecAddress, wait: boolean, deployer: AztecAddress | undefined, registerClass: boolean, publicDeploy: boolean, skipInitialization: boolean, feeOpts: CLIFeeArgs, json: boolean, verbose: boolean, debugLogger: Logger, log: LogFn): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwbG95X2FjY291bnQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbWRzL2RlcGxveV9hY2NvdW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUV6RCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd0RCxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFJM0QsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFM0QsT0FBTyxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFFcEQsd0JBQXNCLGFBQWEsQ0FDakMsTUFBTSxFQUFFLFNBQVMsRUFDakIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsT0FBTyxFQUFFLFlBQVksRUFDckIsSUFBSSxFQUFFLE9BQU8sRUFDYixRQUFRLEVBQUUsWUFBWSxHQUFHLFNBQVMsRUFDbEMsYUFBYSxFQUFFLE9BQU8sRUFDdEIsWUFBWSxFQUFFLE9BQU8sRUFDckIsa0JBQWtCLEVBQUUsT0FBTyxFQUMzQixPQUFPLEVBQUUsVUFBVSxFQUNuQixJQUFJLEVBQUUsT0FBTyxFQUNiLE9BQU8sRUFBRSxPQUFPLEVBQ2hCLFdBQVcsRUFBRSxNQUFNLEVBQ25CLEdBQUcsRUFBRSxLQUFLLGlCQW9HWCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy_account.d.ts","sourceRoot":"","sources":["../../src/cmds/deploy_account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,YAAY,GAAG,SAAS,EAClC,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,EACrB,kBAAkB,EAAE,OAAO,EAC3B,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,KAAK,iBAoGX"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
3
4
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
4
5
|
import { printProfileResult } from '../utils/profiling.js';
|
|
@@ -21,7 +22,7 @@ export async function deployAccount(wallet, aztecNode, address, wait, deployer,
|
|
|
21
22
|
log(`Salt: ${salt.toString()}`);
|
|
22
23
|
log(`Init hash: ${initializationHash.toString()}`);
|
|
23
24
|
}
|
|
24
|
-
let
|
|
25
|
+
let txHash;
|
|
25
26
|
let txReceipt;
|
|
26
27
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
27
28
|
const delegatedDeployment = deployer && !account.address.equals(deployer);
|
|
@@ -58,37 +59,42 @@ export async function deployAccount(wallet, aztecNode, address, wait, deployer,
|
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
} else {
|
|
61
|
-
|
|
62
|
+
if (verbose) {
|
|
63
|
+
printProfileResult(stats, log);
|
|
64
|
+
}
|
|
65
|
+
if (!json) {
|
|
66
|
+
log(`\nWaiting for account contract deployment...`);
|
|
67
|
+
}
|
|
68
|
+
const result = await deployMethod.send({
|
|
62
69
|
...deployAccountOpts,
|
|
63
70
|
fee: deployAccountOpts.fee ? {
|
|
64
71
|
...deployAccountOpts.fee,
|
|
65
72
|
gasSettings: estimatedGas
|
|
66
|
-
} : undefined
|
|
73
|
+
} : undefined,
|
|
74
|
+
wait: wait ? {
|
|
75
|
+
timeout: DEFAULT_TX_TIMEOUT_S,
|
|
76
|
+
returnReceipt: true
|
|
77
|
+
} : NO_WAIT
|
|
67
78
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
73
|
-
out.txHash = txHash;
|
|
74
|
-
if (wait) {
|
|
75
|
-
if (!json) {
|
|
76
|
-
log(`\nWaiting for account contract deployment...`);
|
|
77
|
-
}
|
|
78
|
-
txReceipt = await tx.wait({
|
|
79
|
-
timeout: DEFAULT_TX_TIMEOUT_S
|
|
80
|
-
});
|
|
79
|
+
const isReceipt = (data)=>'txHash' in data;
|
|
80
|
+
if (isReceipt(result)) {
|
|
81
|
+
txReceipt = result;
|
|
82
|
+
txHash = result.txHash;
|
|
81
83
|
out.txReceipt = {
|
|
82
84
|
status: txReceipt.status,
|
|
83
85
|
transactionFee: txReceipt.transactionFee
|
|
84
86
|
};
|
|
87
|
+
} else {
|
|
88
|
+
txHash = result;
|
|
85
89
|
}
|
|
90
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
91
|
+
out.txHash = txHash;
|
|
86
92
|
}
|
|
87
93
|
if (json) {
|
|
88
94
|
log(prettyPrintJSON(out));
|
|
89
95
|
} else {
|
|
90
|
-
if (
|
|
91
|
-
log(`Deploy tx hash: ${
|
|
96
|
+
if (txHash) {
|
|
97
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
92
98
|
}
|
|
93
99
|
if (txReceipt) {
|
|
94
100
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
package/dest/cmds/send.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ import type { CLIWallet } from '../utils/wallet.js';
|
|
|
7
7
|
export declare function send(wallet: CLIWallet, node: AztecNode, from: AztecAddress, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, wait: boolean, cancellable: boolean, feeOpts: CLIFeeArgs, authWitnesses: AuthWitness[], verbose: boolean, log: LogFn): Promise<{
|
|
8
8
|
txHash: import("@aztec/stdlib/tx").TxHash;
|
|
9
9
|
} | undefined>;
|
|
10
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NtZHMvc2VuZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUM5RCxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFNUQsT0FBTyxLQ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D,wBAAsB,IAAI,CACxB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK;;
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/cmds/send.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAsB,IAAI,CACxB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,EAAE,EACrB,oBAAoB,EAAE,MAAM,EAC5B,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,OAAO,EACb,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK;;eA8DX"}
|
package/dest/cmds/send.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Contract } from '@aztec/aztec.js/contracts';
|
|
1
|
+
import { Contract, NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
3
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
4
4
|
import { printProfileResult } from '../utils/profiling.js';
|
|
@@ -25,36 +25,48 @@ export async function send(wallet, node, from, functionName, functionArgsIn, con
|
|
|
25
25
|
if (feeOpts.estimateOnly) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
const tx = call.send({
|
|
29
|
-
...sendOptions,
|
|
30
|
-
fee: {
|
|
31
|
-
...sendOptions.fee,
|
|
32
|
-
gasSettings: estimatedGas
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
28
|
if (verbose) {
|
|
36
29
|
printProfileResult(stats, log);
|
|
37
30
|
}
|
|
38
|
-
const txHash = await tx.getTxHash();
|
|
39
|
-
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
40
31
|
if (wait) {
|
|
41
32
|
try {
|
|
42
|
-
await
|
|
43
|
-
|
|
33
|
+
const receipt = await call.send({
|
|
34
|
+
...sendOptions,
|
|
35
|
+
fee: {
|
|
36
|
+
...sendOptions.fee,
|
|
37
|
+
gasSettings: estimatedGas
|
|
38
|
+
},
|
|
39
|
+
wait: {
|
|
40
|
+
timeout: DEFAULT_TX_TIMEOUT_S
|
|
41
|
+
}
|
|
44
42
|
});
|
|
43
|
+
const txHash = receipt.txHash;
|
|
44
|
+
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
45
45
|
log('Transaction has been mined');
|
|
46
|
-
const receipt = await tx.getReceipt();
|
|
47
46
|
log(` Tx fee: ${receipt.transactionFee}`);
|
|
48
47
|
log(` Status: ${receipt.status}`);
|
|
49
48
|
log(` Block number: ${receipt.blockNumber}`);
|
|
50
49
|
log(` Block hash: ${receipt.blockHash?.toString()}`);
|
|
50
|
+
return {
|
|
51
|
+
txHash
|
|
52
|
+
};
|
|
51
53
|
} catch (err) {
|
|
52
54
|
log(`Transaction failed\n ${err.message}`);
|
|
55
|
+
throw err;
|
|
53
56
|
}
|
|
54
57
|
} else {
|
|
58
|
+
const txHash = await call.send({
|
|
59
|
+
...sendOptions,
|
|
60
|
+
fee: {
|
|
61
|
+
...sendOptions.fee,
|
|
62
|
+
gasSettings: estimatedGas
|
|
63
|
+
},
|
|
64
|
+
wait: NO_WAIT
|
|
65
|
+
});
|
|
66
|
+
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
55
67
|
log('Transaction pending. Check status with check-tx');
|
|
68
|
+
return {
|
|
69
|
+
txHash
|
|
70
|
+
};
|
|
56
71
|
}
|
|
57
|
-
return {
|
|
58
|
-
txHash
|
|
59
|
-
};
|
|
60
72
|
}
|
|
@@ -50,4 +50,4 @@ export declare class WalletDB {
|
|
|
50
50
|
}>;
|
|
51
51
|
storeAlias(type: AliasType, key: string, value: Buffer, log: LogFn): Promise<void>;
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0X2RiLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RvcmFnZS93YWxsZXRfZGIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLE1B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FTLEVBQUUsR0FBRyxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLEdBQUcsRUFBRSxLQUFLLGlCQU12RTtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet_db.d.ts","sourceRoot":"","sources":["../../src/storage/wallet_db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,eAAO,MAAM,OAAO,wFAAyF,CAAC;AAC9G,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,qBAAa,QAAQ;;
|
|
1
|
+
{"version":3,"file":"wallet_db.d.ts","sourceRoot":"","sources":["../../src/storage/wallet_db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,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AAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,iBASvE;IAED,gBAAgB,CAAC,GAAG,EAAE,MAAM,UAM3B;IAEM,sBAAsB,CAAC,GAAG,EAAE,MAAM,UAYxC;IAEK,aAAa,CAAC,GAAG,EAAE,MAAM,mBAW9B;IAEK,WAAW,CAAC,IAAI,CAAC,EAAE,SAAS;;;SAWjC;IAEK,oBAAoB,CAAC,cAAc,EAAE,YAAY,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAGtG;IAEK,uBAAuB,CAAC,cAAc,EAAE,YAAY,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM,oCAOvF;IAEK,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM;;;;;OASnD;IAEK,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAMvE;CACF"}
|
|
@@ -9,6 +9,7 @@ export const Aliases = [
|
|
|
9
9
|
'authwits'
|
|
10
10
|
];
|
|
11
11
|
export class WalletDB {
|
|
12
|
+
#store;
|
|
12
13
|
#accounts;
|
|
13
14
|
#aliases;
|
|
14
15
|
#bridgedFeeJuice;
|
|
@@ -21,6 +22,7 @@ export class WalletDB {
|
|
|
21
22
|
return WalletDB.instance;
|
|
22
23
|
}
|
|
23
24
|
async init(store) {
|
|
25
|
+
this.#store = store;
|
|
24
26
|
this.#accounts = store.openMap('accounts');
|
|
25
27
|
this.#aliases = store.openMap('aliases');
|
|
26
28
|
this.#bridgedFeeJuice = store.openMap('bridgedFeeJuice');
|
|
@@ -33,13 +35,15 @@ export class WalletDB {
|
|
|
33
35
|
]));
|
|
34
36
|
}
|
|
35
37
|
async pushBridgedFeeJuice(recipient, secret, amount, leafIndex, log) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
stackPointer
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
await this.#store.transactionAsync(async ()=>{
|
|
39
|
+
let stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
40
|
+
stackPointer++;
|
|
41
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:${stackPointer}`, Buffer.from(`${amount.toString()}:${secret.toString()}:${leafIndex.toString()}`));
|
|
42
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:stackPointer`, Buffer.from([
|
|
43
|
+
stackPointer
|
|
44
|
+
]));
|
|
45
|
+
log(`Pushed ${amount} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
|
|
46
|
+
});
|
|
43
47
|
}
|
|
44
48
|
async popBridgedFeeJuice(recipient, log) {
|
|
45
49
|
let stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
@@ -59,17 +63,22 @@ export class WalletDB {
|
|
|
59
63
|
};
|
|
60
64
|
}
|
|
61
65
|
async storeAccount(address, { type, secretKey, salt, alias, publicKey }, log) {
|
|
62
|
-
|
|
63
|
-
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
64
|
-
}
|
|
65
|
-
await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
|
|
66
|
-
await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
|
|
67
|
-
await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
|
|
66
|
+
let publicSigningKey;
|
|
68
67
|
if (type === 'ecdsasecp256r1ssh' && publicKey) {
|
|
69
|
-
|
|
70
|
-
await this.storeAccountMetadata(address, 'publicSigningKey', publicSigningKey);
|
|
68
|
+
publicSigningKey = extractECDSAPublicKeyFromBase64String(publicKey);
|
|
71
69
|
}
|
|
72
|
-
await this.#
|
|
70
|
+
await this.#store.transactionAsync(async ()=>{
|
|
71
|
+
if (alias) {
|
|
72
|
+
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
73
|
+
}
|
|
74
|
+
await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
|
|
75
|
+
await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
|
|
76
|
+
await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
|
|
77
|
+
if (publicSigningKey) {
|
|
78
|
+
await this.#accounts.set(`${address.toString()}:publicSigningKey`, publicSigningKey);
|
|
79
|
+
}
|
|
80
|
+
await this.#aliases.set('accounts:last', Buffer.from(address.toString()));
|
|
81
|
+
});
|
|
73
82
|
log(`Account stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
74
83
|
await this.refreshAliasCache();
|
|
75
84
|
}
|
|
@@ -79,29 +88,35 @@ export class WalletDB {
|
|
|
79
88
|
await this.refreshAliasCache();
|
|
80
89
|
}
|
|
81
90
|
async storeContract(address, artifactPath, log, alias) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
await this.#store.transactionAsync(async ()=>{
|
|
92
|
+
if (alias) {
|
|
93
|
+
await this.#aliases.set(`contracts:${alias}`, Buffer.from(address.toString()));
|
|
94
|
+
await this.#aliases.set(`artifacts:${alias}`, Buffer.from(artifactPath));
|
|
95
|
+
}
|
|
96
|
+
await this.#aliases.set(`contracts:last`, Buffer.from(address.toString()));
|
|
97
|
+
await this.#aliases.set(`artifacts:last`, Buffer.from(artifactPath));
|
|
98
|
+
await this.#aliases.set(`artifacts:${address.toString()}`, Buffer.from(artifactPath));
|
|
99
|
+
});
|
|
89
100
|
log(`Contract stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
90
101
|
await this.refreshAliasCache();
|
|
91
102
|
}
|
|
92
103
|
async storeAuthwitness(authWit, log, alias) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
await this.#store.transactionAsync(async ()=>{
|
|
105
|
+
if (alias) {
|
|
106
|
+
await this.#aliases.set(`authwits:${alias}`, Buffer.from(authWit.toString()));
|
|
107
|
+
}
|
|
108
|
+
await this.#aliases.set(`authwits:last`, Buffer.from(authWit.toString()));
|
|
109
|
+
});
|
|
97
110
|
log(`Authorization witness stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
98
111
|
await this.refreshAliasCache();
|
|
99
112
|
}
|
|
100
113
|
async storeTx({ txHash }, log, alias) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
114
|
+
await this.#store.transactionAsync(async ()=>{
|
|
115
|
+
if (alias) {
|
|
116
|
+
await this.#aliases.set(`transactions:${alias}`, Buffer.from(txHash.toString()));
|
|
117
|
+
}
|
|
118
|
+
await this.#aliases.set(`transactions:last`, Buffer.from(txHash.toString()));
|
|
119
|
+
});
|
|
105
120
|
log(`Transaction hash stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
106
121
|
await this.refreshAliasCache();
|
|
107
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli-wallet",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.e310a4c8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/cmds/index.js",
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
71
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
72
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
73
|
-
"@aztec/cli": "0.0.1-commit.
|
|
74
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
75
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
76
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
77
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
78
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
79
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
80
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
81
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
82
|
-
"@aztec/wallet-sdk": "0.0.1-commit.
|
|
70
|
+
"@aztec/accounts": "0.0.1-commit.e310a4c8",
|
|
71
|
+
"@aztec/aztec.js": "0.0.1-commit.e310a4c8",
|
|
72
|
+
"@aztec/bb.js": "0.0.1-commit.e310a4c8",
|
|
73
|
+
"@aztec/cli": "0.0.1-commit.e310a4c8",
|
|
74
|
+
"@aztec/entrypoints": "0.0.1-commit.e310a4c8",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.e310a4c8",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.e310a4c8",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.e310a4c8",
|
|
78
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.e310a4c8",
|
|
79
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.e310a4c8",
|
|
80
|
+
"@aztec/pxe": "0.0.1-commit.e310a4c8",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.e310a4c8",
|
|
82
|
+
"@aztec/wallet-sdk": "0.0.1-commit.e310a4c8",
|
|
83
83
|
"commander": "^12.1.0",
|
|
84
84
|
"inquirer": "^10.1.8",
|
|
85
85
|
"source-map-support": "^0.5.21",
|
|
@@ -39,7 +39,7 @@ export async function authorizeAction(
|
|
|
39
39
|
{ caller, action },
|
|
40
40
|
true,
|
|
41
41
|
);
|
|
42
|
-
const witness = await setAuthwitnessInteraction.send(
|
|
42
|
+
const witness = await setAuthwitnessInteraction.send({ wait: { timeout: DEFAULT_TX_TIMEOUT_S } });
|
|
43
43
|
|
|
44
44
|
log(`Authorized action ${functionName} on contract ${contractAddress} for caller ${caller}`);
|
|
45
45
|
|
package/src/cmds/check_tx.ts
CHANGED
|
@@ -32,7 +32,10 @@ async function inspectTx(wallet: CLIWallet, aztecNode: AztecNode, txHash: TxHash
|
|
|
32
32
|
const [receipt, effectsInBlock] = await Promise.all([aztecNode.getTxReceipt(txHash), aztecNode.getTxEffect(txHash)]);
|
|
33
33
|
// Base tx data
|
|
34
34
|
log(`Tx ${txHash.toString()}`);
|
|
35
|
-
log(` Status: ${receipt.status}
|
|
35
|
+
log(` Status: ${receipt.status}`);
|
|
36
|
+
if (receipt.executionResult) {
|
|
37
|
+
log(` Execution result: ${receipt.executionResult}`);
|
|
38
|
+
}
|
|
36
39
|
if (receipt.error) {
|
|
37
40
|
log(` Error: ${receipt.error}`);
|
|
38
41
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
4
|
import type { DeployAccountOptions } from '@aztec/aztec.js/wallet';
|
|
4
5
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
5
6
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
7
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
8
|
+
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
7
9
|
|
|
8
10
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
9
11
|
import type { AccountType } from '../utils/constants.js';
|
|
@@ -64,8 +66,8 @@ export async function createAccount(
|
|
|
64
66
|
log(`Init hash: ${account.getInstance().initializationHash.toString()}`);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
let
|
|
68
|
-
let txReceipt;
|
|
69
|
+
let txHash: TxHash | undefined;
|
|
70
|
+
let txReceipt: TxReceipt | undefined;
|
|
69
71
|
if (!registerOnly) {
|
|
70
72
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
71
73
|
|
|
@@ -100,7 +102,14 @@ export async function createAccount(
|
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
} else {
|
|
103
|
-
|
|
105
|
+
if (verbose) {
|
|
106
|
+
printProfileResult(stats, log);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!json) {
|
|
110
|
+
log(`\nWaiting for account contract deployment...`);
|
|
111
|
+
}
|
|
112
|
+
const result = await deployMethod.send({
|
|
104
113
|
...deployAccountOpts,
|
|
105
114
|
fee: deployAccountOpts.fee
|
|
106
115
|
? {
|
|
@@ -108,32 +117,29 @@ export async function createAccount(
|
|
|
108
117
|
gasSettings: estimatedGas,
|
|
109
118
|
}
|
|
110
119
|
: undefined,
|
|
120
|
+
wait: wait ? { timeout: DEFAULT_TX_TIMEOUT_S, returnReceipt: true } : NO_WAIT,
|
|
111
121
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const txHash = await tx.getTxHash();
|
|
117
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
118
|
-
out.txHash = txHash;
|
|
119
|
-
if (wait) {
|
|
120
|
-
if (!json) {
|
|
121
|
-
log(`\nWaiting for account contract deployment...`);
|
|
122
|
-
}
|
|
123
|
-
txReceipt = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
122
|
+
const isReceipt = (data: TxReceipt | TxHash): data is TxReceipt => 'txHash' in data;
|
|
123
|
+
if (isReceipt(result)) {
|
|
124
|
+
txReceipt = result;
|
|
125
|
+
txHash = result.txHash;
|
|
124
126
|
out.txReceipt = {
|
|
125
127
|
status: txReceipt.status,
|
|
126
128
|
transactionFee: txReceipt.transactionFee,
|
|
127
129
|
};
|
|
130
|
+
} else {
|
|
131
|
+
txHash = result;
|
|
128
132
|
}
|
|
133
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
134
|
+
out.txHash = txHash;
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
if (json) {
|
|
133
139
|
log(prettyPrintJSON(out));
|
|
134
140
|
} else {
|
|
135
|
-
if (
|
|
136
|
-
log(`Deploy tx hash: ${
|
|
141
|
+
if (txHash) {
|
|
142
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
137
143
|
}
|
|
138
144
|
if (txReceipt) {
|
|
139
145
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
package/src/cmds/deploy.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import type { DeployOptions } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { ContractDeployer } from '@aztec/aztec.js/deployment';
|
|
4
5
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
6
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
@@ -89,37 +90,55 @@ export async function deploy(
|
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
} else {
|
|
92
|
-
const tx = deploy.send(deployOpts);
|
|
93
93
|
if (verbose) {
|
|
94
94
|
printProfileResult(stats, log);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const txHash = await tx.getTxHash();
|
|
98
|
-
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
99
|
-
out.hash = txHash;
|
|
100
97
|
const { address, partialAddress } = deploy;
|
|
101
98
|
const instance = await deploy.getInstance();
|
|
102
|
-
|
|
103
|
-
log(`Contract deployed at ${address?.toString()}`);
|
|
104
|
-
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
105
|
-
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
106
|
-
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
107
|
-
log(`Deployment salt: ${salt.toString()}`);
|
|
108
|
-
log(`Deployer: ${instance.deployer.toString()}`);
|
|
109
|
-
} else {
|
|
110
|
-
out.contract = {
|
|
111
|
-
address: address?.toString(),
|
|
112
|
-
partialAddress: (await partialAddress)?.toString(),
|
|
113
|
-
initializationHash: instance.initializationHash.toString(),
|
|
114
|
-
salt: salt.toString(),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
99
|
+
|
|
117
100
|
if (wait) {
|
|
118
|
-
const
|
|
101
|
+
const receipt = await deploy.send({ ...deployOpts, wait: { timeout, returnReceipt: true } });
|
|
102
|
+
const txHash = receipt.txHash;
|
|
103
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
104
|
+
out.hash = txHash;
|
|
105
|
+
|
|
106
|
+
if (!json) {
|
|
107
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
108
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
109
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
110
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
111
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
112
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
113
|
+
log(`Transaction fee: ${receipt.transactionFee?.toString()}`);
|
|
114
|
+
} else {
|
|
115
|
+
out.contract = {
|
|
116
|
+
address: address?.toString(),
|
|
117
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
118
|
+
initializationHash: instance.initializationHash.toString(),
|
|
119
|
+
salt: salt.toString(),
|
|
120
|
+
transactionFee: receipt.transactionFee?.toString(),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
const txHash = await deploy.send({ ...deployOpts, wait: NO_WAIT });
|
|
125
|
+
debugLogger.debug(`Deploy tx sent with hash ${txHash.toString()}`);
|
|
126
|
+
out.hash = txHash;
|
|
127
|
+
|
|
119
128
|
if (!json) {
|
|
120
|
-
log(`
|
|
129
|
+
log(`Contract deployed at ${address?.toString()}`);
|
|
130
|
+
log(`Contract partial address ${(await partialAddress)?.toString()}`);
|
|
131
|
+
log(`Contract init hash ${instance.initializationHash.toString()}`);
|
|
132
|
+
log(`Deployment tx hash: ${txHash.toString()}`);
|
|
133
|
+
log(`Deployment salt: ${salt.toString()}`);
|
|
134
|
+
log(`Deployer: ${instance.deployer.toString()}`);
|
|
121
135
|
} else {
|
|
122
|
-
out.contract
|
|
136
|
+
out.contract = {
|
|
137
|
+
address: address?.toString(),
|
|
138
|
+
partialAddress: (await partialAddress)?.toString(),
|
|
139
|
+
initializationHash: instance.initializationHash.toString(),
|
|
140
|
+
salt: salt.toString(),
|
|
141
|
+
};
|
|
123
142
|
}
|
|
124
143
|
}
|
|
125
144
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
2
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
4
|
import type { DeployAccountOptions } from '@aztec/aztec.js/wallet';
|
|
4
5
|
import { prettyPrintJSON } from '@aztec/cli/cli-utils';
|
|
5
6
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
7
|
+
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
6
8
|
|
|
7
9
|
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
8
10
|
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
@@ -45,8 +47,8 @@ export async function deployAccount(
|
|
|
45
47
|
log(`Init hash: ${initializationHash.toString()}`);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
let
|
|
49
|
-
let txReceipt;
|
|
50
|
+
let txHash: TxHash | undefined;
|
|
51
|
+
let txReceipt: TxReceipt | undefined;
|
|
50
52
|
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(aztecNode, wallet, address);
|
|
51
53
|
|
|
52
54
|
const delegatedDeployment = deployer && !account.address.equals(deployer);
|
|
@@ -80,7 +82,14 @@ export async function deployAccount(
|
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
} else {
|
|
83
|
-
|
|
85
|
+
if (verbose) {
|
|
86
|
+
printProfileResult(stats, log);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!json) {
|
|
90
|
+
log(`\nWaiting for account contract deployment...`);
|
|
91
|
+
}
|
|
92
|
+
const result = await deployMethod.send({
|
|
84
93
|
...deployAccountOpts,
|
|
85
94
|
fee: deployAccountOpts.fee
|
|
86
95
|
? {
|
|
@@ -88,31 +97,28 @@ export async function deployAccount(
|
|
|
88
97
|
gasSettings: estimatedGas,
|
|
89
98
|
}
|
|
90
99
|
: undefined,
|
|
100
|
+
wait: wait ? { timeout: DEFAULT_TX_TIMEOUT_S, returnReceipt: true } : NO_WAIT,
|
|
91
101
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const txHash = await tx.getTxHash();
|
|
97
|
-
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
98
|
-
out.txHash = txHash;
|
|
99
|
-
if (wait) {
|
|
100
|
-
if (!json) {
|
|
101
|
-
log(`\nWaiting for account contract deployment...`);
|
|
102
|
-
}
|
|
103
|
-
txReceipt = await tx.wait({ timeout: DEFAULT_TX_TIMEOUT_S });
|
|
102
|
+
const isReceipt = (data: TxReceipt | TxHash): data is TxReceipt => 'txHash' in data;
|
|
103
|
+
if (isReceipt(result)) {
|
|
104
|
+
txReceipt = result;
|
|
105
|
+
txHash = result.txHash;
|
|
104
106
|
out.txReceipt = {
|
|
105
107
|
status: txReceipt.status,
|
|
106
108
|
transactionFee: txReceipt.transactionFee,
|
|
107
109
|
};
|
|
110
|
+
} else {
|
|
111
|
+
txHash = result;
|
|
108
112
|
}
|
|
113
|
+
debugLogger.debug(`Account contract tx sent with hash ${txHash.toString()}`);
|
|
114
|
+
out.txHash = txHash;
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
if (json) {
|
|
112
118
|
log(prettyPrintJSON(out));
|
|
113
119
|
} else {
|
|
114
|
-
if (
|
|
115
|
-
log(`Deploy tx hash: ${
|
|
120
|
+
if (txHash) {
|
|
121
|
+
log(`Deploy tx hash: ${txHash.toString()}`);
|
|
116
122
|
}
|
|
117
123
|
if (txReceipt) {
|
|
118
124
|
log(`Deploy tx fee: ${txReceipt.transactionFee}`);
|
package/src/cmds/send.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { AuthWitness } from '@aztec/aztec.js/authorization';
|
|
3
|
-
import { Contract, type SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import { Contract, NO_WAIT, type SendInteractionOptions } from '@aztec/aztec.js/contracts';
|
|
4
4
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
5
5
|
import { prepTx } from '@aztec/cli/utils';
|
|
6
6
|
import type { LogFn } from '@aztec/foundation/log';
|
|
@@ -46,31 +46,43 @@ export async function send(
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const tx = call.send({ ...sendOptions, fee: { ...sendOptions.fee, gasSettings: estimatedGas } });
|
|
50
49
|
if (verbose) {
|
|
51
50
|
printProfileResult(stats!, log);
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
const txHash = await tx.getTxHash();
|
|
55
|
-
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
56
53
|
if (wait) {
|
|
57
54
|
try {
|
|
58
|
-
await
|
|
55
|
+
const receipt = await call.send({
|
|
56
|
+
...sendOptions,
|
|
57
|
+
fee: { ...sendOptions.fee, gasSettings: estimatedGas },
|
|
58
|
+
wait: { timeout: DEFAULT_TX_TIMEOUT_S },
|
|
59
|
+
});
|
|
59
60
|
|
|
61
|
+
const txHash = receipt.txHash;
|
|
62
|
+
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
60
63
|
log('Transaction has been mined');
|
|
61
|
-
|
|
62
|
-
const receipt = await tx.getReceipt();
|
|
63
64
|
log(` Tx fee: ${receipt.transactionFee}`);
|
|
64
65
|
log(` Status: ${receipt.status}`);
|
|
65
66
|
log(` Block number: ${receipt.blockNumber}`);
|
|
66
67
|
log(` Block hash: ${receipt.blockHash?.toString()}`);
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
txHash,
|
|
71
|
+
};
|
|
67
72
|
} catch (err: any) {
|
|
68
73
|
log(`Transaction failed\n ${err.message}`);
|
|
74
|
+
throw err;
|
|
69
75
|
}
|
|
70
76
|
} else {
|
|
77
|
+
const txHash = await call.send({
|
|
78
|
+
...sendOptions,
|
|
79
|
+
fee: { ...sendOptions.fee, gasSettings: estimatedGas },
|
|
80
|
+
wait: NO_WAIT,
|
|
81
|
+
});
|
|
82
|
+
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
71
83
|
log('Transaction pending. Check status with check-tx');
|
|
84
|
+
return {
|
|
85
|
+
txHash,
|
|
86
|
+
};
|
|
72
87
|
}
|
|
73
|
-
return {
|
|
74
|
-
txHash,
|
|
75
|
-
};
|
|
76
88
|
}
|
package/src/storage/wallet_db.ts
CHANGED
|
@@ -12,6 +12,7 @@ export const Aliases = ['accounts', 'contracts', 'artifacts', 'secrets', 'transa
|
|
|
12
12
|
export type AliasType = (typeof Aliases)[number];
|
|
13
13
|
|
|
14
14
|
export class WalletDB {
|
|
15
|
+
#store!: AztecAsyncKVStore;
|
|
15
16
|
#accounts!: AztecAsyncMap<string, Buffer>;
|
|
16
17
|
#aliases!: AztecAsyncMap<string, Buffer>;
|
|
17
18
|
#bridgedFeeJuice!: AztecAsyncMap<string, Buffer>;
|
|
@@ -29,6 +30,7 @@ export class WalletDB {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
async init(store: AztecAsyncKVStore) {
|
|
33
|
+
this.#store = store;
|
|
32
34
|
this.#accounts = store.openMap('accounts');
|
|
33
35
|
this.#aliases = store.openMap('aliases');
|
|
34
36
|
this.#bridgedFeeJuice = store.openMap('bridgedFeeJuice');
|
|
@@ -41,14 +43,17 @@ export class WalletDB {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
async pushBridgedFeeJuice(recipient: AztecAddress, secret: Fr, amount: bigint, leafIndex: bigint, log: LogFn) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
await this.#store.transactionAsync(async () => {
|
|
47
|
+
let stackPointer =
|
|
48
|
+
(await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
49
|
+
stackPointer++;
|
|
50
|
+
await this.#bridgedFeeJuice.set(
|
|
51
|
+
`${recipient.toString()}:${stackPointer}`,
|
|
52
|
+
Buffer.from(`${amount.toString()}:${secret.toString()}:${leafIndex.toString()}`),
|
|
53
|
+
);
|
|
54
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:stackPointer`, Buffer.from([stackPointer]));
|
|
55
|
+
log(`Pushed ${amount} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
|
|
56
|
+
});
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
async popBridgedFeeJuice(recipient: AztecAddress, log: LogFn) {
|
|
@@ -76,19 +81,24 @@ export class WalletDB {
|
|
|
76
81
|
}: { type: AccountType; secretKey: Fr; salt: Fr; alias: string | undefined; publicKey: string | undefined },
|
|
77
82
|
log: LogFn,
|
|
78
83
|
) {
|
|
79
|
-
|
|
80
|
-
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
81
|
-
}
|
|
82
|
-
await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
|
|
83
|
-
await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
|
|
84
|
-
await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
|
|
84
|
+
let publicSigningKey: Buffer | undefined;
|
|
85
85
|
if (type === 'ecdsasecp256r1ssh' && publicKey) {
|
|
86
|
-
|
|
87
|
-
await this.storeAccountMetadata(address, 'publicSigningKey', publicSigningKey);
|
|
86
|
+
publicSigningKey = extractECDSAPublicKeyFromBase64String(publicKey);
|
|
88
87
|
}
|
|
89
|
-
await this.#aliases.set('accounts:last', Buffer.from(address.toString()));
|
|
90
|
-
log(`Account stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
91
88
|
|
|
89
|
+
await this.#store.transactionAsync(async () => {
|
|
90
|
+
if (alias) {
|
|
91
|
+
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
92
|
+
}
|
|
93
|
+
await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
|
|
94
|
+
await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
|
|
95
|
+
await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
|
|
96
|
+
if (publicSigningKey) {
|
|
97
|
+
await this.#accounts.set(`${address.toString()}:publicSigningKey`, publicSigningKey);
|
|
98
|
+
}
|
|
99
|
+
await this.#aliases.set('accounts:last', Buffer.from(address.toString()));
|
|
100
|
+
});
|
|
101
|
+
log(`Account stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
92
102
|
await this.refreshAliasCache();
|
|
93
103
|
}
|
|
94
104
|
|
|
@@ -100,35 +110,38 @@ export class WalletDB {
|
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
async storeContract(address: AztecAddress, artifactPath: string, log: LogFn, alias?: string) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
await this.#store.transactionAsync(async () => {
|
|
114
|
+
if (alias) {
|
|
115
|
+
await this.#aliases.set(`contracts:${alias}`, Buffer.from(address.toString()));
|
|
116
|
+
await this.#aliases.set(`artifacts:${alias}`, Buffer.from(artifactPath));
|
|
117
|
+
}
|
|
118
|
+
await this.#aliases.set(`contracts:last`, Buffer.from(address.toString()));
|
|
119
|
+
await this.#aliases.set(`artifacts:last`, Buffer.from(artifactPath));
|
|
120
|
+
await this.#aliases.set(`artifacts:${address.toString()}`, Buffer.from(artifactPath));
|
|
121
|
+
});
|
|
110
122
|
log(`Contract stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
111
|
-
|
|
112
123
|
await this.refreshAliasCache();
|
|
113
124
|
}
|
|
114
125
|
|
|
115
126
|
async storeAuthwitness(authWit: AuthWitness, log: LogFn, alias?: string) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
127
|
+
await this.#store.transactionAsync(async () => {
|
|
128
|
+
if (alias) {
|
|
129
|
+
await this.#aliases.set(`authwits:${alias}`, Buffer.from(authWit.toString()));
|
|
130
|
+
}
|
|
131
|
+
await this.#aliases.set(`authwits:last`, Buffer.from(authWit.toString()));
|
|
132
|
+
});
|
|
120
133
|
log(`Authorization witness stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
121
|
-
|
|
122
134
|
await this.refreshAliasCache();
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
async storeTx({ txHash }: { txHash: TxHash }, log: LogFn, alias?: string) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
await this.#store.transactionAsync(async () => {
|
|
139
|
+
if (alias) {
|
|
140
|
+
await this.#aliases.set(`transactions:${alias}`, Buffer.from(txHash.toString()));
|
|
141
|
+
}
|
|
142
|
+
await this.#aliases.set(`transactions:last`, Buffer.from(txHash.toString()));
|
|
143
|
+
});
|
|
130
144
|
log(`Transaction hash stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
131
|
-
|
|
132
145
|
await this.refreshAliasCache();
|
|
133
146
|
}
|
|
134
147
|
|