-
Notifications
You must be signed in to change notification settings - Fork 2
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 #27 from nodeset-org/constellation
Add support for Constellation
- Loading branch information
Showing
99 changed files
with
2,685 additions
and
809 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
issues: | ||
exclude-rules: | ||
- linters: | ||
- staticcheck | ||
text: "ST1005" |
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 |
---|---|---|
|
@@ -4,6 +4,12 @@ | |
}, | ||
"go.testFlags": [ | ||
"-p", | ||
"1", | ||
"-count", | ||
"1" | ||
], | ||
"go.lintFlags": [ | ||
"-e", | ||
"ST1005" | ||
] | ||
} |
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,67 @@ | ||
package client | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/nodeset-org/hyperdrive-daemon/shared/types/api" | ||
nscommon "github.com/nodeset-org/nodeset-client-go/common" | ||
"github.com/rocket-pool/node-manager-core/api/client" | ||
"github.com/rocket-pool/node-manager-core/api/types" | ||
) | ||
|
||
// Requester for Constellation module calls to the nodeset.io service | ||
type NodeSetConstellationRequester struct { | ||
context client.IRequesterContext | ||
} | ||
|
||
func NewNodeSetConstellationRequester(context client.IRequesterContext) *NodeSetConstellationRequester { | ||
return &NodeSetConstellationRequester{ | ||
context: context, | ||
} | ||
} | ||
|
||
func (r *NodeSetConstellationRequester) GetName() string { | ||
return "NodeSet-Constellation" | ||
} | ||
func (r *NodeSetConstellationRequester) GetRoute() string { | ||
return "nodeset/constellation" | ||
} | ||
func (r *NodeSetConstellationRequester) GetContext() client.IRequesterContext { | ||
return r.context | ||
} | ||
|
||
// Gets the address the node's user has assigned as the registered Constellation address | ||
func (r *NodeSetConstellationRequester) GetRegisteredAddress() (*types.ApiResponse[api.NodeSetConstellation_GetRegisteredAddressData], error) { | ||
args := map[string]string{} | ||
return client.SendGetRequest[api.NodeSetConstellation_GetRegisteredAddressData](r, "get-registered-address", "GetRegisteredAddress", args) | ||
} | ||
|
||
// Gets a signature for registering / whitelisting the node with the Constellation contracts | ||
func (r *NodeSetConstellationRequester) GetRegistrationSignature() (*types.ApiResponse[api.NodeSetConstellation_GetRegistrationSignatureData], error) { | ||
args := map[string]string{} | ||
return client.SendGetRequest[api.NodeSetConstellation_GetRegistrationSignatureData](r, "get-registration-signature", "GetRegistrationSignature", args) | ||
} | ||
|
||
// Gets the deposit signature for a minipool from the Constellation contracts | ||
func (r *NodeSetConstellationRequester) GetDepositSignature(minipoolAddress common.Address, salt *big.Int) (*types.ApiResponse[api.NodeSetConstellation_GetDepositSignatureData], error) { | ||
args := map[string]string{ | ||
"minipoolAddress": minipoolAddress.Hex(), | ||
"salt": salt.String(), | ||
} | ||
return client.SendGetRequest[api.NodeSetConstellation_GetDepositSignatureData](r, "get-deposit-signature", "GetDepositSignature", args) | ||
} | ||
|
||
// Gets the validators that have been registered with the NodeSet service for this node as part of Constellation | ||
func (r *NodeSetConstellationRequester) GetValidators() (*types.ApiResponse[api.NodeSetConstellation_GetValidatorsData], error) { | ||
args := map[string]string{} | ||
return client.SendGetRequest[api.NodeSetConstellation_GetValidatorsData](r, "get-validators", "GetValidators", args) | ||
} | ||
|
||
// Uploads signed exit messages to the NodeSet service | ||
func (r *NodeSetConstellationRequester) UploadSignedExits(exitMessages []nscommon.ExitData) (*types.ApiResponse[api.NodeSetConstellation_UploadSignedExitsData], error) { | ||
body := api.NodeSetConstellation_UploadSignedExitsRequestBody{ | ||
ExitMessages: exitMessages, | ||
} | ||
return client.SendPostRequest[api.NodeSetConstellation_UploadSignedExitsData](r, "upload-signed-exits", "UploadSignedExits", body) | ||
} |
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.