Documentation
¶
Overview ¶
Package cmd is the front-end interface for the application as a command-line utility.
KeyStoreAuthenticator ¶
KeyStoreAuthenticator prompts the user for their password, which is used to unlock their keystore file to interact with the Ethereum blockchain. Since multiple keystore files can exist at the configured directory, the KeyStoreAuthenticator will try the password on all keystore files present.
Client ¶
Client is how the application is invoked from the command line. When you run the binary, for example `./chainlink n`, client.RunNode is called to start the Chainlink core. Similarly, running `./chainlink j` returns information on all jobs in the node, and `./chainlink s` with another argument as a JobID gives information specific to that job.
Renderer ¶
Renderer helps format and display data (based on the kind of data it is) to the command line.
Index ¶
- func InitEnclave() error
- type APIInitializer
- type AppFactory
- type ChainlinkAppFactory
- type ChainlinkRunner
- type Client
- func (cli *Client) AddBridge(c *clipkg.Context) error
- func (cli *Client) BackupDatabase(c *clipkg.Context) error
- func (cli *Client) CreateJobRun(c *clipkg.Context) error
- func (cli *Client) CreateJobSpec(c *clipkg.Context) error
- func (cli *Client) CreateServiceAgreement(c *clipkg.Context) error
- func (cli *Client) DeleteUser(c *clipkg.Context) error
- func (cli *Client) DisplayAccountBalance(c *clipkg.Context) error
- func (cli *Client) GetBridges(c *clipkg.Context) error
- func (cli *Client) GetJobSpecs(c *clipkg.Context) error
- func (cli *Client) ImportKey(c *clipkg.Context) error
- func (cli *Client) RemoteLogin(c *clipkg.Context) error
- func (cli *Client) RemoveBridge(c *clipkg.Context) error
- func (cli *Client) RunNode(c *clipkg.Context) error
- func (cli *Client) ShowBridge(c *clipkg.Context) error
- func (cli *Client) ShowJobSpec(c *clipkg.Context) error
- func (cli *Client) Withdraw(c *clipkg.Context) error
- type CookieAuthenticator
- type HTTPClient
- type KeyStoreAuthenticator
- type Prompter
- type Renderer
- type RendererJSON
- type RendererTable
- type Runner
- type SessionCookieAuthenticator
- type SessionRequestBuilder
- type TerminalKeyStoreAuthenticator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIInitializer ¶
type APIInitializer interface { // Initialize creates a new user for API access, or does nothing if one exists. Initialize(store *store.Store) (models.User, error) }
APIInitializer is the interface used to create the API User credentials needed to access the API. Does nothing if API user already exists.
func NewFileAPIInitializer ¶
func NewFileAPIInitializer(file string) APIInitializer
NewFileAPIInitializer creates a concrete instance of APIInitializer that pulls API user credentials from the passed file path.
func NewPromptingAPIInitializer ¶
func NewPromptingAPIInitializer(prompter Prompter) APIInitializer
NewPromptingAPIInitializer creates a concrete instance of APIInitializer that uses the terminal to solicit credentials from the user.
type AppFactory ¶
type AppFactory interface {
NewApplication(store.Config) services.Application
}
AppFactory implements the NewApplication method.
type ChainlinkAppFactory ¶
type ChainlinkAppFactory struct{}
ChainlinkAppFactory is used to create a new Application.
func (ChainlinkAppFactory) NewApplication ¶
func (n ChainlinkAppFactory) NewApplication(config store.Config) services.Application
NewApplication returns a new instance of the node with the given config.
type ChainlinkRunner ¶
type ChainlinkRunner struct{}
ChainlinkRunner is used to run the node application.
func (ChainlinkRunner) Run ¶
func (n ChainlinkRunner) Run(app services.Application) error
Run sets the log level based on config and starts the web router to listen for input and return data.
type Client ¶
type Client struct { Renderer Config store.Config AppFactory AppFactory KeyStoreAuthenticator KeyStoreAuthenticator FallbackAPIInitializer APIInitializer Runner Runner HTTP HTTPClient CookieAuthenticator CookieAuthenticator FileSessionRequestBuilder SessionRequestBuilder PromptingSessionRequestBuilder SessionRequestBuilder }
Client is the shell for the node, local commands and remote commands.
func (*Client) BackupDatabase ¶
BackupDatabase streams a backup of the node's db to the passed filepath.
func (*Client) CreateJobRun ¶
CreateJobRun creates job run based on SpecID and optional JSON
func (*Client) CreateJobSpec ¶
CreateJobSpec creates a JobSpec based on JSON input
func (*Client) CreateServiceAgreement ¶
CreateServiceAgreement creates a ServiceAgreement based on JSON input
func (*Client) DeleteUser ¶
DeleteUser is run locally to remove the User row from the node's database.
func (*Client) DisplayAccountBalance ¶
DisplayAccountBalance renders a table containing the active account address with it's ETH & LINK balance
func (*Client) GetBridges ¶
GetBridges returns all bridges.
func (*Client) GetJobSpecs ¶
GetJobSpecs returns all job specs.
func (*Client) RemoteLogin ¶
RemoteLogin creates a cookie session to run remote commands.
func (*Client) RemoveBridge ¶
RemoveBridge removes a specific Bridge by name.
func (*Client) ShowBridge ¶
ShowBridge returns the info for the given Bridge name.
func (*Client) ShowJobSpec ¶
ShowJobSpec returns the status of the given JobID.
type CookieAuthenticator ¶
type CookieAuthenticator interface { Cookie() (*http.Cookie, error) Authenticate(models.SessionRequest) (*http.Cookie, error) }
CookieAuthenticator is the interface to generating a cookie to authenticate future HTTP requests.
func NewSessionCookieAuthenticator ¶
func NewSessionCookieAuthenticator(cfg store.Config) CookieAuthenticator
NewSessionCookieAuthenticator creates a SessionCookieAuthenticator using the passed config and builder.
type HTTPClient ¶
type HTTPClient interface { Get(string, ...map[string]string) (*http.Response, error) Post(string, io.Reader) (*http.Response, error) Patch(string, io.Reader, ...map[string]string) (*http.Response, error) Delete(string) (*http.Response, error) }
HTTPClient encapsulates all methods used to interact with a chainlink node API.
func NewAuthenticatedHTTPClient ¶
func NewAuthenticatedHTTPClient(cfg store.Config, cookieAuth CookieAuthenticator) HTTPClient
NewAuthenticatedHTTPClient uses the CookieAuthenticator to generate a sessionID which is then used for all subsequent HTTP API requests.
type KeyStoreAuthenticator ¶
KeyStoreAuthenticator implements the Authenticate method for the store and a password string.
type Prompter ¶
Prompter implements the Prompt function to be used to display at the console.
func NewTerminalPrompter ¶
func NewTerminalPrompter() Prompter
NewTerminalPrompter prompts the user via terminal.
type Renderer ¶
type Renderer interface {
Render(interface{}) error
}
Renderer implements the Render method.
type RendererJSON ¶
RendererJSON is used to render JSON data.
func (RendererJSON) Render ¶
func (rj RendererJSON) Render(v interface{}) error
Render writes the given input as a JSON string.
type RendererTable ¶
RendererTable is used for data to be rendered as a table.
func (RendererTable) Render ¶
func (rt RendererTable) Render(v interface{}) error
Render returns a formatted table of text for a given Job or presenter and relevant information.
type Runner ¶
type Runner interface {
Run(services.Application) error
}
Runner implements the Run method.
type SessionCookieAuthenticator ¶
type SessionCookieAuthenticator struct {
// contains filtered or unexported fields
}
SessionCookieAuthenticator is a concrete implementation of CookieAuthenticator that retrieves a session id for the user with credentials from the session request.
func (*SessionCookieAuthenticator) Authenticate ¶
func (t *SessionCookieAuthenticator) Authenticate(sessionRequest models.SessionRequest) (*http.Cookie, error)
Authenticate retrieves a session ID via a cookie and saves it to disk.
type SessionRequestBuilder ¶
type SessionRequestBuilder interface {
Build(flag string) (models.SessionRequest, error)
}
SessionRequestBuilder is an interface that returns a SessionRequest, abstracting how session requests are generated, whether they be from the prompt or from a file.
func NewFileSessionRequestBuilder ¶
func NewFileSessionRequestBuilder() SessionRequestBuilder
NewFileSessionRequestBuilder pulls credentials from a file to generate a SessionRequest.
func NewPromptingSessionRequestBuilder ¶
func NewPromptingSessionRequestBuilder(prompter Prompter) SessionRequestBuilder
NewPromptingSessionRequestBuilder uses a prompter, often via terminal, to solicit information from a user to generate the SessionRequest.
type TerminalKeyStoreAuthenticator ¶
type TerminalKeyStoreAuthenticator struct {
Prompter Prompter
}
TerminalKeyStoreAuthenticator contains fields for prompting the user and an exit code.
func (TerminalKeyStoreAuthenticator) Authenticate ¶
func (auth TerminalKeyStoreAuthenticator) Authenticate(store *store.Store, pwd string) error
Authenticate checks to see if there are accounts present in the KeyStore, and if there are none, a new account will be created by prompting for a password. If there are accounts present, the account which is unlocked by the given password will be used.