types

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionHandler

type ActionHandler = func(context *Context, payload *Payload) (interface{}, error)

ActionHandler represents a Hasura action request handler. It returns an interface to be returned to the called, or an error if something is wrong

type ActionsWorker

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

ActionsWorker represents the worker that is used to handle Hasura actions queries

func NewActionsWorker

func NewActionsWorker(context *Context) *ActionsWorker

NewActionsWorker returns a new ActionsWorker instance

func (*ActionsWorker) RegisterHandler

func (w *ActionsWorker) RegisterHandler(path string, handler ActionHandler)

RegisterHandler registers the provided handler to be used on each call to the provided path

func (*ActionsWorker) Start

func (w *ActionsWorker) Start(port uint)

Start starts the worker

type Address

type Address struct {
	Address string `json:"address"`
}

type Balance

type Balance struct {
	Coins []Coin `json:"coins"`
}

type Coin

type Coin struct {
	Amount string `json:"amount"`
	Denom  string `json:"denom"`
}

func ConvertCoins

func ConvertCoins(coins sdk.Coins) []Coin

func ConvertDecCoins

func ConvertDecCoins(coins sdk.DecCoins) []Coin

type Context

type Context struct {
	Sources *modulestypes.Sources
	// contains filtered or unexported fields
}

Context contains the data about a Hasura actions worker execution

func NewContext

func NewContext(node node.Node, sources *modulestypes.Sources) *Context

NewContext returns a new Context instance

func (*Context) GetHeight

func (c *Context) GetHeight(payload *Payload) (int64, error)

GetHeight uses the lastest height when the input height is empty from graphql request

type Delegation

type Delegation struct {
	DelegatorAddress string `json:"delegator_address"`
	ValidatorAddress string `json:"validator_address"`
	Coins            []Coin `json:"coins"`
}

type DelegationResponse

type DelegationResponse struct {
	Delegations []Delegation        `json:"delegations"`
	Pagination  *query.PageResponse `json:"pagination"`
}

type DelegationReward

type DelegationReward struct {
	Coins            []Coin `json:"coins"`
	ValidatorAddress string `json:"validator_address"`
}

type GraphQLError

type GraphQLError struct {
	Message string `json:"message"`
}

type Payload

type Payload struct {
	SessionVariables map[string]interface{} `json:"session_variables"`
	Input            PayloadArgs            `json:"input"`
}

Payload contains the payload data that is sent from Hasura

func (*Payload) GetAddress

func (p *Payload) GetAddress() string

GetAddress returns the address associated with this payload, if any

func (*Payload) GetPagination

func (p *Payload) GetPagination() *query.PageRequest

GetPagination returns the pagination asasociated with this payload, if any

type PayloadArgs

type PayloadArgs struct {
	Address    string `json:"address"`
	Height     int64  `json:"height"`
	Offset     uint64 `json:"offset"`
	Limit      uint64 `json:"limit"`
	CountTotal bool   `json:"count_total"`
}

type Redelegation

type Redelegation struct {
	DelegatorAddress    string              `json:"delegator_address"`
	ValidatorSrcAddress string              `json:"validator_src_address"`
	ValidatorDstAddress string              `json:"validator_dst_address"`
	RedelegationEntries []RedelegationEntry `json:"entries"`
}

type RedelegationEntry

type RedelegationEntry struct {
	CompletionTime time.Time `json:"completion_time"`
	Balance        sdk.Int   `json:"balance"`
}

type RedelegationResponse

type RedelegationResponse struct {
	Redelegations []Redelegation      `json:"redelegations"`
	Pagination    *query.PageResponse `json:"pagination"`
}

type UnbondingDelegation

type UnbondingDelegation struct {
	DelegatorAddress string                                 `json:"delegator_address"`
	ValidatorAddress string                                 `json:"validator_address"`
	Entries          []stakingtype.UnbondingDelegationEntry `json:"entries"`
}

type UnbondingDelegationResponse

type UnbondingDelegationResponse struct {
	UnbondingDelegations []UnbondingDelegation `json:"unbonding_delegations"`
	Pagination           *query.PageResponse   `json:"pagination"`
}

type ValidatorCommissionAmount

type ValidatorCommissionAmount struct {
	Coins []Coin `json:"coins"`
}

Jump to

Keyboard shortcuts

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