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 ¶ added in v0.3.0
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 ¶ added in v0.3.0
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 ¶ added in v0.2.0
func (api *GoShimmerAPI) BaseURL() string
BaseURL returns the baseURL of the API.
func (*GoShimmerAPI) BroadcastCollectiveBeacon ¶ added in v0.2.0
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 ¶ added in v0.2.0
func (api *GoShimmerAPI) Data(data []byte) (string, error)
Data sends the given data (payload) by creating a message in the backend.
func (*GoShimmerAPI) FindMessageByID ¶ added in v0.2.0
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 ¶ added in v0.2.0
func (api *GoShimmerAPI) GetAttachments(base58EncodedTxnID string) (*webapi_value.AttachmentsResponse, error)
GetAttachments gets the attachments of a transaction ID
func (*GoShimmerAPI) GetCommittee ¶ added in v0.2.0
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 ¶ added in v0.2.0
func (api *GoShimmerAPI) GetRandomness() (*webapi_drng.RandomnessResponse, error)
GetRandomness gets the current randomness.
func (*GoShimmerAPI) GetTransactionByID ¶ added in v0.2.0
func (api *GoShimmerAPI) GetTransactionByID(base58EncodedTxnID string) (*webapi_value.GetTransactionByIDResponse, error)
GetTransactionByID gets the transaction of a transaction ID
func (*GoShimmerAPI) GetUnspentOutputs ¶ added in v0.2.0
func (api *GoShimmerAPI) GetUnspentOutputs(addresses []string) (*webapi_value.UnspentOutputsResponse, error)
GetUnspentOutputs return unspent output IDs of addresses
func (*GoShimmerAPI) Info ¶ added in v0.2.0
func (api *GoShimmerAPI) Info() (*webapi_info.Response, error)
Info gets the info of the node.
func (*GoShimmerAPI) Missing ¶ added in v0.2.4
func (api *GoShimmerAPI) Missing() (*webapi_tools_message.MissingResponse, error)
Missing returns all the missing messages and their count.
func (*GoShimmerAPI) PastConeExist ¶ added in v0.2.2
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 ¶ added in v0.2.0
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 ¶ added in v0.2.0
func (api *GoShimmerAPI) SendPayload(payload []byte) (string, error)
SendPayload send a message with the given payload.
func (*GoShimmerAPI) SendTransaction ¶ added in v0.2.0
func (api *GoShimmerAPI) SendTransaction(txnBytes []byte) (string, error)
SendTransaction sends the transaction(bytes) to the Value Tangle and returns transaction ID.
func (*GoShimmerAPI) SendTransactionByJSON ¶ added in v0.2.2
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 ¶ added in v0.2.4
func (api *GoShimmerAPI) ValueObjects() (*webapi_tools_value.ObjectsResponse, error)
ValueObjects returns the list of value objects.
func (*GoShimmerAPI) ValueTips ¶ added in v0.2.4
func (api *GoShimmerAPI) ValueTips() (*webapi_tools_value.TipsResponse, error)
ValueTips returns the value objects info from the tips.
type Option ¶ added in v0.3.0
type Option func(*GoShimmerAPI)
Option is a function which sets the given option.
func WithBasicAuth ¶ added in v0.3.0
WithBasicAuth returns a new BasicAuth.
func WithHTTPClient ¶ added in v0.3.0
WithHTTPClient sets the http Client.