Plugin support for SetOption, Query, and Commit

This commit is contained in:
Jae Kwon
2016-03-24 14:10:17 -07:00
parent 964a4cfd50
commit 601a654b7d
5 changed files with 124 additions and 40 deletions
+29 -7
View File
@@ -8,17 +8,16 @@ import (
"github.com/tendermint/basecoin/types"
. "github.com/tendermint/go-common"
"github.com/tendermint/go-wire"
govtypes "github.com/tendermint/governmint/types"
eyescli "github.com/tendermint/merkleeyes/client"
_ "github.com/tendermint/tendermint/rpc/core/types" // Register RPCResponse > Result types
)
/*
Get the "test" account.
PrivKey: 019F86D081884C7D659A2FEAA0C55AD015A3BF4F1B2B0B822CD15D6C15B0F00A0867D3B5EAF0C0BF6B5A602D359DAECC86A7A74053490EC37AE08E71360587C870
PubKey: 0167D3B5EAF0C0BF6B5A602D359DAECC86A7A74053490EC37AE08E71360587C870
Address: D9B727742AA29FA638DC63D70813C976014C4CE0
*/
func main() {
//testSendTx()
testGov()
}
func testSendTx() {
eyesCli := eyescli.NewLocalClient()
bcApp := app.NewBasecoin(eyesCli)
fmt.Println(bcApp.Info())
@@ -61,4 +60,27 @@ func main() {
txBytes := wire.BinaryBytes(tx)
res := bcApp.AppendTx(txBytes)
fmt.Println(res)
if res.IsErr() {
Exit(Fmt("Failed: %v", res.Error()))
}
}
func testGov() {
eyesCli := eyescli.NewLocalClient()
bcApp := app.NewBasecoin(eyesCli)
fmt.Println(bcApp.Info())
tPriv := tests.PrivAccountFromSecret("test")
// Seed Basecoin with admin using PrivAccount
tAcc := tPriv.Account
adminEntity := govtypes.Entity{
ID: "",
PubKey: tAcc.PubKey,
}
log := bcApp.SetOption("GOV:admin", string(wire.JSONBytes(adminEntity)))
if log != "Success" {
Exit(Fmt("Failed to set option: %v", log))
}
// TODO test proposals or something.
}