mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-09 03:13:13 +00:00
cli: add await flag for operations with transactions
New --await flag is an option to synchronize on transaction execution for CLI commands. Closes #3244 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
4f5e3f363a
commit
0ffa24932b
18 changed files with 383 additions and 39 deletions
|
@ -17,12 +17,14 @@ import (
|
|||
// NewCommands returns util commands for neo-go CLI.
|
||||
func NewCommands() []cli.Command {
|
||||
txDumpFlags := append([]cli.Flag{}, options.RPC...)
|
||||
txSendFlags := append(txDumpFlags, txctx.AwaitFlag)
|
||||
txCancelFlags := append([]cli.Flag{
|
||||
flags.AddressFlag{
|
||||
Name: "address, a",
|
||||
Usage: "address to use as conflicting transaction signee (and gas source)",
|
||||
},
|
||||
txctx.GasFlag,
|
||||
txctx.AwaitFlag,
|
||||
}, options.RPC...)
|
||||
txCancelFlags = append(txCancelFlags, options.Wallet...)
|
||||
return []cli.Command{
|
||||
|
@ -42,19 +44,20 @@ func NewCommands() []cli.Command {
|
|||
{
|
||||
Name: "sendtx",
|
||||
Usage: "Send complete transaction stored in a context file",
|
||||
UsageText: "sendtx [-r <endpoint>] <file.in>",
|
||||
UsageText: "sendtx [-r <endpoint>] <file.in> [--await]",
|
||||
Description: `Sends the transaction from the given context file to the given RPC node if it's
|
||||
completely signed and ready. This command expects a ContractParametersContext
|
||||
JSON file for input, it can't handle binary (or hex- or base64-encoded)
|
||||
transactions.
|
||||
transactions. If the --await flag is included, the command waits for the
|
||||
transaction to be included in a block before exiting.
|
||||
`,
|
||||
Action: sendTx,
|
||||
Flags: txDumpFlags,
|
||||
Flags: txSendFlags,
|
||||
},
|
||||
{
|
||||
Name: "canceltx",
|
||||
Usage: "Cancel transaction by sending conflicting transaction",
|
||||
UsageText: "canceltx <txid> -r <endpoint> --wallet <wallet> [--account <account>] [--wallet-config <path>] [--gas <gas>]",
|
||||
UsageText: "canceltx <txid> -r <endpoint> --wallet <wallet> [--account <account>] [--wallet-config <path>] [--gas <gas>] [--await]",
|
||||
Description: `Aims to prevent a transaction from being added to the blockchain by dispatching a more
|
||||
prioritized conflicting transaction to the specified RPC node. The input for this command should
|
||||
be the transaction hash. If another account is not specified, the conflicting transaction is
|
||||
|
@ -65,7 +68,8 @@ func NewCommands() []cli.Command {
|
|||
target transaction's ValidUntilBlock value. If the target transaction is not in the memory pool, standard
|
||||
NetworkFee calculations are performed based on the calculatenetworkfee RPC request. If the --gas
|
||||
flag is included, the specified value is added to the resulting conflicting transaction network fee
|
||||
in both scenarios.`,
|
||||
in both scenarios. When the --await flag is included, the command waits for one of the conflicting
|
||||
or target transactions to be included in a block.`,
|
||||
Action: cancelTx,
|
||||
Flags: txCancelFlags,
|
||||
},
|
||||
|
@ -75,6 +79,11 @@ func NewCommands() []cli.Command {
|
|||
UsageText: "txdump [-r <endpoint>] <file.in>",
|
||||
Action: txDump,
|
||||
Flags: txDumpFlags,
|
||||
Description: `Dumps the transaction from the given parameter context file to
|
||||
the output. This command expects a ContractParametersContext JSON file for input, it can't handle
|
||||
binary (or hex- or base64-encoded) transactions. If --rpc-endpoint flag is specified the result
|
||||
of the given script after running it true the VM will be printed. Otherwise only transaction will
|
||||
be printed.`,
|
||||
},
|
||||
{
|
||||
Name: "ops",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue