RPCClient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadAddress = errors.New("Bad account number")
View Source
var ErrEmpty = errors.New("empty")
View Source
var ErrNotOpenedAccount = errors.New("Account not found")

Functions

func GetBlockByFile

func GetBlockByFile(c rpctypes.Connection, filekey Wallet.PublicKey, pubkey Wallet.PublicKey) (resp nanofytypes.Response, err error)

func GetBlockByHash

func GetBlockByHash(c rpctypes.Connection, hash []byte) (Block.UniversalBlock, error)

func GetBlockByStringHash

func GetBlockByStringHash(c rpctypes.Connection, hash string) (Block.UniversalBlock, error)

func NewBlockByStringHash

func NewBlockByStringHash(hash string) (req internal.RetrieveBlockRequest)

func StartWebsocket

func StartWebsocket() error

Types

type AccountBalance

type AccountBalance struct {
	Balance *Numbers.RawAmount
	Pending *Numbers.RawAmount
}

func GetAccountBalance

func GetAccountBalance(c rpctypes.Connection, addr Wallet.Address) (AccountBalance, error)

GetAccountBalance will retrieve the amount and pending from given account address. It will return an non-nil error if can't reach the server or the address is invalid.

type AccountBalances

type AccountBalances struct {
	Balances map[Wallet.Address]AccountBalance
	DefaultResponse
}

type AccountHistory

type AccountHistory []SingleHistory

func GetAccountHistory

func GetAccountHistory(c rpctypes.Connection, limit int, addr Wallet.Address) (resp AccountHistory, err error)

GetAccountHistory will retrieve all the history (Send/Receive) from given account address. It will return an non-nil error if can't reach the server or the address is not opened, not having an "OpenBlock".

func (*AccountHistory) UnmarshalJSON

func (d *AccountHistory) UnmarshalJSON(data []byte) (err error)

type AccountHistoryRequest

type AccountHistoryRequest struct {
	Account Wallet.Address `json:"account"`
	Count   int            `json:"count"`
	DefaultRequest
}

func NewAccountHistory

func NewAccountHistory(limit int, addr Wallet.Address) AccountHistoryRequest

type AccountInformation

type AccountInformation struct {
	Frontier            Block.BlockHash    `json:"frontier"`
	OpenBlock           Block.BlockHash    `json:"open_block"`
	RepresentativeBlock Block.BlockHash    `json:"representative_block"`
	Balance             *Numbers.RawAmount `json:"balance"`
	BlockCount          uint64             `json:"block_count,string"`
	Pending             *Numbers.RawAmount `json:"pending,omitempty"`
	DefaultResponse
}

func GetAccountInformation

func GetAccountInformation(c rpctypes.Connection, addr Wallet.Address) (AccountInformation, error)

type AccountInformationRequest

type AccountInformationRequest struct {
	Account Wallet.Address `json:"account"`
	Weight  bool           `json:"weight,omitempty"`
	Pending bool           `json:"pending,omitempty"`
	DefaultRequest
}

func NewAccountInformation

func NewAccountInformation(addr Wallet.Address) AccountInformationRequest

type AccountPending

type AccountPending []SinglePending

func GetAccountPending

func GetAccountPending(c rpctypes.Connection, limit int, minimum *Numbers.RawAmount, addr Wallet.Address) (AccountPending, error)

type AccountsBalancesRequest

type AccountsBalancesRequest struct {
	Accounts []Wallet.Address `json:"accounts"`
	DefaultRequest
}

func NewAccountBalance

func NewAccountBalance(addr Wallet.Address) AccountsBalancesRequest

@TODO Use custom UnmarshalJSON/MarshalJSON and rewrite the entire code.

func NewMultiAccountsBalance

func NewMultiAccountsBalance(addr ...Wallet.Address) AccountsBalancesRequest

type AccountsPendingOriginal

type AccountsPendingOriginal map[string]SinglePending

func (*AccountsPendingOriginal) UnmarshalJSON

func (d *AccountsPendingOriginal) UnmarshalJSON(data []byte) (err error)

type AccountsPendingRequest

type AccountsPendingRequest struct {
	Accounts  []Wallet.Address   `json:"accounts"`
	Count     int                `json:"count"`
	Threshold *Numbers.RawAmount `json:"threshold"`
	Source    bool               `json:"source"`
	DefaultRequest
}

func NewAccountPending

func NewAccountPending(limit int, minimum *Numbers.RawAmount, addr Wallet.Address) AccountsPendingRequest

func NewMultiAccountsPending

func NewMultiAccountsPending(limit int, minimum *Numbers.RawAmount, addr ...Wallet.Address) AccountsPendingRequest

type DefaultRequest

type DefaultRequest struct {
	Action string `json:"action"`
	App    string `json:"app,omitempty"`
}

type DefaultResponse

type DefaultResponse struct {
	Error string `json:"error,omitempty"`
}

type MultiplesAccountsBalance

type MultiplesAccountsBalance map[Wallet.Address]AccountBalance

func GetMultiAccountsBalance

func GetMultiAccountsBalance(c rpctypes.Connection, addr ...Wallet.Address) (MultiplesAccountsBalance, error)

GetMultiAccountsBalance will do the same from GetAccountBalance but will return an map, the index of the map will the address. Each value from the map is the respective balance/amount.

type MultiplesAccountsPending

type MultiplesAccountsPending map[Wallet.Address]AccountPending

func GetMultiAccountsPending

func GetMultiAccountsPending(c rpctypes.Connection, limit int, minimum *Numbers.RawAmount, addr ...Wallet.Address) (MultiplesAccountsPending, error)

type ProcessBlock

type ProcessBlock struct {
	Hash Block.BlockHash
}

func BroadcastBlock

func BroadcastBlock(c rpctypes.Connection, block Block.BlockTransaction) (resp ProcessBlock, err error)

BroadcastBlock will perform the PoW and broadcast the block to the network

type RetrieveBlock

type RetrieveBlock struct {
	Block Block.BlockTransaction
}

type SingleHistory

type SingleHistory struct {
	Hash    Block.BlockHash    `json:"hash"`
	Type    string             `json:"type"`
	Account Wallet.Address     `json:"account"`
	Amount  *Numbers.RawAmount `json:"amount"`
}

type SinglePending

type SinglePending struct {
	Hash   Block.BlockHash
	Amount *Numbers.RawAmount
	Source Wallet.Address
	DefaultResponse
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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