Add fees and memo to REST, updated CLI to receive coins as fees (#3069)

This commit is contained in:
Federico Kunze
2018-12-19 16:26:33 -08:00
committed by Jack Zampolin
parent c9ef680f67
commit f02f7aa5a0
24 changed files with 461 additions and 397 deletions
+2 -2
View File
@@ -22,12 +22,12 @@ func ExampleTxSendSize() {
addr1 := sdk.AccAddress(priv1.PubKey().Address())
priv2 := secp256k1.GenPrivKeySecp256k1([]byte{1})
addr2 := sdk.AccAddress(priv2.PubKey().Address())
coins := []sdk.Coin{sdk.NewCoin("denom", sdk.NewInt(10))}
coins := sdk.Coins{sdk.NewCoin("denom", sdk.NewInt(10))}
msg1 := bank.MsgSend{
Inputs: []bank.Input{bank.NewInput(addr1, coins)},
Outputs: []bank.Output{bank.NewOutput(addr2, coins)},
}
fee := auth.NewStdFee(gas, coins...)
fee := auth.NewStdFee(gas, coins)
signBytes := auth.StdSignBytes("example-chain-ID",
1, 1, fee, []sdk.Msg{msg1}, "")
sig, _ := priv1.Sign(signBytes)
+3 -3
View File
@@ -78,7 +78,7 @@ func TestGaiaCLIFeesDeduction(t *testing.T) {
// test simulation
success := executeWrite(t, fmt.Sprintf(
"gaiacli tx send %v --amount=1000footoken --to=%s --from=foo --fee=1footoken --dry-run", flags, barAddr), app.DefaultKeyPass)
"gaiacli tx send %v --amount=1000footoken --to=%s --from=foo --fees=1footoken --dry-run", flags, barAddr), app.DefaultKeyPass)
require.True(t, success)
tests.WaitForNextNBlocksTM(1, port)
// ensure state didn't change
@@ -87,7 +87,7 @@ func TestGaiaCLIFeesDeduction(t *testing.T) {
// insufficient funds (coins + fees)
success = executeWrite(t, fmt.Sprintf(
"gaiacli tx send %v --amount=1000footoken --to=%s --from=foo --fee=1footoken", flags, barAddr), app.DefaultKeyPass)
"gaiacli tx send %v --amount=1000footoken --to=%s --from=foo --fees=1footoken", flags, barAddr), app.DefaultKeyPass)
require.False(t, success)
tests.WaitForNextNBlocksTM(1, port)
// ensure state didn't change
@@ -96,7 +96,7 @@ func TestGaiaCLIFeesDeduction(t *testing.T) {
// test success (transfer = coins + fees)
success = executeWrite(t, fmt.Sprintf(
"gaiacli tx send %v --fee=300footoken --amount=500footoken --to=%s --from=foo", flags, barAddr), app.DefaultKeyPass)
"gaiacli tx send %v --fees=300footoken --amount=500footoken --to=%s --from=foo", flags, barAddr), app.DefaultKeyPass)
require.True(t, success)
cleanupDirs(gaiadHome, gaiacliHome)
}