Documentation ¶
Index ¶
- Constants
- type BCycles
- type BRights
- type BakingRights
- type Block
- type ContentsMetadata
- type Conts
- type Delegate
- type DelegateReport
- type DelegationReport
- type ECycles
- type ERights
- type EndorsingRights
- type FrozenBalance
- type FrozenBalanceByCycle
- type FrozenBalanceRewards
- type GoTezos
- func (gt *GoTezos) AddNewClient(client *TezosRPCClient)
- func (gt *GoTezos) CreateBatchPayment(payments []Payment, wallet Wallet, paymentFee int, gaslimit int, ...) ([]string, error)
- func (gt *GoTezos) CreateWallet(mnenomic string, password string) (Wallet, error)
- func (gt *GoTezos) Debug(d bool)
- func (gt *GoTezos) GetAccountBalance(tezosAddr string) (float64, error)
- func (gt *GoTezos) GetAccountBalanceAtBlock(tezosAddr string, hash string) (int, error)
- func (gt *GoTezos) GetAccountBalanceAtSnapshot(tezosAddr string, cycle int) (float64, error)
- func (gt *GoTezos) GetAllCurrentSnapShots() ([]SnapShot, error)
- func (gt *GoTezos) GetAllDelegates() ([]string, error)
- func (gt *GoTezos) GetAllDelegatesByHash(hash string) ([]string, error)
- func (gt *GoTezos) GetBakingRights(cycle int) (BakingRights, error)
- func (gt *GoTezos) GetBakingRightsForDelegate(cycle int, delegatePhk string, priority int) (BakingRights, error)
- func (gt *GoTezos) GetBakingRightsForDelegateForCycles(cycleStart int, cycleEnd int, delegatePhk string, priority int) ([]BakingRights, error)
- func (gt *GoTezos) GetBlockAtLevel(level int) (Block, error)
- func (gt *GoTezos) GetBlockByHash(hash string) (Block, error)
- func (gt *GoTezos) GetBlockHashAtLevel(level int) (string, error)
- func (gt *GoTezos) GetBlockLevelHead() (int, string, error)
- func (gt *GoTezos) GetBlockOperationHashes(blockHash string) (OperationHashes, error)
- func (gt *GoTezos) GetBlockOperationHashesAtLevel(level int) (OperationHashes, error)
- func (gt *GoTezos) GetBlockOperationHashesHead() (OperationHashes, error)
- func (gt *GoTezos) GetBlockRawOperationHashes(blockHash string) (RawOperationHashes, error)
- func (gt *GoTezos) GetBranchHash() (string, error)
- func (gt *GoTezos) GetBranchProtocol() (string, error)
- func (gt *GoTezos) GetChainHead() (Block, error)
- func (gt *GoTezos) GetChainID() (string, error)
- func (gt *GoTezos) GetContractBigMap(contract string, args MichelineExpr) ([]byte, error)
- func (gt *GoTezos) GetContractStorage(contract string) ([]byte, error)
- func (gt *GoTezos) GetCurrentCycle() (int, error)
- func (gt *GoTezos) GetCycleRewardsForDelegate(delegatePhk string, cycle int) (string, error)
- func (gt *GoTezos) GetDelegate(delegatePhk string) (Delegate, error)
- func (gt *GoTezos) GetDelegateStakingBalance(delegateAddr string, cycle int) (float64, error)
- func (gt *GoTezos) GetDelegationsForDelegate(delegatePhk string) ([]string, error)
- func (gt *GoTezos) GetDelegationsForDelegateByCycle(delegatePhk string, cycle int) ([]string, error)
- func (gt *GoTezos) GetEndorsingRights(cycle int) (EndorsingRights, error)
- func (gt *GoTezos) GetEndorsingRightsForDelegate(cycle int, delegatePhk string) (EndorsingRights, error)
- func (gt *GoTezos) GetEndorsingRightsForDelegateForCycles(cycleStart int, cycleEnd int, delegatePhk string) ([]EndorsingRights, error)
- func (gt *GoTezos) GetNetworkConstants() (NetworkConstants, error)
- func (gt *GoTezos) GetNetworkVersions() ([]NetworkVersion, error)
- func (gt *GoTezos) GetResponse(path string, args string) (ResponseRaw, error)
- func (gt *GoTezos) GetRewardsForDelegateForCycle(delegatePhk string, cycle int, fee float64) (DelegateReport, error)
- func (gt *GoTezos) GetShareOfContract(delegatePhk, delegationPhk string, cycle int) (float64, float64, error)
- func (gt *GoTezos) GetSnapShot(cycle int) (SnapShot, error)
- func (gt *GoTezos) GetStakingBalanceAtCycle(delegateAddr string, cycle int) (string, error)
- func (gt *GoTezos) HandleResponse(method string, path string, args string) (ResponseRaw, error)
- func (gt *GoTezos) ImportEncryptedWallet(pw, encKey string) (Wallet, error)
- func (gt *GoTezos) ImportWallet(address, public, secret string) (Wallet, error)
- func (gt *GoTezos) InjectOperation(op string) ([]byte, error)
- func (gt *GoTezos) IsAlphanet() bool
- func (gt *GoTezos) IsMainnet() bool
- func (gt *GoTezos) IsZeronet() bool
- func (gt *GoTezos) PostResponse(path string, args string) (ResponseRaw, error)
- func (gt *GoTezos) SetLogger(log *log.Logger)
- func (gt *GoTezos) UseBalancerStrategyFailover()
- func (gt *GoTezos) UseBalancerStrategyRandom()
- func (gt *GoTezos) WatchOperationReceipt(watchedOpHash string, receiptChannel chan<- StructOperations, ...)
- type KeyPair
- type MichelineExpr
- type NetworkConstants
- type NetworkVersion
- type NetworkVersions
- type NoClientError
- type OperationHashes
- type OperationResult
- type Payment
- type RPCGenericError
- type RPCGenericErrors
- type RawBlockHashes
- type RawOperationHashes
- type ResponseRaw
- type SnapShot
- type SnapShotQuery
- type StructBalanceUpdates
- type StructContents
- type StructHeader
- type StructLevel
- type StructMaxOperationListLength
- type StructMetadata
- type StructOperations
- type StructTestChainStatus
- type TezClientWrapper
- type TezosRPCClient
- type TransOp
- type Transfer
- type Wallet
Constants ¶
const MUTEZ = 1000000
MUTEZ is a helper for balance devision
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BCycles ¶
type BCycles struct { Cycle int `json:"cycle"` BakingRights BakingRights `json:"baking_rights"` }
BCycles is a structure representing the baking rights in a specific cycle
type BRights ¶
BRights is a structure representing baking rights for a specific delegate between cycles
type BakingRights ¶
type BakingRights []struct { Level int `json:"level"` Delegate string `json:"delegate"` Priority int `json:"priority"` EstimatedTime time.Time `json:"estimated_time"` }
BakingRights a representation of baking rights on the Tezos network
func (*BakingRights) UnmarshalJSON ¶
func (br *BakingRights) UnmarshalJSON(v []byte) (BakingRights, error)
UnmarshalJSON unmarhsels bytes into Baking_Rights
type Block ¶
type Block struct { Protocol string `json:"protocol"` ChainID string `json:"chain_id"` Hash string `json:"hash"` Header StructHeader `json:"header"` Metadata StructMetadata `json:"metadata"` Operations [][]StructOperations `json:"operations"` }
Block is a block returned by the Tezos RPC API.
type ContentsMetadata ¶
type ContentsMetadata struct { BalanceUpdates []StructBalanceUpdates `json:"balance_updates"` Slots []int `json:"slots"` OperationResult OperationResult `json:"operation_result"` }
ContentsMetadata is the Metadata found in the Contents in a operation of a block returned by the Tezos RPC API.
type Conts ¶
Conts is helper structure to build out the contents of a a transfer operation to post to the Tezos RPC
type Delegate ¶
type Delegate struct { Balance string `json:"balance"` FrozenBalance string `json:"frozen_balance"` FrozenBalanceByCycle []FrozenBalanceByCycle `json:"frozen_balance_by_cycle"` StakingBalance string `json:"staking_balance"` DelegateContracts []string `json:"delegated_contracts"` DelegatedBalance string `json:"delegated_balance"` Deactivated bool `json:"deactivated"` GracePeriod int `json:"grace_period"` }
Delegate is representation of a delegate on the Tezos Network
type DelegateReport ¶
type DelegateReport struct { DelegatePhk string Cycle int Delegations []DelegationReport CycleRewards string TotalFeeRewards string SelfBakedRewards string TotalRewards string }
func (*DelegateReport) GetPayments ¶
func (dr *DelegateReport) GetPayments() []Payment
GetPayments will convert a delegate report into payments for batch pay
type DelegationReport ¶
type ECycles ¶
type ECycles struct { Cycle int `json:"cycle"` EndorsingRights EndorsingRights `json:"endorsing_rights"` }
ECycles is a structure representing the endorsing rights in a specific cycle
type ERights ¶
ERights is a structure representing endorsing rights for a specific delegate between cycles
type EndorsingRights ¶
type EndorsingRights []struct { Level int `json:"level"` Delegate string `json:"delegate"` Slots []int `json:"slots"` EstimatedTime time.Time `json:"estimated_time"` }
EndorsingRights is a representation of endorsing rights on the Tezos network
func (*EndorsingRights) UnmarshalJSON ¶
func (er *EndorsingRights) UnmarshalJSON(v []byte) (EndorsingRights, error)
UnmarshalJSON unmarhsels bytes into Endorsing_Rights
type FrozenBalance ¶
type FrozenBalance struct { Deposits string `json:"deposits"` Fees string `json:"fees"` Rewards string `json:"rewards"` }
FrozenBalance is representation of frozen balance on the Tezos network
func (*FrozenBalance) UnmarshalJSON ¶
func (fb *FrozenBalance) UnmarshalJSON(v []byte) (FrozenBalance, error)
UnmarshalJSON unmarshalls bytes into frozen balance
type FrozenBalanceByCycle ¶
type FrozenBalanceByCycle struct { Cycle int `json:"cycle"` Deposit string `json:"deposit"` Fees string `json:"fees"` Rewards string `json:"rewards"` }
FrozenBalanceByCycle a representation of frozen balance by cycle on the Tezos network
type FrozenBalanceRewards ¶
type FrozenBalanceRewards struct { Deposits string `json:"deposits"` Fees string `json:"fees"` Rewards string `json:"rewards"` }
FrozenBalanceRewards is a FrozenBalanceRewards query returned by the Tezos RPC API.
func (*FrozenBalanceRewards) UnmarshalJSON ¶
func (fb *FrozenBalanceRewards) UnmarshalJSON(v []byte) (FrozenBalanceRewards, error)
UnmarshalJSON unmarshals the bytes received as a parameter, into the type SnapShotQuery.
type GoTezos ¶
type GoTezos struct { RPCClients []*TezClientWrapper ActiveRPCCient *TezClientWrapper Constants NetworkConstants Versions []NetworkVersion // contains filtered or unexported fields }
GoTezos manages multiple Clients each Client represents a Connection to a Tezos Node GoTezos manages failover if one Node is down, there are 2 Strategies: failover: always use the same unless it is down -> go to the next - default random: send to each Node equally
func NewGoTezos ¶
func NewGoTezos() *GoTezos
NewGoTezos is a constructor that returns a GoTezos object
func (*GoTezos) AddNewClient ¶
func (gt *GoTezos) AddNewClient(client *TezosRPCClient)
AddNewClient adds an RPC Client to query the tezos network
func (*GoTezos) CreateBatchPayment ¶
func (gt *GoTezos) CreateBatchPayment(payments []Payment, wallet Wallet, paymentFee int, gaslimit int, storageLimit int) ([]string, error)
CreateBatchPayment forges batch payments and returns them ready to inject to a Tezos RPC. PaymentFee must be expressed in mutez.
func (*GoTezos) CreateWallet ¶
CreateWallet returns Wallet with the mnemonic and password provided
func (*GoTezos) GetAccountBalance ¶
GetAccountBalance gets the balance of a public key hash at a specific snapshot for a cycle.
func (*GoTezos) GetAccountBalanceAtBlock ¶
GetAccountBalanceAtBlock get the balance of an address at a specific hash
func (*GoTezos) GetAccountBalanceAtSnapshot ¶
GetAccountBalanceAtSnapshot gets the balance of a public key hash at a specific snapshot for a cycle.
func (*GoTezos) GetAllCurrentSnapShots ¶
GetAllCurrentSnapShots gets a list of all known snapshots to the network
func (*GoTezos) GetAllDelegates ¶
GetAllDelegates a list of all tz1 addresses at the head block
func (*GoTezos) GetAllDelegatesByHash ¶
GetAllDelegatesByHash gets a list of all tz1 addresses at a certain hash
func (*GoTezos) GetBakingRights ¶
func (gt *GoTezos) GetBakingRights(cycle int) (BakingRights, error)
GetBakingRights gets the baking rights for a specific cycle
func (*GoTezos) GetBakingRightsForDelegate ¶
func (gt *GoTezos) GetBakingRightsForDelegate(cycle int, delegatePhk string, priority int) (BakingRights, error)
GetBakingRightsForDelegate gets the baking rights for a delegate at a specific cycle with a certain priority level
func (*GoTezos) GetBakingRightsForDelegateForCycles ¶
func (gt *GoTezos) GetBakingRightsForDelegateForCycles(cycleStart int, cycleEnd int, delegatePhk string, priority int) ([]BakingRights, error)
GetBakingRightsForDelegateForCycles gets the baking rights for a delegate at a range of cycles with a certain priority level
func (*GoTezos) GetBlockAtLevel ¶
GetBlockAtLevel returns a Block at a specific level
func (*GoTezos) GetBlockByHash ¶
GetBlockByHash returns a Block by the identifier hash.
func (*GoTezos) GetBlockHashAtLevel ¶
GetBlockHashAtLevel returns the hash of a block at a specific level.
func (*GoTezos) GetBlockLevelHead ¶
GetBlockLevelHead returns the level, and the hash, of the head block.
func (*GoTezos) GetBlockOperationHashes ¶
func (gt *GoTezos) GetBlockOperationHashes(blockHash string) (OperationHashes, error)
GetBlockOperationHashes returns all the operation hashes at specific block hash
func (*GoTezos) GetBlockOperationHashesAtLevel ¶
func (gt *GoTezos) GetBlockOperationHashesAtLevel(level int) (OperationHashes, error)
GetBlockOperationHashesAtLevel returns list of operations in block at specific level
func (*GoTezos) GetBlockOperationHashesHead ¶
func (gt *GoTezos) GetBlockOperationHashesHead() (OperationHashes, error)
GetBlockOperationHashesHead returns list of operations in the head block
func (*GoTezos) GetBlockRawOperationHashes ¶
func (gt *GoTezos) GetBlockRawOperationHashes(blockHash string) (RawOperationHashes, error)
GetBlockRawOperationHashes returns all the operation hashes at specific block hash as returned by RPC method
func (*GoTezos) GetBranchHash ¶
GetBranchHash returns the current branches hash
func (*GoTezos) GetBranchProtocol ¶
GetBranchProtocol returns the current Tezos protocol hash
func (*GoTezos) GetChainHead ¶
GetChainHead returns the head block from the Tezos RPC.
func (*GoTezos) GetChainID ¶
GetChainID gets the id of the chain with the most fitness
func (*GoTezos) GetContractBigMap ¶
func (gt *GoTezos) GetContractBigMap(contract string, args MichelineExpr) ([]byte, error)
GetContractBigMap gets a contract big map value for a contract
func (*GoTezos) GetContractStorage ¶
GetContractStorage gets the contract storage for a contract
func (*GoTezos) GetCurrentCycle ¶
GetCurrentCycle gets the current cycle of the chain
func (*GoTezos) GetCycleRewardsForDelegate ¶
GetCycleRewardsForDelegate gets the rewards earned by a delegate for a specific cycle.
func (*GoTezos) GetDelegate ¶
GetDelegate retrieves information about a delegate at the head block
func (*GoTezos) GetDelegateStakingBalance ¶
GetDelegateStakingBalance gets the staking balance for a delegate at a specific snapshot for a cycle.
func (*GoTezos) GetDelegationsForDelegate ¶
GetDelegationsForDelegate retrieves a list of all currently delegated contracts for a delegate.
func (*GoTezos) GetDelegationsForDelegateByCycle ¶
func (gt *GoTezos) GetDelegationsForDelegateByCycle(delegatePhk string, cycle int) ([]string, error)
GetDelegationsForDelegateByCycle retrieves a list of all currently delegated contracts for a delegate at a specific cycle.
func (*GoTezos) GetEndorsingRights ¶
func (gt *GoTezos) GetEndorsingRights(cycle int) (EndorsingRights, error)
GetEndorsingRights gets the endorsing rights for a specific cycle
func (*GoTezos) GetEndorsingRightsForDelegate ¶
func (gt *GoTezos) GetEndorsingRightsForDelegate(cycle int, delegatePhk string) (EndorsingRights, error)
GetEndorsingRightsForDelegate gets the endorsing rights for a specific cycle
func (*GoTezos) GetEndorsingRightsForDelegateForCycles ¶
func (gt *GoTezos) GetEndorsingRightsForDelegateForCycles(cycleStart int, cycleEnd int, delegatePhk string) ([]EndorsingRights, error)
GetEndorsingRightsForDelegateForCycles gets the endorsing rights for a delegate for a range of cycles
func (*GoTezos) GetNetworkConstants ¶
func (gt *GoTezos) GetNetworkConstants() (NetworkConstants, error)
GetNetworkConstants gets the network constants for the Tezos network the client is using.
func (*GoTezos) GetNetworkVersions ¶
func (gt *GoTezos) GetNetworkVersions() ([]NetworkVersion, error)
GetNetworkVersions gets the network versions of Tezos network the client is using.
func (*GoTezos) GetResponse ¶
func (gt *GoTezos) GetResponse(path string, args string) (ResponseRaw, error)
GetResponse takes path endpoint and any arguments and returns the raw response of the query
func (*GoTezos) GetRewardsForDelegateForCycle ¶
func (gt *GoTezos) GetRewardsForDelegateForCycle(delegatePhk string, cycle int, fee float64) (DelegateReport, error)
GetRewardsForDelegateForCycle gets the total rewards for a delegate earned and calculates the gross rewards earned by each delegation for a single cycle. Also includes the share of each delegation.
func (*GoTezos) GetShareOfContract ¶
func (gt *GoTezos) GetShareOfContract(delegatePhk, delegationPhk string, cycle int) (float64, float64, error)
GetShareOfContract returns the share of a delegation for a specific cycle.
func (*GoTezos) GetSnapShot ¶
GetSnapShot takes a cycle number and returns a helper structure describing a snap shot on the tezos network.
func (*GoTezos) GetStakingBalanceAtCycle ¶
GetStakingBalanceAtCycle gets the staking balance of a delegate at a specific cycle
func (*GoTezos) HandleResponse ¶
HandleResponse takes the method (GET/POST ... etc), the query path, any arguments, and returns the raw response of the query
func (*GoTezos) ImportEncryptedWallet ¶
ImportEncryptedWallet imports an encrypted wallet using password provided by caller. Caller should remove any 'encrypted:' scheme prefix.
func (*GoTezos) ImportWallet ¶
ImportWallet returns an imported Wallet
func (*GoTezos) InjectOperation ¶
InjectOperation injects an signed operation string and returns the response
func (*GoTezos) IsAlphanet ¶
IsAlphanet checks whether the current network used is the IsAlphanet
func (*GoTezos) PostResponse ¶
func (gt *GoTezos) PostResponse(path string, args string) (ResponseRaw, error)
PostResponse takes path endpoint and any arguments and returns the raw response of the POST query
func (*GoTezos) UseBalancerStrategyFailover ¶
func (gt *GoTezos) UseBalancerStrategyFailover()
UseBalancerStrategyFailover tells the client side failover to use the balancer strategy
func (*GoTezos) UseBalancerStrategyRandom ¶
func (gt *GoTezos) UseBalancerStrategyRandom()
UseBalancerStrategyRandom tells the client side failover to use the balancer random strategy
func (*GoTezos) WatchOperationReceipt ¶
func (gt *GoTezos) WatchOperationReceipt(watchedOpHash string, receiptChannel chan<- StructOperations, logChannel chan<- error)
WatchOperationReceipt watches for maximum an hour every newly mined blocks and if it finds the wanted operation, it writes its receipt on a dedicated channel
type MichelineExpr ¶
type MichelineExpr map[string]interface{}
MichelineExpr gather Michelson expressions
type NetworkConstants ¶
type NetworkConstants struct { ProofOfWorkNonceSize int `json:"proof_of_work_nonce_size"` NonceLength int `json:"nonce_length"` MaxRevelationsPerBlock int `json:"max_revelations_per_block"` MaxOperationDataLength int `json:"max_operation_data_length"` MaxProposalsPerDelegate int `json:"max_proposals_per_delegate"` PreservedCycles int `json:"preserved_cycles"` BlocksPerCycle int `json:"blocks_per_cycle"` BlocksPerCommitment int `json:"blocks_per_commitment"` BlocksPerRollSnapshot int `json:"blocks_per_roll_snapshot"` BlocksPerVotingPeriod int `json:"blocks_per_voting_period"` TimeBetweenBlocks []string `json:"time_between_blocks"` EndorsersPerBlock int `json:"endorsers_per_block"` HardGasLimitPerOperation string `json:"hard_gas_limit_per_operation"` HardGasLimitPerBlock string `json:"hard_gas_limit_per_block"` ProofOfWorkThreshold string `json:"proof_of_work_threshold"` TokensPerRoll string `json:"tokens_per_roll"` MichelsonMaximumTypeSize int `json:"michelson_maximum_type_size"` SeedNonceRevelationTip string `json:"seed_nonce_revelation_tip"` OriginationSize int `json:"origination_size"` BlockSecurityDeposit string `json:"block_security_deposit"` EndorsementSecurityDeposit string `json:"endorsement_security_deposit"` BlockReward string `json:"block_reward"` EndorsementReward string `json:"endorsement_reward"` CostPerByte string `json:"cost_per_byte"` HardStorageLimitPerOperation string `json:"hard_storage_limit_per_operation"` }
NetworkConstants represents the network constants returned by the Tezos network.
func (*NetworkConstants) UnmarshalJSON ¶
func (nc *NetworkConstants) UnmarshalJSON(v []byte) (NetworkConstants, error)
UnmarshalJSON unmarshals bytes received as a parameter, into the type NetworkConstants.
type NetworkVersion ¶
type NetworkVersion struct { Name string `json:"name"` Major int `json:"major"` Minor int `json:"minor"` Network string // Human readable network name }
NetworkVersion represents the network version returned by the Tezos network.
type NetworkVersions ¶
type NetworkVersions []NetworkVersion
NetworkVersions is an array of NetworkVersion
func (*NetworkVersions) UnmarshalJSON ¶
func (nvs *NetworkVersions) UnmarshalJSON(v []byte) (NetworkVersions, error)
UnmarshalJSON unmarshals the bytes received as a parameter, into the type NetworkVersion.
type NoClientError ¶
type NoClientError struct { }
NoClientError is a helper structure for error handling
func (NoClientError) Error ¶
func (gt NoClientError) Error() string
type OperationHashes ¶
type OperationHashes []string
OperationHashes slice
func (*OperationHashes) UnmarshalJSON ¶
func (oh *OperationHashes) UnmarshalJSON(v []byte) (OperationHashes, error)
UnmarshalJSON unmarhsels bytes into OperationHashes
type OperationResult ¶
type OperationResult struct {
Status string `json:"status"`
}
OperationResult is the metadata OperationResult found in the Contents in a operation of a block returned by the Tezos RPC API.
type Payment ¶
type Payment struct { Address string Amount float64 Parameters MichelineExpr }
Payment is a helper struct for transfers
type RPCGenericError ¶
RPCGenericError is an Error helper for the RPC
type RPCGenericErrors ¶
type RPCGenericErrors []RPCGenericError
RPCGenericErrors and array of RPCGenericErrors
func (*RPCGenericErrors) UnmarshalJSON ¶
func (ge *RPCGenericErrors) UnmarshalJSON(v []byte) (RPCGenericErrors, error)
UnmarshalJSON unmarhsels bytes into RPCGenericErrors
type RawBlockHashes ¶
type RawBlockHashes [][]string
slice of RawBlockHashes slice, as returned by GET /chains/<chain_id>/blocks
func (*RawBlockHashes) UnmarshalJSON ¶
func (bh *RawBlockHashes) UnmarshalJSON(v []byte) (RawBlockHashes, error)
UnmarshalJSON unmarshals bytes into RawBlockHashes
type RawOperationHashes ¶
type RawOperationHashes [][]string
slice of OperationHashes slice, as returned by GET /chains/<chain_id>/blocks/:block_ih/operation_hashes
func (*RawOperationHashes) UnmarshalJSON ¶
func (bh *RawOperationHashes) UnmarshalJSON(v []byte) (RawOperationHashes, error)
UnmarshalJSON unmarshals bytes into RawOperationHashes
type ResponseRaw ¶
type ResponseRaw struct {
Bytes []byte
}
ResponseRaw represents a raw RPC/HTTP response
type SnapShotQuery ¶
type SnapShotQuery struct { RandomSeed string `json:"random_seed"` RollSnapShot int `json:"roll_snapshot"` }
SnapShotQuery is a SnapShot returned by the Tezos RPC API.
func (*SnapShotQuery) UnmarshalJSON ¶
func (sq *SnapShotQuery) UnmarshalJSON(v []byte) (SnapShotQuery, error)
UnmarshalJSON unmarshals the bytes received as a parameter, into the type SnapShotQuery.
type StructBalanceUpdates ¶
type StructBalanceUpdates struct { Kind string `json:"kind"` Contract string `json:"contract,omitempty"` Change string `json:"change"` Category string `json:"category,omitempty"` Delegate string `json:"delegate,omitempty"` Level int `json:"level,omitempty"` }
StructBalanceUpdates is the BalanceUpdates found in the Metadata of a block returned by the Tezos RPC API.
type StructContents ¶
type StructContents struct { Kind string `json:"kind"` Source string `json:"source"` Fee string `json:"fee"` Counter string `json:"counter"` GasLimit string `json:"gas_limit"` StorageLimit string `json:"storage_limit"` Amount string `json:"amount"` Destination string `json:"destination"` Delegate string `json:"delegate"` Phk string `json:"phk"` Secret string `json:"secret"` Level int `json:"level"` ManagerPublicKey string `json:"managerPubkey"` Balance string `json:"balance"` Metadata ContentsMetadata `json:"metadata"` }
StructContents is the Contents found in a operation of a block returned by the Tezos RPC API.
type StructHeader ¶
type StructHeader struct { Level int `json:"level"` Proto int `json:"proto"` Predecessor string `json:"Predecessor"` Timestamp time.Time `json:"timestamp"` ValidationPass int `json:"validation_pass"` OperationsHash string `json:"operations_hash"` Fitness []string `json:"fitness"` Context string `json:"context"` Priority int `json:"priority"` ProofOfWorkNonce string `json:"proof_of_work_nonce"` Signature string `json:"signature"` }
StructHeader is a header in a block returned by the Tezos RPC API.
type StructLevel ¶
type StructLevel struct { Level int `json:"level"` LevelPosition int `json:"level_position"` Cycle int `json:"cycle"` CyclePosition int `json:"cycle_position"` VotingPeriod int `json:"voting_period"` VotingPeriodPosition int `json:"voting_period_position"` ExpectedCommitment bool `json:"expected_commitment"` }
StructLevel the Level found in the Metadata of a block returned by the Tezos RPC API.
type StructMaxOperationListLength ¶
type StructMaxOperationListLength struct { MaxSize int `json:"max_size"` MaxOp int `json:"max_op,omitempty"` }
StructMaxOperationListLength is the MaxOperationListLength found in the Metadata of a block returned by the Tezos RPC API.
type StructMetadata ¶
type StructMetadata struct { Protocol string `json:"protocol"` NextProtocol string `json:"next_protocol"` TestChainStatus StructTestChainStatus `json:"test_chain_status"` MaxOperationsTTL int `json:"max_operations_ttl"` MaxOperationDataLength int `json:"max_operation_data_length"` MaxBlockHeaderLength int `json:"max_block_header_length"` MaxOperationListLength []StructMaxOperationListLength `json:"max_operation_list_length"` Baker string `json:"baker"` Level StructLevel `json:"level"` VotingPeriodKind string `json:"voting_period_kind"` NonceHash interface{} `json:"nonce_hash"` ConsumedGas string `json:"consumed_gas"` Deactivated []string `json:"deactivated"` BalanceUpdates []StructBalanceUpdates `json:"balance_updates"` }
StructMetadata is the Metadata in a block returned by the Tezos RPC API.
type StructOperations ¶
type StructOperations struct { Protocol string `json:"protocol"` ChainID string `json:"chain_id"` Hash string `json:"hash"` Branch string `json:"branch"` Contents []StructContents `json:"contents"` Signature string `json:"signature"` }
StructOperations is the Operations found in a block returned by the Tezos RPC API.
func (*StructOperations) UnmarshalJSON ¶
func (op *StructOperations) UnmarshalJSON(v []byte) (StructOperations, error)
UnmarshalJSON unmarshals bytes into StructOperations
type StructTestChainStatus ¶
type StructTestChainStatus struct {
Status string `json:"status"`
}
StructTestChainStatus is the TestChainStatus found in the Metadata of a block returned by the Tezos RPC API.
type TezClientWrapper ¶
type TezClientWrapper struct {
// contains filtered or unexported fields
}
TezClientWrapper is a wrapper for the TezosRPCClient
type TezosRPCClient ¶
TezosRPCClient is a struct to represent the client to reach a Tezos node
func NewTezosRPCClient ¶
func NewTezosRPCClient(hostname string, port string) *TezosRPCClient
NewTezosRPCClient creates a new RPC client using the specified hostname and port. Also acceptable is the hostname of a web-endpoint that supports https.
func (*TezosRPCClient) GetResponse ¶
func (gt *TezosRPCClient) GetResponse(method string, path string, args string) (ResponseRaw, error)
GetResponse gets the raw response using TezosRPCClient with the path and args to query
func (*TezosRPCClient) Healthcheck ¶
func (gt *TezosRPCClient) Healthcheck() bool
Healthcheck a function just to perform a query to see if an RPC Client's endpoint is alive (heartbeat)
func (*TezosRPCClient) IsWebClient ¶
func (gt *TezosRPCClient) IsWebClient(b bool)
IsWebClient tells the TezosRPCClient calling it that it is a web client
func (*TezosRPCClient) SetLogger ¶
func (gt *TezosRPCClient) SetLogger(log *log.Logger)
SetLogger set the logger for the RPC Client
type TransOp ¶
type TransOp struct { Kind string `json:"kind"` Amount string `json:"amount"` Source string `json:"source"` Destination string `json:"destination"` StorageLimit string `json:"storage_limit"` GasLimit string `json:"gas_limit"` Fee string `json:"fee"` Counter string `json:"counter"` Parameters MichelineExpr `json:"parameters"` }
TransOp is a helper structure to build out a transfer operation to post to the Tezos RPC