diff --git a/examples/basecoin/app/app.go b/examples/basecoin/app/app.go index cee058398..65a73367b 100644 --- a/examples/basecoin/app/app.go +++ b/examples/basecoin/app/app.go @@ -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 diff --git a/examples/basecoin/app/baseapp.go b/examples/basecoin/app/init_baseapp.go similarity index 100% rename from examples/basecoin/app/baseapp.go rename to examples/basecoin/app/init_baseapp.go diff --git a/examples/basecoin/app/capkeys.go b/examples/basecoin/app/init_capkeys.go similarity index 100% rename from examples/basecoin/app/capkeys.go rename to examples/basecoin/app/init_capkeys.go diff --git a/examples/basecoin/app/routes.go b/examples/basecoin/app/init_routes.go similarity index 100% rename from examples/basecoin/app/routes.go rename to examples/basecoin/app/init_routes.go diff --git a/examples/basecoin/app/stores.go b/examples/basecoin/app/init_stores.go similarity index 94% rename from examples/basecoin/app/stores.go rename to examples/basecoin/app/init_stores.go index 155d2ff3f..8abb5919b 100644 --- a/examples/basecoin/app/stores.go +++ b/examples/basecoin/app/init_stores.go @@ -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() } diff --git a/x/auth/account.go b/x/auth/baseaccount.go similarity index 88% rename from x/auth/account.go rename to x/auth/baseaccount.go index 1c6183da6..a9c547520 100644 --- a/x/auth/account.go +++ b/x/auth/baseaccount.go @@ -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) +} diff --git a/x/auth/account_test.go b/x/auth/baseaccount_test.go similarity index 100% rename from x/auth/account_test.go rename to x/auth/baseaccount_test.go diff --git a/x/auth/store.go b/x/auth/store.go index 188dd1afb..fee5e5cbe 100644 --- a/x/auth/store.go +++ b/x/auth/store.go @@ -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, } }