chainlink: github.com/smartcontractkit/chainlink/core/store/presenters Index | Files

package presenters

import "github.com/smartcontractkit/chainlink/core/store/presenters"

Package presenters allow for the specification and result of a Job, its associated TaskSpecs, and every JobRun and TaskRun to be returned in a user friendly human readable format.

Index

Package Files

presenters.go

func FriendlyBigInt Uses

func FriendlyBigInt(n *big.Int) string

FriendlyBigInt returns a string printing the integer in both decimal and hexadecimal formats.

func ShowEthBalance Uses

func ShowEthBalance(store *store.Store) ([]map[string]string, error)

ShowEthBalance returns the current Eth Balance for current Account

func ShowLinkBalance Uses

func ShowLinkBalance(store *store.Store) ([]map[string]string, error)

ShowLinkBalance returns the current Link Balance for current Account

type AccountBalance Uses

type AccountBalance struct {
    Address     string       `json:"address"`
    EthBalance  *assets.Eth  `json:"ethBalance"`
    LinkBalance *assets.Link `json:"linkBalance"`
}

AccountBalance holds the hex representation of the address plus it's ETH & LINK balances

func (AccountBalance) GetID Uses

func (a AccountBalance) GetID() string

GetID returns the ID of this structure for jsonapi serialization.

func (*AccountBalance) SetID Uses

func (a *AccountBalance) SetID(value string) error

SetID is used to set the ID of this structure when deserializing from jsonapi documents.

type ConfigWhitelist Uses

type ConfigWhitelist struct {
    AccountAddress string `json:"accountAddress"`
    Whitelist
}

ConfigWhitelist are the non-secret values of the node

If you add an entry here, you should update NewConfigWhitelist and ConfigWhitelist#String accordingly.

func NewConfigWhitelist Uses

func NewConfigWhitelist(store *store.Store) (ConfigWhitelist, error)

NewConfigWhitelist creates an instance of ConfigWhitelist

func (ConfigWhitelist) GetID Uses

func (c ConfigWhitelist) GetID() string

GetID generates a new ID for jsonapi serialization.

func (*ConfigWhitelist) SetID Uses

func (c *ConfigWhitelist) SetID(value string) error

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

func (ConfigWhitelist) String Uses

func (c ConfigWhitelist) String() string

String returns the values as a newline delimited string

type ExplorerStatus Uses

type ExplorerStatus struct {
    Status string `json:"status"`
    Url    string `json:"url"`
}

ExplorerStatus represents the connected server and status of the connection

func NewExplorerStatus Uses

func NewExplorerStatus(statsPusher synchronization.StatsPusher) ExplorerStatus

NewExplorerStatus returns an initialized ExplorerStatus from the store

type ExternalInitiatorAuthentication Uses

type ExternalInitiatorAuthentication struct {
    Name           string        `json:"name,omitempty"`
    URL            models.WebURL `json:"url,omitempty"`
    AccessKey      string        `json:"incomingAccessKey,omitempty"`
    Secret         string        `json:"incomingSecret,omitempty"`
    OutgoingToken  string        `json:"outgoingToken,omitempty"`
    OutgoingSecret string        `json:"outgoingSecret,omitempty"`
}

ExternalInitiatorAuthentication includes initiator and authentication details.

func NewExternalInitiatorAuthentication Uses

func NewExternalInitiatorAuthentication(
    ei models.ExternalInitiator,
    eia auth.Token,
) *ExternalInitiatorAuthentication

NewExternalInitiatorAuthentication creates an instance of ExternalInitiatorAuthentication.

func (*ExternalInitiatorAuthentication) GetID Uses

func (ei *ExternalInitiatorAuthentication) GetID() string

GetID returns the jsonapi ID.

func (*ExternalInitiatorAuthentication) GetName Uses

func (*ExternalInitiatorAuthentication) GetName() string

GetName returns the collection name for jsonapi.

func (*ExternalInitiatorAuthentication) SetID Uses

func (ei *ExternalInitiatorAuthentication) SetID(name string) error

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

type Initiator Uses

type Initiator struct {
    models.Initiator
}

Initiator holds the Job definition's Initiator.

func (Initiator) FriendlyAddress Uses

func (i Initiator) FriendlyAddress() string

FriendlyAddress returns the Ethereum address if present, and a blank string if not.

func (Initiator) FriendlyRunAt Uses

func (i Initiator) FriendlyRunAt() string

FriendlyRunAt returns a human-readable string for Cron Initiator types.

func (Initiator) MarshalJSON Uses

func (i Initiator) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON data of the Initiator based on its Initiator Type.

type JobRun Uses

type JobRun struct {
    models.JobRun
}

JobRun presents an API friendly version of the data.

func (JobRun) MarshalJSON Uses

func (jr JobRun) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON data of the JobRun and its Initiator.

type JobSpec Uses

type JobSpec struct {
    models.JobSpec
    Earnings *assets.Link `json:"earnings"`
}

JobSpec holds the JobSpec definition together with the total link earned from that job

func (JobSpec) FriendlyCreatedAt Uses

func (job JobSpec) FriendlyCreatedAt() string

FriendlyCreatedAt returns a human-readable string of the Job's CreatedAt field.

func (JobSpec) FriendlyEndAt Uses

func (job JobSpec) FriendlyEndAt() string

FriendlyEndAt returns a human-readable string of the Job's EndAt field.

func (JobSpec) FriendlyInitiators Uses

func (job JobSpec) FriendlyInitiators() string

FriendlyInitiators returns the list of Initiator types as a comma separated string.

func (JobSpec) FriendlyMinPayment Uses

func (job JobSpec) FriendlyMinPayment() string

FriendlyMinPayment returns a formatted string of the Job's Minimum Link Payment threshold

func (JobSpec) FriendlyStartAt Uses

func (job JobSpec) FriendlyStartAt() string

FriendlyStartAt returns a human-readable string of the Job's StartAt field.

func (JobSpec) FriendlyTasks Uses

func (job JobSpec) FriendlyTasks() string

FriendlyTasks returns the list of Task types as a comma separated string.

func (JobSpec) MarshalJSON Uses

func (job JobSpec) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON data of the Job and its Initiators.

type NewAccount Uses

type NewAccount struct {
    *accounts.Account
}

NewAccount is a jsonapi wrapper for an Ethereum account.

func (NewAccount) GetID Uses

func (a NewAccount) GetID() string

GetID returns the jsonapi ID.

func (NewAccount) GetName Uses

func (a NewAccount) GetName() string

GetName returns the collection name for jsonapi.

type ServiceAgreement Uses

type ServiceAgreement struct {
    models.ServiceAgreement
}

ServiceAgreement presents an API friendly version of the data.

func (ServiceAgreement) FriendlyAggregator Uses

func (sa ServiceAgreement) FriendlyAggregator() string

FriendlyAggregator returns the ServiceAgreement's aggregator address, in a human readable format.

func (ServiceAgreement) FriendlyAggregatorFulfillMethod Uses

func (sa ServiceAgreement) FriendlyAggregatorFulfillMethod() string

FriendlyAggregatorFulfillMethod returns the ServiceAgreement's aggregator fulfillment (orcale reporting) method's function selector, in a human readable format.

func (ServiceAgreement) FriendlyAggregatorInitMethod Uses

func (sa ServiceAgreement) FriendlyAggregatorInitMethod() string

FriendlyAggregator returns the ServiceAgreement's aggregator initialization method's function selector, in a human readable format.

func (ServiceAgreement) FriendlyCreatedAt Uses

func (sa ServiceAgreement) FriendlyCreatedAt() string

FriendlyCreatedAt returns the ServiceAgreement's created at time in a human readable format.

func (ServiceAgreement) FriendlyExpiration Uses

func (sa ServiceAgreement) FriendlyExpiration() string

FriendlyExpiration returns the ServiceAgreement's Encumbrance expiration time in a human readable format.

func (ServiceAgreement) FriendlyPayment Uses

func (sa ServiceAgreement) FriendlyPayment() string

FriendlyPayment returns the ServiceAgreement's Encumbrance payment amount in a human readable format.

func (ServiceAgreement) MarshalJSON Uses

func (sa ServiceAgreement) MarshalJSON() ([]byte, error)

MarshalJSON presents the ServiceAgreement as public JSON data

type ServiceAgreementPresentation Uses

type ServiceAgreementPresentation struct {
    ID            string             `json:"id"`
    CreatedAt     string             `json:"createdAt"`
    Encumbrance   models.Encumbrance `json:"encumbrance"`
    EncumbranceID uint               `json:"encumbranceID"`
    RequestBody   string             `json:"requestBody"`
    Signature     string             `json:"signature"`
    JobSpec       models.JobSpec     `json:"jobSpec"`
    JobSpecID     string             `json:"jobSpecId"`
}

type TaskSpec Uses

type TaskSpec struct {
    models.TaskSpec
}

TaskSpec holds a task specified in the Job definition.

func (TaskSpec) FriendlyParams Uses

func (t TaskSpec) FriendlyParams() (string, string)

FriendlyParams returns a map of the TaskSpec's parameters.

type Tx Uses

type Tx struct {
    Confirmed bool            `json:"confirmed,omitempty"`
    Data      hexutil.Bytes   `json:"data,omitempty"`
    From      *common.Address `json:"from,omitempty"`
    GasLimit  string          `json:"gasLimit,omitempty"`
    GasPrice  string          `json:"gasPrice,omitempty"`
    Hash      common.Hash     `json:"hash,omitempty"`
    Hex       string          `json:"rawHex,omitempty"`
    Nonce     string          `json:"nonce,omitempty"`
    SentAt    string          `json:"sentAt,omitempty"`
    To        *common.Address `json:"to,omitempty"`
    Value     string          `json:"value,omitempty"`
}

Tx is a jsonapi wrapper for an Ethereum Transaction.

func NewTx Uses

func NewTx(tx *models.Tx) Tx

NewTx builds a transaction presenter.

func NewTxFromAttempt Uses

func NewTxFromAttempt(txAttempt models.TxAttempt) Tx

NewTxFromAttempt builds a transaction presenter from a TxAttempt

models.Tx represents a transaction in progress, with a series of models.TxAttempts, each one of these represents an ethereum transaction. A TxAttempt only stores the unique details of an ethereum transaction, with the rest of the details on its related Tx.

So for presenting a TxAttempt, we take its Hash, GasPrice etc. and get the rest of the details from its Tx.

NOTE: We take a copy here as we don't want side effects.

func (Tx) GetID Uses

func (t Tx) GetID() string

GetID returns the jsonapi ID.

func (Tx) GetName Uses

func (Tx) GetName() string

GetName returns the collection name for jsonapi.

func (*Tx) SetID Uses

func (t *Tx) SetID(hex string) error

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

type UserPresenter Uses

type UserPresenter struct {
    *models.User
}

UserPresenter wraps the user record for shipping as a jsonapi response in the API.

func (UserPresenter) GetID Uses

func (u UserPresenter) GetID() string

GetID returns the jsonapi ID.

func (UserPresenter) GetName Uses

func (u UserPresenter) GetName() string

GetName returns the collection name for jsonapi.

func (UserPresenter) MarshalJSON Uses

func (u UserPresenter) MarshalJSON() ([]byte, error)

MarshalJSON returns the User as json.

type Whitelist Uses

type Whitelist struct {
    AllowOrigins             string          `json:"allowOrigins"`
    BridgeResponseURL        string          `json:"bridgeResponseURL,omitempty"`
    ChainID                  *big.Int        `json:"ethChainId"`
    ClientNodeURL            string          `json:"clientNodeUrl"`
    DatabaseTimeout          time.Duration   `json:"databaseTimeout"`
    Dev                      bool            `json:"chainlinkDev"`
    EthereumURL              string          `json:"ethUrl"`
    EthGasBumpThreshold      uint64          `json:"ethGasBumpThreshold"`
    EthGasBumpWei            *big.Int        `json:"ethGasBumpWei"`
    EthGasPriceDefault       *big.Int        `json:"ethGasPriceDefault"`
    ExplorerURL              string          `json:"explorerUrl"`
    JSONConsole              bool            `json:"jsonConsole"`
    LinkContractAddress      string          `json:"linkContractAddress"`
    LogLevel                 orm.LogLevel    `json:"logLevel"`
    LogSQLMigrations         bool            `json:"logSqlMigrations"`
    LogSQLStatements         bool            `json:"logSqlStatements"`
    LogToDisk                bool            `json:"logToDisk"`
    MaxRPCCallsPerSecond     uint64          `json:"maxRPCCallsPerSecond"`
    MinimumContractPayment   *assets.Link    `json:"minimumContractPayment"`
    MinimumRequestExpiration uint64          `json:"minimumRequestExpiration"`
    MinIncomingConfirmations uint32          `json:"minIncomingConfirmations"`
    MinOutgoingConfirmations uint64          `json:"minOutgoingConfirmations"`
    OracleContractAddress    *common.Address `json:"oracleContractAddress"`
    Port                     uint16          `json:"chainlinkPort"`
    ReaperExpiration         time.Duration   `json:"reaperExpiration"`
    ReplayFromBlock          int64           `json:"replayFromBlock"`
    RootDir                  string          `json:"root"`
    SessionTimeout           time.Duration   `json:"sessionTimeout"`
    TLSHost                  string          `json:"chainlinkTLSHost"`
    TLSPort                  uint16          `json:"chainlinkTLSPort"`
    TLSRedirect              bool            `json:"chainlinkTLSRedirect"`
    TxAttemptLimit           uint16          `json:"txAttemptLimit"`
}

Whitelist contains the supported environment variables

Package presenters imports 22 packages (graph). Updated 2020-04-07. Refresh now. Tools for package owners.

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