api

package
v0.0.0-...-9dc3ee9 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: GPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptCandidacyAccountUpdateArgs

type AcceptCandidacyAccountUpdateArgs struct {
	Nonce                  *hexutil.Uint64 `json:"nonce"`
	From                   common.Address  `json:"from"`
	AccountUpdateRequestId int64           `json:"accountUpdateRequestId"`
}

type ActivateCandidacyArgs

type ActivateCandidacyArgs struct {
	Nonce *hexutil.Uint64 `json:"nonce"`
	From  common.Address  `json:"from"`
}

type AddrLocker

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

func (*AddrLocker) LockAddr

func (l *AddrLocker) LockAddr(address common.Address)

LockAddr locks an account's mutex. This is used to prevent another tx getting the same nonce until the lock is released. The mutex prevents the (an identical nonce) from being read again during the time that the first transaction is being signed.

func (*AddrLocker) UnlockAddr

func (l *AddrLocker) UnlockAddr(address common.Address)

UnlockAddr unlocks the mutex of the given account.

type Backend

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

Backend handles the chain database and VM #stable - 0.4.0

func NewBackend

func NewBackend(ctx *node.ServiceContext, ethConfig *eth.Config) (*Backend, error)

NewBackend creates a new Backend #stable - 0.4.0

func (*Backend) APIs

func (b *Backend) APIs() []rpc.API

APIs returns the collection of RPC services the ethereum package offers. #stable - 0.4.0

func (*Backend) AccumulateRewards

func (b *Backend) AccumulateRewards(config *params.ChainConfig, strategy *emtTypes.Strategy)

AccumulateRewards accumulates the rewards based on the given strategy #unstable

func (*Backend) BroadcastTxCommit

func (b *Backend) BroadcastTxCommit(tx *ethTypes.Transaction) (*ctypes.ResultBroadcastTxCommit, error)

func (*Backend) BroadcastTxSync

func (b *Backend) BroadcastTxSync(tx *ethTypes.Transaction) (*ctypes.ResultBroadcastTx, error)

BroadcastTx broadcasts a transaction to tendermint core #unstable

func (*Backend) Commit

func (b *Backend) Commit(receiver common.Address) (common.Hash, error)

Commit finalises the current block #unstable

func (*Backend) Config

func (b *Backend) Config() *eth.Config

Config returns the eth.Config. #stable

func (*Backend) DeliverTx

DeliverTx appends a transaction to the current block #stable

func (*Backend) DeliverTxState

func (b *Backend) DeliverTxState() *state.StateDB

func (*Backend) EndBlock

func (b *Backend) EndBlock()

func (*Backend) Ethereum

func (b *Backend) Ethereum() *eth.Ethereum

Ethereum returns the underlying the ethereum object. #stable

func (*Backend) GasLimit

func (b *Backend) GasLimit() uint64

GasLimit returns the maximum gas per block #unstable

func (*Backend) GetLocalClient

func (b *Backend) GetLocalClient() *rpcClient.Local

func (*Backend) InitEthState

func (b *Backend) InitEthState(receiver common.Address) error

InitEthState initializes the EthState #unstable

func (*Backend) ManagedState

func (b *Backend) ManagedState() *state.ManagedState

func (*Backend) PeerCount

func (b *Backend) PeerCount() int

func (*Backend) Protocols

func (b *Backend) Protocols() []p2p.Protocol

Protocols implements node.Service, returning all the currently configured network protocols to start. #stable

func (*Backend) ResetState

func (b *Backend) ResetState() (*state.ManagedState, error)

func (*Backend) SetTMNode

func (b *Backend) SetTMNode(tmNode *tmn.Node)

func (*Backend) Start

func (b *Backend) Start(_ *p2p.Server) error

Start implements node.Service, starting all internal goroutines needed by the Ethereum protocol implementation. #stable

func (*Backend) Stop

func (b *Backend) Stop() error

Stop implements node.Service, terminating all internal goroutines used by the Ethereum protocol. #stable

func (*Backend) UpdateHeaderWithTimeInfo

func (b *Backend) UpdateHeaderWithTimeInfo(tmHeader abciTypes.Header)

UpdateHeaderWithTimeInfo uses the tendermint header to update the ethereum header #unstable

type DeactivateCandidacyArgs

type DeactivateCandidacyArgs struct {
	Nonce *hexutil.Uint64 `json:"nonce"`
	From  common.Address  `json:"from"`
}

type DeclareCandidacyArgs

type DeclareCandidacyArgs struct {
	Nonce       *hexutil.Uint64   `json:"nonce"`
	From        common.Address    `json:"from"`
	PubKey      string            `json:"pubKey"`
	MaxAmount   hexutil.Big       `json:"maxAmount"`
	CompRate    sdk.Rat           `json:"compRate"`
	Description stake.Description `json:"description"`
}

type DelegateArgs

type DelegateArgs struct {
	Nonce            *hexutil.Uint64 `json:"nonce"`
	From             common.Address  `json:"from"`
	ValidatorAddress common.Address  `json:"validatorAddress"`
	Amount           hexutil.Big     `json:"amount"`
	CubeBatch        string          `json:"cubeBatch"`
	Sig              string          `json:"sig"`
}

type EcRPCService

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

EcRPCService offers ec related RPC methods

func NewEcRPCService

func NewEcRPCService(b *Backend, nonceLock *AddrLocker) *EcRPCService

func (*EcRPCService) AcceptCandidacyAccountUpdate

func (s *EcRPCService) AcceptCandidacyAccountUpdate(args AcceptCandidacyAccountUpdateArgs) (*ctypes.ResultBroadcastTxCommit, error)

func (*EcRPCService) ActivateCandidacy

func (*EcRPCService) DeactivateCandidacy

func (s *EcRPCService) DeactivateCandidacy(args DeactivateCandidacyArgs) (*ctypes.ResultBroadcastTxCommit, error)

func (*EcRPCService) DeclareCandidacy

func (*EcRPCService) DecodeRawTxs

func (s *EcRPCService) DecodeRawTxs(rawTxs []string) ([]*RPCTransaction, error)

DecodeRawTxs returns the transactions from the raw tx array in the block data

func (*EcRPCService) Delegate

func (*EcRPCService) GetBlockByNumber

func (s *EcRPCService) GetBlockByNumber(height uint64) (*ctypes.ResultBlock, error)

GetBlockByNumber returns the requested block by height.

func (*EcRPCService) GetTransactionByHash

func (s *EcRPCService) GetTransactionByHash(hash string) (*RPCTransaction, error)

GetTransactionByHash returns the transaction for the given hash

func (*EcRPCService) GetTransactionFromBlock

func (s *EcRPCService) GetTransactionFromBlock(height uint64, index uint64) (*RPCTransaction, error)

GetTransactionFromBlock returns the transaction for the given block number and index.

func (*EcRPCService) ProposeChangeParam

func (*EcRPCService) ProposeDeployLibEni

func (*EcRPCService) ProposeRetireProgram

func (*EcRPCService) ProposeTransferFund

func (*EcRPCService) ProposeUpgradeProgram

func (*EcRPCService) QueryAbsentValidatorsKey

func (s *EcRPCService) QueryAbsentValidatorsKey(height uint64) (*StakeQueryResult, error)

func (*EcRPCService) QueryAwardInfos

func (s *EcRPCService) QueryAwardInfos(height uint64) (*StakeQueryResult, error)

func (*EcRPCService) QueryDelegator

func (s *EcRPCService) QueryDelegator(address common.Address, height uint64) (*StakeQueryResult, error)

func (*EcRPCService) QueryParams

func (s *EcRPCService) QueryParams(height uint64) (*StakeQueryResult, error)

func (*EcRPCService) QueryProposals

func (s *EcRPCService) QueryProposals() (*StakeQueryResult, error)

func (*EcRPCService) QueryValidator

func (s *EcRPCService) QueryValidator(address common.Address, height uint64) (*StakeQueryResult, error)

func (*EcRPCService) QueryValidators

func (s *EcRPCService) QueryValidators(height uint64) (*StakeQueryResult, error)

func (*EcRPCService) SendRawTx

func (s *EcRPCService) SendRawTx(encodedTx hexutil.Bytes) (*ctypes.ResultBroadcastTxCommit, error)

SendRawTx will broadcast the signed transaction to tendermint. The sender is responsible for signing the transaction and using the correct nonce.

func (*EcRPCService) SetCompRate

func (*EcRPCService) Syncing

func (s *EcRPCService) Syncing() (*ctypes.SyncInfo, error)

Info about the node's syncing state

func (*EcRPCService) UpdateCandidacy

func (*EcRPCService) UpdateCandidacyAccount

func (s *EcRPCService) UpdateCandidacyAccount(args UpdateCandidacyAccountArgs) (*ctypes.ResultBroadcastTxCommit, error)

func (*EcRPCService) VerifyCandidacy

func (*EcRPCService) Vote

func (*EcRPCService) Withdraw

func (*EcRPCService) WithdrawCandidacy

type EthRPCService

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

EcRPCService offers ec related RPC methods

func NewEthRPCService

func NewEthRPCService(b *Backend, nonceLock *AddrLocker) *EthRPCService

func (*EthRPCService) SendRawTransaction

func (s *EthRPCService) SendRawTransaction(encodedTx hexutil.Bytes) (string, error)

SendRawTransaction will broadcast the signed transaction to tendermint. The sender is responsible for signing the transaction and using the correct nonce.

func (*EthRPCService) SendTransaction

func (s *EthRPCService) SendTransaction(args SendTxArgs) (common.Hash, error)

SendTransaction is compatible with Ethereum, return eth transaction hash

func (*EthRPCService) SendTx

func (s *EthRPCService) SendTx(args SendTxArgs) (string, error)

SendTx is same as SendTransaction, but return ec transaction hash

type EthUmbrella

type EthUmbrella struct {
}

func (*EthUmbrella) EmitScheduleTx

func (eu *EthUmbrella) EmitScheduleTx(stx um.ScheduleTx)

func (*EthUmbrella) GetDueTxs

func (eu *EthUmbrella) GetDueTxs() []um.ScheduleTx

func (*EthUmbrella) GetValidators

func (eu *EthUmbrella) GetValidators() []common.Address

type GovernanceChangeParamProposalArgs

type GovernanceChangeParamProposalArgs struct {
	Nonce             *hexutil.Uint64 `json:"nonce"`
	From              common.Address  `json:"from"`
	Name              string          `json:"name"`
	Value             string          `json:"value"`
	Reason            string          `json:"reason"`
	ExpireTimestamp   *int64          `json:"expireTimestamp"`
	ExpireBlockHeight *int64          `json:"expireBlockHeight"`
}

type GovernanceDeployLibEniProposalArgs

type GovernanceDeployLibEniProposalArgs struct {
	Nonce             *hexutil.Uint64 `json:"nonce"`
	From              common.Address  `json:"from"`
	Name              string          `json:"name"`
	Version           string          `json:"version"`
	FileUrl           string          `json:"fileUrl"`
	Md5               string          `json:"md5"`
	Reason            string          `json:"reason"`
	DeployTimestamp   *int64          `json:"deployTimestamp"`
	DeployBlockHeight *int64          `json:"deployBlockHeight"`
}

type GovernanceRetireProgramProposalArgs

type GovernanceRetireProgramProposalArgs struct {
	Nonce               *hexutil.Uint64 `json:"nonce"`
	From                common.Address  `json:"from"`
	PreservedValidators string          `json:"preservedValidators"`
	Reason              string          `json:"reason"`
	RetiredBlockHeight  *int64          `json:"retiredBlockHeight"`
}

type GovernanceTransferFundProposalArgs

type GovernanceTransferFundProposalArgs struct {
	Nonce             *hexutil.Uint64 `json:"nonce"`
	From              common.Address  `json:"from"`
	TransferFrom      common.Address  `json:"transferFrom"`
	TransferTo        common.Address  `json:"transferTo"`
	Amount            hexutil.Big     `json:"amount"`
	Reason            string          `json:"reason"`
	ExpireTimestamp   *int64          `json:"expireTimestamp"`
	ExpireBlockHeight *int64          `json:"expireBlockHeight"`
}

type GovernanceUpgradeProgramProposalArgs

type GovernanceUpgradeProgramProposalArgs struct {
	Nonce              *hexutil.Uint64 `json:"nonce"`
	From               common.Address  `json:"from"`
	Name               string          `json:"name"`
	Version            string          `json:"version"`
	FileUrl            string          `json:"fileUrl"`
	Md5                string          `json:"md5"`
	Reason             string          `json:"reason"`
	UpgradeBlockHeight *int64          `json:"upgradeBlockHeight"`
}

type GovernanceVoteArgs

type GovernanceVoteArgs struct {
	Nonce      *hexutil.Uint64 `json:"nonce"`
	Voter      common.Address  `json:"from"`
	ProposalId string          `json:"proposalId"`
	Answer     string          `json:"answer"`
}

type NetRPCService

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

NetRPCService mirrors the implementation of `internal/ethapi` #unstable

func NewNetRPCService

func NewNetRPCService(b *Backend) *NetRPCService

NewNetRPCService creates a new net API instance. #unstable

func (*NetRPCService) Listening

func (s *NetRPCService) Listening() bool

Listening returns an indication if the node is listening for network connections. #unstable

func (*NetRPCService) PeerCount

func (s *NetRPCService) PeerCount() hexutil.Uint

PeerCount returns the number of connected peers

func (*NetRPCService) Version

func (s *NetRPCService) Version() string

Version returns the current ethereum protocol version. #unstable

type NullBlockProcessor

type NullBlockProcessor struct{}

NullBlockProcessor does not validate anything #unstable

func (NullBlockProcessor) ValidateBody

func (NullBlockProcessor) ValidateBody(*ethTypes.Block) error

ValidateBody does not validate anything #unstable

func (NullBlockProcessor) ValidateState

func (NullBlockProcessor) ValidateState(block, parent *ethTypes.Block, state *state.StateDB,
	receipts ethTypes.Receipts, usedGas uint64) error

ValidateState does not validate anything #unstable

type PrivateAccountAPI

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

PrivateAccountAPI provides an API to access accounts managed by this node. It offers methods to create, (un)lock en list accounts. Some methods accept passwords and are therefore considered private by default.

func NewPrivateAccountAPI

func NewPrivateAccountAPI(b *Backend, nonceLock *AddrLocker) *PrivateAccountAPI

NewPrivateAccountAPI create a new PrivateAccountAPI.

func (*PrivateAccountAPI) SendTransaction

func (s *PrivateAccountAPI) SendTransaction(args SendTxArgs, passwd string) (common.Hash, error)

SendTransaction is compatible with Ethereum, return eth transaction hash. It will create a transaction from the given arguments and try to sign it with the key associated with args.From. If the given passwd isn't able to decrypt the key it fails.

type RPCTransaction

type RPCTransaction struct {
	BlockNumber      *hexutil.Big           `json:"blockNumber"`
	From             common.Address         `json:"from"`
	Gas              hexutil.Uint64         `json:"gas"`
	GasPrice         *hexutil.Big           `json:"gasPrice"`
	Hash             common.Hash            `json:"hash"`
	EcHash           tmcmn.HexBytes         `json:"ecHash"`
	Input            hexutil.Bytes          `json:"input"`
	EcInput          interface{}            `json:"ecInput"`
	Nonce            hexutil.Uint64         `json:"nonce"`
	To               *common.Address        `json:"to"`
	TransactionIndex hexutil.Uint           `json:"transactionIndex"`
	Value            *hexutil.Big           `json:"value"`
	V                *hexutil.Big           `json:"v"`
	R                *hexutil.Big           `json:"r"`
	S                *hexutil.Big           `json:"s"`
	TxResult         abci.ResponseDeliverTx `json:"txResult"`
}

RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction

type SendTxArgs

type SendTxArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
	// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
	// newer name and should be preferred by clients.
	Data  *hexutil.Bytes `json:"data"`
	Input *hexutil.Bytes `json:"input"`
}

SendTxArgs represents the arguments to sumbit a new transaction

type SetCompRateArgs

type SetCompRateArgs struct {
	Nonce            *hexutil.Uint64 `json:"nonce"`
	From             common.Address  `json:"from"`
	DelegatorAddress common.Address  `json:"delegatorAddress"`
	CompRate         sdk.Rat         `json:"compRate"`
}

type StakeQueryResult

type StakeQueryResult struct {
	Height int64       `json:"height"`
	Data   interface{} `json:"data"`
}

type UpdateCandidacyAccountArgs

type UpdateCandidacyAccountArgs struct {
	Nonce               *hexutil.Uint64 `json:"nonce"`
	From                common.Address  `json:"from"`
	NewCandidateAddress common.Address  `json:"newCandidateAccount"`
}

type UpdateCandidacyArgs

type UpdateCandidacyArgs struct {
	Nonce       *hexutil.Uint64   `json:"nonce"`
	From        common.Address    `json:"from"`
	PubKey      string            `json:"pubKey"`
	MaxAmount   *hexutil.Big      `json:"maxAmount"`
	CompRate    sdk.Rat           `json:"compRate"`
	Description stake.Description `json:"description"`
}

type VerifyCandidacyArgs

type VerifyCandidacyArgs struct {
	Nonce            *hexutil.Uint64 `json:"nonce"`
	From             common.Address  `json:"from"`
	CandidateAddress common.Address  `json:"candidateAddress"`
	Verified         bool            `json:"verified"`
}

type WithdrawArgs

type WithdrawArgs struct {
	Nonce            *hexutil.Uint64 `json:"nonce"`
	From             common.Address  `json:"from"`
	ValidatorAddress common.Address  `json:"validatorAddress"`
	Amount           hexutil.Big     `json:"amount"`
}

type WithdrawCandidacyArgs

type WithdrawCandidacyArgs struct {
	Nonce *hexutil.Uint64 `json:"nonce"`
	From  common.Address  `json:"from"`
}

Jump to

Keyboard shortcuts

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