rpc

package
Version: v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 23 Imported by: 3

Documentation

Index

Constants

View Source
const (
	UnparsingModeInvalid   = ""
	UnparsingModeLegacy    = "Optimized_legacy"
	UnparsingModeOptimized = "Optimized"
	UnparsingModeReadable  = "Readable"
)
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 GasSafetyMargin int64 = 100

Variables

View Source
var (
	Canceled    = errors.New("operation confirm canceled")
	TTLExceeded = errors.New("operation ttl exceeded")
)
View Source
var DefaultOptions = CallOptions{
	Confirmations: 2,
	TTL:           tezos.DefaultParams.MaxOperationsTTL - 2,
	MaxFee:        1_000_000,
}
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 Activation added in v1.12.0

type Activation struct {
	Generic
	Pkh    tezos.Address  `json:"pkh"`
	Secret tezos.HexBytes `json:"secret"`
}

Activation represents a transaction operation

type BakingRight

type BakingRight struct {
	Delegate      tezos.Address `json:"delegate"`
	Level         int64         `json:"level"`
	Priority      int           `json:"priority"` // until v011
	Round         int           `json:"round"`    // v012+
	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 struct {
	Kind     string `json:"kind"`          // contract, freezer, accumulator, commitment, minted, burned
	Origin   string `json:"origin"`        // block, migration, subsidy
	Category string `json:"category"`      // optional, used on mint, burn, freezer
	Change   int64  `json:"change,string"` // amount, <0 =

	// related debtor or creditor
	Contract  tezos.Address `json:"contract"`  // contract only
	Delegate  tezos.Address `json:"delegate"`  // freezer and burn only
	Committer tezos.Address `json:"committer"` // committer only

	// Ithaca only
	IsParticipationBurn bool `json:"participation"` // burn only
	IsRevelationBurn    bool `json:"revelation"`    // burn only

	// legacy freezer cycle
	Level_ int64 `json:"level"` // wrongly called level, it's cycle
	Cycle_ int64 `json:"cycle"` // v4 fix
}

BalanceUpdate is a variable structure depending on the Kind field

func (BalanceUpdate) Address

func (b BalanceUpdate) Address() tezos.Address

func (BalanceUpdate) Amount

func (b BalanceUpdate) Amount() int64

func (BalanceUpdate) AmountAbs added in v1.13.2

func (b BalanceUpdate) AmountAbs() int64

func (BalanceUpdate) Cycle added in v1.12.0

func (b BalanceUpdate) Cycle() int64

type BalanceUpdates

type BalanceUpdates []BalanceUpdate

BalanceUpdates is a list of balance update operations

type Ballot

type Ballot struct {
	Generic
	Source   tezos.Address      `json:"source"`
	Period   int                `json:"period"`
	Ballot   tezos.BallotVote   `json:"ballot"` // yay, nay, pass
	Proposal tezos.ProtocolHash `json:"proposal"`
}

Ballot represents a ballot operation

type BallotInfo added in v1.12.0

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

BallotInfo holds information about a vote listing

type BallotList

type BallotList []BallotInfo

BallotList contains a list of voters

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 [][]*Operation     `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) GetLevelInfo added in v0.10.0

func (b Block) GetLevelInfo() LevelInfo

func (Block) GetTimestamp

func (b Block) GetTimestamp() time.Time

func (Block) GetVersion

func (b Block) GetVersion() int

func (Block) GetVotingInfo added in v0.10.0

func (b Block) GetVotingInfo() VotingPeriodInfo

only works for mainnet when before Edo or for all nets after Edo due to fixed constants used

func (Block) GetVotingPeriod

func (b Block) GetVotingPeriod() int64

func (Block) GetVotingPeriodKind

func (b Block) GetVotingPeriodKind() tezos.VotingPeriodKind

func (Block) IsProtocolUpgrade added in v0.10.1

func (b Block) IsProtocolUpgrade() bool

func (*Block) LogEntry

func (b *Block) LogEntry() *BlockHeaderLogEntry

type BlockAlias added in v1.12.0

type BlockAlias string

BlockAlias is a block addressing mode that uses a constant string

const (
	Genesis BlockAlias = "genesis"
	Head    BlockAlias = "head"
)

func (BlockAlias) Int64 added in v1.12.0

func (b BlockAlias) Int64() int64

func (BlockAlias) String added in v1.12.0

func (b BlockAlias) String() string

type BlockContent

type BlockContent struct {
	Command    string             `json:"command"`
	Protocol   tezos.ProtocolHash `json:"hash"`
	Fitness    []tezos.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 {
	Level                     int64                `json:"level"`
	Proto                     int                  `json:"proto"`
	Predecessor               tezos.BlockHash      `json:"predecessor"`
	Timestamp                 time.Time            `json:"timestamp"`
	ValidationPass            int                  `json:"validation_pass"`
	OperationsHash            tezos.OpListListHash `json:"operations_hash"`
	Fitness                   []tezos.HexBytes     `json:"fitness"`
	Context                   tezos.ContextHash    `json:"context"`
	PayloadHash               tezos.PayloadHash    `json:"payload_hash"`
	PayloadRound              int                  `json:"payload_round"`
	Priority                  int                  `json:"priority"`
	ProofOfWorkNonce          tezos.HexBytes       `json:"proof_of_work_nonce"`
	SeedNonceHash             *tezos.NonceHash     `json:"seed_nonce_hash"`
	Signature                 tezos.Signature      `json:"signature"`
	Content                   *BlockContent        `json:"content,omitempty"`
	LiquidityBakingEscapeVote bool                 `json:"liquidity_baking_escape_vote"`
	LiquidityBakingToggleVote tezos.LbVote         `json:"liquidity_baking_toggle_vote"`

	// only present when header is fetched explicitly
	Hash     tezos.BlockHash    `json:"hash"`
	Protocol tezos.ProtocolHash `json:"protocol"`
	ChainId  tezos.ChainIdHash  `json:"chain_id"`
}

BlockHeader is a part of the Tezos block data

func (BlockHeader) LbVote added in v1.13.0

func (h BlockHeader) LbVote() tezos.LbVote

func (*BlockHeader) LogEntry added in v1.13.0

func (h *BlockHeader) LogEntry() *BlockHeaderLogEntry

func (BlockHeader) ProtocolData added in v1.13.0

func (h BlockHeader) ProtocolData() []byte

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 tezos.OpListListHash `json:"operations_hash"`
	Fitness        []tezos.HexBytes     `json:"fitness"`
	Context        tezos.ContextHash    `json:"context"`
	ProtocolData   tezos.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 BlockID added in v1.12.0

type BlockID interface {
	fmt.Stringer
	Int64() int64
}

BlockID is an interface to abstract different kinds of block addressing modes

type BlockLevel

type BlockLevel int64

BlockLevel is a block addressing mode that uses the blocks sequence number a.k.a level

func (BlockLevel) Int64 added in v1.12.0

func (b BlockLevel) Int64() int64

func (BlockLevel) String added in v1.12.0

func (b BlockLevel) String() string

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"`
	Proposer               tezos.Address          `json:"proposer"`
	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            *LevelInfo              `json:"level"`
	VotingPeriodKind *tezos.VotingPeriodKind `json:"voting_period_kind"`

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

	// v010
	ImplicitOperationsResults []ImplicitResult `json:"implicit_operations_results"`
	LiquidityBakingEscapeEma  int64            `json:"liquidity_baking_escape_ema"`
}

BlockMetadata is a part of the Tezos block data

func (*BlockMetadata) GetLevel added in v1.13.0

func (m *BlockMetadata) GetLevel() int64

type BlockOffset added in v1.12.0

type BlockOffset struct {
	Base   BlockID
	Offset int64
}

BlockOffset is a block addressing mode that uses relative addressing from a given base block.

func NewBlockOffset added in v1.12.0

func NewBlockOffset(id BlockID, n int64) BlockOffset

func (BlockOffset) Int64 added in v1.12.0

func (b BlockOffset) Int64() int64

func (BlockOffset) String added in v1.12.0

func (o BlockOffset) String() string

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 CallOptions added in v1.12.1

type CallOptions struct {
	Confirmations     int64         // number of confirmations to wait after broadcast
	MaxFee            int64         // max acceptable fee, optional (default = 0)
	TTL               int64         // max lifetime for operations in blocks
	IgnoreLimits      bool          // ignore simulated limits and use user-defined limits from op
	SimulationBlockID BlockID       // custom block id to simulate operation
	Signer            signer.Signer // optional signer interface to use for signing the transaction
	Sender            tezos.Address // optional address to sign for (use when signer manages multiple addresses)
	Observer          *Observer     // optional custom block observer for waiting on confirmations
}

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL
	// Base URL for IPFS requests.
	IpfsURL *url.URL
	// User agent name for client.
	UserAgent string
	// Optional API key for protected endpoints
	ApiKey string
	// The chain the client will query.
	ChainId tezos.ChainIdHash
	// The current chain configuration.
	Params *tezos.Params
	// An active event observer to watch for operation inclusion
	BlockObserver *Observer
	// An active event observer to watch for operation posting to the mempool
	MempoolObserver *Observer
	// A default signer used for transaction sending
	Signer signer.Signer
	// 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) Broadcast added in v1.12.0

func (c *Client) Broadcast(ctx context.Context, o *codec.Op) (tezos.OpHash, error)

Broadcast sends the signed operation to network and returns the operation hash on successful pre-validation.

func (*Client) BroadcastOperation added in v1.12.0

func (c *Client) BroadcastOperation(ctx context.Context, body []byte) (hash tezos.OpHash, err error)

BroadcastOperation sends a signed operation to the network (injection). The call returns the operation hash on success. If theoperation was rejected by the node error is of type RPCError.

func (*Client) Client added in v1.12.3

func (c *Client) Client() *http.Client

func (*Client) Close added in v1.12.0

func (c *Client) Close()

func (*Client) Complete added in v1.12.0

func (c *Client) Complete(ctx context.Context, o *codec.Op, key tezos.Key) error

Complete ensures an operation is compatible with the current source account's on-chain state. Sets branch for TTL control, replay counters, and reveals the sender's pubkey if not published yet.

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{}) 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) error

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

func (*Client) ForgeOperation added in v1.12.0

func (c *Client) ForgeOperation(ctx context.Context, id BlockID, body, resp interface{}) error

ForgeOperation uses a remote node to serialize an operation to its binary format. The result of this call SHOULD NEVER be used for signing the operation, it is only meant for validating the locally generated serialized output.

func (*Client) Get

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

func (*Client) GetActiveBigmapInfo added in v1.12.0

func (c *Client) GetActiveBigmapInfo(ctx context.Context, bigmap int64) (*BigmapInfo, error)

GetActiveBigmapInfo returns type and content info from bigmap at current head.

func (*Client) GetActiveBigmapValue added in v1.12.0

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

GetActiveBigmapValue returns current active value at key hash from bigmap.

func (*Client) GetAsync

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

func (*Client) GetBigmapInfo

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

GetBigmapInfo returns type and content info from bigmap at block id.

func (*Client) GetBigmapValue

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

GetBigmapValue returns value at key hash from bigmap at block id

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, id BlockID) (*Block, error)

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

func (*Client) GetBlockHash added in v1.12.0

func (c *Client) GetBlockHash(ctx context.Context, id BlockID) (hash tezos.BlockHash, err error)

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

func (*Client) GetBlockHeader

func (c *Client) GetBlockHeader(ctx context.Context, id BlockID) (*BlockHeader, error)

GetBlockHeader returns a block header. 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) GetBlockMetadata added in v1.13.0

func (c *Client) GetBlockMetadata(ctx context.Context, id BlockID) (*BlockMetadata, error)

GetBlockMetadata returns a block metadata. https://tezos.gitlab.io/mainnet/api/rpc.html#chains-chain-id-blocks

func (*Client) GetBlockOperation added in v1.12.0

func (c *Client) GetBlockOperation(ctx context.Context, id BlockID, l, n int) (*Operation, error)

GetBlockOperation returns information about a single validated Tezos operation group (i.e. a single operation or a batch of operations) at list l and position n https://tezos.gitlab.io/active/rpc.html#get-block-id-operations-list-offset-operation-offset

func (*Client) GetBlockOperationHash added in v1.12.0

func (c *Client) GetBlockOperationHash(ctx context.Context, id BlockID, l, n int) (tezos.OpHash, error)

GetBlockOperationHash returns a single operation hashes included in block https://tezos.gitlab.io/active/rpc.html#get-block-id-operation-hashes-list-offset-operation-offset

func (*Client) GetBlockOperationHashes added in v1.12.0

func (c *Client) GetBlockOperationHashes(ctx context.Context, id BlockID) ([][]tezos.OpHash, error)

GetBlockOperationHashes returns a list of list of operation hashes included in block https://tezos.gitlab.io/active/rpc.html#get-block-id-operation-hashes

func (*Client) GetBlockOperationList added in v1.12.0

func (c *Client) GetBlockOperationList(ctx context.Context, id BlockID, l int) ([]Operation, error)

GetBlockOperationList returns information about all validated Tezos operation group inside operation list l (i.e. validation pass) [0..3]. https://tezos.gitlab.io/active/rpc.html#get-block-id-operations-list-offset

func (*Client) GetBlockOperationListHashes added in v1.12.0

func (c *Client) GetBlockOperationListHashes(ctx context.Context, id BlockID, l int) ([]tezos.OpHash, error)

GetBlockOperationListHashes returns a list of operation hashes included in block at a specified list position (i.e. validation pass) [0..3] https://tezos.gitlab.io/active/rpc.html#get-block-id-operation-hashes-list-offset

func (*Client) GetBlockOperations added in v1.12.0

func (c *Client) GetBlockOperations(ctx context.Context, id BlockID) ([][]Operation, error)

GetBlockOperations returns information about all validated Tezos operation groups from all operation lists in block. https://tezos.gitlab.io/active/rpc.html#get-block-id-operations

func (*Client) GetBlockPredHashes

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

GetBlockPredHashes returns count parent blocks before block with given hash. https://tezos.gitlab.io/mainnet/api/rpc.html#get-chains-chain-id-blocks

func (*Client) GetChainId added in v1.12.0

func (c *Client) GetChainId(ctx context.Context) (tezos.ChainIdHash, error)

GetChainId returns the chain id (i.e. network id). https://tezos.gitlab.io/shell/rpc.html#get-chains-chain-id-chain-id

func (*Client) GetConstants

func (c *Client) GetConstants(ctx context.Context, id BlockID) (con Constants, err error)

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

func (*Client) GetContract added in v1.12.0

func (c *Client) GetContract(ctx context.Context, addr tezos.Address, id BlockID) (*ContractInfo, error)

GetContract returns info about an account at block id.

func (*Client) GetContractBalance

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

GetContractBalance returns the spendable balance for this account at block id.

func (*Client) GetContractEntrypoints

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

GetContractEntrypoints returns the contract's entrypoints.

func (*Client) GetContractExt added in v1.12.0

func (c *Client) GetContractExt(ctx context.Context, addr tezos.Address, id BlockID) (*ContractInfo, error)

GetContractExt returns info about an account at block id including its public key when revealed.

func (*Client) GetContractScript

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

GetContractScript returns the originated contract script in default data mode.

func (*Client) GetContractStorage

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

GetContractStorage returns the contract's storage at block id.

func (*Client) GetContractStorageNormalized added in v1.12.0

func (c *Client) GetContractStorageNormalized(ctx context.Context, addr tezos.Address, id BlockID, mode UnparsingMode) (micheline.Prim, error)

GetContractStorageNormalized returns contract's storage at block id using unparsing mode.

func (*Client) GetDelegate added in v1.12.0

func (c *Client) GetDelegate(ctx context.Context, addr tezos.Address, id BlockID) (*Delegate, error)

GetDelegate returns information about a delegate at a specific height.

func (*Client) GetDelegateBalance

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

GetDelegateBalance returns a delegate's balance

func (*Client) GetGenesisBlock added in v0.10.0

func (c *Client) GetGenesisBlock(ctx context.Context) (*Block, error)

GetGenesisBlock returns main chain genesis block. https://tezos.gitlab.io/mainnet/api/rpc.html#chains-chain-id-blocks

func (*Client) GetHeadBlock added in v0.10.0

func (c *Client) GetHeadBlock(ctx context.Context) (*Block, error)

GetHeadBlock returns the chain's head block. https://tezos.gitlab.io/mainnet/api/rpc.html#chains-chain-id-blocks

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) GetManagerKey added in v1.12.0

func (c *Client) GetManagerKey(ctx context.Context, addr tezos.Address, id BlockID) (tezos.Key, error)

GetManagerKey returns the revealed public key of an account at block id.

func (*Client) GetMempool added in v1.12.0

func (c *Client) GetMempool(ctx context.Context) (*Mempool, error)

GetMempool 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) GetNormalizedScript added in v1.12.0

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

GetNormalizedScript returns the originated contract script with global constants expanded using given unparsing mode.

func (*Client) GetParams added in v1.12.0

func (c *Client) GetParams(ctx context.Context, id BlockID) (*tezos.Params, error)

GetParams returns a translated parameters structure for the current network at block id.

func (*Client) GetRollSnapshotInfoCycle added in v1.12.0

func (c *Client) GetRollSnapshotInfoCycle(ctx context.Context, id BlockID, cycle int64) (*RollSnapshotInfo, error)

GetRollSnapshotInfoCycle returns information about a roll snapshot as seen from block id. Note block and cycle must be no further than preserved cycles away.

func (*Client) GetSnapshotIndexCycle

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

GetSnapshotIndexCycle returns information about a roll or staking snapshot that produced rights at cycle. Note block and cycle must be no further than preserved cycles away.

func (*Client) GetStakingSnapshotInfoCycle added in v1.12.0

func (c *Client) GetStakingSnapshotInfoCycle(ctx context.Context, id BlockID, cycle int64) (*StakingSnapshotInfo, error)

GetStakingSnapshotInfoCycle returns information about a roll snapshot as seen from block id. Note block and cycle must be no further than preserved cycles away.

func (*Client) GetStatus added in v1.12.0

func (c *Client) GetStatus(ctx context.Context) (Status, error)

GetStatus returns whether the node is bootstrapped (i.e. has downloaded the full chain) and in sync. https://tezos.gitlab.io/shell/rpc.html#get-chains-chain-id-is-bootstrapped

func (*Client) GetTipHeader

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

GetTipHeader returns the head block's 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) GetVersionInfo added in v1.12.0

func (c *Client) GetVersionInfo(ctx context.Context) (VersionInfo, error)

GetVersion returns node's version info. https://tezos.gitlab.io/shell/rpc.html#get-version

func (*Client) GetVoteProposal

func (c *Client) GetVoteProposal(ctx context.Context, id BlockID) (tezos.ProtocolHash, error)

GetVoteProposal returns the hash of the current voring proposal at block id.

func (*Client) GetVoteQuorum

func (c *Client) GetVoteQuorum(ctx context.Context, id BlockID) (int, error)

GetVoteQuorum returns information about the current voring quorum at block id. Returned value is percent * 10000 i.e. 5820 for 58.20%.

func (*Client) GetVoteResult

func (c *Client) GetVoteResult(ctx context.Context, id BlockID) (BallotSummary, error)

GetVoteResult returns a summary of the current voting result at block id.

func (*Client) Init added in v1.12.0

func (c *Client) Init(ctx context.Context) error

func (*Client) ListActiveBigmapKeys added in v1.12.0

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

ListActiveBigmapKeys returns all active keys in the bigmap. This call may be very SLOW for large bigmaps and there is no means to limit the result. Use with caution and consider calling an indexer API instead.

func (*Client) ListActiveBigmapValues added in v1.12.0

func (c *Client) ListActiveBigmapValues(ctx context.Context, bigmap int64, id BlockID) ([]micheline.Prim, error)

ListActiveBigmapValues returns all values from bigmap at block id. This call may be very SLOW for large bigmaps and there is no means to limit the result. Use with caution and consider calling an indexer API instead.

func (*Client) ListActiveDelegates

func (c *Client) ListActiveDelegates(ctx context.Context, id BlockID) (DelegateList, error)

ListActiveDelegates returns information about all active delegates at a block.

func (*Client) ListBakingRights added in v1.12.0

func (c *Client) ListBakingRights(ctx context.Context, id BlockID, max int) ([]BakingRight, error)

ListBakingRights returns information about baking rights at block id. Use max to set a max block priority (before Ithaca) or a max round (after Ithaca).

func (*Client) ListBakingRightsCycle added in v1.12.0

func (c *Client) ListBakingRightsCycle(ctx context.Context, id BlockID, cycle int64, max int) ([]BakingRight, error)

ListBakingRightsCycle returns information about baking rights for an entire cycle as seen from block id. Note block and cycle must be no further than preserved cycles away from each other. Use max to set a max block priority (before Ithaca) or a max round (after Ithaca).

func (*Client) ListBallots

func (c *Client) ListBallots(ctx context.Context, id BlockID) (BallotList, error)

ListBallots returns information about all eligible voters for an election at block id.

func (*Client) ListBigmapKeys added in v1.12.0

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

ListBigmapKeys returns all keys in the bigmap at block id. This call may be very SLOW for large bigmaps and there is no means to limit the result. Use with caution and consider calling an indexer API instead.

func (*Client) ListBigmapValues added in v1.12.0

func (c *Client) ListBigmapValues(ctx context.Context, bigmap int64, id BlockID) ([]micheline.Prim, error)

ListBigmapValues returns all values from bigmap at block id. This call may be very SLOW for large bigmaps and there is no means to limit the result. Use with caution and consider calling an indexer API instead.

func (*Client) ListContracts added in v1.12.0

func (c *Client) ListContracts(ctx context.Context, id BlockID) (Contracts, error)

ListContracts returns a list of all known contracts at head. This call may be very SLOW for large chains and there is no means to limit the result. Use with caution and consider calling an indexer API instead.

func (*Client) ListEndorsingRights added in v1.12.0

func (c *Client) ListEndorsingRights(ctx context.Context, id BlockID) ([]EndorsingRight, error)

ListEndorsingRights returns information about block endorsing rights.

func (*Client) ListEndorsingRightsCycle added in v1.12.0

func (c *Client) ListEndorsingRightsCycle(ctx context.Context, id BlockID, cycle int64) ([]EndorsingRight, error)

ListEndorsingRightsCycle returns information about endorsing rights for an entire cycle as seen from block id. Note block and cycle must be no further than preserved cycles away.

func (*Client) ListProposals

func (c *Client) ListProposals(ctx context.Context, id BlockID) (ProposalList, error)

ListProposals returns a list of all submitted proposals and their upvote count at block id. This call only returns results when block is within a proposal vote period.

func (*Client) ListSnapshotRollOwners added in v1.12.0

func (c *Client) ListSnapshotRollOwners(ctx context.Context, id BlockID, cycle, index int64) (*SnapshotOwners, error)

ListSnapshotRollOwners returns information about a roll snapshot ownership. Response is a nested array `[[roll_id, pubkey]]`. Deprecated in Ithaca.

func (*Client) ListVoters

func (c *Client) ListVoters(ctx context.Context, id BlockID) (VoterList, error)

ListVoters returns information about all eligible voters for an election at block id.

func (*Client) Listen added in v1.12.0

func (c *Client) Listen()

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) MonitorMempool added in v1.12.0

func (c *Client) MonitorMempool(ctx context.Context, monitor *MempoolMonitor) error

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

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) Post added in v1.12.0

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

func (*Client) Put

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

func (*Client) ResolveChainConfig added in v1.12.0

func (c *Client) ResolveChainConfig(ctx context.Context) error

func (*Client) RunCode added in v1.12.0

func (c *Client) RunCode(ctx context.Context, id BlockID, body, resp interface{}) error

RunCode simulates executing of provided code on the context of a contract at selected block.

func (*Client) RunOperation added in v1.12.0

func (c *Client) RunOperation(ctx context.Context, id BlockID, body, resp interface{}) error

RunOperation simulates executing an operation without requiring a valid signature. The call returns the execution result as regular operation receipt.

func (*Client) RunView added in v1.12.0

func (c *Client) RunView(ctx context.Context, id BlockID, body, resp interface{}) error

RunView simulates executing of on on-chain view on the context of a contract at selected block.

func (*Client) Send added in v1.12.1

func (c *Client) Send(ctx context.Context, op *codec.Op, opts *CallOptions) (*Receipt, error)

Send is a convenience wrapper for sending operations. It auto-completes gas and storage limit, ensures minimum fees are set, protects against fee overpayment, signs and broadcasts the final operation and waits for a defined number of confirmations.

func (*Client) Simulate added in v1.12.0

func (c *Client) Simulate(ctx context.Context, o *codec.Op, opts *CallOptions) (*Receipt, error)

Simulate dry-runs the execution of the operation against the current state of a Tezos node in order to estimate execution costs and fees (fee/burn/gas/storage).

func (*Client) TraceCode added in v1.12.0

func (c *Client) TraceCode(ctx context.Context, id BlockID, body, resp interface{}) error

TraceCode simulates executing of code on the context of a contract at selected block and returns a full execution trace.

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

func (*Client) UseIpfsUrl added in v1.13.0

func (c *Client) UseIpfsUrl(uri string) error

func (*Client) Validate added in v1.12.0

func (c *Client) Validate(ctx context.Context, o *codec.Op) error

Validate compares local serializiation against remote RPC serialization of the operation and returns an error on mismatch.

type CommitInfo added in v1.12.0

type CommitInfo struct {
	CommitHash string `json:"commit_hash"`
	CommitDate string `json:"commit_date"`
}

type ConnVersion added in v1.12.0

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

ConnVersion models a network-layer version of a node.

type ConstantRegistration added in v1.12.0

type ConstantRegistration struct {
	Manager
	Value micheline.Prim `json:"value,omitempty"`
}

ConstantRegistration represents a global constant registration operation

func (ConstantRegistration) Costs added in v1.12.0

func (c ConstantRegistration) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

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

	// New in v10
	LiquidityBakingEscapeEmaThreshold int64 `json:"liquidity_baking_escape_ema_threshold"`
	LiquidityBakingSubsidy            int64 `json:"liquidity_baking_subsidy,string"`
	LiquidityBakingSunsetLevel        int64 `json:"liquidity_baking_sunset_level"`
	MinimalBlockDelay                 int   `json:"minimal_block_delay,string"`

	// New in v11
	MaxMichelineNodeCount          int      `json:"max_micheline_node_count"`
	MaxMichelineBytesLimit         int      `json:"max_micheline_bytes_limit"`
	MaxAllowedGlobalConstantsDepth int      `json:"max_allowed_global_constants_depth"`
	CacheLayout                    []string `json:"cache_layout"`

	// New in v12
	BlocksPerStakeSnapshot                           int64       `json:"blocks_per_stake_snapshot"`
	BakingRewardFixedPortion                         int64       `json:"baking_reward_fixed_portion,string"`
	BakingRewardBonusPerSlot                         int64       `json:"baking_reward_bonus_per_slot,string"`
	EndorsingRewardPerSlot                           int64       `json:"endorsing_reward_per_slot,string"`
	MaxOperationsTimeToLive                          int64       `json:"max_operations_time_to_live"`
	DelayIncrementPerRound                           int         `json:"delay_increment_per_round,string"`
	ConsensusCommitteeSize                           int         `json:"consensus_committee_size"`
	ConsensusThreshold                               int         `json:"consensus_threshold"`
	MinimalParticipationRatio                        tezos.Ratio `json:"minimal_participation_ratio"`
	MaxSlashingPeriod                                int64       `json:"max_slashing_period"`
	FrozenDepositsPercentage                         int         `json:"frozen_deposits_percentage"`
	DoubleBakingPunishment                           int64       `json:"double_baking_punishment,string"`
	RatioOfFrozenDepositsSlashedPerDoubleEndorsement tezos.Ratio `json:"ratio_of_frozen_deposits_slashed_per_double_endorsement"`

	// New in v13
	CyclesPerVotingPeriod int64 `json:"cycles_per_voting_period"`
}

func (Constants) GetBlockReward

func (c Constants) GetBlockReward() int64

func (Constants) GetEndorsementReward

func (c Constants) GetEndorsementReward() int64

func (Constants) HaveV12Rewards added in v1.12.0

func (c Constants) HaveV12Rewards() bool

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 ContractInfo added in v1.12.0

type ContractInfo struct {
	Balance  int64         `json:"balance,string"`
	Delegate tezos.Address `json:"delegate"`
	Counter  int64         `json:"counter,string"`
	Manager  string        `json:"manager"`
}

Contracts holds info about a Tezos account

func (ContractInfo) IsRevealed added in v1.12.0

func (i ContractInfo) IsRevealed() bool

func (ContractInfo) ManagerKey added in v1.12.0

func (i ContractInfo) ManagerKey() tezos.Key

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 {
	// extra info
	Delegate tezos.Address `json:"-"`
	Height   int64         `json:"-"`
	Block    string        `json:"-"`

	// tezos data
	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"`
	DelegatedBalance     int64           `json:"delegated_balance,string"`
	VotingPower          Int64orString   `json:"voting_power"`

	// v012+
	FullBalance           int64 `json:"full_balance,string"`
	FrozenDeposits        int64 `json:"frozen_deposits,string"`
	CurrentFrozenDeposits int64 `json:"current_frozen_deposits,string"`
	FrozenDepositsLimit   int64 `json:"frozen_deposits_limit,string"`
}

Delegate holds information about an active delegate

type DelegateList

type DelegateList []tezos.Address

DelegateList contains a list of delegates

type Delegation added in v1.12.0

type Delegation struct {
	Manager
	Delegate tezos.Address `json:"delegate,omitempty"`
}

Delegation represents a transaction operation

func (Delegation) Costs added in v1.12.0

func (d Delegation) Costs() tezos.Costs

Cost returns operation cost to implement TypedOperation interface.

type DoubleBaking added in v1.12.0

type DoubleBaking struct {
	Generic
	BH1 BlockHeader `json:"bh1"`
	BH2 BlockHeader `json:"bh2"`
}

DoubleBaking represents a double_baking_evidence operation

func (DoubleBaking) Costs added in v1.12.0

func (d DoubleBaking) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type DoubleEndorsement added in v1.12.0

type DoubleEndorsement struct {
	Generic
	OP1 InlinedEndorsement `json:"op1"`
	OP2 InlinedEndorsement `json:"op2"`
}

DoubleEndorsement represents a double_endorsement_evidence operation

func (DoubleEndorsement) Costs added in v1.12.0

func (d DoubleEndorsement) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type Endorsement added in v1.12.0

type Endorsement struct {
	Generic
	Level       int64               `json:"level"`                 // <= v008, v012+
	Endorsement *InlinedEndorsement `json:"endorsement,omitempty"` // v009+
	Slot        int                 `json:"slot"`                  // v009+
	Round       int                 `json:"round"`                 // v012+
	PayloadHash tezos.PayloadHash   `json:"block_payload_hash"`    // v012+
}

Endorsement represents an endorsement operation

func (Endorsement) GetLevel added in v1.12.0

func (e Endorsement) GetLevel() int64

type EndorsingRight

type EndorsingRight struct {
	Delegate       tezos.Address `json:"delegate"`
	Level          int64         `json:"level"`
	EstimatedTime  time.Time     `json:"estimated_time"`
	Slots          []int         `json:"slots,omitempty"` // until v011
	FirstSlot      int           `json:"first_slot"`      // v012+
	EndorsingPower int           `json:"endorsing_power"` // v012+
}

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

func (EndorsingRight) Address

func (r EndorsingRight) Address() tezos.Address

func (EndorsingRight) Power added in v1.12.0

func (r EndorsingRight) Power() int

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 Generic added in v1.12.0

type Generic struct {
	OpKind   tezos.OpType      `json:"kind"`
	Metadata OperationMetadata `json:"metadata"`
}

Generic is the most generic operation type.

func (Generic) Costs added in v1.12.0

func (e Generic) Costs() tezos.Costs

Costs returns empty operation costs to implement TypedOperation interface.

func (Generic) Kind added in v1.12.0

func (e Generic) Kind() tezos.OpType

Kind returns the operation's type. Implements TypedOperation interface.

func (Generic) Limits added in v1.12.0

func (e Generic) Limits() tezos.Limits

Limits returns empty operation limits to implement TypedOperation interface.

func (Generic) Meta added in v1.12.0

func (e Generic) Meta() OperationMetadata

Meta returns an empty operation metadata to implement TypedOperation interface.

func (Generic) Result added in v1.12.0

func (e Generic) Result() OperationResult

Result returns an empty operation result to implement TypedOperation interface.

type GenericError

type GenericError struct {
	ID   string         `json:"id"`
	Kind string         `json:"kind"`
	With micheline.Prim `json:"with"`
}

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 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 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 ImplicitResult added in v0.10.0

type ImplicitResult struct {
	Kind                tezos.OpType      `json:"kind"`
	BalanceUpdates      BalanceUpdates    `json:"balance_updates"`
	ConsumedGas         int64             `json:"consumed_gas,string"`
	ConsumedMilliGas    int64             `json:"consumed_milligas,string"`
	Storage             *micheline.Prim   `json:"storage,omitempty"`
	StorageSize         int64             `json:"storage_size,string"`
	OriginatedContracts []tezos.Address   `json:"originated_contracts,omitempty"`
	PaidStorageSizeDiff int64             `json:"paid_storage_size_diff,string"`
	Script              *micheline.Script `json:"script,omitempty"`
}

found in block metadata from v010+

func (ImplicitResult) Gas added in v1.13.0

func (r ImplicitResult) Gas() int64

func (ImplicitResult) MilliGas added in v1.13.0

func (r ImplicitResult) MilliGas() int64

type InlinedEndorsement added in v1.12.0

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

InlinedEndorsement represents and embedded endorsement

type Int64orString added in v1.13.0

type Int64orString int64

func (Int64orString) Int64 added in v1.13.0

func (i Int64orString) Int64() int64

func (Int64orString) MarshalJSON added in v1.13.0

func (i Int64orString) MarshalJSON() ([]byte, error)

func (Int64orString) String added in v1.13.0

func (i Int64orString) String() string

func (*Int64orString) UnmarshalJSON added in v1.13.0

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

type InternalResult

type InternalResult struct {
	Kind        tezos.OpType          `json:"kind"`
	Source      tezos.Address         `json:"source"`
	Nonce       int64                 `json:"nonce"`
	Result      OperationResult       `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 LevelInfo added in v1.12.0

type LevelInfo 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 Manager added in v1.12.0

type Manager struct {
	Generic
	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"`
}

Manager represents data common for all manager operations.

func (Manager) Limits added in v1.12.0

func (e Manager) Limits() tezos.Limits

Limits returns manager operation limits to implement TypedOperation interface.

type Mempool added in v1.12.0

type Mempool struct {
	Applied       []*Operation `json:"applied"`
	Refused       []*Operation `json:"refused"`
	Outdated      []*Operation `json:"outdated"` // v012+
	BranchRefused []*Operation `json:"branch_refused"`
	BranchDelayed []*Operation `json:"branch_delayed"`
	Unprocessed   []*Operation `json:"unprocessed"`
}

Mempool represents mempool operations

func (*Mempool) UnmarshalJSON added in v1.12.0

func (m *Mempool) UnmarshalJSON(data []byte) error

type MempoolMonitor added in v1.12.0

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

MempoolMonitor is a monitor for the Tezos mempool. Note that the connection resets every time a new head is attached to the chain. MempoolMonitor is closed with an error in this case and cannot be reused after close.

The Tezos mempool re-evaluates all operations and potentially updates their state when the head block changes. This applies to operations in lists branch_delayed and branch_refused. After reorg, operations already included in a previous block may enter the mempool again.

func NewMempoolMonitor added in v1.12.0

func NewMempoolMonitor() *MempoolMonitor

func (*MempoolMonitor) Close added in v1.12.0

func (m *MempoolMonitor) Close()

func (*MempoolMonitor) Closed added in v1.12.0

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

func (*MempoolMonitor) Err added in v1.12.0

func (m *MempoolMonitor) Err(err error)

func (*MempoolMonitor) New added in v1.12.0

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

func (*MempoolMonitor) Recv added in v1.12.0

func (m *MempoolMonitor) Recv(ctx context.Context) ([]*Operation, error)

func (*MempoolMonitor) Send added in v1.12.0

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

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         []*ConnVersion  `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 {
	ChainName            string `json:"chain_name"`
	DistributedDbVersion int    `json:"distributed_db_version"`
	P2pVersion           int    `json:"p2p_version"`
}

type NodeVersion added in v1.12.0

type NodeVersion struct {
	Major          int    `json:"major"`
	Minor          int    `json:"minor"`
	AdditionalInfo string `json:"additional_info"`
}

type Observer added in v1.12.0

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

func NewObserver added in v1.12.0

func NewObserver() *Observer

func (*Observer) Close added in v1.12.0

func (m *Observer) Close()

func (*Observer) Listen added in v1.12.0

func (m *Observer) Listen(cli *Client)

func (*Observer) ListenMempool added in v1.12.0

func (m *Observer) ListenMempool(cli *Client)

func (*Observer) Subscribe added in v1.12.0

func (m *Observer) Subscribe(oh tezos.OpHash, cb ObserverCallback) int

func (*Observer) Unsubscribe added in v1.12.0

func (m *Observer) Unsubscribe(id int)

func (*Observer) WithDelay added in v1.12.0

func (m *Observer) WithDelay(minDelay time.Duration) *Observer

type ObserverCallback added in v1.12.0

type ObserverCallback func(tezos.BlockHash, int, int, bool) bool

type Operation

type Operation struct {
	Protocol  tezos.ProtocolHash `json:"protocol"`
	ChainID   tezos.ChainIdHash  `json:"chain_id"`
	Hash      tezos.OpHash       `json:"hash"`
	Branch    tezos.BlockHash    `json:"branch"`
	Contents  OperationList      `json:"contents"`
	Signature tezos.Signature    `json:"signature"`
	Errors    []OperationError   `json:"error,omitempty"` // mempool only
}

Operation represents a single operation or batch of operations included in a block

func (Operation) Costs added in v1.12.0

func (o Operation) Costs() []tezos.Costs

Costs returns ta list of individual costs for all batched operations.

func (Operation) TotalCosts added in v1.12.0

func (o Operation) TotalCosts() tezos.Costs

TotalCosts returns the sum of costs across all batched and internal operations.

type OperationError

type OperationError struct {
	GenericError
	Contract *tezos.Address  `json:"contract,omitempty"`
	Raw      json.RawMessage `json:"-"`
}

OperationError represents data describing an error conditon that lead to a failed operation execution.

func (OperationError) MarshalJSON added in v1.12.0

func (o OperationError) MarshalJSON() ([]byte, error)

func (*OperationError) UnmarshalJSON added in v1.12.0

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

type OperationList added in v1.12.0

type OperationList []TypedOperation

OperationList is a slice of TypedOperation (interface type) with custom JSON unmarshaller

func (OperationList) Contains added in v1.12.0

func (o OperationList) Contains(typ tezos.OpType) bool

Contains returns true when the list contains an operation of kind typ.

func (OperationList) Len added in v1.12.1

func (o OperationList) Len() int

func (OperationList) N added in v1.12.1

func (OperationList) Select added in v1.12.0

func (o OperationList) Select(typ tezos.OpType, n int) TypedOperation

func (*OperationList) UnmarshalJSON added in v1.12.0

func (e *OperationList) 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 OperationMetadata added in v1.12.0

type OperationMetadata struct {
	BalanceUpdates BalanceUpdates  `json:"balance_updates"` // fee-related
	Result         OperationResult `json:"operation_result"`

	// transaction only
	InternalResults []*InternalResult `json:"internal_operation_results,omitempty"`

	// endorsement only
	Delegate            tezos.Address `json:"delegate"`
	Slots               []int         `json:"slots,omitempty"`
	EndorsementPower    int           `json:"endorsement_power,omitempty"`    // v12+
	PreendorsementPower int           `json:"preendorsement_power,omitempty"` // v12+

	// some rollup ops only
	Level int64 `json:"level"`
}

OperationMetadata contains execution receipts for successful and failed operations.

func (OperationMetadata) Address added in v1.12.0

func (m OperationMetadata) Address() tezos.Address

Address returns the delegate address for endorsements.

type OperationResult added in v1.12.0

type OperationResult struct {
	Status              tezos.OpStatus   `json:"status"`
	BalanceUpdates      BalanceUpdates   `json:"balance_updates"` // burn, etc
	ConsumedGas         int64            `json:"consumed_gas,string"`
	ConsumedMilliGas    int64            `json:"consumed_milligas,string"` // v007+
	Errors              []OperationError `json:"errors,omitempty"`
	Allocated           bool             `json:"allocated_destination_contract"` // tx only
	Storage             *micheline.Prim  `json:"storage,omitempty"`              // tx, orig
	OriginatedContracts []tezos.Address  `json:"originated_contracts"`           // orig only
	StorageSize         int64            `json:"storage_size,string"`            // tx, orig, const
	PaidStorageSizeDiff int64            `json:"paid_storage_size_diff,string"`  // tx, orig
	BigmapDiff          json.RawMessage  `json:"big_map_diff,omitempty"`         // tx, orig, <v013
	LazyStorageDiff     json.RawMessage  `json:"lazy_storage_diff,omitempty"`    // v008+ tx, orig
	GlobalAddress       tezos.ExprHash   `json:"global_address"`                 // const
	OriginatedRollup    tezos.Address    `json:"originated_rollup"`              // v013
}

OperationResult contains receipts for executed operations, both success and failed. This type is a generic container for all possible results. Which fields are actually used depends on operation type and performed actions.

func (OperationResult) BigmapEvents added in v1.13.0

func (r OperationResult) BigmapEvents() micheline.BigmapEvents

func (OperationResult) Gas added in v1.13.0

func (r OperationResult) Gas() int64

func (OperationResult) IsSuccess added in v1.12.1

func (r OperationResult) IsSuccess() bool

func (OperationResult) MilliGas added in v1.13.0

func (r OperationResult) MilliGas() int64

type Origination added in v1.12.0

type Origination struct {
	Manager
	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"`
}

Origination represents a contract creation operation

func (Origination) Costs added in v1.12.0

func (o Origination) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

func (Origination) ManagerAddress added in v1.12.0

func (o Origination) ManagerAddress() tezos.Address

type PendingOperation added in v1.12.0

type PendingOperation Operation

func (PendingOperation) MarshalJSON added in v1.12.0

func (o PendingOperation) MarshalJSON() ([]byte, error)

func (*PendingOperation) UnmarshalJSON added in v1.12.0

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

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 Proposals added in v1.12.0

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

Proposals 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 Receipt added in v1.12.0

type Receipt struct {
	Block tezos.BlockHash
	List  int
	Pos   int
	Op    *Operation
}

func (*Receipt) Costs added in v1.12.0

func (r *Receipt) Costs() []tezos.Costs

Costs returns a list of individual costs for all batched operations.

func (*Receipt) Error added in v1.12.1

func (r *Receipt) Error() error

Error returns the first execution error found in this operation group or one of its internal results that is of status failed. This helper only exports the error as GenericError. To access error details or all errors, visit r.Op.Contents[].OperationResult.Errors[] and r.Op.Contents[].Metadata.InternalResults.Result.Errors[]

func (*Receipt) IsSuccess added in v1.12.1

func (r *Receipt) IsSuccess() bool

IsSuccess returns true when all operations in this group have been applied successfully.

func (*Receipt) MinLimits added in v1.12.1

func (r *Receipt) MinLimits() []tezos.Limits

MinLimits returns a list of individual operation costs mapped to limits for use in simulation results. Fee is reset to zero to prevent higher simulation fee from spilling over into real fees paid.

func (*Receipt) TotalCosts added in v1.12.0

func (r *Receipt) TotalCosts() tezos.Costs

TotalCosts returns the sum of costs across all batched and internal operations.

type Result added in v1.12.0

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

func NewResult added in v1.12.0

func NewResult(oh tezos.OpHash) *Result

func (*Result) Cancel added in v1.12.0

func (r *Result) Cancel()

func (*Result) Confirmations added in v1.12.0

func (r *Result) Confirmations() int64

func (*Result) Done added in v1.12.0

func (r *Result) Done() <-chan struct{}

func (*Result) Err added in v1.12.0

func (r *Result) Err() error

func (*Result) GetReceipt added in v1.12.0

func (r *Result) GetReceipt(ctx context.Context) (*Receipt, error)

func (*Result) Hash added in v1.12.0

func (r *Result) Hash() tezos.OpHash

func (*Result) Listen added in v1.12.0

func (r *Result) Listen(o *Observer)

func (*Result) Wait added in v1.12.0

func (r *Result) Wait()

func (*Result) WaitContext added in v1.12.0

func (r *Result) WaitContext(ctx context.Context)

func (*Result) WithConfirmations added in v1.12.0

func (r *Result) WithConfirmations(n int64) *Result

func (*Result) WithTTL added in v1.12.0

func (r *Result) WithTTL(n int64) *Result

type Reveal added in v1.12.0

type Reveal struct {
	Manager
	PublicKey tezos.Key `json:"public_key"`
}

Reveal represents a reveal operation

func (Reveal) Costs added in v1.12.0

func (r Reveal) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type RollSnapshotInfo added in v1.12.0

type RollSnapshotInfo struct {
	LastRoll     []string `json:"last_roll"`
	Nonces       []string `json:"nonces"`
	RandomSeed   string   `json:"random_seed"`
	RollSnapshot int      `json:"roll_snapshot"`
}

type Rollup added in v1.13.0

type Rollup struct {
	// common
	Manager

	// rollup address (used by most ops)
	Rollup tezos.Address `json:"rollup"`

	// transfer_ticket contents
	Transfer TransferTicket `json:"-"`

	// tx_rollup_submit_batch
	Batch RollupBatch `json:"-"`

	// tx_rollup_rejection
	Reject RollupRejection `json:"-"`

	// tx_rollup_dispatch_tickets
	Dispatch RollupDispatch `json:"-"`

	// tx_rollup_commit
	Commit RollupCommit `json:"commitment"`
}

Rollup represents any kind of rollup operation

func (*Rollup) Target added in v1.13.0

func (r *Rollup) Target() tezos.Address

func (*Rollup) UnmarshalJSON added in v1.13.0

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

type RollupBatch added in v1.13.0

type RollupBatch struct {
	Content tezos.HexBytes `json:"content"`
}

type RollupCommit added in v1.13.0

type RollupCommit struct {
	Level           int64        `json:"level"`
	Messages        []tezos.Hash `json:"messages"`
	Predecessor     *tezos.Hash  `json:"predecessor,omitempty"`
	InboxMerkleRoot tezos.Hash   `json:"inbox_merkle_root"`
}

type RollupDispatch added in v1.13.0

type RollupDispatch struct {
	Level        int64           `json:"level"`
	TxRollup     tezos.Address   `json:"tx_rollup"`
	ContextHash  tezos.Hash      `json:"context_hash"`
	MessageIndex int64           `json:"message_index"`
	TicketsInfo  json.RawMessage `json:"tickets_info"`
}

type RollupRejection added in v1.13.0

type RollupRejection struct {
	Level                     int64           `json:"level"`
	Message                   json.RawMessage `json:"commitment,omitempty"`
	MessagePosition           tezos.Z         `json:"message_position"`
	MessagePath               []tezos.Hash    `json:"message_path,omitempty"`
	MessageResultHash         tezos.Hash      `json:"message_result_hash"`
	MessageResultPath         []tezos.Hash    `json:"message_result_path,omitempty"`
	PreviousMessageResult     json.RawMessage `json:"previous_message_result,omitempty"`
	PreviousMessageResultPath []tezos.Hash    `json:"previous_message_result_path,omitempty"`
	Proof                     json.RawMessage `json:"proof,omitempty"`
}

type RunCodeRequest added in v1.12.3

type RunCodeRequest struct {
	ChainId    tezos.ChainIdHash `json:"chain_id"`
	Script     micheline.Code    `json:"script"`
	Storage    micheline.Prim    `json:"storage"`
	Input      micheline.Prim    `json:"input"`
	Amount     tezos.N           `json:"amount"`
	Balance    tezos.N           `json:"balance"`
	Source     *tezos.Address    `json:"source,omitempty"`
	Payer      *tezos.Address    `json:"payer,omitempty"`
	Gas        *tezos.N          `json:"gas,omitempty"`
	Entrypoint string            `json:"entrypoint,omitempty"`
}

type RunCodeResponse added in v1.12.3

type RunCodeResponse struct {
	Operations      []Operation            `json:"operations"`
	Storage         micheline.Prim         `json:"storage"`
	BigmapDiff      micheline.BigmapEvents `json:"big_map_diff,omitempty"`
	LazyStorageDiff micheline.LazyEvents   `json:"lazy_storage_diff,omitempty"`
}

RunCodeResponse -

type RunOperationRequest added in v1.12.0

type RunOperationRequest struct {
	Operation *codec.Op         `json:"operation"`
	ChainId   tezos.ChainIdHash `json:"chain_id"`
}

type RunViewRequest added in v1.12.0

type RunViewRequest struct {
	Contract   tezos.Address     `json:"contract"`
	Entrypoint string            `json:"entrypoint"`
	Input      micheline.Prim    `json:"input"`
	ChainId    tezos.ChainIdHash `json:"chain_id"`
	Source     tezos.Address     `json:"source"`
	Payer      tezos.Address     `json:"payer"`
	Gas        tezos.N           `json:"gas"`
	Mode       string            `json:"unparsing_mode"` // "Readable" | "Optimized"
}

type RunViewResponse added in v1.12.0

type RunViewResponse struct {
	Data micheline.Prim `json:"data"`
}

type SeedNonce added in v1.12.0

type SeedNonce struct {
	Generic
	Level int64          `json:"level"`
	Nonce tezos.HexBytes `json:"nonce"`
}

SeedNonce represents a seed_nonce_revelation operation

type SetDepositsLimit added in v1.12.0

type SetDepositsLimit struct {
	Manager
	Limit    int64             `json:"limit,string"`
	Metadata OperationMetadata `json:"metadata"`
}

SetDepositsLimit represents a baker deposit limit update operation.

func (SetDepositsLimit) Costs added in v1.12.0

func (r SetDepositsLimit) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

func (SetDepositsLimit) Meta added in v1.12.0

Meta returns operation metadata to implement TypedOperation interface.

func (SetDepositsLimit) Result added in v1.12.0

func (r SetDepositsLimit) Result() OperationResult

Result returns operation result to implement TypedOperation interface.

type SnapshotIndex

type SnapshotIndex struct {
	Cycle int64 // the requested cycle that contains rights from the snapshot
	Base  int64 // the cycle where the snapshot happened
	Index int   // the index inside base where snapshot happened
}

type SnapshotOwners

type SnapshotOwners struct {
	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 StakeInfo added in v1.12.0

type StakeInfo struct {
	ActiveStake int64         `json:"active_stake,string"`
	Baker       tezos.Address `json:"baker"`
}

type StakingSnapshotInfo added in v1.12.0

type StakingSnapshotInfo struct {
	Nonces           []string    `json:"nonces"`
	RandomSeed       string      `json:"random_seed"`
	BakerStake       []StakeInfo `json:"selected_stake_distribution,omitempty"`
	TotalActiveStake int64       `json:"total_active_stake,string"`
}

v012+

type Status added in v1.12.0

type Status struct {
	Bootstrapped bool   `json:"bootstrapped"`
	SyncState    string `json:"sync_state"`
}

type Transaction added in v1.12.0

type Transaction struct {
	Manager
	Destination tezos.Address         `json:"destination"`
	Amount      int64                 `json:"amount,string"`
	Parameters  *micheline.Parameters `json:"parameters,omitempty"`
}

Transaction represents a transaction operation

func (Transaction) Costs added in v1.12.0

func (t Transaction) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type TransferTicket added in v1.13.0

type TransferTicket struct {
	Destination tezos.Address  `json:"destination"`
	Entrypoint  string         `json:"entrypoint"`
	Type        micheline.Prim `json:"ticket_ty"`
	Contents    micheline.Prim `json:"ticket_contents"`
	Ticketer    tezos.Address  `json:"ticket_ticketer"`
	Amount      tezos.Z        `json:"ticket_amount"`
}

type TypedOperation added in v1.12.0

type TypedOperation interface {
	Kind() tezos.OpType
	Meta() OperationMetadata
	Result() OperationResult
	Costs() tezos.Costs
	Limits() tezos.Limits
}

TypedOperation must be implemented by all operations

type UnparsingMode added in v1.12.0

type UnparsingMode string

UnparsingMode defines the way types and values are represented in Micheline script and storage. This affects timestamps, keys, addresses, signatures and nested pairs. Optimized encodings use integers for timestamps and bytes instead of base58 encoded values. Legacy mode is supposed to output 2-ary pairs only, but is messed up on certain endpoints (e.g. /script/normalized), so there's no guarantee.

func (UnparsingMode) String added in v1.12.0

func (m UnparsingMode) String() string

type VersionInfo added in v1.12.0

type VersionInfo struct {
	NodeVersion    NodeVersion    `json:"version"`
	NetworkVersion NetworkVersion `json:"network_version"`
	CommitInfo     CommitInfo     `json:"commit_info"`
}

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