client

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2020 License: Apache-2.0, BSD-2-Clause Imports: 23 Imported by: 8

Documentation

Overview

Package client implements a very simple wrapper for GoShimmer's web API.

Index

Constants

This section is empty.

Variables

View Source
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 defines the "unauthorized" error.
	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 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, httpClient ...http.Client) *GoShimmerAPI

NewGoShimmerAPI returns a new *GoShimmerAPI with the given baseURL and httpClient.

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.Response, 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_attachments.Response, error)

GetAttachments gets the attachments of a transaction ID

func (*GoShimmerAPI) GetCommittee added in v0.2.0

func (api *GoShimmerAPI) GetCommittee() (*webapi_committee.Response, 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_randomness.Response, error)

GetRandomness gets the current randomness.

func (*GoShimmerAPI) GetTransactionByID added in v0.2.0

func (api *GoShimmerAPI) GetTransactionByID(base58EncodedTxnID string) (*webapi_gettxn.Response, error)

GetTransactionByID gets the transaction of a transaction ID

func (*GoShimmerAPI) GetUnspentOutputs added in v0.2.0

func (api *GoShimmerAPI) GetUnspentOutputs(addresses []string) (*webapi_unspentoutputs.Response, 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) Login

func (api *GoShimmerAPI) Login(username string, password string) error

Login authorizes this API instance against the web API. You must call this function before any other call, if the web-auth plugin is enabled.

func (*GoShimmerAPI) PastConeExist added in v0.2.2

func (api *GoShimmerAPI) PastConeExist(base58EncodedMessageID string) (*webapi_tools.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_sendtxnbyjson.Request) (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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL