@@ -4,19 +4,12 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
4
4
import { AccountWalletWithSecretKey } from '@aztec/aztec.js/wallet' ;
5
5
import { Contract } from '@aztec/aztec.js/contracts' ;
6
6
import { type PXE } from '@aztec/aztec.js/interfaces/pxe' ;
7
- import { PXEService } from '@aztec/pxe/service' ;
8
- import { type PXEServiceConfig , getPXEServiceConfig } from '@aztec/pxe/config' ;
9
- import { KVPxeDatabase } from '@aztec/pxe/database' ;
10
- import { KeyStore } from '@aztec/key-store' ;
11
- import { L2TipsStore } from '@aztec/kv-store/stores' ;
7
+ import { createPXEService , type PXEServiceConfig , getPXEServiceConfig } from '@aztec/pxe/client/lazy' ;
12
8
import { createStore } from '@aztec/kv-store/indexeddb' ;
13
- import { BBWASMLazyPrivateKernelProver } from '@aztec/bb-prover/wasm/lazy' ;
14
- import { WASMSimulator } from '@aztec/simulator/client' ;
15
9
import { createContext } from 'react' ;
16
10
import { NetworkDB , WalletDB } from './utils/storage' ;
17
11
import { type ContractFunctionInteractionTx } from './utils/txs' ;
18
12
import { type Logger , createLogger } from '@aztec/aztec.js/log' ;
19
- import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy' ;
20
13
21
14
const logLevel = [ 'silent' , 'fatal' , 'error' , 'warn' , 'info' , 'verbose' , 'debug' , 'trace' ] as const ;
22
15
@@ -151,44 +144,19 @@ export class AztecEnv {
151
144
const config = getPXEServiceConfig ( ) ;
152
145
config . dataDirectory = 'pxe' ;
153
146
config . proverEnabled = true ;
154
-
155
- const simulationProvider = new WASMSimulator ( ) ;
156
- const proofCreator = new BBWASMLazyPrivateKernelProver (
157
- simulationProvider ,
158
- 16 ,
159
- WebLogger . getInstance ( ) . createLogger ( 'bb:wasm:lazy' ) ,
160
- ) ;
161
147
const l1Contracts = await aztecNode . getL1ContractAddresses ( ) ;
162
148
const configWithContracts = {
163
149
...config ,
164
150
l1Contracts,
165
151
} as PXEServiceConfig ;
166
152
167
- const store = await createStore (
168
- 'pxe_data' ,
169
- configWithContracts ,
170
- WebLogger . getInstance ( ) . createLogger ( 'pxe:data:indexeddb' ) ,
171
- ) ;
172
-
173
- const keyStore = new KeyStore ( store ) ;
174
-
175
- const db = await KVPxeDatabase . create ( store ) ;
176
- const tips = new L2TipsStore ( store , 'pxe' ) ;
177
-
178
- const protocolContractsProvider = new LazyProtocolContractsProvider ( ) ;
179
-
180
- const pxe = new PXEService (
181
- keyStore ,
182
- aztecNode ,
183
- db ,
184
- tips ,
185
- proofCreator ,
186
- simulationProvider ,
187
- protocolContractsProvider ,
188
- config ,
189
- WebLogger . getInstance ( ) . createLogger ( 'pxe:service' ) ,
190
- ) ;
191
- await pxe . init ( ) ;
153
+ const pxe = await createPXEService ( aztecNode , configWithContracts , {
154
+ loggers : {
155
+ store : WebLogger . getInstance ( ) . createLogger ( 'pxe:data:indexeddb' ) ,
156
+ pxe : WebLogger . getInstance ( ) . createLogger ( 'pxe:service' ) ,
157
+ prover : WebLogger . getInstance ( ) . createLogger ( 'bb:wasm:lazy' ) ,
158
+ }
159
+ } ) ;
192
160
return pxe ;
193
161
}
194
162
}
0 commit comments