models

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 31 Imported by: 31

Documentation

Index

Constants

View Source
const FunctionSelectorLength = 4

FunctionSelectorLength should always be a length of 4 as a byte.

View Source
const (
	MaxBcryptPasswordLength = 50
)

https://security.stackexchange.com/questions/39849/does-bcrypt-have-a-maximum-password-length

View Source
const (
	// SignatureLength is the length of the signature in bytes: v = 1, r = 32, s
	// = 32; v + r + s = 65
	SignatureLength = 65
)

Variables

View Source
var ChainlinkFulfilledTopic = utils.MustHash("ChainlinkFulfilled(bytes32)")

ChainlinkFulfilledTopic is the signature for the event emitted after calling ChainlinkClient.validateChainlinkCallback(requestId). See ../../contracts/src/v0.6/ChainlinkClient.sol

View Source
var CronParser cron.Parser

CronParser is the global parser for crontabs. It accepts the standard 5 field cron syntax as well as an optional 6th field at the front to represent seconds.

View Source
var WeiPerEth = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)

WeiPerEth is amount of Wei currency units in one Eth.

Functions

func AuthenticateBridgeType

func AuthenticateBridgeType(bt *BridgeType, token string) (bool, error)

AuthenticateBridgeType returns true if the passed token matches its IncomingToken, or returns false with an error.

func AuthenticateExternalInitiator

func AuthenticateExternalInitiator(eia *auth.Token, ea *ExternalInitiator) (bool, error)

AuthenticateExternalInitiator compares an auth against an initiator and returns true if the password hashes match

func AuthenticateUserByToken added in v0.8.2

func AuthenticateUserByToken(token *auth.Token, user *User) (bool, error)

AuthenticateUserByToken returns true on successful authentication of the user against the given Authentication Token.

func CoerceInterfaceMapToStringMap added in v0.9.7

func CoerceInterfaceMapToStringMap(in interface{}) (interface{}, error)

CoerceInterfaceMapToStringMap converts map[interface{}]interface{} (interface maps) to map[string]interface{} (string maps) and []interface{} with interface maps to string maps. Relevant when serializing between CBOR and JSON.

It also handles the CBOR 'bignum' type as documented here: https://tools.ietf.org/html/rfc7049#section-2.4.2

func MarshalBridgeMetaData added in v0.10.5

func MarshalBridgeMetaData(latestAnswer *big.Int, updatedAt *big.Int) (map[string]interface{}, error)

func MarshalToMap added in v0.8.17

func MarshalToMap(input interface{}) (map[string]interface{}, error)

MarshalToMap converts a struct (typically) to a map[string] so it can be manipulated without repeatedly serializing/deserializing

func NewBridgeType

NewBridgeType returns a bridge bridge type authentication (with plaintext password) and a bridge type (with hashed password, for persisting)

func NewDatabaseAccessError

func NewDatabaseAccessError(msg string) error

NewDatabaseAccessError returns a database access error.

func NewValidationError

func NewValidationError(msg string, values ...interface{}) error

NewValidationError returns a validation error.

func ReceiptIndicatesRunLogFulfillment added in v0.8.13

func ReceiptIndicatesRunLogFulfillment(txr types.Receipt) bool

ReceiptIndicatesRunLogFulfillment returns true if this tx receipt is the result of a fulfilled run log.

func ReceiptIsUnconfirmed added in v0.8.13

func ReceiptIsUnconfirmed(txr *types.Receipt) bool

Unconfirmed returns true if the transaction is not confirmed.

func VRFCoordinatorABI added in v0.8.8

func VRFCoordinatorABI() abi.ABI

VRFCoordinatorABI returns the ABI for the VRFCoordinator contract

func VRFFulfillMethod added in v0.8.8

func VRFFulfillMethod() abi.Method

VRFFulfillMethod returns the golang abstraction of the fulfillRandomnessRequest method

func VRFFulfillSelector added in v0.8.8

func VRFFulfillSelector() string

VRFFulfillSelector returns the signature of the fulfillRandomnessRequest method on the VRFCoordinator contract

func VRFRandomnessRequestLogTopic added in v0.8.8

func VRFRandomnessRequestLogTopic() common.Hash

VRFRandomnessRequestLogTopic returns the signature of the RandomnessRequest log emitted by the VRFCoordinator contract

Types

type AddressCollection

type AddressCollection []common.Address

AddressCollection is an array of common.Address serializable to and from a database.

func (*AddressCollection) Scan

func (r *AddressCollection) Scan(value interface{}) error

Scan parses the database value as a string.

func (AddressCollection) ToStrings

func (r AddressCollection) ToStrings() []string

ToStrings returns this address collection as an array of strings.

func (AddressCollection) Value

func (r AddressCollection) Value() (driver.Value, error)

Value returns the string value to be written to the database.

type AnyTime

type AnyTime struct {
	time.Time
	Valid bool
}

AnyTime holds a common field for time, and serializes it as a json number.

func NewAnyTime

func NewAnyTime(t time.Time) AnyTime

NewAnyTime creates a new Time.

func (AnyTime) MarshalJSON

func (t AnyTime) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this time is null.

func (AnyTime) MarshalText

func (t AnyTime) MarshalText() ([]byte, error)

MarshalText returns null if not set, or the time.

func (*AnyTime) Scan

func (t *AnyTime) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (*AnyTime) UnmarshalJSON

func (t *AnyTime) UnmarshalJSON(b []byte) error

UnmarshalJSON parses the raw time stored in JSON-encoded data and stores it to the Time field.

func (*AnyTime) UnmarshalText

func (t *AnyTime) UnmarshalText(text []byte) error

UnmarshalText parses null or a valid time.

func (AnyTime) Value

func (t AnyTime) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

type BridgeMetaData added in v0.10.4

type BridgeMetaData struct {
	LatestAnswer *big.Int `json:"latestAnswer"`
	UpdatedAt    *big.Int `json:"updatedAt"` // A unix timestamp
}

NOTE: latestAnswer and updatedAt is the only metadata used. Currently market closer adapter and outlier detection depend latestAnswer. https://github.com/smartcontractkit/external-adapters-js/tree/f474bd2e2de13ebe5c9dc3df36ebb7018817005e/composite/market-closure https://github.com/smartcontractkit/external-adapters-js/tree/5abb8e5ec2024f724fd39122897baa63c3cd0167/composite/outlier-detection

type BridgeMetaDataJSON added in v0.10.5

type BridgeMetaDataJSON struct {
	Meta BridgeMetaData
}

type BridgeType

type BridgeType struct {
	Name                   TaskType `gorm:"primary_key"`
	URL                    WebURL
	Confirmations          uint32
	IncomingTokenHash      string
	Salt                   string
	OutgoingToken          string
	MinimumContractPayment *assets.Link `gorm:"type:varchar(255)"`
	CreatedAt              time.Time
	UpdatedAt              time.Time
}

BridgeType is used for external adapters and has fields for the name of the adapter and its URL.

type BridgeTypeAuthentication

type BridgeTypeAuthentication struct {
	Name                   TaskType
	URL                    WebURL
	Confirmations          uint32
	IncomingToken          string
	OutgoingToken          string
	MinimumContractPayment *assets.Link
}

BridgeTypeAuthentication is the record returned in response to a request to create a BridgeType

type BridgeTypeRequest

type BridgeTypeRequest struct {
	Name                   TaskType     `json:"name"`
	URL                    WebURL       `json:"url"`
	Confirmations          uint32       `json:"confirmations"`
	MinimumContractPayment *assets.Link `json:"minimumContractPayment"`
}

BridgeTypeRequest is the incoming record used to create a BridgeType

func (BridgeTypeRequest) GetID

func (bt BridgeTypeRequest) GetID() string

GetID returns the ID of this structure for jsonapi serialization.

func (BridgeTypeRequest) GetName

func (bt BridgeTypeRequest) GetName() string

GetName returns the pluralized "type" of this structure for jsonapi serialization.

func (*BridgeTypeRequest) SetID

func (bt *BridgeTypeRequest) SetID(value string) error

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

type ChangeAuthTokenRequest added in v0.8.2

type ChangeAuthTokenRequest struct {
	Password string `json:"password"`
}

Changeauth.TokenRequest is sent when updating a User's authentication token.

type Configuration added in v0.6.6

type Configuration struct {
	ID        int64  `gorm:"primary_key"`
	Name      string `gorm:"not null;unique;index"`
	Value     string `gorm:"not null"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *gorm.DeletedAt
}

Configuration stores key value pairs for overriding global configuration

type Cron

type Cron string

Cron holds the string that will represent the spec of the cron-job.

func (Cron) String

func (c Cron) String() string

String returns the current Cron spec string.

func (*Cron) UnmarshalJSON

func (c *Cron) UnmarshalJSON(b []byte) error

UnmarshalJSON parses the raw spec stored in JSON-encoded data and stores it to the Cron string.

type DatabaseAccessError

type DatabaseAccessError struct {
	// contains filtered or unexported fields
}

DatabaseAccessError is an error that occurs during database access.

func (*DatabaseAccessError) Error

func (e *DatabaseAccessError) Error() string

type Duration added in v0.8.2

type Duration struct {
	// contains filtered or unexported fields
}

Duration is a non-negative time duration.

func MakeDuration added in v0.8.3

func MakeDuration(d time.Duration) (Duration, error)

func MustMakeDuration added in v0.8.3

func MustMakeDuration(d time.Duration) Duration

func (Duration) Before added in v0.8.3

func (d Duration) Before(t time.Time) time.Time

Before returns the time d units before time t

func (Duration) Duration added in v0.8.2

func (d Duration) Duration() time.Duration

Duration returns the value as the standard time.Duration value.

func (Duration) IsInstant added in v0.8.3

func (d Duration) IsInstant() bool

IsInstant is true if and only if d is of duration 0

func (Duration) MarshalJSON added in v0.8.2

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Duration) Scan added in v0.8.3

func (d *Duration) Scan(v interface{}) (err error)

func (Duration) Shorter added in v0.8.3

func (d Duration) Shorter(od Duration) bool

Shorter returns true if and only if d is shorter than od.

func (Duration) String added in v0.8.2

func (d Duration) String() string

String returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s.

func (*Duration) UnmarshalJSON added in v0.8.2

func (d *Duration) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (Duration) Value added in v0.8.3

func (d Duration) Value() (driver.Value, error)

type ExternalInitiator

type ExternalInitiator struct {
	ID             int64   `gorm:"primary_key"`
	Name           string  `gorm:"not null;unique"`
	URL            *WebURL `gorm:"url,omitempty"`
	AccessKey      string  `gorm:"not null"`
	Salt           string  `gorm:"not null"`
	HashedSecret   string  `gorm:"not null"`
	OutgoingSecret string  `gorm:"not null"`
	OutgoingToken  string  `gorm:"not null"`

	CreatedAt time.Time
	UpdatedAt time.Time
}

ExternalInitiator represents a user that can initiate runs remotely

func NewExternalInitiator

func NewExternalInitiator(
	eia *auth.Token,
	eir *ExternalInitiatorRequest,
) (*ExternalInitiator, error)

NewExternalInitiator generates an ExternalInitiator from an auth.Token, hashing the password for storage

type ExternalInitiatorRequest added in v0.6.6

type ExternalInitiatorRequest struct {
	Name string  `json:"name"`
	URL  *WebURL `json:"url,omitempty"`
}

ExternalInitiatorRequest is the incoming record used to create an ExternalInitiator.

type FunctionSelector

type FunctionSelector [FunctionSelectorLength]byte

FunctionSelector is the first four bytes of the call data for a function call and specifies the function to be called.

func BytesToFunctionSelector

func BytesToFunctionSelector(b []byte) FunctionSelector

BytesToFunctionSelector converts the given bytes to a FunctionSelector.

func HexToFunctionSelector

func HexToFunctionSelector(s string) FunctionSelector

HexToFunctionSelector converts the given string to a FunctionSelector.

func (FunctionSelector) Bytes

func (f FunctionSelector) Bytes() []byte

Bytes returns the FunctionSelector as a byte slice

func (FunctionSelector) MarshalJSON added in v0.6.8

func (f FunctionSelector) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of f

func (*FunctionSelector) Scan added in v0.6.8

func (f *FunctionSelector) Scan(value interface{}) error

Scan returns the selector from its serialization in the database

func (*FunctionSelector) SetBytes

func (f *FunctionSelector) SetBytes(b []byte)

SetBytes sets the FunctionSelector to that of the given bytes (will trim).

func (FunctionSelector) String

func (f FunctionSelector) String() string

String returns the FunctionSelector as a string type.

func (*FunctionSelector) UnmarshalJSON

func (f *FunctionSelector) UnmarshalJSON(input []byte) error

UnmarshalJSON parses the raw FunctionSelector and sets the FunctionSelector type to the given input.

func (FunctionSelector) Value added in v0.6.8

func (f FunctionSelector) Value() (driver.Value, error)

Value returns this instance serialized for database storage

type Head struct {
	ID            uint64
	Hash          common.Hash
	Number        int64
	L1BlockNumber null.Int64
	ParentHash    common.Hash
	Parent        *Head `gorm:"-"`
	Timestamp     time.Time
	CreatedAt     time.Time
}

Head represents a BlockNumber, BlockHash.

func NewHead

func NewHead(number *big.Int, blockHash common.Hash, parentHash common.Hash, timestamp uint64) Head

NewHead returns a Head instance.

func (*Head) ChainHashes added in v0.10.6

func (h *Head) ChainHashes() []common.Hash

ChainHashes returns an array of block hashes by recursively looking up parents

func (*Head) ChainLength added in v0.8.7

func (h *Head) ChainLength() uint32

ChainLength returns the length of the chain followed by recursively looking up parents

func (*Head) EarliestInChain added in v0.8.7

func (h *Head) EarliestInChain() Head

EarliestInChain recurses through parents until it finds the earliest one

func (*Head) GreaterThan

func (h *Head) GreaterThan(r *Head) bool

GreaterThan compares BlockNumbers and returns true if the receiver BlockNumber is greater than the supplied BlockNumber

func (*Head) HashAtHeight added in v0.10.5

func (h *Head) HashAtHeight(blockNum int64) common.Hash

HashAtHeight returns the hash of the block at the given heigh, if it is in the chain. If not in chain, returns the zero hash

func (*Head) IsInChain added in v0.10.3

func (h *Head) IsInChain(blockHash common.Hash) bool

IsInChain returns true if the given hash matches the hash of a head in the chain

func (*Head) MarshalJSON added in v0.8.13

func (h *Head) MarshalJSON() ([]byte, error)

func (*Head) NextInt

func (h *Head) NextInt() *big.Int

NextInt returns the next BlockNumber as big.int, or nil if nil to represent latest.

func (*Head) String

func (h *Head) String() string

String returns a string representation of this number.

func (*Head) ToInt

func (h *Head) ToInt() *big.Int

ToInt return the height as a *big.Int. Also handles nil by returning nil.

func (*Head) UnmarshalJSON added in v0.8.13

func (h *Head) UnmarshalJSON(bs []byte) error

type Interval added in v0.9.3

type Interval time.Duration

Interval represents a time.Duration stored as a Postgres interval type

func (Interval) Duration added in v1.0.0

func (i Interval) Duration() time.Duration

func (Interval) IsZero added in v0.9.7

func (i Interval) IsZero() bool

func (Interval) MarshalText added in v0.9.3

func (i Interval) MarshalText() ([]byte, error)

MarshalText implements the text.Marshaler interface.

func (*Interval) Scan added in v0.9.3

func (i *Interval) Scan(v interface{}) error

func (*Interval) UnmarshalText added in v0.9.3

func (i *Interval) UnmarshalText(input []byte) error

UnmarshalText implements the text.Unmarshaler interface.

func (Interval) Value added in v0.9.3

func (i Interval) Value() (driver.Value, error)

type JSON

type JSON struct {
	gjson.Result
}

JSON stores the json types string, number, bool, and null. Arrays and Objects are returned as their raw json types.

func Merge added in v0.8.2

func Merge(inputs ...JSON) (JSON, error)

Merge returns a new map with all keys merged from left to right On conflicting keys, rightmost inputs will clobber leftmost inputs

func MergeExceptResult added in v0.10.6

func MergeExceptResult(inputs ...JSON) (JSON, error)

MergeExceptResult does a merge, but will never clobber the field called "result" On conflicting keys, rightmost inputs will clobber leftmost inputs EXCEPT if the field is named "result", in which case the leftmost result wins This is needed to work around idiosyncrasies in the V1 job pipeline where "result" has special meaning

func MustParseJSON added in v0.10.6

func MustParseJSON(b []byte) JSON

func ParseCBOR

func ParseCBOR(b []byte) (JSON, error)

ParseCBOR attempts to coerce the input byte array into valid CBOR and then coerces it into a JSON object.

func ParseJSON

func ParseJSON(b []byte) (JSON, error)

ParseJSON attempts to coerce the input byte array into valid JSON and parse it into a JSON object.

func (JSON) Add

func (j JSON) Add(insertKey string, insertValue interface{}) (JSON, error)

Add returns a new instance of JSON with the new value added.

func (JSON) AsMap added in v0.8.2

func (j JSON) AsMap() (map[string]interface{}, error)

AsMap returns j as a map

func (JSON) Bytes

func (j JSON) Bytes() []byte

Bytes returns the raw JSON.

func (JSON) CBOR

func (j JSON) CBOR() ([]byte, error)

CBOR returns a bytes array of the JSON map or array encoded to CBOR.

func (JSON) Delete

func (j JSON) Delete(key string) (JSON, error)

Delete returns a new instance of JSON with the specified key removed.

func (JSON) GormDBDataType added in v0.10.0

func (JSON) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (JSON) GormDataType added in v0.10.0

func (JSON) GormDataType() string

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON data if it already exists, returns an empty JSON object as bytes if not.

func (JSON) MultiAdd added in v0.8.2

func (j JSON) MultiAdd(keyValues KV) (JSON, error)

MultiAdd returns a new instance of j with the new values added.

func (JSON) PrependAtArrayKey added in v0.9.7

func (j JSON) PrependAtArrayKey(insertKey string, insertValue interface{}) (JSON, error)

func (*JSON) Scan

func (j *JSON) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(b []byte) error

UnmarshalJSON parses the JSON bytes and stores in the *JSON pointer.

func (*JSON) UnmarshalTOML added in v0.9.3

func (j *JSON) UnmarshalTOML(val interface{}) error

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

type JSONAPIError

type JSONAPIError struct {
	Detail string `json:"detail"`
}

JSONAPIError is an individual JSONAPI Error.

type JSONAPIErrors

type JSONAPIErrors struct {
	Errors []JSONAPIError `json:"errors"`
}

JSONAPIErrors holds errors conforming to the JSONAPI spec.

func NewJSONAPIErrors

func NewJSONAPIErrors() *JSONAPIErrors

NewJSONAPIErrors creates an instance of JSONAPIErrors, with the intention of managing a collection of them.

func NewJSONAPIErrorsWith

func NewJSONAPIErrorsWith(detail string) *JSONAPIErrors

NewJSONAPIErrorsWith creates an instance of JSONAPIErrors populated with this single detail.

func (*JSONAPIErrors) Add

func (jae *JSONAPIErrors) Add(detail string)

Add adds a new error to JSONAPIErrors with the passed detail.

func (*JSONAPIErrors) CoerceEmptyToNil

func (jae *JSONAPIErrors) CoerceEmptyToNil() error

CoerceEmptyToNil will return nil if JSONAPIErrors has no errors.

func (*JSONAPIErrors) Error

func (jae *JSONAPIErrors) Error() string

Error collapses the collection of errors into a collection of comma separated strings.

func (*JSONAPIErrors) Merge

func (jae *JSONAPIErrors) Merge(e error)

Merge combines the arrays of the passed error if it is of type JSONAPIErrors, otherwise simply adds a single error with the error string as detail.

type KV added in v0.8.2

type KV map[string]interface{}

KV represents a key/value pair to be added to a JSON object

type RandomnessRequestLog added in v0.8.8

type RandomnessRequestLog struct {
	KeyHash   common.Hash
	Seed      *big.Int // uint256
	JobID     common.Hash
	Sender    common.Address
	Fee       *assets.Link // uint256
	RequestID common.Hash
	Raw       RawRandomnessRequestLog
}

RandomnessRequestLog contains the data for a RandomnessRequest log, represented as compatible golang types.

func ParseRandomnessRequestLog added in v0.8.8

func ParseRandomnessRequestLog(log types.Log) (*RandomnessRequestLog, error)

ParseRandomnessRequestLog returns the RandomnessRequestLog corresponding to the raw logData

func RawRandomnessRequestLogToRandomnessRequestLog added in v0.8.8

func RawRandomnessRequestLogToRandomnessRequestLog(
	l *RawRandomnessRequestLog) *RandomnessRequestLog

func (*RandomnessRequestLog) ComputedRequestID added in v0.8.13

func (l *RandomnessRequestLog) ComputedRequestID() common.Hash

func (*RandomnessRequestLog) Equal added in v0.8.8

Equal(ol) is true iff l is the same log as ol, and both represent valid RandomnessRequest logs.

func (*RandomnessRequestLog) RawData added in v0.8.8

func (l *RandomnessRequestLog) RawData() ([]byte, error)

RawData returns the raw bytes corresponding to l in a solidity log

This serialization does not include the JobID, because that's an indexed field.

type RawRandomnessRequestLog added in v0.8.8

RawRandomnessRequestLog is used to parse a RandomnessRequest log into types go-ethereum knows about.

type ReplayBlocksRequest added in v0.10.11

type ReplayBlocksRequest struct {
	BlockNumber int64 `json:"blockNumber" gorm:"type:text"`
}

type SendEtherRequest

type SendEtherRequest struct {
	DestinationAddress common.Address `json:"address"`
	FromAddress        common.Address `json:"from"`
	Amount             assets.Eth     `json:"amount"`
}

SendEtherRequest represents a request to transfer ETH.

type Session

type Session struct {
	ID        string    `json:"id" gorm:"primary_key"`
	LastUsed  time.Time `json:"lastUsed" gorm:"index"`
	CreatedAt time.Time `json:"createdAt" gorm:"index"`
}

Session holds the unique id for the authenticated session.

func NewSession

func NewSession() Session

NewSession returns a session instance with ID set to a random ID and LastUsed to to now.

type SessionRequest

type SessionRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

SessionRequest encapsulates the fields needed to generate a new SessionID, including the hashed password.

type Sha256Hash added in v0.9.3

type Sha256Hash [32]byte

Explicit type indicating a 32-byte sha256 hash

func MustSha256HashFromHex added in v0.9.3

func MustSha256HashFromHex(x string) Sha256Hash

func Sha256HashFromHex added in v0.9.3

func Sha256HashFromHex(x string) (Sha256Hash, error)

func (Sha256Hash) MarshalJSON added in v0.9.6

func (s Sha256Hash) MarshalJSON() ([]byte, error)

MarshalJSON converts a Sha256Hash to a JSON byte slice.

func (*Sha256Hash) Scan added in v0.9.3

func (s *Sha256Hash) Scan(value interface{}) error

func (Sha256Hash) String added in v0.9.3

func (s Sha256Hash) String() string

func (*Sha256Hash) UnmarshalJSON added in v0.9.6

func (s *Sha256Hash) UnmarshalJSON(input []byte) error

UnmarshalJSON converts a bytes slice of JSON to a TaskType.

func (*Sha256Hash) UnmarshalText added in v0.9.3

func (s *Sha256Hash) UnmarshalText(bs []byte) error

func (Sha256Hash) Value added in v0.9.3

func (s Sha256Hash) Value() (driver.Value, error)

type Signature

type Signature [SignatureLength]byte

Signature is a byte array fixed to the size of a signature

func BytesToSignature

func BytesToSignature(b []byte) Signature

BytesToSignature converts an arbitrary length byte array to a Signature

func NewSignature

func NewSignature(s string) (Signature, error)

NewSignature returns a new Signature

func (Signature) Big

func (s Signature) Big() *big.Int

Big returns a big.Int representation

func (Signature) Bytes

func (s Signature) Bytes() []byte

Bytes returns the raw bytes

func (Signature) Format

func (s Signature) Format(state fmt.State, c rune)

Format implements fmt.Formatter

func (Signature) Hex

func (s Signature) Hex() string

Hex returns a hexadecimal string

func (Signature) MarshalJSON

func (s Signature) MarshalJSON() ([]byte, error)

MarshalJSON prints the signature as a hexadecimal encoded string

func (Signature) MarshalText

func (s Signature) MarshalText() ([]byte, error)

MarshalText encodes the signature in hexadecimal

func (*Signature) Scan

func (s *Signature) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (*Signature) SetBytes

func (s *Signature) SetBytes(b []byte)

SetBytes assigns the byte array to the signature

func (Signature) String

func (s Signature) String() string

String implements the stringer interface and is used also by the logger.

func (*Signature) UnmarshalJSON

func (s *Signature) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a signature from a JSON string

func (*Signature) UnmarshalText

func (s *Signature) UnmarshalText(input []byte) error

UnmarshalText parses the signature from a hexadecimal representation

func (Signature) Value

func (s Signature) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

type TaskType

type TaskType string

TaskType defines what Adapter a TaskSpec will use.

func MustNewTaskType

func MustNewTaskType(val string) TaskType

MustNewTaskType instantiates a new TaskType, and panics if a bad input is provided.

func NewTaskType

func NewTaskType(val string) (TaskType, error)

NewTaskType returns a formatted Task type.

func (TaskType) MarshalJSON

func (t TaskType) MarshalJSON() ([]byte, error)

MarshalJSON converts a TaskType to a JSON byte slice.

func (*TaskType) Scan

func (t *TaskType) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (TaskType) String

func (t TaskType) String() string

String returns this TaskType as a string.

func (*TaskType) UnmarshalJSON

func (t *TaskType) UnmarshalJSON(input []byte) error

UnmarshalJSON converts a bytes slice of JSON to a TaskType.

func (TaskType) Value

func (t TaskType) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

type UntrustedBytes added in v0.8.8

type UntrustedBytes []byte

This data can contain anything and is submitted by user on-chain, so we must be extra careful how we interact with it

func (UntrustedBytes) SafeByteSlice added in v0.8.8

func (ary UntrustedBytes) SafeByteSlice(start int, end int) ([]byte, error)

SafeByteSlice returns an error on out of bounds access to a byte array, where a normal slice would panic instead

type User

type User struct {
	Email             string `gorm:"primary_key"`
	HashedPassword    string
	CreatedAt         time.Time `gorm:"index"`
	TokenKey          string
	TokenSalt         string
	TokenHashedSecret string
	UpdatedAt         time.Time
}

User holds the credentials for API user.

func NewUser

func NewUser(email, plainPwd string) (User, error)

NewUser creates a new user by hashing the passed plainPwd with bcrypt.

func (*User) DeleteAuthToken added in v0.8.2

func (u *User) DeleteAuthToken()

DeleteAuthToken clears and disables the users Authentication Token.

func (*User) GenerateAuthToken added in v0.8.2

func (u *User) GenerateAuthToken() (*auth.Token, error)

GenerateAuthToken randomly generates and sets the users Authentication Token.

func (*User) SetAuthToken added in v0.8.2

func (u *User) SetAuthToken(token *auth.Token) error

SetAuthToken updates the user to use the given Authentication Token.

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

ValidationError is an error that occurs during validation.

func (*ValidationError) Error

func (e *ValidationError) Error() string

type WebURL

type WebURL url.URL

WebURL contains the URL of the endpoint.

func (WebURL) MarshalJSON

func (w WebURL) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON-encoded string of the given data.

func (*WebURL) Scan

func (w *WebURL) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (WebURL) String

func (w WebURL) String() string

String delegates to the wrapped URL struct or an empty string when it is nil

func (*WebURL) UnmarshalJSON

func (w *WebURL) UnmarshalJSON(j []byte) error

UnmarshalJSON parses the raw URL stored in JSON-encoded data to a URL structure and sets it to the URL field.

func (WebURL) Value

func (w WebURL) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

type WithdrawalRequest

type WithdrawalRequest struct {
	DestinationAddress common.Address `json:"address"`
	ContractAddress    common.Address `json:"contractAddress"`
	Amount             *assets.Link   `json:"amount"`
}

WithdrawalRequest request to withdraw LINK.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL