diff --git a/docs/core/app1.md b/docs/core/app1.md index abc2c39b5d..7384db4330 100644 --- a/docs/core/app1.md +++ b/docs/core/app1.md @@ -243,7 +243,7 @@ Note this handler has unfettered access to the store specified by the capability For this first example, we will define a simple account that is JSON encoded: ```go -type app1Account struct { +type appAccount struct { Coins sdk.Coins `json:"coins"` } ``` @@ -294,7 +294,7 @@ func handleFrom(store sdk.KVStore, from sdk.Address, amt sdk.Coins) sdk.Result { } // Unmarshal the JSON account bytes. - var acc app1Account + var acc appAccount err := json.Unmarshal(accBytes, &acc) if err != nil { // InternalError @@ -326,10 +326,10 @@ func handleFrom(store sdk.KVStore, from sdk.Address, amt sdk.Coins) sdk.Result { func handleTo(store sdk.KVStore, to sdk.Address, amt sdk.Coins) sdk.Result { // Add msg amount to receiver account accBytes := store.Get(to) - var acc app1Account + var acc appAccount if accBytes == nil { // Receiver account does not already exist, create a new one. - acc = app1Account{} + acc = appAccount{} } else { // Receiver account already exists. Retrieve and decode it. err := json.Unmarshal(accBytes, &acc) diff --git a/docs/core/examples/app1.go b/docs/core/examples/app1.go index 2ac8fa5298..ec5b779e7c 100644 --- a/docs/core/examples/app1.go +++ b/docs/core/examples/app1.go @@ -149,7 +149,7 @@ func handleFrom(store sdk.KVStore, from sdk.Address, amt sdk.Coins) sdk.Result { } // Unmarshal the JSON account bytes. - var acc app1Account + var acc appAccount err := json.Unmarshal(accBytes, &acc) if err != nil { // InternalError @@ -181,10 +181,10 @@ func handleFrom(store sdk.KVStore, from sdk.Address, amt sdk.Coins) sdk.Result { func handleTo(store sdk.KVStore, to sdk.Address, amt sdk.Coins) sdk.Result { // Add msg amount to receiver account accBytes := store.Get(to) - var acc app1Account + var acc appAccount if accBytes == nil { // Receiver account does not already exist, create a new one. - acc = app1Account{} + acc = appAccount{} } else { // Receiver account already exists. Retrieve and decode it. err := json.Unmarshal(accBytes, &acc) @@ -210,7 +210,7 @@ func handleTo(store sdk.KVStore, to sdk.Address, amt sdk.Coins) sdk.Result { return sdk.Result{} } -type app1Account struct { +type appAccount struct { Coins sdk.Coins `json:"coins"` } diff --git a/docs/core/examples/app2.go b/docs/core/examples/app2.go index 87bf0ba1c3..5959fcd393 100644 --- a/docs/core/examples/app2.go +++ b/docs/core/examples/app2.go @@ -25,7 +25,6 @@ var ( ) func NewCodec() *wire.Codec { - // TODO register cdc := wire.NewCodec() cdc.RegisterInterface((*sdk.Msg)(nil), nil) cdc.RegisterConcrete(MsgSend{}, "example/MsgSend", nil) @@ -190,10 +189,10 @@ func handleMsgIssue(ctx sdk.Context, keyMain *sdk.KVStoreKey, keyAcc *sdk.KVStor // Add coins to receiver account bz := accStore.Get(o.Address) - var acc account + var acc appAccount if bz == nil { // Receiver account does not already exist, create a new one. - acc = account{} + acc = appAccount{} } else { // Receiver account already exists. Retrieve and decode it. err := json.Unmarshal(bz, &acc) @@ -219,7 +218,7 @@ func handleMsgIssue(ctx sdk.Context, keyMain *sdk.KVStoreKey, keyAcc *sdk.KVStor } return sdk.Result{ - // TODO: Tags + // TODO: Tags } } @@ -238,11 +237,6 @@ func (tx app2Tx) GetMsgs() []sdk.Msg { return []sdk.Msg{tx.Msg} } -// TODO: remove the need for this -func (tx app2Tx) GetMemo() string { - return "" -} - func (tx app2Tx) GetSignatures() []auth.StdSignature { return tx.Signatures } diff --git a/docs/core/examples/app3.go b/docs/core/examples/app3.go index 74142fd187..25036ef1b2 100644 --- a/docs/core/examples/app3.go +++ b/docs/core/examples/app3.go @@ -21,6 +21,7 @@ const ( func NewApp3(logger log.Logger, db dbm.DB) *bapp.BaseApp { + // Create the codec with registered Msg types cdc := NewCodec() // Create the base application object. @@ -32,6 +33,7 @@ func NewApp3(logger log.Logger, db dbm.DB) *bapp.BaseApp { keyFees := sdk.NewKVStoreKey("fee") // Set various mappers/keepers to interact easily with underlying stores + // TODO: Need to register Account interface or use different Codec accountMapper := auth.NewAccountMapper(cdc, keyAccount, &auth.BaseAccount{}) accountKeeper := bank.NewKeeper(accountMapper) metadataMapper := NewApp3MetaDataMapper(keyMain)