@tokamak-zk-evm/synthesizer
Version:
Tokamak zk-EVM Synthesizer - Processes Ethereum transactions into wire maps for Tokamak zk-SNARK proof generation
37 lines (27 loc) • 889 B
text/typescript
import { Common, Mainnet } from '@synthesizer-libs/common'
import { SimpleStateManager } from '@synthesizer-libs/statemanager'
import { NobleBN254 } from './precompiles/index.js'
import { EVMMockBlockchain } from './types.js'
import { EVM } from './index.js'
import type { EVMOpts } from './index.js'
/**
* Use this async static constructor for the initialization
* of an EVM object
*
* @param createOpts The EVM options
* @returns A new EVM
*/
export async function createEVM(createOpts?: EVMOpts) {
const opts = createOpts ?? ({} as EVMOpts)
opts.bn254 = new NobleBN254()
if (opts.common === undefined) {
opts.common = new Common({ chain: Mainnet })
}
if (opts.blockchain === undefined) {
opts.blockchain = new EVMMockBlockchain()
}
if (opts.stateManager === undefined) {
opts.stateManager = new SimpleStateManager()
}
return new EVM(opts)
}