naet

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

Package naet represents a connection to a Node or Compiler. It saves the caller from having to deal with swagger generated types and returns native Go types whenever possible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIVersioner

type APIVersioner interface {
	APIVersion() (version string, err error)
}

APIVersioner guarantees that one can run a APIVersion() method on the mocked/real network connection to the aesophia compiler

type CompileContracter

type CompileContracter interface {
	CompileContract(source string, backend string) (bytecode string, err error)
}

CompileContracter guarantees that one can run a CompileContract() method on the mocked/real network connection to the aesophia compiler

type Compiler

type Compiler struct {
	*compiler_client.Compiler
}

Compiler wraps around the swagger-generated Compiler. Unlike the swagger-generated Compiler, this Compiler struct builds the swagger HTTP requests from the Golang native arguments that its methods receive, and uses the swagger-generated Compiler's endpoints to send these requests off. It then parses the swagger response and makes it as native-Go-code-friendly as possible.

func NewCompiler

func NewCompiler(compilerURL string, debug bool) *Compiler

NewCompiler creates a new Compiler instance from a URL

func (*Compiler) APIVersion

func (c *Compiler) APIVersion() (version string, err error)

APIVersion connects to the compiler and returns its version string, e.g. 3.1.0

func (*Compiler) CompileContract

func (c *Compiler) CompileContract(source string, backend string) (bytecode string, err error)

CompileContract abstracts away the swagger specifics of posting to /compile

func (*Compiler) DecodeCallResult

func (c *Compiler) DecodeCallResult(callResult string, callValue string, function string, source string, backend string) (answer interface{}, err error)

DecodeCallResult abstracts away the swagger specifics of posting to /decode-call-result

func (*Compiler) DecodeCalldataBytecode

func (c *Compiler) DecodeCalldataBytecode(bytecode string, calldata string, backend string) (decodedCallData *models.DecodedCalldata, err error)

DecodeCalldataBytecode abstracts away the swagger specifics of posting to /decode-calldata/bytecode

func (*Compiler) DecodeCalldataSource

func (c *Compiler) DecodeCalldataSource(source string, function string, callData string, backend string) (decodedCallData *models.DecodedCalldata, err error)

DecodeCalldataSource abstracts away the swagger specifics of posting to /decode-calldata/source

func (*Compiler) DecodeData

func (c *Compiler) DecodeData(data string, sophiaType string) (decodedData *models.SophiaJSONData, err error)

DecodeData abstracts away the swagger specifics of posting to /decode-data

func (*Compiler) EncodeCalldata

func (c *Compiler) EncodeCalldata(source string, function string, args []string, backend string) (callData string, err error)

EncodeCalldata abstracts away the swagger specifics of posting to /encode-calldata

func (*Compiler) GenerateACI

func (c *Compiler) GenerateACI(source string, backend string) (aci *models.ACI, err error)

GenerateACI abstracts away the swagger specifics of posting to /aci

func (*Compiler) SophiaVersion

func (c *Compiler) SophiaVersion() (version string, err error)

SophiaVersion abstracts away the swagger specifics of getting /version

type DecodeCallResulter

type DecodeCallResulter interface {
	DecodeCallResult(callResult string, callValue string, function string, source string, backend string) (answer interface{}, err error)
}

DecodeCallResulter guarantees that one can run a DecodeCallResult() method on the mocked/real network connection to the aesophia compiler

type DecodeCalldataBytecoder

type DecodeCalldataBytecoder interface {
	DecodeCalldataBytecode(bytecode string, calldata string, backend string) (decodedCallData *models.DecodedCalldata, err error)
}

DecodeCalldataBytecoder guarantees that one can run a DecodeCalldataBytecode() method on the mocked/real network connection to the aesophia compiler

type DecodeCalldataSourcer

type DecodeCalldataSourcer interface {
	DecodeCalldataSource(source string, function string, callData string, backend string) (decodedCallData *models.DecodedCalldata, err error)
}

DecodeCalldataSourcer guarantees that one can run a DecodeCalldataSource() method on the mocked/real network connection to the aesophia compiler

type DecodeDataer

type DecodeDataer interface {
	DecodeData(data string, sophiaType string) (decodedData *models.SophiaJSONData, err error)
}

DecodeDataer guarantees that one can run a DecodeData() method on the mocked/real network connection to the aesophia compiler

type EncodeCalldataer

type EncodeCalldataer interface {
	EncodeCalldata(source string, function string, args []string, backend string) (callData string, err error)
}

EncodeCalldataer guarantees that one can run a EncodeCalldata() method on the mocked/real network connection to the aesophia compiler

type GenerateACIer

type GenerateACIer interface {
	GenerateACI(source string, backend string) (aci *models.ACI, err error)
}

GenerateACIer guarantees that one can run a GenerateACI() method on the mocked/real network connection to the aesophia compiler

type GetAccounter

type GetAccounter interface {
	GetAccount(accountID string) (*models.Account, error)
}

GetAccounter guarantees that one can run a GetAccount() method on the mocked/real network connection

type GetGenerationByHeighter

type GetGenerationByHeighter interface {
	GetGenerationByHeight(height uint64) (*models.Generation, error)
}

GetGenerationByHeighter guarantees that one can run a GetGenerationByHeight() method on the mocked/real network connection

type GetHeighter

type GetHeighter interface {
	GetHeight() (uint64, error)
}

GetHeighter guarantees that one can run a GetHeight() method on the mocked/real network connection

type GetKeyBlockByHasher

type GetKeyBlockByHasher interface {
	GetKeyBlockByHash(string) (*models.KeyBlock, error)
}

GetKeyBlockByHasher guarantees that one can run a GetKeyBlockByHash() method on the mocked/real network connection

type GetMicroBlockHeaderByHasher

type GetMicroBlockHeaderByHasher interface {
	GetMicroBlockHeaderByHash(string) (*models.MicroBlockHeader, error)
}

GetMicroBlockHeaderByHasher guarantees that one can run a GetMicroBlockHeaderByHash() method on the mocked/real network connection

type GetMicroBlockTransactionsByHasher

type GetMicroBlockTransactionsByHasher interface {
	GetMicroBlockTransactionsByHash(string) (*models.GenericTxs, error)
}

GetMicroBlockTransactionsByHasher guarantees that one can run a GetMicroBlockTransactionsByHash() method on the mocked/real network connection

type GetNameEntryByNamer

type GetNameEntryByNamer interface {
	GetNameEntryByName(string) (*models.NameEntry, error)
}

GetNameEntryByNamer guarantees that one can run a GetNameEntryByName() method on the mocked/real network connection

type GetOracleByPubkeyer

type GetOracleByPubkeyer interface {
	GetOracleByPubkey(string) (*models.RegisteredOracle, error)
}

GetOracleByPubkeyer guarantees that one can run a GetOracleByPubkey() method on the mocked/real network connection

type GetStatuser

type GetStatuser interface {
	GetStatus() (*models.Status, error)
}

GetStatuser guarantees that one can run a GetStatus() method on the mocked/real network connection

type GetTopBlocker

type GetTopBlocker interface {
	GetTopBlock() (*models.KeyBlockOrMicroBlockHeader, error)
}

GetTopBlocker guarantees that one can run a GetTopBlock() method on the mocked/real network connection

type GetTransactionByHasher

type GetTransactionByHasher interface {
	GetTransactionByHash(string) (*models.GenericSignedTx, error)
}

GetTransactionByHasher guarantees that one can run a GetTransactionByHash() method on the mocked/real network connection

type Node

type Node struct {
	*apiclient.Node
}

Node represents a HTTP connection to an aeternity node

func NewNode

func NewNode(nodeURL string, debug bool) *Node

NewNode instantiates a new swagger HTTP client to an aeternity node. No network connection is actually performed, this only sets up the HTTP client code.

func (*Node) GetAccount

func (c *Node) GetAccount(accountID string) (account *models.Account, err error)

GetAccount retrieve an account by its address (public key) it is particularly useful to obtain the nonce for spending transactions

func (*Node) GetContractByID

func (c *Node) GetContractByID(ctID string) (contract *models.ContractObject, err error)

GetContractByID gets a contract by ct_ ID

func (*Node) GetCurrentKeyBlock

func (c *Node) GetCurrentKeyBlock() (kb *models.KeyBlock, err error)

GetCurrentKeyBlock get current key block

func (*Node) GetGenerationByHeight

func (c *Node) GetGenerationByHeight(height uint64) (g *models.Generation, err error)

GetGenerationByHeight gets the keyblock and all its microblocks

func (*Node) GetHeight

func (c *Node) GetHeight() (height uint64, err error)

GetHeight get the height of the chain

func (*Node) GetKeyBlockByHash

func (c *Node) GetKeyBlockByHash(keyBlockID string) (txs *models.KeyBlock, err error)

GetKeyBlockByHash get a key block by its hash

func (*Node) GetMicroBlockHeaderByHash

func (c *Node) GetMicroBlockHeaderByHash(microBlockID string) (txs *models.MicroBlockHeader, err error)

GetMicroBlockHeaderByHash get the header of a micro block

func (*Node) GetMicroBlockTransactionsByHash

func (c *Node) GetMicroBlockTransactionsByHash(microBlockID string) (txs *models.GenericTxs, err error)

GetMicroBlockTransactionsByHash get the transactions of a microblock

func (*Node) GetNameEntryByName

func (c *Node) GetNameEntryByName(name string) (nameEntry *models.NameEntry, err error)

GetNameEntryByName return the name entry

func (*Node) GetOracleByPubkey

func (c *Node) GetOracleByPubkey(pubkey string) (oracle *models.RegisteredOracle, err error)

GetOracleByPubkey get an oracle by it's public key

func (*Node) GetOracleQueriesByPubkey

func (c *Node) GetOracleQueriesByPubkey(pubkey string) (oracleQueries *models.OracleQueries, err error)

GetOracleQueriesByPubkey get a list of queries made to a particular oracle

func (*Node) GetStatus

func (c *Node) GetStatus() (status *models.Status, err error)

GetStatus returns a node's Status.

func (*Node) GetTopBlock

func (c *Node) GetTopBlock() (kb *models.KeyBlockOrMicroBlockHeader, err error)

GetTopBlock get the top block of the chain

func (*Node) GetTransactionByHash

func (c *Node) GetTransactionByHash(txHash string) (tx *models.GenericSignedTx, err error)

GetTransactionByHash get a transaction by it's hash

func (*Node) PostTransaction

func (c *Node) PostTransaction(signedEncodedTx, signedEncodedTxHash string) (err error)

PostTransaction post transaction

type NodeInterface

NodeInterface collects together all the interfaces defined in this file to describe the capabilities of a generic connection to an aeternity (or mock) node

type PostTransactioner

type PostTransactioner interface {
	PostTransaction(string, string) error
}

PostTransactioner guarantees that one can run a PostTransaction() method on the mocked/real network connection

type SophiaVersioner

type SophiaVersioner interface {
	SophiaVersion() (version string, err error)
}

SophiaVersioner guarantees that one can run a SophiaVersion() method on the mocked/real network connection to the aesophia compiler

Jump to

Keyboard shortcuts

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