Documentation ¶
Index ¶
- type Client
- func (c Client) GetBestBlockHash() (string, error)
- func (c Client) GetBlockByHash(hash string) (*models.Block, error)
- func (c Client) GetBlockByIndex(index int64) (*models.Block, error)
- func (c Client) GetBlockCount() (int64, error)
- func (c Client) GetBlockHash(index int64) (string, error)
- func (c Client) GetConnectionCount() (int64, error)
- func (c Client) GetStorage(scriptHash string, storageKey string) (string, error)
- func (c Client) GetTransaction(hash string) (*models.Transaction, error)
- func (c Client) GetTransactionOutput(hash string, index int64) (*models.Vout, error)
- func (c Client) GetUnconfirmedTransactions() ([]string, error)
- func (c Client) Ping() bool
- func (c *Client) SelectBestNode() error
- func (c Client) ValidateAddress(address string) (bool, error)
- type PrivateKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Node string // contains filtered or unexported fields }
Client is the entrypoint for the package, it is used to carry out all actions.
func NewClientUsingMultipleNodes ¶
NewClientUsingMultipleNodes creates a new Client struct, and allows multiple node URIs to be passed in. Before the Client struct is returned, each node is queried to determine its block height. The node with the highest block count is chosen.
func (Client) GetBestBlockHash ¶
GetBestBlockHash returns the hash of the best block in the chain.
func (Client) GetBlockByHash ¶
GetBlockByHash returns the corresponding block information according to the specified hash value.
func (Client) GetBlockByIndex ¶
GetBlockByIndex returns the corresponding block information according to the specified index value.
func (Client) GetBlockCount ¶
GetBlockCount returns the number of blocks in the chain.
func (Client) GetBlockHash ¶
GetBlockHash returns the hash value of the corresponding block based on the specified index.
func (Client) GetConnectionCount ¶
GetConnectionCount returns the current number of connections for the node.
func (Client) GetStorage ¶
GetStorage takes a smart contract hash and a storage key, and returns the storage value if available.
func (Client) GetTransaction ¶
func (c Client) GetTransaction(hash string) (*models.Transaction, error)
GetTransaction returns the corresponding transaction information based on the specified hash value.
func (Client) GetTransactionOutput ¶
GetTransactionOutput returns the corresponding transaction output (change) information based on the specified hash and index.
func (Client) GetUnconfirmedTransactions ¶
GetUnconfirmedTransactions returns a slice of transaction hashes that are all unconfirmed transactions that the node has in memory.
func (*Client) SelectBestNode ¶
SelectBestNode selects the best node to use for RPC calls. If there is a single node URI then that will be used. If there are 2 or more then each node is called and the block count is compared. The node with the heighest block count is used.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey is a struct which holds the value of a NEO address private key, and has a number of utility functions attached to the struct.
func NewPrivateKeyFromWIF ¶
func NewPrivateKeyFromWIF(wif string) (*PrivateKey, error)
NewPrivateKeyFromWIF creates a PrivateKey struct using a WIF.
func (PrivateKey) Output ¶
func (p PrivateKey) Output() string
Output converts the 32-byte slice representation of the private key to a string.
func (PrivateKey) OutputBase64 ¶
func (p PrivateKey) OutputBase64() string
OutputBase64 converts the 32-byte slice representation of the private key to a base64 encoded string.
func (PrivateKey) PublicAddress ¶
func (p PrivateKey) PublicAddress() (string, error)
PublicAddress derives the public NEO address that is coupled with the private key, and returns it as a string.
func (PrivateKey) PublicKey ¶
func (p PrivateKey) PublicKey() ([]byte, error)
PublicKey derives the public key that is coupled with the private key, and returns it in an array of bytes.
func (PrivateKey) Signature ¶
func (p PrivateKey) Signature() ([]byte, error)
Signature creates the signature using the private key.