x/auth/Account -> x/auth/BaseAccount; RegisterWireBaseAccount()
This commit is contained in:
parent
f942cb4340
commit
561da6353f
|
@ -31,10 +31,10 @@ func NewBasecoinApp() *BasecoinApp {
|
|||
|
||||
// Create and configure app.
|
||||
var app = &BasecoinApp{}
|
||||
app.initCapKeys() // ./capkeys.go
|
||||
app.initStores() // ./stores.go
|
||||
app.initBaseApp() // ./baseapp.go
|
||||
app.initRoutes() // ./routes.go
|
||||
app.initCapKeys() // ./init_capkeys.go
|
||||
app.initStores() // ./init_stores.go
|
||||
app.initBaseApp() // ./init_baseapp.go
|
||||
app.initRoutes() // ./init_routes.go
|
||||
|
||||
// TODO: Load genesis
|
||||
// TODO: InitChain with validators
|
||||
|
|
|
@ -54,10 +54,8 @@ func (app *BasecoinApp) initAccountStore() {
|
|||
// If there are additional interfaces & concrete types that
|
||||
// need to be registered w/ wire.Codec, they can be registered
|
||||
// here before the accStore is sealed.
|
||||
//
|
||||
// cdc := accStore.WireCodec()
|
||||
// cdc.RegisterInterface(...)
|
||||
// cdc.RegisterConcrete(...)
|
||||
cdc := accStore.WireCodec()
|
||||
auth.RegisterWireBaseAccount(cdc)
|
||||
|
||||
app.accStore = accStore.Seal()
|
||||
}
|
|
@ -3,9 +3,9 @@ package auth
|
|||
import (
|
||||
"errors"
|
||||
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/go-wire"
|
||||
)
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
@ -88,3 +88,11 @@ func (acc *BaseAccount) SetSequence(seq int64) error {
|
|||
acc.Sequence = seq
|
||||
return nil
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Wire
|
||||
|
||||
func RegisterWireBaseAccount(cdc *wire.Codec) {
|
||||
// Register crypto.[PubKey,PrivKey,Signature] types.
|
||||
crypto.RegisterWire(cdc)
|
||||
}
|
|
@ -28,10 +28,11 @@ type accountStore struct {
|
|||
// NewAccountStore returns a new sdk.AccountStore that
|
||||
// uses go-wire to (binary) encode and decode concrete sdk.Accounts.
|
||||
func NewAccountStore(key sdk.SubstoreKey, proto sdk.Account) accountStore {
|
||||
cdc := wire.NewCodec()
|
||||
return accountStore{
|
||||
key: key,
|
||||
proto: proto,
|
||||
cdc: wire.NewCodec(),
|
||||
cdc: cdc,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue