client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 12 Imported by: 15 modules, 30 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoApiKeyError = errors.New("no api key provided")

Functions

This section is empty.

Types

type Addresses

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

func NewAddresses

func NewAddresses(options Options) *Addresses

func (*Addresses) Addresses

func (a *Addresses) Addresses(ctx context.Context) ([]proto.Address, *Response, error)

func (*Addresses) Balance

func (a *Addresses) Balance(ctx context.Context, address proto.Address) (*AddressesBalance, *Response, error)

func (*Addresses) BalanceAfterConfirmations

func (a *Addresses) BalanceAfterConfirmations(
	ctx context.Context, address proto.Address, confirmations uint64) (*BalanceAfterConfirmations, *Response, error)

func (*Addresses) BalanceDetails

func (a *Addresses) BalanceDetails(ctx context.Context, address proto.Address) (*AddressesBalanceDetails, *Response, error)

func (*Addresses) EffectiveBalance

func (a *Addresses) EffectiveBalance(ctx context.Context, address proto.Address) (*AddressesEffectiveBalance, *Response, error)

func (*Addresses) PublicKey

func (a *Addresses) PublicKey(ctx context.Context, publicKey string) (*AddressesPublicKey, *Response, error)

func (*Addresses) ScriptInfo

func (a *Addresses) ScriptInfo(ctx context.Context, address proto.Address) (*AddressesScriptInfo, *Response, error)

func (*Addresses) SignText

func (a *Addresses) SignText(ctx context.Context, address proto.Address, message string) (*AddressesSignText, *Response, error)

func (*Addresses) Validate

func (a *Addresses) Validate(ctx context.Context, address proto.Address) (*AddressesValidate, *Response, error)

func (*Addresses) VerifyText

func (a *Addresses) VerifyText(ctx context.Context, address proto.Address, body VerifyTextReq) (bool, *Response, error)

type AddressesBalance

type AddressesBalance struct {
	Address       proto.Address `json:"address"`
	Confirmations uint64        `json:"confirmations"`
	Balance       uint64        `json:"balance"`
}

type AddressesBalanceDetails

type AddressesBalanceDetails struct {
	Address    proto.Address `json:"address"`
	Regular    uint64        `json:"regular"`
	Generating uint64        `json:"generating"`
	Available  uint64        `json:"available"`
	Effective  uint64        `json:"effective"`
}

type AddressesEffectiveBalance

type AddressesEffectiveBalance struct {
	Address       proto.Address `json:"address"`
	Confirmations uint64        `json:"confirmations"`
	Balance       uint64        `json:"balance"`
}

type AddressesPublicKey

type AddressesPublicKey struct {
	Address proto.Address `json:"address"`
}

type AddressesScriptInfo

type AddressesScriptInfo struct {
	Address    proto.Address `json:"address"`
	Complexity uint64        `json:"complexity"`
	ExtraFee   uint64        `json:"extra_fee"`
}

type AddressesSignText

type AddressesSignText struct {
	Message   string `json:"message"`
	PublicKey string `json:"publicKey"`
	Signature string `json:"signature"`
}

type AddressesValidate

type AddressesValidate struct {
	Address proto.Address `json:"address"`
	Valid   bool          `json:"valid"`
}

type Alias

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

func NewAlias

func NewAlias(options Options) *Alias

func (*Alias) Broadcast

func (a *Alias) Broadcast(ctx context.Context, broadcastReq AliasBroadcastReq) (*CreateAliasV1, *Response, error)

func (*Alias) Create

func (a *Alias) Create(ctx context.Context, createReq AliasCreateReq) (*CreateAliasV1, *Response, error)

func (*Alias) Get

func (a *Alias) Get(ctx context.Context, alias string) (proto.Address, *Response, error)

func (*Alias) GetByAddress

func (a *Alias) GetByAddress(ctx context.Context, address proto.Address) ([]*proto.Alias, *Response, error)

type AliasBroadcastReq

type AliasBroadcastReq struct {
	SenderPublicKey crypto.PublicKey `json:"senderPublicKey"`
	Fee             uint64           `json:"fee"`
	Timestamp       Timestamp        `json:"timestamp"`
	Signature       crypto.Signature `json:"signature"`
	Alias           string           `json:"alias"`
}

type AliasCreateReq

type AliasCreateReq struct {
	Sender    proto.Address `json:"sender"`
	Alias     string        `json:"alias"`
	Fee       uint64        `json:"fee"`
	Timestamp uint64        `json:"timestamp,omitempty"`
}

type BalanceAfterConfirmations

type BalanceAfterConfirmations struct {
	Address       proto.Address `json:"address"`
	Confirmations uint64        `json:"confirmations"`
	Balance       uint64        `json:"balance"`
}

type Block

type Block struct {
	Version          uint64       `json:"version"`
	Timestamp        uint64       `json:"timestamp"`
	Reference        string       `json:"reference"`
	NxtConsensus     NxtConsensus `json:"nxt-consensus"`
	Features         []uint64     `json:"features"`
	Generator        string       `json:"generator"`
	Signature        string       `json:"signature"`
	Blocksize        uint64       `json:"blocksize"`
	TransactionCount uint64       `json:"transactionCount"`
	Fee              uint64       `json:"fee"`
	Height           uint64       `json:"height"`
}

type Blocks

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

func NewBlocks

func NewBlocks(options Options) *Blocks

func (*Blocks) HeadersAt

func (a *Blocks) HeadersAt(ctx context.Context, height uint64) (*Headers, *Response, error)

func (*Blocks) HeadersLast

func (a *Blocks) HeadersLast(ctx context.Context) (*Headers, *Response, error)

func (*Blocks) HeadersSeq

func (a *Blocks) HeadersSeq(ctx context.Context, from uint64, to uint64) ([]*Headers, *Response, error)

func (*Blocks) Height

func (a *Blocks) Height(ctx context.Context) (*BlocksHeight, *Response, error)

func (*Blocks) HeightBySignature

func (a *Blocks) HeightBySignature(ctx context.Context, signature string) (*BlocksHeight, *Response, error)

type BlocksHeight

type BlocksHeight struct {
	Height uint64 `json:"height"`
}

type Client

type Client struct {
	Addresses *Addresses
	Blocks    *Blocks
	Wallet    *Wallet
	Alias     *Alias
	Peers     *Peers
	Consensus *Consensus
	// contains filtered or unexported fields
}

func NewClient

func NewClient(options ...Options) (*Client, error)

Creates new client instance If no options provided will use default

func (*Client) Do

func (a *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

func (Client) GetOptions

func (a Client) GetOptions() Options

type Consensus

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

func NewConsensus

func NewConsensus(options Options) *Consensus

creates new consensus api section

func (*Consensus) Algo

func (a *Consensus) Algo(ctx context.Context) (string, *Response, error)

Shows which consensus algo being using

func (*Consensus) BaseTarget

func (a *Consensus) BaseTarget(ctx context.Context) (*ConsensusBaseTarget, *Response, error)

Base target of a last block

func (*Consensus) BaseTargetByBlock

func (a *Consensus) BaseTargetByBlock(ctx context.Context, blockID string) (uint64, *Response, error)

Base target of a block with specified id

func (Consensus) GeneratingBalance

func (a Consensus) GeneratingBalance(ctx context.Context, address proto.Address) (*ConsensusGeneratingBalance, *Response, error)

Account's generating balance(the same as balance atm)

func (*Consensus) GenerationSignature

func (a *Consensus) GenerationSignature(ctx context.Context) (string, *Response, error)

Generation signature of a last block

func (*Consensus) GenerationSignatureByBlock

func (a *Consensus) GenerationSignatureByBlock(ctx context.Context, blockID string) (string, *Response, error)

Generation signature of a block with specified id

type ConsensusBaseTarget

type ConsensusBaseTarget struct {
	BaseTarget uint64 `json:"baseTarget"`
	Score      string `json:"score"`
}

type ConsensusGeneratingBalance

type ConsensusGeneratingBalance struct {
	Address proto.Address `json:"address"`
	Balance uint64        `json:"balance"`
}

type CreateAliasV1

type CreateAliasV1 struct {
	Type      proto.TransactionType `json:"type"`
	Version   byte                  `json:"version,omitempty"`
	ID        *crypto.Digest        `json:"id,omitempty"`
	Signature *crypto.Signature     `json:"signature,omitempty"`
	SenderPK  crypto.PublicKey      `json:"senderPublicKey"`
	Alias     string                `json:"alias"`
	Fee       uint64                `json:"fee"`
	Timestamp Timestamp             `json:"timestamp,omitempty"`
}

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

type Headers

type Headers struct {
	Version          uint64       `json:"version"`
	Timestamp        uint64       `json:"timestamp"`
	Reference        string       `json:"reference"`
	NxtConsensus     NxtConsensus `json:"nxt-consensus"`
	Features         []uint64     `json:"features"`
	Generator        string       `json:"generator"`
	Signature        string       `json:"signature"`
	Blocksize        uint64       `json:"blocksize"`
	TransactionCount uint64       `json:"transactionCount"`
	Height           uint64       `json:"height"`
}

type HttpClient

type HttpClient interface {
}

type NxtConsensus

type NxtConsensus struct {
	BaseTarget          uint64 `json:"base-target"`
	GenerationSignature string `json:"generation-signature"`
}

type Options

type Options struct {
	BaseUrl string
	Client  Doer
	ApiKey  string
}

type ParseError

type ParseError struct {
	Err error
}

func (ParseError) Error

func (a ParseError) Error() string

type PeerAllRow

type PeerAllRow struct {
	Address  proto.PeerInfo
	LastSeen Timestamp `json:"lastSeen"`
}

type Peers

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

func NewPeers

func NewPeers(options Options) *Peers

func (*Peers) All

func (a *Peers) All(ctx context.Context) ([]*PeerAllRow, *Response, error)

func (*Peers) Blacklisted

func (a *Peers) Blacklisted(ctx context.Context) ([]*PeersBlacklistedRow, *Response, error)

func (*Peers) ClearBlacklist

func (a *Peers) ClearBlacklist(ctx context.Context) (string, *Response, error)

func (*Peers) Connect

func (a *Peers) Connect(ctx context.Context, host string, port uint16) (*PeersConnect, *Response, error)

func (*Peers) Connected

func (a *Peers) Connected(ctx context.Context) ([]*PeersConnectedRow, *Response, error)

func (*Peers) Suspended

func (a *Peers) Suspended(ctx context.Context) ([]*PeersSuspendedRow, *Response, error)

type PeersBlacklistedRow

type PeersBlacklistedRow struct {
	Hostname  proto.PeerInfo `json:"hostname"`
	Timestamp Timestamp      `json:"timestamp"`
	Reason    string         `json:"reason"`
}

type PeersConnect

type PeersConnect struct {
	Hostname string `json:"hostname"`
	Status   string `json:"status"`
}

type PeersConnectedRow

type PeersConnectedRow struct {
	Address            proto.PeerInfo `json:"address"`
	DeclaredAddress    proto.PeerInfo `json:"declaredAddress"`
	PeerName           string         `json:"peerName"`
	PeerNonce          uint64         `json:"peerNonce"`
	ApplicationName    string         `json:"applicationName"`
	ApplicationVersion string         `json:"applicationVersion"`
}

type PeersSuspendedRow

type PeersSuspendedRow struct {
	Hostname  proto.PeerInfo `json:"hostname"`
	Timestamp Timestamp      `json:"timestamp"`
}

type RequestError

type RequestError struct {
	Err  error
	Body string
}

func (*RequestError) Error

func (a *RequestError) Error() string

type Response

type Response struct {
	*http.Response
}

type Timestamp

type Timestamp uint64

timestamp in milliseconds

func NewTimestampFromTime

func NewTimestampFromTime(t time.Time) Timestamp

func NewTimestampFromUnixNano

func NewTimestampFromUnixNano(nano int64) Timestamp

type VerifyText

type VerifyText struct {
	Valid bool
}

type VerifyTextReq

type VerifyTextReq struct {
	Message   string `json:"message"`
	PublicKey string `json:"publickey"`
	Signature string `json:"signature"`
}

type Wallet

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

func NewWallet

func NewWallet(options Options) *Wallet

func (*Wallet) Seed

func (a *Wallet) Seed(ctx context.Context) (string, *Response, error)

Jump to

Keyboard shortcuts

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