chainlink: github.com/smartcontractkit/chainlink/core/web Index | Files

package web

import "github.com/smartcontractkit/chainlink/core/web"

Package web handles receiving and supplying information within the node.

AccountBalanceController

AccountBalanceController allows for the display of the active accounts ETH and LINK balances.

API

API contains logic for the web interface to display items.

BridgeTypesController

BridgeTypesController allows for the creation of BridgeTypes on the node. BridgeTypes are the external adapters which add functionality not available in the core, from outside the node.

JobRunsController

JobRunsController allows for the creation of JobRuns within a given Job on the node.

JobSpecsController

JobSpecsController allows for the creation of specs to be added to the node, and shows the current specs which have already been added.

Router

Router defines the valid paths for the node and responds to requests.

Index

Package Files

api.go authentication.go box.go bridge_types_controller.go bulk_deletes_controller.go config_controller.go cookies.go doc.go external_initiators.go external_initiators_controller.go helpers.go job_runs_controller.go job_specs_controller.go keys_controller.go ping_controller.go router.go service_agreements_controller.go sessions_controller.go transactions_controller.go transfer_controller.go tx_attempts_controller.go user_controller.go withdrawals_controller.go

Constants

const (
    // PaginationDefault is the number of records to supply from a paginated
    // request when no size param is supplied.
    PaginationDefault = 25

    // MediaType is the response header for JSONAPI documents.
    MediaType = "application/vnd.api+json"

    // KeyNextLink is the name of the key that contains the HREF for the next
    // document in a paginated response.
    KeyNextLink = "next"
    // KeyPreviousLink is the name of the key that contains the HREF for the
    // previous document in a paginated response.
    KeyPreviousLink = "prev"
)
const (
    // APIKey is the header name for the API token identifier for user authentication.
    APIKey = "X-API-KEY"
    // APISecret is the header name for the API token secret for user authentication.
    APISecret = "X-API-SECRET"
    // ExternalInitiatorAccessKeyHeader is the header name for the access key
    // used by external initiators to authenticate
    ExternalInitiatorAccessKeyHeader = "X-Chainlink-EA-AccessKey"
    // ExternalInitiatorSecretHeader is the header name for the secret used by
    // external initiators to authenticate
    ExternalInitiatorSecretHeader = "X-Chainlink-EA-Secret"
)
const (
    // SessionName is the session name
    SessionName = "clsession"
    // SessionIDKey is the session ID key in the session map
    SessionIDKey = "clsession_id"
    // SessionUserKey is the User key in the session map
    SessionUserKey = "user"
    // SessionExternalInitiatorKey is the External Initiator key in the session map
    SessionExternalInitiatorKey = "external_initiator"
)

func AuthenticateBySession Uses

func AuthenticateBySession(store AuthStorer, c *gin.Context) error

func AuthenticateByToken Uses

func AuthenticateByToken(store AuthStorer, c *gin.Context) error

AuthenticateByToken authenticates a User by their API token.

func AuthenticateExternalInitiator Uses

func AuthenticateExternalInitiator(store AuthStorer, c *gin.Context) error

func FindSessionCookie Uses

func FindSessionCookie(cookies []*http.Cookie) *http.Cookie

FindSessionCookie returns the cookie with the "clsession" name

func MatchExactBoxPath Uses

func MatchExactBoxPath(boxList []string, path string) (matchedPath string)

MatchExactBoxPath returns the box path when there is an exact match for the resource and an empty string otherwise

func MatchWildcardBoxPath Uses

func MatchWildcardBoxPath(boxList []string, path string, file string) (matchedPath string)

MatchWildcardBoxPath returns the box path when there is a wildcard match and an empty string otherwise

func NewJSONAPIResponse Uses

func NewJSONAPIResponse(resource interface{}) ([]byte, error)

NewJSONAPIResponse returns a JSONAPI response for a single resource.

func NewPaginatedResponse Uses

func NewPaginatedResponse(url url.URL, size, page, count int, resource interface{}) ([]byte, error)

NewPaginatedResponse returns a jsonapi.Document with links to next and previous collection pages

func NotifyExternalInitiator Uses

func NotifyExternalInitiator(
    js models.JobSpec,
    store *store.Store,
) error

NotifyExternalInitiator sends a POST notification to the External Initiator responsible for initiating the Job Spec.

func ParseJSONAPIResponse Uses

func ParseJSONAPIResponse(input []byte, resource interface{}) error

ParseJSONAPIResponse parses the bytes of the root document and unmarshals it into the given resource.

func ParsePaginatedRequest Uses

func ParsePaginatedRequest(sizeParam, pageParam string) (int, int, int, error)

ParsePaginatedRequest parses the parameters that control pagination for a collection request, returning the size and offset if specified, or a sensible default.

func ParsePaginatedResponse Uses

func ParsePaginatedResponse(input []byte, resource interface{}, links *jsonapi.Links) error

ParsePaginatedResponse parse a JSONAPI response for a document with links

func RequireAuth Uses

func RequireAuth(store AuthStorer, methods ...authType) gin.HandlerFunc

func Router Uses

func Router(app chainlink.Application) *gin.Engine

Router listens and responds to requests to the node for valid paths.

func StatusCodeForError Uses

func StatusCodeForError(err interface{}) int

StatusCodeForError returns an http status code for an error type.

type AuthStorer Uses

type AuthStorer interface {
    AuthorizedUserWithSession(sessionID string) (models.User, error)
    FindExternalInitiator(eia *auth.Token) (*models.ExternalInitiator, error)
    FindUser() (models.User, error)
}

type BridgeTypesController Uses

type BridgeTypesController struct {
    App chainlink.Application
}

BridgeTypesController manages BridgeType requests in the node.

func (*BridgeTypesController) Create Uses

func (btc *BridgeTypesController) Create(c *gin.Context)

Create adds the BridgeType to the given context.

func (*BridgeTypesController) Destroy Uses

func (btc *BridgeTypesController) Destroy(c *gin.Context)

Destroy removes a specific Bridge.

func (*BridgeTypesController) Index Uses

func (btc *BridgeTypesController) Index(c *gin.Context, size, page, offset int)

Index lists Bridges, one page at a time.

func (*BridgeTypesController) Show Uses

func (btc *BridgeTypesController) Show(c *gin.Context)

Show returns the details of a specific Bridge.

func (*BridgeTypesController) Update Uses

func (btc *BridgeTypesController) Update(c *gin.Context)

Update can change the restricted attributes for a bridge

type BulkDeletesController Uses

type BulkDeletesController struct {
    App chainlink.Application
}

BulkDeletesController manages background tasks that delete resources given a query

func (*BulkDeletesController) Delete Uses

func (bdc *BulkDeletesController) Delete(c *gin.Context)

Delete removes all runs given a query Example:

"<application>/bulk_delete_runs"

type Change Uses

type Change struct {
    From string `json:"old"`
    To   string `json:"new"`
}

Change represents the old value and the new value after a PATH request has been made

type ConfigController Uses

type ConfigController struct {
    App chainlink.Application
}

ConfigController manages config variables

func (*ConfigController) Patch Uses

func (cc *ConfigController) Patch(c *gin.Context)

Patch updates one or more configuration options

func (*ConfigController) Show Uses

func (cc *ConfigController) Show(c *gin.Context)

Show returns the whitelist of config variables Example:

"<application>/config"

type ConfigPatchResponse Uses

type ConfigPatchResponse struct {
    EthGasPriceDefault Change `json:"ethGasPriceDefault"`
}

ConfigPatchResponse represents the change to the configuration made due to a PATCH to the config endpoint

func (ConfigPatchResponse) GetID Uses

func (c ConfigPatchResponse) GetID() string

GetID returns the jsonapi ID.

func (*ConfigPatchResponse) SetID Uses

func (*ConfigPatchResponse) SetID(string) error

SetID is used to conform to the UnmarshallIdentifier interface for deserializing from jsonapi documents.

type ExternalInitiatorsController Uses

type ExternalInitiatorsController struct {
    App chainlink.Application
}

ExternalInitiatorsController manages external initiators

func (*ExternalInitiatorsController) Create Uses

func (eic *ExternalInitiatorsController) Create(c *gin.Context)

Create builds and saves a new service agreement record.

func (*ExternalInitiatorsController) Destroy Uses

func (eic *ExternalInitiatorsController) Destroy(c *gin.Context)

Destroy deletes an ExternalInitiator

type JobRunsController Uses

type JobRunsController struct {
    App chainlink.Application
}

JobRunsController manages JobRun requests in the node.

func (*JobRunsController) Cancel Uses

func (jrc *JobRunsController) Cancel(c *gin.Context)

Cancel stops a Run from continuing. Example:

"<application>/runs/:RunID/cancellation"

func (*JobRunsController) Create Uses

func (jrc *JobRunsController) Create(c *gin.Context)

Create starts a new Run for the requested JobSpec. Example:

"<application>/specs/:SpecID/runs"

func (*JobRunsController) Index Uses

func (jrc *JobRunsController) Index(c *gin.Context, size, page, offset int)

Index returns paginated JobRuns for a given JobSpec Example:

"<application>/runs?jobSpecId=:jobSpecId&size=1&page=2"

func (*JobRunsController) Show Uses

func (jrc *JobRunsController) Show(c *gin.Context)

Show returns the details of a JobRun. Example:

"<application>/runs/:RunID"

func (*JobRunsController) Update Uses

func (jrc *JobRunsController) Update(c *gin.Context)

Update allows external adapters to resume a JobRun, reporting the result of the task and marking it no longer pending. Example:

"<application>/runs/:RunID"

type JobSpecNotice Uses

type JobSpecNotice struct {
    JobID  *models.ID  `json:"jobId"`
    Type   string      `json:"type"`
    Params models.JSON `json:"params,omitempty"`
}

JobSpecNotice is sent to the External Initiator when JobSpecs are created.

func NewJobSpecNotice Uses

func NewJobSpecNotice(initiator models.Initiator, js models.JobSpec) (*JobSpecNotice, error)

NewJobSpecNotice returns a new JobSpec.

type JobSpecsController Uses

type JobSpecsController struct {
    App chainlink.Application
}

JobSpecsController manages JobSpec requests.

func (*JobSpecsController) Create Uses

func (jsc *JobSpecsController) Create(c *gin.Context)

Create adds validates, saves, and starts a new JobSpec. Example:

"<application>/specs"

func (*JobSpecsController) Destroy Uses

func (jsc *JobSpecsController) Destroy(c *gin.Context)

Destroy soft deletes a job spec. Example:

"<application>/specs/:SpecID"

func (*JobSpecsController) Index Uses

func (jsc *JobSpecsController) Index(c *gin.Context, size, page, offset int)

Index lists JobSpecs, one page at a time. Example:

"<application>/specs?size=1&page=2"

func (*JobSpecsController) Show Uses

func (jsc *JobSpecsController) Show(c *gin.Context)

Show returns the details of a JobSpec. Example:

"<application>/specs/:SpecID"

type KeysController Uses

type KeysController struct {
    App chainlink.Application
}

KeysController manages account keys

func (*KeysController) Create Uses

func (kc *KeysController) Create(c *gin.Context)

Create adds a new account Example:

"<application>/keys"

type PingController Uses

type PingController struct {
    App chainlink.Application
}

PingController has the ping endpoint.

func (*PingController) Show Uses

func (eic *PingController) Show(c *gin.Context)

Show returns pong.

type ServiceAgreementsController Uses

type ServiceAgreementsController struct {
    App chainlink.Application
}

ServiceAgreementsController manages service agreements.

func (*ServiceAgreementsController) Create Uses

func (sac *ServiceAgreementsController) Create(c *gin.Context)

Create builds and saves a new service agreement record.

func (*ServiceAgreementsController) Show Uses

func (sac *ServiceAgreementsController) Show(c *gin.Context)

Show returns the details of a ServiceAgreement. Example:

"<application>/service_agreements/:SAID"

type Session Uses

type Session struct {
    Authenticated bool `json:"authenticated"`
}

func (Session) GetID Uses

func (s Session) GetID() string

GetID returns the jsonapi ID.

func (Session) GetName Uses

func (Session) GetName() string

GetName returns the collection name for jsonapi.

func (*Session) SetID Uses

func (*Session) SetID(string) error

SetID is used to conform to the UnmarshallIdentifier interface for deserializing from jsonapi documents.

type SessionsController Uses

type SessionsController struct {
    App chainlink.Application
}

SessionsController manages session requests.

func (*SessionsController) Create Uses

func (sc *SessionsController) Create(c *gin.Context)

Create creates a session ID for the given user credentials, and returns it in a cookie.

func (*SessionsController) Destroy Uses

func (sc *SessionsController) Destroy(c *gin.Context)

Destroy erases the session ID for the sole API user.

type TransactionsController Uses

type TransactionsController struct {
    App chainlink.Application
}

TransactionsController displays Ethereum transactions requests.

func (*TransactionsController) Index Uses

func (tc *TransactionsController) Index(c *gin.Context, size, page, offset int)

Index returns paginated transaction attempts

func (*TransactionsController) Show Uses

func (tc *TransactionsController) Show(c *gin.Context)

Show returns the details of a Ethereum Transasction details. Example:

"<application>/transactions/:TxHash"

type TransfersController Uses

type TransfersController struct {
    App chainlink.Application
}

TransfersController can send LINK tokens to another address

func (*TransfersController) Create Uses

func (tc *TransfersController) Create(c *gin.Context)

Create sends ETH from the Chainlink's account to a specified address.

Example: "<application>/withdrawals"

type TxAttemptsController Uses

type TxAttemptsController struct {
    App chainlink.Application
}

TxAttemptsController lists TxAttempts requests.

func (*TxAttemptsController) Index Uses

func (tac *TxAttemptsController) Index(c *gin.Context, size, page, offset int)

Index returns paginated transaction attempts

type UserController Uses

type UserController struct {
    App chainlink.Application
}

UserController manages the current Session's User User.

func (*UserController) AccountBalances Uses

func (c *UserController) AccountBalances(ctx *gin.Context)

AccountBalances returns the account balances of ETH & LINK. Example:

"<application>/user/balances"

func (*UserController) DeleteAPIToken Uses

func (c *UserController) DeleteAPIToken(ctx *gin.Context)

DeleteAPIToken deletes and disables a user's API token.

func (*UserController) NewAPIToken Uses

func (c *UserController) NewAPIToken(ctx *gin.Context)

NewAPIToken generates a new API token for a user overwriting any pre-existing one set.

func (*UserController) UpdatePassword Uses

func (c *UserController) UpdatePassword(ctx *gin.Context)

UpdatePassword changes the password for the current User.

type WithdrawalsController Uses

type WithdrawalsController struct {
    App chainlink.Application
}

WithdrawalsController can send LINK tokens to another address

func (*WithdrawalsController) Create Uses

func (abc *WithdrawalsController) Create(c *gin.Context)

Create sends LINK from the configured oracle contract to the given address See models.WithdrawalRequest for expected inputs. ContractAddress field is optional.

Example: "<application>/withdrawals"

Package web imports 43 packages (graph). Updated 2020-04-06. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: