rpc

package
v0.0.0-...-fd63c1f Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var (
	ProtoAlpha     = ParseProto("ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK")
	ProtoGenesis   = ParseProto("PrihK96nBAFSxVL1GLJTVhu9YnzkMFiBeuJRPA8NwuZVZCE1L6i")
	ProtoBootstrap = ParseProto("Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P")
	ProtoV001      = ParseProto("PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY")
	ProtoV002      = ParseProto("PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt")
	ProtoV003      = ParseProto("PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP")
	ProtoV004      = ParseProto("Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd")
	ProtoV005_2    = ParseProto("PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS")
	ProtoV006_2    = ParseProto("PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb")
	ProtoV007      = ParseProto("PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo")
	ProtoV008_2    = ParseProto("PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA")
	ProtoV009      = ParseProto("PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i")
	ProtoV010      = ParseProto("PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV")
	ProtoV011_2    = ParseProto("PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx")
	ProtoV012_2    = ParseProto("Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A")
	ProtoV013_2    = ParseProto("PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY")
	ProtoV014      = ParseProto("PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg")
	ProtoV015      = ParseProto("PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW")
	ProtoV016      = ParseProto("PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc")
	ProtoV016_2    = ParseProto("PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1")
	ProtoV017      = ParseProto("PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf")
	ProtoV018      = ParseProto("ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH")

	// aliases
	PtAthens  = ProtoV004
	PsBabyM1  = ProtoV005_2
	PsCARTHA  = ProtoV006_2
	PsDELPH1  = ProtoV007
	PtEdo2Zk  = ProtoV008_2
	PsFLoren  = ProtoV009
	PtGRANAD  = ProtoV010
	PtHangz2  = ProtoV011_2
	Psithaca  = ProtoV012_2
	PtJakart  = ProtoV013_2
	PtKathma  = ProtoV014
	PtLimaPt  = ProtoV015
	PtMumbai  = ProtoV016_2
	PtNairobi = ProtoV017
	Proxford  = ProtoV018

	Mainnet    = ParseChain("NetXdQprcVkpaWU")
	Ghostnet   = ParseChain("NetXnHfVqm9iesp")
	Nairobinet = ParseChain("NetXyuzvDo2Ugzb")
	Oxfordnet  = ParseChain("NetXxWsskGahzQB")

	Versions = map[tezos.ProtocolHash]int{
		ProtoGenesis:   0,
		ProtoBootstrap: 0,
		ProtoV001:      1,
		ProtoV002:      2,
		ProtoV003:      3,
		ProtoV004:      4,
		ProtoV005_2:    5,
		ProtoV006_2:    6,
		ProtoV007:      7,
		ProtoV008_2:    8,
		ProtoV009:      9,
		ProtoV010:      10,
		ProtoV011_2:    11,
		ProtoV012_2:    12,
		ProtoV013_2:    13,
		ProtoV014:      14,
		ProtoV015:      15,
		ProtoV016:      16,
		ProtoV016_2:    16,
		ProtoV017:      17,
		ProtoV018:      18,
		ProtoAlpha:     19,
	}
)
View Source
var ErrMonitorClosed = errors.New("monitor closed")

Functions

func DisableLog

func DisableLog()

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

func ErrorStatus

func ErrorStatus(err error) int

func UseLogger

func UseLogger(logger logpkg.Logger)

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

Types

type Activation

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

Activation represents a transaction operation

func (Activation) Addresses

func (a Activation) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (Activation) Fees

func (a Activation) Fees() BalanceUpdates

Fees returns fee-related balance updates to implement TypedOperation interface.

type ActiveStake

type ActiveStake struct {
	Combined  int64 `json:"-"`
	Frozen    int64 `json:"frozen,string"`
	Delegated int64 `json:"delegated,string"`
}

v12+ .. v17: single integer v18+: struct

func (*ActiveStake) UnmarshalJSON

func (s *ActiveStake) UnmarshalJSON(data []byte) error

func (ActiveStake) Value

func (s ActiveStake) Value() int64

type BabylonFlags

type BabylonFlags byte
const (
	BabylonSpendable   BabylonFlags = 0x1
	BabylonDelegatable BabylonFlags = 0x2
)

func (BabylonFlags) CanUpgrade

func (f BabylonFlags) CanUpgrade() bool

func (BabylonFlags) IsDelegatable

func (f BabylonFlags) IsDelegatable() bool

func (BabylonFlags) IsSpendable

func (f BabylonFlags) IsSpendable() bool

type Baker

type Baker struct {
	// extra info
	Address 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"`

	// v018+
	TotalDelegatedStake int64 `json:"total_delegated_stake,string"`
	StakingDenominator  int64 `json:"staking_denominator,string"`
}

Baker holds information about an active baker

type BakerList

type BakerList []tezos.Address

type BakingRight

type BakingRight struct {
	Delegate string
	Level    int64
	Round    int
}

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

func (BakingRight) Address

func (r BakingRight) Address() tezos.Address

func (*BakingRight) UnmarshalJSON

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

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  string `json:"contract,omitempty"`  // contract only
	Delegate  string `json:"delegate,omitempty"`  // freezer and burn only
	Committer string `json:"committer,omitempty"` // committer only

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

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

	// Oxford staking
	Staker struct {
		Contract string `json:"contract,omitempty"` // single: used in ??
		Delegate string `json:"delegate,omitempty"` // single & shared: used in ??
		Baker    string `json:"baker,omitempty"`    // baker: ??
	} `json:"staker"`
	DelayedOp string `json:"delayed_operation_hash,omitempty"`
	Delegator string `json:"delegator,omitempty"` // Oxford+, ??
}

BalanceUpdate is a variable structure depending on the Kind field

func (BalanceUpdate) Address

func (b BalanceUpdate) Address() (addr tezos.Address)

func (BalanceUpdate) Amount

func (b BalanceUpdate) Amount() int64

func (BalanceUpdate) Cycle

func (b BalanceUpdate) Cycle() int64

func (BalanceUpdate) IsBakerStake

func (b BalanceUpdate) IsBakerStake() bool

func (BalanceUpdate) IsSharedStake

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 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 [4][]*Operation    `json:"operations"`
}

Block holds information about a Tezos block. This is a stripped version for indexing without signatures.

func (*Block) CollectAddresses

func (b *Block) CollectAddresses(addUnique func(tezos.Address)) error

func (Block) GetCycle

func (b Block) GetCycle() int64

func (Block) GetCyclePosition

func (b Block) GetCyclePosition() int64

func (Block) GetLevel

func (b Block) GetLevel() int64

func (Block) GetLevelInfo

func (b Block) GetLevelInfo() LevelInfo

func (Block) GetProtocol

func (b Block) GetProtocol() tezos.ProtocolHash

func (Block) GetTimestamp

func (b Block) GetTimestamp() time.Time

func (Block) GetVersion

func (b Block) GetVersion() int

func (Block) GetVotingInfo

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) Invoices

func (b Block) Invoices() (upd []BalanceUpdate, ok bool)

func (Block) IsAiActivationUpgrade

func (b Block) IsAiActivationUpgrade() bool

func (Block) IsProtocolUpgrade

func (b Block) IsProtocolUpgrade() bool

func (*Block) LogEntry

func (b *Block) LogEntry() *BlockHeaderLogEntry

func (*Block) UpdateAllOriginatedScripts

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

Pulls storage from archive node and replaces storage embedded into originated scripts. For implicit (block-level) originations generated by protocol upgrades we pull the entire script. This is necessary because in script bigmap pointers are not replaced.

func (*Block) UpdateHeaderOriginatedScripts

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

type BlockAlias

type BlockAlias string

BlockAlias is a block addressing mode that uses a constant string

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

func (BlockAlias) Int64

func (b BlockAlias) Int64() int64

func (BlockAlias) String

func (b BlockAlias) String() string

type BlockContent

type BlockContent struct {
	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"`
	Fitness                         []tezos.HexBytes  `json:"fitness"`
	PayloadHash                     tezos.PayloadHash `json:"payload_hash"`
	PayloadRound                    int               `json:"payload_round"`
	Priority                        int               `json:"priority"`
	ProofOfWorkNonce                tezos.HexBytes    `json:"proof_of_work_nonce"`
	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"`
	AdaptiveIssuanceActivationCycle *int64            `json:"adaptive_issuance_activation_cycle"`

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

BlockHeader is a part of the Tezos block data

func (BlockHeader) LbVote

func (h BlockHeader) LbVote() tezos.FeatureVote

type BlockHeaderLogEntry

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

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

type BlockHeaderMonitor

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

func NewBlockHeaderMonitor

func NewBlockHeaderMonitor() *BlockHeaderMonitor

func (*BlockHeaderMonitor) Close

func (m *BlockHeaderMonitor) Close()

func (*BlockHeaderMonitor) Closed

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

func (*BlockHeaderMonitor) Err

func (m *BlockHeaderMonitor) Err(err error)

func (*BlockHeaderMonitor) New

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

func (*BlockHeaderMonitor) Recv

func (*BlockHeaderMonitor) Send

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

type BlockID

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

func (b BlockLevel) Int64() int64

func (BlockLevel) String

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"`
	Baker            tezos.Address      `json:"baker"`
	Proposer         tezos.Address      `json:"proposer"`
	ConsumedGas      int64              `json:"consumed_gas,string"`
	ConsumedMilliGas int64              `json:"consumed_milli_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"`
	LiquidityBakingToggleEma  int64             `json:"liquidity_baking_toggle_ema"`
	AdaptiveIssuanceEma       int64             `json:"adaptive_issuance_vote_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) Gas

func (m BlockMetadata) Gas() int64

func (BlockMetadata) GetLbEma

func (m BlockMetadata) GetLbEma() int64

func (*BlockMetadata) GetLevel

func (m *BlockMetadata) GetLevel() int64

func (BlockMetadata) MilliGas

func (m BlockMetadata) MilliGas() int64

type BlockOffset

type BlockOffset struct {
	Base   BlockID
	Offset int64
}

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

func NewBlockOffset

func NewBlockOffset(id BlockID, n int64) BlockOffset

func (BlockOffset) Int64

func (b BlockOffset) Int64() int64

func (BlockOffset) String

func (o BlockOffset) String() string

type Bundle

type Bundle struct {
	Block         *Block
	Params        *Params
	Baking        [][]BakingRight    // all blocks from one or more cycle
	Endorsing     [][]EndorsingRight // all blocks from one or more cycles
	PrevEndorsing []EndorsingRight   // last block from previous cycle
	Snapshot      *SnapshotIndex
	SnapInfo      *SnapshotInfo
	Issuance      []Issuance // future cycles where rights exist
}

func (Bundle) Cycle

func (b Bundle) Cycle() int64

func (Bundle) GetCyclePosition

func (b Bundle) GetCyclePosition() int64

func (Bundle) GetCycleStart

func (b Bundle) GetCycleStart() int64

func (Bundle) GetSnapshotIndex

func (b Bundle) GetSnapshotIndex() int

func (Bundle) Hash

func (b Bundle) Hash() (h tezos.BlockHash)

func (Bundle) Height

func (b Bundle) Height() int64

func (Bundle) IsCycleEnd

func (b Bundle) IsCycleEnd() bool

func (Bundle) IsCycleStart

func (b Bundle) IsCycleStart() bool

func (Bundle) IsFull

func (b Bundle) IsFull() bool

func (Bundle) IsSeedRequired

func (b Bundle) IsSeedRequired() bool

func (Bundle) IsSnapshotBlock

func (b Bundle) IsSnapshotBlock() bool

func (Bundle) IsValid

func (b Bundle) IsValid() bool

func (Bundle) IsVoteEnd

func (b Bundle) IsVoteEnd() bool

func (Bundle) IsVoteStart

func (b Bundle) IsVoteStart() bool

func (Bundle) ParentHash

func (b Bundle) ParentHash() (h tezos.BlockHash)

func (Bundle) Protocol

func (b Bundle) Protocol() (h tezos.ProtocolHash)

type Client

type Client struct {
	// 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) 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) FetchIssuanceByCycle

func (c *Client) FetchIssuanceByCycle(ctx context.Context, height, cycle int64, bundle *Bundle) error

func (*Client) FetchRightsByCycle

func (c *Client) FetchRightsByCycle(ctx context.Context, height, cycle int64, bundle *Bundle) error

func (*Client) Get

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

func (*Client) GetActiveStakingParams

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

GetActiveStakingParams returns a delegate's current staking setup

func (*Client) GetAsync

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

func (*Client) GetBakerBalance

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

GetBakerBalance returns a delegate's balance

func (*Client) GetBakerInfo

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

GetBakerInfo returns information about a delegate at a specific height.

func (*Client) GetBakerKey

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

GetBakerKey returns a delegate's current consensus key

func (*Client) GetBakingRightOwner

func (c *Client) GetBakingRightOwner(ctx context.Context, id BlockID, round int, p *Params) (tezos.Address, error)

GetBakingRightOwner returns the address if the baker who owns endorsing slot in block.

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) GetBlockHeader

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

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

func (*Client) GetBlockMetadata

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) GetChainId

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

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

GetContract returns the full info about a contract at block id.

func (*Client) GetContractScript

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

GetContractScript returns the originated contract script.

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) GetEndorsingSlotOwner

func (c *Client) GetEndorsingSlotOwner(ctx context.Context, id BlockID, slot int, p *Params) (tezos.Address, error)

GetEndorsingSlotOwner returns the address if the baker who owns endorsing slot in block.

func (*Client) GetFullBundle

func (c *Client) GetFullBundle(ctx context.Context, id BlockID, p *Params) (b *Bundle, err error)

func (*Client) GetIssuance

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

GetIssuance returns expected xtz issuance for known future cycles

func (*Client) GetLightBundle

func (c *Client) GetLightBundle(ctx context.Context, id BlockID, p *Params) (b *Bundle, err error)

func (*Client) GetMempool

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

GetMempool returns mempool pending operations

func (*Client) GetParams

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

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

func (*Client) GetPendingStakingParams

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

GetPendingStakingParams returns a delegate's future staking setup

func (*Client) GetSnapshotIndexCycle

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

GetSnapshotIndexCycle 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) GetSnapshotInfoCycle

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

GetSnapshotInfoCycle 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

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

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

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) Init

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

func (*Client) IsInitialized

func (c *Client) IsInitialized() bool

func (*Client) ListActiveBakers

func (c *Client) ListActiveBakers(ctx context.Context, id BlockID) (BakerList, error)

ListActiveBakers returns information about all active delegates at a block.

func (*Client) ListBakingRights

func (c *Client) ListBakingRights(ctx context.Context, id BlockID, max int, p *Params) ([]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

func (c *Client) ListBakingRightsCycle(ctx context.Context, id BlockID, cycle int64, max int, p *Params) ([]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) ListEndorsingRights

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

ListEndorsingRights returns information about block endorsing rights.

func (*Client) ListEndorsingRightsCycle

func (c *Client) ListEndorsingRightsCycle(ctx context.Context, id BlockID, cycle int64, p *Params) ([]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. On protocol changes future rights must be refetched!

func (*Client) ListSnapshotRollOwners

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) 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) MonitorMempool

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) NewRequest

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

NewRequest creates a Tezos RPC request.

func (*Client) Params

func (c *Client) Params() *Params

func (*Client) ResolveChainConfig

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

func (*Client) WithApiKey

func (c *Client) WithApiKey(s string) *Client

func (*Client) WithChainId

func (c *Client) WithChainId(id tezos.ChainIdHash) *Client

func (*Client) WithParams

func (c *Client) WithParams(p *Params) *Client

func (*Client) WithRetry

func (c *Client) WithRetry(num int, delay time.Duration) *Client

func (*Client) WithUserAgent

func (c *Client) WithUserAgent(s string) *Client

type CommitInfo

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

type ConstantRegistration

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

ConstantRegistration represents a global constant registration operation

type Constants

type Constants struct {
	PreservedCycles              int64    `json:"preserved_cycles"`
	BlocksPerCycle               int64    `json:"blocks_per_cycle"`
	BlocksPerCommitment          int64    `json:"blocks_per_commitment"`
	BlocksPerRollSnapshot        int64    `json:"blocks_per_roll_snapshot"`
	BlocksPerVotingPeriod        int64    `json:"blocks_per_voting_period"`
	TimeBetweenBlocks            []string `json:"time_between_blocks"`
	EndorsersPerBlock            int      `json:"endorsers_per_block"`
	HardGasLimitPerOperation     int64    `json:"hard_gas_limit_per_operation,string"`
	HardGasLimitPerBlock         int64    `json:"hard_gas_limit_per_block,string"`
	TokensPerRoll                int64    `json:"tokens_per_roll,string"`
	MichelsonMaximumTypeSize     int      `json:"michelson_maximum_type_size"`
	SeedNonceRevelationTip       int64    `json:"seed_nonce_revelation_tip,string"`
	OriginationSize              int64    `json:"origination_size"`
	OriginationBurn              int64    `json:"origination_burn,string"`
	BlockSecurityDeposit         int64    `json:"block_security_deposit,string"`
	EndorsementSecurityDeposit   int64    `json:"endorsement_security_deposit,string"`
	CostPerByte                  int64    `json:"cost_per_byte,string"`
	HardStorageLimitPerOperation int64    `json:"hard_storage_limit_per_operation,string"`
	MaxOperationDataLength       int      `json:"max_operation_data_length"`
	ConsensusCommitteeSize       int      `json:"consensus_committee_size"`
	ConsensusThreshold           int      `json:"consensus_threshold"`

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

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

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

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

	// New in v12
	BlocksPerStakeSnapshot   int64 `json:"blocks_per_stake_snapshot"`
	BakingRewardFixedPortion int64 `json:"baking_reward_fixed_portion,string"`
	BakingRewardBonusPerSlot int64 `json:"baking_reward_bonus_per_slot,string"`
	EndorsingRewardPerSlot   int64 `json:"endorsing_reward_per_slot,string"`
	FrozenDepositsPercentage int   `json:"frozen_deposits_percentage"`
	MaxOperationsTimeToLive  int64 `json:"max_operations_time_to_live"`
	DelayIncrementPerRound   int   `json:"delay_increment_per_round,string"`
	LiquidityBakingSubsidy   int64 `json:"liquidity_baking_subsidy,string"`

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

	// New in v15
	MinimalStake int64 `json:"minimal_stake,string"` // replaces tokens_per_roll

	// New in v18
	MaxSlashingPeriod              int64 `json:"max_slashing_period"`
	LimitOfDelegationOverBaking    int64 `json:"limit_of_delegation_over_baking"`
	GlobalLimitOfStakingOverBaking int64 `json:"global_limit_of_staking_over_baking"`
	EdgeOfStakingOverDelegation    int64 `json:"edge_of_staking_over_delegation"`
}

func (Constants) GetBlockReward

func (c Constants) GetBlockReward() int64

func (Constants) GetEndorsementReward

func (c Constants) GetEndorsementReward() int64

func (Constants) HaveV12Rewards

func (c Constants) HaveV12Rewards() bool

func (Constants) HaveV6Rewards

func (c Constants) HaveV6Rewards() bool

func (Constants) Params

func (c Constants) Params() *Params

func (*Constants) UnmarshalJSON

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

type ContractInfo

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

Contracts holds info about a Tezos account

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

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

type DalAttestation

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

func (DalAttestation) Addresses

func (t DalAttestation) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

type DalPublishSlotHeader

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 Delegation

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

Delegation represents a transaction operation

func (Delegation) Addresses

func (d Delegation) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

type DoubleBaking

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

DoubleBaking represents a double_baking_evidence operation

func (DoubleBaking) Strip

func (d DoubleBaking) Strip() DoubleBaking

type DoubleEndorsement

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

DoubleEndorsement represents a double_endorsement_evidence operation

func (DoubleEndorsement) Strip

type DrainDelegate

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

func (DrainDelegate) Addresses

func (t DrainDelegate) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

type Endorsement

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+

}

Endorsement represents an endorsement operation. This is a stripped version for indexing without block_payload_hash.

func (Endorsement) GetLevel

func (e Endorsement) GetLevel() int64

type EndorsingRight

type EndorsingRight struct {
	Delegate string
	Level    int64
	Power    int
}

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

func (EndorsingRight) Address

func (r EndorsingRight) Address() tezos.Address

type Error

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

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

type Errors

type Errors []Error

Errors is a slice of Error with custom JSON unmarshaller

func (Errors) Error

func (e Errors) Error() string

func (Errors) ErrorID

func (e Errors) ErrorID() string

ErrorID returns Tezos error id

func (Errors) ErrorKind

func (e Errors) ErrorKind() string

ErrorKind returns Tezos error kind

type FrozenDeposit

type FrozenDeposit struct {
	Cycle   int64   `json:"cycle"`
	Deposit tezos.Z `json:"deposit"`
}

type GameStatus

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

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

type Generic

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

Generic is the most generic operation type.

func (Generic) Addresses

func (e Generic) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (Generic) Fees

func (e Generic) Fees() BalanceUpdates

Fees returns an empty balance update list to implement TypedOperation interface.

func (Generic) Kind

func (e Generic) Kind() tezos.OpType

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

func (Generic) Meta

func (e Generic) Meta() OperationMetadata

Meta returns an empty operation metadata to implement TypedOperation interface.

func (Generic) Result

func (e Generic) Result() OperationResult

Result returns an empty operation result to implement TypedOperation interface.

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 ImplicitResult

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

found in block metadata from v010+

func (ImplicitResult) Gas

func (r ImplicitResult) Gas() int64

func (ImplicitResult) MilliGas

func (r ImplicitResult) MilliGas() int64

type IncreasePaidStorage

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

IncreasePaidStorage represents a transaction operation

func (IncreasePaidStorage) Addresses

func (t IncreasePaidStorage) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (IncreasePaidStorage) Costs

func (t IncreasePaidStorage) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type InlinedEndorsement

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

}

InlinedEndorsement represents and embedded endorsement. This is a stripped version for indexing without signature.

type Int64orString

type Int64orString int64

func (Int64orString) Int64

func (i Int64orString) Int64() int64

func (Int64orString) MarshalJSON

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

func (Int64orString) String

func (i Int64orString) String() string

func (*Int64orString) UnmarshalJSON

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"`    // transaction
	Delegate    tezos.Address        `json:"delegate"`       // delegation
	Parameters  micheline.Parameters `json:"parameters"`     // transaction
	Amount      int64                `json:"amount,string"`  // transaction
	Balance     int64                `json:"balance,string"` // origination
	Script      *micheline.Script    `json:"script"`         // origination
	Type        micheline.Prim       `json:"type"`           // event
	Payload     micheline.Prim       `json:"payload"`        // event
	Tag         string               `json:"tag"`            // event
}

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 Issuance

type Issuance 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

type LevelInfo struct {
	Level int64 `json:"level"`
	Cycle int64 `json:"cycle"`
	// <v008
	VotingPeriod         int64 `json:"voting_period"`
	CyclePosition        int64 `json:"cycle_position"`
	VotingPeriodPosition int64 `json:"voting_period_position"`
	ExpectedCommitment   bool  `json:"expected_commitment"`
}

BlockLevel is a part of BlockMetadata

type Manager

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) Addresses

func (e Manager) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (Manager) Limits

func (e Manager) Limits() tezos.Limits

Limits returns manager operation limits to implement TypedOperation interface.

type Mempool

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

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

type MempoolMonitor

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

func NewMempoolMonitor() *MempoolMonitor

func (*MempoolMonitor) Close

func (m *MempoolMonitor) Close()

func (*MempoolMonitor) Closed

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

func (*MempoolMonitor) Err

func (m *MempoolMonitor) Err(err error)

func (*MempoolMonitor) New

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

func (*MempoolMonitor) Recv

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

func (*MempoolMonitor) Send

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

type Monitor

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

type NetworkVersion

type NetworkVersion struct {
	ChainName            string `json:"chain_name"`
	DistributedDbVersion int    `json:"distributed_db_version"`
	P2pVersion           int    `json:"p2p_version"`
}

type NodeError

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

NodeError is a basic error type

func (*NodeError) Error

func (e *NodeError) Error() string

func (*NodeError) ErrorID

func (e *NodeError) ErrorID() string

ErrorID returns Tezos error id

func (*NodeError) ErrorKind

func (e *NodeError) ErrorKind() string

ErrorKind returns Tezos error kind

type NodeErrors

type NodeErrors []NodeError

func (NodeErrors) Interface

func (n NodeErrors) Interface() []Error

type NodeVersion

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

type Operation

type Operation struct {
	Hash     tezos.OpHash     `json:"hash"`
	Contents OperationList    `json:"contents"`
	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) Addresses

func (o Operation) Addresses() *tezos.AddressSet

Addresses lists all Tezos addresses that appear in this operation group. This does not include addresses used in contract call parameters, storage updates and tickets.

func (Operation) IsSuccess

func (o Operation) IsSuccess() bool

type OperationError

type OperationError struct {
	NodeError
	// whitelist commonly useful error contents, avoid storing large scripts, etc
	Contract       string          `json:"contract,omitempty"`
	ContractHandle string          `json:"contract_handle,omitempty"`
	BigMap         int64           `json:"big_map,omitempty"`
	Identifier     string          `json:"identifier,omitempty"`
	Location       int64           `json:"location,omitempty"`
	Loc            int64           `json:"loc,omitempty"`
	With           *micheline.Prim `json:"with,omitempty"`
	Amount         string          `json:"amount,omitempty"`
	Balance        string          `json:"balance,omitempty"`
}

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

type OperationList

type OperationList []TypedOperation

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

func (*OperationList) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler

type OperationMetadata

type OperationMetadata struct {
	BalanceUpdates BalanceUpdates  `json:"balance_updates,omitempty"` // 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"`                // < v12
	EndorsementPower    int           `json:"endorsement_power,omitempty"`    // v12+
	PreendorsementPower int           `json:"preendorsement_power,omitempty"` // v12+
	ConsensusPower      int           `json:"consensus_power,omitempty"`      // v18+
}

OperationMetadata contains execution receipts for successful and failed operations.

func (OperationMetadata) Address

func (m OperationMetadata) Address() tezos.Address

Address returns the delegate address for endorsements.

func (OperationMetadata) Balances

func (m OperationMetadata) Balances() BalanceUpdates

func (OperationMetadata) Power

func (m OperationMetadata) Power() int

type OperationResult

type OperationResult struct {
	Status               tezos.OpStatus   `json:"status"`
	BalanceUpdates       BalanceUpdates   `json:"balance_updates"` // burn, etc
	ConsumedGas          int64            `json:"consumed_gas,string"`
	ConsumedMilliGas     int64            `json:"consumed_milligas,string"` // v007+
	Errors               []OperationError `json:"errors,omitempty"`
	Allocated            bool             `json:"allocated_destination_contract"` // tx only
	Storage              micheline.Prim   `json:"storage,omitempty"`              // tx, orig
	OriginatedContracts  []tezos.Address  `json:"originated_contracts"`           // orig only
	StorageSize          int64            `json:"storage_size,string"`            // tx, orig, const
	PaidStorageSizeDiff  int64            `json:"paid_storage_size_diff,string"`  // tx, orig
	BigmapDiff           json.RawMessage  `json:"big_map_diff,omitempty"`         // tx, orig, <v013
	LazyStorageDiff      json.RawMessage  `json:"lazy_storage_diff,omitempty"`    // v008+ tx, orig
	GlobalAddress        tezos.ExprHash   `json:"global_address"`                 // global constant
	TicketUpdatesCorrect []TicketUpdate   `json:"ticket_updates"`                 // v015, correct name on external
	TicketReceipts       []TicketUpdate   `json:"ticket_receipt"`                 // v015, incorrect name on internal

	// v013 tx rollup
	TxRollupResult

	// v016 smart rollup
	SmartRollupResult
	// contains filtered or unexported fields
}

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) Balances

func (r OperationResult) Balances() BalanceUpdates

func (OperationResult) BigmapEvents

func (r OperationResult) BigmapEvents() micheline.BigmapEvents

func (OperationResult) Gas

func (r OperationResult) Gas() int64

func (OperationResult) IsSuccess

func (r OperationResult) IsSuccess() bool

func (OperationResult) MilliGas

func (r OperationResult) MilliGas() int64

func (OperationResult) TicketUpdates

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

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) AddEmbeddedAddresses

func (o Origination) AddEmbeddedAddresses(add func(tezos.Address))

func (Origination) Addresses

func (o Origination) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (Origination) BabylonFlags

func (o Origination) BabylonFlags(version int) BabylonFlags

func (Origination) ManagerAddress

func (o Origination) ManagerAddress() tezos.Address

type Params

type Params struct {
	// chain identity, not part of RPC
	Network     string             `json:"network,omitempty"`
	Symbol      string             `json:"symbol,omitempty"`
	Deployment  int                `json:"deployment"`
	Version     int                `json:"version"`
	ChainId     tezos.ChainIdHash  `json:"chain_id"`
	Protocol    tezos.ProtocolHash `json:"protocol"`
	StartHeight int64              `json:"start_height"` // protocol start (may be != cycle start!!)
	EndHeight   int64              `json:"end_height"`   // protocol end (may be != cycle end!!)
	Decimals    int                `json:"decimals"`

	// sizes
	MinimalStake        int64 `json:"minimal_stake,omitempty"`
	PreservedCycles     int64 `json:"preserved_cycles,omitempty"`
	BlocksPerCycle      int64 `json:"blocks_per_cycle,omitempty"`
	BlocksPerCommitment int64 `json:"blocks_per_commitment,omitempty"`
	BlocksPerSnapshot   int64 `json:"blocks_per_snapshot,omitempty"`

	// timing
	MinimalBlockDelay      time.Duration `json:"minimal_block_delay,omitempty"`
	DelayIncrementPerRound time.Duration `json:"delay_increment_per_round,omitempty"`

	// rewards
	BlockReward              int64 `json:"block_reward,omitempty"`
	EndorsementReward        int64 `json:"endorsement_reward,omitempty"`
	BakingRewardFixedPortion int64 `json:"baking_reward_fixed_portion,omitempty"`
	BakingRewardBonusPerSlot int64 `json:"baking_reward_bonus_per_slot,omitempty"`
	EndorsingRewardPerSlot   int64 `json:"endorsing_reward_per_slot,omitempty"`
	LiquidityBakingSubsidy   int64 `json:"liquidity_baking_subsidy,omitempty"`
	SeedNonceRevelationTip   int64 `json:"seed_nonce_revelation_tip,omitempty"`

	// costs
	CostPerByte                int64 `json:"cost_per_byte,omitempty"`
	OriginationSize            int64 `json:"origination_size,omitempty"`
	OriginationBurn            int64 `json:"origination_burn,omitempty"`
	BlockSecurityDeposit       int64 `json:"block_security_deposit,omitempty"`
	EndorsementSecurityDeposit int64 `json:"endorsement_security_deposit,omitempty"`

	// limits
	EndorsersPerBlock              int   `json:"endorsers_per_block,omitempty"`
	MaxOperationsTTL               int64 `json:"max_operations_ttl,omitempty"`
	ConsensusCommitteeSize         int   `json:"consensus_committee_size,omitempty"`
	ConsensusThreshold             int   `json:"consensus_threshold,omitempty"`
	FrozenDepositsPercentage       int   `json:"frozen_deposits_percentage,omitempty"`          // <v18
	LimitOfDelegationOverBaking    int64 `json:"limit_of_delegation_over_baking,omitempty"`     // v18+
	GlobalLimitOfStakingOverBaking int64 `json:"global_limit_of_staking_over_baking,omitempty"` // v18+
	MaxSlashingPeriod              int64 `json:"max_slashing_period,omitempty"`

	// voting
	BlocksPerVotingPeriod int64 `json:"blocks_per_voting_period,omitempty"`
	MinProposalQuorum     int64 `json:"min_proposal_quorum,omitempty"`
	QuorumMin             int64 `json:"quorum_min,omitempty"`
	QuorumMax             int64 `json:"quorum_max,omitempty"`

	// extra features to follow protocol upgrades
	NumVotingPeriods int64 `json:"num_votes,omitempty"` // 5 after v008, 4 before
	StartOffset      int64 `json:"start_offset"`        // correction for cycle start
	StartCycle       int64 `json:"start_cycle"`         // correction cycle lengths

}

Params contains a subset of protocol configuration settings that are relevant for dapps and most indexers. For additional protocol data, call rpc.GetCustomConstants() with a custom data struct.

func NewParams

func NewParams() *Params

func (Params) BlockTime

func (p Params) BlockTime() time.Duration

func (Params) ContainsCycle

func (p Params) ContainsCycle(c int64) bool

only works one way, but that's enough for use in proxy

func (Params) ContainsHeight

func (p Params) ContainsHeight(height int64) bool

treat -1 as special height query that matches open interval params only don't correct for start offset here

func (Params) ConvertAmount

func (p Params) ConvertAmount(value float64) int64

convertAmount converts a floating point number, which may or may not be representable as an integer, to an integer type by rounding to the nearest integer. This is performed consistent with the General Decimal Arithmetic spec and according to IEEE 754-2008 roundTiesToEven

func (Params) ConvertValue

func (p Params) ConvertValue(amount int64) float64

func (Params) CycleEndHeight

func (p Params) CycleEndHeight(c int64) int64

func (Params) CyclePosition

func (p Params) CyclePosition(height int64) int64

func (Params) CycleStartHeight

func (p Params) CycleStartHeight(c int64) int64

func (Params) HeightToCycle

func (p Params) HeightToCycle(height int64) int64

Functions requiring start/end to be available

func (Params) IsCycleEnd

func (p Params) IsCycleEnd(height int64) bool

func (Params) IsCycleStart

func (p Params) IsCycleStart(height int64) bool

func (Params) IsMainnet

func (p Params) IsMainnet() bool

func (Params) IsPostBabylon

func (p Params) IsPostBabylon() bool

func (Params) IsPreBabylonHeight

func (p Params) IsPreBabylonHeight(height int64) bool

func (Params) IsPreIthacaNetworkAtStart

func (p Params) IsPreIthacaNetworkAtStart() bool

func (Params) MaxBlockReward

func (p Params) MaxBlockReward() int64

post v18 this is no longer available, must query dynamic inflation from RPC

func (Params) NumEndorsers

func (p Params) NumEndorsers() int

func (Params) SnapshotBaseCycle

func (p Params) SnapshotBaseCycle(c int64) int64

Functions that work without start/end

func (Params) SnapshotBlock

func (p Params) SnapshotBlock(cycle int64, index int) int64

func (Params) SnapshotIndex

func (p Params) SnapshotIndex(height int64) int

func (*Params) WithChainId

func (p *Params) WithChainId(id tezos.ChainIdHash) *Params

func (*Params) WithDeployment

func (p *Params) WithDeployment(v int) *Params

func (*Params) WithIssuance

func (p *Params) WithIssuance(i Issuance) *Params

func (*Params) WithNetwork

func (p *Params) WithNetwork(n string) *Params

func (*Params) WithProtocol

func (p *Params) WithProtocol(h tezos.ProtocolHash) *Params

type PendingOperation

type PendingOperation Operation

func (PendingOperation) MarshalJSON

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

func (*PendingOperation) UnmarshalJSON

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

type Proposals

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 Reveal

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

Reveal represents a reveal operation

type SeedNonce

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

SeedNonce represents a seed_nonce_revelation operation

type SetDepositsLimit

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

SetDepositsLimit represents a baker deposit limit update operation.

func (SetDepositsLimit) Fees

Fees returns fee-related balance updates to implement TypedOperation interface.

func (SetDepositsLimit) Meta

Meta returns operation metadata to implement TypedOperation interface.

func (SetDepositsLimit) Result

func (r SetDepositsLimit) Result() OperationResult

Result returns operation result to implement TypedOperation interface.

type SmartRollupAddMessages

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

func (SmartRollupAddMessages) Encode

func (o SmartRollupAddMessages) Encode() []byte

type SmartRollupCement

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

func (SmartRollupCement) Addresses

func (o SmartRollupCement) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (SmartRollupCement) Encode

func (o SmartRollupCement) Encode() []byte

type SmartRollupCommitment

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

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

func (SmartRollupExecuteOutboxMessage) Addresses

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (SmartRollupExecuteOutboxMessage) Encode

type SmartRollupInputProof

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

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

func (SmartRollupOriginate) Addresses

func (o SmartRollupOriginate) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (SmartRollupOriginate) Encode

func (o SmartRollupOriginate) Encode() []byte

type SmartRollupProof

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

type SmartRollupPublish

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

func (SmartRollupPublish) Addresses

func (o SmartRollupPublish) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (SmartRollupPublish) Encode

func (o SmartRollupPublish) Encode() []byte

type SmartRollupRecoverBond

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

func (SmartRollupRecoverBond) Addresses

func (o SmartRollupRecoverBond) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (SmartRollupRecoverBond) Encode

func (o SmartRollupRecoverBond) Encode() []byte

type SmartRollupRefutation

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

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

func (SmartRollupRefute) Addresses

func (o SmartRollupRefute) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (SmartRollupRefute) Encode

func (o SmartRollupRefute) Encode() []byte

type SmartRollupRefuteStep

type SmartRollupRefuteStep struct {
	Ticks []SmartRollupTick `json:"ticks,omitempty"`
	Proof *SmartRollupProof `json:"proof,omitempty"`
}

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

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

func (*SmartRollupRefuteStep) UnmarshalJSON

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

type SmartRollupResult

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
}

func (SmartRollupResult) Encode

func (r SmartRollupResult) Encode() []byte

type SmartRollupTick

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

type SmartRollupTimeout

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

func (SmartRollupTimeout) Addresses

func (o SmartRollupTimeout) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (SmartRollupTimeout) Encode

func (o SmartRollupTimeout) Encode() []byte

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 SnapshotInfo

type SnapshotInfo struct {
	LastRoll     []string    `json:"last_roll"`
	Nonces       []string    `json:"nonces"`
	RandomSeed   string      `json:"random_seed"`
	RollSnapshot int         `json:"roll_snapshot"`                         // until v011
	Cycle        int64       `json:"cycle"`                                 // added, not part of RPC response
	BakerStake   []StakeInfo `json:"selected_stake_distribution,omitempty"` // v012+
	TotalStake   ActiveStake `json:"total_active_stake"`                    // v012+, changed type in v18

}

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) UnmarshalJSON

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

type StakeInfo

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

type StakingParameters

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

type Status

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

type Ticket

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

func (Ticket) Hash64

func (t Ticket) Hash64() uint64

type TicketBalanceUpdate

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

type TicketUpdate

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

func (TicketUpdate) Prim

func (u TicketUpdate) Prim() m.Prim

type Transaction

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

Transaction represents a transaction operation

func (Transaction) AddEmbeddedAddresses

func (t Transaction) AddEmbeddedAddresses(addUnique func(tezos.Address))

func (Transaction) Addresses

func (t Transaction) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

type TransferTicket

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) AddEmbeddedAddresses

func (t TransferTicket) AddEmbeddedAddresses(addUnique func(tezos.Address))

func (TransferTicket) Addresses

func (t TransferTicket) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (TransferTicket) Costs

func (t TransferTicket) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

func (TransferTicket) EncodeParameters

func (t TransferTicket) EncodeParameters() micheline.Prim

type TxRollup

type TxRollup struct {
	// common
	Manager

	// most rollup 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) Addresses

func (t TxRollup) Addresses(set *tezos.AddressSet)

Addresses adds all addresses used in this operation to the set. Implements TypedOperation interface.

func (*TxRollup) EncodeParameters

func (r *TxRollup) EncodeParameters() micheline.Parameters

func (*TxRollup) Target

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

func (*TxRollup) UnmarshalJSON

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

type TxRollupBatch

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

func DecodeTxRollupBatch

func DecodeTxRollupBatch(data []byte) (*TxRollupBatch, error)

func (TxRollupBatch) MarshalJSON

func (b TxRollupBatch) MarshalJSON() ([]byte, error)

func (TxRollupBatch) Prim

func (b TxRollupBatch) Prim() micheline.Prim

type TxRollupCommit

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

func DecodeTxRollupCommit

func DecodeTxRollupCommit(data []byte) (*TxRollupCommit, error)

func (TxRollupCommit) MarshalJSON

func (c TxRollupCommit) MarshalJSON() ([]byte, error)

func (TxRollupCommit) Prim

func (c TxRollupCommit) Prim() micheline.Prim

type TxRollupDispatch

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

func DecodeTxRollupDispatch

func DecodeTxRollupDispatch(data []byte) (*TxRollupDispatch, error)

func (TxRollupDispatch) MarshalJSON

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

func (TxRollupDispatch) Prim

func (r TxRollupDispatch) Prim() micheline.Prim

type TxRollupRejection

type TxRollupRejection struct {
	Level                     int64           `json:"level"`
	Message                   json.RawMessage `json:"message,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"`
}

func DecodeTxRollupRejection

func DecodeTxRollupRejection(data []byte) (*TxRollupRejection, error)

func (TxRollupRejection) MarshalJSON

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

func (TxRollupRejection) Prim

func (r TxRollupRejection) Prim() micheline.Prim

type TxRollupResult

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

type TypedOperation

type TypedOperation interface {
	Kind() tezos.OpType
	Meta() OperationMetadata
	Result() OperationResult
	Fees() BalanceUpdates
	Addresses(*tezos.AddressSet)
}

TypedOperation must be implemented by all operations

type UpdateConsensusKey

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

UpdateConsensusKey represents a transaction operation

func (UpdateConsensusKey) Costs

func (t UpdateConsensusKey) Costs() tezos.Costs

Costs returns operation cost to implement TypedOperation interface.

type VdfRevelation

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

VdfRevelation represents a vdf_revelation operation

type VersionInfo

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

type VotingPeriod

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

type VotingPeriodInfo

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

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