api

package
v0.0.0-...-f432f55 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultConfig is the default config for the Lisk API client
	DefaultConfig = &Config{
		RandomHostsPool: []Host{{"betanet.lisk.io", 5000, false}},
		RandomHost:      true,
		Debug:           false,
	}
)

Functions

This section is empty.

Types

type Account

type Account struct {
	// Address of the account
	Address string `json:"address"`
	// PublicKey of the account
	PublicKey string `json:"publicKey"`
	// Balance of the account
	Balance int64 `json:"balance,string"`
	// UnconfirmedBalance of the account
	UnconfirmedBalance int64 `json:"unconfirmedBalance,string"`
	// SecondPublicKey of the account
	SecondPublicKey string `json:"secondPublicKey"`
	// Delegate is the delegate name of the account
	Delegate *Delegate `json:"delegate,omitempty"`
}

Account is an account on the Lisk blockchain

type AccountRequest

type AccountRequest struct {
	// Address of the account
	Address string
	// PublicKey of the account
	PublicKey string
	// SecondPublicKey of the account
	SecondPublicKey string
	// Username of the account
	Username string

	ListOptions
}

AccountRequest is the request body to request accounts

type AccountResponse

type AccountResponse struct {
	// Accounts are the results
	Accounts []*Account `json:"data"`
	*GenericResponse
}

AccountResponse is the API response for account requests

type Block

type Block struct {
	// ID of the block
	ID string `json:"id"`
	// Version of the block
	Version int `json:"version"`
	// Height of the block
	Height int `json:"height"`
	// Timestamp of the block
	Timestamp int `json:"timestamp"`
	// GeneratorAddress of the block
	GeneratorAddress string `json:"generatorAddress"`
	// GeneratorPublicKey of the block
	GeneratorPublicKey string `json:"generatorPublicKey"`
	// OptionsLength of the block
	OptionsLength int `json:"optionsLength"`
	// OptionsHash of the block
	OptionsHash string `json:"optionsHash"`
	// BlockSignature of the block
	BlockSignature string `json:"blockSignature"`
	// Confirmations of the block
	Confirmations int `json:"confirmations"`
	// PreviousBlockID of the block
	PreviousBlockID string `json:"previousBlockId"`
	// NumberOfTransactions of the block
	NumberOfTransactions int `json:"numberOfTransactions"`
	// TotalAmount of the block
	TotalAmount string `json:"totalAmount"`
	// TotalFee of the block
	TotalFee string `json:"totalFee"`
	// Reward of the block
	Reward string `json:"reward"`
	// TotalForged of the block
	TotalForged string `json:"totalForged"`
}

Block is a Lisk block

type BlockRequest

type BlockRequest struct {
	// BlockID of the block
	BlockID string
	// Height if the block
	Height *int64
	// GeneratorPublicKey is the public key of the delegate that forged the block
	GeneratorPublicKey string

	ListOptions
}

BlockRequest is the request body to request blocks

type BlockResponse

type BlockResponse struct {
	// Blocks are the results
	Blocks []*Block `json:"data"`
	*GenericResponse
}

BlockResponse is the API response for block requests

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a client for the Lisk API

func NewClient

func NewClient() *Client

NewClient returns a new client for the Lisk API

func NewClientWithCustomConfig

func NewClientWithCustomConfig(config *Config) *Client

NewClientWithCustomConfig returns a new client for the Lisk API and uses a custom config

func (*Client) ChangeRandomHost

func (c *Client) ChangeRandomHost()

ChangeRandomHost selects a new host from the pool for the client requests

func (*Client) GetAccounts

func (c *Client) GetAccounts(ctx context.Context, options *AccountRequest) (*AccountResponse, error)

GetAccounts searches for accounts on the blockchain. Search parameters can be specified in options. Limit is set to 100 by default The Account field of the Delegate field in the response is empty as it would cause a circular reference.

func (*Client) GetBlocks

func (c *Client) GetBlocks(ctx context.Context, options *BlockRequest) (*BlockResponse, error)

GetBlocks searches for blocks on the blockchain. Search parameters can be specified in options. Limit is set to 100 by default

func (*Client) GetConstants

func (c *Client) GetConstants(ctx context.Context) (*ConstantsResponse, error)

GetConstants returns the chain constants.

func (*Client) GetDapps

func (c *Client) GetDapps(ctx context.Context, options *DappRequest) (*DappResponse, error)

GetDapps searches for Dapps on the blockchain. Search parameters can be specified in options. Limit is set to 100 by default

func (*Client) GetDelegate

func (c *Client) GetDelegate(ctx context.Context, options *DelegateRequest) (*DelegateResponse, error)

GetDelegate gets a Delegate from the blockchain. Query parameters can be specified in options. The Account field of the delegate response does not contain a username. Use the delegate username instead

func (*Client) GetDelegateVoters

func (c *Client) GetDelegateVoters(ctx context.Context, options *DelegateVoterRequest) (*DelegateVoterResponse, error)

GetDelegateVoters returns the voters for a specific delegate. Search parameters can be specified in options. Limit is set to 100 by default

func (*Client) GetForgingStats

func (c *Client) GetForgingStats(ctx context.Context, options *ForgingStatsRequest) (*ForgingStatsResponse, error)

GetForgingStats returns the forgingStats for a delegate.

func (*Client) GetForgingStatus

func (c *Client) GetForgingStatus(ctx context.Context, options *ForgingStatusRequest) (*ForgingStatsResponse, error)

GetForgingStatus returns the forging status of the node. You can optionally specify a publicKey to query for to only return the forging status for that delegate.

func (*Client) GetNextForgers

func (c *Client) GetNextForgers(ctx context.Context, listOptions *ListOptions) (*NextForgersResponse, error)

GetNextForgers returns the next forging delegates. Limit is set to 100 by default The Account field of the delegate response does not contain a username. Use the delegate username instead

func (*Client) GetNodeStatus

func (c *Client) GetNodeStatus(ctx context.Context) (*NodeStatusReponse, error)

GetNodeStatus returns the status of the node.

func (*Client) GetPeers

func (c *Client) GetPeers(ctx context.Context, options *PeerRequest) (*PeerResponse, error)

GetPeers searches for peers. Search parameters can be specified in options. Limit is set to 100 by default

func (*Client) GetPendingTransactions

func (c *Client) GetPendingTransactions(ctx context.Context, state TransactionState, options *QueueRequest) (*QueueResponse, error)

GetPendingTransactions searches for transactions with the given state. Search parameters can be specified in options. Limit is set to 100 by default

func (*Client) GetTransactions

func (c *Client) GetTransactions(ctx context.Context, options *TransactionRequest) (*TransactionsResponse, error)

GetTransactions searches for transactions on the blockchain. Search parameters can be specified in options. Limit is set to 100 by default

func (*Client) GetVotes

func (c *Client) GetVotes(ctx context.Context, options *VoterRequest) (*VotesResponse, error)

GetVotes returns the votes that a specific address has casted. Search parameters can be specified in options. Limit is set to 100 by default

func (*Client) SearchDelegates

func (c *Client) SearchDelegates(ctx context.Context, username string, listOptions *ListOptions) (*DelegatesResponse, error)

SearchDelegates fuzzy searches for Delegates by username. Limit is set to 100 by default The Account field of the delegate response does not contain a username. Use the delegate username instead

func (*Client) SendSignature

func (c *Client) SendSignature(ctx context.Context, transaction *transactions.Transaction) (*TransactionSendResponse, error)

SendSignature submits the signature for a multisignature transaction to the network.

func (*Client) SendTransaction

func (c *Client) SendTransaction(ctx context.Context, transaction *transactions.Transaction) (*TransactionSendResponse, error)

SendTransaction submits the transaction to the network.

func (*Client) SetHost

func (c *Client) SetHost(host Host)

SetHost sets the Lisk node for the client requests

func (*Client) ToggleForging

func (c *Client) ToggleForging(ctx context.Context, options *ForgingToggleRequest) (*ForgingToggleResponse, error)

ToggleForging toggles forging on a specific key.

type Config

type Config struct {
	// Host to use for API calls - can be nil when RandomHost is true.
	Host Host
	// RandomHost specifies whether a random Host from RandomHostsPool should be used.
	RandomHost bool
	// RandomHostsPool is a list of hosts from which a random one is selected on Client creation.
	RandomHostsPool []Host
	// Debug specifies whether debug logging for the API client should be activated.
	Debug bool
}

Config is the config for the Lisk API client

func (*Config) GetRandomHost

func (c *Config) GetRandomHost() Host

GetRandomHost returns a random host from RandomHostsPool

type Constants

type Constants struct {
	// Epoch of the node
	Epoch time.Time `json:"epoch"`
	// Milestone of the node
	Milestone int64 `json:"milestone,string"`
	// Build of the node
	Build string `json:"build"`
	// Commit of the node
	Commit string `json:"commit"`
	// Version of the node
	Version string `json:"version"`
	// Nethash of the node
	Nethash string `json:"nethash"`
	// Supply of the node
	Supply string `json:"supply"`
	// Reward is the blockReward of the node
	Reward LiskAmount `json:"reward,string"`
	// Nonce of the node
	Nonce string `json:"nonce"`
	// Fees of the node
	Fees *Fees `json:"fees"`
}

Constants are the constants of the node

type ConstantsResponse

type ConstantsResponse struct {
	// Constants is the result
	Constants *Constants `json:"data"`
	*GenericResponse
}

ConstantsResponse is the API response for constants requests

type Dapp

type Dapp struct {
	// TransactionID is the transactionID of the Dapp creation
	TransactionID string `json:"transactionId"`
	// Icon is the icon of the Dapp
	Icon string `json:"icon"`
	// Category is the category of the Dapp
	Category int `json:"category"`
	// Type is the type of the Dapp
	Type int `json:"type"`
	// Link is the link to the Dapp
	Link string `json:"link"`
	// Tags are the tags of the Dapp
	Tags string `json:"tags"`
	// Description is the description of the Dapp
	Description string `json:"description"`
	// Name is the name of the Dapp
	Name string `json:"name"`
}

Dapp is a Lisk Dapp

type DappRequest

type DappRequest struct {
	// TransactionID is the transactionID of the Dapp creation
	TransactionID string
	// Name is the name of the Dapp
	Name string

	ListOptions
}

DappRequest is the request body to request Dapps

type DappResponse

type DappResponse struct {
	// Dapps are the results
	Dapps []*Dapp `json:"data"`
	*GenericResponse
}

DappResponse is the API response for Dapp requests

type Delegate

type Delegate struct {
	// Username of the delegate
	Username string `json:"username"`
	// Vote amount of the delegate
	Vote int64 `json:"vote,string"`
	// Rewards of the delegate
	Rewards int `json:"rewards,string"`
	// ProducedBlocks is the number of blocks produced by the delegate
	ProducedBlocks int `json:"producedBlocks"`
	// MissedBlocks is the number of blocks missed by the delegate
	MissedBlocks int `json:"missedBlocks"`
	// Rate of the delegate
	Rate int `json:"rate"`
	// Approval percentage of the delegate
	Approval float64 `json:"approval"`
	// Productivity of the delegate
	Productivity float64 `json:"productivity"`
	// Rank of the delegate
	Rank int `json:"rank"`
	// Account of the delegate
	Account *Account `json:"account"`
}

Delegate is a delegate on the Lisk blockchain

type DelegateRequest

type DelegateRequest struct {
	// Address of the delegate
	Address string
	// PublicKey of the delegate
	PublicKey string
	// SecondPublicKey of the delegate
	SecondPublicKey string
	// Username of the delegate
	Username string
	// Rank of the delegate
	Rank string
}

DelegateRequest is the request body for a single Delegate request

type DelegateResponse

type DelegateResponse struct {
	// Delegate is the resulting delegate
	Delegate *Delegate `json:"data"`
	*GenericResponse
}

DelegateResponse is the API response for single Delegate requests

type DelegateVoterRequest

type DelegateVoterRequest VoterRequest

DelegateVoterRequest is the request body for a delegate voter request

type DelegateVoterResponse

type DelegateVoterResponse struct {
	// DelegateWithVoters is the result
	DelegateWithVoters DelegateWithVoters `json:"data"`
	*GenericResponse
}

DelegateVoterResponse is the API response for delegate voter requests

type DelegateWithSlot

type DelegateWithSlot struct {
	// Username of the delegate
	Username string `json:"username"`
	// PublicKey of the delegate
	PublicKey string `json:"publicKey"`
	// Address of the delegate
	Address string `json:"address"`
	// NextSlot of the delegate
	NextSlot int `json:"nextSlot"`
}

DelegateWithSlot is a delegate with its next forging slot

type DelegateWithVoters

type DelegateWithVoters struct {
	// Username of the delegate
	Username string `json:"username"`
	// PublicKey of the delegate
	PublicKey string `json:"publicKey,omitempty"`
	// Username of the delegate
	Votes int32 `json:"votes"`
	// Address of the delegate
	Address string `json:"address"`
	// Balance of the delegate
	Balance string `json:"balance"`
	// Voters of the delegate
	Voters []*Voter `json:"voters"`
}

DelegateWithVoters is a delegate with information on its voters

type DelegatesRequest

type DelegatesRequest struct {
	// Address of the delegate
	Address string
	// PublicKey of the delegate
	PublicKey string
	// SecondPublicKey of the delegate
	SecondPublicKey string
	// Username of the delegate
	Username string
	// Rank of the delegate
	Rank string

	ListOptions
}

DelegatesRequest is the request body to request Delegates

type DelegatesResponse

type DelegatesResponse struct {
	// Delegates are the results
	Delegates []*Delegate `json:"data"`
	*GenericResponse
}

DelegatesResponse is the API response for Delegate requests

type Error

type Error struct {
	// Message is the root error message
	Message string `json:"message"`
	// Errors contains detailed errors
	Errors []struct {
		// Code is the error code
		Code string `json:"code"`
		// Name is the name of the error
		Name string `json:"name"`
		// In is the part of the request that contains the error (e.g. body)
		In string `json:"in"`
		// Message is the detail error message
		Message string `json:"message"`
		// Errors contains deep errors
		Errors []struct {
			// Code is the error code
			Code string `json:"code"`
			// Message is the detail error message
			Message string `json:"message"`
			// Description is a human readable error description
			Description string `json:"description"`
			// Path are the body nodes which contain the error
			Path []string `json:"path"`
		} `json:"errors"`
	} `json:"errors"`
}

Error represents an API error

func (*Error) Error

func (e *Error) Error() string

Error prints API errors in a human readable format

type Fees

type Fees struct {
	// Send is the fee for a send transaction
	Send LiskAmount `json:"send,string"`
	// Vote is the fee for a vote transaction
	Vote LiskAmount `json:"vote,string"`
	// SecondSignature is the fee for a second signature registration transaction
	SecondSignature LiskAmount `json:"secondSignature,string"`
	// Delegate is the fee for a delegate registration transaction
	Delegate LiskAmount `json:"delegate,string"`
	// Multisignature is the fee for a multisignature creation/update transaction
	Multisignature LiskAmount `json:"multisignature,string"`
	// DappRegistration is the fee for a dapp creation transaction
	DappRegistration LiskAmount `json:"dappRegistration,string"`
	// DappWithdrawal is the fee for a dapp withdrawal transaction
	DappWithdrawal LiskAmount `json:"dappWithdrawal,string"`
	// DappDeposit is the fee for a dapp deposit transaction
	DappDeposit LiskAmount `json:"dappDeposit,string"`
	// Data is the additional fee for a data transaction
	Data LiskAmount `json:"data,string"`
}

Fees are the transaction fees of the blockchain

type ForgingStats

type ForgingStats struct {
	// Fees forged by the delegate
	Fees string `json:"fees"`
	// Rewards forged by the delegate
	Rewards string `json:"rewards"`
	// Forged is the total amount forged by the delegate
	Forged string `json:"forged"`
	// Count of blocks forged
	Count string `json:"count"`
}

ForgingStats are the forgingStats of a delegate

type ForgingStatsRequest

type ForgingStatsRequest struct {
	// Address of the delegate
	Address string

	// FromTimestamp is the starting point of the stats
	FromTimestamp int64
	// ToTimestamp is the ending point of the stats
	ToTimestamp int64
}

ForgingStatsRequest is the request body for a forgingStats request

type ForgingStatsResponse

type ForgingStatsResponse struct {
	// Stats is the result
	Stats ForgingStats `json:"data"`
	*GenericResponse
}

ForgingStatsResponse is the API response for forgingStats requests

type ForgingStatus

type ForgingStatus struct {
	// Forging indicates whether a node is currently forging
	Forging bool `json:"forging"`
	// PublicKey is the key the node is forging with
	PublicKey string `json:"publicKey"`
}

ForgingStatus is the forging status of a node

type ForgingStatusRequest

type ForgingStatusRequest struct {
	// PublicKey is the public key for which the status should be requested
	PublicKey string
}

ForgingStatusRequest is the request body to request the forging status of a node

type ForgingStatusResponse

type ForgingStatusResponse struct {
	// ForgingStatus are the results
	ForgingStatus []*ForgingStatus `json:"data"`
	*GenericResponse
}

ForgingStatusResponse is the API response for forging status requests

type ForgingToggleRequest

type ForgingToggleRequest struct {
	DecryptionKey string `json:"decryptionKey"`
	PublicKey     string `json:"publicKey"`
}

ForgingToggleRequest is the request body to toggle forging on a node

type ForgingToggleResponse

type ForgingToggleResponse struct {
	ForgingStatus *ForgingStatus `json:"data"`
	*GenericResponse
}

ForgingToggleResponse is the API response for forging toggle requests

type GenericResponse

type GenericResponse struct {
	// Meta is meta information of the response
	Meta interface{} `json:"meta"`
	// Links is a currently unused field
	Links interface{} `json:"links"`
}

GenericResponse specifies the generic meta fields of an API response

type Host

type Host struct {
	// Hostname is the hostname/IP of the Lisk Node to connect to.
	Hostname string
	// Port is the port used by the Lisk node.
	Port int
	// Secure specifies whether https should be used.
	Secure bool
}

Host is a Lisk Node

func (Host) GetHostURL

func (h Host) GetHostURL() string

GetHostURL composes a URL from the host details

type LiskAmount

type LiskAmount int64

LiskAmount is an amount of Lisk

type ListOptions

type ListOptions struct {
	// Limit is the amount of results requested
	Limit int
	// Offset is the offset from the first item from which on results should be returned
	Offset int
	// Sort is the mode in which results should be sorted
	Sort SortMode
}

ListOptions are options which are used for pagination

type NextForgersResponse

type NextForgersResponse struct {
	// NextForgers are the results
	NextForgers []*DelegateWithSlot `json:"data"`
	*GenericResponse
}

NextForgersResponse is the API response for the next forger request

type NodeStatus

type NodeStatus struct {
	// Broadhash of the node
	Broadhash string `json:"broadhash"`
	// Consensus status of the node
	Consensus int `json:"consensus"`
	// Height is the current height of the node
	Height int `json:"height"`
	// Loaded indicates whether the blockchain loading is finished
	Loaded bool `json:"loaded"`
	// NetworkHeight is the network height
	NetworkHeight int `json:"networkHeight"`
	// Syncing indicates whether the node is currently syncing the blockchain
	Syncing bool `json:"syncing"`
	// Transactions is information on the (pending) transactions
	Transactions struct {
		// Unconfirmed is the number of unconfirmed transactions in the pool
		Unconfirmed int `json:"unconfirmed"`
		// Unsigned is the number of unsigned transactions in the pool
		Unsigned int `json:"unsigned"`
		// Unprocessed is the number of unprocessed transactions in the pool
		Unprocessed int `json:"unprocessed"`
		// Confirmed is the number of confirmed transactions
		Confirmed int `json:"confirmed"`
		// Total is the total number of transactions
		Total int `json:"total"`
	} `json:"transactions"`
}

NodeStatus is the status of a node

type NodeStatusReponse

type NodeStatusReponse struct {
	// NodeStatus is the result
	NodeStatus *NodeStatus `json:"data"`
	*GenericResponse
}

NodeStatusReponse is the API response for node status requests

type Peer

type Peer struct {
	// IP of the peer
	IP string `json:"ip"`
	// HTTPPort of the peer
	HTTPPort int `json:"httpPort"`
	// WSPort of the peer
	WSPort int `json:"wsPort"`
	// OS of the peer
	OS string `json:"os"`
	// Version of the peer
	Version string `json:"version"`
	// State of the peer
	State int `json:"state"`
	// Height of the peer
	Height int64 `json:"height"`
	// Broadhash of the peer
	Broadhash string `json:"broadhash"`
	// Nonce of the peer
	Nonce string `json:"nonce"`
}

Peer is a peer the node is connected to

type PeerRequest

type PeerRequest struct {
	// IP of the peer
	IP string
	// HTTPPort of the peer
	HTTPPort *int
	// WSPort of the peer
	WSPort *int
	// OS of the peer
	OS string
	// Version of the peer
	Version string
	// State of the peer
	State *int
	// Height of the peer
	Height *int64
	// Broadhash of the peer
	Broadhash string

	ListOptions
}

PeerRequest is the request body for a peer request

type PeerResponse

type PeerResponse struct {
	// Peers are the results
	Peers []*Peer `json:"data"`
	*GenericResponse
}

PeerResponse is the API response for peer requests

type QueueRequest

type QueueRequest struct {
	// ID of the transaction in the queue
	ID string
	// RecipientID of the transaction in the queue
	RecipientID string
	// RecipientPublicKey of the transaction in the queue
	RecipientPublicKey string
	// SenderID of the transaction in the queue
	SenderID string
	// SenderPublicKey of the transaction in the queue
	SenderPublicKey string
	// Type of the transaction in the queue
	Type *int

	ListOptions
}

QueueRequest is the request body for a transaction queue request

type QueueResponse

type QueueResponse struct {
	// Transactions are the results
	Transactions []*Transaction `json:"data"`
	*GenericResponse
}

QueueResponse is the API response for transaction queue requests

type SignatureSendResponse

type SignatureSendResponse struct {
	Result struct {
		Message string `json:"message"`
	} `json:"data"`
	*GenericResponse
}

SignatureSendResponse is the API response for signature requests

type SortMode

type SortMode string

SortMode specifies how results are sorted

const (
	// SortModeAscending is the raw SortMode for ascending sorting
	SortModeAscending SortMode = "ASC"
	// SortModeDescending is the raw SortMode for descending sorting
	SortModeDescending SortMode = "DESC"
)

type Transaction

type Transaction struct {
	// ID of the transaction
	ID string `json:"id"`
	// Amount of the transaction
	Amount string `json:"amount"`
	// Fee of the transaction
	Fee string `json:"fee"`
	// Type of the transaction
	Type int `json:"type"`
	// Height of the transaction
	Height int `json:"height"`
	// BlockID of the transaction
	BlockID string `json:"blockId"`
	// Timestamp of the transaction
	Timestamp int `json:"timestamp"`
	// SenderID of the transaction
	SenderID string `json:"senderId"`
	// SenderPublicKey of the transaction
	SenderPublicKey string `json:"senderPublicKey"`
	// SenderSecondPublicKey of the transaction
	SenderSecondPublicKey string `json:"senderSecondPublicKey"`
	// RecipientID of the transaction
	RecipientID string `json:"recipientId"`
	// RecipientPublicKey of the transaction
	RecipientPublicKey string `json:"recipientPublicKey"`
	// Signature of the transaction
	Signature string `json:"signature"`
	// SignSignature of the transaction
	SignSignature string `json:"signSignature"`
	// Multisignatures of the transaction
	Multisignatures []string `json:"signatures"`
	// Confirmations of the transaction
	Confirmations int `json:"confirmations"`
	// Asset of the transaction
	Asset struct{} `json:"asset"`
	// ReceivedAt timestamp of the transaction
	ReceivedAt time.Time `json:"receivedAt"`
	// Relays is the number of times the transaction was relayed
	Relays int `json:"relays"`
	// Ready status of the transaction
	Ready bool `json:"ready"`
}

Transaction is a transaction in the pool or on the blockchain

type TransactionRequest

type TransactionRequest struct {
	// ID of the transaction
	ID string
	// RecipientID of the transaction
	RecipientID string
	// RecipientPublicKey of the transaction
	RecipientPublicKey string
	// SenderID of the transaction
	SenderID string
	// SenderPublicKey of the transaction
	SenderPublicKey string
	// BlockID of the transaction
	BlockID string
	// Type of the transaction
	Type *int
	// Height of the transaction
	Height *int64
	// MinAmount of the transaction
	MinAmount *int64
	// MaxAmount of the transaction
	MaxAmount *int64

	// FromTimestamp only returns transactions after this time
	FromTimestamp int64
	// ToTimestamp only returns transactions before this time
	ToTimestamp int64
	ListOptions
}

TransactionRequest is the request body for a transaction request

type TransactionSendResponse

type TransactionSendResponse struct {
	// Result is the result status
	Result struct {
		Message string `json:"message"`
	} `json:"data"`
	*GenericResponse
}

TransactionSendResponse is the API response for transaction send requests

type TransactionState

type TransactionState string

TransactionState is the state of a transaction in the queue

const (
	// TransactionStateUnprocessed is the state of a transaction the was not processed yet
	TransactionStateUnprocessed TransactionState = "unprocessed"
	// TransactionStateUnconfirmed is the state of a transaction the was not confirmed yet
	TransactionStateUnconfirmed TransactionState = "unconfirmed"
	// TransactionStateUnsigned is the state of a transaction that is missing signatures
	TransactionStateUnsigned TransactionState = "unsigned"
)

type TransactionsResponse

type TransactionsResponse struct {
	// Transactions are the results
	Transactions []*Transaction `json:"data"`
	*GenericResponse
}

TransactionsResponse is the API response for transaction requests

type Voter

type Voter struct {
	// Address of the voter
	Address string `json:"address"`
	// PublicKey of the voter
	PublicKey string `json:"publicKey"`
	// Balance of the voter
	Balance int64 `json:"balance"`
}

Voter is the detail information for a voter

type VoterRequest

type VoterRequest struct {
	// Address of the voter
	Address string
	// PublicKey of the voter
	PublicKey string
	// SecondPublicKey of the voter
	SecondPublicKey string
	// Username of the voter
	Username string

	ListOptions
}

VoterRequest is the request body for a voter request

type VotesData

type VotesData struct {
	// Address of the voter
	Address string `json:"address"`
	// Balance of the voter
	Balance int64 `json:"balance"`
	// Username of the voter
	Username string `json:"username"`
	// PublicKey of the voter
	PublicKey string `json:"publicKey"`
	// VotesUsed is the number of votes used
	VotesUsed int `json:"votesUsed"`
	// VotesAvailable is the number of votes available
	VotesAvailable int `json:"votesAvailable"`
	// Votes are the votes of the voter
	Votes []struct {
		// Address of the delegate
		Address string `json:"address"`
		// PublicKey of the delegate
		PublicKey string `json:"publicKey"`
		// Balance of the delegate
		Balance int64 `json:"balance"`
		// Username of the delegate
		Username string `json:"username"`
	} `json:"votes"`
}

VotesData is detailed information on a users votes

type VotesResponse

type VotesResponse struct {
	// VoteData is the result
	VoteData VotesData
	*GenericResponse
}

VotesResponse is the API response for voter requests

Jump to

Keyboard shortcuts

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