2018-01-07 12:27:56 -08:00
|
|
|
package types
|
2018-01-06 14:22:21 -08:00
|
|
|
|
|
|
|
import (
|
|
|
|
crypto "github.com/tendermint/go-crypto"
|
2018-03-01 23:49:07 -08:00
|
|
|
cmn "github.com/tendermint/tmlibs/common"
|
2018-01-06 14:22:21 -08:00
|
|
|
)
|
|
|
|
|
2018-03-02 09:21:49 -08:00
|
|
|
// Address in go-crypto style
|
2018-03-01 23:49:07 -08:00
|
|
|
type Address = cmn.HexBytes
|
|
|
|
|
2018-01-07 12:27:56 -08:00
|
|
|
// Account is a standard account using a sequence number for replay protection
|
|
|
|
// and a pubkey for authentication.
|
2018-01-06 14:22:21 -08:00
|
|
|
type Account interface {
|
2018-03-01 23:49:07 -08:00
|
|
|
GetAddress() Address
|
|
|
|
SetAddress(Address) error // errors if already set.
|
2018-01-06 14:22:21 -08:00
|
|
|
|
2018-01-10 20:11:44 -08:00
|
|
|
GetPubKey() crypto.PubKey // can return nil.
|
2018-01-06 14:22:21 -08:00
|
|
|
SetPubKey(crypto.PubKey) error
|
|
|
|
|
|
|
|
GetSequence() int64
|
|
|
|
SetSequence(int64) error
|
|
|
|
|
2018-01-12 11:49:53 -08:00
|
|
|
GetCoins() Coins
|
2018-01-20 11:19:44 -08:00
|
|
|
SetCoins(Coins) error
|
2018-01-12 11:49:53 -08:00
|
|
|
|
2018-01-06 14:22:21 -08:00
|
|
|
Get(key interface{}) (value interface{}, err error)
|
|
|
|
Set(key interface{}, value interface{}) error
|
|
|
|
}
|
2018-01-10 20:11:44 -08:00
|
|
|
|
2018-01-22 05:44:24 -08:00
|
|
|
// AccountMapper stores and retrieves accounts from stores
|
|
|
|
// retrieved from the context.
|
|
|
|
type AccountMapper interface {
|
2018-03-01 23:49:07 -08:00
|
|
|
NewAccountWithAddress(ctx Context, addr Address) Account
|
|
|
|
GetAccount(ctx Context, addr Address) Account
|
2018-01-12 11:49:53 -08:00
|
|
|
SetAccount(ctx Context, acc Account)
|
2018-01-10 20:11:44 -08:00
|
|
|
}
|
2018-02-28 17:57:38 -08:00
|
|
|
|
|
|
|
// Application function variable used to unmarshal account
|
|
|
|
type ParseAccount func([]byte) (Account, error)
|