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-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-01-12 11:49:53 -08:00
|
|
|
GetAddress() crypto.Address
|
|
|
|
SetAddress(crypto.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-01-12 11:49:53 -08:00
|
|
|
NewAccountWithAddress(ctx Context, addr crypto.Address) Account
|
|
|
|
GetAccount(ctx Context, addr crypto.Address) Account
|
|
|
|
SetAccount(ctx Context, acc Account)
|
2018-01-10 20:11:44 -08:00
|
|
|
}
|