forked from 0xPolygon/polygon-edge
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for better client version details (#229)
# Description This PR resolves a pending issue that doesn't return proper chain information on the client version. It removes the base `GET` endpoint to the JSON-RPC layer, as it's not by the standard, nor should it be supported. Users should use the `web3_clientVersion` endpoint instead, that is outlined in the specification. The PR is merging from PolygonEdge [PR 672](0xPolygon#672) # Changes include - [x] Bugfix (non-breaking change that solves an issue) ## Testing - [x] I have tested this code with the official test suite
- Loading branch information
1 parent
1960bf6
commit 45ccc44
Showing
10 changed files
with
150 additions
and
38 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 |
---|---|---|
@@ -1,9 +1,27 @@ | ||
package version | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/dogechain-lab/dogechain/command/helper" | ||
) | ||
|
||
type VersionResult struct { | ||
Version string `json:"version"` | ||
Version string `json:"version"` | ||
Commit string `json:"commit"` | ||
BuildTime string `json:"buildTime"` | ||
} | ||
|
||
func (r *VersionResult) GetOutput() string { | ||
return r.Version | ||
var s strings.Builder | ||
|
||
s.WriteString("Dogechain\n") | ||
s.WriteString(helper.FormatKV([]string{ | ||
fmt.Sprintf("Version|%s", r.Version), | ||
fmt.Sprintf("Commit|%s", r.Commit), | ||
fmt.Sprintf("Build Time|%s", r.BuildTime), | ||
})) | ||
|
||
return s.String() | ||
} |
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
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
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package versioning | ||
|
||
// Embedded by --ldflags on build time | ||
// Versioning should follow the SemVer guidelines | ||
// https://semver.org/ | ||
var ( | ||
// Version is the main version at the moment. | ||
// Embedded by --ldflags on build time | ||
// Versioning should follow the SemVer guidelines | ||
// https://semver.org/ | ||
Version = "v0.1.0" | ||
Version string // the main version at the moment | ||
Commit string // the git commit that the binary was built on | ||
BuildTime string // the timestamp of the build | ||
) |