brtapi

package
v0.0.0-...-59674b5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIs

func GetAPIs(b Backend, miner *miner.Miner) []rpc.API

GetAPIs get apis of berith serivce

Types

type AccountInfo

type AccountInfo struct {
	Balance      *big.Int //main balance
	StakeBalance *big.Int //staking balance
}

[BERITH] Structure for returning account information

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 interface {
	AccountManager() *accounts.Manager
	SuggestPrice(ctx context.Context) (*big.Int, error)
	GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)

	SendTx(ctx context.Context, signedTx *types.Transaction) error

	ChainConfig() *params.ChainConfig
	CurrentBlock() *types.Block

	StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
}

Backend backend of berith service

type PrivateBerithAPI

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

PrivateBerithAPI struct of berith private apis

func NewPrivateBerithAPI

func NewPrivateBerithAPI(b Backend, m *miner.Miner, nonceLock *AddrLocker) *PrivateBerithAPI

[BERITH] The first function called to register the implementation

func (*PrivateBerithAPI) GetAccountInfo

func (s *PrivateBerithAPI) GetAccountInfo(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*AccountInfo, error)

[BERITH] Function to return account information (All Balance) Functions created for convenience of information verification

func (*PrivateBerithAPI) GetSelectionPoint

func (s *PrivateBerithAPI) GetSelectionPoint(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) (*hexutil.Big, error)

[BERITH] Function to get the SelectionPoint of the specified account

func (*PrivateBerithAPI) GetStakeBalance

func (s *PrivateBerithAPI) GetStakeBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Big, error)

[BERITH] Function to check the staking quantity of the specified Account Check and return the current local block status

func (*PrivateBerithAPI) Stake

func (s *PrivateBerithAPI) Stake(ctx context.Context, wallet WalletTxArgs) (common.Hash, error)

[BERITH] Stake creates a transaction for user staking Function to handle berith.stake request Create Tx with added base and target. WalletTxArgs structure is a structure to limit Tx

func (*PrivateBerithAPI) StopStaking

func (s *PrivateBerithAPI) StopStaking(ctx context.Context, wallet WalletTxArgs) (common.Hash, error)

[BERITH] When this function is called, all staking is released and returned to Main After creating Tx and sending it, it is processed by Consensus.

func (*PrivateBerithAPI) UpdateAccount

func (s *PrivateBerithAPI) UpdateAccount(ctx context.Context, address common.Address, passphrase, newPassphrase string) error

[BERITH] Function to change the keystore password Made by user's request

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"`
	Base   types.JobWallet `json:"base"`
	Target types.JobWallet `json:"target"`
}

[BERITH] SendTxArgs represents the arguments to sumbit a new transaction into the transaction pool. Specify the tx type by putting Base and Target in the existing transaction structure.

type WalletTxArgs

type WalletTxArgs struct {
	From     common.Address  `json:"from"`
	Value    *hexutil.Big    `json:"value"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
}

Jump to

Keyboard shortcuts

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