in progress

This commit is contained in:
sunnya97
2018-05-23 19:49:35 -07:00
parent 34f64752e4
commit cb52712660
25 changed files with 280 additions and 262 deletions
+5 -4
View File
@@ -6,6 +6,7 @@ import (
"github.com/pkg/errors"
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
rpcclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
cmn "github.com/tendermint/tmlibs/common"
@@ -109,11 +110,11 @@ func (ctx CoreContext) SignAndBuild(name, passphrase string, msg sdk.Msg, cdc *w
return nil, errors.Errorf("Chain ID required but not specified")
}
sequence := ctx.Sequence
signMsg := sdk.StdSignMsg{
signMsg := auth.StdSignMsg{
ChainID: chainID,
Sequences: []int64{sequence},
Msg: msg,
Fee: sdk.NewStdFee(10000, sdk.Coin{}), // TODO run simulate to estimate gas?
Fee: auth.NewStdFee(10000, sdk.Coin{}), // TODO run simulate to estimate gas?
}
keybase, err := keys.GetKeyBase()
@@ -128,14 +129,14 @@ func (ctx CoreContext) SignAndBuild(name, passphrase string, msg sdk.Msg, cdc *w
if err != nil {
return nil, err
}
sigs := []sdk.StdSignature{{
sigs := []auth.StdSignature{{
PubKey: pubkey,
Signature: sig,
Sequence: sequence,
}}
// marshal bytes
tx := sdk.NewStdTx(signMsg.Msg, signMsg.Fee, sigs)
tx := auth.NewStdTx(signMsg.Msg, signMsg.Fee, sigs)
return cdc.MarshalBinary(tx)
}
+3 -3
View File
@@ -3,7 +3,7 @@ package context
import (
rpcclient "github.com/tendermint/tendermint/rpc/client"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
)
// typical context created in sdk modules for transactions/queries
@@ -15,7 +15,7 @@ type CoreContext struct {
FromAddressName string
Sequence int64
Client rpcclient.Client
Decoder sdk.AccountDecoder
Decoder auth.AccountDecoder
AccountStore string
}
@@ -63,7 +63,7 @@ func (c CoreContext) WithClient(client rpcclient.Client) CoreContext {
}
// WithDecoder - return a copy of the context with an updated Decoder
func (c CoreContext) WithDecoder(decoder sdk.AccountDecoder) CoreContext {
func (c CoreContext) WithDecoder(decoder auth.AccountDecoder) CoreContext {
c.Decoder = decoder
return c
}
+2 -1
View File
@@ -17,6 +17,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/context"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
)
// Get the default command for a tx query
@@ -95,7 +96,7 @@ type txInfo struct {
}
func parseTx(cdc *wire.Codec, txBytes []byte) (sdk.Tx, error) {
var tx sdk.StdTx
var tx auth.StdTx
err := cdc.UnmarshalBinary(txBytes, &tx)
if err != nil {
return nil, err