-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into SD_utilize
- Loading branch information
Showing
18 changed files
with
542 additions
and
12 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
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
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,21 @@ | ||
package stader_backend | ||
|
||
type NodeDiversityRequest struct { | ||
Signature string `json:"signature"` | ||
Message *NodeDiversity `json:"message"` | ||
} | ||
|
||
type NodeDiversity struct { | ||
ExecutionClient string `json:"executionClient"` | ||
ConsensusClient string `json:"consensusClient"` | ||
ValidatorClient string `json:"validatorClient"` | ||
TotalNonTerminalKeys uint64 `json:"totalNonTerminalKeys"` | ||
NodeAddress string `json:"nodeAddress"` | ||
NodePublicKey string `json:"nodePublicKey"` | ||
Relays string `json:"relays"` | ||
} | ||
|
||
type NodeDiversityResponseType struct { | ||
Success bool `json:"success"` | ||
Error string `json:"error"` | ||
} |
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,37 @@ | ||
package stader | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/stader-labs/stader-node/shared/services" | ||
stader_backend "github.com/stader-labs/stader-node/shared/types/stader-backend" | ||
"github.com/stader-labs/stader-node/shared/utils/net" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
func SendNodeDiversityResponseType( | ||
c *cli.Context, | ||
request *stader_backend.NodeDiversityRequest, | ||
) (*stader_backend.NodeDiversityResponseType, error) { | ||
config, err := services.GetConfig(c) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res, err := net.MakePostRequest(config.StaderNode.GetNodeDiversityApi(), request) | ||
if err != nil { | ||
return nil, fmt.Errorf("request to GetNodeDiversityApi %w", err) | ||
} | ||
defer res.Body.Close() | ||
|
||
var resp stader_backend.NodeDiversityResponseType | ||
err = json.NewDecoder(res.Body).Decode(&resp) | ||
|
||
if err != nil { | ||
return nil, fmt.Errorf("decode NodeDiversityResponseType %w", err) | ||
} | ||
|
||
return &resp, nil | ||
|
||
} |
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
Oops, something went wrong.