go-tezos: github.com/ecadlabs/go-tezos Index | Files

package tezos

import "github.com/ecadlabs/go-tezos"

Index

Package Files

block.go client.go errors.go operations.go service.go utils.go votes.go

Constants

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

type ActivateAccountOperationElem Uses

type ActivateAccountOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    PKH                  string                          `json:"pkh" yaml:"pkh"`
    Secret               string                          `json:"secret" yaml:"secret"`
    Metadata             BalanceUpdatesOperationMetadata `json:"metadata" yaml:"metadata"`
}

ActivateAccountOperationElem represents activate_account operation

func (*ActivateAccountOperationElem) BalanceUpdates Uses

func (el *ActivateAccountOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

type BalanceUpdate Uses

type BalanceUpdate interface {
    BalanceUpdateKind() string
}

BalanceUpdate is a variable structure depending on the Kind field

type BalanceUpdates Uses

type BalanceUpdates []BalanceUpdate

BalanceUpdates is a list of balance update operations

func (*BalanceUpdates) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler

type BalanceUpdatesOperation Uses

type BalanceUpdatesOperation interface {
    BalanceUpdates() BalanceUpdates
}

BalanceUpdatesOperation is implemented by operations providing balance updates

type BalanceUpdatesOperationMetadata Uses

type BalanceUpdatesOperationMetadata struct {
    BalanceUpdates BalanceUpdates `json:"balance_updates" yaml:"balance_updates"`
}

BalanceUpdatesOperationMetadata contains balance updates only

type Ballot Uses

type Ballot struct {
    PKH    string `json:"pkh" yaml:"pkh"`
    Ballot string `json:"ballot" yaml:"ballot"`
}

Ballot holds information about a Tezos ballot

type BallotListing Uses

type BallotListing struct {
    PKH   string `json:"pkh" yaml:"pkh"`
    Rolls int64  `json:"rolls" yaml:"rolls"`
}

BallotListing holds information about a Tezos delegate and his voting weight in rolls

type BallotOperationElem Uses

type BallotOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Source               string                 `json:"source" yaml:"source"`
    Period               int                    `json:"period" yaml:"period"`
    Proposal             string                 `json:"proposal" yaml:"proposal"`
    Ballot               string                 `json:"ballot" yaml:"ballot"`
    Metadata             map[string]interface{} `json:"metadata" yaml:"metadata"`
}

BallotOperationElem represents a ballot operation

type Ballots Uses

type Ballots struct {
    Yay  int64 `json:"yay" yaml:"yay"`
    Nay  int64 `json:"nay" yaml:"nay"`
    Pass int64 `json:"pass" yaml:"pass"`
}

Ballots holds summary data about a voting period

type BigInt Uses

type BigInt struct {
    big.Int
}

BigInt overrides UnmarshalJSON for big.Int

func (*BigInt) MarshalYAML Uses

func (z *BigInt) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler

func (*BigInt) UnmarshalJSON Uses

func (z *BigInt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Block Uses

type Block struct {
    Protocol   string              `json:"protocol" yaml:"protocol"`
    ChainID    string              `json:"chain_id" yaml:"chain_id"`
    Hash       string              `json:"hash" yaml:"hash"`
    Header     RawBlockHeader      `json:"header" yaml:"header"`
    Metadata   BlockHeaderMetadata `json:"metadata" yaml:"metadata"`
    Operations [][]*Operation      `json:"operations" yaml:"operations"`
}

Block holds information about a Tezos block

type BlockHeaderMetadata Uses

type BlockHeaderMetadata struct {
    Protocol               string                    `json:"protocol" yaml:"protocol"`
    NextProtocol           string                    `json:"next_protocol" yaml:"next_protocol"`
    TestChainStatus        TestChainStatus           `json:"-" yaml:"-"`
    MaxOperationsTTL       int                       `json:"max_operations_ttl" yaml:"max_operations_ttl"`
    MaxOperationDataLength int                       `json:"max_operation_data_length" yaml:"max_operation_data_length"`
    MaxBlockHeaderLength   int                       `json:"max_block_header_length" yaml:"max_block_header_length"`
    MaxOperationListLength []*MaxOperationListLength `json:"max_operation_list_length" yaml:"max_operation_list_length"`
    Baker                  string                    `json:"baker" yaml:"baker"`
    Level                  BlockHeaderMetadataLevel  `json:"level" yaml:"level"`
    VotingPeriodKind       string                    `json:"voting_period_kind" yaml:"voting_period_kind"`
    NonceHash              string                    `json:"nonce_hash" yaml:"nonce_hash"`
    ConsumedGas            *BigInt                   `json:"consumed_gas" yaml:"consumed_gas"`
    Deactivated            []string                  `json:"deactivated" yaml:"deactivated"`
    BalanceUpdates         BalanceUpdates            `json:"balance_updates" yaml:"balance_updates"`
}

BlockHeaderMetadata is a part of the Tezos block data

func (*BlockHeaderMetadata) UnmarshalJSON Uses

func (bhm *BlockHeaderMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the BlockHeaderMetadata JSON

type BlockHeaderMetadataLevel Uses

type BlockHeaderMetadataLevel struct {
    Level                int  `json:"level" yaml:"level"`
    LevelPosition        int  `json:"level_position" yaml:"level_position"`
    Cycle                int  `json:"cycle" yaml:"cycle"`
    CyclePosition        int  `json:"cycle_position" yaml:"cycle_position"`
    VotingPeriod         int  `json:"voting_period" yaml:"voting_period"`
    VotingPeriodPosition int  `json:"voting_period_position" yaml:"voting_period_position"`
    ExpectedCommitment   bool `json:"expected_commitment" yaml:"expected_commitment"`
}

BlockHeaderMetadataLevel is a part of BlockHeaderMetadata

type BlockInfo Uses

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

BlockInfo holds information about block returned by monitor heads endpoint

type BootstrappedBlock Uses

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

BootstrappedBlock represents bootstrapped block stream message

type ContractBalanceUpdate Uses

type ContractBalanceUpdate struct {
    GenericBalanceUpdate `yaml:",inline"`
    Contract             string `json:"contract" yaml:"contract"`
}

ContractBalanceUpdate is a BalanceUpdatesType variant for Kind=contract

type DelegationOperationElem Uses

type DelegationOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Source               string                      `json:"source" yaml:"source"`
    Fee                  *BigInt                     `json:"fee" yaml:"fee"`
    Counter              *BigInt                     `json:"counter" yaml:"counter"`
    GasLimit             *BigInt                     `json:"gas_limit" yaml:"gas_limit"`
    StorageLimit         *BigInt                     `json:"storage_limit" yaml:"storage_limit"`
    ManagerPubKey        string                      `json:"managerPubkey" yaml:"managerPubkey"`
    Balance              *BigInt                     `json:"balance" yaml:"balance"`
    Spendable            *bool                       `json:"spendable,omitempty" yaml:"spendable,omitempty"`
    Delegatable          *bool                       `json:"delegatable,omitempty" yaml:"delegatable,omitempty"`
    Delegate             string                      `json:"delegate,omitempty" yaml:"delegate,omitempty"`
    Script               *ScriptedContracts          `json:"script,omitempty" yaml:"script,omitempty"`
    Metadata             DelegationOperationMetadata `json:"metadata" yaml:"metadata"`
}

DelegationOperationElem represents a delegation operation

func (*DelegationOperationElem) BalanceUpdates Uses

func (el *DelegationOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

func (*DelegationOperationElem) OperationFee Uses

func (el *DelegationOperationElem) OperationFee() *big.Int

OperationFee implements OperationWithFee

type DelegationOperationMetadata Uses

type DelegationOperationMetadata struct {
    BalanceUpdates  BalanceUpdates            `json:"balance_updates" yaml:"balance_updates"`
    OperationResult DelegationOperationResult `json:"operation_result" yaml:"operation_result"`
}

DelegationOperationMetadata represents a delegation operation metadata

type DelegationOperationResult Uses

type DelegationOperationResult struct {
    Status string `json:"status" yaml:"status"`
    Errors Errors `json:"errors" yaml:"errors"`
}

DelegationOperationResult represents a delegation operation result

type DoubleBakingEvidenceOperationElem Uses

type DoubleBakingEvidenceOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    BlockHeader1         RawBlockHeader                  `json:"bh1" yaml:"bh1"`
    BlockHeader2         RawBlockHeader                  `json:"bh2" yaml:"bh2"`
    Metadata             BalanceUpdatesOperationMetadata `json:"metadata" yaml:"metadata"`
}

DoubleBakingEvidenceOperationElem represents double_baking_evidence operation

func (*DoubleBakingEvidenceOperationElem) BalanceUpdates Uses

func (el *DoubleBakingEvidenceOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

type DoubleEndorsementEvidenceOperationElem Uses

type DoubleEndorsementEvidenceOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Operation1           InlinedEndorsement              `json:"op1" yaml:"op1"`
    Operation2           InlinedEndorsement              `json:"op2" yaml:"op2"`
    Metadata             BalanceUpdatesOperationMetadata `json:"metadata" yaml:"metadata"`
}

DoubleEndorsementEvidenceOperationElem represents double_endorsement_evidence operation

func (*DoubleEndorsementEvidenceOperationElem) BalanceUpdates Uses

func (el *DoubleEndorsementEvidenceOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

type EndorsementOperationElem Uses

type EndorsementOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Level                int                          `json:"level" yaml:"level"`
    Metadata             EndorsementOperationMetadata `json:"metadata" yaml:"metadata"`
}

EndorsementOperationElem represents an endorsement operation

func (*EndorsementOperationElem) BalanceUpdates Uses

func (el *EndorsementOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

type EndorsementOperationMetadata Uses

type EndorsementOperationMetadata struct {
    BalanceUpdates BalanceUpdates `json:"balance_updates" yaml:"balance_updates"`
    Delegate       string         `json:"delegate" yaml:"delegate"`
    Slots          []int          `json:"slots" yaml:"slots,flow"`
}

EndorsementOperationMetadata represents an endorsement operation metadata

type Error Uses

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 Uses

type Errors []Error

Errors is a slice of Error with custom JSON unmarshaller

func (Errors) Error Uses

func (e Errors) Error() string

func (Errors) ErrorID Uses

func (e Errors) ErrorID() string

ErrorID returns Tezos error id

func (Errors) ErrorKind Uses

func (e Errors) ErrorKind() string

ErrorKind returns Tezos error kind

func (*Errors) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler

type ForkingTestChainStatus Uses

type ForkingTestChainStatus struct {
    GenericTestChainStatus
    Protocol   string `json:"protocol" yaml:"protocol"`
    Expiration string `json:"expiration" yaml:"expiration"`
}

ForkingTestChainStatus is a TestChainStatus variant for Status=forking

type FreezerBalanceUpdate Uses

type FreezerBalanceUpdate struct {
    GenericBalanceUpdate `yaml:",inline"`
    Category             string `json:"category" yaml:"category"`
    Delegate             string `json:"delegate" yaml:"delegate"`
    Level                int    `json:"level" yaml:"level"`
}

FreezerBalanceUpdate is a BalanceUpdatesType variant for Kind=freezer

type GenericBalanceUpdate Uses

type GenericBalanceUpdate struct {
    Kind   string `json:"kind" yaml:"kind"`
    Change int64  `json:"change,string" yaml:"change"`
}

GenericBalanceUpdate holds the common values among all BalanceUpdatesType variants

func (*GenericBalanceUpdate) BalanceUpdateKind Uses

func (g *GenericBalanceUpdate) BalanceUpdateKind() string

BalanceUpdateKind returns the BalanceUpdateType's Kind field

type GenericError Uses

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

GenericError is a basic error type

func (*GenericError) Error Uses

func (e *GenericError) Error() string

func (*GenericError) ErrorID Uses

func (e *GenericError) ErrorID() string

ErrorID returns Tezos error id

func (*GenericError) ErrorKind Uses

func (e *GenericError) ErrorKind() string

ErrorKind returns Tezos error kind

type GenericOperationElem Uses

type GenericOperationElem struct {
    Kind string `json:"kind" yaml:"kind"`
}

GenericOperationElem is a most generic element type

func (*GenericOperationElem) OperationElemKind Uses

func (e *GenericOperationElem) OperationElemKind() string

OperationElemKind implements OperationElem

type GenericTestChainStatus Uses

type GenericTestChainStatus struct {
    Status string `json:"status" yaml:"status"`
}

GenericTestChainStatus holds the common values among all TestChainStatus variants

func (*GenericTestChainStatus) TestChainStatus Uses

func (t *GenericTestChainStatus) TestChainStatus() string

TestChainStatus gets the TestChainStatus's Status field

type HTTPError Uses

type HTTPError interface {
    error
    HTTPStatus
}

HTTPError retains HTTP status

type HTTPStatus Uses

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

HTTPStatus interface represents an unprocessed HTTP reply

type HexBytes Uses

type HexBytes []byte

HexBytes represents bytes as a JSON string of hexadecimal digits

func (*HexBytes) UnmarshalText Uses

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

UnmarshalText umarshalls a hex string to bytes

type IDTimestamp Uses

type IDTimestamp struct {
    ID        string
    Timestamp time.Time
}

IDTimestamp represents peer id with timestamp

func (*IDTimestamp) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler

type InlinedEndorsement Uses

type InlinedEndorsement struct {
    Branch     string                     `json:"branch" yaml:"branch"`
    Operations InlinedEndorsementContents `json:"operations" yaml:"operations"`
    Signature  string                     `json:"signature" yaml:"signature"`
}

InlinedEndorsement corresponds to $inlined.endorsement

type InlinedEndorsementContents Uses

type InlinedEndorsementContents struct {
    Kind  string `json:"endorsement" yaml:"endorsement"`
    Level int    `json:"level" yaml:"level"`
}

InlinedEndorsementContents corresponds to $inlined.endorsement.contents

type InvalidBlock Uses

type InvalidBlock struct {
    Block string `json:"block"`
    Level int    `json:"level"`
    Error Errors `json:"error"`
}

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

type Logger Uses

type Logger interface {
    log.FieldLogger
    Writer() *io.PipeWriter
    WriterLevel(level log.Level) *io.PipeWriter
}

Logger is an extension to logrus.FieldLogger

type MaxOperationListLength Uses

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

MaxOperationListLength is a part of the BlockHeaderMetadata

type MempoolOperations Uses

type MempoolOperations struct {
    Applied       []*Operation             `json:"applied"`
    Refused       []*OperationWithErrorAlt `json:"refused"`
    BranchRefused []*OperationWithErrorAlt `json:"branch_refused"`
    BranchDelayed []*OperationWithErrorAlt `json:"branch_delayed"`
    Unprocessed   []*OperationAlt          `json:"unprocessed"`
}

MempoolOperations represents mempool operations

type NetworkAddress Uses

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

NetworkAddress models a point's address and port.

type NetworkConnection Uses

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 Uses

type NetworkConnectionTimestamp struct {
    NetworkAddress
    Timestamp time.Time
}

NetworkConnectionTimestamp represents peer address with timestamp added

func (*NetworkConnectionTimestamp) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler

type NetworkMetadata Uses

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

NetworkMetadata models metadata of a node.

type NetworkPeer Uses

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 Uses

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

NetworkPeerLogEntry represents peer log entry

type NetworkPoint Uses

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 Uses

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

NetworkPointLogEntry represents point's log entry

type NetworkPointState Uses

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

NetworkPointState represents point state

type NetworkStats Uses

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 Uses

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 NotRunningTestChainStatus Uses

type NotRunningTestChainStatus struct {
    GenericTestChainStatus
}

NotRunningTestChainStatus is a TestChainStatus variant for Status=not_running

type Operation Uses

type Operation struct {
    Protocol  string            `json:"protocol" yaml:"protocol"`
    ChainID   string            `json:"chain_id" yaml:"chain_id"`
    Hash      string            `json:"hash" yaml:"hash"`
    Branch    string            `json:"branch" yaml:"branch"`
    Contents  OperationElements `json:"contents" yaml:"contents"`
    Signature string            `json:"signature" yaml:"signature"`
}

Operation represents an operation included into block

type OperationAlt Uses

type OperationAlt Operation

OperationAlt is a heterogeneously encoded Operation with hash as a first array member, i.e.

[
	"...", // hash
	{
		"protocol": "...",
		...
	}
]

instead of

{
	"protocol": "...",
	"hash": "...",
	...
}

func (*OperationAlt) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler

type OperationElem Uses

type OperationElem interface {
    OperationElemKind() string
}

OperationElem must be implemented by all operation elements

type OperationElements Uses

type OperationElements []OperationElem

OperationElements is a slice of OperationElem with custom JSON unmarshaller

func (*OperationElements) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler

type OperationWithError Uses

type OperationWithError struct {
    Operation
    Error Errors `json:"error" yaml:"error"`
}

OperationWithError represents unsuccessful operation

type OperationWithErrorAlt Uses

type OperationWithErrorAlt OperationWithError

OperationWithErrorAlt is a heterogeneously encoded OperationWithError with hash as a first array member. See OperationAlt for details

func (*OperationWithErrorAlt) UnmarshalJSON Uses

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

UnmarshalJSON implements json.Unmarshaler

type OperationWithFee Uses

type OperationWithFee interface {
    OperationFee() *big.Int
}

OperationWithFee is implemented by operations with fees

type OriginationOperationElem Uses

type OriginationOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Source               string                       `json:"source" yaml:"source"`
    Fee                  *BigInt                      `json:"fee" yaml:"fee"`
    Counter              *BigInt                      `json:"counter" yaml:"counter"`
    GasLimit             *BigInt                      `json:"gas_limit" yaml:"gas_limit"`
    StorageLimit         *BigInt                      `json:"storage_limit" yaml:"storage_limit"`
    ManagerPubKey        string                       `json:"managerPubkey" yaml:"managerPubkey"`
    Balance              *BigInt                      `json:"balance" yaml:"balance"`
    Spendable            *bool                        `json:"spendable,omitempty" yaml:"spendable,omitempty"`
    Delegatable          *bool                        `json:"delegatable,omitempty" yaml:"delegatable,omitempty"`
    Delegate             string                       `json:"delegate,omitempty" yaml:"delegate,omitempty"`
    Script               *ScriptedContracts           `json:"script,omitempty" yaml:"script,omitempty"`
    Metadata             OriginationOperationMetadata `json:"metadata" yaml:"metadata"`
}

OriginationOperationElem represents a origination operation

func (*OriginationOperationElem) BalanceUpdates Uses

func (el *OriginationOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

func (*OriginationOperationElem) OperationFee Uses

func (el *OriginationOperationElem) OperationFee() *big.Int

OperationFee implements OperationWithFee

type OriginationOperationMetadata Uses

type OriginationOperationMetadata struct {
    BalanceUpdates  BalanceUpdates             `json:"balance_updates" yaml:"balance_updates"`
    OperationResult OriginationOperationResult `json:"operation_result" yaml:"operation_result"`
}

OriginationOperationMetadata represents a origination operation metadata

type OriginationOperationResult Uses

type OriginationOperationResult struct {
    Status              string         `json:"status" yaml:"status"`
    BalanceUpdates      BalanceUpdates `json:"balance_updates,omitempty" yaml:"balance_updates,omitempty"`
    OriginatedContracts []string       `json:"originated_contracts,omitempty" yaml:"originated_contracts,omitempty"`
    ConsumedGas         *BigInt        `json:"consumed_gas,omitempty" yaml:"consumed_gas,omitempty"`
    StorageSize         *BigInt        `json:"storage_size,omitempty" yaml:"storage_size,omitempty"`
    PaidStorageSizeDiff *BigInt        `json:"paid_storage_size_diff,omitempty" yaml:"paid_storage_size_diff,omitempty"`
    Errors              Errors         `json:"errors,omitempty" yaml:"errors,omitempty"`
}

OriginationOperationResult represents a origination operation result

type PeriodKind Uses

type PeriodKind string

PeriodKind contains information about tezos voting period kind

func (PeriodKind) IsPromotionVote Uses

func (p PeriodKind) IsPromotionVote() bool

IsPromotionVote true if period kind is promotion vote

func (PeriodKind) IsProposal Uses

func (p PeriodKind) IsProposal() bool

IsProposal return true if period kind is proposal

func (PeriodKind) IsTesting Uses

func (p PeriodKind) IsTesting() bool

IsTesting return true if period kind is testing

func (PeriodKind) IsTestingVote Uses

func (p PeriodKind) IsTestingVote() bool

IsTestingVote return true if period kind is testing vote

type Proposal Uses

type Proposal struct {
    ProposalHash   string
    SupporterCount int
}

Proposal holds summary data about a proposal and his number of supporter

type ProposalOperationElem Uses

type ProposalOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Source               string                 `json:"source" yaml:"source"`
    Period               int                    `json:"period" yaml:"period"`
    Proposals            []string               `json:"proposals" yaml:"proposals"`
    Metadata             map[string]interface{} `json:"metadata" yaml:"metadata"`
}

ProposalOperationElem represents a proposal operation

type RPCClient Uses

type RPCClient struct {
    // Logger
    Logger Logger
    // HTTP client used to communicate with the Tezos node API.
    Client *http.Client
    // Base URL for API requests.
    BaseURL *url.URL
    // User agent name for client.
    UserAgent string
    // Optional callback for metrics.
    RPCStatusCallback func(req *http.Request, status int, duration time.Duration, err error)
    // Optional callback for metrics.
    RPCHeaderCallback func(req *http.Request, resp *http.Response, duration time.Duration)
}

RPCClient manages communication with a Tezos RPC server.

func NewRPCClient Uses

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

NewRPCClient returns a new Tezos RPC client.

func (*RPCClient) Do Uses

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

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

func (*RPCClient) NewRequest Uses

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

NewRequest creates a Tezos RPC request.

type RPCError Uses

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 RawBlockHeader Uses

type RawBlockHeader struct {
    Level            int        `json:"level" yaml:"level"`
    Proto            int        `json:"proto" yaml:"proto"`
    Predecessor      string     `json:"predecessor" yaml:"predecessor"`
    Timestamp        time.Time  `json:"timestamp" yaml:"timestamp"`
    ValidationPass   int        `json:"validation_pass" yaml:"validation_pass"`
    OperationsHash   string     `json:"operations_hash" yaml:"operations_hash"`
    Fitness          []HexBytes `json:"fitness" yaml:"fitness,flow"`
    Context          string     `json:"context" yaml:"context"`
    Priority         int        `json:"priority" yaml:"priority"`
    ProofOfWorkNonce HexBytes   `json:"proof_of_work_nonce" yaml:"proof_of_work_nonce,flow"`
    SeedNonceHash    string     `json:"seed_nonce_hash" yaml:"seed_nonce_hash"`
    Signature        string     `json:"signature" yaml:"signature"`
}

RawBlockHeader is a part of the Tezos block data

type RevealOperationElem Uses

type RevealOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Source               string                  `json:"source" yaml:"source"`
    Fee                  *BigInt                 `json:"fee" yaml:"fee"`
    Counter              *BigInt                 `json:"counter" yaml:"counter"`
    GasLimit             *BigInt                 `json:"gas_limit" yaml:"gas_limit"`
    StorageLimit         *BigInt                 `json:"storage_limit" yaml:"storage_limit"`
    PublicKey            string                  `json:"public_key" yaml:"public_key"`
    Metadata             RevealOperationMetadata `json:"metadata" yaml:"metadata"`
}

RevealOperationElem represents a reveal operation

func (*RevealOperationElem) BalanceUpdates Uses

func (el *RevealOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

func (*RevealOperationElem) OperationFee Uses

func (el *RevealOperationElem) OperationFee() *big.Int

OperationFee implements OperationWithFee

type RevealOperationMetadata Uses

type RevealOperationMetadata DelegationOperationMetadata

RevealOperationMetadata represents a reveal operation metadata

type RunningTestChainStatus Uses

type RunningTestChainStatus struct {
    GenericTestChainStatus
    ChainID    string `json:"chain_id" yaml:"chain_id"`
    Genesis    string `json:"genesis" yaml:"genesis"`
    Protocol   string `json:"protocol" yaml:"protocol"`
    Expiration string `json:"expiration" yaml:"expiration"`
}

RunningTestChainStatus is a TestChainStatus variant for Status=running

type ScriptedContracts Uses

type ScriptedContracts struct {
    Code    map[string]interface{} `json:"code" yaml:"code"`
    Storage map[string]interface{} `json:"storage" yaml:"storage"`
}

ScriptedContracts corresponds to $scripted.contracts

type SeedNonceRevelationOperationElem Uses

type SeedNonceRevelationOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Level                int32                           `json:"level" yaml:"level"`
    Nonce                string                          `json:"nonce" yaml:"nonce"`
    Metadata             BalanceUpdatesOperationMetadata `json:"metadata" yaml:"metadata"`
}

SeedNonceRevelationOperationElem represents seed_nonce_revelation operation

func (*SeedNonceRevelationOperationElem) BalanceUpdates Uses

func (el *SeedNonceRevelationOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

type Service Uses

type Service struct {
    Client *RPCClient
}

Service implements fetching of information from Tezos nodes via JSON.

func (*Service) BanNetworkPeer Uses

func (s *Service) 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 (*Service) BanNetworkPoint Uses

func (s *Service) 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 (*Service) ConnectToNetworkPoint Uses

func (s *Service) 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 (*Service) GetBallotList Uses

func (s *Service) GetBallotList(ctx context.Context, chainID, blockID string) ([]*Ballot, error)

GetBallotList returns ballots casted so far during a voting period. https://tezos.gitlab.io/alphanet/api/rpc.html#get-block-id-votes-ballot-list

func (*Service) GetBallotListings Uses

func (s *Service) GetBallotListings(ctx context.Context, chainID, blockID string) ([]*BallotListing, error)

GetBallotListings returns a list of delegates with their voting weight, in number of rolls. https://tezos.gitlab.io/alphanet/api/rpc.html#get-block-id-votes-listings

func (*Service) GetBallots Uses

func (s *Service) GetBallots(ctx context.Context, chainID, blockID string) (*Ballots, error)

GetBallots returns sum of ballots casted so far during a voting period. https://tezos.gitlab.io/alphanet/api/rpc.html#get-block-id-votes-ballots

func (*Service) GetBlock Uses

func (s *Service) GetBlock(ctx context.Context, chainID, blockID string) (*Block, error)

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

func (*Service) GetContractBalance Uses

func (s *Service) GetContractBalance(ctx context.Context, chainID string, blockID string, contractID string) (*big.Int, error)

GetContractBalance returns a contract's balance http://tezos.gitlab.io/mainnet/api/rpc.html#get-block-id-context-contracts-contract-id-balance

func (*Service) GetCurrentPeriodKind Uses

func (s *Service) GetCurrentPeriodKind(ctx context.Context, chainID, blockID string) (PeriodKind, error)

GetCurrentPeriodKind returns the current period kind https://tezos.gitlab.io/alphanet/api/rpc.html#get-block-id-votes-current-period-kind

func (*Service) GetCurrentProposals Uses

func (s *Service) GetCurrentProposals(ctx context.Context, chainID, blockID string) (string, error)

GetCurrentProposals returns the current proposal under evaluation. https://tezos.gitlab.io/alphanet/api/rpc.html#get-block-id-votes-current-proposal

func (*Service) GetCurrentQuorum Uses

func (s *Service) GetCurrentQuorum(ctx context.Context, chainID, blockID string) (int, error)

GetCurrentQuorum returns the current expected quorum. https://tezos.gitlab.io/alphanet/api/rpc.html#get-block-id-votes-current-quorum

func (*Service) GetDelegateBalance Uses

func (s *Service) GetDelegateBalance(ctx context.Context, chainID string, blockID string, pkh string) (*big.Int, error)

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

func (*Service) GetInvalidBlocks Uses

func (s *Service) GetInvalidBlocks(ctx context.Context, chainID string) ([]*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/alphanet/api/rpc.html#get-chains-chain-id-invalid-blocks

func (*Service) GetMempoolPendingOperations Uses

func (s *Service) GetMempoolPendingOperations(ctx context.Context, chainID string) (*MempoolOperations, error)

GetMempoolPendingOperations returns mempool pending operations

func (*Service) GetNetworkConnections Uses

func (s *Service) GetNetworkConnections(ctx context.Context) ([]*NetworkConnection, error)

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

func (*Service) GetNetworkPeer Uses

func (s *Service) 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 (*Service) GetNetworkPeerBanned Uses

func (s *Service) 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 (*Service) GetNetworkPeerLog Uses

func (s *Service) 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 (*Service) GetNetworkPeers Uses

func (s *Service) 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 (*Service) GetNetworkPoint Uses

func (s *Service) 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 (*Service) GetNetworkPointBanned Uses

func (s *Service) 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 (*Service) GetNetworkPointLog Uses

func (s *Service) 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 (*Service) GetNetworkPoints Uses

func (s *Service) 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 (*Service) GetNetworkStats Uses

func (s *Service) GetNetworkStats(ctx context.Context) (*NetworkStats, error)

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

func (*Service) GetProposals Uses

func (s *Service) GetProposals(ctx context.Context, chainID, blockID string) ([]*Proposal, error)

GetProposals returns a list of proposals with number of supporters. https://tezos.gitlab.io/alphanet/api/rpc.html#get-block-id-votes-proposals

func (*Service) MonitorBootstrapped Uses

func (s *Service) MonitorBootstrapped(ctx context.Context, results chan<- *BootstrappedBlock) error

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

func (*Service) MonitorHeads Uses

func (s *Service) MonitorHeads(ctx context.Context, chainID string, results chan<- *BlockInfo) error

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

func (*Service) MonitorMempoolOperations Uses

func (s *Service) MonitorMempoolOperations(ctx context.Context, chainID, filter string, results chan<- []*Operation) error

MonitorMempoolOperations monitors mempool pending operations. The connection is closed after every new block.

func (*Service) MonitorNetworkPeerLog Uses

func (s *Service) MonitorNetworkPeerLog(ctx context.Context, peerID string, results chan<- []*NetworkPeerLogEntry) 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 (*Service) MonitorNetworkPointLog Uses

func (s *Service) MonitorNetworkPointLog(ctx context.Context, address string, results chan<- []*NetworkPointLogEntry) 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 (*Service) TrustNetworkPeer Uses

func (s *Service) 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 (*Service) TrustNetworkPoint Uses

func (s *Service) 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 TestChainStatus Uses

type TestChainStatus interface {
    TestChainStatus() string
}

TestChainStatus is a variable structure depending on the Status field

type TransactionOperationElem Uses

type TransactionOperationElem struct {
    GenericOperationElem `yaml:",inline"`
    Source               string                       `json:"source" yaml:"source"`
    Fee                  *BigInt                      `json:"fee" yaml:"fee"`
    Counter              *BigInt                      `json:"counter" yaml:"counter"`
    GasLimit             *BigInt                      `json:"gas_limit" yaml:"gas_limit"`
    StorageLimit         *BigInt                      `json:"storage_limit" yaml:"storage_limit"`
    Amount               *BigInt                      `json:"amount" yaml:"amount"`
    Destination          string                       `json:"destination" yaml:"destination"`
    Parameters           map[string]interface{}       `json:"parameters,omitempty" yaml:"parameters,omitempty"`
    Metadata             TransactionOperationMetadata `json:"metadata" yaml:"metadata"`
}

TransactionOperationElem represents a transaction operation

func (*TransactionOperationElem) BalanceUpdates Uses

func (el *TransactionOperationElem) BalanceUpdates() BalanceUpdates

BalanceUpdates implements BalanceUpdateOperation

func (*TransactionOperationElem) OperationFee Uses

func (el *TransactionOperationElem) OperationFee() *big.Int

OperationFee implements OperationWithFee

type TransactionOperationMetadata Uses

type TransactionOperationMetadata struct {
    BalanceUpdates  BalanceUpdates             `json:"balance_updates" yaml:"balance_updates"`
    OperationResult TransactionOperationResult `json:"operation_result" yaml:"operation_result"`
}

TransactionOperationMetadata represents a transaction operation metadata

type TransactionOperationResult Uses

type TransactionOperationResult struct {
    Status              string                 `json:"status" yaml:"status"`
    Storage             map[string]interface{} `json:"storage,omitempty" yaml:"storage,omitempty"`
    BalanceUpdates      BalanceUpdates         `json:"balance_updates,omitempty" yaml:"balance_updates,omitempty"`
    OriginatedContracts []string               `json:"originated_contracts,omitempty" yaml:"originated_contracts,omitempty"`
    ConsumedGas         *BigInt                `json:"consumed_gas,omitempty" yaml:"consumed_gas,omitempty"`
    StorageSize         *BigInt                `json:"storage_size,omitempty" yaml:"storage_size,omitempty"`
    PaidStorageSizeDiff *BigInt                `json:"paid_storage_size_diff,omitempty" yaml:"paid_storage_size_diff,omitempty"`
    Errors              Errors                 `json:"errors,omitempty" yaml:"errors,omitempty"`
}

TransactionOperationResult represents a transaction operation result

Package tezos imports 17 packages (graph). Updated 2019-09-11. Refresh now. Tools for package owners.