forked from TrueCloudLab/neoneo-go
cli/wallet: add sysgas option to candidate and claim commands
It doesn't make a lot of sense, but hey, it's a transaction, it can have a bit more GAS.
This commit is contained in:
parent
1ea06e9757
commit
5bafa5f6b4
2 changed files with 10 additions and 4 deletions
|
@ -22,12 +22,13 @@ func newValidatorCommands() []cli.Command {
|
|||
{
|
||||
Name: "register",
|
||||
Usage: "register as a new candidate",
|
||||
UsageText: "register -w <path> -r <rpc> -a <addr>",
|
||||
UsageText: "register -w <path> -r <rpc> -a <addr> [-g gas] [-e sysgas]",
|
||||
Action: handleRegister,
|
||||
Flags: append([]cli.Flag{
|
||||
walletPathFlag,
|
||||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to register",
|
||||
|
@ -37,12 +38,13 @@ func newValidatorCommands() []cli.Command {
|
|||
{
|
||||
Name: "unregister",
|
||||
Usage: "unregister self as a candidate",
|
||||
UsageText: "unregister -w <path> -r <rpc> -a <addr>",
|
||||
UsageText: "unregister -w <path> -r <rpc> -a <addr> [-g gas] [-e sysgas]",
|
||||
Action: handleUnregister,
|
||||
Flags: append([]cli.Flag{
|
||||
walletPathFlag,
|
||||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to unregister",
|
||||
|
@ -52,7 +54,7 @@ func newValidatorCommands() []cli.Command {
|
|||
{
|
||||
Name: "vote",
|
||||
Usage: "vote for a validator",
|
||||
UsageText: "vote -w <path> -r <rpc> [-s <timeout>] [-g gas] -a <addr> [-c <public key>]",
|
||||
UsageText: "vote -w <path> -r <rpc> [-s <timeout>] [-g gas] [-e sysgas] -a <addr> [-c <public key>]",
|
||||
Description: `Votes for a validator by calling "vote" method of a NEO native
|
||||
contract. Do not provide candidate argument to perform unvoting.
|
||||
`,
|
||||
|
@ -61,6 +63,7 @@ func newValidatorCommands() []cli.Command {
|
|||
walletPathFlag,
|
||||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to vote from",
|
||||
|
@ -119,12 +122,14 @@ func handleNeoAction(ctx *cli.Context, mkTx func(*neo.Contract, util.Uint160, *w
|
|||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -92,6 +92,7 @@ func NewCommands() []cli.Command {
|
|||
walletPathFlag,
|
||||
walletConfigFlag,
|
||||
gasFlag,
|
||||
sysGasFlag,
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "Address to claim GAS for",
|
||||
|
@ -116,7 +117,7 @@ func NewCommands() []cli.Command {
|
|||
{
|
||||
Name: "claim",
|
||||
Usage: "claim GAS",
|
||||
UsageText: "neo-go wallet claim -w wallet [--wallet-config path] [-g gas] -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]",
|
||||
Action: claimGas,
|
||||
Flags: claimFlags,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue