diff --git a/.env.example b/.env.example index bb98bb1..027956a 100644 --- a/.env.example +++ b/.env.example @@ -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 \ No newline at end of file +JACKAL_CONTRACT=jkl1tjaqmxerltfqgxwp5p9sdwr9hncmdvevg9mllac2qjqfrjte6wkqwnq3h9 +CHAIN_ID=1 \ No newline at end of file diff --git a/main.go b/main.go index 07c9200..83d38f2 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "log" "os" "os/signal" + "strconv" "syscall" "time" @@ -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 {