Skip to content

Commit

Permalink
Update testing RPC (#1784)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrodyHughes authored Dec 12, 2024
1 parent ede2fcd commit adb639b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"// Build and zip": "",
"bundle": "yarn build && yarn zip",
"// Runs tests": "",
"anvil": "ETH_MAINNET_RPC=$(grep ETH_MAINNET_RPC .env | cut -d '=' -f2) && anvil --fork-url $ETH_MAINNET_RPC",
"anvil:optimism": "OPTIMISM_MAINNET_RPC=$(grep OPTIMISM_MAINNET_RPC .env | cut -d '=' -f2) && anvil --fork-url $OPTIMISM_MAINNET_RPC",
"anvil": "anvil --fork-url $(./scripts/get-rpc-url.sh mainnet)",
"anvil:optimism": "anvil --fork-url $(./scripts/get-rpc-url.sh optimism)",
"anvil:kill": "lsof -i :8545|tail -n +2|awk '{print $2}'|xargs -r kill -s SIGINT",
"test": "./scripts/unit-tests.sh",
"test:watch": "yarn anvil & vitest --watch",
Expand Down
12 changes: 12 additions & 0 deletions scripts/get-rpc-url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
NETWORK=$1
KEY=$(grep ALCHEMY_DEV_KEY .env | cut -d '=' -f2)

case $NETWORK in
"optimism")
echo "https://opt-mainnet.g.alchemy.com/v2/$KEY"
;;
"mainnet")
echo "https://eth-mainnet.g.alchemy.com/v2/$KEY"
;;
esac

0 comments on commit adb639b

Please sign in to comment.