Documentation ¶
Index ¶
- func DoCall(ctx context.Context, c *Container, args CallArgs, blockNr rpc.BlockNumber, ...) ([]byte, uint64, bool, error)
- func DoEstimateGas(ctx context.Context, c *Container, args CallArgs, blockNr rpc.BlockNumber, ...) (hexutil.Uint64, error)
- func GetAPIs(container *Container) []rpc.API
- func RPCMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error)
- type AccountResult
- type AddrLocker
- type AddressKeyResult
- type CallArgs
- type Container
- func (c *Container) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error)
- func (c *Container) BloomStatus() (uint64, uint64)
- func (c *Container) ChainDb() youdb.Database
- func (c *Container) EventMux() *event.TypeMux
- func (c *Container) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
- func (c *Container) GetPoolNonce(addr common.Address) (uint64, error)
- func (c *Container) GetPoolTransaction(txHash common.Hash) *types.Transaction
- func (c *Container) GetPoolTransactions() (types.Transactions, error)
- func (c *Container) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)
- func (c *Container) GetTransaction(txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error)
- func (c *Container) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (c *Container) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error)
- func (c *Container) ProtocolVersion() int
- func (c *Container) RPCGasCap() *big.Int
- func (c *Container) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
- func (c *Container) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error)
- func (c *Container) Stats() (pending int, queued int)
- func (c *Container) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
- func (c *Container) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
- func (c *Container) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription
- func (c *Container) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
- func (c *Container) SuggestPrice(ctx context.Context) (*big.Int, error)
- func (c *Container) TxPool() *core.TxPool
- func (c *Container) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
- type DumpValidatorRewardsInfo
- type P2PStatus
- type PrivateAccountApi
- func (y *PrivateAccountApi) DelValKey(addr common.Address, pwd string) error
- func (y *PrivateAccountApi) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error)
- func (y *PrivateAccountApi) ExportKeyJson(addr common.Address, pwd, newPwd string) (keyJSON hexutil.Bytes, err error)
- func (y *PrivateAccountApi) ExportRawKey(addr common.Address, pwd string) (privekey string, err error)
- func (y *PrivateAccountApi) ExportValKey(addr common.Address, pwd, newPwd string) (keyJSON hexutil.Bytes, err error)
- func (y *PrivateAccountApi) ImportKeyJson(keyJson hexutil.Bytes, pwd, newPwd string) (*AddressKeyResult, error)
- func (y *PrivateAccountApi) ImportRawKey(privkey string, password string) (common.Address, error)
- func (y *PrivateAccountApi) ImportValKey(keyJSON hexutil.Bytes, pwd, newPwd string) (*ValAccountResult, error)
- func (y *PrivateAccountApi) ListAccounts() []common.Address
- func (y *PrivateAccountApi) LockAccount(addr common.Address) bool
- func (y *PrivateAccountApi) LockValKey() error
- func (y *PrivateAccountApi) NewAccount(password string) (common.Address, error)
- func (y *PrivateAccountApi) NewValKey(password string) (*ValAccountResult, error)
- func (y *PrivateAccountApi) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
- func (y *PrivateAccountApi) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error)
- func (y *PrivateAccountApi) SignTransaction(ctx context.Context, args SendTxArgs, passwd string) (*SignTransactionResult, error)
- func (y *PrivateAccountApi) UnlockAccount(addr common.Address, password string, duration *uint64) (bool, error)
- func (y *PrivateAccountApi) UseValKey(addr common.Address, password string, keep bool) error
- type PrivateDevApi
- func (y *PrivateDevApi) DoubleSign(ctx context.Context, skey hexutil.Bytes, next uint64) (map[string]interface{}, error)
- func (api *PrivateDevApi) Exit() error
- func (api *PrivateDevApi) SendRawTransactions(encodedTxs []hexutil.Bytes) ([]string, error)
- func (api *PrivateDevApi) SendTransactions(signedTxs []*types.Transaction) ([]string, error)
- func (api *PrivateDevApi) SetHead(number uint64) error
- func (api *PrivateDevApi) SetPrintOrigin(print bool) error
- func (api *PrivateDevApi) StateDump() (state.Dump, error)
- func (api *PrivateDevApi) StateDumpByNumber(ctx context.Context, blockNr rpc.BlockNumber) (state.Dump, error)
- func (api *PrivateDevApi) StateLogDump() (state.DumpAllLogs, error)
- func (api *PrivateDevApi) Stop() error
- func (api *PrivateDevApi) Verbosity(verbosity int) error
- func (api *PrivateDevApi) Vmodule(vmodule string) error
- type PublicMainApi
- func (y *PublicMainApi) Accounts() []common.Address
- func (y *PublicMainApi) BlockNumber() (hexutil.Uint64, error)
- func (y *PublicMainApi) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (y *PublicMainApi) ChangeStatusValidator(ctx context.Context, nonce uint64, mainAddress common.Address, status uint8) (hexutil.Bytes, error)
- func (y *PublicMainApi) CreateValidator(ctx context.Context, nonce uint64, name string, ...) (hexutil.Bytes, error)
- func (y *PublicMainApi) DepositValidator(ctx context.Context, nonce uint64, mainAddress common.Address, ...) (hexutil.Bytes, error)
- func (y *PublicMainApi) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error)
- func (y *PublicMainApi) GasPrice(ctx context.Context) (*hexutil.Big, error)
- func (y *PublicMainApi) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Big, error)
- func (y *PublicMainApi) GetBlockByHash(ctx context.Context, hash string, fullTx bool) (map[string]interface{}, error)
- func (y *PublicMainApi) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
- func (y *PublicMainApi) GetBlockTransactionCountByHash(hash common.Hash) (*hexutil.Uint, error)
- func (y *PublicMainApi) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*hexutil.Uint, error)
- func (y *PublicMainApi) GetCode(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
- func (y *PublicMainApi) GetDelegationAddData(ctx context.Context, toValidator common.Address, value hexutil.Big) (hexutil.Bytes, error)
- func (y *PublicMainApi) GetDelegationSettleData(ctx context.Context, toValidator common.Address) (hexutil.Bytes, error)
- func (y *PublicMainApi) GetDelegationSubData(ctx context.Context, toValidator common.Address, value hexutil.Big) (hexutil.Bytes, error)
- func (y *PublicMainApi) GetDelegationsFrom(ctx context.Context, delegator common.Address, blockNr rpc.BlockNumber) (map[string]interface{}, error)
- func (y *PublicMainApi) GetPoolNonce(address string) (*hexutil.Uint64, error)
- func (y *PublicMainApi) GetProof(ctx context.Context, address common.Address, storageKeys []string, ...) (*AccountResult, error)
- func (y *PublicMainApi) GetStakingEndBlockReceipt(ctx context.Context, blockNr rpc.BlockNumber) (map[string]interface{}, error)
- func (y *PublicMainApi) GetStakingRecord(ctx context.Context, validator common.Address, blockNr rpc.BlockNumber) (*RPCStakingRecord, error)
- func (y *PublicMainApi) GetStorageAt(ctx context.Context, address common.Address, key string, ...) (hexutil.Bytes, error)
- func (y *PublicMainApi) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (*RPCTransaction, error)
- func (y *PublicMainApi) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (*RPCTransaction, error)
- func (y *PublicMainApi) GetTransactionByHash(txHash common.Hash) (*RPCTransaction, error)
- func (y *PublicMainApi) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)
- func (y *PublicMainApi) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
- func (y *PublicMainApi) GetWithdrawRecords(ctx context.Context, blockNr rpc.BlockNumber) ([]*state.DumpWithdrawRecord, error)
- func (y *PublicMainApi) Mining() bool
- func (y *PublicMainApi) NetworkId() hexutil.Uint64
- func (y *PublicMainApi) ProtocolVersion() hexutil.Uint
- func (y *PublicMainApi) SendRawTransaction(encodedTx hexutil.Bytes) (common.Hash, error)
- func (y *PublicMainApi) SendSignedTransaction(signedTx *types.Transaction) (string, error)
- func (y *PublicMainApi) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)
- func (y *PublicMainApi) SettleValidator(ctx context.Context, mainAddress common.Address) (hexutil.Bytes, error)
- func (y *PublicMainApi) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)
- func (y *PublicMainApi) Syncing() (interface{}, error)
- func (y *PublicMainApi) UpdateValidator(ctx context.Context, nonce uint64, name string, ...) (hexutil.Bytes, error)
- func (y *PublicMainApi) ValidatorByMainAddress(ctx context.Context, blockNr rpc.BlockNumber, mainAddress common.Address) (*state.DumpValidator, error)
- func (y *PublicMainApi) Validators(ctx context.Context, role uint8, page, pageSize int, blockNr rpc.BlockNumber) ([]*state.DumpValidator, error)
- func (y *PublicMainApi) ValidatorsStat(ctx context.Context, blockNr rpc.BlockNumber) (map[params.ValidatorRole]state.DumpValidatorsStatItem, error)
- func (y *PublicMainApi) WithdrawValidator(ctx context.Context, nonce uint64, mainAddress, withdraw common.Address, ...) (hexutil.Bytes, error)
- type PublicTxpoolApi
- type RPCBlacklistItem
- type RPCPeersInfo
- type RPCStakingRecord
- type RPCTransaction
- type SendTxArgs
- type Shard
- type ShardId
- type SignTransactionResult
- type StorageResult
- type ValAccountResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoEstimateGas ¶
func RPCMarshalBlock ¶
RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.
Types ¶
type AccountResult ¶
type AccountResult struct { Address common.Address `json:"address"` AccountProof []string `json:"accountProof"` Balance *hexutil.Big `json:"balance"` CodeHash common.Hash `json:"codeHash"` Nonce hexutil.Uint64 `json:"nonce"` StorageHash common.Hash `json:"storageHash"` StorageProof []StorageResult `json:"storageProof"` }
Result structs for GetProof
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 AddressKeyResult ¶ added in v0.9.9
AddressKeyResult is the normal account type to differ with valaccount
type CallArgs ¶
type CallArgs 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"` Data *hexutil.Bytes `json:"data"` }
CallArgs represents the arguments for a call.
type Container ¶
func NewContainer ¶
func (*Container) BlockByNumber ¶
func (*Container) BloomStatus ¶
func (*Container) GetPoolNonce ¶
func (*Container) GetPoolTransaction ¶
func (c *Container) GetPoolTransaction(txHash common.Hash) *types.Transaction
func (*Container) GetPoolTransactions ¶
func (c *Container) GetPoolTransactions() (types.Transactions, error)
func (*Container) GetReceipts ¶
func (*Container) GetTransaction ¶
func (*Container) HeaderByHash ¶
func (*Container) HeaderByNumber ¶
func (*Container) ProtocolVersion ¶
func (*Container) ServiceFilter ¶
func (c *Container) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
func (*Container) StateAndHeaderByNumber ¶
func (*Container) SubscribeChainEvent ¶
func (c *Container) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription
func (*Container) SubscribeLogsEvent ¶
func (c *Container) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription
func (*Container) SubscribeNewTxsEvent ¶
func (c *Container) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription
func (*Container) SubscribeRemovedLogsEvent ¶
func (c *Container) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription
func (*Container) SuggestPrice ¶
func (*Container) TxPoolContent ¶
func (c *Container) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
type PrivateAccountApi ¶
type PrivateAccountApi struct {
// contains filtered or unexported fields
}
func NewPrivateAccountApi ¶
func NewPrivateAccountApi(c *Container, nonceLock *AddrLocker) *PrivateAccountApi
func (*PrivateAccountApi) DelValKey ¶
func (y *PrivateAccountApi) DelValKey(addr common.Address, pwd string) error
DelValKey will both try removing all unlocked validator keys and delete the specific key.
func (*PrivateAccountApi) EcRecover ¶
func (y *PrivateAccountApi) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error)
EcRecover returns the address for the account that was used to create the signature. Note, this function is compatible with you_sign and personal_sign. As such it recovers the address of: hash = keccak256("\x19YOUChain Signed Message:\n"${message length}${message}) addr = ecrecover(hash, signature)
Note, the signature must conform to the secp256k1 curve R, S and V values, where the V value must be 27 or 28 for legacy reasons.
func (*PrivateAccountApi) ExportKeyJson ¶ added in v0.9.9
func (y *PrivateAccountApi) ExportKeyJson(addr common.Address, pwd, newPwd string) (keyJSON hexutil.Bytes, err error)
ExportKeyJson will export the keyjson in byte from input of the accounts address
func (*PrivateAccountApi) ExportRawKey ¶ added in v0.9.9
func (y *PrivateAccountApi) ExportRawKey(addr common.Address, pwd string) (privekey string, err error)
ExportRawKey will export the hexstring privatekey, be cautious employing it
func (*PrivateAccountApi) ExportValKey ¶
func (y *PrivateAccountApi) ExportValKey(addr common.Address, pwd, newPwd string) (keyJSON hexutil.Bytes, err error)
ExportValKey exports a validator key in a key json format, which is encrypted by the newPwd.
func (*PrivateAccountApi) ImportKeyJson ¶ added in v0.9.9
func (y *PrivateAccountApi) ImportKeyJson(keyJson hexutil.Bytes, pwd, newPwd string) (*AddressKeyResult, error)
ImportKeyJson import the keyJson byte to conclude accounts
func (*PrivateAccountApi) ImportRawKey ¶
ImportRawKey stores the given hex encoded ECDSA key into the key directory, encrypting it with the passphrase.
func (*PrivateAccountApi) ImportValKey ¶
func (y *PrivateAccountApi) ImportValKey(keyJSON hexutil.Bytes, pwd, newPwd string) (*ValAccountResult, error)
ImportValKey imports and stores a validator key that is encrypted by pwd, and will re-encrypt by newPwd
func (*PrivateAccountApi) ListAccounts ¶
func (y *PrivateAccountApi) ListAccounts() []common.Address
ListAccounts will return a list of addresses for accounts this node manages.
func (*PrivateAccountApi) LockAccount ¶
func (y *PrivateAccountApi) LockAccount(addr common.Address) bool
LockAccount will lock the account associated with the given address when it's unlocked.
func (*PrivateAccountApi) LockValKey ¶
func (y *PrivateAccountApi) LockValKey() error
LockValKey will remove all unlocked validator keys. It will not affect the currently used key in consensus engine
func (*PrivateAccountApi) NewAccount ¶
func (y *PrivateAccountApi) NewAccount(password string) (common.Address, error)
NewAccount will create a new account and returns the address for the new account.
func (*PrivateAccountApi) NewValKey ¶
func (y *PrivateAccountApi) NewValKey(password string) (*ValAccountResult, error)
NewValKey generates a new validator key that includes an ecdsa key and a bls key. the returned object includes an address and the compressed ecdsa public key (cons_cpk) and bls public key (bls_cpk)
func (*PrivateAccountApi) SendTransaction ¶
func (y *PrivateAccountApi) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error)
signTransaction sets defaults and signs the given transaction NOTE: the caller needs to ensure that the nonceLock is held, if applicable, and release it after the transaction has been submitted to the tx pool
func (*PrivateAccountApi) Sign ¶
func (y *PrivateAccountApi) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error)
Sign calculates an YOUChain ECDSA signature for: keccack256("\x19YOUChain Signed Message:\n" + len(message) + message))
Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.
The key used to calculate the signature is decrypted with the given password.
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
func (*PrivateAccountApi) SignTransaction ¶
func (y *PrivateAccountApi) SignTransaction(ctx context.Context, args SendTxArgs, passwd string) (*SignTransactionResult, error)
SignTransaction will create a transaction from the given arguments and tries to sign it with the key associated with args.To. If the given passwd isn't able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast to other nodes
func (*PrivateAccountApi) UnlockAccount ¶
func (y *PrivateAccountApi) UnlockAccount(addr common.Address, password string, duration *uint64) (bool, error)
UnlockAccount will unlock the account associated with the given address with the given password for duration seconds. If duration is nil it will use a default of 300 seconds. It returns an indication if the account was unlocked.
type PrivateDevApi ¶
type PrivateDevApi struct {
// contains filtered or unexported fields
}
private api for dev
func NewPrivateDevApi ¶
func NewPrivateDevApi(c *Container) *PrivateDevApi
func (*PrivateDevApi) DoubleSign ¶
func (*PrivateDevApi) Exit ¶
func (api *PrivateDevApi) Exit() error
func (*PrivateDevApi) SendRawTransactions ¶
func (api *PrivateDevApi) SendRawTransactions(encodedTxs []hexutil.Bytes) ([]string, error)
func (*PrivateDevApi) SendTransactions ¶
func (api *PrivateDevApi) SendTransactions(signedTxs []*types.Transaction) ([]string, error)
func (*PrivateDevApi) SetHead ¶
func (api *PrivateDevApi) SetHead(number uint64) error
Rewind rewinds the local chain to a new head. Everything above the new head will be deleted and the new one set. dev_rewind
func (*PrivateDevApi) SetPrintOrigin ¶
func (api *PrivateDevApi) SetPrintOrigin(print bool) error
func (*PrivateDevApi) StateDump ¶
func (api *PrivateDevApi) StateDump() (state.Dump, error)
StateDump retrieves the trie in the stateDB. dev_stateDump
func (*PrivateDevApi) StateDumpByNumber ¶
func (api *PrivateDevApi) StateDumpByNumber(ctx context.Context, blockNr rpc.BlockNumber) (state.Dump, error)
func (*PrivateDevApi) StateLogDump ¶
func (api *PrivateDevApi) StateLogDump() (state.DumpAllLogs, error)
StateLogDump retrieves all logs in the stateDB. dev_stateLogDump
func (*PrivateDevApi) Stop ¶
func (api *PrivateDevApi) Stop() error
func (*PrivateDevApi) Verbosity ¶
func (api *PrivateDevApi) Verbosity(verbosity int) error
func (*PrivateDevApi) Vmodule ¶
func (api *PrivateDevApi) Vmodule(vmodule string) error
type PublicMainApi ¶
type PublicMainApi struct {
// contains filtered or unexported fields
}
public api for main
func NewPublicMainApi ¶
func NewPublicMainApi(c *Container, nonceLock *AddrLocker) *PublicMainApi
func (*PublicMainApi) Accounts ¶
func (y *PublicMainApi) Accounts() []common.Address
Accounts returns the collection of accounts this node manages
func (*PublicMainApi) BlockNumber ¶
func (y *PublicMainApi) BlockNumber() (hexutil.Uint64, error)
func (*PublicMainApi) Call ¶
func (y *PublicMainApi) Call(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
Call executes the given transaction on the state for the given block number. It doesn't make and changes in the state/blockchain and is useful to execute and retrieve values.
func (*PublicMainApi) ChangeStatusValidator ¶
func (y *PublicMainApi) ChangeStatusValidator(ctx context.Context, nonce uint64, mainAddress common.Address, status uint8) (hexutil.Bytes, error)
build tx.data
func (*PublicMainApi) CreateValidator ¶
func (y *PublicMainApi) CreateValidator(ctx context.Context, nonce uint64, name string, operator, coinbase common.Address, mainPubKey, blsPubKey hexutil.Bytes, value hexutil.Big, role uint8, acceptDelegation, commissionRate, riskObligation uint16) (hexutil.Bytes, error)
build tx.data
func (*PublicMainApi) DepositValidator ¶
func (y *PublicMainApi) DepositValidator(ctx context.Context, nonce uint64, mainAddress common.Address, value hexutil.Big) (hexutil.Bytes, error)
build tx.data
func (*PublicMainApi) EstimateGas ¶
EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.
func (*PublicMainApi) GetBalance ¶
func (y *PublicMainApi) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Big, error)
GetBalance returns the amount of lu for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
func (*PublicMainApi) GetBlockByHash ¶
func (*PublicMainApi) GetBlockByNumber ¶
func (y *PublicMainApi) GetBlockByNumber(ctx context.Context, blockNr rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
GetBlockByNumber returns the requested block. When blockNr is -1 the chain head is returned. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
func (*PublicMainApi) GetBlockTransactionCountByHash ¶
func (*PublicMainApi) GetBlockTransactionCountByNumber ¶
func (y *PublicMainApi) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*hexutil.Uint, error)
GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
func (*PublicMainApi) GetCode ¶
func (y *PublicMainApi) GetCode(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
GetCode returns the code stored at the given address in the state for the given block number.
func (*PublicMainApi) GetDelegationAddData ¶
func (*PublicMainApi) GetDelegationSettleData ¶
func (*PublicMainApi) GetDelegationSubData ¶
func (*PublicMainApi) GetDelegationsFrom ¶
func (y *PublicMainApi) GetDelegationsFrom(ctx context.Context, delegator common.Address, blockNr rpc.BlockNumber) (map[string]interface{}, error)
func (*PublicMainApi) GetPoolNonce ¶
func (y *PublicMainApi) GetPoolNonce(address string) (*hexutil.Uint64, error)
func (*PublicMainApi) GetProof ¶
func (y *PublicMainApi) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNr rpc.BlockNumber) (*AccountResult, error)
GetProof returns the Merkle-proof for a given account and optionally some storage keys.
func (*PublicMainApi) GetStakingEndBlockReceipt ¶
func (y *PublicMainApi) GetStakingEndBlockReceipt(ctx context.Context, blockNr rpc.BlockNumber) (map[string]interface{}, error)
func (*PublicMainApi) GetStakingRecord ¶ added in v0.9.9
func (y *PublicMainApi) GetStakingRecord(ctx context.Context, validator common.Address, blockNr rpc.BlockNumber) (*RPCStakingRecord, error)
func (*PublicMainApi) GetStorageAt ¶
func (y *PublicMainApi) GetStorageAt(ctx context.Context, address common.Address, key string, blockNr rpc.BlockNumber) (hexutil.Bytes, error)
GetStorageAt returns the storage from the state at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.
func (*PublicMainApi) GetTransactionByBlockHashAndIndex ¶
func (y *PublicMainApi) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (*RPCTransaction, error)
func (*PublicMainApi) GetTransactionByBlockNumberAndIndex ¶
func (y *PublicMainApi) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (*RPCTransaction, error)
GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
func (*PublicMainApi) GetTransactionByHash ¶
func (y *PublicMainApi) GetTransactionByHash(txHash common.Hash) (*RPCTransaction, error)
func (*PublicMainApi) GetTransactionCount ¶
func (y *PublicMainApi) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)
GetTransactionCount returns the number of transactions the given address has sent for the given block number
func (*PublicMainApi) GetTransactionReceipt ¶
func (y *PublicMainApi) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (*PublicMainApi) GetWithdrawRecords ¶
func (y *PublicMainApi) GetWithdrawRecords(ctx context.Context, blockNr rpc.BlockNumber) ([]*state.DumpWithdrawRecord, error)
func (*PublicMainApi) Mining ¶
func (y *PublicMainApi) Mining() bool
func (*PublicMainApi) NetworkId ¶
func (y *PublicMainApi) NetworkId() hexutil.Uint64
NetworkId is the network id for the current YOUChain network config.
func (*PublicMainApi) ProtocolVersion ¶
func (y *PublicMainApi) ProtocolVersion() hexutil.Uint
YouVersion returns the current YOU protocol version this node supports
func (*PublicMainApi) SendRawTransaction ¶
SendRawTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.
func (*PublicMainApi) SendSignedTransaction ¶
func (y *PublicMainApi) SendSignedTransaction(signedTx *types.Transaction) (string, error)
func (*PublicMainApi) SendTransaction ¶
func (y *PublicMainApi) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)
SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.
func (*PublicMainApi) SettleValidator ¶
func (y *PublicMainApi) SettleValidator(ctx context.Context, mainAddress common.Address) (hexutil.Bytes, error)
build tx.data
func (*PublicMainApi) Sign ¶
Sign calculates an ECDSA signature for: keccack256("\x19Ethereum Signed Message:\n" + len(message) + message).
Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.
The account associated with addr must be unlocked.
func (*PublicMainApi) Syncing ¶
func (y *PublicMainApi) Syncing() (interface{}, error)
func (*PublicMainApi) UpdateValidator ¶
func (y *PublicMainApi) UpdateValidator(ctx context.Context, nonce uint64, name string, mainAddress, operator, coinbase common.Address, acceptDelegation, commissionRate, riskObligation *uint16) (hexutil.Bytes, error)
build tx.data
func (*PublicMainApi) ValidatorByMainAddress ¶
func (y *PublicMainApi) ValidatorByMainAddress(ctx context.Context, blockNr rpc.BlockNumber, mainAddress common.Address) (*state.DumpValidator, error)
func (*PublicMainApi) Validators ¶
func (y *PublicMainApi) Validators(ctx context.Context, role uint8, page, pageSize int, blockNr rpc.BlockNumber) ([]*state.DumpValidator, error)
func (*PublicMainApi) ValidatorsStat ¶
func (y *PublicMainApi) ValidatorsStat(ctx context.Context, blockNr rpc.BlockNumber) (map[params.ValidatorRole]state.DumpValidatorsStatItem, error)
type PublicTxpoolApi ¶
type PublicTxpoolApi struct {
// contains filtered or unexported fields
}
func NewPublicTxpoolApi ¶
func NewPublicTxpoolApi(c *Container) *PublicTxpoolApi
func (*PublicTxpoolApi) Content ¶
func (y *PublicTxpoolApi) Content() map[string]map[string]map[string]*RPCTransaction
Content returns the transactions contained within the transaction pool.
type RPCBlacklistItem ¶
type RPCBlacklistItem struct { Count int ItemsInfo []p2p.BlacklistItem }
type RPCPeersInfo ¶
type RPCStakingRecord ¶ added in v0.9.9
type RPCTransaction ¶
type RPCTransaction struct { BlockHash common.Hash `json:"blockHash"` 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"` Input hexutil.Bytes `json:"input"` 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"` }
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 into the transaction pool.
type SignTransactionResult ¶
type SignTransactionResult struct { Raw hexutil.Bytes `json:"raw"` Tx *types.Transaction `json:"tx"` }
SignTransactionResult represents a RLP encoded signed transaction.