Skip to content

Commit

Permalink
adding chain id to env
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Sep 13, 2024
1 parent 4ec267a commit 89735b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ GRPC=jackal-testnet-grpc.polkachu.com:17590
ETH_RPC=ws://127.0.0.1:8545
SEED=
CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
JACKAL_CONTRACT=jkl1tjaqmxerltfqgxwp5p9sdwr9hncmdvevg9mllac2qjqfrjte6wkqwnq3h9
JACKAL_CONTRACT=jkl1tjaqmxerltfqgxwp5p9sdwr9hncmdvevg9mllac2qjqfrjte6wkqwnq3h9
CHAIN_ID=1
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"os"
"os/signal"
"strconv"
"syscall"
"time"

Expand Down Expand Up @@ -69,13 +70,13 @@ func main() {
continue
}

bigChainID, err := client.ChainID(context.Background())
chainIDs := os.Getenv("CHAIN_ID")
chainID, err := strconv.ParseInt(chainIDs, 10, 64)
if err != nil {
log.Printf("Failed to get the chainID, retrying in 5 seconds: %v", err)
log.Print("Failed to parse chainID, retrying in 5 seconds")
time.Sleep(5 * time.Second)
continue
}
chainID := bigChainID.Int64()

sub, logs, err = subscribeLogs(client, query)
if err != nil {
Expand Down

0 comments on commit 89735b0

Please sign in to comment.