client

package
v0.0.0-...-345d297 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Id            string         `json:"id,omitempty"`
	Version       byte           `json:"version,omitempty"`
	Height        int64          `json:"height,omitempty"`
	Previous      string         `json:"previous,omitempty"`
	Forged        BlockForged    `json:"forged,omitempty"`
	Payload       BlockPayload   `json:"payload,omitempty"`
	Generator     BlockGenerator `json:"generator,omitempty"`
	Signature     string         `json:"signature,omitempty"`
	Confirmations uint32         `json:"confirmations,omitempty"`
	Transactions  byte           `json:"transactions,omitempty"`
	Timestamp     Timestamp      `json:"timestamp,omitempty"`
}

type BlockForged

type BlockForged struct {
	Reward uint64 `json:"reward,omitempty,string"`
	Fee    uint64 `json:"fee,omitempty,string"`
	Total  uint64 `json:"total,omitempty,string"`
	Amount uint64 `json:"amount,omitempty,string"`
}

type BlockGenerator

type BlockGenerator struct {
	Username  string `json:"username,omitempty"`
	Address   string `json:"address,omitempty"`
	PublicKey string `json:"publicKey,omitempty"`
}

type BlockPayload

type BlockPayload struct {
	Hash   string `json:"hash,omitempty"`
	Length uint32 `json:"length,omitempty"`
}

type Blocks

type Blocks struct {
	Meta Meta    `json:"meta,omitempty"`
	Data []Block `json:"data,omitempty"`
}

type BlocksService

type BlocksService Service

BlocksService handles communication with the blocks related methods of the Ark Core API - Version 2.

func (*BlocksService) First

func (s *BlocksService) First(ctx context.Context) (*GetBlock, *http.Response, error)

Get the first block.

func (*BlocksService) Get

func (s *BlocksService) Get(ctx context.Context, id int64) (*GetBlock, *http.Response, error)

Get a block by the given id.

func (*BlocksService) Last

Get the last block.

func (*BlocksService) List

func (s *BlocksService) List(ctx context.Context, query *Pagination) (*Blocks, *http.Response, error)

Get all blocks.

func (*BlocksService) Transactions

func (s *BlocksService) Transactions(ctx context.Context, id int64, query *Pagination) (*GetBlockTransactions, *http.Response, error)

Get all transactions by the given block.

type ClaimAsset

type ClaimAsset struct {
	LockTransactionId string `json:"lockTransactionId,omitempty"`
	UnlockSecret      string `json:"unlockSecret,omitempty"`
}

type Client

type Client struct {
	BaseURL *url.URL

	Blocks       *BlocksService
	Delegates    *DelegatesService
	Locks        *LocksService
	Node         *NodeService
	Peers        *PeersService
	Rounds       *RoundsService
	Transactions *TransactionsService
	Votes        *VotesService
	Wallets      *WalletsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) SendRequest

func (c *Client) SendRequest(ctx context.Context, method string, urlStr string, queryString interface{}, body interface{}, model interface{}) (*http.Response, error)

type CreateTransaction

type CreateTransaction struct {
	Accept  []string `json:"accept,omitempty"`
	Excess  []string `json:"excess,omitempty"`
	Invalid []string `json:"invalid,omitempty"`
}

type CreateTransactionRequest

type CreateTransactionRequest struct {
	Transactions []Transaction `json:"transactions,omitempty"`
}

type Delegate

type Delegate struct {
	Username   string             `json:"username,omitempty"`
	Address    string             `json:"address,omitempty"`
	PublicKey  string             `json:"publicKey,omitempty"`
	Votes      int64              `json:"votes,omitempty"`
	Rank       byte               `json:"rank,omitempty"`
	Blocks     DelegateBlocks     `json:"blocks,omitempty"`
	Production DelegateProduction `json:"production,omitempty"`
	Forged     DelegateForged     `json:"forged,omitempty"`
}

type DelegateAsset

type DelegateAsset struct {
	Username string `json:"username,omitempty"`
}

type DelegateBlocks

type DelegateBlocks struct {
	Produced uint32 `json:"produced,omitempty"`
	Missed   uint32 `json:"missed,omitempty"`
	Last     Block  `json:"last,omitempty"`
}

type DelegateForged

type DelegateForged struct {
	Fees    uint64 `json:"fees,omitempty,string"`
	Rewards uint64 `json:"rewards,omitempty,string"`
	Total   uint64 `json:"total,omitempty,string"`
}

type DelegateProduction

type DelegateProduction struct {
	Approval float64 `json:"approval,omitempty"`
}

type Delegates

type Delegates struct {
	Meta Meta       `json:"meta,omitempty"`
	Data []Delegate `json:"data,omitempty"`
}

type DelegatesService

type DelegatesService Service

DelegatesService handles communication with the delegates related methods of the Ark Core API - Version 2.

func (*DelegatesService) Blocks

Get all blocks for the given delegate.

func (*DelegatesService) Get

Get a delegate by the given ID. (address, publicKey and username are valid)

func (*DelegatesService) List

Get all accounts.

func (*DelegatesService) Voters

Get all voters for the given delegate.

type DynamicFees

type DynamicFees struct {
	Enabled         bool     `json:"enabled,omitempty"`
	MinFeePool      int16    `json:"minFeePool,omitempty"`
	MinFeeBroadcast int16    `json:"minFeeBroadcast,omitempty"`
	AddonBytes      FeeTypes `json:"addonBytes,omitempty"`
}

type FeeStatistic

type FeeStatistic struct {
	Type   int16  `json:"type,omitempty"`
	MinFee uint32 `json:"min,omitempty,string"`
	MaxFee uint32 `json:"max,omitempty,string"`
	AvgFee uint32 `json:"avg,omitempty,string"`
	SumFee uint32 `json:"sum,omitempty,string"`
	MdnFee uint32 `json:"median,omitempty,string"`
}

type FeeTypes

type FeeTypes struct {
	Transfer             uint32 `json:"transfer,omitempty"`
	SecondSignature      uint32 `json:"secondSignature,omitempty"`
	DelegateRegistration uint32 `json:"delegateRegistration,omitempty"`
	Vote                 uint32 `json:"vote,omitempty"`
	MultiSignature       uint32 `json:"multiSignature,omitempty"`
	Ipfs                 uint32 `json:"ipfs,omitempty"`
	MultiPayment         uint32 `json:"multiPayment,omitempty"`
	DelegateResignation  uint32 `json:"delegateResignation,omitempty"`
	HtlcLock             uint32 `json:"htlcLock,omitempty"`
	HtlcClaim            uint32 `json:"htlcClaim,omitempty"`
	HtlcRefund           uint32 `json:"htlcRefund,omitempty"`
}

type FeesRequest

type FeesRequest struct {
	Days int `url:"days"`
}

type FromTo

type FromTo struct {
	From interface{} `json:"from,omitempty"`
	To   interface{} `json:"from,omitempty"`
}

type GetBlock

type GetBlock struct {
	Data Block `json:"data,omitempty"`
}

type GetBlockTransactions

type GetBlockTransactions struct {
	Meta Meta          `json:"meta,omitempty"`
	Data []Transaction `json:"data,omitempty"`
}

type GetCreateTransaction

type GetCreateTransaction struct {
	Data CreateTransaction `json:"data,omitempty"`
}

type GetDelegate

type GetDelegate struct {
	Meta Meta     `json:"meta,omitempty"`
	Data Delegate `json:"data,omitempty"`
}

type GetDelegateBlocks

type GetDelegateBlocks struct {
	Meta Meta    `json:"meta,omitempty"`
	Data []Block `json:"data,omitempty"`
}

type GetDelegateVoters

type GetDelegateVoters struct {
	Meta Meta     `json:"meta,omitempty"`
	Data []Wallet `json:"data,omitempty"`
}

type GetDelegates

type GetDelegates struct {
	Data []RoundDelegate `json:"data,omitempty"`
}

type GetLock

type GetLock struct {
	Data Lock `json:"data,omitempty"`
}

type GetNodeConfiguration

type GetNodeConfiguration struct {
	Data NodeConfiguration `json:"data,omitempty"`
}

type GetNodeFees

type GetNodeFees struct {
	Data NodeFees `json:"data,omitempty"`
}

type GetNodeStatus

type GetNodeStatus struct {
	Data NodeStatus `json:"data,omitempty"`
}

type GetNodeSyncing

type GetNodeSyncing struct {
	Data NodeSyncing `json:"data,omitempty"`
}

type GetPeer

type GetPeer struct {
	Meta Meta `json:"meta,omitempty"`
	Data Peer `json:"data,omitempty"`
}

type GetTransaction

type GetTransaction struct {
	Data Transaction `json:"data,omitempty"`
}

type GetWallet

type GetWallet struct {
	Data Wallet `json:"data,omitempty"`
}

type IpfsAsset

type IpfsAsset struct {
	Dag string `json:"dag,omitempty"`
}

type Lock

type Lock struct {
	LockId          string    `json:"lockId,omitempty"`
	Amount          uint64    `json:"amount,omitempty,string"`
	SecretHash      string    `json:"secretHash,omitempty"`
	SenderPublicKey string    `json:"senderPublicKey,omitempty"`
	RecipientId     string    `json:"recipientId,omitempty"`
	Timestamp       Timestamp `json:"timestamp,omitempty"`
	ExpirationType  byte      `json:"expirationType,omitempty"`
	ExpirationValue uint32    `json:"expirationValue,omitempty"`
	VendorField     string    `json:"vendorField,omitempty"`
	IsExpired       bool      `json:"isExpired,omitempty"`
}

type Locks

type Locks struct {
	Meta Meta   `json:"meta,omitempty"`
	Data []Lock `json:"data,omitempty"`
}

type LocksService

type LocksService Service

LocksService handles communication with the locks related methods of the Ark Core API - Version 2.

func (*LocksService) Get

func (s *LocksService) Get(ctx context.Context, id string) (*GetLock, *http.Response, error)

Get a lock by the given id.

func (*LocksService) List

func (s *LocksService) List(ctx context.Context, query *Pagination) (*Locks, *http.Response, error)

Get all locks.

func (*LocksService) Unlocked

Retrieve transactions by the given lock ids.

type LocksUnlockedRequest

type LocksUnlockedRequest struct {
	Ids []string `json:"ids,omitempty"`
}

type Meta

type Meta struct {
	Count      uint32 `url:"count,omitempty"`
	PageCount  uint32 `url:"pageCount,omitempty"`
	TotalCount uint32 `url:"totalCount,omitempty"`
	Next       string `url:"next,omitempty"`
	Previous   string `url:"previous,omitempty"`
	Self       string `url:"self,omitempty"`
	First      string `url:"first,omitempty"`
	Last       string `url:"last,omitempty"`
}

type MultiPaymentAsset

type MultiPaymentAsset struct {
	Amount      uint64 `json:"amount,omitempty,string"`
	RecipientId string `json:"recipientId,omitempty"`
}

type MultiSignatureRegistrationAsset

type MultiSignatureRegistrationAsset struct {
	Min       byte     `json:"min,omitempty"`
	Keysgroup []string `json:"keysgroup,omitempty"`
	Lifetime  byte     `json:"lifetime,omitempty"`
}

type NodeConfiguration

type NodeConfiguration struct {
	Nethash         string              `json:"nethash,omitempty"`
	Token           string              `json:"token,omitempty"`
	Symbol          string              `json:"symbol,omitempty"`
	Explorer        string              `json:"explorer,omitempty"`
	Version         int16               `json:"version,omitempty"`
	Ports           map[string]int16    `json:"ports,omitempty"`
	Constants       NodeConstants       `json:"constants,omitempty"`
	TransactionPool NodeTransactionPool `json:"transactionPool,omitempty"`
}

type NodeConstants

type NodeConstants struct {
	Height          int64               `json:"height,omitempty"`
	Reward          int64               `json:"reward,omitempty"`
	ActiveDelegates byte                `json:"activeDelegates,omitempty"`
	BlockTime       byte                `json:"blocktime,omitempty"`
	Block           NodeConstantsBlock  `json:"block,omitempty"`
	Epoch           string              `json:"epoch,omitempty"`
	Fees            map[string]FeeTypes `json:"fees,omitempty"`
}

type NodeConstantsBlock

type NodeConstantsBlock struct {
	Version         byte  `json:"version,omitempty"`
	MaxTransactions byte  `json:"maxTransactions,omitempty"`
	MaxPayload      int64 `json:"maxPayload,omitempty"`
}

type NodeFees

type NodeFees []FeeStatistic

type NodeService

type NodeService Service

NodeService handles communication with the node related methods of the Ark Core API - Version 2.

func (*NodeService) Configuration

func (s *NodeService) Configuration(ctx context.Context) (*GetNodeConfiguration, *http.Response, error)

Get the node configuration.

func (*NodeService) Fees

func (s *NodeService) Fees(ctx context.Context, days int) (*GetNodeFees, *http.Response, error)

Get the node fee statistics.

func (*NodeService) Status

Get the node status.

func (*NodeService) Syncing

Get the node syncing status.

type NodeStatus

type NodeStatus struct {
	Synced      bool  `json:"synced,omitempty"`
	Now         int64 `json:"now,omitempty"`
	BlocksCount int64 `json:"blocksCount,omitempty"`
	Timestamp   int64 `json:"timestamp,omitempty"`
}

type NodeSyncing

type NodeSyncing struct {
	Syncing bool   `json:"syncing,omitempty"`
	Blocks  int64  `json:"blocks,omitempty"`
	Height  int64  `json:"height,omitempty"`
	Id      string `json:"id,omitempty"`
}

type NodeTransactionPool

type NodeTransactionPool struct {
	DynamicFees DynamicFees `json:"dynamicFees,omitempty"`
}

type Pagination

type Pagination struct {
	Page  int `url:"page"`
	Limit int `url:"limit"`
}

type Peer

type Peer struct {
	Ip      string    `json:"ip,omitempty"`
	Port    int16     `json:"port,omitempty"`
	Ports   PeerPorts `json:"ports,omitempty"`
	Version string    `json:"version,omitempty"`
	Height  int64     `json:"height,omitempty"`
	Latency byte      `json:"latency,omitempty"`
}

type PeerPorts

type PeerPorts map[string]int16

type Peers

type Peers struct {
	Meta Meta   `json:"meta,omitempty"`
	Data []Peer `json:"data,omitempty"`
}

type PeersService

type PeersService Service

PeersService handles communication with the peers related methods of the Ark Core API - Version 2.

func (*PeersService) Get

func (s *PeersService) Get(ctx context.Context, ip string) (*GetPeer, *http.Response, error)

Get a peer by the given IP address.

func (*PeersService) List

func (s *PeersService) List(ctx context.Context, query *Pagination) (*Peers, *http.Response, error)

Get all peers.

type RoundDelegate

type RoundDelegate struct {
	PublicKey string `json:"publicKey,omitempty"`
	Votes     string `json:"votes,omitempty"`
}

type RoundsService

type RoundsService Service

RoundsService handles communication with the rounds related methods of the Ark Core API - Version 2.

func (*RoundsService) Delegates

func (s *RoundsService) Delegates(ctx context.Context, id int64) (*GetDelegates, *http.Response, error)

Get the forging delegates of a round by the given id.

type SecondSignatureRegistrationAsset

type SecondSignatureRegistrationAsset struct {
	PublicKey string `json:"publicKey,omitempty"`
}

type Service

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

type Timestamp

type Timestamp struct {
	Epoch int32  `json:"epoch,omitempty"`
	Unix  int32  `json:"unix,omitempty"`
	Human string `json:"human,omitempty"`
}

func (Timestamp) Time

func (t Timestamp) Time() time.Time

Time parses the unix value of the timestamp and returns as time.Time object with location as local.

type Transaction

type Transaction struct {
	Id              string            `json:"id,omitempty"`
	BlockId         string            `json:"blockId,omitempty"`
	Version         byte              `json:"version,omitempty"`
	Type            byte              `json:"type,omitempty"`
	TypeGroup       uint16            `json:"typeGroup,omitempty"`
	Amount          uint64            `json:"amount,omitempty,string"`
	Fee             uint64            `json:"fee,omitempty,string"`
	Sender          string            `json:"sender,omitempty"`
	SenderPublicKey string            `json:"senderPublicKey,omitempty"`
	Recipient       string            `json:"recipient,omitempty"`
	Signature       string            `json:"signature,omitempty"`
	Asset           *TransactionAsset `json:"asset,omitempty"`
	VendorField     string            `json:"vendorField,omitempty"`
	Confirmations   uint32            `json:"confirmations,omitempty"`
	Timestamp       Timestamp         `json:"timestamp,omitempty"`
	Nonce           uint64            `json:"nonce,omitempty,string"`
}

type TransactionAsset

type TransactionAsset struct {
	Votes          []string                          `json:"votes,omitempty"`
	Signature      *SecondSignatureRegistrationAsset `json:"signature,omitempty"`
	Delegate       *DelegateAsset                    `json:"publicKey,omitempty"`
	MultiSignature *MultiSignatureRegistrationAsset  `json:"multisignature,omitempty"`
	Ipfs           *IpfsAsset                        `json:"ipfs,omitempty"`
	Payments       []*MultiPaymentAsset              `json:"payments,omitempty"`
	Claim          *ClaimAsset                       `json:"claim,omitempty"`
}

type TransactionFees

type TransactionFees struct {
	Data map[string]uint32 `json:"data,omitempty"`
}

type TransactionTypes

type TransactionTypes struct {
	Data map[string]TypeGroupTypes `json:"data,omitempty"`
}

type Transactions

type Transactions struct {
	Meta Meta          `json:"meta,omitempty"`
	Data []Transaction `json:"data,omitempty"`
}

type TransactionsService

type TransactionsService Service

TransactionsService handles communication with the transactions related methods of the Ark Core API - Version 2.

func (*TransactionsService) Create

Create a new transaction.

func (*TransactionsService) Fees

Get a list of static transaction fees.

func (*TransactionsService) Get

Get a transaction by the given id.

func (*TransactionsService) GetUnconfirmed

func (s *TransactionsService) GetUnconfirmed(ctx context.Context, id string) (*GetTransaction, *http.Response, error)

Get an unconfirmed transaction by the given id.

func (*TransactionsService) List

Get all transactions.

func (*TransactionsService) ListUnconfirmed

func (s *TransactionsService) ListUnconfirmed(ctx context.Context, query *Pagination) (*Transactions, *http.Response, error)

Get all unconfirmed transactions.

func (*TransactionsService) Types

Get a list of valid transaction types.

type TypeGroupTypes

type TypeGroupTypes map[string]byte

type VotesService

type VotesService Service

VotesService handles communication with the votes related methods of the Ark Core API - Version 2.

func (*VotesService) Get

Get a vote by the given id.

func (*VotesService) List

Get all votes.

type Wallet

type Wallet struct {
	Address    string `json:"address,omitempty"`
	PublicKey  string `json:"publicKey,omitempty"`
	Nonce      uint64 `json:"nonce,omitempty,string"`
	Balance    uint64 `json:"balance,omitempty,string"`
	IsDelegate bool   `json:"isDelegate,omitempty"`
}

type Wallets

type Wallets struct {
	Meta Meta     `json:"meta,omitempty"`
	Data []Wallet `json:"data,omitempty"`
}

type WalletsService

type WalletsService Service

WalletsService handles communication with the wallets related methods of the Ark Core API - Version 2.

func (*WalletsService) Get

Get a wallet by the given id. (address, publicKey and username are valid)

func (*WalletsService) List

func (s *WalletsService) List(ctx context.Context, query *Pagination) (*Wallets, *http.Response, error)

Get all wallets.

func (*WalletsService) Locks

func (s *WalletsService) Locks(ctx context.Context, id string, query *Pagination) (*Locks, *http.Response, error)

Get all locks for the given wallet.

func (*WalletsService) ReceivedTransactions

func (s *WalletsService) ReceivedTransactions(ctx context.Context, id string, query *Pagination) (*Transactions, *http.Response, error)

Get all transactions received by the given wallet.

func (*WalletsService) SentTransactions

func (s *WalletsService) SentTransactions(ctx context.Context, id string, query *Pagination) (*Transactions, *http.Response, error)

Get all transactions sent by the given wallet.

func (*WalletsService) Top

func (s *WalletsService) Top(ctx context.Context, query *Pagination) (*Wallets, *http.Response, error)

Get all wallets sorted by balance in descending order.

func (*WalletsService) Transactions

func (s *WalletsService) Transactions(ctx context.Context, id string, query *Pagination) (*Transactions, *http.Response, error)

Get all transactions for the given wallet.

func (*WalletsService) Votes

func (s *WalletsService) Votes(ctx context.Context, id string, query *Pagination) (*Transactions, *http.Response, error)

Get all votes by the given wallet.

Jump to

Keyboard shortcuts

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