graphql

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const HexPrefix = "0x"

HexPrefix is the prefix of ERC20 address in hex string

Variables

View Source
var ErrPaginationNotFound = errors.New("Pagination information is not found")

ErrPaginationNotFound is the error indicating that pagination is not specified

Functions

func DecodeDelegateName

func DecodeDelegateName(name string) (string, error)

DecodeDelegateName converts format to readable delegate name

func EncodeDelegateName

func EncodeDelegateName(name string) (string, error)

EncodeDelegateName converts a delegate name input to an internal format

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type Account

type Account struct {
	ActiveAccounts  []string         `json:"activeAccounts"`
	Alias           *Alias           `json:"alias"`
	OperatorAddress *OperatorAddress `json:"operatorAddress"`
}

type Alias

type Alias struct {
	Exist     bool   `json:"exist"`
	AliasName string `json:"aliasName"`
}

type Bookkeeping

type Bookkeeping struct {
	Exist              bool                  `json:"exist"`
	RewardDistribution []*RewardDistribution `json:"rewardDistribution"`
	Count              int                   `json:"count"`
}

type BucketInfo

type BucketInfo struct {
	VoterEthAddress string `json:"voterEthAddress"`
	WeightedVotes   string `json:"weightedVotes"`
}

type BucketInfoList

type BucketInfoList struct {
	EpochNumber int           `json:"epochNumber"`
	BucketInfo  []*BucketInfo `json:"bucketInfo"`
	Count       int           `json:"count"`
}

type BucketInfoOutput

type BucketInfoOutput struct {
	Exist          bool              `json:"exist"`
	BucketInfoList []*BucketInfoList `json:"bucketInfoList"`
}

type CandidateMeta

type CandidateMeta struct {
	EpochNumber        int    `json:"epochNumber"`
	TotalCandidates    int    `json:"totalCandidates"`
	ConsensusDelegates int    `json:"consensusDelegates"`
	TotalWeightedVotes string `json:"totalWeightedVotes"`
	VotedTokens        string `json:"votedTokens"`
}

type Chain

type Chain struct {
	MostRecentEpoch       int              `json:"mostRecentEpoch"`
	MostRecentBlockHeight int              `json:"mostRecentBlockHeight"`
	MostRecentTps         int              `json:"mostRecentTPS"`
	NumberOfActions       *NumberOfActions `json:"numberOfActions"`
}

type ComplexityRoot

type ComplexityRoot struct {
	Account struct {
		ActiveAccounts  func(childComplexity int, count int) int
		Alias           func(childComplexity int, operatorAddress string) int
		OperatorAddress func(childComplexity int, aliasName string) int
	}

	Alias struct {
		AliasName func(childComplexity int) int
		Exist     func(childComplexity int) int
	}

	Bookkeeping struct {
		Count              func(childComplexity int) int
		Exist              func(childComplexity int) int
		RewardDistribution func(childComplexity int, pagination *Pagination) int
	}

	BucketInfo struct {
		VoterEthAddress func(childComplexity int) int
		WeightedVotes   func(childComplexity int) int
	}

	BucketInfoList struct {
		BucketInfo  func(childComplexity int) int
		Count       func(childComplexity int) int
		EpochNumber func(childComplexity int) int
	}

	BucketInfoOutput struct {
		BucketInfoList func(childComplexity int) int
		Exist          func(childComplexity int) int
	}

	CandidateMeta struct {
		ConsensusDelegates func(childComplexity int) int
		EpochNumber        func(childComplexity int) int
		TotalCandidates    func(childComplexity int) int
		TotalWeightedVotes func(childComplexity int) int
		VotedTokens        func(childComplexity int) int
	}

	Chain struct {
		MostRecentBlockHeight func(childComplexity int) int
		MostRecentEpoch       func(childComplexity int) int
		MostRecentTps         func(childComplexity int, blockWindow int) int
		NumberOfActions       func(childComplexity int, pagination *EpochRange) int
	}

	Delegate struct {
		Bookkeeping  func(childComplexity int, percentage int, includeFoundationBonus bool) int
		BucketInfo   func(childComplexity int) int
		Productivity func(childComplexity int) int
		Reward       func(childComplexity int) int
		Staking      func(childComplexity int) int
	}

	NumberOfActions struct {
		Count func(childComplexity int) int
		Exist func(childComplexity int) int
	}

	OperatorAddress struct {
		Exist           func(childComplexity int) int
		OperatorAddress func(childComplexity int) int
	}

	Productivity struct {
		Exist              func(childComplexity int) int
		ExpectedProduction func(childComplexity int) int
		Production         func(childComplexity int) int
	}

	Query struct {
		Account  func(childComplexity int) int
		Chain    func(childComplexity int) int
		Delegate func(childComplexity int, startEpoch int, epochCount int, delegateName string) int
		Voting   func(childComplexity int, startEpoch int, epochCount int) int
	}

	Reward struct {
		BlockReward     func(childComplexity int) int
		EpochReward     func(childComplexity int) int
		Exist           func(childComplexity int) int
		FoundationBonus func(childComplexity int) int
	}

	RewardDistribution struct {
		Amount            func(childComplexity int) int
		VoterEthAddress   func(childComplexity int) int
		VoterIotexAddress func(childComplexity int) int
	}

	StakingInformation struct {
		EpochNumber  func(childComplexity int) int
		SelfStaking  func(childComplexity int) int
		TotalStaking func(childComplexity int) int
	}

	StakingOutput struct {
		Exist       func(childComplexity int) int
		StakingInfo func(childComplexity int) int
	}

	Voting struct {
		CandidateMeta func(childComplexity int) int
		Exist         func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type Delegate

type Delegate struct {
	Reward       *Reward           `json:"reward"`
	Productivity *Productivity     `json:"productivity"`
	Bookkeeping  *Bookkeeping      `json:"bookkeeping"`
	BucketInfo   *BucketInfoOutput `json:"bucketInfo"`
	Staking      *StakingOutput    `json:"staking"`
}

type DirectiveRoot

type DirectiveRoot struct {
}

type EpochRange

type EpochRange struct {
	StartEpoch int `json:"startEpoch"`
	EpochCount int `json:"epochCount"`
}

type NumberOfActions

type NumberOfActions struct {
	Exist bool `json:"exist"`
	Count int  `json:"count"`
}

type OperatorAddress

type OperatorAddress struct {
	Exist           bool   `json:"exist"`
	OperatorAddress string `json:"operatorAddress"`
}

type Pagination

type Pagination struct {
	Skip  int `json:"skip"`
	First int `json:"first"`
}

type Productivity

type Productivity struct {
	Exist              bool   `json:"exist"`
	Production         string `json:"production"`
	ExpectedProduction string `json:"expectedProduction"`
}

type QueryResolver

type QueryResolver interface {
	Account(ctx context.Context) (*Account, error)
	Chain(ctx context.Context) (*Chain, error)
	Delegate(ctx context.Context, startEpoch int, epochCount int, delegateName string) (*Delegate, error)
	Voting(ctx context.Context, startEpoch int, epochCount int) (*Voting, error)
}

type Resolver

type Resolver struct {
	PP *productivity.Protocol
	RP *rewards.Protocol
	AP *actions.Protocol
	VP *votings.Protocol
	CP *chainmeta.Protocol
}

Resolver is hte resolver that handles GraphQL request

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns a query resolver

type ResolverRoot

type ResolverRoot interface {
	Query() QueryResolver
}

type Reward

type Reward struct {
	Exist           bool   `json:"exist"`
	BlockReward     string `json:"blockReward"`
	EpochReward     string `json:"epochReward"`
	FoundationBonus string `json:"foundationBonus"`
}

type RewardDistribution

type RewardDistribution struct {
	VoterEthAddress   string `json:"voterEthAddress"`
	VoterIotexAddress string `json:"voterIotexAddress"`
	Amount            string `json:"amount"`
}

type StakingInformation

type StakingInformation struct {
	EpochNumber  int    `json:"epochNumber"`
	TotalStaking string `json:"totalStaking"`
	SelfStaking  string `json:"selfStaking"`
}

type StakingOutput

type StakingOutput struct {
	Exist       bool                  `json:"exist"`
	StakingInfo []*StakingInformation `json:"stakingInfo"`
}

type Voting

type Voting struct {
	Exist         bool             `json:"exist"`
	CandidateMeta []*CandidateMeta `json:"candidateMeta"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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