request

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Synchronize

func Synchronize(ctx context.Context, c *conn.Conn, mode string, manualNodeIndex ...int) (rerr *rpc.Error, err error)

Synchronize method. Mode is one of: regular, fast, manual

Types

type AddedTransaction

type AddedTransaction struct {
	VotingNow       bool `json:"voting_now"`
	TransactionPool struct {
		PendingCapacity int `json:"pending_capacity"`
		VotingCapacity  int `json:"voting_capacity"`
	} `json:"txpool"`
}

AddedTransaction model

func AddTransaction

func AddTransaction(ctx context.Context, c *conn.Conn, tc transaction.Code, data []byte) (res AddedTransaction, rerr *rpc.Error, err error)

AddTransaction method

type Balance

type Balance struct {
	Gold *amount.Amount `json:"gold"`
	Mnt  *amount.Amount `json:"mnt"`
}

Balance is common balance struct (blockchain balance, wallet balance)

type BigInt

type BigInt struct {
	*big.Int
}

BigInt is big.Int wrapper

func (*BigInt) MarshalJSON

func (bi *BigInt) MarshalJSON() ([]byte, error)

MarshalJSON impl

func (*BigInt) UnmarshalJSON

func (bi *BigInt) UnmarshalJSON(b []byte) error

UnmarshalJSON impl.

type BinaryWalletTransaction

type BinaryWalletTransaction struct {
	Data  ByteArray        `json:"data"`
	Code  transaction.Code `json:"code"`
	Block *BigInt          `json:"block"`
}

BinaryWalletTransaction model

func GetWalletTransactionsBinary

func GetWalletTransactionsBinary(ctx context.Context, c *conn.Conn, w mint.PublicKey, max uint32, poolLookup, incoming, outgoing bool) (res []BinaryWalletTransaction, rerr *rpc.Error, err error)

GetWalletTransactionsBinary method

type Block

type Block []byte

Block model

func GetBlockByDigest

func GetBlockByDigest(ctx context.Context, c *conn.Conn, digest mint.Digest) (res Block, rerr *rpc.Error, err error)

GetBlockByDigest method

func GetBlockByID

func GetBlockByID(ctx context.Context, c *conn.Conn, id *big.Int) (res Block, rerr *rpc.Error, err error)

GetBlockByID method

func (Block) Header added in v1.2.1

func (b Block) Header() (*block.Header, error)

Header parses and returns block's header

type BlockchainInfo

type BlockchainInfo struct {
	BlockchainVersion     uint16   `json:"blockchain_version"`
	ClientAPIVersion      uint16   `json:"client_api_version"`
	SupportedTransactions []string `json:"supported_transactions"`
	SupportedAssets       []string `json:"supported_assets"`
	SupportedWalletTags   []string `json:"supported_wallet_tags"`
}

BlockchainInfo model

func GetBlockchainInfo

func GetBlockchainInfo(ctx context.Context, c *conn.Conn) (res BlockchainInfo, rerr *rpc.Error, err error)

GetBlockchainInfo method

type BlockchainNode

type BlockchainNode struct {
	Index     uint32         `json:"index"`
	PublicKey mint.PublicKey `json:"public_key"`
	IP        string         `json:"ip"`
}

BlockchainNode model

func GetBlockchainNodes

func GetBlockchainNodes(ctx context.Context, c *conn.Conn) (res []BlockchainNode, rerr *rpc.Error, err error)

GetBlockchainNodes method

type BlockchainState

type BlockchainState struct {
	LastBlockDigest     mint.Digest `json:"last_block_digest"`
	LastBlockMerkleRoot mint.Digest `json:"last_block_merkle_root"`
	BlockCount          *BigInt     `json:"block_count"`
	TransactionCount    *BigInt     `json:"transaction_count"`
	WalletCount         *BigInt     `json:"wallet_count"`
	NodeCount           int         `json:"node_count"`
	Balance             Balance     `json:"balance"`
	Node                struct {
		BlockchainState string `json:"blockchain_state"`
		LastError       string `json:"last_error"`
		SyncState       string `json:"sync_state"`
		ConsensusRound  int    `json:"consensus_round"`
		VotingNodes     string `json:"voting_nodes"`
		TransactionPool struct {
			PendingCount    int `json:"pending_count"`
			PendingCapacity int `json:"pending_capacity"`
			VotingCount     int `json:"voting_count"`
			VotingCapacity  int `json:"voting_capacity"`
		} `json:"transaction_pool"`
	} `json:"node"`
}

BlockchainState model

func GetBlockchainState

func GetBlockchainState(ctx context.Context, c *conn.Conn) (res BlockchainState, rerr *rpc.Error, err error)

GetBlockchainState method

type ByteArray

type ByteArray []byte

ByteArray is byte array wrapper

func (*ByteArray) MarshalJSON

func (ba *ByteArray) MarshalJSON() ([]byte, error)

MarshalJSON impl

func (*ByteArray) UnmarshalJSON

func (ba *ByteArray) UnmarshalJSON(b []byte) error

UnmarshalJSON impl.

type TextualWalletTransaction

type TextualWalletTransaction struct {
	Desc   string      `json:"desc"`
	Digest mint.Digest `json:"digest"`
	Block  *BigInt     `json:"block"`
}

TextualWalletTransaction model

func GetWalletTransactionsTextual

func GetWalletTransactionsTextual(ctx context.Context, c *conn.Conn, w mint.PublicKey, max uint32, poolLookup, incoming, outgoing bool) (res []TextualWalletTransaction, rerr *rpc.Error, err error)

GetWalletTransactionsTextual method

type WalletState

type WalletState struct {
	Exist                 bool     `json:"exist"`
	Balance               Balance  `json:"balance"`
	Tags                  []string `json:"tags"`
	LastTransactionID     uint64   `json:"last_transaction_id"`
	LastPoolTransactionID uint64   `json:"last_pool_transaction_id"`
}

WalletState model

func GetWalletState

func GetWalletState(ctx context.Context, c *conn.Conn, w mint.PublicKey) (res WalletState, rerr *rpc.Error, err error)

GetWalletState method

type WalletsDump

type WalletsDump struct {
	Count        uint64    `json:"count"`
	Uncompressed uint64    `json:"uncompressed"`
	Dump         ByteArray `json:"dump"`
}

WalletsDump model

func DumpWallets

func DumpWallets(ctx context.Context, c *conn.Conn, withMNT, withGOLD bool) (res WalletsDump, rerr *rpc.Error, err error)

DumpWallets method

func (WalletsDump) Wallets

func (wd WalletsDump) Wallets() (map[mint.PublicKey]WalletState, error)

Wallets parses dump

Jump to

Keyboard shortcuts

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