@aztec-labs/cli-wallet 6.0.0-nightly.20260829
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/README.md +32 -0
- package/dest/bin/index.d.ts +3 -0
- package/dest/bin/index.d.ts.map +1 -0
- package/dest/bin/index.js +96 -0
- package/dest/cmds/authorize_action.d.ts +5 -0
- package/dest/cmds/authorize_action.d.ts.map +1 -0
- package/dest/cmds/authorize_action.js +23 -0
- package/dest/cmds/bridge_fee_juice.d.ts +6 -0
- package/dest/cmds/bridge_fee_juice.d.ts.map +1 -0
- package/dest/cmds/bridge_fee_juice.js +54 -0
- package/dest/cmds/check_tx.d.ts +6 -0
- package/dest/cmds/check_tx.d.ts.map +1 -0
- package/dest/cmds/check_tx.js +181 -0
- package/dest/cmds/create_account.d.ts +17 -0
- package/dest/cmds/create_account.d.ts.map +1 -0
- package/dest/cmds/create_account.js +146 -0
- package/dest/cmds/create_authwit.d.ts +5 -0
- package/dest/cmds/create_authwit.d.ts.map +1 -0
- package/dest/cmds/create_authwit.js +16 -0
- package/dest/cmds/deploy.d.ts +10 -0
- package/dest/cmds/deploy.d.ts.map +1 -0
- package/dest/cmds/deploy.js +129 -0
- package/dest/cmds/deploy_account.d.ts +8 -0
- package/dest/cmds/deploy_account.d.ts.map +1 -0
- package/dest/cmds/deploy_account.js +111 -0
- package/dest/cmds/get_fee_juice_balance.d.ts +5 -0
- package/dest/cmds/get_fee_juice_balance.d.ts.map +1 -0
- package/dest/cmds/get_fee_juice_balance.js +27 -0
- package/dest/cmds/import_test_accounts.d.ts +5 -0
- package/dest/cmds/import_test_accounts.d.ts.map +1 -0
- package/dest/cmds/import_test_accounts.js +40 -0
- package/dest/cmds/index.d.ts +6 -0
- package/dest/cmds/index.d.ts.map +1 -0
- package/dest/cmds/index.js +208 -0
- package/dest/cmds/profile.d.ts +8 -0
- package/dest/cmds/profile.d.ts.map +1 -0
- package/dest/cmds/profile.js +28 -0
- package/dest/cmds/register_contract.d.ts +8 -0
- package/dest/cmds/register_contract.d.ts.map +1 -0
- package/dest/cmds/register_contract.js +27 -0
- package/dest/cmds/register_sender.d.ts +5 -0
- package/dest/cmds/register_sender.d.ts.map +1 -0
- package/dest/cmds/register_sender.js +4 -0
- package/dest/cmds/send.d.ts +11 -0
- package/dest/cmds/send.d.ts.map +1 -0
- package/dest/cmds/send.js +73 -0
- package/dest/cmds/simulate.d.ts +8 -0
- package/dest/cmds/simulate.d.ts.map +1 -0
- package/dest/cmds/simulate.js +33 -0
- package/dest/storage/wallet_db.d.ts +61 -0
- package/dest/storage/wallet_db.d.ts.map +1 -0
- package/dest/storage/wallet_db.js +231 -0
- package/dest/utils/authorizations.d.ts +6 -0
- package/dest/utils/authorizations.d.ts.map +1 -0
- package/dest/utils/authorizations.js +28 -0
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts +12 -0
- package/dest/utils/cli_wallet_and_node_wrapper.d.ts.map +1 -0
- package/dest/utils/cli_wallet_and_node_wrapper.js +25 -0
- package/dest/utils/constants.d.ts +4 -0
- package/dest/utils/constants.d.ts.map +1 -0
- package/dest/utils/constants.js +8 -0
- package/dest/utils/ecdsa.d.ts +2 -0
- package/dest/utils/ecdsa.d.ts.map +1 -0
- package/dest/utils/ecdsa.js +13 -0
- package/dest/utils/options/fees.d.ts +36 -0
- package/dest/utils/options/fees.d.ts.map +1 -0
- package/dest/utils/options/fees.js +250 -0
- package/dest/utils/options/index.d.ts +3 -0
- package/dest/utils/options/index.d.ts.map +1 -0
- package/dest/utils/options/index.js +2 -0
- package/dest/utils/options/options.d.ts +24 -0
- package/dest/utils/options/options.d.ts.map +1 -0
- package/dest/utils/options/options.js +134 -0
- package/dest/utils/profiling.d.ts +5 -0
- package/dest/utils/profiling.d.ts.map +1 -0
- package/dest/utils/profiling.js +68 -0
- package/dest/utils/wallet.d.ts +64 -0
- package/dest/utils/wallet.d.ts.map +1 -0
- package/dest/utils/wallet.js +285 -0
- package/dest/utils/well_known_contracts.d.ts +8 -0
- package/dest/utils/well_known_contracts.d.ts.map +1 -0
- package/dest/utils/well_known_contracts.js +38 -0
- package/package.json +108 -0
- package/src/bin/index.ts +141 -0
- package/src/cmds/authorize_action.ts +47 -0
- package/src/cmds/bridge_fee_juice.ts +92 -0
- package/src/cmds/check_tx.ts +220 -0
- package/src/cmds/create_account.ts +176 -0
- package/src/cmds/create_authwit.ts +39 -0
- package/src/cmds/deploy.ts +157 -0
- package/src/cmds/deploy_account.ts +140 -0
- package/src/cmds/get_fee_juice_balance.ts +37 -0
- package/src/cmds/import_test_accounts.ts +54 -0
- package/src/cmds/index.ts +732 -0
- package/src/cmds/profile.ts +47 -0
- package/src/cmds/register_contract.ts +43 -0
- package/src/cmds/register_sender.ts +8 -0
- package/src/cmds/send.ts +96 -0
- package/src/cmds/simulate.ts +55 -0
- package/src/storage/wallet_db.ts +264 -0
- package/src/utils/authorizations.ts +50 -0
- package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
- package/src/utils/constants.ts +10 -0
- package/src/utils/ecdsa.ts +15 -0
- package/src/utils/options/fees.ts +325 -0
- package/src/utils/options/index.ts +2 -0
- package/src/utils/options/options.ts +196 -0
- package/src/utils/profiling.ts +171 -0
- package/src/utils/wallet.ts +377 -0
- package/src/utils/well_known_contracts.ts +46 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Contract } from '@aztec-labs/aztec.js/contracts';
|
|
2
|
+
import { prepTx } from '@aztec-labs/cli/utils';
|
|
3
|
+
import { serializePrivateExecutionSteps } from '@aztec-labs/stdlib/kernel';
|
|
4
|
+
import { promises as fs } from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
+
export async function profile(wallet, node, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, debugOutputPath, feeOpts, authWitnesses, log) {
|
|
8
|
+
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
9
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
10
|
+
const call = contract.methods[functionName](...functionArgs);
|
|
11
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
|
12
|
+
const result = await call.profile({
|
|
13
|
+
fee: {
|
|
14
|
+
gasSettings,
|
|
15
|
+
paymentMethod
|
|
16
|
+
},
|
|
17
|
+
from,
|
|
18
|
+
profileMode: 'full',
|
|
19
|
+
authWitnesses,
|
|
20
|
+
skipProofGeneration: false
|
|
21
|
+
});
|
|
22
|
+
printProfileResult(result.stats, log, true, result.executionSteps);
|
|
23
|
+
if (debugOutputPath) {
|
|
24
|
+
const ivcInputsPath = path.join(debugOutputPath, 'ivc-inputs.msgpack');
|
|
25
|
+
log(`Debug output written to ${ivcInputsPath}.`);
|
|
26
|
+
await fs.writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
2
|
+
import { Fr } from '@aztec-labs/aztec.js/fields';
|
|
3
|
+
import { PublicKeys } from '@aztec-labs/aztec.js/keys';
|
|
4
|
+
import type { AztecNode } from '@aztec-labs/aztec.js/node';
|
|
5
|
+
import type { Wallet } from '@aztec-labs/aztec.js/wallet';
|
|
6
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
7
|
+
export declare function registerContract(wallet: Wallet, node: AztecNode, address: AztecAddress, artifactPath: string, log: LogFn, initializer?: string, publicKeys?: PublicKeys, rawArgs?: any[], salt?: Fr, deployer?: AztecAddress): Promise<import("@aztec-labs/aztec.js/contracts").ContractInstanceWithAddress>;
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVnaXN0ZXJfY29udHJhY3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3N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AAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGxD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,YAAY,EACrB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,KAAK,EACV,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,UAAU,EACvB,OAAO,CAAC,EAAE,GAAG,EAAE,EACf,IAAI,CAAC,EAAE,EAAE,EACT,QAAQ,CAAC,EAAE,YAAY,iFAsBxB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getContractInstanceFromInstantiationParams } from '@aztec-labs/aztec.js/contracts';
|
|
2
|
+
import { Fr } from '@aztec-labs/aztec.js/fields';
|
|
3
|
+
import { PublicKeys } from '@aztec-labs/aztec.js/keys';
|
|
4
|
+
import { getContractArtifact } from '@aztec-labs/cli/cli-utils';
|
|
5
|
+
import { getAllFunctionAbis, getInitializer } from '@aztec-labs/stdlib/abi';
|
|
6
|
+
export async function registerContract(wallet, node, address, artifactPath, log, initializer, publicKeys, rawArgs, salt, deployer) {
|
|
7
|
+
const contractArtifact = await getContractArtifact(artifactPath, log);
|
|
8
|
+
const hasInitializer = getAllFunctionAbis(contractArtifact).some((fn)=>fn.isInitializer);
|
|
9
|
+
const constructorArtifact = hasInitializer ? getInitializer(contractArtifact, initializer) : undefined;
|
|
10
|
+
let contractInstance = await node.getContract(address);
|
|
11
|
+
if (!contractInstance) {
|
|
12
|
+
log(`Contract not found in the node at ${address}. Computing instance locally...`);
|
|
13
|
+
contractInstance = await getContractInstanceFromInstantiationParams(contractArtifact, {
|
|
14
|
+
constructorArtifact,
|
|
15
|
+
publicKeys: publicKeys ?? PublicKeys.default(),
|
|
16
|
+
constructorArgs: rawArgs,
|
|
17
|
+
salt: salt ?? Fr.ZERO,
|
|
18
|
+
deployer
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (!contractInstance.address.equals(address)) {
|
|
22
|
+
throw new Error(`Contract address mismatch: expected ${address}, got ${contractInstance.address}`);
|
|
23
|
+
}
|
|
24
|
+
await wallet.registerContract(contractInstance, contractArtifact);
|
|
25
|
+
log(`Contract registered: at ${contractInstance.address}`);
|
|
26
|
+
return contractInstance;
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
2
|
+
import type { Wallet } from '@aztec-labs/aztec.js/wallet';
|
|
3
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
4
|
+
export declare function registerSender(wallet: Wallet, address: AztecAddress, log: LogFn): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVnaXN0ZXJfc2VuZGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY21kcy9yZWdpc3Rlcl9zZW5kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQzlELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzFELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBRXhELHdCQUFzQixjQUFjLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxPQUFPLEVBQUUsWUFBWSxFQUFFLEdBQUcsRUFBRSxLQUFLLGlCQUdyRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register_sender.d.ts","sourceRoot":"","sources":["../../src/cmds/register_sender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,iBAGrF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
2
|
+
import { AuthWitness } from '@aztec-labs/aztec.js/authorization';
|
|
3
|
+
import { type AztecNode } from '@aztec-labs/aztec.js/node';
|
|
4
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
5
|
+
import { TxStatus } from '@aztec-labs/stdlib/tx';
|
|
6
|
+
import { CLIFeeArgs } from '../utils/options/fees.js';
|
|
7
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
8
|
+
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[], waitForStatus: TxStatus, verbose: boolean, log: LogFn): Promise<{
|
|
9
|
+
txHash: import("@aztec-labs/stdlib/tx").TxHash;
|
|
10
|
+
} | undefined>;
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NtZHMvc2VuZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNuRSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0NBQW9DLENBQUM7QUFFakUsT0FBTyxFQ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AAuB,CAAC;AAGjD,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,aAAa,EAAE,QAAQ,EACvB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK;;eAoEX"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Contract, NO_WAIT } from '@aztec-labs/aztec.js/contracts';
|
|
2
|
+
import { waitForTx } from '@aztec-labs/aztec.js/node';
|
|
3
|
+
import { prepTx } from '@aztec-labs/cli/utils';
|
|
4
|
+
import { TxStatus } from '@aztec-labs/stdlib/tx';
|
|
5
|
+
import { DEFAULT_TX_TIMEOUT_S } from '../utils/cli_wallet_and_node_wrapper.js';
|
|
6
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
7
|
+
export async function send(wallet, node, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, wait, cancellable, feeOpts, authWitnesses, waitForStatus, verbose, log) {
|
|
8
|
+
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
9
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
10
|
+
const call = contract.methods[functionName](...functionArgs);
|
|
11
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
|
12
|
+
const sendOptions = {
|
|
13
|
+
fee: {
|
|
14
|
+
paymentMethod,
|
|
15
|
+
gasSettings
|
|
16
|
+
},
|
|
17
|
+
from,
|
|
18
|
+
authWitnesses
|
|
19
|
+
};
|
|
20
|
+
const localStart = performance.now();
|
|
21
|
+
const sim = await call.simulate({
|
|
22
|
+
...sendOptions,
|
|
23
|
+
includeMetadata: true
|
|
24
|
+
});
|
|
25
|
+
// includeMetadata: true guarantees these fields are present
|
|
26
|
+
const estimatedGas = await wallet.estimateGasLimits(sim.gasUsed);
|
|
27
|
+
const stats = sim.stats;
|
|
28
|
+
if (feeOpts.estimateOnly) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (verbose) {
|
|
32
|
+
printProfileResult(stats, log);
|
|
33
|
+
}
|
|
34
|
+
const { txHash } = await call.send({
|
|
35
|
+
...sendOptions,
|
|
36
|
+
fee: {
|
|
37
|
+
...sendOptions.fee,
|
|
38
|
+
gasSettings: estimatedGas
|
|
39
|
+
},
|
|
40
|
+
wait: NO_WAIT
|
|
41
|
+
});
|
|
42
|
+
const localTimeMs = performance.now() - localStart;
|
|
43
|
+
log(`\nTransaction hash: ${txHash.toString()}`);
|
|
44
|
+
if (wait) {
|
|
45
|
+
try {
|
|
46
|
+
const nodeStart = performance.now();
|
|
47
|
+
const receipt = await waitForTx(node, txHash, {
|
|
48
|
+
timeout: DEFAULT_TX_TIMEOUT_S,
|
|
49
|
+
waitForStatus
|
|
50
|
+
});
|
|
51
|
+
const nodeTimeMs = performance.now() - nodeStart;
|
|
52
|
+
const statusLabel = waitForStatus === TxStatus.PROPOSED ? 'proposed' : 'checkpointed';
|
|
53
|
+
log(`Transaction has been ${statusLabel}`);
|
|
54
|
+
log(` Tx fee: ${receipt.transactionFee}`);
|
|
55
|
+
log(` Status: ${receipt.status}`);
|
|
56
|
+
log(` Block number: ${receipt.blockNumber}`);
|
|
57
|
+
log(` Block hash: ${receipt.blockHash?.toString()}`);
|
|
58
|
+
log(` Local processing time: ${(localTimeMs / 1000).toFixed(1)}s`);
|
|
59
|
+
log(` Node inclusion time: ${(nodeTimeMs / 1000).toFixed(1)}s`);
|
|
60
|
+
return {
|
|
61
|
+
txHash
|
|
62
|
+
};
|
|
63
|
+
} catch (err) {
|
|
64
|
+
log(`Transaction failed\n ${err.message}`);
|
|
65
|
+
throw err;
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
log('Transaction pending. Check status with check-tx');
|
|
69
|
+
return {
|
|
70
|
+
txHash
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
2
|
+
import { AuthWitness } from '@aztec-labs/aztec.js/authorization';
|
|
3
|
+
import type { AztecNode } from '@aztec-labs/aztec.js/node';
|
|
4
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
5
|
+
import type { CLIFeeArgs } from '../utils/options/fees.js';
|
|
6
|
+
import type { CLIWallet } from '../utils/wallet.js';
|
|
7
|
+
export declare function simulate(wallet: CLIWallet, node: AztecNode, from: AztecAddress, functionName: string, functionArgsIn: any[], contractArtifactPath: string, contractAddress: AztecAddress, feeOpts: CLIFeeArgs, authWitnesses: AuthWitness[], verbose: boolean, log: LogFn): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2ltdWxhdGUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbWRzL3NpbXVsYXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ25FLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUVqRSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUUzRCxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUF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,EAAE,YAAY,EAC7B,OAAO,EAAE,UAAU,EACnB,aAAa,EAAE,WAAW,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,KAAK,iBA8BX"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Contract } from '@aztec-labs/aztec.js/contracts';
|
|
2
|
+
import { prepTx } from '@aztec-labs/cli/utils';
|
|
3
|
+
import { format } from 'util';
|
|
4
|
+
import { printAuthorizations } from '../utils/authorizations.js';
|
|
5
|
+
import { printProfileResult } from '../utils/profiling.js';
|
|
6
|
+
export async function simulate(wallet, node, from, functionName, functionArgsIn, contractArtifactPath, contractAddress, feeOpts, authWitnesses, verbose, log) {
|
|
7
|
+
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
8
|
+
const contract = Contract.at(contractAddress, contractArtifact, wallet);
|
|
9
|
+
const call = contract.methods[functionName](...functionArgs);
|
|
10
|
+
const { paymentMethod, gasSettings } = await feeOpts.toUserFeeOptions(node, wallet, from);
|
|
11
|
+
const simulationResult = await call.simulate({
|
|
12
|
+
fee: {
|
|
13
|
+
paymentMethod,
|
|
14
|
+
gasSettings
|
|
15
|
+
},
|
|
16
|
+
from,
|
|
17
|
+
authWitnesses,
|
|
18
|
+
includeMetadata: true
|
|
19
|
+
});
|
|
20
|
+
if (verbose) {
|
|
21
|
+
await printAuthorizations(simulationResult.offchainEffects, async (address)=>{
|
|
22
|
+
const metadata = await wallet.getContractMetadata(address);
|
|
23
|
+
if (!metadata.instance) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const classId = metadata.updatedContractClassId ?? metadata.instance.originalContractClassId;
|
|
27
|
+
const artifact = await wallet.getContractArtifact(classId);
|
|
28
|
+
return artifact;
|
|
29
|
+
}, log);
|
|
30
|
+
printProfileResult(simulationResult.stats, log);
|
|
31
|
+
}
|
|
32
|
+
log(format('\nSimulation result: ', simulationResult.result, '\n'));
|
|
33
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import { GrumpkinScalar } from '@aztec-labs/foundation/curves/grumpkin';
|
|
3
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
4
|
+
import type { AztecAsyncKVStore } from '@aztec-labs/kv-store';
|
|
5
|
+
import type { AuthWitness } from '@aztec-labs/stdlib/auth-witness';
|
|
6
|
+
import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
|
|
7
|
+
import type { TxHash } from '@aztec-labs/stdlib/tx';
|
|
8
|
+
import type { AccountType } from '../utils/constants.js';
|
|
9
|
+
export declare const Aliases: readonly ["accounts", "contracts", "artifacts", "secrets", "transactions", "authwits"];
|
|
10
|
+
export type AliasType = (typeof Aliases)[number];
|
|
11
|
+
export declare class WalletDB {
|
|
12
|
+
#private;
|
|
13
|
+
private static instance;
|
|
14
|
+
private aliasCache;
|
|
15
|
+
static getInstance(): WalletDB;
|
|
16
|
+
init(store: AztecAsyncKVStore): Promise<void>;
|
|
17
|
+
private refreshAliasCache;
|
|
18
|
+
pushBridgedFeeJuice(recipient: AztecAddress, secret: Fr, amount: bigint, leafIndex: bigint, log: LogFn): Promise<void>;
|
|
19
|
+
popBridgedFeeJuice(recipient: AztecAddress, log: LogFn): Promise<{
|
|
20
|
+
amount: bigint;
|
|
21
|
+
secret: string;
|
|
22
|
+
leafIndex: bigint;
|
|
23
|
+
}>;
|
|
24
|
+
peekBridgedFeeJuice(recipient: AztecAddress, log: LogFn): Promise<{
|
|
25
|
+
amount: bigint;
|
|
26
|
+
secret: string;
|
|
27
|
+
leafIndex: bigint;
|
|
28
|
+
}>;
|
|
29
|
+
storeAccount(address: AztecAddress, { type, signingKey, secretKey, salt, alias, publicKey }: {
|
|
30
|
+
type: AccountType;
|
|
31
|
+
signingKey?: GrumpkinScalar;
|
|
32
|
+
secretKey?: Fr;
|
|
33
|
+
salt: Fr;
|
|
34
|
+
alias: string | undefined;
|
|
35
|
+
publicKey: string | undefined;
|
|
36
|
+
}, log: LogFn): Promise<void>;
|
|
37
|
+
storeSender(address: AztecAddress, alias: string, log: LogFn): Promise<void>;
|
|
38
|
+
storeContract(address: AztecAddress, artifactPath: string, log: LogFn, alias?: string): Promise<void>;
|
|
39
|
+
storeAuthwitness(authWit: AuthWitness, log: LogFn, alias?: string): Promise<void>;
|
|
40
|
+
storeTx({ txHash }: {
|
|
41
|
+
txHash: TxHash;
|
|
42
|
+
}, log: LogFn, alias?: string): Promise<void>;
|
|
43
|
+
tryRetrieveAlias(arg: string): string;
|
|
44
|
+
retrieveAliasFromCache(arg: string): string;
|
|
45
|
+
retrieveAlias(arg: string): Promise<string>;
|
|
46
|
+
listAliases(type?: AliasType): Promise<{
|
|
47
|
+
key: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}[]>;
|
|
50
|
+
storeAccountMetadata(aliasOrAddress: AztecAddress | string, metadataKey: string, metadata: Buffer): Promise<void>;
|
|
51
|
+
retrieveAccountMetadata(aliasOrAddress: AztecAddress | string, metadataKey: string): Promise<Buffer<ArrayBufferLike>>;
|
|
52
|
+
retrieveAccount(address: AztecAddress | string): Promise<{
|
|
53
|
+
address: string | AztecAddress;
|
|
54
|
+
signingKey: import("@aztec-labs/foundation/curves/bn254").Fq | undefined;
|
|
55
|
+
secretKey: Fr;
|
|
56
|
+
salt: Fr;
|
|
57
|
+
type: "ecdsasecp256k1" | "ecdsasecp256r1" | "ecdsasecp256r1ssh" | "schnorr" | "schnorr_initializerless";
|
|
58
|
+
}>;
|
|
59
|
+
storeAlias(type: AliasType, key: string, value: Buffer, log: LogFn): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0X2RiLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RvcmFnZS93YWxsZXRfZGIudHMiXSwibmFtZXMiOltd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,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,iBAY1F;IAEK,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,iBAStE;IAEK,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE;QAAE,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;;;;;;OAYnD;IAEK,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAMvE;CACF"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { Fr } from '@aztec-labs/foundation/curves/bn254';
|
|
2
|
+
import { GrumpkinScalar } from '@aztec-labs/foundation/curves/grumpkin';
|
|
3
|
+
import { extractECDSAPublicKeyFromBase64String } from '../utils/ecdsa.js';
|
|
4
|
+
export const Aliases = [
|
|
5
|
+
'accounts',
|
|
6
|
+
'contracts',
|
|
7
|
+
'artifacts',
|
|
8
|
+
'secrets',
|
|
9
|
+
'transactions',
|
|
10
|
+
'authwits'
|
|
11
|
+
];
|
|
12
|
+
export class WalletDB {
|
|
13
|
+
#store;
|
|
14
|
+
#accounts;
|
|
15
|
+
#aliases;
|
|
16
|
+
#bridgedFeeJuice;
|
|
17
|
+
static instance;
|
|
18
|
+
aliasCache = new Map();
|
|
19
|
+
static getInstance() {
|
|
20
|
+
if (!WalletDB.instance) {
|
|
21
|
+
WalletDB.instance = new WalletDB();
|
|
22
|
+
}
|
|
23
|
+
return WalletDB.instance;
|
|
24
|
+
}
|
|
25
|
+
async init(store) {
|
|
26
|
+
this.#store = store;
|
|
27
|
+
this.#accounts = store.openMap('accounts');
|
|
28
|
+
this.#aliases = store.openMap('aliases');
|
|
29
|
+
this.#bridgedFeeJuice = store.openMap('bridgedFeeJuice');
|
|
30
|
+
await this.refreshAliasCache();
|
|
31
|
+
}
|
|
32
|
+
async refreshAliasCache() {
|
|
33
|
+
this.aliasCache = new Map((await this.listAliases()).map(({ key, value })=>[
|
|
34
|
+
key,
|
|
35
|
+
value
|
|
36
|
+
]));
|
|
37
|
+
}
|
|
38
|
+
async pushBridgedFeeJuice(recipient, secret, amount, leafIndex, log) {
|
|
39
|
+
await this.#store.transactionAsync(async ()=>{
|
|
40
|
+
let stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
41
|
+
stackPointer++;
|
|
42
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:${stackPointer}`, Buffer.from(`${amount.toString()}:${secret.toString()}:${leafIndex.toString()}`));
|
|
43
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:stackPointer`, Buffer.from([
|
|
44
|
+
stackPointer
|
|
45
|
+
]));
|
|
46
|
+
log(`Pushed ${amount} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async popBridgedFeeJuice(recipient, log) {
|
|
50
|
+
let stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
51
|
+
const result = await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:${stackPointer}`);
|
|
52
|
+
if (!result) {
|
|
53
|
+
throw new Error(`No stored fee juice available for recipient ${recipient.toString()}. Please provide claim amount and secret. Stack pointer ${stackPointer}`);
|
|
54
|
+
}
|
|
55
|
+
const [amountStr, secretStr, leafIndexStr] = result.toString().split(':');
|
|
56
|
+
await this.#bridgedFeeJuice.set(`${recipient.toString()}:stackPointer`, Buffer.from([
|
|
57
|
+
--stackPointer
|
|
58
|
+
]));
|
|
59
|
+
log(`Retrieved ${amountStr} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
|
|
60
|
+
return {
|
|
61
|
+
amount: BigInt(amountStr),
|
|
62
|
+
secret: secretStr,
|
|
63
|
+
leafIndex: BigInt(leafIndexStr)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async peekBridgedFeeJuice(recipient, log) {
|
|
67
|
+
const stackPointer = (await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:stackPointer`))?.readInt8() || 0;
|
|
68
|
+
const result = await this.#bridgedFeeJuice.getAsync(`${recipient.toString()}:${stackPointer}`);
|
|
69
|
+
if (!result) {
|
|
70
|
+
throw new Error(`No stored fee juice available for recipient ${recipient.toString()}. Please provide claim amount and secret. Stack pointer ${stackPointer}`);
|
|
71
|
+
}
|
|
72
|
+
const [amountStr, secretStr, leafIndexStr] = result.toString().split(':');
|
|
73
|
+
log(`Peeked ${amountStr} fee juice for recipient ${recipient.toString()}. Stack pointer ${stackPointer}`);
|
|
74
|
+
return {
|
|
75
|
+
amount: BigInt(amountStr),
|
|
76
|
+
secret: secretStr,
|
|
77
|
+
leafIndex: BigInt(leafIndexStr)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
async storeAccount(address, { type, signingKey, secretKey, salt, alias, publicKey }, log) {
|
|
81
|
+
// Even though the privacy secret key is sometimes derived from the signing key, we store it in the database
|
|
82
|
+
// regardless as that is not always the case. Local-key accounts also store their signing key, while external-key
|
|
83
|
+
// accounts such as SSH store only the privacy secret.
|
|
84
|
+
if (!secretKey) {
|
|
85
|
+
throw new Error('Cannot store account without a secret key');
|
|
86
|
+
}
|
|
87
|
+
let publicSigningKey;
|
|
88
|
+
if (type === 'ecdsasecp256r1ssh' && publicKey) {
|
|
89
|
+
publicSigningKey = extractECDSAPublicKeyFromBase64String(publicKey);
|
|
90
|
+
}
|
|
91
|
+
await this.#store.transactionAsync(async ()=>{
|
|
92
|
+
if (alias) {
|
|
93
|
+
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
94
|
+
}
|
|
95
|
+
await this.#accounts.set(`${address.toString()}:type`, Buffer.from(type));
|
|
96
|
+
await this.#accounts.set(`${address.toString()}:sk`, secretKey.toBuffer());
|
|
97
|
+
if (signingKey) {
|
|
98
|
+
await this.#accounts.set(`${address.toString()}:signing`, signingKey.toBuffer());
|
|
99
|
+
}
|
|
100
|
+
await this.#accounts.set(`${address.toString()}:salt`, salt.toBuffer());
|
|
101
|
+
if (publicSigningKey) {
|
|
102
|
+
await this.#accounts.set(`${address.toString()}:publicSigningKey`, publicSigningKey);
|
|
103
|
+
}
|
|
104
|
+
await this.#aliases.set('accounts:last', Buffer.from(address.toString()));
|
|
105
|
+
});
|
|
106
|
+
log(`Account stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
107
|
+
await this.refreshAliasCache();
|
|
108
|
+
}
|
|
109
|
+
async storeSender(address, alias, log) {
|
|
110
|
+
await this.#aliases.set(`accounts:${alias}`, Buffer.from(address.toString()));
|
|
111
|
+
log(`Account stored in database with alias ${alias} as a sender`);
|
|
112
|
+
await this.refreshAliasCache();
|
|
113
|
+
}
|
|
114
|
+
async storeContract(address, artifactPath, log, alias) {
|
|
115
|
+
await this.#store.transactionAsync(async ()=>{
|
|
116
|
+
if (alias) {
|
|
117
|
+
await this.#aliases.set(`contracts:${alias}`, Buffer.from(address.toString()));
|
|
118
|
+
await this.#aliases.set(`artifacts:${alias}`, Buffer.from(artifactPath));
|
|
119
|
+
}
|
|
120
|
+
await this.#aliases.set(`contracts:last`, Buffer.from(address.toString()));
|
|
121
|
+
await this.#aliases.set(`artifacts:last`, Buffer.from(artifactPath));
|
|
122
|
+
await this.#aliases.set(`artifacts:${address.toString()}`, Buffer.from(artifactPath));
|
|
123
|
+
});
|
|
124
|
+
log(`Contract stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
125
|
+
await this.refreshAliasCache();
|
|
126
|
+
}
|
|
127
|
+
async storeAuthwitness(authWit, log, alias) {
|
|
128
|
+
await this.#store.transactionAsync(async ()=>{
|
|
129
|
+
if (alias) {
|
|
130
|
+
await this.#aliases.set(`authwits:${alias}`, Buffer.from(authWit.toString()));
|
|
131
|
+
}
|
|
132
|
+
await this.#aliases.set(`authwits:last`, Buffer.from(authWit.toString()));
|
|
133
|
+
});
|
|
134
|
+
log(`Authorization witness stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
135
|
+
await this.refreshAliasCache();
|
|
136
|
+
}
|
|
137
|
+
async storeTx({ txHash }, log, alias) {
|
|
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
|
+
});
|
|
144
|
+
log(`Transaction hash stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
145
|
+
await this.refreshAliasCache();
|
|
146
|
+
}
|
|
147
|
+
tryRetrieveAlias(arg) {
|
|
148
|
+
try {
|
|
149
|
+
return this.retrieveAliasFromCache(arg);
|
|
150
|
+
} catch {
|
|
151
|
+
return arg;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
retrieveAliasFromCache(arg) {
|
|
155
|
+
if (Aliases.find((alias)=>arg.startsWith(`${alias}:`))) {
|
|
156
|
+
const [type, ...alias] = arg.split(':');
|
|
157
|
+
const aliasKey = `${type}:${alias.join(':') ?? 'last'}`;
|
|
158
|
+
const data = this.aliasCache.get(aliasKey);
|
|
159
|
+
if (!data) {
|
|
160
|
+
throw new Error(`Could not find alias ${arg}`);
|
|
161
|
+
}
|
|
162
|
+
return data.toString();
|
|
163
|
+
} else {
|
|
164
|
+
throw new Error(`Aliases must start with one of ${Aliases.join(', ')}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async retrieveAlias(arg) {
|
|
168
|
+
if (Aliases.find((alias)=>arg.startsWith(`${alias}:`))) {
|
|
169
|
+
const [type, ...alias] = arg.split(':');
|
|
170
|
+
const data = await this.#aliases.getAsync(`${type}:${alias.join(':') ?? 'last'}`);
|
|
171
|
+
if (!data) {
|
|
172
|
+
throw new Error(`Could not find alias ${arg}`);
|
|
173
|
+
}
|
|
174
|
+
return data.toString();
|
|
175
|
+
} else {
|
|
176
|
+
throw new Error(`Aliases must start with one of ${Aliases.join(', ')}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async listAliases(type) {
|
|
180
|
+
const result = [];
|
|
181
|
+
if (type && !Aliases.includes(type)) {
|
|
182
|
+
throw new Error(`Unknown alias type ${type}`);
|
|
183
|
+
}
|
|
184
|
+
for await (const [key, value] of this.#aliases.entriesAsync()){
|
|
185
|
+
if (!type || key.startsWith(`${type}:`)) {
|
|
186
|
+
result.push({
|
|
187
|
+
key,
|
|
188
|
+
value: value.toString()
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
async storeAccountMetadata(aliasOrAddress, metadataKey, metadata) {
|
|
195
|
+
const { address } = await this.retrieveAccount(aliasOrAddress);
|
|
196
|
+
await this.#accounts.set(`${address.toString()}:${metadataKey}`, metadata);
|
|
197
|
+
}
|
|
198
|
+
async retrieveAccountMetadata(aliasOrAddress, metadataKey) {
|
|
199
|
+
const { address } = await this.retrieveAccount(aliasOrAddress);
|
|
200
|
+
const result = await this.#accounts.getAsync(`${address.toString()}:${metadataKey}`);
|
|
201
|
+
if (!result) {
|
|
202
|
+
throw new Error(`Could not find metadata with key ${metadataKey} for account ${aliasOrAddress}`);
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
async retrieveAccount(address) {
|
|
207
|
+
const secretKeyBuffer = await this.#accounts.getAsync(`${address.toString()}:sk`);
|
|
208
|
+
if (!secretKeyBuffer) {
|
|
209
|
+
throw new Error(`Could not find ${address}:sk. Account "${address.toString}" does not exist on this wallet.`);
|
|
210
|
+
}
|
|
211
|
+
const signingKeyBuffer = await this.#accounts.getAsync(`${address.toString()}:signing`);
|
|
212
|
+
const secretKey = Fr.fromBuffer(secretKeyBuffer);
|
|
213
|
+
// External-key accounts (e.g. SSH) store no signing key.
|
|
214
|
+
const signingKey = signingKeyBuffer ? GrumpkinScalar.fromBuffer(signingKeyBuffer) : undefined;
|
|
215
|
+
const salt = Fr.fromBuffer(await this.#accounts.getAsync(`${address.toString()}:salt`));
|
|
216
|
+
const type = (await this.#accounts.getAsync(`${address.toString()}:type`)).toString('utf8');
|
|
217
|
+
return {
|
|
218
|
+
address,
|
|
219
|
+
signingKey,
|
|
220
|
+
secretKey,
|
|
221
|
+
salt,
|
|
222
|
+
type
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async storeAlias(type, key, value, log) {
|
|
226
|
+
await this.#aliases.set(`${type}:${key}`, value);
|
|
227
|
+
await this.refreshAliasCache();
|
|
228
|
+
log(`Data stored in database with alias ${type}:${key}`);
|
|
229
|
+
await this.refreshAliasCache();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec-labs/aztec.js/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec-labs/aztec.js/addresses';
|
|
3
|
+
import type { LogFn } from '@aztec-labs/foundation/log';
|
|
4
|
+
import type { OffchainEffect } from '@aztec-labs/stdlib/tx';
|
|
5
|
+
export declare function printAuthorizations(offchainEffects: OffchainEffect[], artifactRetriever: (address: AztecAddress) => Promise<ContractArtifact | undefined>, log: LogFn): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbnMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9hdXRob3JpemF0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ2pFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBRW5FLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBRXhELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRzVELHdCQUFzQixtQkFBbUIsQ0FDdkMsZUFBZSxFQUFFLGNBQWMsRUFBRSxFQUNqQyxpQkFBaUIsRUFBRSxDQUFDLE9BQU8sRUFBRSxZQUFZLEtBQUssT0FBTyxDQUFDLGdCQUFnQixHQUFHLFNBQVMsQ0FBQyxFQUNuRixHQUFHLEVBQUUsS0FBSyxpQkFzQ1gifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorizations.d.ts","sourceRoot":"","sources":["../../src/utils/authorizations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,wBAAsB,mBAAmB,CACvC,eAAe,EAAE,cAAc,EAAE,EACjC,iBAAiB,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,EACnF,GAAG,EAAE,KAAK,iBAsCX"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CallAuthorizationRequest } from '@aztec-labs/aztec.js/authorization';
|
|
2
|
+
import { decodeEachFromAbi, getFunctionArtifact } from '@aztec-labs/stdlib/abi';
|
|
3
|
+
import { format } from 'util';
|
|
4
|
+
export async function printAuthorizations(offchainEffects, artifactRetriever, log) {
|
|
5
|
+
log(format('\nAuthorizations requested by the tx:\n'));
|
|
6
|
+
const callAuthorizationSelector = await CallAuthorizationRequest.getSelector();
|
|
7
|
+
const callAuthorizationEffects = offchainEffects.filter((effect)=>effect.data[0].equals(callAuthorizationSelector.toField()));
|
|
8
|
+
for (const callAuthorizationEffect of callAuthorizationEffects){
|
|
9
|
+
const callAuthorizationRequest = await CallAuthorizationRequest.fromFields(callAuthorizationEffect.data);
|
|
10
|
+
const artifact = await artifactRetriever(callAuthorizationEffect.contractAddress);
|
|
11
|
+
if (!artifact) {
|
|
12
|
+
log(format(' -', `Call authorization. Inner hash: ${callAuthorizationRequest.innerHash.toString()}\n`));
|
|
13
|
+
log(format(' ', `Contract: unknown@${callAuthorizationEffect.contractAddress}`));
|
|
14
|
+
log(format(' ', `${callAuthorizationRequest.functionSelector.toString()}(\n${callAuthorizationRequest.args.map((arg)=>` ${arg.toString()}`).join(',\n')}\n )`));
|
|
15
|
+
} else {
|
|
16
|
+
const functionAbi = await getFunctionArtifact(artifact, callAuthorizationRequest.functionSelector);
|
|
17
|
+
const callData = decodeEachFromAbi(functionAbi.parameters.map((param)=>param.type), callAuthorizationRequest.args);
|
|
18
|
+
const parameters = functionAbi.parameters.map((param, i)=>({
|
|
19
|
+
name: param.name,
|
|
20
|
+
value: callData[i]
|
|
21
|
+
}));
|
|
22
|
+
log(format(' -', `Call authorization. Inner hash: ${callAuthorizationRequest.innerHash.toString()}`));
|
|
23
|
+
log(format(' ', `Contract: ${artifact.name}@${callAuthorizationEffect.contractAddress}`));
|
|
24
|
+
log(format(' ', /* eslint-disable-next-line @typescript-eslint/no-base-to-string */ `${functionAbi.name}(\n${parameters.map((p)=>` ${p.name}: ${p.value}`).join(',\n')}\n )`));
|
|
25
|
+
}
|
|
26
|
+
log(`\n`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec-labs/stdlib/interfaces/client';
|
|
2
|
+
import { CLIWallet } from './wallet.js';
|
|
3
|
+
export declare const DEFAULT_TX_TIMEOUT_S = 180;
|
|
4
|
+
export declare class CliWalletAndNodeWrapper {
|
|
5
|
+
private _wallet;
|
|
6
|
+
private _node;
|
|
7
|
+
constructor();
|
|
8
|
+
get wallet(): CLIWallet;
|
|
9
|
+
get node(): AztecNode;
|
|
10
|
+
setNodeAndWallet(node: AztecNode, wallet: CLIWallet): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpX3dhbGxldF9hbmRfbm9kZV93cmFwcGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvY2xpX3dhbGxldF9hbmRfbm9kZV93cmFwcGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHNDQUFzQyxDQUFDO0FBRXRFLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFeEMsZUFBTyxNQUFNLG9CQUFvQixNQUFNLENBQUM7QUFNeEMscUJBQWEsdUJBQXVCO0lBQ2xDLE9BQU8sQ0FBQyxPQUFPLENBQXdCO0lBQ3ZDLE9BQU8sQ0FBQyxLQUFLLENBQXdCO0lBRXJDLGNBQWdCO0lBRWhCLElBQUksTUFBTSxjQUtUO0lBRUQsSUFBSSxJQUFJLElBQUksU0FBUyxDQUtwQjtJQUVELGdCQUFnQixDQUFDLElBQUksRUFBRSxTQUFTLEVBQUUsTUFBTSxFQUFFLFNBQVMsUUFHbEQ7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli_wallet_and_node_wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/cli_wallet_and_node_wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAMxC,qBAAa,uBAAuB;IAClC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,KAAK,CAAwB;IAErC,cAAgB;IAEhB,IAAI,MAAM,cAKT;IAED,IAAI,IAAI,IAAI,SAAS,CAKpB;IAED,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,QAGlD;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const DEFAULT_TX_TIMEOUT_S = 180;
|
|
2
|
+
/*
|
|
3
|
+
* Wrapper class for CLIWallet and AztecNode, avoids initialization issues due to closures when providing CLIWallet
|
|
4
|
+
* and AztecNode to injected commander.js commands
|
|
5
|
+
*/ export class CliWalletAndNodeWrapper {
|
|
6
|
+
_wallet;
|
|
7
|
+
_node;
|
|
8
|
+
constructor(){}
|
|
9
|
+
get wallet() {
|
|
10
|
+
if (!this._wallet) {
|
|
11
|
+
throw new Error('Wallet not initialized while it should have been initialized in preSubcommand');
|
|
12
|
+
}
|
|
13
|
+
return this._wallet;
|
|
14
|
+
}
|
|
15
|
+
get node() {
|
|
16
|
+
if (!this._node) {
|
|
17
|
+
throw new Error('Node not initialized while it should have been initialized in preSubcommand');
|
|
18
|
+
}
|
|
19
|
+
return this._node;
|
|
20
|
+
}
|
|
21
|
+
setNodeAndWallet(node, wallet) {
|
|
22
|
+
this._node = node;
|
|
23
|
+
this._wallet = wallet;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const MIN_FEE_PADDING = 0.5;
|
|
2
|
+
export declare const AccountTypes: readonly ["schnorr", "schnorr_initializerless", "ecdsasecp256r1", "ecdsasecp256r1ssh", "ecdsasecp256k1"];
|
|
3
|
+
export type AccountType = (typeof AccountTypes)[number];
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGVBQU8sTUFBTSxlQUFlLE1BQU0sQ0FBQztBQUVuQyxlQUFPLE1BQU0sWUFBWSwwR0FNZixDQUFDO0FBQ1gsTUFBTSxNQUFNLFdBQVcsR0FBRyxDQUFDLE9BQU8sWUFBWSxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,eAAO,MAAM,YAAY,0GAMf,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
|