Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ jobs:
- name: build seismic-viem
run: bun viem:build
- name: Test devnet
run: bun viem:test:devnet
run: bun viem:test:reth
- name: Remove reth files
run: rm -rf "$RETH_DATA_DIR" && rm -rf "$RETH_STATIC_FILES"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"viem:build": "bun run --cwd packages/seismic-viem build",
"viem:publish": "npm publish -w packages/seismic-viem",
"viem:test:anvil": "bun run --cwd tests/seismic-viem test:anvil",
"viem:test:devnet": "bun run --cwd tests/seismic-viem test:devnet",
"viem:test:reth": "bun run --cwd tests/seismic-viem test:reth",
"react:typecheck": "bun run viem:build && bun run --cwd packages/seismic-react typecheck",
"react:build": "bun run --cwd packages/seismic-react build",
"react:publish": "npm publish -w packages/seismic-react",
Expand Down
2 changes: 1 addition & 1 deletion packages/seismic-viem-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seismic-viem-tests",
"version": "0.1.3",
"version": "0.1.4",
"type": "module",
"module": "./dist/_esm/index.js",
"types": "./dist/_types/index.d.ts",
Expand Down
35 changes: 22 additions & 13 deletions packages/seismic-viem-tests/src/process/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,27 @@ export type SpawnedNode = {

enum ChainName {
Anvil = 'anvil',
Devnet = 'devnet',
Reth = 'reth',
}

const CHAIN_VALUES = Object.values(ChainName).sort()
const CHAIN_OPTIONS = `{${CHAIN_VALUES.join('|')}}`

const nameToChain = (name: ChainName): Chain => {
switch (name) {
case ChainName.Anvil:
return sanvil as Chain
case ChainName.Devnet:
case ChainName.Reth:
return localSeismicDevnet as Chain
default:
throw new Error(`Unable to map ${name} to Chain`)
throw new Error(`CHAIN should be one of ${CHAIN_OPTIONS}`)
}
}

export const envChain = (): Chain => {
const chainName = process.env.CHAIN as ChainName
if (!Object.values(ChainName).includes(chainName)) {
throw new Error(`CHAIN env variable must be either "anvil" or "reth"`)
if (!CHAIN_VALUES.includes(chainName)) {
throw new Error(`CHAIN should be one of ${CHAIN_OPTIONS}`)
}
return nameToChain(chainName)
}
Expand All @@ -61,23 +64,29 @@ export const setupNode = async (
case localSeismicDevnet.id:
return setupRethNode({ port, ...rest })
default:
throw new Error(`Unable to map Chain ${chain.id} to Backend`)
throw new Error(`CHAIN should be one of ${CHAIN_OPTIONS}`)
}
}

export const buildNode = async (chain: Chain) => {
switch (chain.id) {
case sanvil.id:
case sanvil.id: {
const sfoundryDir = process.env.SFOUNDRY_ROOT
if (sfoundryDir) {
return buildAnvil(sfoundryDir)
if (!sfoundryDir) {
throw new Error(
'SFOUNDRY_ROOT env variable must be set to build sanvil'
)
}
case localSeismicDevnet.id:
return buildAnvil(sfoundryDir)
}
case localSeismicDevnet.id: {
const srethDir = process.env.SRETH_ROOT
if (srethDir) {
return buildReth(srethDir)
if (!srethDir) {
throw new Error('SRETH_ROOT env variable must be set to build reth')
}
return buildReth(srethDir)
}
default:
throw new Error(`Unable to map Chain ${chain.id} to Backend`)
throw new Error(`CHAIN should be one of ${CHAIN_OPTIONS}`)
}
}
2 changes: 1 addition & 1 deletion tests/seismic-viem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"clean": "rimraf dist",
"typecheck": "tsc --noEmit",
"test:anvil": "CHAIN=anvil bun test",
"test:devnet": "CHAIN=devnet bun test"
"test:reth": "CHAIN=reth bun test"
},
"devDependencies": {
"dotenv": "^16.4.7",
Expand Down