Documentation ¶
Overview ¶
Package client implements a very simple wrapper for GoShimmer's web API.
Index ¶
- Variables
- type BasicAuth
- type GoShimmerAPI
- func (api *GoShimmerAPI) BaseURL() string
- func (api *GoShimmerAPI) BroadcastCollectiveBeacon(payload []byte) (string, error)
- func (api *GoShimmerAPI) Data(data []byte) (string, error)
- func (api *GoShimmerAPI) FindMessageByID(base58EncodedIDs []string) (*webapi_message.FindByIDResponse, error)
- func (api *GoShimmerAPI) GetAttachments(base58EncodedTxnID string) (*webapi_value.AttachmentsResponse, error)
- func (api *GoShimmerAPI) GetCommittee() (*webapi_drng.CommitteeResponse, error)
- func (api *GoShimmerAPI) GetNeighbors(knownPeers bool) (*webapi_autopeering.Response, error)
- func (api *GoShimmerAPI) GetRandomness() (*webapi_drng.RandomnessResponse, error)
- func (api *GoShimmerAPI) GetTransactionByID(base58EncodedTxnID string) (*webapi_value.GetTransactionByIDResponse, error)
- func (api *GoShimmerAPI) GetUnspentOutputs(addresses []string) (*webapi_value.UnspentOutputsResponse, error)
- func (api *GoShimmerAPI) Info() (*webapi_info.Response, error)
- func (api *GoShimmerAPI) Missing() (*webapi_tools_message.MissingResponse, error)
- func (api *GoShimmerAPI) PastConeExist(base58EncodedMessageID string) (*webapi_tools_message.PastconeResponse, error)
- func (api *GoShimmerAPI) SendFaucetRequest(base58EncodedAddr string) (*webapi_faucet.Response, error)
- func (api *GoShimmerAPI) SendPayload(payload []byte) (string, error)
- func (api *GoShimmerAPI) SendTransaction(txnBytes []byte) (string, error)
- func (api *GoShimmerAPI) SendTransactionByJSON(txn webapi_value.SendTransactionByJSONRequest) (string, error)
- func (api *GoShimmerAPI) ToggleSpammer(enable bool) (*webapi_spammer.Response, error)
- func (api *GoShimmerAPI) ValueObjects() (*webapi_tools_value.ObjectsResponse, error)
- func (api *GoShimmerAPI) ValueTips() (*webapi_tools_value.TipsResponse, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBadRequest defines the "bad request" error. ErrBadRequest = errors.New("bad request") // ErrInternalServerError defines the "internal server error" error. ErrInternalServerError = errors.New("internal server error") // ErrNotFound defines the "not found" error. ErrNotFound = errors.New("not found") ErrUnauthorized = errors.New("unauthorized") // ErrUnknownError defines the "unknown error" error. ErrUnknownError = errors.New("unknown error") // ErrNotImplemented defines the "operation not implemented/supported/available" error. ErrNotImplemented = errors.New("operation not implemented/supported/available") )
Functions ¶
This section is empty.
Types ¶
type BasicAuth ¶
type BasicAuth struct { Enabled bool `json:"enabled,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` }
BasicAuth defines the basic-auth struct.
func (BasicAuth) Credentials ¶
Credentials returns the username and password of a given BasicAuth.
type GoShimmerAPI ¶
type GoShimmerAPI struct {
// contains filtered or unexported fields
}
GoShimmerAPI is an API wrapper over the web API of GoShimmer.
func NewGoShimmerAPI ¶
func NewGoShimmerAPI(baseURL string, setters ...Option) *GoShimmerAPI
NewGoShimmerAPI returns a new *GoShimmerAPI with the given baseURL and options.
func (*GoShimmerAPI) BaseURL ¶
func (api *GoShimmerAPI) BaseURL() string
BaseURL returns the baseURL of the API.
func (*GoShimmerAPI) BroadcastCollectiveBeacon ¶
func (api *GoShimmerAPI) BroadcastCollectiveBeacon(payload []byte) (string, error)
BroadcastCollectiveBeacon sends the given collective beacon (payload) by creating a message in the backend.
func (*GoShimmerAPI) Data ¶
func (api *GoShimmerAPI) Data(data []byte) (string, error)
Data sends the given data (payload) by creating a message in the backend.
func (*GoShimmerAPI) FindMessageByID ¶
func (api *GoShimmerAPI) FindMessageByID(base58EncodedIDs []string) (*webapi_message.FindByIDResponse, error)
FindMessageByID finds messages by the given base58 encoded IDs. The messages are returned in the same order as the given IDs. Non available messages are empty at their corresponding index.
func (*GoShimmerAPI) GetAttachments ¶
func (api *GoShimmerAPI) GetAttachments(base58EncodedTxnID string) (*webapi_value.AttachmentsResponse, error)
GetAttachments gets the attachments of a transaction ID
func (*GoShimmerAPI) GetCommittee ¶
func (api *GoShimmerAPI) GetCommittee() (*webapi_drng.CommitteeResponse, error)
GetCommittee gets the current committee.
func (*GoShimmerAPI) GetNeighbors ¶
func (api *GoShimmerAPI) GetNeighbors(knownPeers bool) (*webapi_autopeering.Response, error)
GetNeighbors gets the chosen/accepted neighbors. If knownPeers is set, also all known peers to the node are returned additionally.
func (*GoShimmerAPI) GetRandomness ¶
func (api *GoShimmerAPI) GetRandomness() (*webapi_drng.RandomnessResponse, error)
GetRandomness gets the current randomness.
func (*GoShimmerAPI) GetTransactionByID ¶
func (api *GoShimmerAPI) GetTransactionByID(base58EncodedTxnID string) (*webapi_value.GetTransactionByIDResponse, error)
GetTransactionByID gets the transaction of a transaction ID
func (*GoShimmerAPI) GetUnspentOutputs ¶
func (api *GoShimmerAPI) GetUnspentOutputs(addresses []string) (*webapi_value.UnspentOutputsResponse, error)
GetUnspentOutputs return unspent output IDs of addresses
func (*GoShimmerAPI) Info ¶
func (api *GoShimmerAPI) Info() (*webapi_info.Response, error)
Info gets the info of the node.
func (*GoShimmerAPI) Missing ¶
func (api *GoShimmerAPI) Missing() (*webapi_tools_message.MissingResponse, error)
Missing returns all the missing messages and their count.
func (*GoShimmerAPI) PastConeExist ¶
func (api *GoShimmerAPI) PastConeExist(base58EncodedMessageID string) (*webapi_tools_message.PastconeResponse, error)
PastConeExist checks that all of the messages in the past cone of a message are existing on the node down to the genesis. Returns the number of messages in the past cone as well.
func (*GoShimmerAPI) SendFaucetRequest ¶
func (api *GoShimmerAPI) SendFaucetRequest(base58EncodedAddr string) (*webapi_faucet.Response, error)
SendFaucetRequest requests funds from faucet nodes by sending a faucet request payload message.
func (*GoShimmerAPI) SendPayload ¶
func (api *GoShimmerAPI) SendPayload(payload []byte) (string, error)
SendPayload send a message with the given payload.
func (*GoShimmerAPI) SendTransaction ¶
func (api *GoShimmerAPI) SendTransaction(txnBytes []byte) (string, error)
SendTransaction sends the transaction(bytes) to the Value Tangle and returns transaction ID.
func (*GoShimmerAPI) SendTransactionByJSON ¶
func (api *GoShimmerAPI) SendTransactionByJSON(txn webapi_value.SendTransactionByJSONRequest) (string, error)
SendTransactionByJSON sends the transaction(JSON) to the Value Tangle and returns transaction ID.
func (*GoShimmerAPI) ToggleSpammer ¶
func (api *GoShimmerAPI) ToggleSpammer(enable bool) (*webapi_spammer.Response, error)
ToggleSpammer toggles the node internal spammer.
func (*GoShimmerAPI) ValueObjects ¶
func (api *GoShimmerAPI) ValueObjects() (*webapi_tools_value.ObjectsResponse, error)
ValueObjects returns the list of value objects.
func (*GoShimmerAPI) ValueTips ¶
func (api *GoShimmerAPI) ValueTips() (*webapi_tools_value.TipsResponse, error)
ValueTips returns the value objects info from the tips.
type Option ¶
type Option func(*GoShimmerAPI)
Option is a function which sets the given option.
func WithBasicAuth ¶
WithBasicAuth returns a new BasicAuth.
func WithHTTPClient ¶
WithHTTPClient sets the http Client.