parent
5bafa5f6b4
commit
5200765dab
4 changed files with 23 additions and 19 deletions
|
@ -55,7 +55,8 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
e.Run(t, "neo-go", "wallet", "candidate", "register",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", testcli.ValidatorWallet,
|
||||
"--address", validatorAddress)
|
||||
"--address", validatorAddress,
|
||||
"--force")
|
||||
e.CheckTxPersisted(t)
|
||||
|
||||
vs, err := e.Chain.GetEnrollments()
|
||||
|
@ -77,7 +78,8 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", testcli.ValidatorWallet,
|
||||
"--address", validatorAddress,
|
||||
"--candidate", validatorHex)
|
||||
"--candidate", validatorHex,
|
||||
"--force")
|
||||
_, index := e.CheckTxPersisted(t)
|
||||
|
||||
vs, err = e.Chain.GetEnrollments()
|
||||
|
@ -110,7 +112,8 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
e.Run(t, "neo-go", "wallet", "candidate", "vote",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", testcli.ValidatorWallet,
|
||||
"--address", validatorAddress)
|
||||
"--address", validatorAddress,
|
||||
"--force")
|
||||
_, index = e.CheckTxPersisted(t)
|
||||
|
||||
vs, err = e.Chain.GetEnrollments()
|
||||
|
@ -143,7 +146,8 @@ func TestRegisterCandidate(t *testing.T) {
|
|||
e.Run(t, "neo-go", "wallet", "candidate", "unregister",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", testcli.ValidatorWallet,
|
||||
"--address", validatorAddress)
|
||||
"--address", validatorAddress,
|
||||
"--force")
|
||||
e.CheckTxPersisted(t)
|
||||
|
||||
vs, err = e.Chain.GetEnrollments()
|
||||
|
|
|
@ -22,13 +22,15 @@ func newValidatorCommands() []cli.Command {
|
|||
{
|
||||
Name: "register",
|
||||
Usage: "register as a new candidate",
|
||||
UsageText: "register -w <path> -r <rpc> -a <addr> [-g gas] [-e sysgas]",
|
||||
UsageText: "register -w <path> -r <rpc> -a <addr> [-g gas] [-e sysgas] [--out file] [--force]",
|
||||
Action: handleRegister,
|
||||
Flags: append([]cli.Flag{
|
||||
walletPathFlag,
|
||||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
outFlag,
|
||||
forceFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to register",
|
||||
|
@ -38,13 +40,15 @@ func newValidatorCommands() []cli.Command {
|
|||
{
|
||||
Name: "unregister",
|
||||
Usage: "unregister self as a candidate",
|
||||
UsageText: "unregister -w <path> -r <rpc> -a <addr> [-g gas] [-e sysgas]",
|
||||
UsageText: "unregister -w <path> -r <rpc> -a <addr> [-g gas] [-e sysgas] [--out file] [--force]",
|
||||
Action: handleUnregister,
|
||||
Flags: append([]cli.Flag{
|
||||
walletPathFlag,
|
||||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
outFlag,
|
||||
forceFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to unregister",
|
||||
|
@ -54,7 +58,7 @@ func newValidatorCommands() []cli.Command {
|
|||
{
|
||||
Name: "vote",
|
||||
Usage: "vote for a validator",
|
||||
UsageText: "vote -w <path> -r <rpc> [-s <timeout>] [-g gas] [-e sysgas] -a <addr> [-c <public key>]",
|
||||
UsageText: "vote -w <path> -r <rpc> [-s <timeout>] [-g gas] [-e sysgas] -a <addr> [-c <public key>] [--out file] [--force]",
|
||||
Description: `Votes for a validator by calling "vote" method of a NEO native
|
||||
contract. Do not provide candidate argument to perform unvoting.
|
||||
`,
|
||||
|
@ -64,6 +68,8 @@ func newValidatorCommands() []cli.Command {
|
|||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
outFlag,
|
||||
forceFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to vote from",
|
||||
|
@ -121,21 +127,12 @@ func handleNeoAction(ctx *cli.Context, mkTx func(*neo.Contract, util.Uint160, *w
|
|||
return cli.NewExitError(fmt.Errorf("RPC actor issue: %w", err), 1)
|
||||
}
|
||||
|
||||
gas := flags.Fixed8FromContext(ctx, "gas")
|
||||
sysgas := flags.Fixed8FromContext(ctx, "sysgas")
|
||||
contract := neo.New(act)
|
||||
tx, err := mkTx(contract, addr, acc)
|
||||
if err != nil {
|
||||
return cli.NewExitError(err, 1)
|
||||
}
|
||||
tx.NetworkFee += int64(gas)
|
||||
tx.SystemFee += int64(sysgas)
|
||||
res, _, err := act.SignAndSend(tx)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to sign/send transaction: %w", err), 1)
|
||||
}
|
||||
fmt.Fprintln(ctx.App.Writer, res.StringLE())
|
||||
return nil
|
||||
return signAndSendSomeTransaction(ctx, act, acc, tx)
|
||||
}
|
||||
|
||||
func handleVote(ctx *cli.Context) error {
|
||||
|
|
|
@ -93,6 +93,8 @@ func NewCommands() []cli.Command {
|
|||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
outFlag,
|
||||
forceFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to claim GAS for",
|
||||
|
@ -117,7 +119,7 @@ func NewCommands() []cli.Command {
|
|||
{
|
||||
Name: "claim",
|
||||
Usage: "claim GAS",
|
||||
UsageText: "neo-go wallet claim -w wallet [--wallet-config path] [-g gas] [-e sysgas] -a address -r endpoint [-s timeout]",
|
||||
UsageText: "neo-go wallet claim -w wallet [--wallet-config path] [-g gas] [-e sysgas] -a address -r endpoint [-s timeout] [--out file] [--force]",
|
||||
Action: claimGas,
|
||||
Flags: claimFlags,
|
||||
},
|
||||
|
|
|
@ -524,7 +524,8 @@ func TestWalletClaimGas(t *testing.T) {
|
|||
e.Run(t, "neo-go", "wallet", "claim",
|
||||
"--rpc-endpoint", "http://"+e.RPC.Addr,
|
||||
"--wallet", testcli.TestWalletPath,
|
||||
"--address", testcli.TestWalletAccount)
|
||||
"--address", testcli.TestWalletAccount,
|
||||
"--force")
|
||||
tx, height := e.CheckTxPersisted(t)
|
||||
balanceBefore.Sub(balanceBefore, big.NewInt(tx.NetworkFee+tx.SystemFee))
|
||||
balanceBefore.Add(balanceBefore, cl)
|
||||
|
|
Loading…
Reference in a new issue