chainsync

package
v6.0.0-...-9259e93 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const FindIntersectMethod = "FindIntersect"
View Source
const FindIntersectionMethod = "findIntersection"
View Source
const NextBlockMethod = "nextBlock"
View Source
const RequestNextMethod = "RequestNext"
View Source
const RollBackwardString = "backward"
View Source
const RollForwardString = "forward"

Variables

View Source
var Origin = PointString("origin").Point()

Functions

func Equals

func Equals(left Value, right Value) bool

func GetMetadataDatumMapV6

func GetMetadataDatumMapV6(txMetadata json.RawMessage, metadataDatumKey int) (map[string][]byte, error)

func GetMetadataDatums

func GetMetadataDatums(datums map[string][]byte) ([][]byte, error)

func GetMetadataDatumsV6

func GetMetadataDatumsV6(txMetadata json.RawMessage, metadataDatumKey int) ([][]byte, error)

func ReconstructDatums

func ReconstructDatums(metadatum OgmiosMetadatum) (map[string][]byte, error)

Types

type Block

type Block struct {
	Type         string      `json:"type,omitempty"`
	Era          string      `json:"era,omitempty"`
	ID           string      `json:"id,omitempty"`
	Ancestor     string      `json:"ancestor,omitempty"`
	Nonce        *Nonce      `json:"nonce,omitempty"`
	Height       uint64      `json:"height,omitempty"`
	Size         BlockSize   `json:"size,omitempty"`
	Slot         uint64      `json:"slot,omitempty"`
	Transactions []Tx        `json:"transactions,omitempty"`
	Protocol     Protocol    `json:"protocol,omitempty"`
	Issuer       BlockIssuer `json:"issuer,omitempty"`
}

All blocks except Byron-era blocks.

func (Block) PointStruct

func (b Block) PointStruct() PointStruct

type BlockIssuer

type BlockIssuer struct {
	VerificationKey        string       `json:"verificationKey,omitempty"`
	VrfVerificationKey     string       `json:"vrfVerificationKey,omitempty"`
	OperationalCertificate OpCert       `json:"operationalCertificate,omitempty"`
	LeaderValue            *LeaderValue `json:"leaderValue,omitempty"`
}

type BlockSize

type BlockSize struct {
	Bytes int64 `json:"bytes,omitempty"  dynamodbav:"bytes,omitempty"`
}

type ByronBlockBFT

type ByronBlockBFT struct {
	Type                    string             `json:"type,omitempty"`
	Era                     string             `json:"era,omitempty"`
	ID                      string             `json:"id,omitempty"`
	Ancestor                string             `json:"ancestor,omitempty"`
	Height                  uint64             `json:"height,omitempty"`
	Slot                    uint64             `json:"slot,omitempty"`
	Size                    BlockSize          `json:"size,omitempty"`
	Transactions            []Tx               `json:"transactions,omitempty"`
	OperationalCertificates []json.RawMessage  `json:"operationalCertificates,omitempty"`
	Protocol                ByronProtocol      `json:"protocol,omitempty"`
	Issuer                  ByronBlockIssuer   `json:"issuer,omitempty"`
	Delegate                ByronBlockDelegate `json:"delegate,omitempty"`
}

BFT Block Root

type ByronBlockDelegate

type ByronBlockDelegate struct {
	VerificationKey string
}

type ByronBlockEBB

type ByronBlockEBB struct {
	Type     string `json:"type,omitempty"`
	Era      string `json:"era,omitempty"`
	ID       string `json:"id,omitempty"`
	Ancestor string `json:"ancestor,omitempty"`
	Height   uint64 `json:"height,omitempty"`
}

EBB Block Type

type ByronBlockIssuer

type ByronBlockIssuer struct {
	VerificationKey string
}

type ByronProtocol

type ByronProtocol struct {
	Version  ProtocolVersion
	Id       uint64 // aka magic
	Software map[string]interface{}
	Update   json.RawMessage
}

type Datums

type Datums map[string]string

func (*Datums) UnmarshalDynamoDBAttributeValue

func (d *Datums) UnmarshalDynamoDBAttributeValue(item *dynamodb.AttributeValue) error

func (*Datums) UnmarshalJSON

func (d *Datums) UnmarshalJSON(i []byte) error

type Kes

type Kes struct {
	Period          uint64 `json:"period,omitempty"`
	VerificationKey string `json:"verificationKey,omitempty"`
}

type LeaderValue

type LeaderValue struct {
	Output string `json:"output,omitempty"`
	Proof  string `json:"proof,omitempty"`
}

type Nonce

type Nonce struct {
	Output string `json:"output,omitempty" dynamodbav:"slot,omitempty"`
	Proof  string `json:"proof,omitempty"  dynamodbav:"slot,omitempty"`
}

type OgmiosAuxiliaryDataLabelsV6

type OgmiosAuxiliaryDataLabelsV6 map[int]OgmiosMetadatumRecordV6

type OgmiosAuxiliaryDataV6

type OgmiosAuxiliaryDataV6 struct {
	Hash   string
	Labels *OgmiosAuxiliaryDataLabelsV6
}

func (*OgmiosAuxiliaryDataV6) UnmarshalJSON

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

type OgmiosMetadatum

type OgmiosMetadatum struct {
	Tag         OgmiosMetadatumKind
	IntField    *big.Int              `json:"int"`
	StringField string                `json:"string"`
	BytesField  []byte                `json:"bytes"`
	ListField   []*OgmiosMetadatum    `json:"list"`
	MapField    []*OgmiosMetadatumMap `json:"map"`
}

func (*OgmiosMetadatum) UnmarshalJSON

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

type OgmiosMetadatumKind

type OgmiosMetadatumKind int
const (
	OgmiosMetadatumTagUnknown OgmiosMetadatumKind = iota
	OgmiosMetadatumTagInt
	OgmiosMetadatumTagString
	OgmiosMetadatumTagBytes
	OgmiosMetadatumTagList
	OgmiosMetadatumTagMap
)

type OgmiosMetadatumMap

type OgmiosMetadatumMap struct {
	Key   *OgmiosMetadatum `json:"k"`
	Value *OgmiosMetadatum `json:"v"`
}

type OgmiosMetadatumRecordV6

type OgmiosMetadatumRecordV6 struct {
	Cbor *string          `json:"cbor"`
	Json *OgmiosMetadatum `json:"json"`
}

type OpCert

type OpCert struct {
	Count uint64 `json:"count,omitempty"`
	Kes   Kes    `json:"kes,omitempty"`
}

type Point

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

func (Point) MarshalCBOR

func (p Point) MarshalCBOR() ([]byte, error)

func (Point) MarshalDynamoDBAttributeValue

func (p Point) MarshalDynamoDBAttributeValue(item *dynamodb.AttributeValue) error

func (Point) MarshalJSON

func (p Point) MarshalJSON() ([]byte, error)

func (Point) PointString

func (p Point) PointString() (PointString, bool)

func (Point) PointStruct

func (p Point) PointStruct() (*PointStruct, bool)

func (Point) PointType

func (p Point) PointType() PointType

func (Point) String

func (p Point) String() string

func (*Point) UnmarshalCBOR

func (p *Point) UnmarshalCBOR(data []byte) error

func (*Point) UnmarshalDynamoDBAttributeValue

func (p *Point) UnmarshalDynamoDBAttributeValue(item *dynamodb.AttributeValue) error

func (*Point) UnmarshalJSON

func (p *Point) UnmarshalJSON(data []byte) error

type PointString

type PointString string

func (PointString) Point

func (p PointString) Point() Point

type PointStruct

type PointStruct struct {
	Height *uint64 `json:"height,omitempty" dynamodbav:"height,omitempty"` // Not part of RollBackward.
	ID     string  `json:"id,omitempty"      dynamodbav:"id,omitempty"`    // BLAKE2b_256 hash
	Slot   uint64  `json:"slot,omitempty"    dynamodbav:"slot,omitempty"`
}

func (PointStruct) Point

func (p PointStruct) Point() Point

type PointType

type PointType int
const (
	PointTypeString PointType = 1
	PointTypeStruct PointType = 2
)

type Points

type Points []Point

func (Points) Len

func (pp Points) Len() int

func (Points) Less

func (pp Points) Less(i, j int) bool

func (Points) String

func (pp Points) String() string

func (Points) Swap

func (pp Points) Swap(i, j int)

type Protocol

type Protocol struct {
	Version ProtocolVersion `json:"version,omitempty" dynamodbav:"version,omitempty"`
}

type ProtocolVersion

type ProtocolVersion struct {
	Major uint32
	Minor uint32
	Patch uint32 `json:"patch,omitempty"`
}

type ResponseByronBFT

type ResponseByronBFT struct {
	JsonRpc string          `json:"jsonrpc,omitempty" dynamodbav:"jsonrpc,omitempty"`
	Method  string          `json:"method,omitempty"  dynamodbav:"method,omitempty"`
	Result  *ResultByronBFT `json:"result,omitempty"  dynamodbav:"result,omitempty"`
	ID      json.RawMessage `json:"id,omitempty"      dynamodbav:"id,omitempty"`
}

type ResponseByronEBB

type ResponseByronEBB struct {
	JsonRpc string          `json:"jsonrpc,omitempty" dynamodbav:"jsonrpc,omitempty"`
	Method  string          `json:"method,omitempty"  dynamodbav:"method,omitempty"`
	Result  *ResultByronEBB `json:"result,omitempty"  dynamodbav:"result,omitempty"`
	ID      json.RawMessage `json:"id,omitempty"      dynamodbav:"id,omitempty"`
}

type ResponsePraos

type ResponsePraos struct {
	JsonRpc string          `json:"jsonrpc,omitempty" dynamodbav:"jsonrpc,omitempty"`
	Method  string          `json:"method,omitempty"  dynamodbav:"method,omitempty"`
	Result  interface{}     `json:"result,omitempty"  dynamodbav:"result,omitempty"`
	Error   *ResultError    `json:"error,omitempty"   dynamodbav:"error,omitempty"`
	ID      json.RawMessage `json:"id,omitempty"      dynamodbav:"id,omitempty"`
}

func (ResponsePraos) MustFindIntersectResult

func (r ResponsePraos) MustFindIntersectResult() ResultFindIntersectionPraos

func (ResponsePraos) MustNextBlockResult

func (r ResponsePraos) MustNextBlockResult() ResultNextBlockPraos

func (*ResponsePraos) UnmarshalJSON

func (r *ResponsePraos) UnmarshalJSON(b []byte) error

type ResultByronBFT

type ResultByronBFT struct {
	Direction string         `json:"direction,omitempty" dynamodbav:"direction,omitempty"`
	Block     *ByronBlockBFT `json:"block,omitempty"     dynamodbav:"block,omitempty"`
	Tip       *PointStruct   `json:"tip,omitempty"       dynamodbav:"tip,omitempty"`
}

type ResultByronEBB

type ResultByronEBB struct {
	Direction string         `json:"direction,omitempty" dynamodbav:"direction,omitempty"`
	Block     *ByronBlockEBB `json:"block,omitempty"     dynamodbav:"block,omitempty"`
	Tip       *PointStruct   `json:"tip,omitempty"       dynamodbav:"tip,omitempty"`
}

type ResultError

type ResultError struct {
	Code    uint32          `json:"code,omitempty"    dynamodbav:"code,omitempty"`
	Message string          `json:"message,omitempty" dynamodbav:"message,omitempty"`
	Data    json.RawMessage `json:"data,omitempty"    dynamodbav:"data,omitempty"` // Forward
	ID      json.RawMessage `json:"id,omitempty"      dynamodbav:"id,omitempty"`
}

type ResultFindIntersectionPraos

type ResultFindIntersectionPraos struct {
	Intersection *Point          `json:"intersection,omitempty" dynamodbav:"intersection,omitempty"`
	Tip          *PointStruct    `json:"tip,omitempty"          dynamodbav:"tip,omitempty"`
	Error        *ResultError    `json:"error,omitempty"        dynamodbav:"error,omitempty"`
	ID           json.RawMessage `json:"id,omitempty"           dynamodbav:"id,omitempty"`
}

Covers everything except Byron-era blocks.

type ResultNextBlockPraos

type ResultNextBlockPraos struct {
	Direction string       `json:"direction,omitempty" dynamodbav:"direction,omitempty"`
	Tip       *PointStruct `json:"tip,omitempty"       dynamodbav:"tip,omitempty"`
	Block     *Block       `json:"block,omitempty"     dynamodbav:"block,omitempty"` // Forward
	Point     *Point       `json:"point,omitempty"     dynamodbav:"point,omitempty"` // Backward
}

Covers all blocks except Byron-era blocks.

type RollBackward

type RollBackward struct {
	Direction string            `json:"direction,omitempty" dynamodbav:"direction,omitempty"`
	Tip       PointStruct       `json:"tip,omitempty"   dynamodbav:"tip,omitempty"`
	Point     RollBackwardPoint `json:"point,omitempty" dynamodbav:"point,omitempty"`
}

type RollBackwardPoint

type RollBackwardPoint struct {
	Slot uint64 `json:"slot,omitempty"    dynamodbav:"slot,omitempty"`
	ID   string `json:"id,omitempty"      dynamodbav:"id,omitempty"` // BLAKE2b_256 hash
}

type RollForward

type RollForward struct {
	Direction string      `json:"direction,omitempty" dynamodbav:"direction,omitempty"`
	Tip       PointStruct `json:"tip,omitempty"   dynamodbav:"tip,omitempty"`
	Block     Block       `json:"block,omitempty" dynamodbav:"block,omitempty"`
}

Assume non-Byron blocks.

type Signature

type Signature struct {
	Key               string `json:"key" dynamodbav:"key"`
	Signature         string `json:"signature" dynamodbav:"signature"`
	ChainCode         string `json:"chainCode,omitempty" dynamodbav:"chainCode,omitempty"`
	AddressAttributes string `json:"addressAttributes,omitempty" dynamodbav:"addressAttributes,omitempty"`
}

type Tx

type Tx struct {
	ID                       string                  `json:"id,omitempty"                       dynamodbav:"id,omitempty"`
	Spends                   string                  `json:"spends,omitempty"                   dynamodbav:"spends,omitempty"`
	Inputs                   []TxIn                  `json:"inputs,omitempty"                   dynamodbav:"inputs,omitempty"`
	References               []TxIn                  `json:"references,omitempty"               dynamodbav:"references,omitempty"`
	Collaterals              []TxIn                  `json:"collaterals,omitempty"              dynamodbav:"collaterals,omitempty"`
	TotalCollateral          *shared.Value           `json:"totalCollateral,omitempty"          dynamodbav:"totalCollateral,omitempty"`
	CollateralReturn         *TxOut                  `json:"collateralReturn,omitempty"         dynamodbav:"collateralReturn,omitempty"`
	Outputs                  TxOuts                  `json:"outputs,omitempty"                  dynamodbav:"outputs,omitempty"`
	Certificates             []json.RawMessage       `json:"certificates,omitempty"             dynamodbav:"certificates,omitempty"`
	Withdrawals              map[string]shared.Value `json:"withdrawals,omitempty"              dynamodbav:"withdrawals,omitempty"`
	Fee                      shared.Value            `json:"fee,omitempty"                      dynamodbav:"fee,omitempty"`
	ValidityInterval         ValidityInterval        `json:"validityInterval"                   dynamodbav:"validityInterval,omitempty"`
	Mint                     shared.Value            `json:"mint,omitempty"                     dynamodbav:"mint,omitempty"`
	Network                  json.RawMessage         `json:"network,omitempty"                  dynamodbav:"network,omitempty"`
	ScriptIntegrityHash      string                  `json:"scriptIntegrityHash,omitempty"      dynamodbav:"scriptIntegrityHash,omitempty"`
	RequiredExtraSignatories []string                `json:"requiredExtraSignatories,omitempty" dynamodbav:"requiredExtraSignatories,omitempty"`
	RequiredExtraScripts     []string                `json:"requiredExtraScripts,omitempty"     dynamodbav:"requiredExtraScripts,omitempty"`
	Proposals                json.RawMessage         `json:"proposals,omitempty"                dynamodbav:"proposals,omitempty"`
	Votes                    json.RawMessage         `json:"votes,omitempty"                    dynamodbav:"votes,omitempty"`
	Metadata                 json.RawMessage         `json:"metadata,omitempty"                 dynamodbav:"metadata,omitempty"`
	Signatories              []Signature             `json:"signatories,omitempty"              dynamodbav:"signatories,omitempty"`
	Scripts                  json.RawMessage         `json:"scripts,omitempty"                  dynamodbav:"scripts,omitempty"`
	Datums                   Datums                  `json:"datums"                             dynamodbav:"datums,omitempty"`
	Redeemers                json.RawMessage         `json:"redeemers,omitempty"                dynamodbav:"redeemers,omitempty"`
	CBOR                     string                  `json:"cbor,omitempty"                     dynamodbav:"cbor,omitempty"`
}

type TxID

type TxID string

func NewTxID

func NewTxID(txHash string, index int) TxID

func (TxID) Index

func (t TxID) Index() int

func (TxID) String

func (t TxID) String() string

func (TxID) TxHash

func (t TxID) TxHash() string

type TxIn

type TxIn struct {
	Transaction TxInID `json:"transaction"  dynamodbav:"transaction"`
	Index       int    `json:"index" dynamodbav:"index"`
}

func (TxIn) String

func (t TxIn) String() string

func (TxIn) TxID

func (t TxIn) TxID() TxID

type TxInID

type TxInID struct {
	ID string `json:"id"  dynamodbav:"id"`
}

type TxInQuery

type TxInQuery struct {
	Transaction shared.UtxoTxID `json:"transaction"  dynamodbav:"transaction"`
	Index       uint32          `json:"index" dynamodbav:"index"`
}

type TxIns

type TxIns []TxIn

type TxOut

type TxOut struct {
	Address   string          `json:"address,omitempty"   dynamodbav:"address,omitempty"`
	Datum     string          `json:"datum,omitempty"     dynamodbav:"datum,omitempty"`
	DatumHash string          `json:"datumHash,omitempty" dynamodbav:"datumHash,omitempty"`
	Value     shared.Value    `json:"value,omitempty"     dynamodbav:"value,omitempty"`
	Script    json.RawMessage `json:"script,omitempty"    dynamodbav:"script,omitempty"`
}

type TxOuts

type TxOuts []TxOut

type ValidityInterval

type ValidityInterval struct {
	InvalidBefore uint64 `json:"invalidBefore,omitempty" dynamodbav:"invalidBefore,omitempty"`
	InvalidAfter  uint64 `json:"invalidAfter,omitempty"  dynamodbav:"invalidAfter,omitempty"`
}

type Witness

type Witness struct {
	Bootstrap  []json.RawMessage `json:"bootstrap,omitempty"  dynamodbav:"bootstrap,omitempty"`
	Datums     Datums            `json:"datums"     dynamodbav:"datums,omitempty"`
	Redeemers  json.RawMessage   `json:"redeemers,omitempty"  dynamodbav:"redeemers,omitempty"`
	Scripts    json.RawMessage   `json:"scripts,omitempty"    dynamodbav:"scripts,omitempty"`
	Signatures map[string]string `json:"signatures,omitempty" dynamodbav:"signatures,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL