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.
|
// Create and configure app.
|
||||||
var app = &BasecoinApp{}
|
var app = &BasecoinApp{}
|
||||||
app.initCapKeys() // ./capkeys.go
|
app.initCapKeys() // ./init_capkeys.go
|
||||||
app.initStores() // ./stores.go
|
app.initStores() // ./init_stores.go
|
||||||
app.initBaseApp() // ./baseapp.go
|
app.initBaseApp() // ./init_baseapp.go
|
||||||
app.initRoutes() // ./routes.go
|
app.initRoutes() // ./init_routes.go
|
||||||
|
|
||||||
// TODO: Load genesis
|
// TODO: Load genesis
|
||||||
// TODO: InitChain with validators
|
// TODO: InitChain with validators
|
||||||
|
|
|
@ -54,10 +54,8 @@ func (app *BasecoinApp) initAccountStore() {
|
||||||
// If there are additional interfaces & concrete types that
|
// If there are additional interfaces & concrete types that
|
||||||
// need to be registered w/ wire.Codec, they can be registered
|
// need to be registered w/ wire.Codec, they can be registered
|
||||||
// here before the accStore is sealed.
|
// here before the accStore is sealed.
|
||||||
//
|
cdc := accStore.WireCodec()
|
||||||
// cdc := accStore.WireCodec()
|
auth.RegisterWireBaseAccount(cdc)
|
||||||
// cdc.RegisterInterface(...)
|
|
||||||
// cdc.RegisterConcrete(...)
|
|
||||||
|
|
||||||
app.accStore = accStore.Seal()
|
app.accStore = accStore.Seal()
|
||||||
}
|
}
|
|
@ -3,9 +3,9 @@ package auth
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
crypto "github.com/tendermint/go-crypto"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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
|
acc.Sequence = seq
|
||||||
return nil
|
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
|
// NewAccountStore returns a new sdk.AccountStore that
|
||||||
// uses go-wire to (binary) encode and decode concrete sdk.Accounts.
|
// uses go-wire to (binary) encode and decode concrete sdk.Accounts.
|
||||||
func NewAccountStore(key sdk.SubstoreKey, proto sdk.Account) accountStore {
|
func NewAccountStore(key sdk.SubstoreKey, proto sdk.Account) accountStore {
|
||||||
|
cdc := wire.NewCodec()
|
||||||
return accountStore{
|
return accountStore{
|
||||||
key: key,
|
key: key,
|
||||||
proto: proto,
|
proto: proto,
|
||||||
cdc: wire.NewCodec(),
|
cdc: cdc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue