Documentation ¶
Index ¶
- func GetAPIs(b Backend, miner *miner.Miner) []rpc.API
- type AccountInfo
- type AddrLocker
- type Backend
- type PrivateBerithAPI
- func (s *PrivateBerithAPI) GetAccountInfo(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*AccountInfo, error)
- func (s *PrivateBerithAPI) GetSelectionPoint(ctx context.Context, address common.Address, blockNumber rpc.BlockNumber) (*hexutil.Big, error)
- func (s *PrivateBerithAPI) GetStakeBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Big, error)
- func (s *PrivateBerithAPI) Stake(ctx context.Context, wallet WalletTxArgs) (common.Hash, error)
- func (s *PrivateBerithAPI) StopStaking(ctx context.Context, wallet WalletTxArgs) (common.Hash, error)
- func (s *PrivateBerithAPI) UpdateAccount(ctx context.Context, address common.Address, passphrase, newPassphrase string) error
- type SendTxArgs
- type WalletTxArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountInfo ¶
[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.