Back to godoc.org

Package server

v0.0.0-...-bbeb5d4
Latest Go to latest

The highest tagged major version is .

Published: Jul 7, 2020 | License: MIT | Module: blockwatch.cc/tzindex

Index

Constants

const (
	EC_NO_ROUTE = 1000 + iota
	EC_CONTENTTYPE_UNSUPPORTED
	EC_CONTENTTYPE_UNEXPECTED
	EC_MARSHAL_FAILED
	EC_DEMARSHAL_FAILED
	EC_BAD_URL_QUERY
	EC_PARAM_REQUIRED
	EC_PARAM_INVALID
	EC_PARAM_NOISOLANG
	EC_PARAM_NOISOCOUNTRY
	EC_PARAM_NOTEXPECTED
)

10xx - HTTP errors

const (
	EC_DATABASE = 1100 + iota
	EC_SERVER
	EC_RPC
	EC_NETWORK
)

11xx - internal server error codes

const (
	EC_ACCESS_HEADER_MISSING = 1200 + iota
	EC_ACCESS_APIKEY_MISSING
	EC_ACCESS_APIKEY_INVALID
	EC_ACCESS_APIKEY_INACTIVE
	EC_ACCESS_APIVERSION_INVALID
	EC_ACCESS_METHOD_UNSUPPORTED
	EC_ACCESS_ORIGIN_DENIED
	EC_ACCESS_TOKEN_MISSING
	EC_ACCESS_TOKEN_MALFORMED
	EC_ACCESS_TOKEN_INVALID
	EC_ACCESS_TOKEN_REVOKED
	EC_ACCESS_TOKEN_EXPIRED
	EC_ACCESS_SCOPES_INSUFFICIENT
	EC_ACCESS_RATE_LIMITED
	EC_ACCESS_READONLY
	EC_ACCESS_DENIED
)

12xx - Access errors

const (
	EC_RESOURCE_ID_MISSING = 1300 + iota
	EC_RESOURCE_ID_MALFORMED
	EC_RESOURCE_VERSION_MISMATCH
	EC_RESOURCE_TYPE_MISMATCH
	EC_RESOURCE_CONFLICT
	EC_RESOURCE_NOTFOUND
	EC_RESOURCE_EXISTS
	EC_RESOURCE_CREATE_FAILED
	EC_RESOURCE_UPDATE_FAILED
	EC_RESOURCE_DELETE_FAILED
	EC_RESOURCE_STATE_UNEXPECTED
)

13xx - Resource errors

Variables

var (
	EBadRequest         = NewWrappedError(http.StatusBadRequest, "incorrect request syntax")
	EUnauthorized       = NewWrappedError(http.StatusUnauthorized, "authentication required")
	EForbidden          = NewWrappedError(http.StatusForbidden, "access forbidden")
	ENotFound           = NewWrappedError(http.StatusNotFound, "resource not found")
	ENotAllowed         = NewWrappedError(http.StatusMethodNotAllowed, "method not allowed")
	ENotAcceptable      = NewWrappedError(http.StatusNotAcceptable, "unsupported response type")
	EBadMimetype        = NewWrappedError(http.StatusUnsupportedMediaType, "unsupported media type")
	EConflict           = NewWrappedError(http.StatusConflict, "resource state conflict")
	EInternal           = NewWrappedError(http.StatusInternalServerError, "internal server error")
	ERequestTooLarge    = NewWrappedError(http.StatusRequestEntityTooLarge, "request size exceeds our limits")
	ETooManyRequests    = NewWrappedError(http.StatusTooManyRequests, "request limit exceeded")
	EServiceUnavailable = NewWrappedError(http.StatusServiceUnavailable, "service temporarily unavailable")
	ENotImplemented     = NewWrappedError(http.StatusNotImplemented, "not implemented")
	EConnectionClosed   = NewWrappedError(499, "connection closed")
)

Server Error Reasons

var (
	UserAgent  = "Blockwatch-tzindex/1.0"
	ApiVersion string
)
var LoggerMap map[string]logpkg.Logger

func BoolPtr

func BoolPtr(b bool) *bool

func C

func C(f ApiCall) func(http.ResponseWriter, *http.Request)

func DisableLog

func DisableLog()

func FlushDatabases

func FlushDatabases(ctx *ApiContext) (interface{}, int)

func FlushJournals

func FlushJournals(ctx *ApiContext) (interface{}, int)

func GcDatabases

func GcDatabases(ctx *ApiContext) (interface{}, int)

func GetBlockchainConfig

func GetBlockchainConfig(ctx *ApiContext) (interface{}, int)

func GetBlockchainTip

func GetBlockchainTip(ctx *ApiContext) (interface{}, int)

func GetConfig

func GetConfig(ctx *ApiContext) (interface{}, int)

func GetMemStats

func GetMemStats(ctx *ApiContext) (interface{}, int)

func GetStatus

func GetStatus(ctx *ApiContext) (interface{}, int)

func GetTableStats

func GetTableStats(ctx *ApiContext) (interface{}, int)

func ListBigMapKeyUpdates

func ListBigMapKeyUpdates(ctx *ApiContext) (interface{}, int)

func ListBigMapKeys

func ListBigMapKeys(ctx *ApiContext) (interface{}, int)

func ListBigMapUpdates

func ListBigMapUpdates(ctx *ApiContext) (interface{}, int)

func ListBigMapValues

func ListBigMapValues(ctx *ApiContext) (interface{}, int)

func MapError

func MapError(scope, msg string, err error) error

func NewRouter

func NewRouter() *mux.Router

Generate a new API router with support for HTTP OPTIONS

func NotFound

func NotFound(ctx *ApiContext) (interface{}, int)

func ParseErrorFromByte

func ParseErrorFromByte(b []byte, status int) error

func ParseErrorFromStream

func ParseErrorFromStream(i io.Reader, status int) error

func Ping

func Ping(ctx *ApiContext) (interface{}, int)

func ReadAccount

func ReadAccount(ctx *ApiContext) (interface{}, int)

func ReadAccountBallots

func ReadAccountBallots(ctx *ApiContext) (interface{}, int)

func ReadAccountOps

func ReadAccountOps(ctx *ApiContext) (interface{}, int)

func ReadBigMap

func ReadBigMap(ctx *ApiContext) (interface{}, int)

func ReadBigMapType

func ReadBigMapType(ctx *ApiContext) (interface{}, int)

func ReadBigMapValue

func ReadBigMapValue(ctx *ApiContext) (interface{}, int)

func ReadBlock

func ReadBlock(ctx *ApiContext) (interface{}, int)

func ReadBlockOps

func ReadBlockOps(ctx *ApiContext) (interface{}, int)

func ReadContract

func ReadContract(ctx *ApiContext) (interface{}, int)

func ReadContractCalls

func ReadContractCalls(ctx *ApiContext) (interface{}, int)

list incoming transaction with data

func ReadContractManager

func ReadContractManager(ctx *ApiContext) (interface{}, int)

func ReadContractScript

func ReadContractScript(ctx *ApiContext) (interface{}, int)

func ReadContractStorage

func ReadContractStorage(ctx *ApiContext) (interface{}, int)

func ReadCycle

func ReadCycle(ctx *ApiContext) (interface{}, int)

func ReadElection

func ReadElection(ctx *ApiContext) (interface{}, int)

func ReadManagedAccounts

func ReadManagedAccounts(ctx *ApiContext) (interface{}, int)

func ReadOp

func ReadOp(ctx *ApiContext) (interface{}, int)

func RollbackDatabases

func RollbackDatabases(ctx *ApiContext) (interface{}, int)

func SnapshotDatabases

func SnapshotDatabases(ctx *ApiContext) (interface{}, int)

func StateOptions

func StateOptions(ctx *ApiContext) (interface{}, int)

Respond to requests with the OPTIONS Method.

func StreamAccountTable

func StreamAccountTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamBallotTable

func StreamBallotTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamBigMapItemTable

func StreamBigMapItemTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamBlockSeries

func StreamBlockSeries(ctx *ApiContext, args *SeriesRequest) (interface{}, int)

func StreamBlockTable

func StreamBlockTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamChainTable

func StreamChainTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamContractTable

func StreamContractTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamElectionTable

func StreamElectionTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamFlowSeries

func StreamFlowSeries(ctx *ApiContext, args *SeriesRequest) (interface{}, int)

func StreamFlowTable

func StreamFlowTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamIncomeTable

func StreamIncomeTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamOpSeries

func StreamOpSeries(ctx *ApiContext, args *SeriesRequest) (interface{}, int)

func StreamOpTable

func StreamOpTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamProposalTable

func StreamProposalTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamRightsTable

func StreamRightsTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamSeries

func StreamSeries(ctx *ApiContext) (interface{}, int)

func StreamSnapshotTable

func StreamSnapshotTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamSupplyTable

func StreamSupplyTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func StreamTable

func StreamTable(ctx *ApiContext) (interface{}, int)

func StreamVoteTable

func StreamVoteTable(ctx *ApiContext, args *TableRequest) (interface{}, int)

func UpdateLog

func UpdateLog(ctx *ApiContext) (interface{}, int)

func UseLogger

func UseLogger(logger logpkg.Logger)

type Account

type Account struct {
	model.Account
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Account) MarshalCSV

func (a *Account) MarshalCSV() ([]string, error)

func (*Account) MarshalJSON

func (a *Account) MarshalJSON() ([]byte, error)

func (*Account) MarshalJSONBrief

func (a *Account) MarshalJSONBrief() ([]byte, error)

func (*Account) MarshalJSONVerbose

func (a *Account) MarshalJSONVerbose() ([]byte, error)

type ApiCall

type ApiCall func(*ApiContext) (interface{}, int)

type ApiContext

type ApiContext struct {
	context.Context
	// request data
	Request        *http.Request
	ResponseWriter http.ResponseWriter
	RemoteIP       net.IP
	Cfg            *Config
	Server         *RestServer
	Crawler        *etl.Crawler
	Indexer        *etl.Indexer
	Client         *rpc.Client

	// QoS and Debugging
	RequestID string
	Log       logpkg.Logger

	// Statistics
	Now         time.Time
	Performance *PerformanceCounter
	// contains filtered or unexported fields
}

func (*ApiContext) ParseRequestArgs

func (api *ApiContext) ParseRequestArgs(args interface{})

GET/POST/PATCH/PATCH load data or fail

func (*ApiContext) StreamResponseHeaders

func (api *ApiContext) StreamResponseHeaders(status int, contentType string)

func (*ApiContext) StreamTrailer

func (api *ApiContext) StreamTrailer(cursor string, count int, err error)

type ApiErrorWrapper

type ApiErrorWrapper func(code int, detail string, err error) *Error

func NewWrappedApiError

func NewWrappedApiError(status int, msg string) ApiErrorWrapper

type Ballot

type Ballot struct {
	model.Ballot
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Ballot) MarshalCSV

func (b *Ballot) MarshalCSV() ([]string, error)

func (*Ballot) MarshalJSON

func (b *Ballot) MarshalJSON() ([]byte, error)

func (*Ballot) MarshalJSONBrief

func (b *Ballot) MarshalJSONBrief() ([]byte, error)

func (*Ballot) MarshalJSONVerbose

func (b *Ballot) MarshalJSONVerbose() ([]byte, error)

type BigMapItem

type BigMapItem struct {
	model.BigMapItem
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*BigMapItem) MarshalCSV

func (b *BigMapItem) MarshalCSV() ([]string, error)

func (*BigMapItem) MarshalJSON

func (b *BigMapItem) MarshalJSON() ([]byte, error)

func (*BigMapItem) MarshalJSONBrief

func (b *BigMapItem) MarshalJSONBrief() ([]byte, error)

func (*BigMapItem) MarshalJSONVerbose

func (b *BigMapItem) MarshalJSONVerbose() ([]byte, error)

type Block

type Block struct {
	model.Block
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Block) MarshalCSV

func (b *Block) MarshalCSV() ([]string, error)

func (*Block) MarshalJSON

func (b *Block) MarshalJSON() ([]byte, error)

func (*Block) MarshalJSONBrief

func (b *Block) MarshalJSONBrief() ([]byte, error)

func (*Block) MarshalJSONVerbose

func (b *Block) MarshalJSONVerbose() ([]byte, error)

type BlockSeries

type BlockSeries struct {
	Timestamp           time.Time `json:"time"`
	NSlotsEndorsed      int64     `json:"n_slots_endorsed"`
	NOps                int64     `json:"n_ops"`
	NOpsFailed          int64     `json:"n_ops_failed"`
	NOpsContract        int64     `json:"n_ops_contract"`
	NTx                 int64     `json:"n_tx"`
	NActivation         int64     `json:"n_activation"`
	NSeedNonce          int64     `json:"n_seed_nonce_revelation"`
	N2Baking            int64     `json:"n_double_baking_evidence"`
	N2Endorsement       int64     `json:"n_double_endorsement_evidence"`
	NEndorsement        int64     `json:"n_endorsement"`
	NDelegation         int64     `json:"n_delegation"`
	NReveal             int64     `json:"n_reveal"`
	NOrigination        int64     `json:"n_origination"`
	NProposal           int64     `json:"n_proposal"`
	NBallot             int64     `json:"n_ballot"`
	Volume              int64     `json:"volume"`
	Fees                int64     `json:"fees"`
	Rewards             int64     `json:"rewards"`
	Deposits            int64     `json:"deposits"`
	UnfrozenFees        int64     `json:"unfrozen_fees"`
	UnfrozenRewards     int64     `json:"unfrozen_rewards"`
	UnfrozenDeposits    int64     `json:"unfrozen_deposits"`
	ActivatedSupply     int64     `json:"activated_supply"`
	BurnedSupply        int64     `json:"burned_supply"`
	NewAccounts         int64     `json:"n_new_accounts"`
	NewImplicitAccounts int64     `json:"n_new_implicit"`
	NewManagedAccounts  int64     `json:"n_new_managed"`
	NewContracts        int64     `json:"n_new_contracts"`
	ClearedAccounts     int64     `json:"n_cleared_accounts"`
	FundedAccounts      int64     `json:"n_funded_accounts"`
	GasUsed             int64     `json:"gas_used"`
	StorageSize         int64     `json:"storage_size"`
	TDD                 float64   `json:"days_destroyed"`
	// contains filtered or unexported fields
}

Only use fields that can be summed over time configurable marshalling helper

func (*BlockSeries) Add

func (s *BlockSeries) Add(b *model.Block)

func (*BlockSeries) MarshalCSV

func (b *BlockSeries) MarshalCSV() ([]string, error)

func (*BlockSeries) MarshalJSON

func (s *BlockSeries) MarshalJSON() ([]byte, error)

func (*BlockSeries) MarshalJSONBrief

func (b *BlockSeries) MarshalJSONBrief() ([]byte, error)

func (*BlockSeries) MarshalJSONVerbose

func (b *BlockSeries) MarshalJSONVerbose() ([]byte, error)

func (*BlockSeries) Reset

func (s *BlockSeries) Reset()

type BlockchainConfig

type BlockchainConfig struct {
	// chain identity
	Name        string             `json:"name"`
	Network     string             `json:"network"`
	Symbol      string             `json:"symbol"`
	ChainId     chain.ChainIdHash  `json:"chain_id"`
	Deployment  int                `json:"deployment"`
	Version     int                `json:"version"`
	Protocol    chain.ProtocolHash `json:"protocol"`
	StartHeight int64              `json:"start_height"`
	EndHeight   int64              `json:"end_height"`

	// fixed
	NoRewardCycles              int64 `json:"no_reward_cycles"`
	SecurityDepositRampUpCycles int64 `json:"security_deposit_ramp_up_cycles"`
	Decimals                    int   `json:"decimals"`
	Token                       int64 `json:"units"`

	// may change with protocol updates
	BlockReward                  float64 `json:"block_reward"`
	BlockSecurityDeposit         float64 `json:"block_security_deposit"`
	BlocksPerCommitment          int64   `json:"blocks_per_commitment"`
	BlocksPerCycle               int64   `json:"blocks_per_cycle"`
	BlocksPerRollSnapshot        int64   `json:"blocks_per_roll_snapshot"`
	BlocksPerVotingPeriod        int64   `json:"blocks_per_voting_period"`
	CostPerByte                  int64   `json:"cost_per_byte"`
	EndorsementReward            float64 `json:"endorsement_reward"`
	EndorsementSecurityDeposit   float64 `json:"endorsement_security_deposit"`
	EndorsersPerBlock            int     `json:"endorsers_per_block"`
	HardGasLimitPerBlock         int64   `json:"hard_gas_limit_per_block"`
	HardGasLimitPerOperation     int64   `json:"hard_gas_limit_per_operation"`
	HardStorageLimitPerOperation int64   `json:"hard_storage_limit_per_operation"`
	MaxOperationDataLength       int     `json:"max_operation_data_length"`
	MaxProposalsPerDelegate      int     `json:"max_proposals_per_delegate"`
	MaxRevelationsPerBlock       int     `json:"max_revelations_per_block"`
	MichelsonMaximumTypeSize     int     `json:"michelson_maximum_type_size"`
	NonceLength                  int     `json:"nonce_length"`
	OriginationBurn              float64 `json:"origination_burn"`
	OriginationSize              int64   `json:"origination_size"`
	PreservedCycles              int64   `json:"preserved_cycles"`
	ProofOfWorkNonceSize         int     `json:"proof_of_work_nonce_size"`
	ProofOfWorkThreshold         int64   `json:"proof_of_work_threshold"`
	SeedNonceRevelationTip       float64 `json:"seed_nonce_revelation_tip"`
	TimeBetweenBlocks            [2]int  `json:"time_between_blocks"`
	TokensPerRoll                float64 `json:"tokens_per_roll"`
	TestChainDuration            int64   `json:"test_chain_duration"`
	MinProposalQuorum            int64   `json:"min_proposal_quorum"`
	QuorumMin                    int64   `json:"quorum_min"`
	QuorumMax                    int64   `json:"quorum_max"`
	// contains filtered or unexported fields
}

func (BlockchainConfig) Expires

func (c BlockchainConfig) Expires() time.Time

func (BlockchainConfig) LastModified

func (c BlockchainConfig) LastModified() time.Time

type BlockchainTip

type BlockchainTip struct {
	Name        string             `json:"name"`
	Network     string             `json:"network"`
	Symbol      string             `json:"symbol"`
	ChainId     chain.ChainIdHash  `json:"chain_id"`
	GenesisTime time.Time          `json:"genesis_time"`
	BestHash    chain.BlockHash    `json:"block_hash"`
	Timestamp   time.Time          `json:"timestamp"`
	Height      int64              `json:"height"`
	Cycle       int64              `json:"cycle"`
	Deployments []model.Deployment `json:"deployments"`

	TotalAccounts  int64 `json:"total_accounts"`
	FundedAccounts int64 `json:"funded_accounts"`
	TotalOps       int64 `json:"total_ops"`
	Delegators     int64 `json:"delegators"`
	Delegates      int64 `json:"delegates"`
	Rolls          int64 `json:"rolls"`
	RollOwners     int64 `json:"roll_owners"`

	NewAccounts30d     int64   `json:"new_accounts_30d"`
	ClearedAccounts30d int64   `json:"cleared_accounts_30d"`
	FundedAccounts30d  int64   `json:"funded_accounts_30d"`
	Inflation1Y        float64 `json:"inflation_1y"`
	InflationRate1Y    float64 `json:"inflation_rate_1y"`

	Health int `json:"health"`

	Supply *Supply           `json:"supply"`
	Status etl.CrawlerStatus `json:"status"`
	// contains filtered or unexported fields
}

func (BlockchainTip) Expires

func (t BlockchainTip) Expires() time.Time

func (BlockchainTip) LastModified

func (t BlockchainTip) LastModified() time.Time

type Chain

type Chain struct {
	model.Chain
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Chain) MarshalCSV

func (c *Chain) MarshalCSV() ([]string, error)

func (*Chain) MarshalJSON

func (c *Chain) MarshalJSON() ([]byte, error)

func (*Chain) MarshalJSONBrief

func (c *Chain) MarshalJSONBrief() ([]byte, error)

func (*Chain) MarshalJSONVerbose

func (c *Chain) MarshalJSONVerbose() ([]byte, error)

type Config

type Config struct {
	Crawler *etl.Crawler
	Indexer *etl.Indexer
	Client  *rpc.Client
	Http    HttpConfig
}

func (Config) ClampExplore

func (c Config) ClampExplore(count uint) uint

func (Config) ClampExplore64

func (c Config) ClampExplore64(count int64) int64

func (Config) ClampList

func (c Config) ClampList(count uint) uint

func (Config) ClampList64

func (c Config) ClampList64(count int64) int64

type Contract

type Contract struct {
	model.Contract
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Contract) MarshalCSV

func (c *Contract) MarshalCSV() ([]string, error)

func (*Contract) MarshalJSON

func (c *Contract) MarshalJSON() ([]byte, error)

func (*Contract) MarshalJSONBrief

func (c *Contract) MarshalJSONBrief() ([]byte, error)

func (*Contract) MarshalJSONVerbose

func (c *Contract) MarshalJSONVerbose() ([]byte, error)

type ContractRequest

type ContractRequest struct {
	ExplorerListRequest // offset, limit

	Order  pack.OrderType `schema:"order"`
	Block  string         `schema:"block"`  // height or hash for time-lock
	Since  string         `schema:"since"`  // block hash or height for updates
	Unpack bool           `schema:"unpack"` // unpack packed key/values
	Prim   bool           `schema:"prim"`   // for prim/value rendering

	// decoded values
	BlockHeight int64           `schema:"-"`
	BlockHash   chain.BlockHash `schema:"-"`
	SinceHeight int64           `schema:"-"`
	SinceHash   chain.BlockHash `schema:"-"`
}

func (*ContractRequest) ParseBlockIdent

func (r *ContractRequest) ParseBlockIdent(ctx *ApiContext)

func (*ContractRequest) WithPrim

func (r *ContractRequest) WithPrim() bool

func (*ContractRequest) WithUnpack

func (r *ContractRequest) WithUnpack() bool

type Election

type Election struct {
	model.Election
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Election) MarshalCSV

func (e *Election) MarshalCSV() ([]string, error)

func (*Election) MarshalJSON

func (e *Election) MarshalJSON() ([]byte, error)

func (*Election) MarshalJSONBrief

func (e *Election) MarshalJSONBrief() ([]byte, error)

func (*Election) MarshalJSONVerbose

func (e *Election) MarshalJSONVerbose() ([]byte, error)

type Error

type Error struct {
	Code      int    `json:"code"`
	Status    int    `json:"status"`
	Message   string `json:"message"`
	Scope     string `json:"scope"`
	Detail    string `json:"detail"`
	RequestId string `json:"request_id,omitempty"`
	Cause     error  `json:"-"`
	Reason    string `json:"reason,omitempty"`
}

func (*Error) Complete

func (e *Error) Complete(code int, detail string, err error) error

func (*Error) CompleteApiError

func (e *Error) CompleteApiError(code int, detail string, err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Marshal

func (e *Error) Marshal() []byte

func (*Error) MarshalIndent

func (e *Error) MarshalIndent() []byte

func (*Error) SetScope

func (e *Error) SetScope(s string) *Error

func (*Error) String

func (e *Error) String() string

type ErrorList

type ErrorList []*Error

type ErrorResponse

type ErrorResponse struct {
	Errors ErrorList `json:"errors"`
}

type ErrorWrapper

type ErrorWrapper func(code int, detail string, err error) error

func NewWrappedError

func NewWrappedError(status int, msg string) ErrorWrapper

type Explorer

type Explorer struct{}

func (Explorer) Expires

func (e Explorer) Expires() time.Time

func (Explorer) LastModified

func (e Explorer) LastModified() time.Time

func (Explorer) RESTPath

func (e Explorer) RESTPath(r *mux.Router) string

func (Explorer) RESTPrefix

func (e Explorer) RESTPrefix() string

func (Explorer) RegisterDirectRoutes

func (e Explorer) RegisterDirectRoutes(r *mux.Router) error

func (Explorer) RegisterRoutes

func (b Explorer) RegisterRoutes(r *mux.Router) error

type ExplorerAccount

type ExplorerAccount struct {
	Address            string             `json:"address"`
	Type               string             `json:"address_type"`
	Delegate           string             `json:"delegate"`
	Manager            string             `json:"manager"`
	Pubkey             string             `json:"pubkey"`
	FirstIn            int64              `json:"first_in"`
	FirstOut           int64              `json:"first_out"`
	LastIn             int64              `json:"last_in"`
	LastOut            int64              `json:"last_out"`
	FirstSeen          int64              `json:"first_seen"`
	LastSeen           int64              `json:"last_seen"`
	DelegatedSince     int64              `json:"delegated_since"`
	DelegateSince      int64              `json:"delegate_since"`
	FirstInTime        time.Time          `json:"first_in_time"`
	FirstOutTime       time.Time          `json:"first_out_time"`
	LastInTime         time.Time          `json:"last_in_time"`
	LastOutTime        time.Time          `json:"last_out_time"`
	FirstSeenTime      time.Time          `json:"first_seen_time"`
	LastSeenTime       time.Time          `json:"last_seen_time"`
	DelegatedSinceTime time.Time          `json:"delegated_since_time"`
	DelegateSinceTime  time.Time          `json:"delegate_since_time"`
	TotalReceived      float64            `json:"total_received"`
	TotalSent          float64            `json:"total_sent"`
	TotalBurned        float64            `json:"total_burned"`
	TotalFeesPaid      float64            `json:"total_fees_paid"`
	TotalRewardsEarned float64            `json:"total_rewards_earned"`
	TotalFeesEarned    float64            `json:"total_fees_earned"`
	TotalLost          float64            `json:"total_lost"`
	FrozenDeposits     float64            `json:"frozen_deposits"`
	FrozenRewards      float64            `json:"frozen_rewards"`
	FrozenFees         float64            `json:"frozen_fees"`
	UnclaimedBalance   float64            `json:"unclaimed_balance"`
	SpendableBalance   float64            `json:"spendable_balance"`
	TotalBalance       float64            `json:"total_balance"`
	DelegatedBalance   float64            `json:"delegated_balance"`
	TotalDelegations   int64              `json:"total_delegations"`
	ActiveDelegations  int64              `json:"active_delegations"`
	IsFunded           bool               `json:"is_funded"`
	IsActivated        bool               `json:"is_activated"`
	IsVesting          bool               `json:"is_vesting"`
	IsSpendable        bool               `json:"is_spendable"`
	IsDelegatable      bool               `json:"is_delegatable"`
	IsDelegated        bool               `json:"is_delegated"`
	IsRevealed         bool               `json:"is_revealed"`
	IsDelegate         bool               `json:"is_delegate"`
	IsActiveDelegate   bool               `json:"is_active_delegate"`
	IsContract         bool               `json:"is_contract"`
	BlocksBaked        int                `json:"blocks_baked"`
	BlocksMissed       int                `json:"blocks_missed"`
	BlocksStolen       int                `json:"blocks_stolen"`
	BlocksEndorsed     int                `json:"blocks_endorsed"`
	SlotsEndorsed      int                `json:"slots_endorsed"`
	SlotsMissed        int                `json:"slots_missed"`
	NOps               int                `json:"n_ops"`
	NOpsFailed         int                `json:"n_ops_failed"`
	NTx                int                `json:"n_tx"`
	NDelegation        int                `json:"n_delegation"`
	NOrigination       int                `json:"n_origination"`
	NProposal          int                `json:"n_proposal"`
	NBallot            int                `json:"n_ballot"`
	TokenGenMin        int64              `json:"token_gen_min"`
	TokenGenMax        int64              `json:"token_gen_max"`
	GracePeriod        int64              `json:"grace_period"`
	StakingBalance     float64            `json:"staking_balance"`
	Rolls              int64              `json:"rolls"`
	RichRank           int                `json:"rich_rank"`
	TrafficRank        int                `json:"traffic_rank"`
	FlowRank           int                `json:"flow_rank"`
	LastBakeHeight     int64              `json:"last_bake_height"`
	LastBakeBlock      string             `json:"last_bake_block"`
	LastBakeTime       time.Time          `json:"last_bake_time"`
	LastEndorseHeight  int64              `json:"last_endorse_height"`
	LastEndorseBlock   string             `json:"last_endorse_block"`
	LastEndorseTime    time.Time          `json:"last_endorse_time"`
	NextBakeHeight     int64              `json:"next_bake_height"`
	NextBakePriority   int                `json:"next_bake_priority"`
	NextBakeTime       time.Time          `json:"next_bake_time"`
	NextEndorseHeight  int64              `json:"next_endorse_height"`
	NextEndorseTime    time.Time          `json:"next_endorse_time"`
	DelegateAcc        *ExplorerAccount   `json:"delegate_account,omitempty"`
	ManagerAcc         *ExplorerAccount   `json:"manager_account,omitempty"`
	Ops                *[]*ExplorerOp     `json:"ops,omitempty"`
	Ballots            *[]*ExplorerBallot `json:"ballots,omitempty"`
	// contains filtered or unexported fields
}

func NewExplorerAccount

func NewExplorerAccount(ctx *ApiContext, a *model.Account, p *chain.Params, details bool) *ExplorerAccount

func (ExplorerAccount) Expires

func (a ExplorerAccount) Expires() time.Time

func (ExplorerAccount) LastModified

func (a ExplorerAccount) LastModified() time.Time

func (ExplorerAccount) RESTPath

func (a ExplorerAccount) RESTPath(r *mux.Router) string

func (ExplorerAccount) RESTPrefix

func (a ExplorerAccount) RESTPrefix() string

func (ExplorerAccount) RegisterDirectRoutes

func (b ExplorerAccount) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerAccount) RegisterRoutes

func (b ExplorerAccount) RegisterRoutes(r *mux.Router) error

type ExplorerBallot

type ExplorerBallot struct {
	Height           int64                  `json:"height"`
	Timestamp        time.Time              `json:"time"`
	ElectionId       int                    `json:"election_id"`
	VotingPeriod     int64                  `json:"voting_period"`
	VotingPeriodKind chain.VotingPeriodKind `json:"voting_period_kind"`
	Proposal         chain.ProtocolHash     `json:"proposal"`
	OpHash           chain.OperationHash    `json:"op"`
	Ballot           chain.BallotVote       `json:"ballot"`
	Rolls            int64                  `json:"rolls"`
	Sender           string                 `json:"sender"`
}

type ExplorerBigMapUpdate

type ExplorerBigMapUpdate struct {
	ExplorerBigmapValue                            // full value
	Action              micheline.BigMapDiffAction `json:"action"`

	// alloc/copy
	KeyType     *micheline.OpCode     `json:"key_type,omitempty"`
	KeyEncoding *micheline.PrimType   `json:"key_encoding,omitempty"`
	ValueType   *micheline.BigMapType `json:"value_type,omitempty"`
	SourceId    int64                 `json:"source_big_map,omitempty"`
	DestId      int64                 `json:"destination_big_map,omitempty"`
}

updates

type ExplorerBigMapUpdateList

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

func (ExplorerBigMapUpdateList) Expires

func (l ExplorerBigMapUpdateList) Expires() time.Time

func (ExplorerBigMapUpdateList) LastModified

func (l ExplorerBigMapUpdateList) LastModified() time.Time

func (ExplorerBigMapUpdateList) MarshalJSON

func (l ExplorerBigMapUpdateList) MarshalJSON() ([]byte, error)

type ExplorerBigmap

type ExplorerBigmap struct {
	Contract        string          `json:"contract"`
	BigMapId        int64           `json:"bigmap_id"`
	NUpdates        int64           `json:"n_updates"`
	NKeys           int64           `json:"n_keys"`
	AllocatedHeight int64           `json:"alloc_height"`
	AllocatedBlock  chain.BlockHash `json:"alloc_block"`
	AllocatedTime   time.Time       `json:"alloc_time"`
	UpdatedHeight   int64           `json:"update_height"`
	UpdatedBlock    chain.BlockHash `json:"update_block"`
	UpdatedTime     time.Time       `json:"update_time"`
	// contains filtered or unexported fields
}

func NewExplorerBigMap

func NewExplorerBigMap(ctx *ApiContext, alloc, last *model.BigMapItem) *ExplorerBigmap

func (ExplorerBigmap) Expires

func (b ExplorerBigmap) Expires() time.Time

func (ExplorerBigmap) LastModified

func (b ExplorerBigmap) LastModified() time.Time

func (ExplorerBigmap) RESTPath

func (b ExplorerBigmap) RESTPath(r *mux.Router) string

func (ExplorerBigmap) RESTPrefix

func (b ExplorerBigmap) RESTPrefix() string

func (ExplorerBigmap) RegisterDirectRoutes

func (b ExplorerBigmap) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerBigmap) RegisterRoutes

func (b ExplorerBigmap) RegisterRoutes(r *mux.Router) error

type ExplorerBigmapKey

type ExplorerBigmapKey struct {
	Key         *micheline.BigMapKey `json:"key"`
	KeyHash     chain.ExprHash       `json:"key_hash"`
	KeyBinary   string               `json:"key_binary"`
	KeyUnpacked *micheline.BigMapKey `json:"key_unpacked,omitempty"`
	KeyPretty   string               `json:"key_pretty,omitempty"`
	Meta        ExplorerBigmapMeta   `json:"meta"`
	Prim        *micheline.Prim      `json:"prim,omitempty"`
}

keys

type ExplorerBigmapKeyList

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

func (ExplorerBigmapKeyList) Expires

func (l ExplorerBigmapKeyList) Expires() time.Time

func (ExplorerBigmapKeyList) LastModified

func (l ExplorerBigmapKeyList) LastModified() time.Time

func (ExplorerBigmapKeyList) MarshalJSON

func (l ExplorerBigmapKeyList) MarshalJSON() ([]byte, error)

type ExplorerBigmapKeyValue

type ExplorerBigmapKeyValue struct {
	Key       *micheline.Prim `json:"key,omitempty"`
	Value     *micheline.Prim `json:"value,omitempty"`
	KeyType   *micheline.Prim `json:"key_type,omitempty"`
	ValueType *micheline.Prim `json:"value_type,omitempty"`
}

type ExplorerBigmapMeta

type ExplorerBigmapMeta struct {
	Contract     string          `json:"contract"`
	BigMapId     int64           `json:"bigmap_id"`
	UpdateTime   time.Time       `json:"time"`
	UpdateHeight int64           `json:"height"`
	UpdateBlock  chain.BlockHash `json:"block"`
	IsReplaced   *bool           `json:"is_replaced,omitempty"` // empty in op lists
	IsRemoved    *bool           `json:"is_removed,omitempty"`
}

bigmap metadata

type ExplorerBigmapType

type ExplorerBigmapType struct {
	Contract    string                  `json:"contract"`
	BigMapId    int64                   `json:"bigmap_id"`
	KeyType     micheline.OpCode        `json:"key_type"`
	KeyEncoding micheline.PrimType      `json:"key_encoding"`
	ValueType   micheline.BigMapType    `json:"value_type"`
	Prim        *ExplorerBigmapKeyValue `json:"prim,omitempty"`
	// contains filtered or unexported fields
}

type

func (ExplorerBigmapType) Expires

func (t ExplorerBigmapType) Expires() time.Time

func (ExplorerBigmapType) LastModified

func (t ExplorerBigmapType) LastModified() time.Time

type ExplorerBigmapValue

type ExplorerBigmapValue struct {
	Key           *micheline.BigMapKey    `json:"key"`
	KeyHash       chain.ExprHash          `json:"key_hash"`
	KeyBinary     string                  `json:"key_binary,omitempty"` // omit on alloc updates
	KeyUnpacked   *micheline.BigMapKey    `json:"key_unpacked,omitempty"`
	KeyPretty     string                  `json:"key_pretty,omitempty"`
	Value         *micheline.BigMapValue  `json:"value,omitempty"` // omit on removal updates
	ValueUnpacked *micheline.BigMapValue  `json:"value_unpacked,omitempty"`
	Meta          ExplorerBigmapMeta      `json:"meta"`
	Prim          *ExplorerBigmapKeyValue `json:"prim,omitempty"`
	// contains filtered or unexported fields
}

values

func (ExplorerBigmapValue) Expires

func (t ExplorerBigmapValue) Expires() time.Time

func (ExplorerBigmapValue) LastModified

func (t ExplorerBigmapValue) LastModified() time.Time

type ExplorerBigmapValueList

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

func (ExplorerBigmapValueList) Expires

func (l ExplorerBigmapValueList) Expires() time.Time

func (ExplorerBigmapValueList) LastModified

func (l ExplorerBigmapValueList) LastModified() time.Time

func (ExplorerBigmapValueList) MarshalJSON

func (l ExplorerBigmapValueList) MarshalJSON() ([]byte, error)

type ExplorerBlock

type ExplorerBlock struct {
	Hash                chain.BlockHash        `json:"hash"`
	ParentHash          chain.BlockHash        `json:"predecessor"`
	FollowerHash        chain.BlockHash        `json:"successor"`
	Baker               chain.Address          `json:"baker"`
	IsOrphan            bool                   `json:"is_orphan,omitempty"`
	Height              int64                  `json:"height"`
	Cycle               int64                  `json:"cycle"`
	IsCycleSnapshot     bool                   `json:"is_cycle_snapshot"`
	Timestamp           time.Time              `json:"time"`
	Solvetime           int                    `json:"solvetime"`
	Version             int                    `json:"version"`
	Validation          int                    `json:"validation_pass"`
	Fitness             uint64                 `json:"fitness"`
	Priority            int                    `json:"priority"`
	Nonce               uint64                 `json:"nonce"`
	VotingPeriodKind    chain.VotingPeriodKind `json:"voting_period_kind"`
	SlotsEndorsed       uint32                 `json:"endorsed_slots"`
	NSlotsEndorsed      int                    `json:"n_endorsed_slots"`
	NOps                int                    `json:"n_ops"`
	NOpsFailed          int                    `json:"n_ops_failed"`
	NOpsContract        int                    `json:"n_ops_contract"`
	NTx                 int                    `json:"n_tx"`
	NActivation         int                    `json:"n_activation"`
	NSeedNonce          int                    `json:"n_seed_nonce_revelations"`
	N2Baking            int                    `json:"n_double_baking_evidences"`
	N2Endorsement       int                    `json:"n_double_endorsement_evidences"`
	NEndorsement        int                    `json:"n_endorsement"`
	NDelegation         int                    `json:"n_delegation"`
	NReveal             int                    `json:"n_reveal"`
	NOrigination        int                    `json:"n_origination"`
	NProposal           int                    `json:"n_proposal"`
	NBallot             int                    `json:"n_ballot"`
	Volume              float64                `json:"volume"`
	Fees                float64                `json:"fees"`
	Rewards             float64                `json:"rewards"`
	Deposits            float64                `json:"deposits"`
	UnfrozenFees        float64                `json:"unfrozen_fees"`
	UnfrozenRewards     float64                `json:"unfrozen_rewards"`
	UnfrozenDeposits    float64                `json:"unfrozen_deposits"`
	ActivatedSupply     float64                `json:"activated_supply"`
	BurnedSupply        float64                `json:"burned_supply"`
	SeenAccounts        int                    `json:"n_accounts"`
	NewAccounts         int                    `json:"n_new_accounts"`
	NewImplicitAccounts int                    `json:"n_new_implicit"`
	NewManagedAccounts  int                    `json:"n_new_managed"`
	NewContracts        int                    `json:"n_new_contracts"`
	ClearedAccounts     int                    `json:"n_cleared_accounts"`
	FundedAccounts      int                    `json:"n_funded_accounts"`
	GasLimit            int64                  `json:"gas_limit"`
	GasUsed             int64                  `json:"gas_used"`
	GasPrice            float64                `json:"gas_price"`
	StorageSize         int64                  `json:"storage_size"`
	TDD                 float64                `json:"days_destroyed"`
	PctAccountsReused   float64                `json:"pct_account_reuse"`
	Ops                 *[]*ExplorerOp         `json:"ops,omitempty"`
	Endorsers           []chain.Address        `json:"endorsers,omitempty"`
	// contains filtered or unexported fields
}

func NewExplorerBlock

func NewExplorerBlock(ctx *ApiContext, block *model.Block, p *chain.Params) *ExplorerBlock

func (ExplorerBlock) Expires

func (b ExplorerBlock) Expires() time.Time

func (ExplorerBlock) LastModified

func (b ExplorerBlock) LastModified() time.Time

func (ExplorerBlock) RESTPath

func (b ExplorerBlock) RESTPath(r *mux.Router) string

func (ExplorerBlock) RESTPrefix

func (b ExplorerBlock) RESTPrefix() string

func (ExplorerBlock) RegisterDirectRoutes

func (b ExplorerBlock) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerBlock) RegisterRoutes

func (b ExplorerBlock) RegisterRoutes(r *mux.Router) error

type ExplorerContract

type ExplorerContract struct {
	Address            string    `json:"address"`
	Manager            string    `json:"manager"`
	Delegate           string    `json:"delegate"`
	Height             int64     `json:"height"`
	Fee                float64   `json:"fee"`
	GasLimit           int64     `json:"gas_limit"`
	GasUsed            int64     `json:"gas_used"`
	GasPrice           float64   `json:"gas_price"`
	StorageLimit       int64     `json:"storage_limit"`
	StorageSize        int64     `json:"storage_size"`
	StoragePaid        int64     `json:"storage_paid"`
	IsFunded           bool      `json:"is_funded"`
	IsVesting          bool      `json:"is_vesting"`
	IsSpendable        bool      `json:"is_spendable"`
	IsDelegatable      bool      `json:"is_delegatable"`
	IsDelegated        bool      `json:"is_delegated"`
	FirstIn            int64     `json:"first_in"`
	FirstOut           int64     `json:"first_out"`
	LastIn             int64     `json:"last_in"`
	LastOut            int64     `json:"last_out"`
	FirstSeen          int64     `json:"first_seen"`
	LastSeen           int64     `json:"last_seen"`
	DelegatedSince     int64     `json:"delegated_since"`
	FirstInTime        time.Time `json:"first_in_time"`
	FirstOutTime       time.Time `json:"first_out_time"`
	LastInTime         time.Time `json:"last_in_time"`
	LastOutTime        time.Time `json:"last_out_time"`
	FirstSeenTime      time.Time `json:"first_seen_time"`
	LastSeenTime       time.Time `json:"last_seen_time"`
	DelegatedSinceTime time.Time `json:"delegated_since_time"`
	NOps               int       `json:"n_ops"`
	NOpsFailed         int       `json:"n_ops_failed"`
	NTx                int       `json:"n_tx"`
	NDelegation        int       `json:"n_delegation"`
	NOrigination       int       `json:"n_origination"`
	TokenGenMin        int64     `json:"token_gen_min"`
	TokenGenMax        int64     `json:"token_gen_max"`
	BigMapIds          []int64   `json:"bigmap_ids"`
	// contains filtered or unexported fields
}

func NewExplorerContract

func NewExplorerContract(ctx *ApiContext, c *model.Contract, a *model.Account, p *chain.Params, details bool) *ExplorerContract

func (ExplorerContract) Expires

func (a ExplorerContract) Expires() time.Time

func (ExplorerContract) LastModified

func (a ExplorerContract) LastModified() time.Time

func (ExplorerContract) RESTPath

func (a ExplorerContract) RESTPath(r *mux.Router) string

func (ExplorerContract) RESTPrefix

func (a ExplorerContract) RESTPrefix() string

func (ExplorerContract) RegisterDirectRoutes

func (b ExplorerContract) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerContract) RegisterRoutes

func (b ExplorerContract) RegisterRoutes(r *mux.Router) error

type ExplorerCycle

type ExplorerCycle struct {
	Cycle       int64     `json:"cycle"`
	StartHeight int64     `json:"start_height"`
	EndHeight   int64     `json:"end_height"`
	StartTime   time.Time `json:"start_time"`
	EndTime     time.Time `json:"end_time"`
	Progress    float64   `json:"progress"`
	IsComplete  bool      `json:"is_complete"` // all blocks baked, cycle complete
	IsSnapshot  bool      `json:"is_snapshot"` // snapshot and rights for cycle N+7 exist
	IsActive    bool      `json:"is_active"`   // cycle is in progress

	// this cycle staking data (at snapshot block or last available block)
	SnapshotHeight int64     `json:"snapshot_height"` // -1 when no snapshot
	SnapshotIndex  int64     `json:"snapshot_index"`  // -1 when no snapshot
	SnapshotTime   time.Time `json:"snapshot_time"`   // zero when no snapshot
	Rolls          int64     `json:"rolls"`
	RollOwners     int64     `json:"roll_owners"`
	StakingSupply  float64   `json:"staking_supply"`
	StakingPercent float64   `json:"staking_percent"` // of total supply

	// health data across all blocks in cycle (empty for future cycles)
	ActiveBakers       int     `json:"active_bakers"`
	ActiveEndorsers    int     `json:"active_endorsers"` // from ops
	MissedPriorities   int     `json:"missed_priorities"`
	MissedEndorsements int     `json:"missed_endorsements"`
	N2Baking           int     `json:"n_double_baking"`
	N2Endorsement      int     `json:"n_double_endorsement"`
	NOrphans           int     `json:"n_orphans"`
	SolveTimeMin       int64   `json:"solvetime_min"`
	SolveTimeMax       int64   `json:"solvetime_max"`
	SolveTimeMean      float64 `json:"solvetime_mean"`
	PriorityMin        int64   `json:"priority_min"`
	PriorityMax        int64   `json:"priority_max"`
	PriorityMean       float64 `json:"priority_mean"`
	EndorsementRate    float64 `json:"endorsement_rate"`
	EndorsementsMin    int64   `json:"endorsements_min"`
	EndorsementsMax    int64   `json:"endorsements_max"`
	EndorsementsMean   float64 `json:"endorsements_mean"`
	SeedNonceRate      float64 `json:"seed_rate"` // from ops
	WorstBakedBlock    int64   `json:"worst_baked_block"`
	WorstEndorsedBlock int64   `json:"worst_endorsed_block"`

	// snapshot cycle who defined rights for this cycle
	SnapshotCycle *ExplorerCycle `json:"snapshot_cycle,omitempty"`

	// future cycle who's rights are defined by this cycle
	FollowerCycle *ExplorerCycle `json:"follower_cycle,omitempty"`
	// contains filtered or unexported fields
}

func NewExplorerCycle

func NewExplorerCycle(ctx *ApiContext, id int64) *ExplorerCycle

func (ExplorerCycle) Expires

func (c ExplorerCycle) Expires() time.Time

func (ExplorerCycle) LastModified

func (c ExplorerCycle) LastModified() time.Time

func (ExplorerCycle) RESTPath

func (c ExplorerCycle) RESTPath(r *mux.Router) string

func (ExplorerCycle) RESTPrefix

func (c ExplorerCycle) RESTPrefix() string

func (ExplorerCycle) RegisterDirectRoutes

func (c ExplorerCycle) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerCycle) RegisterRoutes

func (c ExplorerCycle) RegisterRoutes(r *mux.Router) error

type ExplorerElection

type ExplorerElection struct {
	Id                  int                    `json:"election_id"`
	NumPeriods          int                    `json:"num_periods"`
	NumProposals        int                    `json:"num_proposals"`
	StartTime           time.Time              `json:"start_time"`
	EndTime             time.Time              `json:"end_time"`
	StartHeight         int64                  `json:"start_height"`
	EndHeight           int64                  `json:"end_height"`
	IsEmpty             bool                   `json:"is_empty"`
	IsOpen              bool                   `json:"is_open"`
	IsFailed            bool                   `json:"is_failed"`
	NoQuorum            bool                   `json:"no_quorum"`
	NoMajority          bool                   `json:"no_majority"`
	NoProposal          bool                   `json:"no_proposal"`
	VotingPeriodKind    chain.VotingPeriodKind `json:"voting_period"`
	ProposalPeriod      *ExplorerVote          `json:"proposal"`
	TestingVotePeriod   *ExplorerVote          `json:"testing_vote"`
	TestingPeriod       *ExplorerVote          `json:"testing"`
	PromotionVotePeriod *ExplorerVote          `json:"promotion_vote"`
	// contains filtered or unexported fields
}

func NewExplorerElection

func NewExplorerElection(ctx *ApiContext, e *model.Election) *ExplorerElection

func (ExplorerElection) Expires

func (b ExplorerElection) Expires() time.Time

func (ExplorerElection) LastModified

func (b ExplorerElection) LastModified() time.Time

func (ExplorerElection) RESTPath

func (b ExplorerElection) RESTPath(r *mux.Router) string

func (ExplorerElection) RESTPrefix

func (b ExplorerElection) RESTPrefix() string

func (ExplorerElection) RegisterDirectRoutes

func (b ExplorerElection) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerElection) RegisterRoutes

func (b ExplorerElection) RegisterRoutes(r *mux.Router) error

type ExplorerListRequest

type ExplorerListRequest struct {
	Limit  uint `schema:"limit"`
	Offset uint `schema:"offset"`
}

generic list request

type ExplorerOp

type ExplorerOp struct {
	Hash         chain.OperationHash       `json:"hash"`
	Type         chain.OpType              `json:"type"`
	BlockHash    chain.BlockHash           `json:"block"`
	Timestamp    time.Time                 `json:"time"`
	Height       int64                     `json:"height"`
	Cycle        int64                     `json:"cycle"`
	Counter      int64                     `json:"counter"`
	OpN          int                       `json:"op_n"`
	OpC          int                       `json:"op_c"`
	OpI          int                       `json:"op_i"`
	Status       string                    `json:"status"`
	IsSuccess    bool                      `json:"is_success"`
	IsContract   bool                      `json:"is_contract"`
	GasLimit     int64                     `json:"gas_limit"`
	GasUsed      int64                     `json:"gas_used"`
	GasPrice     float64                   `json:"gas_price"`
	StorageLimit int64                     `json:"storage_limit"`
	StorageSize  int64                     `json:"storage_size"`
	StoragePaid  int64                     `json:"storage_paid"`
	Volume       float64                   `json:"volume"`
	Fee          float64                   `json:"fee"`
	Reward       float64                   `json:"reward"`
	Deposit      float64                   `json:"deposit"`
	Burned       float64                   `json:"burned"`
	IsInternal   bool                      `json:"is_internal"`
	HasData      bool                      `json:"has_data"`
	TDD          float64                   `json:"days_destroyed"`
	Data         json.RawMessage           `json:"data,omitempty"`
	Errors       json.RawMessage           `json:"errors,omitempty"`
	Parameters   *ExplorerParameters       `json:"parameters,omitempty"`
	Storage      *ExplorerStorageValue     `json:"storage,omitempty"`
	BigMapDiff   *ExplorerBigMapUpdateList `json:"big_map_diff,omitempty"`
	Sender       *chain.Address            `json:"sender,omitempty"`
	Receiver     *chain.Address            `json:"receiver,omitempty"`
	Manager      *chain.Address            `json:"manager,omitempty"`
	Delegate     *chain.Address            `json:"delegate,omitempty"`
	BranchId     uint64                    `json:"branch_id"`
	BranchHeight int64                     `json:"branch_height"`
	BranchDepth  int64                     `json:"branch_depth"`
	BranchHash   chain.BlockHash           `json:"branch"`
	// contains filtered or unexported fields
}

func NewExplorerOp

func NewExplorerOp(ctx *ApiContext, op *model.Op, block *model.Block, cc *model.Contract, p *chain.Params, args *ContractRequest) *ExplorerOp

func (ExplorerOp) Expires

func (t ExplorerOp) Expires() time.Time

func (ExplorerOp) LastModified

func (t ExplorerOp) LastModified() time.Time

func (ExplorerOp) RESTPath

func (t ExplorerOp) RESTPath(r *mux.Router) string

func (ExplorerOp) RESTPrefix

func (t ExplorerOp) RESTPrefix() string

func (ExplorerOp) RegisterDirectRoutes

func (t ExplorerOp) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerOp) RegisterRoutes

func (t ExplorerOp) RegisterRoutes(r *mux.Router) error

type ExplorerOpList

type ExplorerOpList []*ExplorerOp

func (ExplorerOpList) Expires

func (t ExplorerOpList) Expires() time.Time

func (ExplorerOpList) LastModified

func (t ExplorerOpList) LastModified() time.Time

func (ExplorerOpList) RESTPath

func (t ExplorerOpList) RESTPath(r *mux.Router) string

func (ExplorerOpList) RESTPrefix

func (t ExplorerOpList) RESTPrefix() string

func (ExplorerOpList) RegisterDirectRoutes

func (t ExplorerOpList) RegisterDirectRoutes(r *mux.Router) error

func (ExplorerOpList) RegisterRoutes

func (t ExplorerOpList) RegisterRoutes(r *mux.Router) error

type ExplorerOpsRequest

type ExplorerOpsRequest struct {
	ExplorerListRequest
	Type  chain.OpType   `schema:"type"`
	Order pack.OrderType `schema:"order"`
	Block string         `schema:"block"` // height or hash for time-lock
	Since string         `schema:"since"` // block hash or height for updates

	// decoded values
	BlockHeight int64           `schema:"-"`
	BlockHash   chain.BlockHash `schema:"-"`
	SinceHeight int64           `schema:"-"`
	SinceHash   chain.BlockHash `schema:"-"`
}

used when listing ops in block/account/contract context

func (*ExplorerOpsRequest) ParseBlockIdent

func (r *ExplorerOpsRequest) ParseBlockIdent(ctx *ApiContext)

type ExplorerParameters

type ExplorerParameters struct {
	Entrypoint    string                 `json:"entrypoint"`
	Branch        string                 `json:"branch"`
	Id            int                    `json:"id"`
	Value         *micheline.BigMapValue `json:"value,omitempty"`
	ValueUnpacked *micheline.BigMapValue `json:"value_unpacked,omitempty"`
	Prim          *micheline.Prim        `json:"prim,omitempty"`
}

params

type ExplorerProposal

type ExplorerProposal struct {
	Hash          chain.ProtocolHash  `json:"hash"`
	SourceAddress chain.Address       `json:"source"`
	BlockHash     chain.BlockHash     `json:"block_hash"`
	OpHash        chain.OperationHash `json:"op_hash"`
	Height        int64               `json:"height"`
	Time          time.Time           `json:"time"`
	Rolls         int64               `json:"rolls"`
	Voters        int64               `json:"voters"`
}

func NewExplorerProposal

func NewExplorerProposal(ctx *ApiContext, p *model.Proposal) *ExplorerProposal

type ExplorerScript

type ExplorerScript struct {
	Script      *micheline.Script     `json:"script,omitempty"`
	Type        micheline.BigMapType  `json:"storage_type"`
	Entrypoints micheline.Entrypoints `json:"entrypoints"`
	// contains filtered or unexported fields
}

func (ExplorerScript) Expires

func (s ExplorerScript) Expires() time.Time

func (ExplorerScript) LastModified

func (s ExplorerScript) LastModified() time.Time

type ExplorerStorageMeta

type ExplorerStorageMeta struct {
	Contract string          `json:"contract"`
	Time     time.Time       `json:"time"`
	Height   int64           `json:"height"`
	Block    chain.BlockHash `json:"block"`
}

storage metadata

type ExplorerStorageValue

type ExplorerStorageValue struct {
	Meta          ExplorerStorageMeta    `json:"meta"`
	Value         *micheline.BigMapValue `json:"value"`
	ValueUnpacked *micheline.BigMapValue `json:"value_unpacked,omitempty"`
	Prim          *micheline.Prim        `json:"prim,omitempty"`
	// contains filtered or unexported fields
}

storage

func (ExplorerStorageValue) Expires

func (t ExplorerStorageValue) Expires() time.Time

func (ExplorerStorageValue) LastModified

func (t ExplorerStorageValue) LastModified() time.Time

type ExplorerVote

type ExplorerVote struct {
	VotingPeriod     int64                  `json:"voting_period"`
	VotingPeriodKind chain.VotingPeriodKind `json:"voting_period_kind"`
	StartTime        time.Time              `json:"period_start_time"`
	EndTime          time.Time              `json:"period_end_time"`
	StartHeight      int64                  `json:"period_start_block"`
	EndHeight        int64                  `json:"period_end_block"`
	EligibleRolls    int64                  `json:"eligible_rolls"`
	EligibleVoters   int64                  `json:"eligible_voters"`
	QuorumPct        int64                  `json:"quorum_pct"`
	QuorumRolls      int64                  `json:"quorum_rolls"`
	TurnoutRolls     int64                  `json:"turnout_rolls"`
	TurnoutVoters    int64                  `json:"turnout_voters"`
	TurnoutPct       int64                  `json:"turnout_pct"`
	TurnoutEma       int64                  `json:"turnout_ema"`
	YayRolls         int64                  `json:"yay_rolls"`
	YayVoters        int64                  `json:"yay_voters"`
	NayRolls         int64                  `json:"nay_rolls"`
	NayVoters        int64                  `json:"nay_voters"`
	PassRolls        int64                  `json:"pass_rolls"`
	PassVoters       int64                  `json:"pass_voters"`
	IsOpen           bool                   `json:"is_open"`
	IsFailed         bool                   `json:"is_failed"`
	IsDraw           bool                   `json:"is_draw"`
	NoProposal       bool                   `json:"no_proposal"`
	NoQuorum         bool                   `json:"no_quorum"`
	NoMajority       bool                   `json:"no_majority"`
	Proposals        []*ExplorerProposal    `json:"proposals"`
}

func NewExplorerVote

func NewExplorerVote(ctx *ApiContext, v *model.Vote) *ExplorerVote

type Flow

type Flow struct {
	model.Flow
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Flow) MarshalCSV

func (f *Flow) MarshalCSV() ([]string, error)

func (*Flow) MarshalJSON

func (f *Flow) MarshalJSON() ([]byte, error)

func (*Flow) MarshalJSONBrief

func (f *Flow) MarshalJSONBrief() ([]byte, error)

func (*Flow) MarshalJSONVerbose

func (f *Flow) MarshalJSONVerbose() ([]byte, error)

type FlowSeries

type FlowSeries struct {
	Timestamp time.Time `json:"time"`
	AmountIn  int64     `json:"amount_in"`
	AmountOut int64     `json:"amount_out"`
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*FlowSeries) Add

func (f *FlowSeries) Add(m *model.Flow)

func (*FlowSeries) MarshalCSV

func (f *FlowSeries) MarshalCSV() ([]string, error)

func (*FlowSeries) MarshalJSON

func (f *FlowSeries) MarshalJSON() ([]byte, error)

func (*FlowSeries) MarshalJSONBrief

func (f *FlowSeries) MarshalJSONBrief() ([]byte, error)

func (*FlowSeries) MarshalJSONVerbose

func (f *FlowSeries) MarshalJSONVerbose() ([]byte, error)

func (*FlowSeries) Reset

func (f *FlowSeries) Reset()

type HttpConfig

type HttpConfig struct {
	Addr                string        `json:"addr"`
	Port                int           `json:"port"`
	Scheme              string        `json:"scheme"`
	Host                string        `json:"host"`
	MaxWorkers          int           `json:"workers"`
	TimeoutHeader       string        `json:"timeout_header"`
	ReadTimeout         time.Duration `json:"read_timeout"`
	HeaderTimeout       time.Duration `json:"header_timeout"`
	WriteTimeout        time.Duration `json:"write_timeout"`
	KeepAlive           time.Duration `json:"keep_alive"`
	ShutdownTimeout     time.Duration `json:"shutdown_timeout"`
	DefaultListCount    uint          `json:"default_list_count"`
	MaxListCount        uint          `json:"max_list_count"`
	DefaultExploreCount uint          `json:"default_explore_count"`
	MaxExploreCount     uint          `json:"max_explore_count"`
	CorsEnable          bool          `json:"cors_enable"`
	CorsOrigin          string        `json:"cors_origin"`
	CorsAllowHeaders    string        `json:"cors_allow_headers"`
	CorsExposeHeaders   string        `json:"cors_expose_headers"`
	CorsMethods         string        `json:"cors_methods"`
	CorsMaxAge          string        `json:"cors_maxage"`
	CorsCredentials     string        `json:"cors_credentials"`
	CacheEnable         bool          `json:"cache_enable"`
	CacheControl        string        `json:"cache_control"`
}

HTTP Server Configuration

func NewHttpConfig

func NewHttpConfig() HttpConfig

func (HttpConfig) Address

func (c HttpConfig) Address() string

func (*HttpConfig) Check

func (cfg *HttpConfig) Check() error

type Income

type Income struct {
	model.Income
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Income) MarshalCSV

func (c *Income) MarshalCSV() ([]string, error)

func (*Income) MarshalJSON

func (r *Income) MarshalJSON() ([]byte, error)

func (*Income) MarshalJSONBrief

func (c *Income) MarshalJSONBrief() ([]byte, error)

func (*Income) MarshalJSONVerbose

func (c *Income) MarshalJSONVerbose() ([]byte, error)

type Op

type Op struct {
	model.Op
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Op) MarshalCSV

func (o *Op) MarshalCSV() ([]string, error)

func (*Op) MarshalJSON

func (o *Op) MarshalJSON() ([]byte, error)

func (*Op) MarshalJSONBrief

func (o *Op) MarshalJSONBrief() ([]byte, error)

func (*Op) MarshalJSONVerbose

func (o *Op) MarshalJSONVerbose() ([]byte, error)

type OpSeries

type OpSeries struct {
	Timestamp   time.Time `json:"time"`
	GasUsed     int64     `json:"gas_used"`
	StorageSize int64     `json:"storage_size"`
	StoragePaid int64     `json:"storage_paid"`
	Volume      int64     `json:"volume"`
	Fee         int64     `json:"fee"`
	Reward      int64     `json:"reward"`
	Deposit     int64     `json:"deposit"`
	Burned      int64     `json:"burned"`
	TDD         float64   `json:"days_destroyed"`
	// contains filtered or unexported fields
}

Only use fields that can be summed over time configurable marshalling helper

func (*OpSeries) Add

func (s *OpSeries) Add(o *model.Op)

func (*OpSeries) MarshalCSV

func (o *OpSeries) MarshalCSV() ([]string, error)

func (*OpSeries) MarshalJSON

func (s *OpSeries) MarshalJSON() ([]byte, error)

func (*OpSeries) MarshalJSONBrief

func (o *OpSeries) MarshalJSONBrief() ([]byte, error)

func (*OpSeries) MarshalJSONVerbose

func (o *OpSeries) MarshalJSONVerbose() ([]byte, error)

func (*OpSeries) Reset

func (s *OpSeries) Reset()

type PerformanceCounter

type PerformanceCounter struct {
	Runtime time.Duration
	// contains filtered or unexported fields
}

func NewPerformanceCounter

func NewPerformanceCounter(now time.Time) *PerformanceCounter

func (*PerformanceCounter) EndCall

func (p *PerformanceCounter) EndCall()

func (*PerformanceCounter) Since

func (p *PerformanceCounter) Since() time.Duration

func (*PerformanceCounter) StartCall

func (p *PerformanceCounter) StartCall(now time.Time)

func (*PerformanceCounter) WriteResponseHeader

func (p *PerformanceCounter) WriteResponseHeader(w http.ResponseWriter)

func (*PerformanceCounter) WriteResponseTrailer

func (p *PerformanceCounter) WriteResponseTrailer(w http.ResponseWriter)

type PingRequest

type PingRequest struct {
	Sequence  int64 `json:"sequence" schema:"sequence"`
	RequestAt int64 `json:"client_time" schema:"client_time"`
}

type Pinger

type Pinger struct {
	Sequence   int64 `json:"sequence"`
	RequestAt  int64 `json:"client_time"` // whatever client sends
	ResponseAt int64 `json:"server_time"` // unix nanosec
}

func (Pinger) Expires

func (p Pinger) Expires() time.Time

func (Pinger) LastModified

func (p Pinger) LastModified() time.Time

func (Pinger) RESTPath

func (p Pinger) RESTPath(r *mux.Router) string

func (Pinger) RESTPrefix

func (p Pinger) RESTPrefix() string

func (Pinger) RegisterDirectRoutes

func (p Pinger) RegisterDirectRoutes(r *mux.Router) error

func (Pinger) RegisterRoutes

func (p Pinger) RegisterRoutes(r *mux.Router) error

type Proposal

type Proposal struct {
	model.Proposal
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Proposal) MarshalCSV

func (p *Proposal) MarshalCSV() ([]string, error)

func (*Proposal) MarshalJSON

func (p *Proposal) MarshalJSON() ([]byte, error)

func (*Proposal) MarshalJSONBrief

func (p *Proposal) MarshalJSONBrief() ([]byte, error)

func (*Proposal) MarshalJSONVerbose

func (p *Proposal) MarshalJSONVerbose() ([]byte, error)

type RESTful

type RESTful interface {
	RESTPrefix() string
	RESTPath(r *mux.Router) string
	RegisterRoutes(r *mux.Router) error
	RegisterDirectRoutes(r *mux.Router) error
}

type Resource

type Resource interface {
	LastModified() time.Time
	Expires() time.Time
}

type RestServer

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

func New

func New(cfg *Config) (*RestServer, error)

func (*RestServer) IsShutdown

func (s *RestServer) IsShutdown() bool

func (*RestServer) Start

func (s *RestServer) Start()

func (*RestServer) Stop

func (s *RestServer) Stop()
type Right struct {
	model.Right
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Right) MarshalCSV

func (r *Right) MarshalCSV() ([]string, error)

func (*Right) MarshalJSON

func (r *Right) MarshalJSON() ([]byte, error)

func (*Right) MarshalJSONBrief

func (r *Right) MarshalJSONBrief() ([]byte, error)

func (*Right) MarshalJSONVerbose

func (r *Right) MarshalJSONVerbose() ([]byte, error)

func (*Right) Timestamp

func (r *Right) Timestamp() time.Time

func (*Right) TimestampMs

func (r *Right) TimestampMs() int64

type RollbackRequest

type RollbackRequest struct {
	Height int64 `schema:"height" json:"height"` // negative height is treated as offset
	Force  bool  `schema:"force"  json:"force"`  // ignore errors
}

type SeriesRequest

type SeriesRequest struct {
	Series   string          `schema:"-"`
	Columns  util.StringList `schema:"columns"`
	Collapse util.Duration   `schema:"collapse"`
	From     util.Time       `schema:"start_date"`
	To       util.Time       `schema:"end_date"`
	Limit    uint            `schema:"limit"`
	Verbose  bool            `schema:"verbose"`
	Format   string          `schema:"-"`     // from URL
	Order    pack.OrderType  `schema:"order"` // asc/desc
}

build packdb query from request

func (SeriesRequest) Expires

func (t SeriesRequest) Expires() time.Time

func (SeriesRequest) LastModified

func (t SeriesRequest) LastModified() time.Time

func (*SeriesRequest) Parse

func (r *SeriesRequest) Parse(ctx *ApiContext)

func (SeriesRequest) RESTPath

func (t SeriesRequest) RESTPath(r *mux.Router) string

func (SeriesRequest) RESTPrefix

func (t SeriesRequest) RESTPrefix() string

func (SeriesRequest) RegisterDirectRoutes

func (t SeriesRequest) RegisterDirectRoutes(r *mux.Router) error

func (SeriesRequest) RegisterRoutes

func (t SeriesRequest) RegisterRoutes(r *mux.Router) error

type Snapshot

type Snapshot struct {
	model.Snapshot
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Snapshot) MarshalCSV

func (s *Snapshot) MarshalCSV() ([]string, error)

func (*Snapshot) MarshalJSON

func (s *Snapshot) MarshalJSON() ([]byte, error)

func (*Snapshot) MarshalJSONBrief

func (s *Snapshot) MarshalJSONBrief() ([]byte, error)

func (*Snapshot) MarshalJSONVerbose

func (s *Snapshot) MarshalJSONVerbose() ([]byte, error)

type Supply

type Supply struct {
	model.Supply
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Supply) MarshalCSV

func (s *Supply) MarshalCSV() ([]string, error)

func (*Supply) MarshalJSON

func (s *Supply) MarshalJSON() ([]byte, error)

func (*Supply) MarshalJSONBrief

func (s *Supply) MarshalJSONBrief() ([]byte, error)

func (*Supply) MarshalJSONVerbose

func (s *Supply) MarshalJSONVerbose() ([]byte, error)

type SystemRequest

type SystemRequest struct{}

func (SystemRequest) Expires

func (t SystemRequest) Expires() time.Time

func (SystemRequest) LastModified

func (t SystemRequest) LastModified() time.Time

func (SystemRequest) RESTPath

func (t SystemRequest) RESTPath(r *mux.Router) string

func (SystemRequest) RESTPrefix

func (t SystemRequest) RESTPrefix() string

func (SystemRequest) RegisterDirectRoutes

func (t SystemRequest) RegisterDirectRoutes(r *mux.Router) error

func (SystemRequest) RegisterRoutes

func (t SystemRequest) RegisterRoutes(r *mux.Router) error

type TableRequest

type TableRequest struct {
	Table   string          `schema:"-"`
	Columns util.StringList `schema:"columns"`
	Limit   uint            `schema:"limit"`
	Cursor  string          `schema:"cursor"`
	Format  string          `schema:"-"`     // from URL
	Order   pack.OrderType  `schema:"order"` // asc/desc
	Verbose bool            `schema:"verbose"`
}

build packdb query from request

func (TableRequest) Expires

func (t TableRequest) Expires() time.Time

func (TableRequest) LastModified

func (t TableRequest) LastModified() time.Time

func (*TableRequest) Parse

func (t *TableRequest) Parse(ctx *ApiContext)

func (TableRequest) RESTPath

func (t TableRequest) RESTPath(r *mux.Router) string

func (TableRequest) RESTPrefix

func (t TableRequest) RESTPrefix() string

func (TableRequest) RegisterDirectRoutes

func (t TableRequest) RegisterDirectRoutes(r *mux.Router) error

func (TableRequest) RegisterRoutes

func (t TableRequest) RegisterRoutes(r *mux.Router) error

type Vote

type Vote struct {
	model.Vote
	// contains filtered or unexported fields
}

configurable marshalling helper

func (*Vote) MarshalCSV

func (v *Vote) MarshalCSV() ([]string, error)

func (*Vote) MarshalJSON

func (v *Vote) MarshalJSON() ([]byte, error)

func (*Vote) MarshalJSONBrief

func (v *Vote) MarshalJSONBrief() ([]byte, error)

func (*Vote) MarshalJSONVerbose

func (v *Vote) MarshalJSONVerbose() ([]byte, error)

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier