Documentation ¶
Index ¶
- Variables
- func NewWrappedReadMessageError(message string, originalErr error) error
- type ChainSync
- type ChainSyncFunc
- type ChainSyncOption
- type ChainSyncOptions
- type Client
- func (c *Client) ChainSync(ctx context.Context, callback ChainSyncFunc, opts ...ChainSyncOption) (*ChainSync, error)
- func (c *Client) ChainTip(ctx context.Context) (chainsync.Point, error)
- func (c *Client) CurrentEpoch(ctx context.Context) (uint64, error)
- func (c *Client) CurrentProtocolParameters(ctx context.Context) (json.RawMessage, error)
- func (c *Client) EraStart(ctx context.Context) (statequery.EraStart, error)
- func (c *Client) EvaluateTx(ctx context.Context, cborHex string) (redeemer chainsync.Redeemer, err error)
- func (c *Client) EvaluateTxV6(ctx context.Context, cborHex string) (redeemer chainsync.Redeemer, err error)
- func (c *Client) SubmitTx(ctx context.Context, data []byte) (err error)
- func (c *Client) UtxosByAddress(ctx context.Context, addresses ...string) ([]statequery.Utxo, error)
- func (c *Client) UtxosByTxIn(ctx context.Context, txIns ...chainsync.TxIn) ([]statequery.Utxo, error)
- type Error
- type EvaluateTxError
- type EvaluationResponse
- type Fault
- type KeyValue
- type Logger
- type Map
- type Option
- type Options
- type Response
- type Store
- type SubmitTxError
- type WrappedReadMessageError
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = defaultLogger{}
DefaultLogger logs via the log package
var NopLogger = nopLogger{}
NopLogger logs nothing
Functions ¶
func NewWrappedReadMessageError ¶ added in v0.3.5
Types ¶
type ChainSync ¶
type ChainSync struct {
// contains filtered or unexported fields
}
ChainSync provides control over a given ChainSync connection
type ChainSyncFunc ¶
ChainSyncFunc callback containing json encoded chainsync.Response
type ChainSyncOption ¶
type ChainSyncOption func(opts *ChainSyncOptions)
ChainSyncOption provides functional options for ChainSync
func WithMinSlot ¶
func WithMinSlot(slot uint64) ChainSyncOption
WithMinSlot ignores any activity prior to the specified slot
func WithPoints ¶
func WithPoints(points ...chainsync.Point) ChainSyncOption
WithPoints allows starting from an optional point
func WithReconnect ¶
func WithReconnect(enabled bool) ChainSyncOption
WithReconnect attempt to reconnect to ogmios if connection drops
func WithStore ¶
func WithStore(store Store) ChainSyncOption
WithStore specifies store to persist points to; defaults to no persistence
type ChainSyncOptions ¶
type ChainSyncOptions struct {
// contains filtered or unexported fields
}
ChainSyncOptions configuration parameters
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a client for the chain sync protocol only
func (*Client) ChainSync ¶
func (c *Client) ChainSync(ctx context.Context, callback ChainSyncFunc, opts ...ChainSyncOption) (*ChainSync, error)
ChainSync replays the blockchain by invoking the callback for each block By default, ChainSync stores no checkpoints and always restarts from origin. These can be overridden via WithPoints and WithStore
func (*Client) CurrentProtocolParameters ¶
func (*Client) EvaluateTx ¶ added in v0.4.0
func (c *Client) EvaluateTx(ctx context.Context, cborHex string) (redeemer chainsync.Redeemer, err error)
EvaluateTx evaluate the execution units of scripts present in a given transaction, without actually submitting the transaction https://ogmios.dev/mini-protocols/local-tx-submission/#evaluatetx
func (*Client) EvaluateTxV6 ¶ added in v1.0.3
func (c *Client) EvaluateTxV6(ctx context.Context, cborHex string) (redeemer chainsync.Redeemer, err error)
EvaluateTxV6 evaluate the execution units of scripts present in a given transaction, without actually submitting the transaction https://ogmios.dev/mini-protocols/local-tx-submission/#evaluatetx
func (*Client) SubmitTx ¶
SubmitTx submits the transaction via ogmios https://ogmios.dev/mini-protocols/local-tx-submission/
func (*Client) UtxosByAddress ¶
func (*Client) UtxosByTxIn ¶
type Error ¶
type Error struct { Type string `json:"type,omitempty"` Version string `json:"version,omitempty"` ServiceName string `json:"servicename,omitempty"` Fault Fault `json:"fault,omitempty"` }
Error encapsulates errors from ogmios
type EvaluateTxError ¶ added in v0.4.0
type EvaluateTxError struct {
// contains filtered or unexported fields
}
EvaluateTxError encapsulates the EvaluateTx errors and allows the results to be parsed
func (EvaluateTxError) Error ¶ added in v0.4.0
func (s EvaluateTxError) Error() string
Error implements the error interface
func (EvaluateTxError) Messages ¶ added in v0.4.0
func (s EvaluateTxError) Messages() json.RawMessage
Messages returns the raw messages from EvaluateTxError
type EvaluationResponse ¶ added in v0.4.0
type Fault ¶
type Fault struct { Code string `json:"code,omitempty"` // Code identifies error String string `json:"string,omitempty"` // String provides human readable description }
Fault provides additional context for ogmios errors
type Option ¶
type Option func(*Options)
Option to cardano client
func WithEndpoint ¶
WithEndpoint allows ogmios endpoint to set; defaults to ws://127.0.0.1:1337
func WithInterval ¶
WithInterval specifies how frequently to save checkpoints when reading
func WithLogger ¶
WithLogger allows custom logger to be specified
func WithPipeline ¶
WithPipeline allows number of pipelined ogmios requests to be provided
func WithTimeout ¶ added in v0.5.0
WithTimeout allows set timeout for handshaking
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options available to ogmios client
type Store ¶
type Store interface { // Save the point; save will be called multiple times and should only // keep track of the most recent points Save(ctx context.Context, point chainsync.Point) error // Load saved points Load(ctx context.Context) (chainsync.Points, error) }
Store allows points to be saved and retrieved to allow graceful recovery after shutdown
func NewLoggingStore ¶
NewLoggingStore logs Save requests, but does not actually save points
type SubmitTxError ¶
type SubmitTxError struct {
// contains filtered or unexported fields
}
SubmitTxError encapsulates the SubmitTx errors and allows the results to be parsed
func (SubmitTxError) Error ¶
func (s SubmitTxError) Error() string
Error implements the error interface
func (SubmitTxError) ErrorCodes ¶
func (s SubmitTxError) ErrorCodes() (keys []string, err error)
ErrorCodes the list of errors codes
func (SubmitTxError) HasErrorCode ¶
func (s SubmitTxError) HasErrorCode(errorCode string) bool
HasErrorCode returns true if the error contains the provided code
func (SubmitTxError) Messages ¶
func (s SubmitTxError) Messages() []json.RawMessage
Messages returns the raw messages from SubmitTxError
type WrappedReadMessageError ¶ added in v0.3.5
type WrappedReadMessageError struct {
// contains filtered or unexported fields
}
func (*WrappedReadMessageError) Error ¶ added in v0.3.5
func (e *WrappedReadMessageError) Error() string
func (*WrappedReadMessageError) Temporary ¶ added in v0.3.5
func (e *WrappedReadMessageError) Temporary() bool