@aztec/wallets 0.0.1-commit.967fc6998 → 0.0.1-commit.9badcec54
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 +4 -3
- package/dest/embedded/account-contract-providers/bundle.d.ts.map +1 -1
- package/dest/embedded/account-contract-providers/bundle.js +6 -5
- package/dest/embedded/account-contract-providers/lazy.d.ts +4 -3
- package/dest/embedded/account-contract-providers/lazy.d.ts.map +1 -1
- package/dest/embedded/account-contract-providers/lazy.js +16 -6
- package/dest/embedded/account-contract-providers/types.d.ts +4 -3
- package/dest/embedded/account-contract-providers/types.d.ts.map +1 -1
- package/dest/embedded/embedded_wallet.d.ts +46 -10
- package/dest/embedded/embedded_wallet.d.ts.map +1 -1
- package/dest/embedded/embedded_wallet.js +159 -62
- package/dest/embedded/entrypoints/browser.d.ts +2 -2
- package/dest/embedded/entrypoints/browser.d.ts.map +1 -1
- package/dest/embedded/entrypoints/browser.js +17 -7
- package/dest/embedded/entrypoints/node.d.ts +2 -2
- package/dest/embedded/entrypoints/node.d.ts.map +1 -1
- package/dest/embedded/entrypoints/node.js +17 -7
- package/dest/testing.d.ts +1 -1
- package/dest/testing.d.ts.map +1 -1
- package/dest/testing.js +2 -2
- package/package.json +11 -10
- package/src/embedded/account-contract-providers/bundle.ts +7 -5
- package/src/embedded/account-contract-providers/lazy.ts +17 -6
- package/src/embedded/account-contract-providers/types.ts +4 -2
- package/src/embedded/embedded_wallet.ts +207 -70
- package/src/embedded/entrypoints/browser.ts +25 -18
- package/src/embedded/entrypoints/node.ts +31 -24
- package/src/testing.ts +2 -1
|
@@ -6,7 +6,7 @@ import { type PXEConfig, getPXEConfig } from '@aztec/pxe/config';
|
|
|
6
6
|
|
|
7
7
|
import { LazyAccountContractsProvider } from '../account-contract-providers/lazy.js';
|
|
8
8
|
import type { AccountContractsProvider } from '../account-contract-providers/types.js';
|
|
9
|
-
import { EmbeddedWallet, type EmbeddedWalletOptions } from '../embedded_wallet.js';
|
|
9
|
+
import { EmbeddedWallet, type EmbeddedWalletOptions, splitPxeOptions } from '../embedded_wallet.js';
|
|
10
10
|
import { WalletDB } from '../wallet_db.js';
|
|
11
11
|
|
|
12
12
|
export class BrowserEmbeddedWallet extends EmbeddedWallet {
|
|
@@ -26,10 +26,15 @@ export class BrowserEmbeddedWallet extends EmbeddedWallet {
|
|
|
26
26
|
const aztecNode = typeof nodeOrUrl === 'string' ? createAztecNodeClient(nodeOrUrl) : nodeOrUrl;
|
|
27
27
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
28
28
|
|
|
29
|
+
// Support both the new unified `pxe` option and the deprecated `pxeConfig`/`pxeOptions`.
|
|
30
|
+
const { config: pxeConfigFromPxe, creation: pxeCreationFromPxe } = splitPxeOptions(options.pxe);
|
|
31
|
+
const mergedConfigOverrides = { ...options.pxeConfig, ...pxeConfigFromPxe };
|
|
32
|
+
const mergedCreationOverrides: PXECreationOptions = { ...options.pxeOptions, ...pxeCreationFromPxe };
|
|
33
|
+
|
|
29
34
|
const pxeConfig: PXEConfig = Object.assign(getPXEConfig(), {
|
|
30
|
-
proverEnabled:
|
|
35
|
+
proverEnabled: mergedConfigOverrides.proverEnabled ?? false,
|
|
31
36
|
dataDirectory: `pxe_data_${l1Contracts.rollupAddress}`,
|
|
32
|
-
...
|
|
37
|
+
...mergedConfigOverrides,
|
|
33
38
|
});
|
|
34
39
|
|
|
35
40
|
if (options.ephemeral) {
|
|
@@ -37,29 +42,31 @@ export class BrowserEmbeddedWallet extends EmbeddedWallet {
|
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
const pxeOptions: PXECreationOptions = {
|
|
40
|
-
...
|
|
45
|
+
...mergedCreationOverrides,
|
|
41
46
|
loggers: {
|
|
42
47
|
store: rootLogger.createChild('pxe:data'),
|
|
43
48
|
pxe: rootLogger.createChild('pxe:service'),
|
|
44
49
|
prover: rootLogger.createChild('pxe:prover'),
|
|
45
|
-
...
|
|
50
|
+
...mergedCreationOverrides.loggers,
|
|
46
51
|
},
|
|
47
52
|
};
|
|
48
53
|
|
|
49
54
|
const pxe = await createPXE(aztecNode, pxeConfig, pxeOptions);
|
|
50
55
|
|
|
51
|
-
const walletDBStore =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
const walletDBStore =
|
|
57
|
+
options.walletDb?.store ??
|
|
58
|
+
(options.ephemeral
|
|
59
|
+
? await openTmpStore(true)
|
|
60
|
+
: await createStore(
|
|
61
|
+
'wallet_data',
|
|
62
|
+
{
|
|
63
|
+
dataDirectory: `wallet_data_${l1Contracts.rollupAddress}`,
|
|
64
|
+
dataStoreMapSizeKb: pxeConfig.dataStoreMapSizeKb,
|
|
65
|
+
l1Contracts,
|
|
66
|
+
},
|
|
67
|
+
1,
|
|
68
|
+
rootLogger.createChild('wallet:data'),
|
|
69
|
+
));
|
|
63
70
|
const walletDB = WalletDB.init(walletDBStore, rootLogger.createChild('wallet:db').info);
|
|
64
71
|
|
|
65
72
|
return new this(pxe, aztecNode, walletDB, new LazyAccountContractsProvider(), rootLogger) as T;
|
|
@@ -67,6 +74,6 @@ export class BrowserEmbeddedWallet extends EmbeddedWallet {
|
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
export { BrowserEmbeddedWallet as EmbeddedWallet };
|
|
70
|
-
export type { EmbeddedWalletOptions } from '../embedded_wallet.js';
|
|
77
|
+
export type { EmbeddedWalletOptions, EmbeddedWalletPXEOptions } from '../embedded_wallet.js';
|
|
71
78
|
export { WalletDB } from '../wallet_db.js';
|
|
72
79
|
export type { AccountType } from '../wallet_db.js';
|
|
@@ -7,7 +7,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
|
7
7
|
|
|
8
8
|
import { BundleAccountContractsProvider } from '../account-contract-providers/bundle.js';
|
|
9
9
|
import type { AccountContractsProvider } from '../account-contract-providers/types.js';
|
|
10
|
-
import { EmbeddedWallet, type EmbeddedWalletOptions } from '../embedded_wallet.js';
|
|
10
|
+
import { EmbeddedWallet, type EmbeddedWalletOptions, splitPxeOptions } from '../embedded_wallet.js';
|
|
11
11
|
import { WalletDB } from '../wallet_db.js';
|
|
12
12
|
|
|
13
13
|
export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
@@ -27,10 +27,15 @@ export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
|
27
27
|
const aztecNode = typeof nodeOrUrl === 'string' ? createAztecNodeClient(nodeOrUrl) : nodeOrUrl;
|
|
28
28
|
const l1Contracts = await aztecNode.getL1ContractAddresses();
|
|
29
29
|
|
|
30
|
+
// Support both the new unified `pxe` option and the deprecated `pxeConfig`/`pxeOptions`.
|
|
31
|
+
const { config: pxeConfigFromPxe, creation: pxeCreationFromPxe } = splitPxeOptions(options.pxe);
|
|
32
|
+
const mergedConfigOverrides = { ...options.pxeConfig, ...pxeConfigFromPxe };
|
|
33
|
+
const mergedCreationOverrides: PXECreationOptions = { ...options.pxeOptions, ...pxeCreationFromPxe };
|
|
34
|
+
|
|
30
35
|
const pxeConfig: PXEConfig = Object.assign(getPXEConfig(), {
|
|
31
|
-
proverEnabled:
|
|
36
|
+
proverEnabled: mergedConfigOverrides.proverEnabled ?? false,
|
|
32
37
|
dataDirectory: `pxe_data_${l1Contracts.rollupAddress}`,
|
|
33
|
-
...
|
|
38
|
+
...mergedConfigOverrides,
|
|
34
39
|
});
|
|
35
40
|
|
|
36
41
|
if (options.ephemeral) {
|
|
@@ -38,35 +43,37 @@ export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
const pxeOptions: PXECreationOptions = {
|
|
41
|
-
...
|
|
46
|
+
...mergedCreationOverrides,
|
|
42
47
|
loggers: {
|
|
43
48
|
store: rootLogger.createChild('pxe:data'),
|
|
44
49
|
pxe: rootLogger.createChild('pxe:service'),
|
|
45
50
|
prover: rootLogger.createChild('pxe:prover'),
|
|
46
|
-
...
|
|
51
|
+
...mergedCreationOverrides.loggers,
|
|
47
52
|
},
|
|
48
53
|
};
|
|
49
54
|
|
|
50
55
|
const pxe = await createPXE(aztecNode, pxeConfig, pxeOptions);
|
|
51
56
|
|
|
52
|
-
const walletDBStore =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
const walletDBStore =
|
|
58
|
+
options.walletDb?.store ??
|
|
59
|
+
(options.ephemeral
|
|
60
|
+
? await openTmpStore(
|
|
61
|
+
`wallet_data_${l1Contracts.rollupAddress}`,
|
|
62
|
+
true,
|
|
63
|
+
undefined,
|
|
64
|
+
undefined,
|
|
65
|
+
rootLogger.createChild('wallet:data').getBindings(),
|
|
66
|
+
)
|
|
67
|
+
: await createStore(
|
|
68
|
+
'wallet_data',
|
|
69
|
+
1,
|
|
70
|
+
{
|
|
71
|
+
dataDirectory: `wallet_data_${l1Contracts.rollupAddress}`,
|
|
72
|
+
dataStoreMapSizeKb: pxeConfig.dataStoreMapSizeKb,
|
|
73
|
+
l1Contracts,
|
|
74
|
+
},
|
|
75
|
+
rootLogger.createChild('wallet:data').getBindings(),
|
|
76
|
+
));
|
|
70
77
|
const walletDB = WalletDB.init(walletDBStore, rootLogger.createChild('wallet:db').info);
|
|
71
78
|
|
|
72
79
|
return new this(pxe, aztecNode, walletDB, new BundleAccountContractsProvider(), rootLogger) as T;
|
|
@@ -74,6 +81,6 @@ export class NodeEmbeddedWallet extends EmbeddedWallet {
|
|
|
74
81
|
}
|
|
75
82
|
|
|
76
83
|
export { NodeEmbeddedWallet as EmbeddedWallet };
|
|
77
|
-
export type { EmbeddedWalletOptions } from '../embedded_wallet.js';
|
|
84
|
+
export type { EmbeddedWalletOptions, EmbeddedWalletPXEOptions } from '../embedded_wallet.js';
|
|
78
85
|
export { WalletDB } from '../wallet_db.js';
|
|
79
86
|
export type { AccountType } from '../wallet_db.js';
|
package/src/testing.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
2
2
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing/lazy';
|
|
3
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
3
4
|
import type { WaitOpts } from '@aztec/aztec.js/contracts';
|
|
4
5
|
import type { AccountManager } from '@aztec/aztec.js/wallet';
|
|
5
6
|
import type { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -21,7 +22,7 @@ export async function deployFundedSchnorrAccounts(
|
|
|
21
22
|
const accountManager = await wallet.createSchnorrAccount(secret, salt, signingKey);
|
|
22
23
|
const deployMethod = await accountManager.getDeployMethod();
|
|
23
24
|
await deployMethod.send({
|
|
24
|
-
from:
|
|
25
|
+
from: NO_FROM,
|
|
25
26
|
skipClassPublication: i !== 0,
|
|
26
27
|
wait: waitOptions,
|
|
27
28
|
});
|