-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ava-labs/cleanup-scripts
Cleanup ./scripts/run.sh
- Loading branch information
Showing
6 changed files
with
206 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module github.com/ava-labs/subnet-evm/scripts/parser | ||
|
||
go 1.17 | ||
|
||
require ( | ||
github.com/fatih/color v1.13.0 | ||
gopkg.in/yaml.v2 v2.4.0 | ||
) | ||
|
||
require ( | ||
github.com/mattn/go-colorable v0.1.9 // indirect | ||
github.com/mattn/go-isatty v0.0.14 // indirect | ||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= | ||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= | ||
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= | ||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= | ||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= | ||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= | ||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= | ||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= | ||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= | ||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// (c) 2022 Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package main | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"strings" | ||
|
||
"github.com/fatih/color" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
/* | ||
===Example File=== | ||
endpoint: /ext/bc/2Z36RnQuk1hvsnFeGWzfZUfXNr7w1SjzmDQ78YxfTVNAkDq3nZ | ||
logsDir: /var/folders/mp/6jm81gc11dv3xtcwxmrd8mcr0000gn/T/runnerlogs2984620995 | ||
pid: 55547 | ||
uris: | ||
- http://localhost:61278 | ||
- http://localhost:61280 | ||
- http://localhost:61282 | ||
- http://localhost:61284 | ||
- http://localhost:61286 | ||
*/ | ||
|
||
type output struct { | ||
Endpoint string `yaml:"endpoint"` | ||
Logs string `yaml:"logsDir"` | ||
PID int `yaml:"pid"` | ||
URIs []string `yaml:"uris"` | ||
} | ||
|
||
func main() { | ||
if len(os.Args) != 4 { | ||
panic("missing args <yaml> <chainID> <address>") | ||
} | ||
|
||
yamlFile, err := ioutil.ReadFile(os.Args[1]) | ||
if err != nil { | ||
panic(err) | ||
} | ||
var o output | ||
if err := yaml.Unmarshal(yamlFile, &o); err != nil { | ||
panic(err) | ||
} | ||
|
||
color.Green("\n") | ||
color.Green("Logs Directory: %s", o.Logs) | ||
color.Green("PID: %d", o.PID) | ||
color.Green("\n") | ||
|
||
color.Green("EVM Chain ID: %s", os.Args[2]) | ||
color.Green("Funded Address: %s", os.Args[3]) | ||
color.Green("RPC Endpoints:") | ||
for _, uri := range o.URIs { | ||
color.Green("- %s%s/rpc", uri, o.Endpoint) | ||
} | ||
color.Green("\n") | ||
|
||
color.Green("WS Endpoints:") | ||
for _, uri := range o.URIs { | ||
wsURI := strings.ReplaceAll(uri, "http", "ws") | ||
color.Green("- %s%s/ws", wsURI, o.Endpoint) | ||
} | ||
color.Green("\n") | ||
|
||
color.Yellow("MetaMask Quick Start:") | ||
color.Yellow("Funded Address: %s", os.Args[3]) | ||
color.Yellow("Network Name: Local EVM") | ||
color.Yellow("RPC URL: %s%s/rpc", o.URIs[0], o.Endpoint) | ||
color.Yellow("Chain ID: %s", os.Args[2]) | ||
color.Yellow("Curreny Symbol: LEVM") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters