cosmos-sdk/types/account.go

35 lines
883 B
Go
Raw Normal View History

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 {
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
GetCoins() Coins
2018-01-20 11:19:44 -08:00
SetCoins(Coins) error
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
// AccountStore indexes accounts by address.
type AccountStore interface {
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
}
// new(AccountStoreKey) is a capabilities key.
type AccountStoreKey struct{}