forked from TrueCloudLab/neoneo-go
cli/wallet: add sysgas to transfer functions
It might also be useful there.
This commit is contained in:
parent
2a57e48897
commit
41e0218555
2 changed files with 12 additions and 2 deletions
|
@ -235,6 +235,7 @@ func transferNEP11(ctx *cli.Context) error {
|
||||||
|
|
||||||
func signAndSendNEP11Transfer(ctx *cli.Context, c *client.Client, acc *wallet.Account, token, to util.Uint160, tokenID string, amount *big.Int, data interface{}, cosigners []client.SignerAccount) error {
|
func signAndSendNEP11Transfer(ctx *cli.Context, c *client.Client, acc *wallet.Account, token, to util.Uint160, tokenID string, amount *big.Int, data interface{}, cosigners []client.SignerAccount) error {
|
||||||
gas := flags.Fixed8FromContext(ctx, "gas")
|
gas := flags.Fixed8FromContext(ctx, "gas")
|
||||||
|
sysgas := flags.Fixed8FromContext(ctx, "sysgas")
|
||||||
|
|
||||||
var (
|
var (
|
||||||
tx *transaction.Transaction
|
tx *transaction.Transaction
|
||||||
|
@ -254,6 +255,7 @@ func signAndSendNEP11Transfer(ctx *cli.Context, c *client.Client, acc *wallet.Ac
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(err, 1)
|
return cli.NewExitError(err, 1)
|
||||||
}
|
}
|
||||||
|
tx.SystemFee += int64(sysgas)
|
||||||
|
|
||||||
if outFile := ctx.String("out"); outFile != "" {
|
if outFile := ctx.String("out"); outFile != "" {
|
||||||
if err := paramcontext.InitAndSave(c.GetNetwork(), tx, acc, outFile); err != nil {
|
if err := paramcontext.InitAndSave(c.GetNetwork(), tx, acc, outFile); err != nil {
|
||||||
|
|
|
@ -25,8 +25,12 @@ var (
|
||||||
Usage: "Token to use (hash or name (for NEO/GAS or imported tokens))",
|
Usage: "Token to use (hash or name (for NEO/GAS or imported tokens))",
|
||||||
}
|
}
|
||||||
gasFlag = flags.Fixed8Flag{
|
gasFlag = flags.Fixed8Flag{
|
||||||
Name: "gas",
|
Name: "gas, g",
|
||||||
Usage: "Amount of GAS to attach to a tx",
|
Usage: "network fee to add to the transaction (prioritizing it)",
|
||||||
|
}
|
||||||
|
sysGasFlag = flags.Fixed8Flag{
|
||||||
|
Name: "sysgas, e",
|
||||||
|
Usage: "system fee to add to transaction (compensating for execution)",
|
||||||
}
|
}
|
||||||
baseBalanceFlags = []cli.Flag{
|
baseBalanceFlags = []cli.Flag{
|
||||||
walletPathFlag,
|
walletPathFlag,
|
||||||
|
@ -50,6 +54,7 @@ var (
|
||||||
toAddrFlag,
|
toAddrFlag,
|
||||||
tokenFlag,
|
tokenFlag,
|
||||||
gasFlag,
|
gasFlag,
|
||||||
|
sysGasFlag,
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "amount",
|
Name: "amount",
|
||||||
Usage: "Amount of asset to send",
|
Usage: "Amount of asset to send",
|
||||||
|
@ -60,6 +65,7 @@ var (
|
||||||
outFlag,
|
outFlag,
|
||||||
fromAddrFlag,
|
fromAddrFlag,
|
||||||
gasFlag,
|
gasFlag,
|
||||||
|
sysGasFlag,
|
||||||
}, options.RPC...)
|
}, options.RPC...)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -561,11 +567,13 @@ func transferNEP(ctx *cli.Context, standard string) error {
|
||||||
|
|
||||||
func signAndSendNEP17Transfer(ctx *cli.Context, c *client.Client, acc *wallet.Account, recipients []client.TransferTarget, cosigners []client.SignerAccount) error {
|
func signAndSendNEP17Transfer(ctx *cli.Context, c *client.Client, acc *wallet.Account, recipients []client.TransferTarget, cosigners []client.SignerAccount) error {
|
||||||
gas := flags.Fixed8FromContext(ctx, "gas")
|
gas := flags.Fixed8FromContext(ctx, "gas")
|
||||||
|
sysgas := flags.Fixed8FromContext(ctx, "sysgas")
|
||||||
|
|
||||||
tx, err := c.CreateNEP17MultiTransferTx(acc, int64(gas), recipients, cosigners)
|
tx, err := c.CreateNEP17MultiTransferTx(acc, int64(gas), recipients, cosigners)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.NewExitError(err, 1)
|
return cli.NewExitError(err, 1)
|
||||||
}
|
}
|
||||||
|
tx.SystemFee += int64(sysgas)
|
||||||
|
|
||||||
if outFile := ctx.String("out"); outFile != "" {
|
if outFile := ctx.String("out"); outFile != "" {
|
||||||
if err := paramcontext.InitAndSave(c.GetNetwork(), tx, acc, outFile); err != nil {
|
if err := paramcontext.InitAndSave(c.GetNetwork(), tx, acc, outFile); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue