Documentation ¶
Index ¶
- func HandleResponse[DataType any](context *RequesterContext, resp *http.Response, path string, err error) (*api.ApiResponse[DataType], error)
- func MakeBatchArg[DataType BatchInputType](input []DataType) string
- func RawGetRequest[DataType any](context *RequesterContext, path string, params map[string]string) (*api.ApiResponse[DataType], error)
- func RawPostRequest[DataType any](context *RequesterContext, path string, body string) (*api.ApiResponse[DataType], error)
- func SendGetRequest[DataType any](r IRequester, method string, requestName string, args map[string]string) (*api.ApiResponse[DataType], error)
- func SendPostRequest[DataType any](r IRequester, method string, requestName string, body any) (*api.ApiResponse[DataType], error)
- type ApiClient
- type BatchInputType
- type IRequester
- type RequesterContext
- type ServiceRequester
- func (r *ServiceRequester) ClientStatus() (*api.ApiResponse[api.ServiceClientStatusData], error)
- func (r *ServiceRequester) GetConfig() (*api.ApiResponse[api.ServiceGetConfigData], error)
- func (r *ServiceRequester) GetContext() *RequesterContext
- func (r *ServiceRequester) GetName() string
- func (r *ServiceRequester) GetRoute() string
- func (r *ServiceRequester) RestartContainer(container string) (*api.ApiResponse[api.SuccessData], error)
- func (r *ServiceRequester) TerminateDataFolder() (*api.ApiResponse[api.ServiceTerminateDataFolderData], error)
- func (r *ServiceRequester) Version() (*api.ApiResponse[api.ServiceVersionData], error)
- type TxRequester
- func (r *TxRequester) GetContext() *RequesterContext
- func (r *TxRequester) GetName() string
- func (r *TxRequester) GetRoute() string
- func (r *TxRequester) SignTx(txSubmission *eth.TransactionSubmission, nonce *big.Int, maxFee *big.Int, ...) (*api.ApiResponse[api.TxSignTxData], error)
- func (r *TxRequester) SignTxBatch(txSubmissions []*eth.TransactionSubmission, firstNonce *big.Int, ...) (*api.ApiResponse[api.TxBatchSignTxData], error)
- func (r *TxRequester) SubmitTx(txSubmission *eth.TransactionSubmission, nonce *big.Int, maxFee *big.Int, ...) (*api.ApiResponse[api.TxData], error)
- func (r *TxRequester) SubmitTxBatch(txSubmissions []*eth.TransactionSubmission, firstNonce *big.Int, ...) (*api.ApiResponse[api.BatchTxData], error)
- func (r *TxRequester) WaitForTransaction(txHash common.Hash) (*api.ApiResponse[api.SuccessData], error)
- type UtilsRequester
- func (r *UtilsRequester) Balance() (*api.ApiResponse[api.UtilsBalanceData], error)
- func (r *UtilsRequester) GetContext() *RequesterContext
- func (r *UtilsRequester) GetName() string
- func (r *UtilsRequester) GetRoute() string
- func (r *UtilsRequester) ResolveEns(address common.Address, name string) (*api.ApiResponse[api.UtilsResolveEnsData], error)
- type WalletRequester
- func (r *WalletRequester) DeletePassword() (*api.ApiResponse[api.SuccessData], error)
- func (r *WalletRequester) Export() (*api.ApiResponse[api.WalletExportData], error)
- func (r *WalletRequester) ExportEthKey() (*api.ApiResponse[api.WalletExportEthKeyData], error)
- func (r *WalletRequester) GenerateValidatorKey(path string) (*api.ApiResponse[api.WalletGenerateValidatorKeyData], error)
- func (r *WalletRequester) GetContext() *RequesterContext
- func (r *WalletRequester) GetName() string
- func (r *WalletRequester) GetRoute() string
- func (r *WalletRequester) Initialize(derivationPath *string, index *uint64, saveWallet bool, password string, ...) (*api.ApiResponse[api.WalletInitializeData], error)
- func (r *WalletRequester) Masquerade(address common.Address) (*api.ApiResponse[api.SuccessData], error)
- func (r *WalletRequester) Rebuild() (*api.ApiResponse[api.WalletRebuildData], error)
- func (r *WalletRequester) Recover(derivationPath *string, mnemonic *string, index *uint64, password string, ...) (*api.ApiResponse[api.WalletRecoverData], error)
- func (r *WalletRequester) RestoreAddress() (*api.ApiResponse[api.SuccessData], error)
- func (r *WalletRequester) SearchAndRecover(mnemonic string, address common.Address, password string, save bool) (*api.ApiResponse[api.WalletSearchAndRecoverData], error)
- func (r *WalletRequester) SendMessage(message []byte, address common.Address) (*api.ApiResponse[api.TxInfoData], error)
- func (r *WalletRequester) SetEnsName(name string) (*api.ApiResponse[api.WalletSetEnsNameData], error)
- func (r *WalletRequester) SetPassword(password string, save bool) (*api.ApiResponse[api.SuccessData], error)
- func (r *WalletRequester) SignMessage(message []byte) (*api.ApiResponse[api.WalletSignMessageData], error)
- func (r *WalletRequester) SignTx(message []byte) (*api.ApiResponse[api.WalletSignTxData], error)
- func (r *WalletRequester) Status() (*api.ApiResponse[api.WalletStatusData], error)
- func (r *WalletRequester) TestRecover(derivationPath *string, mnemonic string, index *uint64) (*api.ApiResponse[api.WalletRecoverData], error)
- func (r *WalletRequester) TestSearchAndRecover(mnemonic string, address common.Address) (*api.ApiResponse[api.WalletSearchAndRecoverData], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleResponse ¶
func HandleResponse[DataType any](context *RequesterContext, resp *http.Response, path string, err error) (*api.ApiResponse[DataType], error)
Processes a response to a request
func MakeBatchArg ¶
func MakeBatchArg[DataType BatchInputType](input []DataType) string
Converts an array of inputs into a comma-delimited string
func RawGetRequest ¶
func RawGetRequest[DataType any](context *RequesterContext, path string, params map[string]string) (*api.ApiResponse[DataType], error)
Submit a GET request to the API server
func RawPostRequest ¶
func RawPostRequest[DataType any](context *RequesterContext, path string, body string) (*api.ApiResponse[DataType], error)
Submit a POST request to the API server
func SendGetRequest ¶
func SendGetRequest[DataType any](r IRequester, method string, requestName string, args map[string]string) (*api.ApiResponse[DataType], error)
Submit a GET request to the API server
func SendPostRequest ¶
func SendPostRequest[DataType any](r IRequester, method string, requestName string, body any) (*api.ApiResponse[DataType], error)
Submit a POST request to the API server
Types ¶
type ApiClient ¶
type ApiClient struct { Service *ServiceRequester Tx *TxRequester Utils *UtilsRequester Wallet *WalletRequester // contains filtered or unexported fields }
Binder for the Hyperdrive daemon API server
func NewApiClient ¶
Creates a new API client instance
type BatchInputType ¶
type BatchInputType interface { uint64 | common.Address | beacon.ValidatorPubkey }
Types that can be batched into a comma-delmited string
type IRequester ¶
type IRequester interface { // The human-readable requester name (for logging) GetName() string // The name of the subroute to send requests to GetRoute() string // Context to hold settings and utilities the requester should use GetContext() *RequesterContext }
IRequester is an interface for making HTTP requests to a specific subroute on the Hyperdrive Daemon
type RequesterContext ¶
type RequesterContext struct { // The path to the socket to send requests to SocketPath string // An HTTP Client for sending requests Client *http.Client // Whether or not to print debug logs DebugMode bool // Logger to print debug messages to Log *log.ColorLogger // The base route for the client to send requests to (<http://<base>/<route>/<method>) Base string }
The context passed into a requester
type ServiceRequester ¶
type ServiceRequester struct {
// contains filtered or unexported fields
}
func NewServiceRequester ¶
func NewServiceRequester(context *RequesterContext) *ServiceRequester
func (*ServiceRequester) ClientStatus ¶
func (r *ServiceRequester) ClientStatus() (*api.ApiResponse[api.ServiceClientStatusData], error)
Gets the status of the configured Execution and Beacon clients
func (*ServiceRequester) GetConfig ¶
func (r *ServiceRequester) GetConfig() (*api.ApiResponse[api.ServiceGetConfigData], error)
Gets the Hyperdrive configuration
func (*ServiceRequester) GetContext ¶
func (r *ServiceRequester) GetContext() *RequesterContext
func (*ServiceRequester) GetName ¶
func (r *ServiceRequester) GetName() string
func (*ServiceRequester) GetRoute ¶
func (r *ServiceRequester) GetRoute() string
func (*ServiceRequester) RestartContainer ¶
func (r *ServiceRequester) RestartContainer(container string) (*api.ApiResponse[api.SuccessData], error)
Restarts a Docker container
func (*ServiceRequester) TerminateDataFolder ¶
func (r *ServiceRequester) TerminateDataFolder() (*api.ApiResponse[api.ServiceTerminateDataFolderData], error)
Deletes the data folder including the wallet file, password file, and all validator keys. Don't use this unless you have a very good reason to do it (such as switching from Prater to Mainnet).
func (*ServiceRequester) Version ¶
func (r *ServiceRequester) Version() (*api.ApiResponse[api.ServiceVersionData], error)
Gets the version of the daemon
type TxRequester ¶
type TxRequester struct {
// contains filtered or unexported fields
}
func NewTxRequester ¶
func NewTxRequester(context *RequesterContext) *TxRequester
func (*TxRequester) GetContext ¶
func (r *TxRequester) GetContext() *RequesterContext
func (*TxRequester) GetName ¶
func (r *TxRequester) GetName() string
func (*TxRequester) GetRoute ¶
func (r *TxRequester) GetRoute() string
func (*TxRequester) SignTx ¶
func (r *TxRequester) SignTx(txSubmission *eth.TransactionSubmission, nonce *big.Int, maxFee *big.Int, maxPriorityFee *big.Int) (*api.ApiResponse[api.TxSignTxData], error)
Use the node private key to sign a transaction without submitting it
func (*TxRequester) SignTxBatch ¶
func (r *TxRequester) SignTxBatch(txSubmissions []*eth.TransactionSubmission, firstNonce *big.Int, maxFee *big.Int, maxPriorityFee *big.Int) (*api.ApiResponse[api.TxBatchSignTxData], error)
Use the node private key to sign a batch of transactions without submitting them
func (*TxRequester) SubmitTx ¶
func (r *TxRequester) SubmitTx(txSubmission *eth.TransactionSubmission, nonce *big.Int, maxFee *big.Int, maxPriorityFee *big.Int) (*api.ApiResponse[api.TxData], error)
Submit a transaction
func (*TxRequester) SubmitTxBatch ¶
func (r *TxRequester) SubmitTxBatch(txSubmissions []*eth.TransactionSubmission, firstNonce *big.Int, maxFee *big.Int, maxPriorityFee *big.Int) (*api.ApiResponse[api.BatchTxData], error)
Submit a batch of transactions
func (*TxRequester) WaitForTransaction ¶
func (r *TxRequester) WaitForTransaction(txHash common.Hash) (*api.ApiResponse[api.SuccessData], error)
Wait for a transaction
type UtilsRequester ¶
type UtilsRequester struct {
// contains filtered or unexported fields
}
func NewUtilsRequester ¶
func NewUtilsRequester(context *RequesterContext) *UtilsRequester
func (*UtilsRequester) Balance ¶
func (r *UtilsRequester) Balance() (*api.ApiResponse[api.UtilsBalanceData], error)
Get the node's ETH balance
func (*UtilsRequester) GetContext ¶
func (r *UtilsRequester) GetContext() *RequesterContext
func (*UtilsRequester) GetName ¶
func (r *UtilsRequester) GetName() string
func (*UtilsRequester) GetRoute ¶
func (r *UtilsRequester) GetRoute() string
func (*UtilsRequester) ResolveEns ¶
func (r *UtilsRequester) ResolveEns(address common.Address, name string) (*api.ApiResponse[api.UtilsResolveEnsData], error)
Resolves an ENS name or reserve resolves an address
type WalletRequester ¶
type WalletRequester struct {
// contains filtered or unexported fields
}
func NewWalletRequester ¶
func NewWalletRequester(context *RequesterContext) *WalletRequester
func (*WalletRequester) DeletePassword ¶
func (r *WalletRequester) DeletePassword() (*api.ApiResponse[api.SuccessData], error)
Delete the wallet keystore's password from disk
func (*WalletRequester) Export ¶
func (r *WalletRequester) Export() (*api.ApiResponse[api.WalletExportData], error)
Export wallet
func (*WalletRequester) ExportEthKey ¶
func (r *WalletRequester) ExportEthKey() (*api.ApiResponse[api.WalletExportEthKeyData], error)
Export the wallet in encrypted ETH key format
func (*WalletRequester) GenerateValidatorKey ¶
func (r *WalletRequester) GenerateValidatorKey(path string) (*api.ApiResponse[api.WalletGenerateValidatorKeyData], error)
Generate a validator key derived from the node wallet's seed
func (*WalletRequester) GetContext ¶
func (r *WalletRequester) GetContext() *RequesterContext
func (*WalletRequester) GetName ¶
func (r *WalletRequester) GetName() string
func (*WalletRequester) GetRoute ¶
func (r *WalletRequester) GetRoute() string
func (*WalletRequester) Initialize ¶
func (r *WalletRequester) Initialize(derivationPath *string, index *uint64, saveWallet bool, password string, savePassword bool) (*api.ApiResponse[api.WalletInitializeData], error)
Initialize the wallet with a new key
func (*WalletRequester) Masquerade ¶
func (r *WalletRequester) Masquerade(address common.Address) (*api.ApiResponse[api.SuccessData], error)
Set the node address to an arbitrary address
func (*WalletRequester) Rebuild ¶
func (r *WalletRequester) Rebuild() (*api.ApiResponse[api.WalletRebuildData], error)
Rebuild the validator keys associated with the wallet
func (*WalletRequester) Recover ¶
func (r *WalletRequester) Recover(derivationPath *string, mnemonic *string, index *uint64, password string, save bool) (*api.ApiResponse[api.WalletRecoverData], error)
Recover wallet
func (*WalletRequester) RestoreAddress ¶
func (r *WalletRequester) RestoreAddress() (*api.ApiResponse[api.SuccessData], error)
Set the node address back to the wallet address
func (*WalletRequester) SearchAndRecover ¶
func (r *WalletRequester) SearchAndRecover(mnemonic string, address common.Address, password string, save bool) (*api.ApiResponse[api.WalletSearchAndRecoverData], error)
Search and recover wallet
func (*WalletRequester) SendMessage ¶
func (r *WalletRequester) SendMessage(message []byte, address common.Address) (*api.ApiResponse[api.TxInfoData], error)
Sends a zero-value message with a payload
func (*WalletRequester) SetEnsName ¶
func (r *WalletRequester) SetEnsName(name string) (*api.ApiResponse[api.WalletSetEnsNameData], error)
Set an ENS reverse record to a name
func (*WalletRequester) SetPassword ¶
func (r *WalletRequester) SetPassword(password string, save bool) (*api.ApiResponse[api.SuccessData], error)
Sets the wallet keystore's password
func (*WalletRequester) SignMessage ¶
func (r *WalletRequester) SignMessage(message []byte) (*api.ApiResponse[api.WalletSignMessageData], error)
Use the node private key to sign an arbitrary message
func (*WalletRequester) SignTx ¶ added in v0.2.3
func (r *WalletRequester) SignTx(message []byte) (*api.ApiResponse[api.WalletSignTxData], error)
Use the node private key to sign a transaction
func (*WalletRequester) Status ¶
func (r *WalletRequester) Status() (*api.ApiResponse[api.WalletStatusData], error)
Get wallet status
func (*WalletRequester) TestRecover ¶
func (r *WalletRequester) TestRecover(derivationPath *string, mnemonic string, index *uint64) (*api.ApiResponse[api.WalletRecoverData], error)
Recover wallet in test-mode so none of the artifacts are saved
func (*WalletRequester) TestSearchAndRecover ¶
func (r *WalletRequester) TestSearchAndRecover(mnemonic string, address common.Address) (*api.ApiResponse[api.WalletSearchAndRecoverData], error)
Search for and recover the wallet in test-mode so none of the artifacts are saved