-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathapp.go
191 lines (187 loc) · 4.7 KB
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
package cmd
import (
"fmt"
"os"
"github.com/smartcontractkit/chainlink/store"
"github.com/urfave/cli"
)
// NewApp returns the command-line parser/function-router for the given client
func NewApp(client *Client) *cli.App {
app := cli.NewApp()
app.Usage = "CLI for Chainlink"
app.Version = fmt.Sprintf("%v@%v", store.Version, store.Sha)
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "json, j",
Usage: "json output as opposed to table",
},
}
app.Before = func(c *cli.Context) error {
if c.Bool("json") {
client.Renderer = RendererJSON{Writer: os.Stdout}
}
return nil
}
app.Commands = []cli.Command{
{
Name: "node",
Aliases: []string{"n"},
Flags: []cli.Flag{
cli.StringFlag{
Name: "api, a",
Usage: "text file holding the API email and password, each on a line",
},
cli.StringFlag{
Name: "password, p",
Usage: "text file holding the password for the node's account",
},
cli.BoolFlag{
Name: "debug, d",
Usage: "set logger level to debug",
},
},
Usage: "Run the chainlink node",
Action: client.RunNode,
},
{
Name: "deleteuser",
Usage: "Erase the *local node's* user and corresponding session to force recreation on next node launch. Does not work remotely over API.",
Action: client.DeleteUser,
},
{
Name: "login",
Usage: "Login to remote client by creating a session cookie",
Action: client.RemoteLogin,
Flags: []cli.Flag{
cli.StringFlag{
Name: "file, f",
Usage: "text file holding the API email and password needed to create a session cookie",
},
},
},
{
Name: "account",
Aliases: []string{"a"},
Usage: "Display the account address with its ETH & LINK balances",
Action: client.DisplayAccountBalance,
},
{
Name: "jobspecs",
Aliases: []string{"jobs", "j", "specs"},
Usage: "Get all jobs",
Action: client.GetJobSpecs,
Flags: []cli.Flag{
cli.IntFlag{
Name: "page",
Usage: "page of results to display",
},
},
},
{
Name: "show",
Aliases: []string{"s"},
Usage: "Show a specific job",
Action: client.ShowJobSpec,
},
{
Name: "create",
Aliases: []string{"c"},
Usage: "Create job spec from JSON",
Action: client.CreateJobSpec,
},
{
Name: "run",
Aliases: []string{"r"},
Usage: "Begin job run for specid",
Action: client.CreateJobRun,
},
{
Name: "showrun",
Aliases: []string{"sr"},
Usage: "Show a job run for a RunID",
Action: client.ShowJobRun,
},
{
Name: "backup",
Usage: "Backup the database of the running node",
Action: client.BackupDatabase,
},
{
Name: "import",
Aliases: []string{"i"},
Usage: "Import a key file to use with the node",
Action: client.ImportKey,
},
{
Name: "bridge",
Usage: "Add a new bridge to the node",
Action: client.AddBridge,
},
{
Name: "getbridges",
Usage: "List all bridges added to the node",
Action: client.GetBridges,
Flags: []cli.Flag{
cli.IntFlag{
Name: "page",
Usage: "page of results to display",
},
},
},
{
Name: "showbridge",
Usage: "Show a specific bridge",
Action: client.ShowBridge,
},
{
Name: "removebridge",
Usage: "Removes a specific bridge",
Action: client.RemoveBridge,
},
{
Name: "agree",
Aliases: []string{"createsa"},
Usage: "Creates a service agreement",
Action: client.CreateServiceAgreement,
},
{
Name: "withdraw",
Aliases: []string{"w"},
Usage: "Withdraw, to an authorized Ethereum <address>, <amount> units of LINK. Withdraws from the configured oracle contract by default, or from contract optionally specified by a third command-line argument --from-oracle-contract-address=<contract address>. Address inputs must be in EIP55-compliant capitalization.",
Flags: []cli.Flag{
cli.StringFlag{
Name: "from-oracle-contract-address",
Usage: "address of Oracle contract to withdraw from (will use node default if unspecified)",
},
},
Action: client.Withdraw,
},
{
Name: "sendether",
Usage: "Send <amount> ETH from the node's ETH account to an <address>.",
Action: client.SendEther,
},
{
Name: "chpass",
Usage: "Change your password",
Action: client.ChangePassword,
},
{
Name: "txattempts",
Usage: "List the transaction attempts in descending order",
Action: client.GetTxAttempts,
Flags: []cli.Flag{
cli.IntFlag{
Name: "page",
Usage: "page of results to display",
},
},
},
{
Name: "createextrakey",
Usage: "Create a key in the node's keystore alongside the existing key; to create an original key, just run the node",
Action: client.CreateExtraKey,
},
}
return app
}