mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
33 lines
1000 B
Go
33 lines
1000 B
Go
package core
|
|
|
|
import (
|
|
"github.com/tendermint/tendermint2/account"
|
|
)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
func GenPrivAccount() (*ResponseGenPrivAccount, error) {
|
|
return &ResponseGenPrivAccount{account.GenPrivAccount()}, nil
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
func GetAccount(address []byte) (*ResponseGetAccount, error) {
|
|
cache := mempoolReactor.Mempool.GetCache()
|
|
return &ResponseGetAccount{cache.GetAccount(address)}, nil
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
func ListAccounts() (*ResponseListAccounts, error) {
|
|
var blockHeight uint
|
|
var accounts []*account.Account
|
|
state := consensusState.GetState()
|
|
blockHeight = state.LastBlockHeight
|
|
state.GetAccounts().Iterate(func(key interface{}, value interface{}) bool {
|
|
accounts = append(accounts, value.(*account.Account))
|
|
return false
|
|
})
|
|
return &ResponseListAccounts{blockHeight, accounts}, nil
|
|
}
|