Documentation
¶
Index ¶
- Constants
- Variables
- func BinarySearchCallback(start, end uint64, callback func(uint64) (int, error)) error
- func Blake2bSum224(data []byte) (hash []byte, err error)
- func BlakeHash(target any) (hash []byte, err error)
- func Cast[X any](target any) (casted X, ok bool)
- func ChunkString(s string, chunkSize int) []string
- func DirectoryExists(path string) bool
- func IndentCbor(input string) string
- func IterateChunkDirectory(dir string, cb func(path string, data []byte, err error) error) error
- func Log() *zerolog.Logger
- func LogAtLevel(level zerolog.Level) *zerolog.Logger
- func MarshalStack(err error) interface{}
- func MessageToProtocol(message Message) (protocol Protocol, subprotocol Subprotocol, err error)
- func StackTracerMessage(err error) string
- type Address
- func (a Address) Bech32String(network Network) (encoded string, err error)
- func (a *Address) Binary() (out []byte, err error)
- func (a Address) Header() (header AddressHeader, err error)
- func (a Address) MarshalJSON() ([]byte, error)
- func (a Address) Network() (net AddressHeaderNetwork, err error)
- func (a *Address) ParseBech32String(encoded string, network Network) (err error)
- func (a Address) String() string
- func (a Address) Type() (typ AddressType, err error)
- type AddressFormat
- type AddressHeader
- func (a AddressHeader) Format() (format AddressFormat, err error)
- func (a AddressHeader) IsForNetwork(params *NetworkParams) (match bool, err error)
- func (a AddressHeader) Network() (network AddressHeaderNetwork, err error)
- func (a *AddressHeader) SetNetwork(network AddressHeaderNetwork)
- func (a *AddressHeader) SetType(headerType AddressHeaderType)
- func (a AddressHeader) String() string
- func (a AddressHeader) Type() (typ AddressType, err error)
- func (a AddressHeader) Valid() bool
- func (a AddressHeader) Validate() (err error)
- type AddressHeaderNetwork
- type AddressHeaderType
- type AddressType
- type AmountData
- type AuxData
- func (a *AuxData) Hash() (hash []byte, err error)
- func (a *AuxData) JSON() (jsn gjson.Result, err error)
- func (a *AuxData) MarshalCBOR() (bytes []byte, err error)
- func (a *AuxData) MarshalJSON() (bytes []byte, err error)
- func (a *AuxData) SetMemo(memo string)
- func (a *AuxData) UnmarshalCBOR(bytes []byte) (err error)
- type Base58Bytes
- type Block
- type BlockHeader
- type BlockProcessor
- type CBORUnmarshalError
- type Client
- func (c *Client) FetchLatestBlock() (block ledger.Block, err error)
- func (c *Client) GetBlockByHeight(height uint64) (block ledger.Block, err error)
- func (c *Client) GetBlockByPoint(point PointRef) (block ledger.Block, err error)
- func (c *Client) GetHeight() (height PointRef, err error)
- func (c *Client) GetProtocolParams() (params common2.ProtocolParameters, err error)
- func (c *Client) GetTip() (point PointRef, err error)
- func (c *Client) GetTransaction(hash string) (tx ledger.Transaction, block ledger.Block, err error)
- func (c *Client) GetUtxoForAddress(address string) (utxos []UtxoWithHeight, err error)
- func (c *Client) Start() (err error)
- func (c *Client) Stop() (err error)
- func (c *Client) SubmitTx(signedTx []byte) (err error)
- type ClientOptions
- type CollateralInput
- type CollateralReturn
- type CollateralReturnA
- type CollateralReturnB
- type CollateralReturnC
- type CollateralReturnD
- type Database
- type Direction
- type Era
- type HasSubtypes
- type HexBytes
- type HexString
- type KV
- type KVSlice
- type Message
- type MessageAcceptTx
- type MessageAcceptVersionNtC
- type MessageAcceptVersionNtN
- type MessageAwaitReply
- type MessageBatchDone
- type MessageBlock
- type MessageChainSyncDone
- type MessageClientDone
- type MessageFindIntersect
- type MessageIntersectFound
- type MessageIntersectNotFound
- type MessageKeepAlive
- type MessageKeepAliveResponse
- type MessageLocalStateAcquire
- type MessageLocalStateAcquireImmutableTip
- type MessageLocalStateAcquireVolatileTip
- type MessageLocalStateAcquired
- type MessageLocalStateDone
- type MessageLocalStateFailure
- type MessageLocalStateQuery
- type MessageLocalStateReacquire
- type MessageLocalStateReacquireImmutableTip
- type MessageLocalStateReacquireVolatileTip
- type MessageLocalStateRelease
- type MessageLocalStateResult
- type MessageNoBlocks
- type MessageProposeVersions
- type MessageQueryReply
- type MessageReader
- type MessageRefuse
- type MessageRejectTx
- type MessageRequestNext
- type MessageRequestRange
- type MessageRollBackward
- type MessageRollForward
- type MessageRollForwardData
- type MessageRollForwardDataA
- type MessageRollForwardDataB
- type MessageStartBatch
- type MessageSubmitTx
- type Network
- type NetworkMagic
- type NetworkParams
- type Optional
- type PeriodicCaller
- type Point
- type PointAndBlockNum
- type PointRef
- type Protocol
- type RpcError
- type Segment
- type SqlLiteDatabase
- func (s *SqlLiteDatabase) AddPoints(points []PointRef) (err error)
- func (s *SqlLiteDatabase) AddTxsForBlock(refs []TxRef) (err error)
- func (s *SqlLiteDatabase) GetBlockNumForTx(txhash string) (blockNumber uint64, err error)
- func (s *SqlLiteDatabase) GetBoundaryPointBehind(blockHash string) (point PointRef, err error)
- func (s *SqlLiteDatabase) GetHighestPoint() (point PointRef, err error)
- func (s *SqlLiteDatabase) GetPointByHash(blockHash string) (point PointRef, err error)
- func (s *SqlLiteDatabase) GetPointByHeight(height uint64) (point PointRef, err error)
- func (s *SqlLiteDatabase) GetPointsBySlot(slot uint64) (points []PointRef, err error)
- func (s *SqlLiteDatabase) GetPointsForLastSlot() (points []PointRef, err error)
- func (s *SqlLiteDatabase) GetPointsForProcessing(batchSize int) (points []PointRef, err error)
- func (s *SqlLiteDatabase) GetTxs(txHashes []string) (txs []TxRef, err error)
- func (s *SqlLiteDatabase) HandleRollback(fromSlot uint64) (err error)
- func (s *SqlLiteDatabase) SetPointHeights(updates []PointRef) (err error)
- type Subprotocol
- type SubtypeOf
- type TransactionBody
- type TransactionInput
- type TransactionOutput
- type TransactionOutputA
- type TransactionOutputB
- type TransactionOutputC
- type TransactionOutputD
- type TransactionOutputE
- type TransactionOutputExtra
- type TransactionOutputF
- type TransactionOutputG
- type TransactionOutputGeneric
- type TransactionWitnessSet
- type TxRef
- type TxSigner
- type TxSubmission
- type TxSubmissionBody
- type TxSubmissionWitness
- type UtxoWithHeight
- type VersionField1
- type VersionField2
- type VersionMap
- type VrfCert
- type WithCborTag
- type WithSubprotocol
Constants ¶
View Source
const ( // MinUtxoBytes The smallest size in bytes a cardano transaction can be. // // It was originally 160 as defined here: // https://github.com/IntersectMBO/cardano-ledger/blob/a6f276a9e3df45d69be3a593d3db6cd9dfaa7a02/eras/babbage/impl/src/Cardano/Ledger/Babbage/TxOut.hs#L680 // // However, the smallest conway transaction I've been able to build was 197 bytes. MinUtxoBytes = 197 MaxAuxDataStringSize = 64 )
View Source
const ( SubprotocolLocalStateAcquire = 0 SubprotocolLocalStateAcquired = 1 SubprotocolLocalStateFailure = 2 SubprotocolLocalStateQuery = 3 SubprotocolLocalStateResult = 4 SubprotocolLocalStateRelease = 5 SubprotocolLocalStateReacquire = 6 SubprotocolLocalStateDone = 7 SubprotocolLocalStateAcquireVolatileTip = 8 SubprotocolLocalStateReacquireVolatileTip = 9 SubprotocolLocalStateAcquireImmutableTip = 10 SubprotocolLocalStateReacquireImmutableTip = 11 )
View Source
const ( N2NProtocolV4 = iota + 4 N2NProtocolV5 N2NProtocolV6 N2NProtocolV7 N2NProtocolV8 N2NProtocolV9 N2NProtocolV10 N2NProtocolV11 N2NProtocolV12 N2NProtocolV13 )
View Source
const (
BlockBatchSize = 10000
)
View Source
const MayaProtocolAuxKey = 6676
Variables ¶
View Source
var ( AddressHeaderTypeStakePaymentKeyHash AddressHeaderType = [4]byte{0, 0, 0, 0} AddressHeaderTypeStakeScriptHash AddressHeaderType = [4]byte{0, 0, 0, 1} AddressHeaderTypeScriptPaymentKeyHash AddressHeaderType = [4]byte{0, 0, 1, 0} AddressHeaderTypeScriptScriptHash AddressHeaderType = [4]byte{0, 0, 1, 1} AddressHeaderTypePointerPaymentKeyHash AddressHeaderType = [4]byte{0, 1, 0, 0} AddressHeaderTypePointerScriptHash AddressHeaderType = [4]byte{0, 1, 0, 1} AddressHeaderTypePaymentKeyHash AddressHeaderType = [4]byte{0, 1, 1, 0} AddressHeaderTypeScriptHash AddressHeaderType = [4]byte{0, 1, 1, 1} AddressHeaderTypeStakeRewardHash AddressHeaderType = [4]byte{1, 1, 1, 0} AddressHeaderTypeScriptRewardHash AddressHeaderType = [4]byte{1, 1, 1, 1} AddressHeaderNetworkTestnet AddressHeaderNetwork = [4]byte{0, 0, 0, 0} AddressHeaderNetworkMainnet AddressHeaderNetwork = [4]byte{0, 0, 0, 1} )
View Source
var ( ErrBlockProcessorStarting = RpcError{Msg: "block processor starting", Code: http.StatusNotFound} ErrPointNotFound = RpcError{Msg: "point not found", Code: http.StatusNotFound} ErrBlockNotFound = RpcError{Msg: "block not found", Code: http.StatusNotFound} ErrTransactionNotFound = RpcError{Msg: "transaction not found", Code: http.StatusNotFound} ErrNotEnoughFunds = RpcError{Msg: "not enough funds", Code: http.StatusBadRequest} ErrInvalidPrivateKey = RpcError{Msg: "invalid private key", Code: http.StatusBadRequest} ErrInvalidPublicKey = RpcError{Msg: "invalid public key", Code: http.StatusBadRequest} ErrInvalidPublicKeyType = RpcError{Msg: "invalid public key type", Code: http.StatusBadRequest} ErrInvalidCliResponse = RpcError{Msg: "invalid cardano-cli response", Code: http.StatusBadRequest} ErrRpcFailed = RpcError{Msg: "rpc failed", Code: 0} ErrNodeCommandFailed = RpcError{Msg: "node command failed", Code: http.StatusBadRequest} ErrNetworkInvalid = RpcError{Msg: "network invalid", Code: http.StatusBadRequest} )
View Source
var AddressTypeMap = map[AddressType]AddressFormat{ AddressTypePaymentAndStake: { Type: AddressTypePaymentAndStake, HeaderType: AddressHeaderTypeStakePaymentKeyHash, }, AddressTypeScriptAndStake: { Type: AddressTypeScriptAndStake, HeaderType: AddressHeaderTypeStakeScriptHash, }, AddressTypePaymentAndScript: { Type: AddressTypePaymentAndScript, HeaderType: AddressHeaderTypeScriptPaymentKeyHash, }, AddressTypeScriptAndScript: { Type: AddressTypeScriptAndScript, HeaderType: AddressHeaderTypeScriptScriptHash, }, AddressTypePaymentAndPointer: { Type: AddressTypePaymentAndPointer, HeaderType: AddressHeaderTypePointerPaymentKeyHash, }, AddressTypeScriptAndPointer: { Type: AddressTypeScriptAndPointer, HeaderType: AddressHeaderTypePointerScriptHash, }, AddressTypePayment: { Type: AddressTypePayment, HeaderType: AddressHeaderTypePaymentKeyHash, }, AddressTypeScript: { Type: AddressTypeScript, HeaderType: AddressHeaderTypeScriptHash, }, AddressTypeStakeReward: { Type: AddressTypeStakeReward, HeaderType: AddressHeaderTypeStakeRewardHash, }, AddressTypeScriptReward: { Type: AddressTypeScriptReward, HeaderType: AddressHeaderTypeScriptRewardHash, }, }
View Source
var EraStringMap = map[Era]string{ EraByronEBB: "ByronEBB", EraByron: "Byron", EraShelley: "Shelley", EraAllegra: "Allegra", EraMary: "Mary", EraAlonzo: "Alonzo", EraBabbage: "Babbage", EraConway: "Conway", }
View Source
var MainNetParams = NetworkParams{}
View Source
var MessageProtocolMap = map[reflect.Type]Protocol{ reflect.TypeOf(&MessageProposeVersions{}): ProtocolHandshake, reflect.TypeOf(&MessageRefuse{}): ProtocolHandshake, reflect.TypeOf(&MessageQueryReply{}): ProtocolHandshake, reflect.TypeOf(&MessageAcceptVersionNtN{}): ProtocolHandshake, reflect.TypeOf(&MessageRequestNext{}): ProtocolChainSync, reflect.TypeOf(&MessageAwaitReply{}): ProtocolChainSync, reflect.TypeOf(&MessageRollForward{}): ProtocolChainSync, reflect.TypeOf(&MessageRollBackward{}): ProtocolChainSync, reflect.TypeOf(&MessageFindIntersect{}): ProtocolChainSync, reflect.TypeOf(&MessageIntersectFound{}): ProtocolChainSync, reflect.TypeOf(&MessageIntersectNotFound{}): ProtocolChainSync, reflect.TypeOf(&MessageChainSyncDone{}): ProtocolChainSync, reflect.TypeOf(&MessageRequestRange{}): ProtocolBlockFetch, reflect.TypeOf(&MessageClientDone{}): ProtocolBlockFetch, reflect.TypeOf(&MessageStartBatch{}): ProtocolBlockFetch, reflect.TypeOf(&MessageNoBlocks{}): ProtocolBlockFetch, reflect.TypeOf(&MessageBlock{}): ProtocolBlockFetch, reflect.TypeOf(&MessageBatchDone{}): ProtocolBlockFetch, reflect.TypeOf(&MessageKeepAliveResponse{}): ProtocolKeepAlive, reflect.TypeOf(&MessageKeepAlive{}): ProtocolKeepAlive, }
View Source
var MessageSubprotocolMap = map[reflect.Type]Subprotocol{ reflect.TypeOf(&MessageProposeVersions{}): SubprotocolHandshakeProposedVersion, reflect.TypeOf(&MessageRefuse{}): SubprotocolHandshakeRefuse, reflect.TypeOf(&MessageQueryReply{}): SubprotocolHandshakeQueryReply, reflect.TypeOf(&MessageAcceptVersionNtN{}): SubprotocolHandshakeAcceptVersion, reflect.TypeOf(&MessageRequestNext{}): SubprotocolChainSyncRequestNext, reflect.TypeOf(&MessageAwaitReply{}): SubprotocolChainSyncAwaitReply, reflect.TypeOf(&MessageRollForward{}): SubprotocolChainSyncRollForward, reflect.TypeOf(&MessageRollBackward{}): SubprotocolChainSyncRollBackward, reflect.TypeOf(&MessageFindIntersect{}): SubprotocolChainSyncFindIntersect, reflect.TypeOf(&MessageIntersectFound{}): SubprotocolChainSyncIntersectFound, reflect.TypeOf(&MessageIntersectNotFound{}): SubprotocolChainSyncIntersectNotFound, reflect.TypeOf(&MessageChainSyncDone{}): SubprotocolChainSyncDone, reflect.TypeOf(&MessageRequestRange{}): SubprotocolBlockFetchRequestRange, reflect.TypeOf(&MessageClientDone{}): SubprotocolBlockFetchClientDone, reflect.TypeOf(&MessageStartBatch{}): SubprotocolBlockFetchStartBatch, reflect.TypeOf(&MessageNoBlocks{}): SubprotocolBlockFetchNoBlocks, reflect.TypeOf(&MessageBlock{}): SubprotocolBlockFetchBlock, reflect.TypeOf(&MessageBatchDone{}): SubprotocolBlockFetchBatchDone, reflect.TypeOf(&MessageKeepAliveResponse{}): SubprotocolKeepAliveEcho, reflect.TypeOf(&MessageKeepAlive{}): SubprotocolKeepAlivePing, }
View Source
var PreProdParams = NetworkParams{}
View Source
var PrivateNetParams = NetworkParams{}
View Source
var ProtocolMessageMap = map[Protocol]map[Subprotocol]Message{ ProtocolHandshake: { SubprotocolHandshakeProposedVersion: &MessageProposeVersions{}, SubprotocolHandshakeAcceptVersion: &MessageAcceptVersionNtC{}, SubprotocolHandshakeRefuse: &MessageRefuse{}, SubprotocolHandshakeQueryReply: &MessageQueryReply{}, }, ProtocolChainSync: { SubprotocolChainSyncRequestNext: &MessageRequestNext{}, SubprotocolChainSyncAwaitReply: &MessageAwaitReply{}, SubprotocolChainSyncRollForward: &MessageRollForward{}, SubprotocolChainSyncRollBackward: &MessageRollBackward{}, SubprotocolChainSyncFindIntersect: &MessageFindIntersect{}, SubprotocolChainSyncIntersectFound: &MessageIntersectFound{}, SubprotocolChainSyncIntersectNotFound: &MessageIntersectNotFound{}, SubprotocolChainSyncDone: &MessageChainSyncDone{}, }, ProtocolBlockFetch: { SubprotocolBlockFetchRequestRange: &MessageRequestRange{}, SubprotocolBlockFetchClientDone: &MessageClientDone{}, SubprotocolBlockFetchStartBatch: &MessageStartBatch{}, SubprotocolBlockFetchNoBlocks: &MessageNoBlocks{}, SubprotocolBlockFetchBlock: &MessageBlock{}, SubprotocolBlockFetchBatchDone: &MessageBatchDone{}, }, ProtocolKeepAlive: { SubprotocolKeepAliveEcho: &MessageKeepAliveResponse{}, SubprotocolKeepAlivePing: &MessageKeepAlive{}, }, ProtocolLocalState: { SubprotocolLocalStateAcquire: &MessageLocalStateAcquire{}, SubprotocolLocalStateAcquired: &MessageLocalStateAcquired{}, SubprotocolLocalStateFailure: &MessageLocalStateFailure{}, SubprotocolLocalStateQuery: &MessageLocalStateQuery{}, SubprotocolLocalStateResult: &MessageLocalStateResult{}, SubprotocolLocalStateRelease: &MessageLocalStateRelease{}, SubprotocolLocalStateReacquire: &MessageLocalStateReacquire{}, SubprotocolLocalStateDone: &MessageLocalStateDone{}, SubprotocolLocalStateAcquireVolatileTip: &MessageLocalStateAcquireVolatileTip{}, SubprotocolLocalStateReacquireVolatileTip: &MessageLocalStateReacquireVolatileTip{}, SubprotocolLocalStateAcquireImmutableTip: &MessageLocalStateAcquireImmutableTip{}, SubprotocolLocalStateReacquireImmutableTip: &MessageLocalStateReacquireImmutableTip{}, }, ProtocolLocalTx: {}, }
View Source
var ProtocolStringMap = map[Protocol]string{ ProtocolHandshake: "handshake", ProtocolChainSync: "chain sync", ProtocolBlockFetch: "block fetch", ProtocolTxSubmission: "tx submission", ProtocolLocalChainSync: "local chain sync", ProtocolLocalTx: "local tx", ProtocolLocalState: "local state", ProtocolKeepAlive: "keep alive", }
View Source
var StandardCborDecoder, _ = cbor.DecOptions{
UTF8: cbor.UTF8DecodeInvalid,
MaxArrayElements: math.MaxInt32,
MaxMapPairs: math.MaxInt32,
}.DecMode()
Functions ¶
func BinarySearchCallback ¶
func Blake2bSum224 ¶
func Cast ¶
Cast acts exactly like the builtin go cast but the return value (if ok) is automatically converted from aliases of the target type.
e.g.
type Map map[string]any
nonBuiltinValue := Map{"test": 1}
if builtinValue, ok := Cast[map[string]any](nonBuiltinValue); ok {
// We have our typed and auto-converted value here
}
func ChunkString ¶
func DirectoryExists ¶
func IndentCbor ¶
func IterateChunkDirectory ¶
func MarshalStack ¶
func MarshalStack(err error) interface{}
func MessageToProtocol ¶
func MessageToProtocol(message Message) (protocol Protocol, subprotocol Subprotocol, err error)
func StackTracerMessage ¶
Types ¶
type Address ¶
type Address []byte
func DecodeAddress ¶
DecodeAddress accepts a Bech32 address string and parses it into a Cardano Address interface.
func EncodeAddress ¶
func EncodeAddress(publicKey []byte, net Network, typ AddressType) (addr Address, err error)
EncodeAddress accepts an Ed25519 public key and returns a Cardano Address interface.
func (Address) Bech32String ¶
func (Address) Header ¶
func (a Address) Header() (header AddressHeader, err error)
func (Address) MarshalJSON ¶
func (Address) Network ¶
func (a Address) Network() (net AddressHeaderNetwork, err error)
func (*Address) ParseBech32String ¶
func (Address) Type ¶
func (a Address) Type() (typ AddressType, err error)
type AddressFormat ¶
type AddressFormat struct {
Type AddressType
HeaderType AddressHeaderType
}
type AddressHeader ¶
type AddressHeader byte
func (AddressHeader) Format ¶
func (a AddressHeader) Format() (format AddressFormat, err error)
func (AddressHeader) IsForNetwork ¶
func (a AddressHeader) IsForNetwork(params *NetworkParams) (match bool, err error)
func (AddressHeader) Network ¶
func (a AddressHeader) Network() (network AddressHeaderNetwork, err error)
func (*AddressHeader) SetNetwork ¶
func (a *AddressHeader) SetNetwork(network AddressHeaderNetwork)
func (*AddressHeader) SetType ¶
func (a *AddressHeader) SetType(headerType AddressHeaderType)
func (AddressHeader) String ¶
func (a AddressHeader) String() string
func (AddressHeader) Type ¶
func (a AddressHeader) Type() (typ AddressType, err error)
func (AddressHeader) Valid ¶
func (a AddressHeader) Valid() bool
func (AddressHeader) Validate ¶
func (a AddressHeader) Validate() (err error)
type AddressHeaderNetwork ¶
type AddressHeaderNetwork [4]byte
func (AddressHeaderNetwork) String ¶
func (a AddressHeaderNetwork) String() string
type AddressHeaderType ¶
type AddressHeaderType [4]byte
type AddressType ¶
type AddressType int
const ( AddressTypePaymentAndStake AddressType = iota AddressTypeScriptAndStake AddressTypePaymentAndScript AddressTypeScriptAndScript AddressTypePaymentAndPointer AddressTypeScriptAndPointer AddressTypePayment AddressTypeScript AddressTypeStakeReward AddressTypeScriptReward )
func (AddressType) Format ¶
func (a AddressType) Format() (format AddressFormat, err error)
func (AddressType) String ¶
func (a AddressType) String() string
type AmountData ¶
type AmountData struct {
Amount uint64
Mappings map[cbor.ByteString]map[cbor.ByteString]uint64
// contains filtered or unexported fields
}
func (AmountData) MarshalJSON ¶
func (t AmountData) MarshalJSON() ([]byte, error)
type AuxData ¶
type AuxData struct {
Value any
}
func (*AuxData) MarshalCBOR ¶
func (*AuxData) MarshalJSON ¶
func (*AuxData) UnmarshalCBOR ¶
type Base58Bytes ¶
type Base58Bytes []byte
func (Base58Bytes) MarshalJSON ¶
func (b Base58Bytes) MarshalJSON() ([]byte, error)
func (Base58Bytes) String ¶
func (b Base58Bytes) String() string
type Block ¶
type Block struct {
Era Era `json:"era"`
Data struct {
Header BlockHeader `json:"header"`
TransactionBodies []TransactionBody `json:"transactionBodies"`
TransactionWitnessSets []TransactionWitnessSet `json:"transactionWitnessSets"`
AuxiliaryData AuxData `json:"auxiliaryData"`
InvalidTransactions []uint64 `json:"invalidTransactions"`
// contains filtered or unexported fields
} `json:"data"`
Raw []byte `cbor:"-" json:"-"`
// contains filtered or unexported fields
}
func (*Block) PointAndNumber ¶
func (b *Block) PointAndNumber() (pn PointAndBlockNum, err error)
type BlockHeader ¶
type BlockHeader struct {
Body struct {
Number uint64 `json:"number,omitempty"`
Slot uint64 `json:"slot,omitempty"`
PrevHash HexBytes `json:"prevHash,omitempty"`
IssuerVkey HexBytes `json:"issuerVkey,omitempty"`
VrfKey HexBytes `json:"vrfKey,omitempty"`
VrfResult VrfCert `json:"vrfResult,omitempty"`
BodySize uint64 `json:"bodySize,omitempty"`
BodyHash HexBytes `json:"bodyHash,omitempty"`
OperationalCert struct {
HotVkey HexBytes `json:"hotVkey,omitempty"`
Sequence uint64 `json:"sequence,omitempty"`
KesPeriod int64 `json:"kesPeriod,omitempty"`
Sigma HexBytes `json:"sigma,omitempty"`
// contains filtered or unexported fields
} `json:"operationalCert"`
ProtocolVersion struct {
Pt1 int64 `json:"pt1,omitempty"`
Pt2 int64 `json:"pt2,omitempty"`
// contains filtered or unexported fields
} `json:"protocolVersion"`
// contains filtered or unexported fields
} `json:"body"`
Signature HexBytes `json:"signature,omitempty"`
// contains filtered or unexported fields
}
type BlockProcessor ¶
type BlockProcessor struct {
// contains filtered or unexported fields
}
func NewBlockProcessor ¶
func (*BlockProcessor) HandleRollback ¶
func (bp *BlockProcessor) HandleRollback(rollbackSlot uint64) error
func (*BlockProcessor) TryProcessBlocks ¶
func (bp *BlockProcessor) TryProcessBlocks()
type CBORUnmarshalError ¶
func (CBORUnmarshalError) Error ¶
func (c CBORUnmarshalError) Error() string
type Client ¶
type Client struct {
Options *ClientOptions
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(options *ClientOptions) (client *Client, err error)
func (*Client) FetchLatestBlock ¶
func (*Client) GetBlockByHeight ¶
func (*Client) GetBlockByPoint ¶
func (*Client) GetProtocolParams ¶
func (c *Client) GetProtocolParams() (params common2.ProtocolParameters, err error)
func (*Client) GetTransaction ¶
func (*Client) GetUtxoForAddress ¶
func (c *Client) GetUtxoForAddress(address string) (utxos []UtxoWithHeight, err error)
type ClientOptions ¶
type CollateralInput ¶
type CollateralReturn ¶
type CollateralReturn struct {
HasSubtypes
}
func (CollateralReturn) Subtypes ¶
func (r CollateralReturn) Subtypes() []any
type CollateralReturnA ¶
type CollateralReturnA struct {
A HexBytes
B AmountData
// contains filtered or unexported fields
}
type CollateralReturnB ¶
type CollateralReturnC ¶
type CollateralReturnD ¶
type CollateralReturnD struct {
A HexBytes `cbor:"0,keyasint"`
B AmountData `cbor:"1,keyasint"`
}
type Database ¶
type Database interface {
AddTxsForBlock(refs []TxRef) (err error)
GetTxs(txHashes []string) (txs []TxRef, err error)
GetBlockNumForTx(txHash string) (block uint64, err error)
AddPoints(points []PointRef) (err error)
SetPointHeights(updates []PointRef) (err error)
GetPointByHash(blockHash string) (point PointRef, err error)
GetPointByHeight(height uint64) (point PointRef, err error)
GetBoundaryPointBehind(blockHash string) (point PointRef, err error)
GetPointsBySlot(slot uint64) (points []PointRef, err error)
GetPointsForLastSlot() (points []PointRef, err error)
GetPointsForProcessing(batchSize int) (points []PointRef, err error)
GetHighestPoint() (point PointRef, err error)
HandleRollback(fromSlot uint64) (err error)
}
type HasSubtypes ¶
type HasSubtypes interface {
Subtypes() []any
}
type Message ¶
type Message interface {
SetSubprotocol(Subprotocol)
GetSubprotocol() Subprotocol
Raw() []byte
SetRaw(raw []byte)
}
func ProtocolToMessage ¶
func ProtocolToMessage(protocol Protocol, subprotocol Subprotocol) (message Message, err error)
type MessageAcceptTx ¶
type MessageAcceptTx struct {
WithSubprotocol
}
type MessageAcceptVersionNtC ¶
type MessageAcceptVersionNtC struct {
WithSubprotocol
Version uint16 `json:"version,omitempty"`
VersionData VersionField1 `json:"versionData,omitempty"`
}
type MessageAcceptVersionNtN ¶
type MessageAcceptVersionNtN struct {
WithSubprotocol
Version uint16 `json:"version,omitempty"`
VersionData VersionField2 `json:"versionData,omitempty"`
}
type MessageAwaitReply ¶
type MessageAwaitReply struct {
WithSubprotocol
}
type MessageBatchDone ¶
type MessageBatchDone struct {
WithSubprotocol
}
type MessageBlock ¶
type MessageBlock struct {
WithSubprotocol
BlockData []byte
}
func (*MessageBlock) Block ¶
func (b *MessageBlock) Block() (block *Block, err error)
type MessageChainSyncDone ¶
type MessageChainSyncDone struct {
WithSubprotocol
}
type MessageClientDone ¶
type MessageClientDone struct {
WithSubprotocol
}
type MessageFindIntersect ¶
type MessageFindIntersect struct {
WithSubprotocol
Points []Point `json:"points"`
}
type MessageIntersectFound ¶
type MessageIntersectFound struct {
WithSubprotocol
Point Point `json:"point,omitempty"`
Tip PointAndBlockNum `json:"tip,omitempty"`
}
type MessageIntersectNotFound ¶
type MessageIntersectNotFound struct {
WithSubprotocol
Tip PointAndBlockNum `json:"tip"`
}
type MessageKeepAlive ¶
type MessageKeepAlive struct {
WithSubprotocol
Cookie uint16 `json:"cookie,omitempty"`
}
type MessageKeepAliveResponse ¶
type MessageKeepAliveResponse struct {
WithSubprotocol
Cookie uint16 `json:"cookie,omitempty"`
}
type MessageLocalStateAcquire ¶
type MessageLocalStateAcquire struct {
WithSubprotocol
}
type MessageLocalStateAcquireImmutableTip ¶
type MessageLocalStateAcquireImmutableTip struct {
WithSubprotocol
}
type MessageLocalStateAcquireVolatileTip ¶
type MessageLocalStateAcquireVolatileTip struct {
WithSubprotocol
}
type MessageLocalStateAcquired ¶
type MessageLocalStateAcquired struct {
WithSubprotocol
}
type MessageLocalStateDone ¶
type MessageLocalStateDone struct {
WithSubprotocol
}
type MessageLocalStateFailure ¶
type MessageLocalStateFailure struct {
WithSubprotocol
}
type MessageLocalStateQuery ¶
type MessageLocalStateQuery struct {
WithSubprotocol
Query any
}
type MessageLocalStateReacquire ¶
type MessageLocalStateReacquire struct {
WithSubprotocol
}
type MessageLocalStateReacquireImmutableTip ¶
type MessageLocalStateReacquireImmutableTip struct {
WithSubprotocol
}
type MessageLocalStateReacquireVolatileTip ¶
type MessageLocalStateReacquireVolatileTip struct {
WithSubprotocol
}
type MessageLocalStateRelease ¶
type MessageLocalStateRelease struct {
WithSubprotocol
}
type MessageLocalStateResult ¶
type MessageLocalStateResult struct {
WithSubprotocol
Result any
}
type MessageNoBlocks ¶
type MessageNoBlocks struct {
WithSubprotocol
}
type MessageProposeVersions ¶
type MessageProposeVersions struct {
WithSubprotocol
VersionMap VersionMap `json:"versionMap"`
}
type MessageQueryReply ¶
type MessageQueryReply struct {
WithSubprotocol
}
type MessageReader ¶
type MessageReader struct {
// contains filtered or unexported fields
}
func NewMessageReader ¶
func NewMessageReader(log *zerolog.Logger) *MessageReader
type MessageRefuse ¶
type MessageRefuse struct {
WithSubprotocol
Details struct {
Code uint16 `json:"something"`
Version uint16 `json:"version"`
Reason string `json:"reason"`
// contains filtered or unexported fields
} `json:"details"`
}
type MessageRejectTx ¶
type MessageRejectTx struct {
WithSubprotocol
Reason uint64
}
type MessageRequestNext ¶
type MessageRequestNext struct {
WithSubprotocol
}
type MessageRequestRange ¶
type MessageRequestRange struct {
WithSubprotocol
From Point `json:"from"`
To Point `json:"to"`
}
type MessageRollBackward ¶
type MessageRollBackward struct {
WithSubprotocol
Point Optional[Point] `json:"point,omitempty"`
Tip PointAndBlockNum `json:"tip,omitempty"`
}
type MessageRollForward ¶
type MessageRollForward struct {
WithSubprotocol
Data SubtypeOf[MessageRollForwardData] `json:"data"`
Tip PointAndBlockNum `json:"tip"`
}
type MessageRollForwardData ¶
type MessageRollForwardData struct{}
func (MessageRollForwardData) Subtypes ¶
func (m MessageRollForwardData) Subtypes() []any
type MessageRollForwardDataA ¶
type MessageRollForwardDataB ¶
type MessageStartBatch ¶
type MessageStartBatch struct {
WithSubprotocol
}
type MessageSubmitTx ¶
type MessageSubmitTx struct {
WithSubprotocol
BodyType Era
TxBytes []byte
}
type Network ¶
type Network string
func (Network) Params ¶
func (n Network) Params() (params *NetworkParams, err error)
type NetworkMagic ¶
type NetworkMagic uint64
const ( NetworkMagicMainNet NetworkMagic = 764824073 NetworkMagicLegacyTestnet NetworkMagic = 1097911063 NetworkMagicPreProd NetworkMagic = 1 NetworkMagicPreview NetworkMagic = 2 NetworkMagicSanchonet NetworkMagic = 4 NetworkMagicPrivateNet NetworkMagic = 42 )
type NetworkParams ¶
type Optional ¶
func (Optional[T]) MarshalCBOR ¶
func (Optional[T]) MarshalJSON ¶
func (*Optional[T]) UnmarshalCBOR ¶
func (*Optional[T]) UnmarshalJSON ¶
type PeriodicCaller ¶
type PeriodicCaller struct {
// contains filtered or unexported fields
}
func NewPeriodicCaller ¶
func NewPeriodicCaller(interval time.Duration, action func()) *PeriodicCaller
func (*PeriodicCaller) Postpone ¶
func (pc *PeriodicCaller) Postpone()
func (*PeriodicCaller) Start ¶
func (pc *PeriodicCaller) Start()
func (*PeriodicCaller) Stop ¶
func (pc *PeriodicCaller) Stop()
type Point ¶
type Point struct {
Slot uint64 `cbor:",omitempty" json:"slot"`
Hash HexBytes `chor:",omitempty" json:"hash"`
// contains filtered or unexported fields
}
func (*Point) UnmarshalCBOR ¶
type PointAndBlockNum ¶
type PointAndBlockNum struct {
Point Point `json:"point"`
Block uint64 `json:"block"`
// contains filtered or unexported fields
}
func NewPointAndNum ¶
func NewPointAndNum() PointAndBlockNum
func (PointAndBlockNum) Equals ¶
func (t PointAndBlockNum) Equals(o PointAndBlockNum) bool
func (PointAndBlockNum) String ¶
func (t PointAndBlockNum) String() string
type PointRef ¶
type RpcError ¶
type Segment ¶
type Segment struct {
Timestamp uint32
Protocol Protocol
PayloadLength uint16
Payload []byte
Direction Direction
// contains filtered or unexported fields
}
func (*Segment) AddMessage ¶
func (*Segment) MarshalDataItem ¶
type SqlLiteDatabase ¶
type SqlLiteDatabase struct {
// contains filtered or unexported fields
}
func NewSqlLiteDatabase ¶
func NewSqlLiteDatabase(path string) (db *SqlLiteDatabase, err error)
func (*SqlLiteDatabase) AddPoints ¶
func (s *SqlLiteDatabase) AddPoints(points []PointRef) (err error)
func (*SqlLiteDatabase) AddTxsForBlock ¶
func (s *SqlLiteDatabase) AddTxsForBlock(refs []TxRef) (err error)
func (*SqlLiteDatabase) GetBlockNumForTx ¶
func (s *SqlLiteDatabase) GetBlockNumForTx(txhash string) (blockNumber uint64, err error)
func (*SqlLiteDatabase) GetBoundaryPointBehind ¶
func (s *SqlLiteDatabase) GetBoundaryPointBehind(blockHash string) (point PointRef, err error)
func (*SqlLiteDatabase) GetHighestPoint ¶
func (s *SqlLiteDatabase) GetHighestPoint() (point PointRef, err error)
func (*SqlLiteDatabase) GetPointByHash ¶
func (s *SqlLiteDatabase) GetPointByHash(blockHash string) (point PointRef, err error)
func (*SqlLiteDatabase) GetPointByHeight ¶
func (s *SqlLiteDatabase) GetPointByHeight(height uint64) (point PointRef, err error)
func (*SqlLiteDatabase) GetPointsBySlot ¶
func (s *SqlLiteDatabase) GetPointsBySlot(slot uint64) (points []PointRef, err error)
func (*SqlLiteDatabase) GetPointsForLastSlot ¶
func (s *SqlLiteDatabase) GetPointsForLastSlot() (points []PointRef, err error)
func (*SqlLiteDatabase) GetPointsForProcessing ¶
func (s *SqlLiteDatabase) GetPointsForProcessing(batchSize int) (points []PointRef, err error)
GetPointsForProcessing returns points ready for block fetching, respecting BlocksUntilConfirmed-distance from tip
func (*SqlLiteDatabase) GetTxs ¶
func (s *SqlLiteDatabase) GetTxs(txHashes []string) (txs []TxRef, err error)
func (*SqlLiteDatabase) HandleRollback ¶
func (s *SqlLiteDatabase) HandleRollback(fromSlot uint64) (err error)
HandleRollback moves points to the rollback table and cleans up related data
func (*SqlLiteDatabase) SetPointHeights ¶
func (s *SqlLiteDatabase) SetPointHeights(updates []PointRef) (err error)
type Subprotocol ¶
type Subprotocol uint16
const ( SubprotocolHandshakeProposedVersion Subprotocol = iota SubprotocolHandshakeAcceptVersion SubprotocolHandshakeRefuse SubprotocolHandshakeQueryReply )
const ( SubprotocolChainSyncRequestNext Subprotocol = iota SubprotocolChainSyncAwaitReply SubprotocolChainSyncRollForward SubprotocolChainSyncRollBackward SubprotocolChainSyncFindIntersect SubprotocolChainSyncIntersectFound SubprotocolChainSyncIntersectNotFound SubprotocolChainSyncDone )
const ( SubprotocolBlockFetchRequestRange Subprotocol = iota SubprotocolBlockFetchClientDone SubprotocolBlockFetchStartBatch SubprotocolBlockFetchNoBlocks SubprotocolBlockFetchBlock SubprotocolBlockFetchBatchDone )
const ( SubprotocolKeepAliveEcho Subprotocol = iota SubprotocolKeepAlivePing )
type SubtypeOf ¶
type SubtypeOf[T HasSubtypes] struct { Subtype any }
func (*SubtypeOf[T]) MarshalCBOR ¶
func (SubtypeOf[T]) MarshalJSON ¶
func (*SubtypeOf[T]) UnmarshalCBOR ¶
type TransactionBody ¶
type TransactionBody struct {
Inputs []TransactionInput `cbor:"0,keyasint,omitempty" json:"inputs,omitempty"`
Outputs []SubtypeOf[TransactionOutput] `cbor:"1,keyasint,omitempty" json:"outputs,omitempty"`
Fee uint64 `cbor:"2,keyasint,omitempty" json:"fee,omitempty"`
Ttl int64 `cbor:"3,keyasint,omitempty" json:"ttl,omitempty"`
Certificates any `cbor:"4,keyasint,omitempty" json:"certificates,omitempty"`
WithdrawalMap map[cbor.ByteString]uint64 `cbor:"5,keyasint,omitempty" json:"withdrawalMap,omitempty"`
UpdateDI any `cbor:"6,keyasint,omitempty" json:"updateDI,omitempty"`
AuxiliaryDataHash HexBytes `cbor:"7,keyasint,omitempty" json:"auxiliaryDataHash,omitempty"`
ValidityStartInterval int64 `cbor:"8,keyasint,omitempty" json:"validityStartInterval,omitempty"`
MintMap map[cbor.ByteString]map[cbor.ByteString]int64 `cbor:"9,keyasint,omitempty" json:"mintMap,omitempty"`
ScriptDataHash HexBytes `cbor:"11,keyasint,omitempty" json:"scriptDataHash,omitempty"`
CollateralInputs []CollateralInput `cbor:"13,keyasint,omitempty" json:"collateralInputs,omitempty"`
RequiredSigners []HexBytes `cbor:"14,keyasint,omitempty" json:"requiredSigners,omitempty"`
NetworkId int64 `cbor:"15,keyasint,omitempty" json:"networkId,omitempty"`
CollateralReturn *SubtypeOf[CollateralReturn] `cbor:"16,keyasint,omitempty" json:"collateralReturn,omitempty"`
TotalCollateral int64 `cbor:"17,keyasint,omitempty" json:"totalCollateral,omitempty"`
ReferenceInputs []TransactionInput `cbor:"18,keyasint,omitempty" json:"referenceInputs,omitempty"`
VotingProcedures any `cbor:"19,keyasint,omitempty" json:"votingProcedures,omitempty"`
ProposalProcedure any `cbor:"20,keyasint,omitempty" json:"proposalProcedure,omitempty"`
TreasuryValue any `cbor:"21,keyasint,omitempty" json:"treasuryValue,omitempty"`
DonationCoin uint64 `cbor:"22,keyasint,omitempty" json:"donationCoin,omitempty"`
}
func (*TransactionBody) Hash ¶
func (tb *TransactionBody) Hash() (hash HexBytes, err error)
func (*TransactionBody) IterateOutputs ¶
func (tb *TransactionBody) IterateOutputs(cb func(index int, output *TransactionOutputGeneric, err error) error) (err error)
type TransactionInput ¶
type TransactionOutput ¶
type TransactionOutput struct {
HasSubtypes
}
func (TransactionOutput) Subtypes ¶
func (t TransactionOutput) Subtypes() []any
func (TransactionOutput) ToGeneric ¶
func (TransactionOutput) ToGeneric(in any) (out *TransactionOutputGeneric, err error)
type TransactionOutputA ¶
type TransactionOutputA struct {
Address Address `cbor:"0,keyasint" json:"address"`
AmountData AmountData `cbor:"1,keyasint" json:"amountData"`
Extra Optional[TransactionOutputExtra] `cbor:"2,keyasint" json:"extra"`
}
type TransactionOutputB ¶
type TransactionOutputC ¶
type TransactionOutputD ¶
type TransactionOutputD struct {
Address Address `json:"address"`
AmountData AmountData `json:"amountData"`
Extra []any `json:"extra"`
// contains filtered or unexported fields
}
type TransactionOutputE ¶
type TransactionOutputE struct {
Address Address `json:"address"`
AmountData AmountData `json:"amountData"`
Extra HexBytes `json:"extra"`
// contains filtered or unexported fields
}
type TransactionOutputExtra ¶
type TransactionOutputF ¶
type TransactionOutputF struct {
Address Address `json:"address"`
AmountData AmountData `json:"amountData"`
// contains filtered or unexported fields
}
type TransactionOutputG ¶
type TransactionWitnessSet ¶
type TransactionWitnessSet struct {
VkeyWitness any `cbor:"0,keyasint" json:"-"`
NativeScript any `cbor:"1,keyasint" json:"-"`
BootstrapWitness any `cbor:"2,keyasint" json:"-"`
PlutusV1Script any `cbor:"3,keyasint" json:"-"`
PlutusData any `cbor:"4,keyasint" json:"-"`
Redeemer any `cbor:"5,keyasint" json:"-"`
PlutusV2Script any `cbor:"6,keyasint" json:"-"`
PlutusV3Script any `cbor:"7,keyasint" json:"-"`
}
type TxSubmission ¶
type TxSubmission struct {
Body TxSubmissionBody `json:"body"`
Witness TxSubmissionWitness `json:"witness"`
AlonzoEval bool `json:"alonzoEval"`
AuxiliaryData *AuxData `json:"auxiliaryData"`
// contains filtered or unexported fields
}
func (*TxSubmission) Hash ¶
func (tx *TxSubmission) Hash() (hash HexBytes, err error)
type TxSubmissionBody ¶
type TxSubmissionBody struct {
Inputs WithCborTag[[]TransactionInput] `cbor:"0,keyasint" json:"inputs"`
Outputs []SubtypeOf[TransactionOutput] `cbor:"1,keyasint" json:"outputs"`
Fee uint64 `cbor:"2,keyasint" json:"fee"`
AuxiliaryDataHash HexBytes `cbor:"7,keyasint,omitempty" json:"auxiliaryDataHash,omitempty"`
}
type TxSubmissionWitness ¶
type TxSubmissionWitness struct {
Signers WithCborTag[[]TxSigner] `cbor:"0,keyasint" json:"signers"`
}
type UtxoWithHeight ¶
type VersionField1 ¶
type VersionField1 struct {
Network NetworkMagic `json:"network"`
InitiatorOnlyDiffusionMode bool `json:"initiatorOnlyDiffusionMode"`
// contains filtered or unexported fields
}
type VersionField2 ¶
type VersionField2 struct {
Network NetworkMagic `json:"network,omitempty"`
InitiatorOnlyDiffusionMode bool `json:"initiatorOnlyDiffusionMode,omitempty"`
PeerSharing int `json:"peerSharing,omitempty"`
Query bool `json:"query,omitempty"`
// contains filtered or unexported fields
}
type VersionMap ¶
type VersionMap struct {
V4 VersionField1 `cbor:"4,keyasint"`
V5 VersionField1 `cbor:"5,keyasint"`
V6 VersionField1 `cbor:"6,keyasint"`
V7 VersionField1 `cbor:"7,keyasint"`
V8 VersionField1 `cbor:"8,keyasint"`
V9 VersionField1 `cbor:"9,keyasint"`
V10 VersionField1 `cbor:"10,keyasint"`
V11 VersionField2 `cbor:"11,keyasint"`
V12 VersionField2 `cbor:"12,keyasint"`
V13 VersionField2 `cbor:"13,keyasint"`
}
type WithCborTag ¶
func (WithCborTag[T]) MarshalCBOR ¶
func (w WithCborTag[T]) MarshalCBOR() (out []byte, err error)
func (WithCborTag[T]) MarshalJSON ¶
func (w WithCborTag[T]) MarshalJSON() ([]byte, error)
func (*WithCborTag[T]) UnmarshalCBOR ¶
func (w *WithCborTag[T]) UnmarshalCBOR(bytes []byte) error
type WithSubprotocol ¶
type WithSubprotocol struct {
Subprotocol Subprotocol `json:"subprotocol"`
// contains filtered or unexported fields
}
func (*WithSubprotocol) GetSubprotocol ¶
func (w *WithSubprotocol) GetSubprotocol() (subprotocol Subprotocol)
func (*WithSubprotocol) Raw ¶
func (w *WithSubprotocol) Raw() []byte
func (*WithSubprotocol) SetRaw ¶
func (w *WithSubprotocol) SetRaw(raw []byte)
func (*WithSubprotocol) SetSubprotocol ¶
func (w *WithSubprotocol) SetSubprotocol(subprotocol Subprotocol)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.