@aztec/wallets 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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/embedded/account-contract-providers/bundle.d.ts +2 -1
- package/dest/embedded/account-contract-providers/bundle.d.ts.map +1 -1
- package/dest/embedded/account-contract-providers/bundle.js +10 -5
- package/dest/embedded/account-contract-providers/lazy.d.ts +2 -1
- package/dest/embedded/account-contract-providers/lazy.d.ts.map +1 -1
- package/dest/embedded/account-contract-providers/lazy.js +10 -6
- package/dest/embedded/account-contract-providers/types.d.ts +2 -1
- package/dest/embedded/account-contract-providers/types.d.ts.map +1 -1
- package/dest/embedded/embedded_wallet.d.ts +5 -6
- package/dest/embedded/embedded_wallet.d.ts.map +1 -1
- package/dest/embedded/embedded_wallet.js +68 -27
- package/dest/embedded/entrypoints/browser.d.ts +1 -1
- package/dest/embedded/entrypoints/browser.d.ts.map +1 -1
- package/dest/embedded/entrypoints/browser.js +21 -18
- package/dest/embedded/entrypoints/node.d.ts +1 -1
- package/dest/embedded/entrypoints/node.d.ts.map +1 -1
- package/dest/embedded/entrypoints/node.js +24 -12
- package/dest/embedded/store_encryption.d.ts +9 -2
- package/dest/embedded/store_encryption.d.ts.map +1 -1
- package/dest/embedded/store_encryption.js +27 -5
- package/dest/embedded/wallet_db.d.ts +5 -3
- package/dest/embedded/wallet_db.d.ts.map +1 -1
- package/dest/embedded/wallet_db.js +4 -2
- package/dest/testing.d.ts +8 -4
- package/dest/testing.d.ts.map +1 -1
- package/dest/testing.js +8 -14
- package/package.json +11 -11
- package/src/embedded/account-contract-providers/bundle.ts +11 -5
- package/src/embedded/account-contract-providers/lazy.ts +11 -6
- package/src/embedded/account-contract-providers/types.ts +1 -0
- package/src/embedded/embedded_wallet.ts +63 -36
- package/src/embedded/entrypoints/browser.ts +26 -28
- package/src/embedded/entrypoints/node.ts +33 -27
- package/src/embedded/store_encryption.ts +42 -3
- package/src/embedded/wallet_db.ts +6 -3
- package/src/testing.ts +11 -17
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
-
import {
|
|
3
|
+
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
4
4
|
import { getPXEConfig } from '@aztec/pxe/config';
|
|
5
|
-
import { createPXE } from '@aztec/pxe/server';
|
|
5
|
+
import { createPXE, openStore } from '@aztec/pxe/server';
|
|
6
6
|
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
7
|
+
import { getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
|
|
7
8
|
import { getStandardMultiCallEntrypoint } from '@aztec/standard-contracts/multi-call-entrypoint';
|
|
8
9
|
import { BundleAccountContractsProvider } from '../account-contract-providers/bundle.js';
|
|
9
10
|
import { EmbeddedWallet, splitPxeOptions } from '../embedded_wallet.js';
|
|
10
|
-
import { WalletDB } from '../wallet_db.js';
|
|
11
|
+
import { WALLET_DATA_SCHEMA_VERSION, WalletDB } from '../wallet_db.js';
|
|
12
|
+
const DEFAULT_WALLET_DATA_DIRECTORY = 'aztec-wallet-data';
|
|
11
13
|
export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
12
14
|
static async create(nodeOrUrl, options = {}) {
|
|
13
15
|
const rootLogger = options.logger ?? createLogger('embedded-wallet');
|
|
14
16
|
const aztecNode = typeof nodeOrUrl === 'string' ? createAztecNodeClient(nodeOrUrl) : nodeOrUrl;
|
|
15
|
-
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
16
17
|
// Support both the new unified `pxe` option and the deprecated `pxeConfig`/`pxeOptions`.
|
|
17
18
|
const { config: pxeConfigFromPxe, creation: pxeCreationFromPxe } = splitPxeOptions(options.pxe);
|
|
18
19
|
const mergedConfigOverrides = {
|
|
@@ -24,8 +25,8 @@ export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
|
24
25
|
...pxeCreationFromPxe
|
|
25
26
|
};
|
|
26
27
|
const pxeConfig = Object.assign(getPXEConfig(), {
|
|
27
|
-
proverEnabled: mergedConfigOverrides.proverEnabled
|
|
28
|
-
dataDirectory:
|
|
28
|
+
proverEnabled: mergedConfigOverrides.proverEnabled,
|
|
29
|
+
dataDirectory: DEFAULT_WALLET_DATA_DIRECTORY,
|
|
29
30
|
autoSync: false,
|
|
30
31
|
...mergedConfigOverrides
|
|
31
32
|
});
|
|
@@ -37,7 +38,8 @@ export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
|
37
38
|
preloadedContractsProvider: mergedCreationOverrides.preloadedContractsProvider ?? {
|
|
38
39
|
getPreloadedContracts: async ()=>[
|
|
39
40
|
await getStandardMultiCallEntrypoint(),
|
|
40
|
-
await getStandardAuthRegistry()
|
|
41
|
+
await getStandardAuthRegistry(),
|
|
42
|
+
await getStandardHandshakeRegistry()
|
|
41
43
|
]
|
|
42
44
|
},
|
|
43
45
|
loggers: {
|
|
@@ -48,11 +50,21 @@ export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
|
48
50
|
}
|
|
49
51
|
};
|
|
50
52
|
const pxe = await createPXE(aztecNode, pxeConfig, pxeOptions);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
let walletDBStore = options.walletDb?.store;
|
|
54
|
+
if (!walletDBStore) {
|
|
55
|
+
const bindings = rootLogger.createChild('wallet:data').getBindings();
|
|
56
|
+
if (options.ephemeral) {
|
|
57
|
+
walletDBStore = await openTmpStore('wallet_data', true, undefined, undefined, bindings);
|
|
58
|
+
} else {
|
|
59
|
+
const { l1ChainId, l1ContractAddresses } = await aztecNode.getNodeInfo();
|
|
60
|
+
walletDBStore = await openStore('wallet_data', WALLET_DATA_SCHEMA_VERSION, {
|
|
61
|
+
dataDirectory: pxeConfig.dataDirectory ?? DEFAULT_WALLET_DATA_DIRECTORY,
|
|
62
|
+
dataStoreMapSizeKb: pxeConfig.dataStoreMapSizeKb,
|
|
63
|
+
l1ChainId,
|
|
64
|
+
rollupAddress: l1ContractAddresses.rollupAddress
|
|
65
|
+
}, bindings);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
56
68
|
const walletDB = new WalletDB(walletDBStore, rootLogger.createChild('wallet:db').info);
|
|
57
69
|
const wallet = new this(pxe, aztecNode, walletDB, new BundleAccountContractsProvider(), rootLogger);
|
|
58
70
|
await wallet.initStubClasses();
|
|
@@ -39,6 +39,13 @@ export interface OpenEncryptedEmbeddedStoresOptions {
|
|
|
39
39
|
* @internal
|
|
40
40
|
*/
|
|
41
41
|
export type OpenSqliteEncryptedStoreFn = (log: Logger, name: string, poolDirectory: string | undefined, encryptionKey: Uint8Array) => Promise<AztecSQLiteOPFSStore>;
|
|
42
|
+
/**
|
|
43
|
+
* Internal seam for tests to inject a fake store wiper. Defaults to removing the store's OPFS pool directory
|
|
44
|
+
* outright. Not part of the public API.
|
|
45
|
+
*
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
export type WipeSqliteStoreFn = (poolDirectory: string | undefined) => Promise<void>;
|
|
42
49
|
/**
|
|
43
50
|
* Opens the PXE and wallet stores in sequence, both encrypted with keys obtained from `getEncryptionKey`.
|
|
44
51
|
*
|
|
@@ -60,8 +67,8 @@ export type OpenSqliteEncryptedStoreFn = (log: Logger, name: string, poolDirecto
|
|
|
60
67
|
* @param log - Logger for both stores.
|
|
61
68
|
* @param openStore - Internal test seam. Do not pass in production code.
|
|
62
69
|
*/
|
|
63
|
-
export declare function openEncryptedEmbeddedStores(config: OpenEncryptedEmbeddedStoresOptions, getEncryptionKey: () => Promise<Uint8Array>, log: Logger, openStore?: OpenSqliteEncryptedStoreFn): Promise<{
|
|
70
|
+
export declare function openEncryptedEmbeddedStores(config: OpenEncryptedEmbeddedStoresOptions, getEncryptionKey: () => Promise<Uint8Array>, log: Logger, openStore?: OpenSqliteEncryptedStoreFn, wipeStore?: WipeSqliteStoreFn): Promise<{
|
|
64
71
|
pxeStore: AztecSQLiteOPFSStore;
|
|
65
72
|
walletStore: AztecSQLiteOPFSStore;
|
|
66
73
|
}>;
|
|
67
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
74
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmVfZW5jcnlwdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2VtYmVkZGVkL3N0b3JlX2VuY3J5cHRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7O0dBUUc7QUFDSCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUNwRCxPQUFPLEVBQ0wsb0JBQW9CLEVBRXBCLHFCQUFxQixFQUV0QixNQUFNLDZCQUE2QixDQUFDO0FBRXJDLGdFQUFnRTtBQUNoRSxNQUFNLE1BQU0saUJBQWlCLEdBQUcsS0FBSyxHQUFHLFFBQVEsQ0FBQztBQUVqRDs7O0dBR0c7QUFDSCxxQkFBYSw2QkFBOEIsU0FBUSxLQUFLO0lBQ3RELFFBQVEsQ0FBQyxTQUFTLEVBQUUsaUJBQWlCLENBQUM7SUFFdEMsWUFBWSxTQUFTLEVBQUUsaUJBQWlCLEVBQUUsSUFBSSxFQUFFO1FBQUUsS0FBSyxFQUFFLHFCQUFxQixDQUFBO0tBQUUsRUFJL0U7Q0FDRjtBQUVELDZEQUE2RDtBQUM3RCxNQUFNLFdBQVcsa0NBQWtDO0lBQ2pELEdBQUcsRUFBRTtRQUFFLElBQUksRUFBRSxNQUFNLENBQUM7UUFBQyxhQUFhLENBQUMsRUFBRSxNQUFNLENBQUE7S0FBRSxDQUFDO0lBQzlDLE1BQU0sRUFBRTtRQUFFLElBQUksRUFBRSxNQUFNLENBQUM7UUFBQyxhQUFhLENBQUMsRUFBRSxNQUFNLENBQUE7S0FBRSxDQUFDO0NBQ2xEO0FBRUQ7Ozs7O0dBS0c7QUFDSCxNQUFNLE1BQU0sMEJBQTBCLEdBQUcsQ0FDdkMsR0FBRyxFQUFFLE1BQU0sRUFDWCxJQUFJLEVBQUUsTUFBTSxFQUNaLGFBQWEsRUFBRSxNQUFNLEdBQUcsU0FBUyxFQUNqQyxhQUFhLEVBQUUsVUFBVSxLQUN0QixPQUFPLENBQUMsb0JBQW9CLENBQUMsQ0FBQztBQUtuQzs7Ozs7R0FLRztBQUNILE1BQU0sTUFBTSxpQkFBaUIsR0FBRyxDQUFDLGFBQWEsRUFBRSxNQUFNLEdBQUcsU0FBUyxLQUFLLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztBQWdCckY7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBb0JHO0FBQ0gsd0JBQXNCLDJCQUEyQixDQUMvQyxNQUFNLEVBQUUsa0NBQWtDLEVBQzFDLGdCQUFnQixFQUFFLE1BQU0sT0FBTyxDQUFDLFVBQVUsQ0FBQyxFQUMzQyxHQUFHLEVBQUUsTUFBTSxFQUNYLFNBQVMsR0FBRSwwQkFBNkMsRUFDeEQsU0FBUyxHQUFFLGlCQUFvQyxHQUM5QyxPQUFPLENBQUM7SUFBRSxRQUFRLEVBQUUsb0JBQW9CLENBQUM7SUFBQyxXQUFXLEVBQUUsb0JBQW9CLENBQUE7Q0FBRSxDQUFDLENBV2hGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store_encryption.d.ts","sourceRoot":"","sources":["../../src/embedded/store_encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"store_encryption.d.ts","sourceRoot":"","sources":["../../src/embedded/store_encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM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C,CAWhF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - `storeName: 'pxe' | 'wallet'`, telling callers WHICH store failed.
|
|
7
7
|
* - Cleanup: when the wallet store fails to open, ensures the already-opened PXE store is closed before the error
|
|
8
8
|
* surfaces, so callers don't leak the SAH Pool's OPFS lock.
|
|
9
|
-
*/ import { AztecSQLiteOPFSStore, SqliteEncryptionError } from '@aztec/kv-store/sqlite-opfs';
|
|
9
|
+
*/ import { AztecSQLiteOPFSStore, SqliteCorruptionError, SqliteEncryptionError, deletePoolDirectory } from '@aztec/kv-store/sqlite-opfs';
|
|
10
10
|
/**
|
|
11
11
|
* Thrown by {@link openEncryptedEmbeddedStores} when one of the two stores cannot be decrypted with the supplied
|
|
12
12
|
* key. The original {@link SqliteEncryptionError} is preserved as `cause`.
|
|
@@ -21,6 +21,18 @@
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
const defaultOpenStore = (log, name, poolDirectory, encryptionKey)=>AztecSQLiteOPFSStore.open(log, name, false, poolDirectory, encryptionKey);
|
|
24
|
+
/**
|
|
25
|
+
* Deletes a store's OPFS pool directory. Safe to call only after a *failed* open() — a live store's SAH pool holds
|
|
26
|
+
* a lock on the directory and the removal would reject. A store with no `poolDirectory` lives in the shared default
|
|
27
|
+
* pool, which we won't blow away (it would take unrelated stores with it), so wiping is a no-op there.
|
|
28
|
+
*/ const defaultWipeStore = async (poolDirectory)=>{
|
|
29
|
+
if (!poolDirectory) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
await deletePoolDirectory(poolDirectory).catch(()=>{
|
|
33
|
+
// Already gone / never created — nothing to wipe.
|
|
34
|
+
});
|
|
35
|
+
};
|
|
24
36
|
/**
|
|
25
37
|
* Opens the PXE and wallet stores in sequence, both encrypted with keys obtained from `getEncryptionKey`.
|
|
26
38
|
*
|
|
@@ -41,10 +53,10 @@ const defaultOpenStore = (log, name, poolDirectory, encryptionKey)=>AztecSQLiteO
|
|
|
41
53
|
* detaches on transfer, so each call must allocate).
|
|
42
54
|
* @param log - Logger for both stores.
|
|
43
55
|
* @param openStore - Internal test seam. Do not pass in production code.
|
|
44
|
-
*/ export async function openEncryptedEmbeddedStores(config, getEncryptionKey, log, openStore = defaultOpenStore) {
|
|
45
|
-
const pxeStore = await openOneStore('pxe', config.pxe, getEncryptionKey, log, openStore);
|
|
56
|
+
*/ export async function openEncryptedEmbeddedStores(config, getEncryptionKey, log, openStore = defaultOpenStore, wipeStore = defaultWipeStore) {
|
|
57
|
+
const pxeStore = await openOneStore('pxe', config.pxe, getEncryptionKey, log, openStore, wipeStore);
|
|
46
58
|
try {
|
|
47
|
-
const walletStore = await openOneStore('wallet', config.wallet, getEncryptionKey, log, openStore);
|
|
59
|
+
const walletStore = await openOneStore('wallet', config.wallet, getEncryptionKey, log, openStore, wipeStore);
|
|
48
60
|
return {
|
|
49
61
|
pxeStore,
|
|
50
62
|
walletStore
|
|
@@ -56,7 +68,7 @@ const defaultOpenStore = (log, name, poolDirectory, encryptionKey)=>AztecSQLiteO
|
|
|
56
68
|
throw err;
|
|
57
69
|
}
|
|
58
70
|
}
|
|
59
|
-
async function openOneStore(storeName, { name, poolDirectory }, getEncryptionKey, log, openStore) {
|
|
71
|
+
async function openOneStore(storeName, { name, poolDirectory }, getEncryptionKey, log, openStore, wipeStore) {
|
|
60
72
|
const key = await getEncryptionKey();
|
|
61
73
|
try {
|
|
62
74
|
return await openStore(log, name, poolDirectory, key);
|
|
@@ -66,6 +78,16 @@ async function openOneStore(storeName, { name, poolDirectory }, getEncryptionKey
|
|
|
66
78
|
cause: err
|
|
67
79
|
});
|
|
68
80
|
}
|
|
81
|
+
if (err instanceof SqliteCorruptionError) {
|
|
82
|
+
// A corrupt image is unrecoverable — no key or retry against the same bytes brings it back. Self-heal
|
|
83
|
+
// instead of dead-ending forever: wipe the store's OPFS directory (safe — the failed open left no SAH-pool
|
|
84
|
+
// lock behind) and reopen a fresh, empty one, so callers see a normal first-run rather than a permanent
|
|
85
|
+
// "database disk image is malformed" on every open.
|
|
86
|
+
log.warn(`Embedded wallet '${storeName}' store is corrupt (${err.message}); wiping and reopening fresh`);
|
|
87
|
+
await wipeStore(poolDirectory);
|
|
88
|
+
// open() transferred (detached) the previous key buffer, so fetch a fresh one for the reopen.
|
|
89
|
+
return await openStore(log, name, poolDirectory, await getEncryptionKey());
|
|
90
|
+
}
|
|
69
91
|
throw err;
|
|
70
92
|
}
|
|
71
93
|
}
|
|
@@ -3,8 +3,10 @@ import { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import type { LogFn } from '@aztec/foundation/log';
|
|
4
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
export declare const AccountTypes: readonly ["schnorr", "ecdsasecp256r1", "ecdsasecp256k1"];
|
|
6
|
+
export declare const AccountTypes: readonly ["schnorr", "schnorr_initializerless", "ecdsasecp256r1", "ecdsasecp256k1"];
|
|
7
7
|
export type AccountType = (typeof AccountTypes)[number];
|
|
8
|
+
/** Bump when the WalletDB layout changes; a new version selects a fresh store, leaving the old one intact. */
|
|
9
|
+
export declare const WALLET_DATA_SCHEMA_VERSION = 1;
|
|
8
10
|
export declare class WalletDB {
|
|
9
11
|
#private;
|
|
10
12
|
private store;
|
|
@@ -24,7 +26,7 @@ export declare class WalletDB {
|
|
|
24
26
|
address: string | AztecAddress;
|
|
25
27
|
secretKey: Fr;
|
|
26
28
|
salt: Fr;
|
|
27
|
-
type: "ecdsasecp256k1" | "ecdsasecp256r1" | "schnorr";
|
|
29
|
+
type: "ecdsasecp256k1" | "ecdsasecp256r1" | "schnorr" | "schnorr_initializerless";
|
|
28
30
|
signingKey: Buffer<ArrayBufferLike>;
|
|
29
31
|
}>;
|
|
30
32
|
listAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
@@ -32,4 +34,4 @@ export declare class WalletDB {
|
|
|
32
34
|
deleteAccount(address: AztecAddress): Promise<void>;
|
|
33
35
|
close(): Promise<void>;
|
|
34
36
|
}
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2FsbGV0X2RiLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZW1iZWRkZWQvd2FsbGV0X2RiLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLE9BQU8sRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3RELE9BQU8sRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDeEQsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDbkQsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQWlCLE1BQU0saUJBQWlCLENBQUM7QUFDeEUsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRTNELGVBQU8sTUFBTSxZQUFZLHFGQUFzRixDQUFDO0FBQ2hILE1BQU0sTUFBTSxXQUFXLEdBQUcsQ0FBQyxPQUFPLFlBQVksQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBTXhELDhHQUE4RztBQUM5RyxlQUFPLE1BQU0sMEJBQTBCLElBQUksQ0FBQztBQUU1QyxxQkFBYSxRQUFROztJQUtqQixPQUFPLENBQUMsS0FBSztJQUNiLE9BQU8sQ0FBQyxPQUFPO0lBTGpCLE9BQU8sQ0FBQyxRQUFRLENBQWdDO0lBQ2hELE9BQU8sQ0FBQyxPQUFPLENBQWdDO0lBRS9DLFlBQ1UsS0FBSyxFQUFFLGlCQUFpQixFQUN4QixPQUFPLEVBQUUsS0FBSyxFQUl2QjtJQUVLLFlBQVksQ0FDaEIsT0FBTyxFQUFFLFlB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BAGhF;IAEK,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM;;;;;;OAcnD;IAEK,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAWrD;IAEK,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CASpD;IAoBK,aAAa,CAAC,OAAO,EAAE,YAAY,iBAaxC;IAEK,KAAK,kBAEV;CACF"}
|
|
@@ -2,12 +2,14 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
3
|
export const AccountTypes = [
|
|
4
4
|
'schnorr',
|
|
5
|
+
'schnorr_initializerless',
|
|
5
6
|
'ecdsasecp256r1',
|
|
6
7
|
'ecdsasecp256k1'
|
|
7
8
|
];
|
|
8
9
|
function accountKey(field, address) {
|
|
9
10
|
return `${field}:${address.toString()}`;
|
|
10
11
|
}
|
|
12
|
+
/** Bump when the WalletDB layout changes; a new version selects a fresh store, leaving the old one intact. */ export const WALLET_DATA_SCHEMA_VERSION = 1;
|
|
11
13
|
export class WalletDB {
|
|
12
14
|
store;
|
|
13
15
|
userLog;
|
|
@@ -62,7 +64,7 @@ export class WalletDB {
|
|
|
62
64
|
]);
|
|
63
65
|
return accountAddresses.map((addressStr)=>({
|
|
64
66
|
alias: aliasesByAddress.get(addressStr) ?? '',
|
|
65
|
-
item: AztecAddress.
|
|
67
|
+
item: AztecAddress.fromStringUnsafe(addressStr)
|
|
66
68
|
}));
|
|
67
69
|
}
|
|
68
70
|
async listSenders() {
|
|
@@ -73,7 +75,7 @@ export class WalletDB {
|
|
|
73
75
|
})){
|
|
74
76
|
result.push({
|
|
75
77
|
alias: alias.slice('senders:'.length),
|
|
76
|
-
item: AztecAddress.
|
|
78
|
+
item: AztecAddress.fromStringUnsafe(item.toString())
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
return result;
|
package/dest/testing.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
|
-
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
3
2
|
import type { AccountManager } from '@aztec/aztec.js/wallet';
|
|
4
3
|
import type { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
5
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
5
|
interface WalletWithSchnorrAccounts {
|
|
7
|
-
|
|
6
|
+
createSchnorrInitializerlessAccount(secret: Fr, salt: Fr, signingKey: Fq, alias?: string): Promise<AccountManager>;
|
|
8
7
|
}
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Creates the given (genesis-funded) test accounts as initializerless schnorr accounts. Initializerless
|
|
10
|
+
* accounts need no deployment tx — creating one registers the instance and materializes its immutable keys
|
|
11
|
+
* locally — so the accounts are usable as soon as they are created, funded via genesis at their addresses.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createFundedInitializerlessAccounts(wallet: WalletWithSchnorrAccounts, accountsData: InitialAccountData[]): Promise<AccountManager[]>;
|
|
10
14
|
export declare function registerInitialLocalNetworkAccountsInWallet(wallet: WalletWithSchnorrAccounts): Promise<AztecAddress[]>;
|
|
11
15
|
export {};
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3Rlc3RpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUVsRSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUM3RCxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDN0QsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRTNELFVBQVUseUJBQXlCO0lBQ2pDLG1DQUFtQyxDQUFDLE1BQU0sRUFBRSxFQUFFLEVBQUUsSUFBSSxFQUFFLEVBQUUsRUFBRSxVQUFVLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxFQUFFLE1BQU0sR0FBRyxPQUFPLENBQUMsY0FBYyxDQUFDLENBQUM7Q0FDcEg7QUFFRDs7OztHQUlHO0FBQ0gsd0JBQXNCLG1DQUFtQyxDQUN2RCxNQUFNLEVBQUUseUJBQXlCLEVBQ2pDLFlBQVksRUFBRSxrQkFBa0IsRUFBRSw2QkFPbkM7QUFFRCx3QkFBc0IsMkNBQTJDLENBQy9ELE1BQU0sRUFBRSx5QkFBeUIsR0FDaEMsT0FBTyxDQUFDLFlBQVksRUFBRSxDQUFDLENBUXpCIn0=
|
package/dest/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,UAAU,yBAAyB;IACjC,mCAAmC,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACpH;AAED;;;;GAIG;AACH,wBAAsB,mCAAmC,CACvD,MAAM,EAAE,yBAAyB,EACjC,YAAY,EAAE,kBAAkB,EAAE,6BAOnC;AAED,wBAAsB,2CAA2C,CAC/D,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,YAAY,EAAE,CAAC,CAQzB"}
|
package/dest/testing.js
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing/lazy';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Creates the given (genesis-funded) test accounts as initializerless schnorr accounts. Initializerless
|
|
4
|
+
* accounts need no deployment tx — creating one registers the instance and materializes its immutable keys
|
|
5
|
+
* locally — so the accounts are usable as soon as they are created, funded via genesis at their addresses.
|
|
6
|
+
*/ export async function createFundedInitializerlessAccounts(wallet, accountsData) {
|
|
4
7
|
const accountManagers = [];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { secret, salt, signingKey } = accountsData[i];
|
|
8
|
-
const accountManager = await wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
9
|
-
const deployMethod = await accountManager.getDeployMethod();
|
|
10
|
-
await deployMethod.send({
|
|
11
|
-
from: NO_FROM,
|
|
12
|
-
skipClassPublication: i !== 0,
|
|
13
|
-
wait: waitOptions
|
|
14
|
-
});
|
|
15
|
-
accountManagers.push(accountManager);
|
|
8
|
+
for (const { secret, salt, signingKey } of accountsData){
|
|
9
|
+
accountManagers.push(await wallet.createSchnorrInitializerlessAccount(secret, salt, signingKey));
|
|
16
10
|
}
|
|
17
11
|
return accountManagers;
|
|
18
12
|
}
|
|
19
13
|
export async function registerInitialLocalNetworkAccountsInWallet(wallet) {
|
|
20
14
|
const testAccounts = await getInitialTestAccountsData();
|
|
21
15
|
return Promise.all(testAccounts.map(async (account)=>{
|
|
22
|
-
return (await wallet.
|
|
16
|
+
return (await wallet.createSchnorrInitializerlessAccount(account.secret, account.salt, account.signingKey)).address;
|
|
23
17
|
}));
|
|
24
18
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/wallets",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/wallets",
|
|
4
|
-
"version": "0.0.1-commit.
|
|
4
|
+
"version": "0.0.1-commit.9a89641",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./embedded": {
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
32
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
33
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
34
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
35
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
36
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
37
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
38
|
-
"@aztec/standard-contracts": "0.0.1-commit.
|
|
39
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
40
|
-
"@aztec/wallet-sdk": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.9a89641",
|
|
32
|
+
"@aztec/aztec.js": "0.0.1-commit.9a89641",
|
|
33
|
+
"@aztec/entrypoints": "0.0.1-commit.9a89641",
|
|
34
|
+
"@aztec/foundation": "0.0.1-commit.9a89641",
|
|
35
|
+
"@aztec/kv-store": "0.0.1-commit.9a89641",
|
|
36
|
+
"@aztec/protocol-contracts": "0.0.1-commit.9a89641",
|
|
37
|
+
"@aztec/pxe": "0.0.1-commit.9a89641",
|
|
38
|
+
"@aztec/standard-contracts": "0.0.1-commit.9a89641",
|
|
39
|
+
"@aztec/stdlib": "0.0.1-commit.9a89641",
|
|
40
|
+
"@aztec/wallet-sdk": "0.0.1-commit.9a89641"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@jest/globals": "^30.0.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/stub
|
|
2
|
+
import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/ecdsa/stub';
|
|
3
|
+
import { SchnorrAccountContract, SchnorrInitializerlessAccountContract } from '@aztec/accounts/schnorr';
|
|
4
|
+
import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/schnorr/stub';
|
|
5
5
|
import type { Account, AccountContract } from '@aztec/aztec.js/account';
|
|
6
6
|
import type { Fq } from '@aztec/foundation/curves/bn254';
|
|
7
7
|
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
@@ -19,6 +19,10 @@ export class BundleAccountContractsProvider implements AccountContractsProvider
|
|
|
19
19
|
return Promise.resolve(new SchnorrAccountContract(signingKey));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
getSchnorrInitializerlessAccountContract(signingKey: Fq): Promise<AccountContract> {
|
|
23
|
+
return Promise.resolve(new SchnorrInitializerlessAccountContract(signingKey));
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
getEcdsaRAccountContract(signingKey: Buffer): Promise<AccountContract> {
|
|
23
27
|
return Promise.resolve(new EcdsaRAccountContract(signingKey));
|
|
24
28
|
}
|
|
@@ -28,10 +32,12 @@ export class BundleAccountContractsProvider implements AccountContractsProvider
|
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
getStubAccountContractArtifact(type: AccountType): Promise<ContractArtifact> {
|
|
31
|
-
|
|
35
|
+
const isSchnorr = type === 'schnorr' || type === 'schnorr_initializerless';
|
|
36
|
+
return Promise.resolve(isSchnorr ? StubSchnorrAccountContractArtifact : StubEcdsaAccountContractArtifact);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
createStubAccount(address: CompleteAddress, type: AccountType): Promise<Account> {
|
|
35
|
-
|
|
40
|
+
const isSchnorr = type === 'schnorr' || type === 'schnorr_initializerless';
|
|
41
|
+
return Promise.resolve(isSchnorr ? createStubSchnorrAccount(address) : createStubEcdsaAccount(address));
|
|
36
42
|
}
|
|
37
43
|
}
|
|
@@ -16,6 +16,11 @@ export class LazyAccountContractsProvider implements AccountContractsProvider {
|
|
|
16
16
|
return new SchnorrAccountContract(signingKey);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
async getSchnorrInitializerlessAccountContract(signingKey: Fq): Promise<AccountContract> {
|
|
20
|
+
const { SchnorrInitializerlessAccountContract } = await import('@aztec/accounts/schnorr/lazy');
|
|
21
|
+
return new SchnorrInitializerlessAccountContract(signingKey);
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
async getEcdsaRAccountContract(signingKey: Buffer): Promise<AccountContract> {
|
|
20
25
|
const { EcdsaRAccountContract } = await import('@aztec/accounts/ecdsa/lazy');
|
|
21
26
|
return new EcdsaRAccountContract(signingKey);
|
|
@@ -27,21 +32,21 @@ export class LazyAccountContractsProvider implements AccountContractsProvider {
|
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
async getStubAccountContractArtifact(type: AccountType): Promise<ContractArtifact> {
|
|
30
|
-
if (type === 'schnorr') {
|
|
31
|
-
const { getStubSchnorrAccountContractArtifact } = await import('@aztec/accounts/stub/
|
|
35
|
+
if (type === 'schnorr' || type === 'schnorr_initializerless') {
|
|
36
|
+
const { getStubSchnorrAccountContractArtifact } = await import('@aztec/accounts/schnorr/stub/lazy');
|
|
32
37
|
return getStubSchnorrAccountContractArtifact();
|
|
33
38
|
} else {
|
|
34
|
-
const { getStubEcdsaAccountContractArtifact } = await import('@aztec/accounts/stub/
|
|
39
|
+
const { getStubEcdsaAccountContractArtifact } = await import('@aztec/accounts/ecdsa/stub/lazy');
|
|
35
40
|
return getStubEcdsaAccountContractArtifact();
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
async createStubAccount(address: CompleteAddress, type: AccountType): Promise<Account> {
|
|
40
|
-
if (type === 'schnorr') {
|
|
41
|
-
const { createStubSchnorrAccount } = await import('@aztec/accounts/stub/
|
|
45
|
+
if (type === 'schnorr' || type === 'schnorr_initializerless') {
|
|
46
|
+
const { createStubSchnorrAccount } = await import('@aztec/accounts/schnorr/stub/lazy');
|
|
42
47
|
return createStubSchnorrAccount(address);
|
|
43
48
|
} else {
|
|
44
|
-
const { createStubEcdsaAccount } = await import('@aztec/accounts/stub/
|
|
49
|
+
const { createStubEcdsaAccount } = await import('@aztec/accounts/ecdsa/stub/lazy');
|
|
45
50
|
return createStubEcdsaAccount(address);
|
|
46
51
|
}
|
|
47
52
|
}
|
|
@@ -13,6 +13,7 @@ import type { AccountType } from '../wallet_db.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface AccountContractsProvider {
|
|
15
15
|
getSchnorrAccountContract(signingKey: Fq): Promise<AccountContract>;
|
|
16
|
+
getSchnorrInitializerlessAccountContract(signingKey: Fq): Promise<AccountContract>;
|
|
16
17
|
getEcdsaRAccountContract(signingKey: Buffer): Promise<AccountContract>;
|
|
17
18
|
getEcdsaKAccountContract(signingKey: Buffer): Promise<AccountContract>;
|
|
18
19
|
getStubAccountContractArtifact(type: AccountType): Promise<ContractArtifact>;
|