rpc

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 18 Imported by: 15

Documentation

Index

Constants

View Source
const (
	// ErrorKindPermanent Tezos RPC error kind.
	ErrorKindPermanent = "permanent"
	// ErrorKindTemporary Tezos RPC error kind.
	ErrorKindTemporary = "temporary"
	// ErrorKindBranch Tezos RPC error kind.
	ErrorKindBranch = "branch"
)
View Source
const (
	MAIN_NET = "main"
)

Variables

View Source
var ErrMonitorClosed = errors.New("monitor closed")

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func ErrorStatus

func ErrorStatus(err error) int

func UseLogger

func UseLogger(logger logpkg.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using logpkg.

Types

type AccountActivationOp

type AccountActivationOp struct {
	GenericOp
	Pkh      tezos.Address                `json:"pkh"`
	Secret   HexBytes                     `json:"secret"`
	Metadata *AccountActivationOpMetadata `json:"metadata"`
}

AccountActivationOp represents a transaction operation

type AccountActivationOpMetadata

type AccountActivationOpMetadata struct {
	BalanceUpdates BalanceUpdates `json:"balance_updates"` // initial funding
}

AccountActivationOpMetadata represents a transaction operation metadata

type BakingRight

type BakingRight struct {
	Delegate      tezos.Address `json:"delegate"`
	Level         int64         `json:"level"`
	Priority      int           `json:"priority"`
	EstimatedTime time.Time     `json:"estimated_time"`
}

BakingRight holds information about the right to bake a specific Tezos block

func (BakingRight) Address

func (r BakingRight) Address() tezos.Address

type BalanceUpdate

type BalanceUpdate interface {
	BalanceUpdateKind() string
	Address() tezos.Address
	Amount() int64
}

BalanceUpdate is a variable structure depending on the Kind field

type BalanceUpdates

type BalanceUpdates []BalanceUpdate

BalanceUpdates is a list of balance update operations

func (*BalanceUpdates) UnmarshalJSON

func (b *BalanceUpdates) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Ballot

type Ballot struct {
	Delegate tezos.Address    `json:"pkh"`
	Ballot   tezos.BallotVote `json:"ballot"`
}

Ballot holds information about a vote listing

type BallotList

type BallotList []Ballot

BallotList contains a list of voters

type BallotOp

type BallotOp struct {
	GenericOp
	Source   tezos.Address      `json:"source"`
	Period   int                `json:"period"`
	Ballot   tezos.BallotVote   `json:"ballot"` // yay, nay, pass
	Proposal tezos.ProtocolHash `json:"proposal"`
	Metadata json.RawMessage    `json:"metadata"` // missing example
}

BallotOp represents a ballot operation

type BallotSummary

type BallotSummary struct {
	Yay  int `json:"yay"`
	Nay  int `json:"nay"`
	Pass int `json:"pass"`
}

Ballots holds the current summary of a vote

type BigmapInfo

type BigmapInfo struct {
	KeyType    micheline.Prim `json:"key_type"`
	ValueType  micheline.Prim `json:"value_type"`
	TotalBytes int64          `json:"total_bytes,string"`
}

type Block

type Block struct {
	Protocol   tezos.ProtocolHash   `json:"protocol"`
	ChainId    tezos.ChainIdHash    `json:"chain_id"`
	Hash       tezos.BlockHash      `json:"hash"`
	Header     BlockHeader          `json:"header"`
	Metadata   BlockMetadata        `json:"metadata"`
	Operations [][]*OperationHeader `json:"operations"`
}

Block holds information about a Tezos block

func (Block) GetCycle

func (b Block) GetCycle() int64

func (Block) GetLevel

func (b Block) GetLevel() int64

func (Block) GetTimestamp

func (b Block) GetTimestamp() time.Time

func (Block) GetVersion

func (b Block) GetVersion() int

func (Block) GetVotingPeriod

func (b Block) GetVotingPeriod() int64

func (Block) GetVotingPeriodKind

func (b Block) GetVotingPeriodKind() tezos.VotingPeriodKind

func (*Block) LogEntry

func (b *Block) LogEntry() *BlockHeaderLogEntry

type BlockContent

type BlockContent struct {
	Command    string             `json:"command"`
	Protocol   tezos.ProtocolHash `json:"hash"`
	Fitness    []HexBytes         `json:"fitness"`
	Parameters *GenesisData       `json:"protocol_parameters"`
}

BlockContent is part of block 1 header that seeds the initial context

type BlockHeader

type BlockHeader struct {
	ChainId          *tezos.ChainIdHash  `json:"chain_id,omitempty"`
	Hash             *tezos.BlockHash    `json:"hash,omitempty"`
	Level            int64               `json:"level"`
	Proto            int                 `json:"proto"`
	Predecessor      tezos.BlockHash     `json:"predecessor"`
	Timestamp        time.Time           `json:"timestamp"`
	ValidationPass   int                 `json:"validation_pass"`
	OperationsHash   string              `json:"operations_hash"`
	Fitness          []HexBytes          `json:"fitness"`
	Context          string              `json:"context"`
	Priority         int                 `json:"priority"`
	ProofOfWorkNonce HexBytes            `json:"proof_of_work_nonce"`
	SeedNonceHash    *tezos.NonceHash    `json:"seed_nonce_hash"`
	Signature        string              `json:"signature"`
	Content          *BlockContent       `json:"content,omitempty"`
	Protocol         *tezos.ProtocolHash `json:"protocol,omitempty"`
}

BlockHeader is a part of the Tezos block data

type BlockHeaderLogEntry

type BlockHeaderLogEntry struct {
	Hash           tezos.BlockHash `json:"hash"`
	Level          int64           `json:"level"`
	Proto          int             `json:"proto"`
	Predecessor    tezos.BlockHash `json:"predecessor"`
	Timestamp      time.Time       `json:"timestamp"`
	ValidationPass int             `json:"validation_pass"`
	OperationsHash string          `json:"operations_hash"`
	Fitness        []HexBytes      `json:"fitness"`
	Context        string          `json:"context"`
	ProtocolData   HexBytes        `json:"protocol_data"`
}

BlockHeaderLogEntry is a log entry returned for a new block when monitoring

type BlockHeaderMonitor

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

func NewBlockHeaderMonitor

func NewBlockHeaderMonitor() *BlockHeaderMonitor

func (*BlockHeaderMonitor) Close

func (m *BlockHeaderMonitor) Close()

func (*BlockHeaderMonitor) Closed

func (m *BlockHeaderMonitor) Closed() <-chan struct{}

func (*BlockHeaderMonitor) Err

func (m *BlockHeaderMonitor) Err(err error)

func (*BlockHeaderMonitor) New

func (m *BlockHeaderMonitor) New() interface{}

func (*BlockHeaderMonitor) Recv

func (*BlockHeaderMonitor) Send

func (m *BlockHeaderMonitor) Send(ctx context.Context, val interface{})

type BlockLevel

type BlockLevel struct {
	Level              int64 `json:"level"`
	LevelPosition      int64 `json:"level_position"`
	Cycle              int64 `json:"cycle"`
	CyclePosition      int64 `json:"cycle_position"`
	ExpectedCommitment bool  `json:"expected_commitment"`

	// deprecated in v008
	VotingPeriod         int64 `json:"voting_period"`
	VotingPeriodPosition int64 `json:"voting_period_position"`
}

BlockLevel is a part of BlockMetadata

type BlockMetadata

type BlockMetadata struct {
	Protocol               tezos.ProtocolHash     `json:"protocol"`
	NextProtocol           tezos.ProtocolHash     `json:"next_protocol"`
	MaxOperationsTTL       int                    `json:"max_operations_ttl"`
	MaxOperationDataLength int                    `json:"max_operation_data_length"`
	MaxBlockHeaderLength   int                    `json:"max_block_header_length"`
	MaxOperationListLength []*OperationListLength `json:"max_operation_list_length"`
	Baker                  tezos.Address          `json:"baker"`
	NonceHash              *tezos.NonceHash       `json:"nonce_hash"`
	ConsumedGas            int64                  `json:"consumed_gas,string"`
	Deactivated            []tezos.Address        `json:"deactivated"`
	BalanceUpdates         BalanceUpdates         `json:"balance_updates"`

	// deprecated in v008
	Level            *BlockLevel             `json:"level"`
	VotingPeriodKind *tezos.VotingPeriodKind `json:"voting_period_kind"`

	// v008
	LevelInfo        *BlockLevel       `json:"level_info"`
	VotingPeriodInfo *VotingPeriodInfo `json:"voting_period_info"`
}

BlockMetadata is a part of the Tezos block data

type BootstrapMonitor

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

func NewBootstrapMonitor

func NewBootstrapMonitor() *BootstrapMonitor

func (*BootstrapMonitor) Close

func (m *BootstrapMonitor) Close()

func (*BootstrapMonitor) Closed

func (m *BootstrapMonitor) Closed() <-chan struct{}

func (*BootstrapMonitor) Err

func (m *BootstrapMonitor) Err(err error)

func (*BootstrapMonitor) New

func (m *BootstrapMonitor) New() interface{}

func (*BootstrapMonitor) Recv

func (*BootstrapMonitor) Send

func (m *BootstrapMonitor) Send(ctx context.Context, val interface{})

type BootstrappedBlock

type BootstrappedBlock struct {
	Block     tezos.BlockHash `json:"block"`
	Timestamp time.Time       `json:"timestamp"`
}

BootstrappedBlock represents bootstrapped block stream message

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL
	// User agent name for client.
	UserAgent string
	// The chain the client will query.
	ChainID string
	// contains filtered or unexported fields
}

Client manages communication with a Tezos RPC server.

func NewClient

func NewClient(baseURL string, httpClient *http.Client) (*Client, error)

NewClient returns a new Tezos RPC client.

func (*Client) BanNetworkPeer

func (c *Client) BanNetworkPeer(ctx context.Context, peerID string) error

BanNetworkPeer blacklists the given peer. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id-ban

func (*Client) BanNetworkPoint

func (c *Client) BanNetworkPoint(ctx context.Context, address string) error

BanNetworkPoint blacklists the given address. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-points-point-ban

func (*Client) ConnectToNetworkPoint

func (c *Client) ConnectToNetworkPoint(ctx context.Context, address string, timeout time.Duration) error

ConnectToNetworkPoint used to connect to a peer. https://tezos.gitlab.io/mainnet/api/rpc.html#put-network-points-point

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (err error)

Do retrieves values from the API and marshals them into the provided interface.

func (*Client) DoAsync

func (c *Client) DoAsync(req *http.Request, mon Monitor) (err error)

DoAsync retrieves values from the API and sends responses using the provided monitor.

func (*Client) Get

func (c *Client) Get(ctx context.Context, urlpath string, result interface{}) error

func (*Client) GetAsync

func (c *Client) GetAsync(ctx context.Context, urlpath string, mon Monitor) error

func (*Client) GetBakingRights

func (c *Client) GetBakingRights(ctx context.Context, blockID tezos.BlockHash) ([]BakingRight, error)

GetBakingRights returns information about a Tezos block baking rights https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-helpers-baking-rights

func (*Client) GetBakingRightsCycle

func (c *Client) GetBakingRightsCycle(ctx context.Context, height, cycle int64) ([]BakingRight, error)

GetBakingRightsCycle returns information about a Tezos baking rights for an entire cycle. https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-helpers-baking-rights

func (*Client) GetBakingRightsHeight

func (c *Client) GetBakingRightsHeight(ctx context.Context, height int64) ([]BakingRight, error)

GetBakingRightsHeight returns information about a Tezos block baking rights https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-helpers-baking-rights

func (*Client) GetBigmapInfo

func (c *Client) GetBigmapInfo(ctx context.Context, id int64) (*BigmapInfo, error)

GetBigmapInfo returns type and content info from bigmap id

func (*Client) GetBigmapKeys

func (c *Client) GetBigmapKeys(ctx context.Context, id int64) ([]tezos.ExprHash, error)

GetBigmapKeys returns all active keys in the bigmap id

func (*Client) GetBigmapValue

func (c *Client) GetBigmapValue(ctx context.Context, id int64, hash tezos.ExprHash) (micheline.Prim, error)

GetBigmapValue returns current active value at key hash from bigmap id

func (*Client) GetBigmapValueHeight

func (c *Client) GetBigmapValueHeight(ctx context.Context, id int64, hash tezos.ExprHash, height int64) (micheline.Prim, error)

GetBigmapValueHeight returns a value from bigmap id at key hash that was active at height

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, blockID tezos.BlockHash) (*Block, error)

GetBlock returns information about a Tezos block https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id

func (*Client) GetBlockHeader

func (c *Client) GetBlockHeader(ctx context.Context, height int64) (*BlockHeader, error)

GetBlockHeader returns the main chain's block header at height. https://tezos.gitlab.io/mainnet/api/rpc.html#chains-chain-id-blocks

func (*Client) GetBlockHeight

func (c *Client) GetBlockHeight(ctx context.Context, height int64) (*Block, error)

GetBlockHeight returns information about a Tezos block https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id

func (*Client) GetBlockPredHashes

func (c *Client) GetBlockPredHashes(ctx context.Context, blockID tezos.BlockHash, count int) ([]tezos.BlockHash, error)

GetBlockPredHashes returns the block id's (hashes) of count preceeding blocks. https://tezos.gitlab.io/mainnet/api/rpc.html#get-chains-chain-id-blocks

func (*Client) GetConstants

func (c *Client) GetConstants(ctx context.Context, blockID tezos.BlockHash) (Constants, error)

GetConstants returns chain configuration constants at a block hash https://tezos.gitlab.io/tezos/api/rpc.html#get-block-id-context-constants

func (*Client) GetConstantsHeight

func (c *Client) GetConstantsHeight(ctx context.Context, height int64) (Constants, error)

GetConstantsHeight returns chain configuration constants at a block height https://tezos.gitlab.io/tezos/api/rpc.html#get-block-id-context-constants

func (*Client) GetContractBalance

func (c *Client) GetContractBalance(ctx context.Context, addr tezos.Address) (int64, error)

GetContractBalance returns the current balance of a contract at head https://tezos.gitlab.io/tezos/api/rpc.html#get-block-id-context-contracts-contract-id-balance

func (*Client) GetContractBalanceHeight

func (c *Client) GetContractBalanceHeight(ctx context.Context, addr tezos.Address, height int64) (int64, error)

GetContractBalanceHeight returns the current balance of a contract at height https://tezos.gitlab.io/tezos/api/rpc.html#get-block-id-context-contracts-contract-id-balance

func (*Client) GetContractEntrypoints

func (c *Client) GetContractEntrypoints(ctx context.Context, addr tezos.Address) (map[string]micheline.Prim, error)

GetContractEntrypoints returns the contract's storage at height

func (*Client) GetContractScript

func (c *Client) GetContractScript(ctx context.Context, addr tezos.Address) (*micheline.Script, error)

GetContractScript returns the originated contract script

func (*Client) GetContractStorage

func (c *Client) GetContractStorage(ctx context.Context, addr tezos.Address) (micheline.Prim, error)

GetContractStorage returns the most recent version of the contract's storage

func (*Client) GetContractStorageHeight

func (c *Client) GetContractStorageHeight(ctx context.Context, addr tezos.Address, height int64) (micheline.Prim, error)

GetContractStorage returns the contract's storage at height

func (*Client) GetContracts

func (c *Client) GetContracts(ctx context.Context) (Contracts, error)

GetContracts returns a list of all known contracts at head https://tezos.gitlab.io/tezos/api/rpc.html#get-block-id-context-contracts

func (*Client) GetContractsHeight

func (c *Client) GetContractsHeight(ctx context.Context, height int64) (Contracts, error)

GetContractsHeight returns a list of all known contracts at height https://tezos.gitlab.io/tezos/api/rpc.html#get-block-id-context-contracts

func (*Client) GetDelegateBalance

func (c *Client) GetDelegateBalance(ctx context.Context, addr tezos.Address) (int64, error)

GetDelegateBalance returns a delegate's balance http://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-context-delegates-pkh-balance

func (*Client) GetDelegateStatus

func (c *Client) GetDelegateStatus(ctx context.Context, addr tezos.Address, height int64) (*Delegate, error)

GetDelegateStatus returns information about a delegate at a specific height https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-context-delegates-pkh

func (*Client) GetEndorsingRights

func (c *Client) GetEndorsingRights(ctx context.Context, blockID tezos.BlockHash) ([]EndorsingRight, error)

GetEndorsingRights returns information about a Tezos block endorsing rights https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-helpers-endorsing-rights

func (*Client) GetEndorsingRightsCycle

func (c *Client) GetEndorsingRightsCycle(ctx context.Context, height, cycle int64) ([]EndorsingRight, error)

GetEndorsingRightsCycle returns information about a Tezos endorsing rights for an entire cycle https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-helpers-endorsing-rights

func (*Client) GetEndorsingRightsHeight

func (c *Client) GetEndorsingRightsHeight(ctx context.Context, height int64) ([]EndorsingRight, error)

GetEndorsingRightsHeight returns information about a Tezos block endorsing rights https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-helpers-endorsing-rights

func (*Client) GetInvalidBlock

func (c *Client) GetInvalidBlock(ctx context.Context, blockID tezos.BlockHash) (*InvalidBlock, error)

GetInvalidBlock returns a single invalid block with the errors that led to it being declared invalid. https://tezos.gitlab.io/mainnet/api/rpc.html#get-chains-chain-id-invalid-blocks-block-hash

func (*Client) GetInvalidBlocks

func (c *Client) GetInvalidBlocks(ctx context.Context) ([]*InvalidBlock, error)

GetInvalidBlocks lists blocks that have been declared invalid along with the errors that led to them being declared invalid. https://tezos.gitlab.io/mainnet/api/rpc.html#get-chains-chain-id-invalid-blocks

func (*Client) GetMempoolPendingOperations

func (c *Client) GetMempoolPendingOperations(ctx context.Context) (*MempoolOperations, error)

GetMempoolPendingOperations returns mempool pending operations

func (*Client) GetNetworkConnections

func (c *Client) GetNetworkConnections(ctx context.Context) ([]*NetworkConnection, error)

GetNetworkConnections returns all network connections http://tezos.gitlab.io/mainnet/api/rpc.html#get-network-connections

func (*Client) GetNetworkPeer

func (c *Client) GetNetworkPeer(ctx context.Context, peerID string) (*NetworkPeer, error)

GetNetworkPeer returns details about a given peer. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id

func (*Client) GetNetworkPeerBanned

func (c *Client) GetNetworkPeerBanned(ctx context.Context, peerID string) (bool, error)

GetNetworkPeerBanned checks if a given peer is blacklisted or greylisted. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id-banned

func (*Client) GetNetworkPeerLog

func (c *Client) GetNetworkPeerLog(ctx context.Context, peerID string) ([]*NetworkPeerLogEntry, error)

GetNetworkPeerLog monitors network events related to a given peer. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id-log

func (*Client) GetNetworkPeers

func (c *Client) GetNetworkPeers(ctx context.Context, filter string) ([]*NetworkPeer, error)

GetNetworkPeers returns the list the peers the node ever met. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers

func (*Client) GetNetworkPoint

func (c *Client) GetNetworkPoint(ctx context.Context, address string) (*NetworkPoint, error)

GetNetworkPoint returns details about a given `IP:addr`. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-points-point

func (*Client) GetNetworkPointBanned

func (c *Client) GetNetworkPointBanned(ctx context.Context, address string) (bool, error)

GetNetworkPointBanned check is a given address is blacklisted or greylisted. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-points-point-banned

func (*Client) GetNetworkPointLog

func (c *Client) GetNetworkPointLog(ctx context.Context, address string) ([]*NetworkPointLogEntry, error)

GetNetworkPointLog monitors network events related to an `IP:addr`. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id-log

func (*Client) GetNetworkPoints

func (c *Client) GetNetworkPoints(ctx context.Context, filter string) ([]*NetworkPoint, error)

GetNetworkPoints returns list the pool of known `IP:port` used for establishing P2P connections. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-points

func (*Client) GetNetworkStats

func (c *Client) GetNetworkStats(ctx context.Context) (*NetworkStats, error)

GetNetworkStats returns current network stats https://tezos.gitlab.io/betanet/api/rpc.html#get-network-stat

func (*Client) GetParamsByHeight

func (c *Client) GetParamsByHeight(ctx context.Context, height int64) (*tezos.Params, error)

GetParamsByHeight returns a translated parameters structure for the current network

func (*Client) GetSnapshotIndexCycle

func (c *Client) GetSnapshotIndexCycle(ctx context.Context, height, cycle int64) (*SnapshotIndex, error)

GetSnapshotIndexCycle returns information about a Tezos roll snapshot https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-helpers-endorsing-rights

func (*Client) GetSnapshotRollOwners

func (c *Client) GetSnapshotRollOwners(ctx context.Context, height, cycle, index int64) (*SnapshotOwners, error)

GetSnapshotRollOwners returns information about a Tezos roll snapshot ownership [[0,"p2pk67wVncLFS1DQDm2gVR45sYCzQSXTtqn3bviNYXVCq6WRoqtxHXL"]]

roll - baker pubkey

/chains/main/blocks/901121/context/raw/json/rolls/owner/snapshot/220/15/?depth=1

func (*Client) GetTipHeader

func (c *Client) GetTipHeader(ctx context.Context) (*BlockHeader, error)

GetTipHeader returns main chain tip's block header. https://tezos.gitlab.io/mainnet/api/rpc.html#chains-chain-id-blocks

func (*Client) GetTips

func (c *Client) GetTips(ctx context.Context, depth int, head tezos.BlockHash) ([][]tezos.BlockHash, error)

GetTips returns hashes of the current chain tip blocks, first in the array is the current main chain. https://tezos.gitlab.io/mainnet/api/rpc.html#chains-chain-id-blocks

func (*Client) GetVoteProposal

func (c *Client) GetVoteProposal(ctx context.Context, height int64) (tezos.ProtocolHash, error)

GetVoteProposal returns the hash of the current voring proposal at a specific height https://tezos.gitlab.io/api/rpc.html#rpcs-full-description

func (*Client) GetVoteQuorum

func (c *Client) GetVoteQuorum(ctx context.Context, height int64) (int, error)

GetVoteQuorum returns information about the current voring quorum at a specific height Returned value is percent * 10000 i.e. 5820 for 58.20% https://tezos.gitlab.io/api/rpc.html#rpcs-full-description

func (*Client) GetVoteResult

func (c *Client) GetVoteResult(ctx context.Context, height int64) (BallotSummary, error)

GetVoteResult returns a summary of the current voting result at a specific height https://tezos.gitlab.io/api/rpc.html#rpcs-full-description

func (*Client) ListActiveDelegates

func (c *Client) ListActiveDelegates(ctx context.Context, height int64) (DelegateList, error)

ListActiveDelegates returns information about all active delegates at a block https://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-context-delegates

func (*Client) ListBallots

func (c *Client) ListBallots(ctx context.Context, height int64) (BallotList, error)

ListBallots returns information about all eligible voters for an election https://tezos.gitlab.io/api/rpc.html#rpcs-full-description

func (*Client) ListProposals

func (c *Client) ListProposals(ctx context.Context, height int64) (ProposalList, error)

ListProposals returns a list of all submitted proposals and their upvote count This call only returns results when height is within a proposal vote period. https://tezos.gitlab.io/api/rpc.html#rpcs-full-description

func (*Client) ListVoters

func (c *Client) ListVoters(ctx context.Context, height int64) (VoterList, error)

ListVoters returns information about all eligible voters for an election https://tezos.gitlab.io/api/rpc.html#rpcs-full-description

func (*Client) MonitorBlockHeader

func (c *Client) MonitorBlockHeader(ctx context.Context, monitor *BlockHeaderMonitor) error

MonitorBlockHeader reads from the chain heads stream http://tezos.gitlab.io/mainnet/api/rpc.html#get-monitor-heads-chain-id

func (*Client) MonitorBootstrapped

func (c *Client) MonitorBootstrapped(ctx context.Context, monitor *BootstrapMonitor) error

MonitorBootstrapped reads from the bootstrapped blocks stream http://tezos.gitlab.io/mainnet/api/rpc.html#get-monitor-bootstrapped

func (*Client) MonitorNetworkPeerLog

func (c *Client) MonitorNetworkPeerLog(ctx context.Context, peerID string, monitor *NetworkPeerMonitor) error

MonitorNetworkPeerLog monitors network events related to a given peer. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id-log

func (*Client) MonitorNetworkPointLog

func (c *Client) MonitorNetworkPointLog(ctx context.Context, address string, monitor *NetworkPointMonitor) error

MonitorNetworkPointLog monitors network events related to an `IP:addr`. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id-log

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates a Tezos RPC request.

func (*Client) Put

func (c *Client) Put(ctx context.Context, urlpath string, body, result interface{}) error

func (*Client) TrustNetworkPeer

func (c *Client) TrustNetworkPeer(ctx context.Context, peerID string) error

TrustNetworkPeer used to trust a given peer permanently: the peer cannot be blocked (but its host IP still can). https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-peers-peer-id-trust

func (*Client) TrustNetworkPoint

func (c *Client) TrustNetworkPoint(ctx context.Context, address string) error

TrustNetworkPoint used to trust a given address permanently. Connections from this address can still be closed on authentication if the peer is blacklisted or greylisted. https://tezos.gitlab.io/mainnet/api/rpc.html#get-network-points-point-trust

type Constants

type Constants struct {
	NoRewardCycles               int64    `json:"no_reward_cycles"`
	SecurityDepositRampUpCycles  int64    `json:"security_deposit_ramp_up_cycles"`
	PreservedCycles              int64    `json:"preserved_cycles"`
	BlocksPerCycle               int64    `json:"blocks_per_cycle"`
	BlocksPerCommitment          int64    `json:"blocks_per_commitment"`
	BlocksPerRollSnapshot        int64    `json:"blocks_per_roll_snapshot"`
	BlocksPerVotingPeriod        int64    `json:"blocks_per_voting_period"`
	TimeBetweenBlocks            []string `json:"time_between_blocks"`
	EndorsersPerBlock            int      `json:"endorsers_per_block"`
	HardGasLimitPerOperation     int64    `json:"hard_gas_limit_per_operation,string"`
	HardGasLimitPerBlock         int64    `json:"hard_gas_limit_per_block,string"`
	ProofOfWorkThreshold         int64    `json:"proof_of_work_threshold,string"`
	ProofOfWorkNonceSize         int      `json:"proof_of_work_nonce_size"`
	TokensPerRoll                int64    `json:"tokens_per_roll,string"`
	MichelsonMaximumTypeSize     int      `json:"michelson_maximum_type_size"`
	SeedNonceRevelationTip       int64    `json:"seed_nonce_revelation_tip,string"`
	OriginationSize              int64    `json:"origination_size"`
	OriginationBurn              int64    `json:"origination_burn,string"`
	BlockSecurityDeposit         int64    `json:"block_security_deposit,string"`
	EndorsementSecurityDeposit   int64    `json:"endorsement_security_deposit,string"`
	CostPerByte                  int64    `json:"cost_per_byte,string"`
	HardStorageLimitPerOperation int64    `json:"hard_storage_limit_per_operation,string"`
	TestChainDuration            int64    `json:"test_chain_duration,string"`
	MaxOperationDataLength       int      `json:"max_operation_data_length"`
	MaxProposalsPerDelegate      int      `json:"max_proposals_per_delegate"`
	MaxRevelationsPerBlock       int      `json:"max_revelations_per_block"`
	NonceLength                  int      `json:"nonce_length"`

	// New in Bablyon v005
	MinProposalQuorum int64 `json:"min_proposal_quorum"`
	QuorumMin         int64 `json:"quorum_min"`
	QuorumMax         int64 `json:"quorum_max"`

	// Emmy+ v1
	InitialEndorsers           int `json:"initial_endorsers"`
	DelayPerMissingEndorsement int `json:"delay_per_missing_endorsement,string"`

	// New in Carthage v006 (Emmy+ v2)
	BakingRewardPerEndorsement_v6 [2]int64 `json:"-"`
	EndorsementReward_v6          [2]int64 `json:"-"`

	// Broken by v6
	BlockReward_v1       int64 `json:"block_reward,string"` // default unmarshal
	EndorsementReward_v1 int64 `json:"-"`

	// New in v7
	MaxAnonOpsPerBlock int `json:"max_anon_ops_per_block"` // was max_revelations_per_block
}

func (Constants) GetBlockReward

func (c Constants) GetBlockReward() int64

func (Constants) GetEndorsementReward

func (c Constants) GetEndorsementReward() int64

func (Constants) HaveV6Rewards

func (c Constants) HaveV6Rewards() bool

func (Constants) MapToChainParams

func (c Constants) MapToChainParams() *tezos.Params

func (*Constants) UnmarshalJSON

func (c *Constants) UnmarshalJSON(buf []byte) error

type ContractBalanceUpdate

type ContractBalanceUpdate struct {
	GenericBalanceUpdate
	Contract tezos.Address `json:"contract"`
}

ContractBalanceUpdate is a BalanceUpdatesType variant for Kind=contract

func (*ContractBalanceUpdate) Address

func (c *ContractBalanceUpdate) Address() tezos.Address

type Contracts

type Contracts []tezos.Address

Contracts holds a list of addresses

type CycleBalance

type CycleBalance struct {
	Cycle   int64 `json:"cycle"`
	Deposit int64 `json:"deposit,string"`
	Fees    int64 `json:"fees,string"`
	Rewards int64 `json:"rewards,string"`
}

type Delegate

type Delegate struct {
	Delegate             tezos.Address   `json:"-"`
	Height               int64           `json:"-"`
	Deactivated          bool            `json:"deactivated"`
	Balance              int64           `json:"balance,string"`
	DelegatedContracts   []tezos.Address `json:"delegated_contracts"`
	FrozenBalance        int64           `json:"frozen_balance,string"`
	FrozenBalanceByCycle []CycleBalance  `json:"frozen_balance_by_cycle"`
	GracePeriod          int64           `json:"grace_period"`
	StakingBalance       int64           `json:"staking_balance,string"`
}

Delegate holds information about an active delegate

type DelegateList

type DelegateList []tezos.Address

DelegateList contains a list of delegates

type DelegationOp

type DelegationOp struct {
	GenericOp
	Source       tezos.Address         `json:"source"`
	Fee          int64                 `json:"fee,string"`
	Counter      int64                 `json:"counter,string"`
	GasLimit     int64                 `json:"gas_limit,string"`
	StorageLimit int64                 `json:"storage_limit,string"`
	Delegate     tezos.Address         `json:"delegate,omitempty"`
	Metadata     *DelegationOpMetadata `json:"metadata"`
}

DelegationOp represents a transaction operation

type DelegationOpMetadata

type DelegationOpMetadata struct {
	BalanceUpdates BalanceUpdates   `json:"balance_updates"` // fee-related
	Result         DelegationResult `json:"operation_result"`
}

DelegationOpMetadata represents a transaction operation metadata

type DelegationResult

type DelegationResult struct {
	ConsumedGas int64            `json:"consumed_gas,string"`
	Status      tezos.OpStatus   `json:"status"`
	Errors      []OperationError `json:"errors,omitempty"`
}

DelegationResult represents a transaction result

type DoubleBakingOp

type DoubleBakingOp struct {
	GenericOp
	BH1      BlockHeader             `json:"bh1"`
	BH2      BlockHeader             `json:"bh2"`
	Metadata *DoubleBakingOpMetadata `json:"metadata"`
}

DoubleBakingOp represents a double_baking_evidence operation

type DoubleBakingOpMetadata

type DoubleBakingOpMetadata struct {
	BalanceUpdates BalanceUpdates `json:"balance_updates"`
}

DoubleBakingOpMetadata represents a double_baking_evidence operation metadata

type DoubleEndorsementEvidence

type DoubleEndorsementEvidence struct {
	Branch     tezos.BlockHash `json:"branch"`     // the double block
	Operations EndorsementOp   `json:"operations"` // only level and kind are set
	Signature  string          `json:"signature"`
}

DoubleEndorsementEvidence represents one of the duplicate endoresements

type DoubleEndorsementOp

type DoubleEndorsementOp struct {
	GenericOp
	OP1      DoubleEndorsementEvidence    `json:"op1"`
	OP2      DoubleEndorsementEvidence    `json:"op2"`
	Metadata *DoubleEndorsementOpMetadata `json:"metadata"`
}

DoubleEndorsementOp represents a double_endorsement_evidence operation

type DoubleEndorsementOpMetadata

type DoubleEndorsementOpMetadata struct {
	BalanceUpdates BalanceUpdates `json:"balance_updates"`
}

DoubleEndorsementOpMetadata represents double_endorsement_evidence operation metadata

type EmbeddedEndorsementOp

type EmbeddedEndorsementOp struct {
	Kind  tezos.OpType `json:"kind"`
	Level int64        `json:"level"`
}

v009+

type EndorsementContent

type EndorsementContent struct {
	Branch     string                `json:"branch"`
	Operations EmbeddedEndorsementOp `json:"operations"`
}

v009+

type EndorsementOp

type EndorsementOp struct {
	GenericOp
	Level       int64                  `json:"level"`       // <= v008
	Metadata    *EndorsementOpMetadata `json:"metadata"`    // all protocols
	Endorsement *EndorsementContent    `json:"endorsement"` // v009+
	Slot        int                    `json:"slot"`        // v009+
}

EndorsementOp represents an endorsement operation

func (EndorsementOp) GetLevel

func (e EndorsementOp) GetLevel() int64

type EndorsementOpMetadata

type EndorsementOpMetadata struct {
	BalanceUpdates BalanceUpdates `json:"balance_updates"`
	Delegate       tezos.Address  `json:"delegate"`
	Slots          []int          `json:"slots"`
}

EndorsementOpMetadata represents an endorsement operation metadata

func (EndorsementOpMetadata) Address

func (m EndorsementOpMetadata) Address() tezos.Address

type EndorsingRight

type EndorsingRight struct {
	Delegate      tezos.Address `json:"delegate"`
	Level         int64         `json:"level"`
	EstimatedTime time.Time     `json:"estimated_time"`
	Slots         []int         `json:"slots"`
}

EndorsingRight holds information about the right to endorse a specific Tezos block

func (EndorsingRight) Address

func (r EndorsingRight) Address() tezos.Address

type Error

type Error interface {
	error
	ErrorID() string
	ErrorKind() string
}

Error is a Tezos error as documented on http://tezos.gitlab.io/mainnet/api/errors.html.

type Errors

type Errors []Error

Errors is a slice of Error with custom JSON unmarshaller

func (Errors) Error

func (e Errors) Error() string

func (Errors) ErrorID

func (e Errors) ErrorID() string

ErrorID returns Tezos error id

func (Errors) ErrorKind

func (e Errors) ErrorKind() string

ErrorKind returns Tezos error kind

func (*Errors) UnmarshalJSON

func (e *Errors) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type FreezerBalanceUpdate

type FreezerBalanceUpdate struct {
	GenericBalanceUpdate
	Category string        `json:"category"`
	Delegate tezos.Address `json:"delegate"`
	Level_   int64         `json:"level"` // wrongly called level, it's cycle
	Cycle_   int64         `json:"cycle"` // v4 fix
}

FreezerBalanceUpdate is a BalanceUpdatesType variant for Kind=freezer

func (*FreezerBalanceUpdate) Address

func (c *FreezerBalanceUpdate) Address() tezos.Address

func (*FreezerBalanceUpdate) Cycle

func (b *FreezerBalanceUpdate) Cycle() int64

type GenericBalanceUpdate

type GenericBalanceUpdate struct {
	Kind   string `json:"kind"`
	Change int64  `json:"change,string"`
	Origin string `json:"origin"` // block, migration
}

GenericBalanceUpdate holds the common values among all BalanceUpdatesType variants

func (*GenericBalanceUpdate) Address

func (g *GenericBalanceUpdate) Address() tezos.Address

func (*GenericBalanceUpdate) Amount

func (g *GenericBalanceUpdate) Amount() int64

func (*GenericBalanceUpdate) BalanceUpdateKind

func (g *GenericBalanceUpdate) BalanceUpdateKind() string

BalanceUpdateKind returns the BalanceUpdateType's Kind field

type GenericDiff

type GenericDiff struct {
	DiffKind LazyDiffKind `json:"kind"`
	DiffId   int64        `json:"id,string"`
}

func (*GenericDiff) Id

func (d *GenericDiff) Id() int64

func (*GenericDiff) Kind

func (d *GenericDiff) Kind() LazyDiffKind

type GenericError

type GenericError struct {
	ID   string `json:"id"`
	Kind string `json:"kind"`
}

GenericError is a basic error type

func (*GenericError) Error

func (e *GenericError) Error() string

func (*GenericError) ErrorID

func (e *GenericError) ErrorID() string

ErrorID returns Tezos error id

func (*GenericError) ErrorKind

func (e *GenericError) ErrorKind() string

ErrorKind returns Tezos error kind

type GenericOp

type GenericOp struct {
	Kind tezos.OpType `json:"kind"`
}

GenericOp is a most generic type

func (*GenericOp) OpKind

func (e *GenericOp) OpKind() tezos.OpType

OpKind implements Operation

type GenesisData

type GenesisData struct {
	Accounts    []*X0
	Contracts   []*X1
	Commitments []*X2
}

func (*GenesisData) Supply

func (b *GenesisData) Supply() int64

func (*GenesisData) UnmarshalText

func (b *GenesisData) UnmarshalText(data []byte) error

type HTTPError

type HTTPError interface {
	error
	HTTPStatus
}

HTTPError retains HTTP status

type HTTPStatus

type HTTPStatus interface {
	Request() string // e.g. GET /...
	Status() string  // e.g. "200 OK"
	StatusCode() int // e.g. 200
	Body() []byte
}

HTTPStatus interface represents an unprocessed HTTP reply

type HexBytes

type HexBytes []byte

HexBytes represents bytes as a JSON string of hexadecimal digits

func (HexBytes) MarshalText

func (h HexBytes) MarshalText() ([]byte, error)

func (HexBytes) String

func (h HexBytes) String() string

func (*HexBytes) UnmarshalText

func (h *HexBytes) UnmarshalText(data []byte) error

UnmarshalText umarshalls a hex string to bytes

type IDTimestamp

type IDTimestamp struct {
	ID        string
	Timestamp time.Time
}

IDTimestamp represents peer id with timestamp

func (*IDTimestamp) UnmarshalJSON

func (i *IDTimestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type InternalResult

type InternalResult struct {
	GenericOp
	Source      tezos.Address         `json:"source"`
	Nonce       int64                 `json:"nonce"`
	Result      *TransactionResult    `json:"result"`
	Destination *tezos.Address        `json:"destination,omitempty"` // transaction
	Delegate    *tezos.Address        `json:"delegate,omitempty"`    // delegation
	Parameters  *micheline.Parameters `json:"parameters,omitempty"`  // transaction
	Amount      int64                 `json:"amount,string"`         // transaction
	Balance     int64                 `json:"balance,string"`        // origination
	Script      *micheline.Script     `json:"script,omitempty"`      // origination
}

type InvalidBlock

type InvalidBlock struct {
	Block tezos.BlockHash `json:"block"`
	Level int64           `json:"level"`
	Error Errors          `json:"error"`
}

InvalidBlock represents invalid block hash along with the errors that led to it being declared invalid

type LazyBigMapDiff

type LazyBigMapDiff struct {
	GenericDiff
	Diff micheline.BigmapDiffElem `json:"diff"`
}

type LazyDiffKind

type LazyDiffKind string
const (
	LazyDiffKindBigMap       LazyDiffKind = "big_map"
	LazyDiffKindSaplingState LazyDiffKind = "sapling_state"
)

func ParseLazyDiffKind

func ParseLazyDiffKind(data string) (LazyDiffKind, error)

func (LazyDiffKind) MarshalText

func (k LazyDiffKind) MarshalText() ([]byte, error)

func (LazyDiffKind) String

func (k LazyDiffKind) String() string

func (*LazyDiffKind) UnmarshalText

func (k *LazyDiffKind) UnmarshalText(data []byte) error

type LazySaplingDiff

type LazySaplingDiff struct {
	GenericDiff
	Diff micheline.SaplingDiffElem `json:"diff"`
}

type LazyStorageDiff

type LazyStorageDiff []LazyStorageItem

func (*LazyStorageDiff) UnmarshalJSON

func (d *LazyStorageDiff) UnmarshalJSON(data []byte) error

type LazyStorageItem

type LazyStorageItem interface {
	Kind() LazyDiffKind
	Id() int64
}

type MempoolOperations

type MempoolOperations struct {
	Applied       []*OperationHeader             `json:"applied"`
	Refused       []*OperationHeaderWithErrorAlt `json:"refused"`
	BranchRefused []*OperationHeaderWithErrorAlt `json:"branch_refused"`
	BranchDelayed []*OperationHeaderWithErrorAlt `json:"branch_delayed"`
	Unprocessed   []*OperationHeaderAlt          `json:"unprocessed"`
}

MempoolOperations represents mempool operations

type Monitor

type Monitor interface {
	New() interface{}
	Send(ctx context.Context, val interface{})
	Err(error)
	Closed() <-chan struct{}
	Close()
}

type NetworkAddress

type NetworkAddress struct {
	Addr string `json:"addr"`
	Port uint16 `json:"port"`
}

NetworkAddress models a point's address and port.

type NetworkConnection

type NetworkConnection struct {
	Incoming         bool              `json:"incoming"`
	PeerID           string            `json:"peer_id"`
	IDPoint          NetworkAddress    `json:"id_point"`
	RemoteSocketPort uint16            `json:"remote_socket_port"`
	Versions         []*NetworkVersion `json:"versions"`
	Private          bool              `json:"private"`
	LocalMetadata    NetworkMetadata   `json:"local_metadata"`
	RemoteMetadata   NetworkMetadata   `json:"remote_metadata"`
}

NetworkConnection models detailed information for one network connection.

type NetworkConnectionTimestamp

type NetworkConnectionTimestamp struct {
	NetworkAddress
	Timestamp time.Time
}

NetworkConnectionTimestamp represents peer address with timestamp added

func (*NetworkConnectionTimestamp) UnmarshalJSON

func (n *NetworkConnectionTimestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type NetworkMetadata

type NetworkMetadata struct {
	DisableMempool bool `json:"disable_mempool"`
	PrivateNode    bool `json:"private_node"`
}

NetworkMetadata models metadata of a node.

type NetworkPeer

type NetworkPeer struct {
	PeerID                    string                      `json:"-"`
	Score                     int64                       `json:"score"`
	Trusted                   bool                        `json:"trusted"`
	ConnMetadata              *NetworkMetadata            `json:"conn_metadata"`
	State                     string                      `json:"state"`
	ReachableAt               *NetworkAddress             `json:"reachable_at"`
	Stat                      NetworkStats                `json:"stat"`
	LastEstablishedConnection *NetworkConnectionTimestamp `json:"last_established_connection"`
	LastSeen                  *NetworkConnectionTimestamp `json:"last_seen"`
	LastFailedConnection      *NetworkConnectionTimestamp `json:"last_failed_connection"`
	LastRejectedConnection    *NetworkConnectionTimestamp `json:"last_rejected_connection"`
	LastDisconnection         *NetworkConnectionTimestamp `json:"last_disconnection"`
	LastMiss                  *NetworkConnectionTimestamp `json:"last_miss"`
}

NetworkPeer represents peer info

type NetworkPeerLogEntry

type NetworkPeerLogEntry struct {
	NetworkAddress
	Kind      string    `json:"kind"`
	Timestamp time.Time `json:"timestamp"`
}

NetworkPeerLogEntry represents peer log entry

type NetworkPeerMonitor

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

func NewNetworkPeerMonitor

func NewNetworkPeerMonitor() *NetworkPeerMonitor

func (*NetworkPeerMonitor) Close

func (m *NetworkPeerMonitor) Close()

func (*NetworkPeerMonitor) Closed

func (m *NetworkPeerMonitor) Closed() <-chan struct{}

func (*NetworkPeerMonitor) Err

func (m *NetworkPeerMonitor) Err(err error)

func (*NetworkPeerMonitor) New

func (m *NetworkPeerMonitor) New() interface{}

func (*NetworkPeerMonitor) Recv

func (*NetworkPeerMonitor) Send

func (m *NetworkPeerMonitor) Send(ctx context.Context, val interface{})

type NetworkPoint

type NetworkPoint struct {
	Address                   string            `json:"-"`
	Trusted                   bool              `json:"trusted"`
	GreylistedUntil           time.Time         `json:"greylisted_until"`
	State                     NetworkPointState `json:"state"`
	P2PPeerID                 string            `json:"p2p_peer_id"`
	LastFailedConnection      time.Time         `json:"last_failed_connection"`
	LastRejectedConnection    *IDTimestamp      `json:"last_rejected_connection"`
	LastEstablishedConnection *IDTimestamp      `json:"last_established_connection"`
	LastDisconnection         *IDTimestamp      `json:"last_disconnection"`
	LastSeen                  *IDTimestamp      `json:"last_seen"`
	LastMiss                  time.Time         `json:"last_miss"`
}

NetworkPoint represents network point info

type NetworkPointLogEntry

type NetworkPointLogEntry struct {
	Kind      NetworkPointState `json:"kind"`
	Timestamp time.Time         `json:"timestamp"`
}

NetworkPointLogEntry represents point's log entry

type NetworkPointMonitor

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

func NewNetworkPointMonitor

func NewNetworkPointMonitor() *NetworkPointMonitor

func (*NetworkPointMonitor) Close

func (m *NetworkPointMonitor) Close()

func (*NetworkPointMonitor) Closed

func (m *NetworkPointMonitor) Closed() <-chan struct{}

func (*NetworkPointMonitor) Err

func (m *NetworkPointMonitor) Err(err error)

func (*NetworkPointMonitor) New

func (m *NetworkPointMonitor) New() interface{}

func (*NetworkPointMonitor) Recv

func (*NetworkPointMonitor) Send

func (m *NetworkPointMonitor) Send(ctx context.Context, val interface{})

type NetworkPointState

type NetworkPointState struct {
	EventKind string `json:"event_kind"`
	P2PPeerID string `json:"p2p_peer_id"`
}

NetworkPointState represents point state

type NetworkStats

type NetworkStats struct {
	TotalBytesSent int64 `json:"total_sent,string"`
	TotalBytesRecv int64 `json:"total_recv,string"`
	CurrentInflow  int64 `json:"current_inflow"`
	CurrentOutflow int64 `json:"current_outflow"`
}

NetworkStats models global network bandwidth totals and usage in B/s.

type NetworkVersion

type NetworkVersion struct {
	Name  string `json:"name"`
	Major uint16 `json:"major"`
	Minor uint16 `json:"minor"`
}

NetworkVersion models a network-layer version of a node.

type Operation

type Operation interface {
	OpKind() tezos.OpType
}

Operation must be implemented by all operations

type OperationError

type OperationError struct {
	GenericError
	Contract *tezos.Address `json:"contract,omitempty"`
	Amount   int64          `json:"amount,string,omitempty"`
	Balance  int64          `json:"balance,string,omitempty"`
}

type OperationHeader

type OperationHeader struct {
	Protocol  tezos.ProtocolHash `json:"protocol"`
	ChainID   tezos.ChainIdHash  `json:"chain_id"`
	Hash      tezos.OpHash       `json:"hash"`
	Branch    tezos.BlockHash    `json:"branch"`
	Contents  Operations         `json:"contents"`
	Signature string             `json:"signature"`
}

OperationHeader represents a single operation included into a block

type OperationHeaderAlt

type OperationHeaderAlt OperationHeader

func (*OperationHeaderAlt) UnmarshalJSON

func (o *OperationHeaderAlt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type OperationHeaderWithError

type OperationHeaderWithError struct {
	OperationHeader
	Error Errors `json:"error"`
}

OperationHeaderWithError represents unsuccessful operation

type OperationHeaderWithErrorAlt

type OperationHeaderWithErrorAlt OperationHeaderWithError

OperationHeaderWithErrorAlt is a named array encoded OperationWithError with hash as a first array member. See OperationAltList for details

func (*OperationHeaderWithErrorAlt) UnmarshalJSON

func (o *OperationHeaderWithErrorAlt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type OperationListLength

type OperationListLength struct {
	MaxSize int `json:"max_size"`
	MaxOp   int `json:"max_op"`
}

OperationListLength is a part of the BlockMetadata

type Operations

type Operations []Operation

Operations is a slice of Operation (interface type) with custom JSON unmarshaller

func (*Operations) UnmarshalJSON

func (e *Operations) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type OriginationOp

type OriginationOp struct {
	GenericOp
	Source         tezos.Address          `json:"source"`
	Fee            int64                  `json:"fee,string"`
	Counter        int64                  `json:"counter,string"`
	GasLimit       int64                  `json:"gas_limit,string"`
	StorageLimit   int64                  `json:"storage_limit,string"`
	ManagerPubkey  tezos.Address          `json:"manager_pubkey"` // proto v1 & >= v4
	ManagerPubkey2 tezos.Address          `json:"managerPubkey"`  // proto v2, v3
	Balance        int64                  `json:"balance,string"`
	Spendable      *bool                  `json:"spendable"`   // true when missing before v5 Babylon
	Delegatable    *bool                  `json:"delegatable"` // true when missing before v5 Babylon
	Delegate       *tezos.Address         `json:"delegate"`
	Script         *micheline.Script      `json:"script"`
	Metadata       *OriginationOpMetadata `json:"metadata"`
}

OriginationOp represents a contract creation operation

func (OriginationOp) Manager

func (o OriginationOp) Manager() tezos.Address

type OriginationOpMetadata

type OriginationOpMetadata struct {
	BalanceUpdates BalanceUpdates    `json:"balance_updates"` // fee-related
	Result         OriginationResult `json:"operation_result"`
}

OriginationOpMetadata represents a transaction operation metadata

type OriginationResult

type OriginationResult struct {
	BalanceUpdates      BalanceUpdates   `json:"balance_updates"` // burned fees
	OriginatedContracts []tezos.Address  `json:"originated_contracts"`
	ConsumedGas         int64            `json:"consumed_gas,string"`
	StorageSize         int64            `json:"storage_size,string"`
	PaidStorageSizeDiff int64            `json:"paid_storage_size_diff,string"`
	Status              tezos.OpStatus   `json:"status"`
	Errors              []OperationError `json:"errors,omitempty"`

	// v007
	ConsumedMilliGas int64 `json:"consumed_milligas,string"`

	// deprecated in v008
	BigmapDiff micheline.BigmapDiff `json:"big_map_diff,omitempty"`

	// v008
	LazyStorageDiff LazyStorageDiff `json:"lazy_storage_diff,omitempty"`
}

OriginationResult represents a contract creation result

type Proposal

type Proposal struct {
	Proposal tezos.ProtocolHash
	Upvotes  int64
}

Proposal holds information about a vote listing

func (*Proposal) UnmarshalJSON

func (p *Proposal) UnmarshalJSON(data []byte) error

type ProposalList

type ProposalList []Proposal

ProposalList contains a list of voters

type ProposalsOp

type ProposalsOp struct {
	GenericOp
	Source    tezos.Address        `json:"source"`
	Period    int                  `json:"period"`
	Proposals []tezos.ProtocolHash `json:"proposals"`
}

ProposalsOp represents a proposal operation

type RPCError

type RPCError interface {
	Error
	HTTPStatus
	Errors() []Error // returns all errors as a slice
}

RPCError is a Tezos RPC error as documented on http://tezos.gitlab.io/mainnet/api/errors.html.

type RevelationOp

type RevelationOp struct {
	GenericOp
	Source       tezos.Address         `json:"source"`
	Fee          int64                 `json:"fee,string"`
	Counter      int64                 `json:"counter,string"`
	GasLimit     int64                 `json:"gas_limit,string"`
	StorageLimit int64                 `json:"storage_limit,string"`
	PublicKey    tezos.Key             `json:"public_key"`
	Metadata     *RevelationOpMetadata `json:"metadata"`
}

RevelationOp represents a reveal operation

type RevelationOpMetadata

type RevelationOpMetadata struct {
	BalanceUpdates BalanceUpdates   `json:"balance_updates"` // fee-related
	Result         RevelationResult `json:"operation_result"`
}

RevelationOpMetadata represents a reveal operation metadata

type RevelationResult

type RevelationResult struct {
	ConsumedGas int64            `json:"consumed_gas,string"`
	Status      tezos.OpStatus   `json:"status"`
	Errors      []OperationError `json:"errors,omitempty"`
}

RevelationResult represents a reveal result

type SeedNonceOp

type SeedNonceOp struct {
	GenericOp
	Level    int64                `json:"level"`
	Nonce    HexBytes             `json:"nonce"`
	Metadata *SeedNonceOpMetadata `json:"metadata"`
}

SeedNonceOp represents a seed_nonce_revelation operation

type SeedNonceOpMetadata

type SeedNonceOpMetadata struct {
	BalanceUpdates BalanceUpdates `json:"balance_updates"` // fee-related
}

SeedNonceOpMetadata represents a transaction operation metadata

type SnapshotIndex

type SnapshotIndex struct {
	LastRoll     []string `json:"last_roll"`
	Nonces       []string `json:"nonces"`
	RandomSeed   string   `json:"random_seed"`
	RollSnapshot int64    `json:"roll_snapshot"`
	Cycle        int64    `json:"cycle"`
}

type SnapshotOwners

type SnapshotOwners struct {
	Height int64          `json:"height"`
	Cycle  int64          `json:"cycle"`
	Index  int64          `json:"index"`
	Rolls  []SnapshotRoll `json:"rolls"`
}

type SnapshotRoll

type SnapshotRoll struct {
	RollId   int64
	OwnerKey tezos.Key
}

func (SnapshotRoll) MarshalJSON

func (r SnapshotRoll) MarshalJSON() ([]byte, error)

func (*SnapshotRoll) UnmarshalJSON

func (r *SnapshotRoll) UnmarshalJSON(data []byte) error

type TransactionOp

type TransactionOp struct {
	GenericOp
	Source       tezos.Address          `json:"source"`
	Destination  tezos.Address          `json:"destination"`
	Fee          int64                  `json:"fee,string"`
	Amount       int64                  `json:"amount,string"`
	Counter      int64                  `json:"counter,string"`
	GasLimit     int64                  `json:"gas_limit,string"`
	StorageLimit int64                  `json:"storage_limit,string"`
	Parameters   *micheline.Parameters  `json:"parameters,omitempty"`
	Metadata     *TransactionOpMetadata `json:"metadata"`
}

TransactionOp represents a transaction operation

type TransactionOpMetadata

type TransactionOpMetadata struct {
	BalanceUpdates  BalanceUpdates     `json:"balance_updates"` // fee-related
	Result          *TransactionResult `json:"operation_result"`
	InternalResults []*InternalResult  `json:"internal_operation_results,omitempty"`
}

TransactionOpMetadata represents a transaction operation metadata

type TransactionResult

type TransactionResult struct {
	BalanceUpdates      BalanceUpdates   `json:"balance_updates"` // tx or contract related
	ConsumedGas         int64            `json:"consumed_gas,string"`
	ConsumedMilliGas    int64            `json:"consumed_milligas,string"`
	Status              tezos.OpStatus   `json:"status"`
	Allocated           bool             `json:"allocated_destination_contract"` // new addr created and payed
	Errors              []OperationError `json:"errors,omitempty"`
	Storage             *micheline.Prim  `json:"storage,omitempty"`
	StorageSize         int64            `json:"storage_size,string"`
	PaidStorageSizeDiff int64            `json:"paid_storage_size_diff,string"`

	// deprecated in v008
	BigmapDiff micheline.BigmapDiff `json:"big_map_diff,omitempty"`

	// v008
	LazyStorageDiff LazyStorageDiff `json:"lazy_storage_diff,omitempty"`

	// when reused as internal origination result
	OriginatedContracts []tezos.Address `json:"originated_contracts,omitempty"`
}

TransactionResult represents a transaction result

type Voter

type Voter struct {
	Delegate tezos.Address `json:"pkh"`
	Rolls    int64         `json:"rolls"`
}

Voter holds information about a vote listing

type VoterList

type VoterList []Voter

VoterList contains a list of voters

type VotingPeriod

type VotingPeriod struct {
	Index         int64                  `json:"index"`
	Kind          tezos.VotingPeriodKind `json:"kind"`
	StartPosition int64                  `json:"start_position"`
}

type VotingPeriodInfo

type VotingPeriodInfo struct {
	Position     int64        `json:"position"`
	Remaining    int64        `json:"remaining"`
	VotingPeriod VotingPeriod `json:"voting_period"`
}

type X0

type X0 struct {
	Addr  tezos.Address
	Key   tezos.Key
	Value int64
}

bootstrap account with or without known public key

type X1

type X1 struct {
	Addr     tezos.Address
	Delegate tezos.Address
	Value    int64
	Script   micheline.Script
}

bootstrap contract

type X2

type X2 struct {
	Addr  tezos.Address
	Value int64
}

commitment

Jump to

Keyboard shortcuts

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