rpc

package
v1.18.4 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 22 Imported by: 15

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 CONTRACT = "contract"
View Source
const ExtraSafetyMargin int64 = 100 // used to adjust gas and storage estimations

Variables

View Source
var (
	Canceled    = errors.New("operation confirm canceled")
	TTLExceeded = errors.New("operation ttl exceeded")
)
View Source
var (
	// for reveal
	DefaultRevealLimits = tezos.Limits{
		Fee:      1000,
		GasLimit: 1000,
	}
	// for transfers to tz1/2/3
	DefaultTransferLimitsEOA = tezos.Limits{
		Fee:      1000,
		GasLimit: 1420,
	}
	// for transfers to manager.tz
	DefaultTransferLimitsKT1 = tezos.Limits{
		Fee:      1000,
		GasLimit: 2078,
	}
	// for delegation
	DefaultDelegationLimitsEOA = tezos.Limits{
		Fee:      1000,
		GasLimit: 1000,
	}
	// for baker registration
	DefaultBakerRegistrationLimits = tezos.Limits{
		Fee:      1000,
		GasLimit: 1000,
	}
	// for simulating contract calls and other operations
	// used when no explicit costs are set
	DefaultSimulationLimits = tezos.Limits{
		GasLimit:     tezos.DefaultParams.HardGasLimitPerOperation,
		StorageLimit: tezos.DefaultParams.HardStorageLimitPerOperation,
	}
)
View Source
var DefaultOptions = CallOptions{
	Confirmations:    2,
	TTL:              tezos.DefaultParams.MaxOperationsTTL - 2,
	MaxFee:           1_000_000,
	ExtraGasMargin:   ExtraSafetyMargin,
	SimulationOffset: 5,
}
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(l log.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 v0.17.3

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, also used in Oxford for unstake

	// smart rollup
	BondId struct {
		SmartRollup tezos.Address `json:"smart_rollup"`
	} `json:"bond_id"`

	// Oxford staking
	Staker struct {
		Contract tezos.Address `json:"contract"` // tz1/2/3 accounts (only stake, unstake)
		Delegate tezos.Address `json:"delegate"` // baker
		Baker    tezos.Address `json:"baker"`    // baker
	} `json:"staker"`
	DelayedOp tezos.OpHash `json:"delayed_operation_hash"`
}

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 v0.17.3

func (b BalanceUpdate) AmountAbs() int64

func (BalanceUpdate) Cycle added in v0.17.3

func (b BalanceUpdate) Cycle() int64

func (BalanceUpdate) IsBakerStake added in v1.18.4

func (b BalanceUpdate) IsBakerStake() bool

func (BalanceUpdate) IsSharedStake added in v1.18.4

func (b BalanceUpdate) IsSharedStake() bool

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 v0.17.3

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  Int64orString `json:"yay"`
	Nay  Int64orString `json:"nay"`
	Pass Int64orString `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 v0.17.3

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 v0.17.3

func (b BlockAlias) Int64() int64

func (BlockAlias) String added in v0.17.3

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.FeatureVote    `json:"liquidity_baking_toggle_vote"`
	AdaptiveIssuanceVote      tezos.FeatureVote    `json:"adaptive_issuance_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) AiVote added in v1.18.0

func (h BlockHeader) AiVote() tezos.FeatureVote

func (BlockHeader) LbVote added in v0.17.3

func (h BlockHeader) LbVote() tezos.FeatureVote

func (*BlockHeader) LogEntry added in v0.17.3

func (h *BlockHeader) LogEntry() *BlockHeaderLogEntry

func (BlockHeader) ProtocolData added in v0.17.3

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

func (BlockHeaderLogEntry) PayloadHash added in v0.17.3

func (l BlockHeaderLogEntry) PayloadHash() (h tezos.PayloadHash)

func (BlockHeaderLogEntry) Pow added in v1.18.0

func (l BlockHeaderLogEntry) Pow() (h tezos.HexBytes)

func (BlockHeaderLogEntry) Round added in v0.17.3

func (l BlockHeaderLogEntry) Round() int

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 v0.17.3

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 v0.17.3

func (b BlockLevel) Int64() int64

func (BlockLevel) String added in v0.17.3

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"`

	// <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"`

	// v015+
	ProposerConsensusKey tezos.Address `json:"proposer_consensus_key"`
	BakerConsensusKey    tezos.Address `json:"baker_consensus_key"`
}

BlockMetadata is a part of the Tezos block data

func (*BlockMetadata) GetLevel added in v0.17.3

func (m *BlockMetadata) GetLevel() int64

type BlockOffset added in v0.17.3

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 v0.17.3

func NewBlockOffset(id BlockID, n int64) BlockOffset

func (BlockOffset) Int64 added in v0.17.3

func (b BlockOffset) Int64() int64

func (BlockOffset) String added in v0.17.3

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 v0.17.3

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
	ExtraGasMargin    int64         // safety margin in case simulation underestimates future usage
	SimulationBlockID BlockID       // custom block id to simulate operation (default is head, use to select a past block)
	SimulationOffset  int64         // custom block offset for future block simulations
	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
}

func NewCallOptions added in v0.17.3

func NewCallOptions() *CallOptions

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
	// MetadataMode defines the metadata reconstruction mode used for fetching
	// block and operation receipts. Set this mode to `always` if an RPC node prunes
	// metadata (i.e. you see metadata too large in certain operations)
	MetadataMode MetadataMode
	// Close connections. This may help with EOF errors from unexpected
	// connection close by Tezos RPC.
	CloseConns bool
	// Log is the logger implementation used by this client
	Log log.Logger
	// 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 v0.17.3

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 v0.17.3

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 v0.17.3

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

func (*Client) Close added in v0.17.3

func (c *Client) Close()

func (*Client) Complete added in v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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) GetCustomConstants added in v0.17.3

func (c *Client) GetCustomConstants(ctx context.Context, id BlockID, resp any) error

GetCustomConstants returns chain configuration constants at block id marshaled into a user-defined structure. https://tezos.gitlab.io/tezos/api/rpc.html#get-block-id-context-constants

func (*Client) GetDelegate added in v0.17.3

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) GetDelegateKey added in v1.18.0

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

GetDelegateKey returns a delegate's current consensus key

func (*Client) GetDelegatePendingStakingParams added in v1.18.0

func (c *Client) GetDelegatePendingStakingParams(ctx context.Context, addr tezos.Address, id BlockID) ([]StakingParameters, error)

GetDelegatePendingStakingParams returns a delegate's future staking setup

func (*Client) GetDelegateStakingParams added in v1.18.0

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

GetDelegateStakingParams returns a delegate's current staking setup

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) GetIssuance added in v1.18.0

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

GetIssuance returns expected xtz issuance for known future cycles

func (*Client) GetManagerKey added in v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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) GetUnstakedFrozenDeposits added in v1.18.0

func (c *Client) GetUnstakedFrozenDeposits(ctx context.Context, addr tezos.Address, id BlockID) ([]FrozenDeposit, error)

GetUnstakedFrozenDeposits returns a delegate's unstaked frozen deposits

func (*Client) GetVersionInfo added in v0.17.3

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 v0.17.3

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

func (*Client) ListActiveBigmapKeys added in v0.17.3

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

ListActiveBigmapKeys 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 of this method is discouraged. Instead, call the ListActiveBigmapValuesExt method below. In case you require the pre-image of bigmap keys consider calling an indexer API instead.

func (*Client) ListActiveBigmapValues added in v0.17.3

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 of this method is discouraged. Instead, call the ListActiveBigmapValuesExt method below. In case you require the pre-image of bigmap keys consider calling an indexer API instead.

func (*Client) ListActiveBigmapValuesExt added in v0.17.3

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

ListActiveBigmapValuesExt returns at most limit values starting at offset from bigmap at block id. In case you require the pre-image of bigmap keys 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 v0.17.3

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 v0.17.3

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 v0.17.3

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 of this method is discouraged. Instead, call the ListBigmapValuesExt method below. In case you require the pre-image of bigmap keys consider calling an indexer API instead.

func (*Client) ListBigmapValues added in v0.17.3

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 of this method is discouraged. Instead, call the ListBigmapValuesExt method below. In case you require the pre-image of bigmap keys consider calling an indexer API instead.

func (*Client) ListBigmapValuesExt added in v0.17.3

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

ListBigmapValues returns at most limit values starting at offset from bigmap at block id.

func (*Client) ListContracts added in v0.17.3

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 v0.17.3

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

ListEndorsingRights returns information about block endorsing rights.

func (*Client) ListEndorsingRightsCycle added in v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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

func (*Client) RunCallback added in v0.17.3

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

RunCallback simulates executing of TZip4 view on the context of a contract at selected block.

func (*Client) RunCode added in v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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 v0.17.3

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) SimulateOperation added in v0.17.3

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

SimulateOperation simulates executing an operation without requiring a valid signature. The call returns the execution result as regular operation receipt with estimated future gas usage.

Note gas consumption may differ based on whether a contract is cached inside a node at the time of operation inclusion in a block. The contract cache is dynamic so under rare circumstances the simulation can underestimates real gas cost and a contract call may fail. In such cases attempt to resend the transaction with a higher gas margin (CallOptions.ExtraGasMargin > ExtraSafetyMargin).

For simulation purposes a future cache state is predicted. You can control the future simulation point via RunOperationRequest.Latency (in blocks).

func (*Client) TraceCode added in v0.17.3

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 v0.17.3

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

func (*Client) Validate added in v0.17.3

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 v0.17.3

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

type ConnVersion added in v0.17.3

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 v0.17.3

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

ConstantRegistration represents a global constant registration operation

func (ConstantRegistration) Costs added in v0.17.3

func (c ConstantRegistration) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type Constants

type Constants struct {
	PreservedCycles              int64    `json:"preserved_cycles"`
	BlocksPerCycle               int64    `json:"blocks_per_cycle"`
	BlocksPerRollSnapshot        int64    `json:"blocks_per_roll_snapshot"`
	TimeBetweenBlocks            []string `json:"time_between_blocks"`
	HardGasLimitPerOperation     int64    `json:"hard_gas_limit_per_operation,string"`
	HardGasLimitPerBlock         int64    `json:"hard_gas_limit_per_block,string"`
	MichelsonMaximumTypeSize     int      `json:"michelson_maximum_type_size"`
	OriginationSize              int64    `json:"origination_size"`
	OriginationBurn              int64    `json:"origination_burn,string"`
	CostPerByte                  int64    `json:"cost_per_byte,string"`
	HardStorageLimitPerOperation int64    `json:"hard_storage_limit_per_operation,string"`
	MaxOperationDataLength       int      `json:"max_operation_data_length"`

	// New in v10
	MinimalBlockDelay int `json:"minimal_block_delay,string"`

	// New in v12
	MaxOperationsTimeToLive int64 `json:"max_operations_time_to_live"`
	BlocksPerStakeSnapshot  int64 `json:"blocks_per_stake_snapshot"`
}

Constants represents only a limited subset of Tezos chain configuration params which are required by TzGo. Users must define custom structs to read other constants as needed.

func (Constants) MapToChainParams

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

type ContractInfo added in v0.17.3

type ContractInfo struct {
	Balance        int64         `json:"balance,string"`
	Delegate       tezos.Address `json:"delegate"`
	Counter        int64         `json:"counter,string"`
	Manager        string        `json:"manager"`
	FrozenDeposits struct {
		InitialAmount int64 `json:"initial_amount,string"`
		ActualAmount  int64 `json:"actual_amount,string"`
	} `json:"frozen_deposits"`
	FrozenDepositsPseudotokens int64 `json:"frozen_deposits_pseudotokens,string"`
	MissedAttestations         struct {
		RemainingSlots int64 `json:"remaining_slots"`
		MissedLevels   int64 `json:"missed_levels"`
	} `json:"missed_attestations"`
	StakingParameters struct {
	} `json:"staking_parameters"`
	UnstakeRequests struct {
		Delegate tezos.Address `json:"delegate"`
		Requests []struct {
			Cycle           int64 `json:"cycle"`
			RequestedAmount int64 `json:"requested_amount,string"`
		} `json:"requests"`
	} `json:"unstake_requests"`
	UnstakedFrozenDeposits []UnstakedDeposit `json:"unstaked_frozen_deposits"`
}

Contracts holds info about a Tezos account

func (ContractInfo) IsRevealed added in v0.17.3

func (i ContractInfo) IsRevealed() bool

func (ContractInfo) ManagerKey added in v0.17.3

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 CycleKey added in v0.17.3

type CycleKey struct {
	Cycle int64         `json:"cycle"`
	Pkh   tezos.Address `json:"pkh"`
}

type DalAttestation added in v0.17.3

type DalAttestation struct {
	Generic
	Attestor    tezos.Address `json:"attestor"`
	Attestation tezos.Z       `json:"attestation"`
	Level       int64         `json:"level"`
}

type DalPublishSlotHeader added in v0.17.3

type DalPublishSlotHeader struct {
	Manager
	SlotHeader struct {
		Level      int64          `json:"level"`
		Index      byte           `json:"index"`
		Commitment string         `json:"commitment"`
		Proof      tezos.HexBytes `json:"commitment_proof"`
	} `json:"slot_header"`
}

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"`

	// v015+
	ActiveConsensusKey   tezos.Address `json:"active_consensus_key"`
	PendingConsensusKeys []CycleKey    `json:"pending_consensus_keys"`
}

Delegate holds information about an active delegate

type DelegateList

type DelegateList []tezos.Address

DelegateList contains a list of delegates

type Delegation added in v0.17.3

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

Delegation represents a transaction operation

func (Delegation) Costs added in v0.17.3

func (d Delegation) Costs() tezos.Costs

Cost returns operation cost to implement TypedOperation interface.

type DoubleBaking added in v0.17.3

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

DoubleBaking represents a double_baking_evidence operation

func (DoubleBaking) Costs added in v0.17.3

func (d DoubleBaking) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type DoubleEndorsement added in v0.17.3

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

DoubleEndorsement represents a double_endorsement_evidence operation

func (DoubleEndorsement) Costs added in v0.17.3

func (d DoubleEndorsement) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type DrainDelegate added in v0.17.3

type DrainDelegate struct {
	Generic
	ConsensusKey tezos.Address `json:"consensus_key"`
	Delegate     tezos.Address `json:"delegate"`
	Destination  tezos.Address `json:"destination"`
}

DrainDelegate represents a transaction operation

type Endorsement added in v0.17.3

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 v0.17.3

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 v0.17.3

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 FrozenDeposit added in v1.18.0

type FrozenDeposit struct {
	Cycle   int64 `json:"cycle"`
	Deposit int64 `json:"deposit,string"`
}

type GameStatus added in v0.17.3

type GameStatus struct {
	Status string         `json:"status,omitempty"`
	Kind   string         `json:"kind,omitempty"`
	Reason string         `json:"reason,omitempty"`
	Player *tezos.Address `json:"player,omitempty"`
}

func (*GameStatus) UnmarshalJSON added in v0.17.3

func (s *GameStatus) UnmarshalJSON(buf []byte) error

type Generic added in v0.17.3

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

Generic is the most generic operation type.

func (Generic) Costs added in v0.17.3

func (e Generic) Costs() tezos.Costs

Costs returns empty operation costs to implement TypedOperation interface.

func (Generic) Kind added in v0.17.3

func (e Generic) Kind() tezos.OpType

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

func (Generic) Limits added in v0.17.3

func (e Generic) Limits() tezos.Limits

Limits returns empty operation limits to implement TypedOperation interface.

func (Generic) Meta added in v0.17.3

func (e Generic) Meta() OperationMetadata

Meta returns an empty operation metadata to implement TypedOperation interface.

func (Generic) Result added in v0.17.3

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 v0.17.3

func (r ImplicitResult) Gas() int64

func (ImplicitResult) MilliGas added in v0.17.3

func (r ImplicitResult) MilliGas() int64

type IncreasePaidStorage added in v0.17.3

type IncreasePaidStorage struct {
	Manager
	Destination tezos.Address `json:"destination"`
	Amount      int64         `json:"amount,string"`
}

IncreasePaidStorage represents a transaction operation

func (IncreasePaidStorage) Costs added in v0.17.3

func (t IncreasePaidStorage) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type InlinedEndorsement added in v0.17.3

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 v0.17.3

type Int64orString int64

func (Int64orString) Int added in v0.17.3

func (i Int64orString) Int() int

func (Int64orString) Int64 added in v0.17.3

func (i Int64orString) Int64() int64

func (Int64orString) MarshalJSON added in v0.17.3

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

func (Int64orString) String added in v0.17.3

func (i Int64orString) String() string

func (*Int64orString) UnmarshalJSON added in v0.17.3

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          micheline.Prim        `json:"type"`                  // event
	Payload       micheline.Prim        `json:"payload"`               // event
	Tag           string                `json:"tag"`                   // event
	TicketUpdates []TicketUpdate        `json:"ticket_receipt"`        // v015
}

func (InternalResult) Costs added in v0.17.3

func (r InternalResult) Costs() tezos.Costs

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 IssuanceParameters added in v1.18.0

type IssuanceParameters struct {
	Cycle           int64 `json:"cycle"`
	BakingReward    int64 `json:"baking_reward_fixed_portion,string"`
	BakingBonus     int64 `json:"baking_reward_bonus_per_slot,string"`
	AttestingReward int64 `json:"attesting_reward_per_slot,string"`
	LBSubsidy       int64 `json:"liquidity_baking_subsidy,string"`
	SeedNonceTip    int64 `json:"seed_nonce_revelation_tip,string"`
	VdfTip          int64 `json:"vdf_revelation_tip,string"`
}

type LevelInfo added in v0.17.3

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"`

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

BlockLevel is a part of BlockMetadata

type Manager added in v0.17.3

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 v0.17.3

func (e Manager) Limits() tezos.Limits

Limits returns manager operation limits to implement TypedOperation interface.

type Mempool added in v0.17.3

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 v0.17.3

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

type MempoolMonitor added in v0.17.3

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 v0.17.3

func NewMempoolMonitor() *MempoolMonitor

func (*MempoolMonitor) Close added in v0.17.3

func (m *MempoolMonitor) Close()

func (*MempoolMonitor) Closed added in v0.17.3

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

func (*MempoolMonitor) Err added in v0.17.3

func (m *MempoolMonitor) Err(err error)

func (*MempoolMonitor) New added in v0.17.3

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

func (*MempoolMonitor) Recv added in v0.17.3

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

func (*MempoolMonitor) Send added in v0.17.3

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

type MetadataMode added in v0.17.3

type MetadataMode string
const (
	MetadataModeUnset  MetadataMode = ""
	MetadataModeNever  MetadataMode = "never"
	MetadataModeAlways MetadataMode = "always"
)

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 v0.17.3

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

type Observer added in v0.17.3

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

func NewObserver added in v0.17.3

func NewObserver() *Observer

func (*Observer) Close added in v0.17.3

func (m *Observer) Close()

func (*Observer) Head added in v0.17.3

func (m *Observer) Head() *BlockHeaderLogEntry

func (*Observer) Listen added in v0.17.3

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

func (*Observer) ListenMempool added in v0.17.3

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

func (*Observer) Subscribe added in v0.17.3

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

func (*Observer) Unsubscribe added in v0.17.3

func (m *Observer) Unsubscribe(id int)

func (*Observer) WithDelay added in v0.17.3

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

type ObserverCallback added in v0.17.3

type ObserverCallback func(*BlockHeaderLogEntry, int64, 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
	Metadata  string             `json:"metadata,omitempty"` // contains `too large` when stripped, this is BAD!!
}

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

func (Operation) Costs added in v0.17.3

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

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

func (Operation) TotalCosts added in v0.17.3

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 v0.17.3

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

func (*OperationError) UnmarshalJSON added in v0.17.3

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

type OperationList added in v0.17.3

type OperationList []TypedOperation

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

func (OperationList) Contains added in v0.17.3

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 v0.17.3

func (o OperationList) Len() int

func (OperationList) N added in v0.17.3

func (OperationList) Select added in v0.17.3

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

func (*OperationList) UnmarshalJSON added in v0.17.3

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 v0.17.3

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, FIXME: is this correct here or is this field in result?
	Level int64 `json:"level"`

	// v18 slashing ops may block a baker
	ForbiddenDelegate tezos.Address `json:"forbidden_delegate"` // v18+
}

OperationMetadata contains execution receipts for successful and failed operations.

func (OperationMetadata) Address added in v0.17.3

func (m OperationMetadata) Address() tezos.Address

Address returns the delegate address for endorsements.

type OperationResult added in v0.17.3

type OperationResult struct {
	Status               tezos.OpStatus   `json:"status"`
	BalanceUpdates       BalanceUpdates   `json:"balance_updates"`
	ConsumedGas          int64            `json:"consumed_gas,string"`      // deprecated in v015
	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
	TicketUpdatesCorrect []TicketUpdate   `json:"ticket_updates"`                 // v015
	TicketReceipts       []TicketUpdate   `json:"ticket_receipt"`                 // v015, name on internal

	// v013 tx rollup
	TxRollupResult

	// v016 smart rollup
	SmartRollupResult
}

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 v0.17.3

func (r OperationResult) BigmapEvents() micheline.BigmapEvents

func (OperationResult) Gas added in v0.17.3

func (r OperationResult) Gas() int64

func (OperationResult) IsSuccess added in v0.17.3

func (r OperationResult) IsSuccess() bool

func (OperationResult) MilliGas added in v0.17.3

func (r OperationResult) MilliGas() int64

func (OperationResult) TicketUpdates added in v0.17.3

func (r OperationResult) TicketUpdates() []TicketUpdate

Always use this helper to retrieve Ticket updates. This is because due to lack of quality control Tezos Lima protocol ended up with 2 distinct names for ticket updates in external call receipts versus internal call receipts.

type Origination added in v0.17.3

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 v0.17.3

func (o Origination) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

func (Origination) ManagerAddress added in v0.17.3

func (o Origination) ManagerAddress() tezos.Address

type PendingOperation added in v0.17.3

type PendingOperation Operation

func (PendingOperation) MarshalJSON added in v0.17.3

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

func (*PendingOperation) UnmarshalJSON added in v0.17.3

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

type Proposal

type Proposal struct {
	Proposal tezos.ProtocolHash `json:"proposal"`
	Upvotes  int64              `json:"upvotes,string"`
}

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 v0.17.3

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 v0.17.3

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

func (*Receipt) Costs added in v0.17.3

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

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

func (*Receipt) Error added in v0.17.3

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 v0.17.3

func (r *Receipt) IsSuccess() bool

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

func (*Receipt) MinLimits added in v0.17.3

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) OriginatedContract added in v0.17.3

func (r *Receipt) OriginatedContract() (tezos.Address, bool)

OriginatedContract returns the first contract address deployed by the operation.

func (*Receipt) TotalCosts added in v0.17.3

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

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

type Result added in v0.17.3

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

func NewResult added in v0.17.3

func NewResult(oh tezos.OpHash) *Result

func (*Result) Cancel added in v0.17.3

func (r *Result) Cancel()

func (*Result) Confirmations added in v0.17.3

func (r *Result) Confirmations() int64

func (*Result) Done added in v0.17.3

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

func (*Result) Err added in v0.17.3

func (r *Result) Err() error

func (*Result) GetReceipt added in v0.17.3

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

func (*Result) Hash added in v0.17.3

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

func (*Result) Listen added in v0.17.3

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

func (*Result) Wait added in v0.17.3

func (r *Result) Wait()

func (*Result) WaitContext added in v0.17.3

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

func (*Result) WithConfirmations added in v0.17.3

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

func (*Result) WithTTL added in v0.17.3

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

type Reveal added in v0.17.3

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

Reveal represents a reveal operation

func (Reveal) Costs added in v0.17.3

func (r Reveal) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type RollSnapshotInfo added in v0.17.3

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

type RpcClient added in v0.17.3

type RpcClient interface {
	Init(ctx context.Context) error
	UseIpfsUrl(uri string) error
	Client() *http.Client
	Listen()
	Close()
	ResolveChainConfig(ctx context.Context) error
	Get(ctx context.Context, urlpath string, result interface{}) error
	GetAsync(ctx context.Context, urlpath string, mon Monitor) error
	Put(ctx context.Context, urlpath string, body, result interface{}) error
	Post(ctx context.Context, urlpath string, body, result interface{}) error
	NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
	Do(req *http.Request, v interface{}) error
	DoAsync(req *http.Request, mon Monitor) error
	GetBlock(ctx context.Context, id BlockID) (*Block, error)
	GetBlockHeight(ctx context.Context, height int64) (*Block, error)
	GetTips(ctx context.Context, depth int, head tezos.BlockHash) ([][]tezos.BlockHash, error)
	GetHeadBlock(ctx context.Context) (*Block, error)
	GetGenesisBlock(ctx context.Context) (*Block, error)
	GetTipHeader(ctx context.Context) (*BlockHeader, error)
	GetBlockHeader(ctx context.Context, id BlockID) (*BlockHeader, error)
	GetBlockMetadata(ctx context.Context, id BlockID) (*BlockMetadata, error)
	GetBlockHash(ctx context.Context, id BlockID) (hash tezos.BlockHash, err error)
	GetBlockPredHashes(ctx context.Context, hash tezos.BlockHash, count int) ([]tezos.BlockHash, error)
	GetInvalidBlocks(ctx context.Context) ([]*InvalidBlock, error)
	GetInvalidBlock(ctx context.Context, blockID tezos.BlockHash) (*InvalidBlock, error)
	GetChainId(ctx context.Context) (tezos.ChainIdHash, error)
	GetStatus(ctx context.Context) (Status, error)
	GetVersionInfo(ctx context.Context) (VersionInfo, error)
	GetConstants(ctx context.Context, id BlockID) (con Constants, err error)
	GetCustomConstants(ctx context.Context, id BlockID, resp any) error
	GetParams(ctx context.Context, id BlockID) (*tezos.Params, error)
	GetContract(ctx context.Context, addr tezos.Address, id BlockID) (*ContractInfo, error)
	GetContractBalance(ctx context.Context, addr tezos.Address, id BlockID) (tezos.Z, error)
	GetManagerKey(ctx context.Context, addr tezos.Address, id BlockID) (tezos.Key, error)
	GetContractExt(ctx context.Context, addr tezos.Address, id BlockID) (*ContractInfo, error)
	ListContracts(ctx context.Context, id BlockID) (Contracts, error)
	GetContractScript(ctx context.Context, addr tezos.Address) (*micheline.Script, error)
	GetNormalizedScript(ctx context.Context, addr tezos.Address, mode UnparsingMode) (*micheline.Script, error)
	GetContractStorage(ctx context.Context, addr tezos.Address, id BlockID) (micheline.Prim, error)
	GetContractStorageNormalized(ctx context.Context, addr tezos.Address, id BlockID, mode UnparsingMode) (micheline.Prim, error)
	GetContractEntrypoints(ctx context.Context, addr tezos.Address) (map[string]micheline.Type, error)
	ListBigmapKeys(ctx context.Context, bigmap int64, id BlockID) ([]tezos.ExprHash, error)
	ListActiveBigmapKeys(ctx context.Context, bigmap int64) ([]tezos.ExprHash, error)
	GetBigmapValue(ctx context.Context, bigmap int64, hash tezos.ExprHash, id BlockID) (micheline.Prim, error)
	GetActiveBigmapValue(ctx context.Context, bigmap int64, hash tezos.ExprHash) (micheline.Prim, error)
	ListBigmapValues(ctx context.Context, bigmap int64, id BlockID) ([]micheline.Prim, error)
	ListActiveBigmapValues(ctx context.Context, bigmap int64, id BlockID) ([]micheline.Prim, error)
	GetActiveBigmapInfo(ctx context.Context, bigmap int64) (*BigmapInfo, error)
	GetBigmapInfo(ctx context.Context, bigmap int64, id BlockID) (*BigmapInfo, error)
	ListActiveDelegates(ctx context.Context, id BlockID) (DelegateList, error)
	GetDelegate(ctx context.Context, addr tezos.Address, id BlockID) (*Delegate, error)
	GetDelegateBalance(ctx context.Context, addr tezos.Address, id BlockID) (int64, error)
	GetMempool(ctx context.Context) (*Mempool, error)
	MonitorBootstrapped(ctx context.Context, monitor *BootstrapMonitor) error
	MonitorBlockHeader(ctx context.Context, monitor *BlockHeaderMonitor) error
	MonitorMempool(ctx context.Context, monitor *MempoolMonitor) error
	MonitorNetworkPointLog(ctx context.Context, address string, monitor *NetworkPointMonitor) error
	MonitorNetworkPeerLog(ctx context.Context, peerID string, monitor *NetworkPeerMonitor) error
	GetNetworkStats(ctx context.Context) (*NetworkStats, error)
	GetNetworkConnections(ctx context.Context) ([]*NetworkConnection, error)
	GetNetworkPeers(ctx context.Context, filter string) ([]*NetworkPeer, error)
	GetNetworkPeer(ctx context.Context, peerID string) (*NetworkPeer, error)
	BanNetworkPeer(ctx context.Context, peerID string) error
	TrustNetworkPeer(ctx context.Context, peerID string) error
	GetNetworkPeerBanned(ctx context.Context, peerID string) (bool, error)
	GetNetworkPeerLog(ctx context.Context, peerID string) ([]*NetworkPeerLogEntry, error)
	GetNetworkPoints(ctx context.Context, filter string) ([]*NetworkPoint, error)
	GetNetworkPoint(ctx context.Context, address string) (*NetworkPoint, error)
	ConnectToNetworkPoint(ctx context.Context, address string, timeout time.Duration) error
	BanNetworkPoint(ctx context.Context, address string) error
	TrustNetworkPoint(ctx context.Context, address string) error
	GetNetworkPointBanned(ctx context.Context, address string) (bool, error)
	GetNetworkPointLog(ctx context.Context, address string) ([]*NetworkPointLogEntry, error)
	GetBlockOperationHash(ctx context.Context, id BlockID, l, n int) (tezos.OpHash, error)
	GetBlockOperationHashes(ctx context.Context, id BlockID) ([][]tezos.OpHash, error)
	GetBlockOperationListHashes(ctx context.Context, id BlockID, l int) ([]tezos.OpHash, error)
	GetBlockOperation(ctx context.Context, id BlockID, l, n int) (*Operation, error)
	GetBlockOperationList(ctx context.Context, id BlockID, l int) ([]Operation, error)
	GetBlockOperations(ctx context.Context, id BlockID) ([][]Operation, error)
	BroadcastOperation(ctx context.Context, body []byte) (hash tezos.OpHash, err error)
	RunOperation(ctx context.Context, id BlockID, body, resp interface{}) error
	ForgeOperation(ctx context.Context, id BlockID, body, resp interface{}) error
	ListBakingRights(ctx context.Context, id BlockID, max int) ([]BakingRight, error)
	ListBakingRightsCycle(ctx context.Context, id BlockID, cycle int64, max int) ([]BakingRight, error)
	ListEndorsingRights(ctx context.Context, id BlockID) ([]EndorsingRight, error)
	ListEndorsingRightsCycle(ctx context.Context, id BlockID, cycle int64) ([]EndorsingRight, error)
	GetRollSnapshotInfoCycle(ctx context.Context, id BlockID, cycle int64) (*RollSnapshotInfo, error)
	GetStakingSnapshotInfoCycle(ctx context.Context, id BlockID, cycle int64) (*StakingSnapshotInfo, error)
	GetSnapshotIndexCycle(ctx context.Context, id BlockID, cycle int64) (*SnapshotIndex, error)
	ListSnapshotRollOwners(ctx context.Context, id BlockID, cycle, index int64) (*SnapshotOwners, error)
	Complete(ctx context.Context, o *codec.Op, key tezos.Key) error
	Simulate(ctx context.Context, o *codec.Op, opts *CallOptions) (*Receipt, error)
	Validate(ctx context.Context, o *codec.Op) error
	Broadcast(ctx context.Context, o *codec.Op) (tezos.OpHash, error)
	Send(ctx context.Context, op *codec.Op, opts *CallOptions) (*Receipt, error)
	RunCode(ctx context.Context, id BlockID, body, resp interface{}) error
	RunCallback(ctx context.Context, id BlockID, body, resp interface{}) error
	RunView(ctx context.Context, id BlockID, body, resp interface{}) error
	TraceCode(ctx context.Context, id BlockID, body, resp interface{}) error
	ListVoters(ctx context.Context, id BlockID) (VoterList, error)
	GetVoteQuorum(ctx context.Context, id BlockID) (int, error)
	GetVoteProposal(ctx context.Context, id BlockID) (tezos.ProtocolHash, error)
	ListBallots(ctx context.Context, id BlockID) (BallotList, error)
	GetVoteResult(ctx context.Context, id BlockID) (BallotSummary, error)
	ListProposals(ctx context.Context, id BlockID) (ProposalList, error)
}

RpcClient interface for various clients implementations and mocks generation

type RunCodeRequest added in v0.17.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 v0.17.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 v0.17.3

type RunOperationRequest struct {
	Operation *codec.Op         `json:"operation"`
	ChainId   tezos.ChainIdHash `json:"chain_id"`
	Latency   int64             `json:"latency,omitempty"`
}

type RunViewRequest added in v0.17.3

type RunViewRequest struct {
	Contract     tezos.Address     `json:"contract"`
	Entrypoint   string            `json:"entrypoint,omitempty"`
	View         string            `json:"view,omitempty"`
	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"
	UnlimitedGas bool              `json:"unlimited_gas,omitempty"` // view
	Now          string            `json:"now,omitempty"`           // view
}

type RunViewResponse added in v0.17.3

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

type SeedNonce added in v0.17.3

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

SeedNonce represents a seed_nonce_revelation operation

type SetDepositsLimit added in v0.17.3

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 v0.17.3

func (r SetDepositsLimit) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

func (SetDepositsLimit) Meta added in v0.17.3

Meta returns operation metadata to implement TypedOperation interface.

func (SetDepositsLimit) Result added in v0.17.3

func (r SetDepositsLimit) Result() OperationResult

Result returns operation result to implement TypedOperation interface.

type SmartRollupAddMessages added in v0.17.3

type SmartRollupAddMessages struct {
	Manager
	Messages []tezos.HexBytes `json:"message"`
}

type SmartRollupCement added in v0.17.3

type SmartRollupCement struct {
	Manager
	Rollup     tezos.Address                `json:"rollup"`
	Commitment *tezos.SmartRollupCommitHash `json:"commitment,omitempty"` // deprecated in v17
}

type SmartRollupCommitment added in v0.17.3

type SmartRollupCommitment struct {
	CompressedState tezos.SmartRollupStateHash  `json:"compressed_state"`
	InboxLevel      int64                       `json:"inbox_level"`
	Predecessor     tezos.SmartRollupCommitHash `json:"predecessor"`
	NumberOfTicks   tezos.Z                     `json:"number_of_ticks"`
}

type SmartRollupExecuteOutboxMessage added in v0.17.3

type SmartRollupExecuteOutboxMessage struct {
	Manager
	Rollup             tezos.Address               `json:"rollup"`
	CementedCommitment tezos.SmartRollupCommitHash `json:"cemented_commitment"`
	OutputProof        tezos.HexBytes              `json:"output_proof"`
}

type SmartRollupInputProof added in v0.17.3

type SmartRollupInputProof struct {
	Kind    string         `json:"input_proof_kind"`
	Level   int64          `json:"level"`
	Counter tezos.Z        `json:"message_counter"`
	Proof   tezos.HexBytes `json:"serialized_proof"`
}

type SmartRollupOriginate added in v0.17.3

type SmartRollupOriginate struct {
	Manager
	PvmKind          tezos.PvmKind  `json:"pvm_kind"`
	Kernel           tezos.HexBytes `json:"kernel"`
	OriginationProof tezos.HexBytes `json:"origination_proof"`
	ParametersTy     micheline.Prim `json:"parameters_ty"`
}

type SmartRollupProof added in v0.17.3

type SmartRollupProof struct {
	PvmStep    tezos.HexBytes         `json:"pvm_step,omitempty"`
	InputProof *SmartRollupInputProof `json:"input_proof,omitempty"`
}

type SmartRollupPublish added in v0.17.3

type SmartRollupPublish struct {
	Manager
	Rollup     tezos.Address         `json:"rollup"`
	Commitment SmartRollupCommitment `json:"commitment"`
}

type SmartRollupRecoverBond added in v0.17.3

type SmartRollupRecoverBond struct {
	Manager
	Rollup tezos.Address `json:"rollup"`
	Staker tezos.Address `json:"staker"`
}

type SmartRollupRefutation added in v0.17.3

type SmartRollupRefutation struct {
	Kind         string                       `json:"refutation_kind"`
	PlayerHash   *tezos.SmartRollupCommitHash `json:"player_commitment_hash,omitempty"`
	OpponentHash *tezos.SmartRollupCommitHash `json:"opponent_commitment_hash,omitempty"`
	Choice       *tezos.Z                     `json:"choice,omitempty"`
	Step         *SmartRollupRefuteStep       `json:"step,omitempty"`
}

type SmartRollupRefute added in v0.17.3

type SmartRollupRefute struct {
	Manager
	Rollup     tezos.Address         `json:"rollup"`
	Opponent   tezos.Address         `json:"opponent"`
	Refutation SmartRollupRefutation `json:"refutation"`
}

type SmartRollupRefuteStep added in v0.17.3

type SmartRollupRefuteStep struct {
	Ticks []SmartRollupTick
	Proof *SmartRollupProof
}

Step can either be

- []SmartRollupTick - SmartRollupInputProof - smth else?

There is no indication in the outer parts of the refutation struct that suggests how to decode this.

func (SmartRollupRefuteStep) MarshalJSON added in v0.17.3

func (s SmartRollupRefuteStep) MarshalJSON() ([]byte, error)

func (*SmartRollupRefuteStep) UnmarshalJSON added in v0.17.3

func (s *SmartRollupRefuteStep) UnmarshalJSON(buf []byte) error

type SmartRollupResult added in v0.17.3

type SmartRollupResult struct {
	Address          *tezos.Address               `json:"address,omitempty"`            // v016, smart_rollup_originate
	Size             *tezos.Z                     `json:"size,omitempty"`               // v016, smart_rollup_originate
	InboxLevel       int64                        `json:"inbox_level,omitempty"`        // v016, smart_rollup_cement
	StakedHash       *tezos.SmartRollupCommitHash `json:"staked_hash,omitempty"`        // v016, smart_rollup_publish
	PublishedAtLevel int64                        `json:"published_at_level,omitempty"` // v016, smart_rollup_publish
	GameStatus       *GameStatus                  `json:"game_status,omitempty"`        // v016, smart_rollup_refute, smart_rollup_timeout
	Commitment       *tezos.SmartRollupCommitHash `json:"commitment_hash,omitempty"`    // v017, smart_rollup_cement
}

type SmartRollupTick added in v0.17.3

type SmartRollupTick struct {
	State tezos.SmartRollupStateHash `json:"state"`
	Tick  tezos.Z                    `json:"tick"`
}

type SmartRollupTimeout added in v0.17.3

type SmartRollupTimeout struct {
	Manager
	Rollup  tezos.Address `json:"rollup"`
	Stakers struct {
		Alice tezos.Address `json:"alice"`
		Bob   tezos.Address `json:"bob"`
	} `json:"stakers"`
}

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 v0.17.3

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

type StakingParameters added in v1.18.0

type StakingParameters struct {
	Cycle int64 `json:"cycle"`
	Limit int64 `json:"limit_of_staking_over_baking_millionth"`
	Edge  int64 `json:"edge_of_baking_over_staking_billionth"`
}

type StakingSnapshotInfo added in v0.17.3

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 v0.17.3

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

type Ticket added in v0.17.3

type Ticket struct {
	Ticketer tezos.Address  `json:"ticketer"`
	Content  micheline.Prim `json:"content"`
	Type     micheline.Prim `json:"content_type"`
}

type TicketBalanceUpdate added in v0.17.3

type TicketBalanceUpdate struct {
	Account tezos.Address `json:"account"`
	Amount  tezos.Z       `json:"amount"`
}

type TicketUpdate added in v0.17.3

type TicketUpdate struct {
	Ticket  Ticket                `json:"ticket_token"`
	Updates []TicketBalanceUpdate `json:"updates"`
}

type Transaction added in v0.17.3

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 v0.17.3

func (t Transaction) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type TransferTicket added in v0.17.3

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

func (TransferTicket) Costs added in v0.17.3

func (t TransferTicket) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type TxRollup added in v0.17.3

type TxRollup struct {
	// common
	Manager

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

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

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

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

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

TxRollup represents any kind of rollup operation

func (*TxRollup) Target added in v0.17.3

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

func (*TxRollup) UnmarshalJSON added in v0.17.3

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

type TxRollupBatch added in v0.17.3

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

type TxRollupCommit added in v0.17.3

type TxRollupCommit struct {
	Level           int64    `json:"level"`
	Messages        []string `json:"messages"`
	Predecessor     string   `json:"predecessor,omitempty"`
	InboxMerkleRoot string   `json:"inbox_merkle_root"`
}

type TxRollupDispatch added in v0.17.3

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

type TxRollupRejection added in v0.17.3

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

type TxRollupResult added in v0.17.3

type TxRollupResult struct {
	OriginatedRollup tezos.Address `json:"originated_rollup"` // v013 tx_rollup_originate
	Level            int64         `json:"level"`             // v013 ?? here or in metadata??
}

type TypedOperation added in v0.17.3

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 v0.17.3

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 v0.17.3

func (m UnparsingMode) String() string

type UnstakedDeposit added in v1.18.0

type UnstakedDeposit struct {
	Cycle         int64 `json:"cycle"`
	InitialAmount int64 `json:"initial_amount,string"`
	ActualAmount  int64 `json:"actual_amount,string"`
}

func (*UnstakedDeposit) UnmarshalJSON added in v1.18.0

func (u *UnstakedDeposit) UnmarshalJSON(buf []byte) error

[[44,{"initial_amount":"1007000000","actual_amount":"1007000000"}]]

type UpdateConsensusKey added in v0.17.3

type UpdateConsensusKey struct {
	Manager
	Pk tezos.Key `json:"pk"`
}

UpdateConsensusKey represents a transaction operation

func (UpdateConsensusKey) Costs added in v0.17.3

func (t UpdateConsensusKey) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type VdfRevelation added in v0.17.3

type VdfRevelation struct {
	Generic
	Solution []tezos.HexBytes `json:"solution"`
}

VdfRevelation represents a vdf_revelation operation

type VersionInfo added in v0.17.3

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"`
	Power    int64         `json:"voting_power,string"`
}

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