Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More work preparing for browse #3945

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions docs/content/chifra/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,30 +239,21 @@ Arguments:
addrs - one or more addresses (0x...) to process

Flags:
--delete delete a monitor, but do not remove it
--undelete undelete a previously deleted monitor
--remove remove a previously deleted monitor
-C, --clean clean (i.e. remove duplicate appearances) from monitors, optionally clear stage
-l, --list list monitors in the cache (--verbose for more detail)
-c, --count show the number of active monitors (included deleted but not removed monitors)
-S, --staged for --clean, --list, and --count options only, include staged monitors
-w, --watch continually scan for new blocks and extract data as per the command file
-a, --watchlist string available with --watch option only, a file containing the addresses to watch
-d, --commands string available with --watch option only, the file containing the list of commands to apply to each watched address
-b, --batch_size uint available with --watch option only, the number of monitors to process in each batch (default 8)
-u, --run_count uint available with --watch option only, run the monitor this many times, then quit
-s, --sleep float available with --watch option only, the number of seconds to sleep between runs (default 14)
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
-v, --verbose enable verbose output
-h, --help display this help screen
--delete delete a monitor, but do not remove it
--undelete undelete a previously deleted monitor
--remove remove a previously deleted monitor
-C, --clean clean (i.e. remove duplicate appearances) from monitors, optionally clear stage
-l, --list list monitors in the cache (--verbose for more detail)
-c, --count show the number of active monitors (included deleted but not removed monitors)
-S, --staged for --clean, --list, and --count options only, include staged monitors
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
-v, --verbose enable verbose output
-h, --help display this help screen

Notes:
- An address must be either an ENS name or start with '0x' and be forty-two characters long.
- If no address is presented to the --clean command, all existing monitors will be cleaned.
- The --watch option requires two additional parameters to be specified: --watchlist and --commands.
- Addresses provided on the command line are ignored in --watch mode.
- Providing the value existing to the --watchlist monitors all existing monitor files (see --list).
```

Data models produced by this tool:
Expand Down
2 changes: 1 addition & 1 deletion khedra
Submodule khedra updated 2 files
+394 −0 app/action_daemon.go
+35 −13 app/app.go
11 changes: 1 addition & 10 deletions src/apps/chifra/cmd/monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ const longMonitors = `Purpose:
const notesMonitors = `
Notes:
- An address must be either an ENS name or start with '0x' and be forty-two characters long.
- If no address is presented to the --clean command, all existing monitors will be cleaned.
- The --watch option requires two additional parameters to be specified: --watchlist and --commands.
- Addresses provided on the command line are ignored in --watch mode.
- Providing the value existing to the --watchlist monitors all existing monitor files (see --list).`
- If no address is presented to the --clean command, all existing monitors will be cleaned.`

func init() {
var capabilities caps.Capability // capabilities for chifra monitors
Expand All @@ -67,12 +64,6 @@ func init() {
monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().List, "list", "l", false, `list monitors in the cache (--verbose for more detail)`)
monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Count, "count", "c", false, `show the number of active monitors (included deleted but not removed monitors)`)
monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Staged, "staged", "S", false, `for --clean, --list, and --count options only, include staged monitors`)
monitorsCmd.Flags().BoolVarP(&monitorsPkg.GetOptions().Watch, "watch", "w", false, `continually scan for new blocks and extract data as per the command file`)
monitorsCmd.Flags().StringVarP(&monitorsPkg.GetOptions().Watchlist, "watchlist", "a", "", `available with --watch option only, a file containing the addresses to watch`)
monitorsCmd.Flags().StringVarP(&monitorsPkg.GetOptions().Commands, "commands", "d", "", `available with --watch option only, the file containing the list of commands to apply to each watched address`)
monitorsCmd.Flags().Uint64VarP(&monitorsPkg.GetOptions().BatchSize, "batch_size", "b", 8, `available with --watch option only, the number of monitors to process in each batch`)
monitorsCmd.Flags().Uint64VarP(&monitorsPkg.GetOptions().RunCount, "run_count", "u", 0, `available with --watch option only, run the monitor this many times, then quit`)
monitorsCmd.Flags().Float64VarP(&monitorsPkg.GetOptions().Sleep, "sleep", "s", 14, `available with --watch option only, the number of seconds to sleep between runs`)
globals.InitGlobals("monitors", monitorsCmd, &monitorsPkg.GetOptions().Globals, capabilities)

monitorsCmd.SetUsageTemplate(UsageWithNotes(notesMonitors))
Expand Down
1 change: 1 addition & 0 deletions src/apps/chifra/internal/daemon/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (opts *DaemonOptions) DaemonInternal(rCtx *output.RenderCtx) error {

// Start listening to the web sockets
RunWebsocketPool()

// Start listening for requests
logger.Fatal(http.ListenAndServe(opts.Url, NewRouter(opts.Silent)))

Expand Down
3 changes: 1 addition & 2 deletions src/apps/chifra/internal/export/handle_accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func (opts *ExportOptions) HandleAccounting(rCtx *output.RenderCtx, monitorArray
opts.Articulate = true

ledgers := &ledger.Ledger{}
chain := opts.Globals.Chain
abiCache := articulate.NewAbiCache(opts.Conn, opts.Articulate)
testMode := opts.Globals.TestMode
filter := filter.NewFilter(
Expand Down Expand Up @@ -68,6 +67,7 @@ func (opts *ExportOptions) HandleAccounting(rCtx *output.RenderCtx, monitorArray
} else if !opts.NoZero || cnt > 0 {
ledgers = ledger.NewLedger(
opts.Conn,
apps,
mon.Address,
opts.FirstBlock,
opts.LastBlock,
Expand All @@ -78,7 +78,6 @@ func (opts *ExportOptions) HandleAccounting(rCtx *output.RenderCtx, monitorArray
opts.Reversed,
&opts.Asset,
)
_ = ledgers.SetContexts(chain, apps)

for _, app := range apps {
if err := visitAppearance(&app); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions src/apps/chifra/internal/export/handle_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
)

func (opts *ExportOptions) HandleStatements(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error {
chain := opts.Globals.Chain
testMode := opts.Globals.TestMode
filter := filter.NewFilter(
opts.Reversed,
Expand Down Expand Up @@ -115,6 +114,7 @@ func (opts *ExportOptions) HandleStatements(rCtx *output.RenderCtx, monitorArray

ledgers := ledger.NewLedger(
opts.Conn,
apps,
mon.Address,
opts.FirstBlock,
opts.LastBlock,
Expand All @@ -125,7 +125,6 @@ func (opts *ExportOptions) HandleStatements(rCtx *output.RenderCtx, monitorArray
opts.Reversed,
&opts.Asset,
)
_ = ledgers.SetContexts(chain, apps)

items := make([]types.Statement, 0, len(thisMap))
for _, tx := range txArray {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/chifra/internal/export/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (opts *ExportOptions) validateExport() error {

if opts.Accounting {
if len(opts.Addrs) != 1 {
return validate.Usage("The {0} option is allows with only a single address.", "--accounting")
return validate.Usage("The {0} option allows only a single address.", "--accounting")
}

if !opts.Conn.IsNodeArchive() {
Expand Down
31 changes: 11 additions & 20 deletions src/apps/chifra/internal/monitors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,21 @@ Arguments:
addrs - one or more addresses (0x...) to process

Flags:
--delete delete a monitor, but do not remove it
--undelete undelete a previously deleted monitor
--remove remove a previously deleted monitor
-C, --clean clean (i.e. remove duplicate appearances) from monitors, optionally clear stage
-l, --list list monitors in the cache (--verbose for more detail)
-c, --count show the number of active monitors (included deleted but not removed monitors)
-S, --staged for --clean, --list, and --count options only, include staged monitors
-w, --watch continually scan for new blocks and extract data as per the command file
-a, --watchlist string available with --watch option only, a file containing the addresses to watch
-d, --commands string available with --watch option only, the file containing the list of commands to apply to each watched address
-b, --batch_size uint available with --watch option only, the number of monitors to process in each batch (default 8)
-u, --run_count uint available with --watch option only, run the monitor this many times, then quit
-s, --sleep float available with --watch option only, the number of seconds to sleep between runs (default 14)
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
-v, --verbose enable verbose output
-h, --help display this help screen
--delete delete a monitor, but do not remove it
--undelete undelete a previously deleted monitor
--remove remove a previously deleted monitor
-C, --clean clean (i.e. remove duplicate appearances) from monitors, optionally clear stage
-l, --list list monitors in the cache (--verbose for more detail)
-c, --count show the number of active monitors (included deleted but not removed monitors)
-S, --staged for --clean, --list, and --count options only, include staged monitors
-D, --decache removes related items from the cache
-x, --fmt string export format, one of [none|json*|txt|csv]
-v, --verbose enable verbose output
-h, --help display this help screen

Notes:
- An address must be either an ENS name or start with '0x' and be forty-two characters long.
- If no address is presented to the --clean command, all existing monitors will be cleaned.
- The --watch option requires two additional parameters to be specified: --watchlist and --commands.
- Addresses provided on the command line are ignored in --watch mode.
- Providing the value existing to the --watchlist monitors all existing monitor files (see --list).
```

Data models produced by this tool:
Expand Down
Loading
Loading