Skip to content

Commit

Permalink
add --xdai flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Stéphane Duchesneau committed Apr 12, 2021
1 parent afbb589 commit b515706
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ project adheres to
[MAINTAINERS.md](./MAINTAINERS.md) for instructions to keep up to
date.

# v0.0.7

Added --xdai endpoint

# v0.0.6

Added --fantom endpoint
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ $ sf --heco "true" 100000 100002
# Look at recent blocks and stream forever on Fantom Opera Mainnet
$ sf --fantom "true" -5

# Look at recent blocks and stream forever on xDai Mainnet
# Look at recent blocks and stream forever on xDai Chain
$ sf --xdai "true" -5
```

Expand Down
8 changes: 7 additions & 1 deletion cmd/sf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var flagBSC = flag.Bool("bsc", false, "When set, will force the endpoint to Bina
var flagPolygon = flag.Bool("polygon", false, "When set, will force the endpoint to Polygon (previously Matic)")
var flagHECO = flag.Bool("heco", false, "When set, will force the endpoint to Huobi Eco Chain")
var flagFantom = flag.Bool("fantom", false, "When set, will force the endpoint to Fantom Opera Mainnet")
var flagXDAI = flag.Bool("xdai", false, "When set, will force the endpoint to xDai Chain")

var flagHandleForks = flag.Bool("handle-forks", false, "Request notifications type STEP_UNDO when a block was forked out, and STEP_IRREVERSIBLE after a block has seen enough confirmations (200)")
var flagSkipVerify = flag.Bool("s", false, "When set, skips certification verification")
Expand All @@ -52,7 +53,7 @@ func main() {

args := flag.Args()
ensure((len(args) == 1 && *flagStartCursor != "") || len(args) > 1, errorUsage("Expecting between 1 and 3 arguments"))
ensure(noMoreThanOneTrue(*flagBSC, *flagPolygon, *flagHECO, *flagFantom), errorUsage("Cannot set more than one network flag (ex: --polygon, --bsc)"))
ensure(noMoreThanOneTrue(*flagBSC, *flagPolygon, *flagHECO, *flagFantom, *flagXDAI), errorUsage("Cannot set more than one network flag (ex: --polygon, --bsc)"))

filter := args[0]
cursor := *flagStartCursor
Expand All @@ -79,6 +80,8 @@ func main() {
endpoint = "heco.streamingfast.io:443"
case *flagFantom:
endpoint = "fantom.streamingfast.io:443"
case *flagXDAI:
endpoint = "xdai.streamingfast.io:443"
default:
if e := os.Getenv("STREAMINGFAST_ENDPOINT"); e != "" {
endpoint = e
Expand Down Expand Up @@ -331,6 +334,9 @@ Examples:
# Look at recent blocks and stream forever on Fantom Opera Mainnet
$ sf --fantom "true" -5
# Look at recent blocks and stream forever on xDai Chain
$ sf --xdai "true" -5
`
}

Expand Down

0 comments on commit b515706

Please sign in to comment.