user

package
v0.0.0-...-d1fccd7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Overview

Package user is responsible for user communication. This is an API user should use to connect to the test node. Later we will add wallet API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API object is for querying and sending transactions to the network.

func NewUserAPI

func NewUserAPI(ra net.Addr, ta net.Addr, rs net.PacketConn, ts net.PacketConn) *API

NewUserAPI creates new API object.

func (*API) Balance

func (tc *API) Balance(publicKey ed25519.PublicKey) (int64, error)

Balance method requests balance of user holding 'publicKey' and blocks until the server sends a response. If the response packet is dropped by the network, this method will hang indefinitely.

func (*API) TransactionsTotal

func (tc *API) TransactionsTotal() uint64

TransactionsTotal requests the transaction count from server. If the response packet is dropped by the network, this method will hang.

func (*API) Transfer

func (tc *API) Transfer(from *block.KeyPair, to ed25519.PublicKey, token int64, vdf block.VDFValue)

Transfer will create Transaction, sign and transfer to the transactionSocket

func (*API) TransferTransaction

func (tc *API) TransferTransaction(tran block.Transaction)

TransferTransaction will transfer transaction to the transactionSocket

func (*API) ValidVDFValue

func (tc *API) ValidVDFValue() block.VDFValue

ValidVDFValue method queries producer for the valid vdf saved in the ledger and returns the result. If producer will not respond or the request will be lost this method will hang.

Jump to

Keyboard shortcuts

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