@aztec/cli-wallet 0.0.0-test.1 → 0.0.1-commit.b655e406
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 +30 -0
- package/dest/bin/index.js +48 -26
- package/dest/cmds/authorize_action.d.ts +3 -2
- package/dest/cmds/authorize_action.d.ts.map +1 -1
- package/dest/cmds/authorize_action.js +8 -4
- package/dest/cmds/bridge_fee_juice.d.ts +2 -2
- package/dest/cmds/bridge_fee_juice.d.ts.map +1 -1
- package/dest/cmds/bridge_fee_juice.js +8 -7
- package/dest/cmds/check_tx.d.ts +4 -2
- package/dest/cmds/check_tx.d.ts.map +1 -1
- package/dest/cmds/check_tx.js +145 -6
- package/dest/cmds/create_account.d.ts +6 -5
- package/dest/cmds/create_account.d.ts.map +1 -1
- package/dest/cmds/create_account.js +46 -27
- package/dest/cmds/create_authwit.d.ts +3 -2
- package/dest/cmds/create_authwit.d.ts.map +1 -1
- package/dest/cmds/create_authwit.js +5 -5
- package/dest/cmds/deploy.d.ts +6 -3
- package/dest/cmds/deploy.d.ts.map +1 -1
- package/dest/cmds/deploy.js +71 -54
- package/dest/cmds/deploy_account.d.ts +5 -7
- package/dest/cmds/deploy_account.d.ts.map +1 -1
- package/dest/cmds/deploy_account.js +46 -29
- package/dest/cmds/import_test_accounts.d.ts +2 -2
- package/dest/cmds/import_test_accounts.d.ts.map +1 -1
- package/dest/cmds/import_test_accounts.js +6 -9
- package/dest/cmds/index.d.ts +2 -2
- package/dest/cmds/index.d.ts.map +1 -1
- package/dest/cmds/index.js +83 -115
- 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 +6 -2
- package/dest/cmds/register_contract.d.ts.map +1 -1
- package/dest/cmds/register_contract.js +20 -7
- package/dest/cmds/register_sender.d.ts +3 -2
- package/dest/cmds/register_sender.d.ts.map +1 -1
- package/dest/cmds/send.d.ts +7 -8
- package/dest/cmds/send.d.ts.map +1 -1
- package/dest/cmds/send.js +31 -20
- package/dest/cmds/simulate.d.ts +6 -2
- package/dest/cmds/simulate.d.ts.map +1 -1
- package/dest/cmds/simulate.js +25 -19
- package/dest/storage/wallet_db.d.ts +4 -16
- package/dest/storage/wallet_db.d.ts.map +1 -1
- package/dest/storage/wallet_db.js +2 -23
- 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/ecdsa.d.ts +0 -2
- package/dest/utils/ecdsa.d.ts.map +1 -1
- package/dest/utils/options/fees.d.ts +20 -27
- package/dest/utils/options/fees.d.ts.map +1 -1
- package/dest/utils/options/fees.js +85 -144
- package/dest/utils/options/options.d.ts +8 -4
- package/dest/utils/options/options.d.ts.map +1 -1
- package/dest/utils/options/options.js +26 -14
- package/dest/utils/profiling.d.ts +5 -0
- package/dest/utils/profiling.d.ts.map +1 -0
- package/dest/utils/profiling.js +60 -0
- package/dest/utils/wallet.d.ts +35 -0
- package/dest/utils/wallet.d.ts.map +1 -0
- package/dest/utils/wallet.js +193 -0
- package/package.json +24 -20
- package/src/bin/index.ts +56 -32
- package/src/cmds/authorize_action.ts +15 -4
- package/src/cmds/bridge_fee_juice.ts +14 -11
- package/src/cmds/check_tx.ts +182 -5
- package/src/cmds/create_account.ts +55 -32
- package/src/cmds/create_authwit.ts +8 -4
- package/src/cmds/deploy.ts +79 -62
- package/src/cmds/deploy_account.ts +57 -28
- package/src/cmds/import_test_accounts.ts +7 -11
- package/src/cmds/index.ts +256 -220
- package/src/cmds/profile.ts +48 -0
- package/src/cmds/register_contract.ts +28 -5
- package/src/cmds/register_sender.ts +3 -2
- package/src/cmds/send.ts +31 -17
- package/src/cmds/simulate.ts +39 -23
- package/src/storage/wallet_db.ts +3 -31
- package/src/utils/authorizations.ts +51 -0
- package/src/utils/cli_wallet_and_node_wrapper.ts +35 -0
- package/src/utils/options/fees.ts +134 -206
- package/src/utils/options/options.ts +41 -19
- package/src/utils/profiling.ts +158 -0
- package/src/utils/wallet.ts +264 -0
- package/dest/cmds/add_authwit.d.ts +0 -4
- package/dest/cmds/add_authwit.d.ts.map +0 -1
- package/dest/cmds/add_authwit.js +0 -4
- package/dest/cmds/cancel_tx.d.ts +0 -11
- package/dest/cmds/cancel_tx.d.ts.map +0 -1
- package/dest/cmds/cancel_tx.js +0 -38
- package/dest/utils/accounts.d.ts +0 -11
- package/dest/utils/accounts.d.ts.map +0 -1
- package/dest/utils/accounts.js +0 -87
- package/dest/utils/pxe_wrapper.d.ts +0 -10
- package/dest/utils/pxe_wrapper.d.ts.map +0 -1
- package/dest/utils/pxe_wrapper.js +0 -21
- package/src/cmds/add_authwit.ts +0 -13
- package/src/cmds/cancel_tx.ts +0 -62
- package/src/utils/accounts.ts +0 -102
- package/src/utils/pxe_wrapper.ts +0 -26
package/dest/cmds/simulate.js
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import { Contract } from '@aztec/aztec.js';
|
|
1
|
+
import { Contract } from '@aztec/aztec.js/contracts';
|
|
2
2
|
import { prepTx } from '@aztec/cli/utils';
|
|
3
3
|
import { format } from 'util';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
log(format('\nGate count per circuit:'));
|
|
8
|
-
let acc = 0;
|
|
9
|
-
result.gateCounts.forEach((r)=>{
|
|
10
|
-
acc += r.gateCount;
|
|
11
|
-
log(format(' ', r.circuitName.padEnd(50), 'Gates:', r.gateCount.toLocaleString(), '\tAcc:', acc.toLocaleString()));
|
|
12
|
-
});
|
|
13
|
-
log(format('\nTotal gates:', acc.toLocaleString()));
|
|
14
|
-
}
|
|
15
|
-
export async function simulate(wallet, functionName, functionArgsIn, contractArtifactPath, contractAddress, profile, log) {
|
|
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) {
|
|
16
7
|
const { functionArgs, contractArtifact } = await prepTx(contractArtifactPath, functionName, functionArgsIn, log);
|
|
17
8
|
const contract = await Contract.at(contractAddress, contractArtifact, wallet);
|
|
18
9
|
const call = contract.methods[functionName](...functionArgs);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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.contractInstance) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const classMetadata = await wallet.getContractClassMetadata(metadata.contractInstance.currentContractClassId, true);
|
|
27
|
+
return classMetadata.artifact;
|
|
28
|
+
}, log);
|
|
29
|
+
printProfileResult(simulationResult.stats, log);
|
|
25
30
|
}
|
|
31
|
+
log(format('\nSimulation result: ', simulationResult.result, '\n'));
|
|
26
32
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
3
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
4
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
7
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
9
6
|
import type { TxHash } from '@aztec/stdlib/tx';
|
|
10
|
-
import type { AccountType } from '../utils/
|
|
7
|
+
import type { AccountType } from '../utils/wallet.js';
|
|
11
8
|
export declare const Aliases: readonly ["accounts", "contracts", "artifacts", "secrets", "transactions", "authwits"];
|
|
12
9
|
export type AliasType = (typeof Aliases)[number];
|
|
13
10
|
export declare class WalletDB {
|
|
@@ -33,18 +30,9 @@ export declare class WalletDB {
|
|
|
33
30
|
storeSender(address: AztecAddress, alias: string, log: LogFn): Promise<void>;
|
|
34
31
|
storeContract(address: AztecAddress, artifactPath: string, log: LogFn, alias?: string): Promise<void>;
|
|
35
32
|
storeAuthwitness(authWit: AuthWitness, log: LogFn, alias?: string): Promise<void>;
|
|
36
|
-
storeTx({ txHash
|
|
33
|
+
storeTx({ txHash }: {
|
|
37
34
|
txHash: TxHash;
|
|
38
|
-
nonce: Fr;
|
|
39
|
-
cancellable: boolean;
|
|
40
|
-
gasSettings: GasSettings;
|
|
41
35
|
}, log: LogFn, alias?: string): Promise<void>;
|
|
42
|
-
retrieveTxData(txHash: TxHash): Promise<{
|
|
43
|
-
txHash: TxHash;
|
|
44
|
-
nonce: Fr;
|
|
45
|
-
cancellable: boolean;
|
|
46
|
-
gasSettings: GasSettings;
|
|
47
|
-
}>;
|
|
48
36
|
tryRetrieveAlias(arg: string): string;
|
|
49
37
|
retrieveAliasFromCache(arg: string): string;
|
|
50
38
|
retrieveAlias(arg: string): Promise<string>;
|
|
@@ -53,12 +41,12 @@ export declare class WalletDB {
|
|
|
53
41
|
value: string;
|
|
54
42
|
}[]>;
|
|
55
43
|
storeAccountMetadata(aliasOrAddress: AztecAddress | string, metadataKey: string, metadata: Buffer): Promise<void>;
|
|
56
|
-
retrieveAccountMetadata(aliasOrAddress: AztecAddress | string, metadataKey: string): Promise<Buffer
|
|
44
|
+
retrieveAccountMetadata(aliasOrAddress: AztecAddress | string, metadataKey: string): Promise<Buffer<ArrayBufferLike>>;
|
|
57
45
|
retrieveAccount(address: AztecAddress | string): Promise<{
|
|
58
46
|
address: string | AztecAddress;
|
|
59
47
|
secretKey: Fr;
|
|
60
48
|
salt: Fr;
|
|
61
|
-
type: "schnorr" | "ecdsasecp256r1ssh" | "ecdsasecp256k1";
|
|
49
|
+
type: "schnorr" | "ecdsasecp256r1" | "ecdsasecp256r1ssh" | "ecdsasecp256k1";
|
|
62
50
|
}>;
|
|
63
51
|
storeAlias(type: AliasType, key: string, value: Buffer, log: LogFn): Promise<void>;
|
|
64
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet_db.d.ts","sourceRoot":"","sources":["../../src/storage/wallet_db.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallet_db.d.ts","sourceRoot":"","sources":["../../src/storage/wallet_db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,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;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,OAAO,wFAAyF,CAAC;AAC9G,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjD,qBAAa,QAAQ;;IAKnB,OAAO,C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C,EAAE,SAAS;;;;IAa5B,oBAAoB,CAAC,cAAc,EAAE,YAAY,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAKjG,uBAAuB,CAAC,cAAc,EAAE,YAAY,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM;IASlF,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM;;;;;;IAW9C,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK;CAOzE"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { GasSettings } from '@aztec/stdlib/gas';
|
|
3
2
|
import { extractECDSAPublicKeyFromBase64String } from '../utils/ecdsa.js';
|
|
4
3
|
export const Aliases = [
|
|
5
4
|
'accounts',
|
|
@@ -13,7 +12,6 @@ export class WalletDB {
|
|
|
13
12
|
#accounts;
|
|
14
13
|
#aliases;
|
|
15
14
|
#bridgedFeeJuice;
|
|
16
|
-
#transactions;
|
|
17
15
|
static instance;
|
|
18
16
|
aliasCache = new Map();
|
|
19
17
|
static getInstance() {
|
|
@@ -26,7 +24,6 @@ export class WalletDB {
|
|
|
26
24
|
this.#accounts = store.openMap('accounts');
|
|
27
25
|
this.#aliases = store.openMap('aliases');
|
|
28
26
|
this.#bridgedFeeJuice = store.openMap('bridgedFeeJuice');
|
|
29
|
-
this.#transactions = store.openMap('transactions');
|
|
30
27
|
await this.refreshAliasCache();
|
|
31
28
|
}
|
|
32
29
|
async refreshAliasCache() {
|
|
@@ -100,36 +97,18 @@ export class WalletDB {
|
|
|
100
97
|
log(`Authorization witness stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
101
98
|
await this.refreshAliasCache();
|
|
102
99
|
}
|
|
103
|
-
async storeTx({ txHash
|
|
100
|
+
async storeTx({ txHash }, log, alias) {
|
|
104
101
|
if (alias) {
|
|
105
102
|
await this.#aliases.set(`transactions:${alias}`, Buffer.from(txHash.toString()));
|
|
106
103
|
}
|
|
107
|
-
await this.#transactions.set(`${txHash.toString()}:nonce`, nonce.toBuffer());
|
|
108
|
-
await this.#transactions.set(`${txHash.toString()}:cancellable`, Buffer.from(cancellable ? 'true' : 'false'));
|
|
109
|
-
await this.#transactions.set(`${txHash.toString()}:gasSettings`, gasSettings.toBuffer());
|
|
110
104
|
await this.#aliases.set(`transactions:last`, Buffer.from(txHash.toString()));
|
|
111
105
|
log(`Transaction hash stored in database with alias${alias ? `es last & ${alias}` : ' last'}`);
|
|
112
106
|
await this.refreshAliasCache();
|
|
113
107
|
}
|
|
114
|
-
async retrieveTxData(txHash) {
|
|
115
|
-
const nonceBuffer = await this.#transactions.getAsync(`${txHash.toString()}:nonce`);
|
|
116
|
-
if (!nonceBuffer) {
|
|
117
|
-
throw new Error(`Could not find ${txHash.toString()}:nonce. Transaction with hash "${txHash.toString()}" does not exist on this wallet.`);
|
|
118
|
-
}
|
|
119
|
-
const nonce = Fr.fromBuffer(nonceBuffer);
|
|
120
|
-
const cancellable = (await this.#transactions.getAsync(`${txHash.toString()}:cancellable`)).toString() === 'true';
|
|
121
|
-
const gasBuffer = await this.#transactions.getAsync(`${txHash.toString()}:gasSettings`);
|
|
122
|
-
return {
|
|
123
|
-
txHash,
|
|
124
|
-
nonce,
|
|
125
|
-
cancellable,
|
|
126
|
-
gasSettings: GasSettings.fromBuffer(gasBuffer)
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
108
|
tryRetrieveAlias(arg) {
|
|
130
109
|
try {
|
|
131
110
|
return this.retrieveAliasFromCache(arg);
|
|
132
|
-
} catch
|
|
111
|
+
} catch {
|
|
133
112
|
return arg;
|
|
134
113
|
}
|
|
135
114
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
4
|
+
import type { OffchainEffect } from '@aztec/stdlib/tx';
|
|
5
|
+
export declare function printAuthorizations(offchainEffects: OffchainEffect[], artifactRetriever: (address: AztecAddress) => Promise<ContractArtifact | undefined>, log: LogFn): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=authorizations.d.ts.map
|
|
@@ -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,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD,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/aztec.js/authorization';
|
|
2
|
+
import { decodeFromAbi, getFunctionArtifact } from '@aztec/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 = decodeFromAbi(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/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=cli_wallet_and_node_wrapper.d.ts.map
|
|
@@ -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,iCAAiC,CAAC;AAEjE,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;;IAIrC,IAAI,MAAM,cAKT;IAED,IAAI,IAAI,cAKP;IAED,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS;CAIpD"}
|
|
@@ -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
|
+
}
|
package/dest/utils/ecdsa.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa.d.ts","sourceRoot":"","sources":["../../src/utils/ecdsa.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecdsa.d.ts","sourceRoot":"","sources":["../../src/utils/ecdsa.ts"],"names":[],"mappings":"AAAA,wBAAgB,qCAAqC,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAcrF"}
|
|
@@ -1,41 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
3
|
+
import type { FeeOptions, Wallet } from '@aztec/aztec.js/wallet';
|
|
2
4
|
import type { LogFn } from '@aztec/foundation/log';
|
|
5
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
6
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
7
|
import { GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
4
8
|
import { Option } from 'commander';
|
|
5
9
|
import type { WalletDB } from '../../storage/wallet_db.js';
|
|
6
|
-
export type
|
|
10
|
+
export type RawCliFeeArgs = {
|
|
7
11
|
estimateGasOnly: boolean;
|
|
8
12
|
gasLimits?: string;
|
|
9
13
|
payment?: string;
|
|
10
14
|
maxFeesPerGas?: string;
|
|
11
15
|
maxPriorityFeesPerGas?: string;
|
|
12
|
-
estimateGas?: boolean;
|
|
13
16
|
};
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
gasSettings
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export declare function
|
|
21
|
-
export declare class
|
|
17
|
+
export type ParsedFeeOptions = {
|
|
18
|
+
paymentMethod?: FeePaymentMethod;
|
|
19
|
+
gasSettings?: Partial<FieldsOf<GasSettings>>;
|
|
20
|
+
};
|
|
21
|
+
export declare function getPaymentMethodOption(): Option;
|
|
22
|
+
export declare function parsePaymentMethod(payment: string, log: LogFn, db?: WalletDB): (wallet: Wallet, from: AztecAddress, gasSettings: GasSettings) => Promise<FeePaymentMethod | undefined>;
|
|
23
|
+
export declare function parseGasFees(gasFees: string): GasFees;
|
|
24
|
+
export declare class CLIFeeArgs {
|
|
22
25
|
estimateOnly: boolean;
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
toSendOpts(sender: AccountWallet): Promise<SendMethodOptions>;
|
|
29
|
-
toDeployAccountOpts(sender: AccountWallet): Promise<DeployAccountOptions>;
|
|
30
|
-
static paymentMethodOption(): Option;
|
|
26
|
+
private paymentMethod;
|
|
27
|
+
private gasSettings;
|
|
28
|
+
constructor(estimateOnly: boolean, paymentMethod: (wallet: Wallet, feePayer: AztecAddress, gasSettings: GasSettings) => Promise<FeePaymentMethod | undefined>, gasSettings: Partial<FieldsOf<GasSettings>>);
|
|
29
|
+
toUserFeeOptions(node: AztecNode, wallet: Wallet, from: AztecAddress): Promise<ParsedFeeOptions>;
|
|
30
|
+
static parse(args: RawCliFeeArgs, log: LogFn, db?: WalletDB): CLIFeeArgs;
|
|
31
31
|
static getOptions(): Option[];
|
|
32
|
-
static fromCli(args: CliFeeArgs, pxe: PXE, log: LogFn, db?: WalletDB): Promise<FeeOpts>;
|
|
33
32
|
}
|
|
34
|
-
export declare
|
|
35
|
-
static paymentMethodOption(): Option;
|
|
36
|
-
static getOptions(): Option[];
|
|
37
|
-
static fromCli(args: CliFeeArgs, pxe: PXE, log: LogFn, db?: WalletDB): Promise<FeeOptsWithFeePayer>;
|
|
38
|
-
}
|
|
39
|
-
export declare function parsePaymentMethod(payment: string, allowCustomFeePayer: boolean, log: LogFn, db?: WalletDB): (sender: AccountWallet) => Promise<FeePaymentMethod>;
|
|
40
|
-
export declare function parseGasFees(gasFees: string): GasFees;
|
|
33
|
+
export declare function printGasEstimates(feeOpts: FeeOptions, gasEstimates: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>, log: LogFn): void;
|
|
41
34
|
//# sourceMappingURL=fees.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["../../../src/utils/options/fees.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"fees.d.ts","sourceRoot":"","sources":["../../../src/utils/options/fees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAO,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAI3D,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;CAC9C,CAAC;AAyDF,wBAAgB,sBAAsB,WAGrC;AA0BD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,KAA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