diff --git a/gno.land/cmd/gnoland/testdata/gnoweb_airgapped.txtar b/gno.land/cmd/gnoland/testdata/gnoweb_airgapped.txtar new file mode 100644 index 00000000000..e1ed4a63915 --- /dev/null +++ b/gno.land/cmd/gnoland/testdata/gnoweb_airgapped.txtar @@ -0,0 +1,39 @@ +# This test ensures that the "full security with airgap" commands, on gnoweb's +# help page, work as intended. + +# load the package from $WORK directory +loadpkg gno.land/r/demo/echo + +# start the node +gnoland start + +# Query account +gnokey query auth/accounts/$USER_ADDR_test1 +cmp stdout query.stdout.golden + +# Create transaction +gnokey maketx call -pkgpath "gno.land/r/demo/echo" -func "Render" -gas-fee 1000000ugnot -gas-wanted 2000000 -send "" -args "HELLO" test1 +cp stdout call.tx + +# Sign +gnokey sign -tx-path $WORK/call.tx -chainid "tendermint_test" -account-number 0 -account-sequence 0 test1 +cmpenv stdout sign.stdout.golden + +gnokey broadcast $WORK/call.tx +stdout '("HELLO" string)' +stdout 'GAS WANTED: 2000000' + +-- query.stdout.golden -- +height: 0 +data: { + "BaseAccount": { + "address": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5", + "coins": "9999999000000ugnot", + "public_key": null, + "account_number": "0", + "sequence": "0" + } +} +-- sign.stdout.golden -- + +Tx successfully signed and saved to $WORK/call.tx diff --git a/gno.land/cmd/gnoland/testdata/time-simple.txtar b/gno.land/cmd/gnoland/testdata/time_simple.txtar similarity index 100% rename from gno.land/cmd/gnoland/testdata/time-simple.txtar rename to gno.land/cmd/gnoland/testdata/time_simple.txtar diff --git a/gno.land/pkg/gnoweb/static/js/realm_help.js b/gno.land/pkg/gnoweb/static/js/realm_help.js index 5670309bcd1..30cfacd5f59 100644 --- a/gno.land/pkg/gnoweb/static/js/realm_help.js +++ b/gno.land/pkg/gnoweb/static/js/realm_help.js @@ -84,20 +84,19 @@ function updateCommand(x) { }); args.push(myAddr) var command = args.join(" "); - command = command + " > unsigned.tx"; + command = command + " > call.tx"; shell.append(u("").text(command)).append(u("
")); // command 2: sign tx. var args = ["gnokey", "sign", - "-txpath", "unsigned.tx", "-chainid", shq(chainid), - "-number", "ACCOUNTNUMBER", - "-sequence", "SEQUENCENUMBER", myAddr]; + "-tx-path", "call.tx", "-chainid", shq(chainid), + "-account-number", "ACCOUNTNUMBER", + "-account-sequence", "SEQUENCENUMBER", myAddr]; var command = args.join(" "); - command = command + " > signed.tx"; shell.append(u("").text(command)).append(u("
")); // command 3: broadcast tx. - var args = ["gnokey", "broadcast", "-remote", shq(remote), "signed.tx"]; + var args = ["gnokey", "broadcast", "-remote", shq(remote), "call.tx"]; var command = args.join(" "); command = command; shell.append(u("").text(command)).append(u("
")); diff --git a/gno.land/pkg/keyscli/addpkg.go b/gno.land/pkg/keyscli/addpkg.go index 9cac68c4c79..37463d13b5c 100644 --- a/gno.land/pkg/keyscli/addpkg.go +++ b/gno.land/pkg/keyscli/addpkg.go @@ -126,7 +126,7 @@ func execMakeAddPkg(cfg *MakeAddPkgCfg, args []string, io commands.IO) error { return err } } else { - fmt.Println(string(amino.MustMarshalJSON(tx))) + io.Println(string(amino.MustMarshalJSON(tx))) } return nil } diff --git a/gno.land/pkg/keyscli/call.go b/gno.land/pkg/keyscli/call.go index 7eb5be7d501..a7085bbfeb7 100644 --- a/gno.land/pkg/keyscli/call.go +++ b/gno.land/pkg/keyscli/call.go @@ -3,7 +3,6 @@ package keyscli import ( "context" "flag" - "fmt" "github.com/gnolang/gno/gno.land/pkg/sdk/vm" "github.com/gnolang/gno/tm2/pkg/amino" @@ -137,7 +136,7 @@ func execMakeCall(cfg *MakeCallCfg, args []string, io commands.IO) error { return err } } else { - fmt.Println(string(amino.MustMarshalJSON(tx))) + io.Println(string(amino.MustMarshalJSON(tx))) } return nil } diff --git a/gno.land/pkg/keyscli/run.go b/gno.land/pkg/keyscli/run.go index 9ae6132c8f3..aa0ee298201 100644 --- a/gno.land/pkg/keyscli/run.go +++ b/gno.land/pkg/keyscli/run.go @@ -131,7 +131,7 @@ func execMakeRun(cfg *MakeRunCfg, args []string, cmdio commands.IO) error { return err } } else { - fmt.Println(string(amino.MustMarshalJSON(tx))) + cmdio.Println(string(amino.MustMarshalJSON(tx))) } return nil } diff --git a/tm2/pkg/crypto/keys/client/broadcast.go b/tm2/pkg/crypto/keys/client/broadcast.go index c088c63d19f..70dafaaef90 100644 --- a/tm2/pkg/crypto/keys/client/broadcast.go +++ b/tm2/pkg/crypto/keys/client/broadcast.go @@ -40,7 +40,7 @@ func NewBroadcastCmd(rootCfg *BaseCfg, io commands.IO) *commands.Command { }, cfg, func(_ context.Context, args []string) error { - return execBroadcast(cfg, args, commands.NewDefaultIO()) + return execBroadcast(cfg, args, io) }, ) } diff --git a/tm2/pkg/crypto/keys/client/export.go b/tm2/pkg/crypto/keys/client/export.go index b80942734f6..b7a82a5af6e 100644 --- a/tm2/pkg/crypto/keys/client/export.go +++ b/tm2/pkg/crypto/keys/client/export.go @@ -105,7 +105,7 @@ func execExport(cfg *ExportCfg, io commands.IO) error { panic(err) } - fmt.Printf("privk:\n%x\n", privk.Bytes()) + io.Printf("privk:\n%x\n", privk.Bytes()) } else { // Get the armor encrypt password encryptPassword, err := io.GetCheckPassword( diff --git a/tm2/pkg/crypto/keys/client/send.go b/tm2/pkg/crypto/keys/client/send.go index 964c0a86993..28016889548 100644 --- a/tm2/pkg/crypto/keys/client/send.go +++ b/tm2/pkg/crypto/keys/client/send.go @@ -3,7 +3,6 @@ package client import ( "context" "flag" - "fmt" "github.com/gnolang/gno/tm2/pkg/amino" "github.com/gnolang/gno/tm2/pkg/commands" @@ -124,7 +123,7 @@ func execMakeSend(cfg *MakeSendCfg, args []string, io commands.IO) error { return err } } else { - fmt.Println(string(amino.MustMarshalJSON(tx))) + io.Println(string(amino.MustMarshalJSON(tx))) } return nil }