chainsync

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type AssetID

type AssetID string

func (AssetID) AssetName

func (a AssetID) AssetName() string

func (AssetID) AssetNameUTF8

func (a AssetID) AssetNameUTF8() (string, bool)

func (AssetID) HasAssetID

func (a AssetID) HasAssetID(re *regexp.Regexp) bool

func (AssetID) HasPolicyID

func (a AssetID) HasPolicyID(s string) bool

func (AssetID) IsZero

func (a AssetID) IsZero() bool

func (AssetID) MatchAssetName

func (a AssetID) MatchAssetName(re *regexp.Regexp) ([]string, bool)

func (AssetID) PolicyID

func (a AssetID) PolicyID() string

func (AssetID) String

func (a AssetID) String() string

type Block

type Block struct {
	Body       []Tx        `json:"body,omitempty"       dynamodbav:"body,omitempty"`
	Header     BlockHeader `json:"header,omitempty"     dynamodbav:"header,omitempty"`
	HeaderHash string      `json:"headerHash,omitempty" dynamodbav:"headerHash,omitempty"`
}

type BlockHeader

type BlockHeader struct {
	BlockHash       string                 `json:"blockHash,omitempty"       dynamodbav:"blockHash,omitempty"`
	BlockHeight     uint64                 `json:"blockHeight,omitempty"     dynamodbav:"blockHeight,omitempty"`
	BlockSize       uint64                 `json:"blockSize,omitempty"       dynamodbav:"blockSize,omitempty"`
	IssuerVK        string                 `json:"issuerVK,omitempty"        dynamodbav:"issuerVK,omitempty"`
	IssuerVrf       string                 `json:"issuerVrf,omitempty"       dynamodbav:"issuerVrf,omitempty"`
	LeaderValue     map[string][]byte      `json:"leaderValue,omitempty"     dynamodbav:"leaderValue,omitempty"`
	Nonce           map[string]string      `json:"nonce,omitempty"           dynamodbav:"nonce,omitempty"`
	OpCert          map[string]interface{} `json:"opCert,omitempty"          dynamodbav:"opCert,omitempty"`
	PrevHash        string                 `json:"prevHash,omitempty"        dynamodbav:"prevHash,omitempty"`
	ProtocolVersion map[string]int         `json:"protocolVersion,omitempty" dynamodbav:"protocolVersion,omitempty"`
	Signature       string                 `json:"signature,omitempty"       dynamodbav:"signature,omitempty"`
	Slot            uint64                 `json:"slot,omitempty"            dynamodbav:"slot,omitempty"`
}

type BlockV6 added in v1.1.0

type BlockV6 struct {
	Type         string        `json:"type,omitempty"`
	Era          string        `json:"era,omitempty"`
	ID           string        `json:"id,omitempty"`
	Height       uint64        `json:"height,omitempty"`
	Slot         uint64        `json:"slot,omitempty"`
	Transactions []Transaction `json:"transactions,omitempty"`
}

type Budget added in v1.0.0

type Budget struct {
	Memory int64 `json:"memory"`
	Steps  int64 `json:"cpu"`
}

type ByronBlock

type ByronBlock struct {
	Body   ByronBody
	Hash   string
	Header ByronHeader
}

type ByronBody

type ByronBody struct {
	DlgPayload    []json.RawMessage `json:"dlgPayload,omitempty"`
	TxPayload     []ByronTxPayload  `json:"txPayload,omitempty"`
	UpdatePayload json.RawMessage   `json:"updatePayload,omitempty"`
}

type ByronHeader

type ByronHeader struct {
	BlockHeight     uint64 `json:"blockHeight,omitempty"`
	GenesisKey      string
	Epoch           uint32
	Proof           json.RawMessage
	PrevHash        string
	ProtocolMagicId uint64
	ProtocolVersion ProtocolVersion
	Signature       json.RawMessage
	Slot            uint64 `json:"slot,omitempty"`
	SoftwareVersion map[string]interface{}
}

type ByronTxBody

type ByronTxBody struct {
	Inputs  []TxIn
	Outputs []TxOut
}

type ByronTxPayload

type ByronTxPayload struct {
	ID      string
	Witness []ByronWitness
}

type ByronWitness

type ByronWitness struct {
	RedeemWitness map[string]string
}

type Cbor added in v1.2.0

type Cbor string

func (*Cbor) UnmarshalJSON added in v1.2.0

func (c *Cbor) UnmarshalJSON(data []byte) error

type Collateral

type Collateral struct {
	Index int    `json:"index" dynamodbav:"index"`
	TxId  string `json:"txId"  dynamodbav:"tx_id"`
}

type Error added in v1.1.0

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type EvaluationItem added in v1.0.0

type EvaluationItem struct {
	Validator string `json:"validator"`
	Budget    Budget `json:"budget"`
}

type EvaluationResult added in v1.0.0

type EvaluationResult []EvaluationItem

type Fee added in v1.1.0

type Fee struct {
	Lovelace num.Int `json:"lovelace,omitempty"`
}

type HexData added in v0.3.1

type HexData []byte

func (*HexData) UnmarshalJSON added in v0.3.1

func (h *HexData) UnmarshalJSON(data []byte) error

type IntersectionFound

type IntersectionFound struct {
	Point Point
	Tip   Point
}

type IntersectionNotFound

type IntersectionNotFound struct {
	Tip Point
}

type Point

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

func (*Point) ConvertToV6 added in v1.1.0

func (p *Point) ConvertToV6() PointV6

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 {
	BlockNo uint64 `json:"blockNo,omitempty" dynamodbav:"blockNo,omitempty"`
	Hash    string `json:"hash,omitempty"    dynamodbav:"hash,omitempty"`
	Slot    uint64 `json:"slot,omitempty"    dynamodbav:"slot,omitempty"`
}

func (PointStruct) Point

func (p PointStruct) Point() Point

type PointStructV6 added in v1.1.0

type PointStructV6 struct {
	ID   string `json:"id,omitempty"`
	Slot uint64 `json:"slot,omitempty"`
}

type PointType

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

type PointV6 added in v1.1.0

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

func (PointV6) MarshalJSON added in v1.1.0

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

func (*PointV6) UnmarshalJSON added in v1.1.0

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

type Points

type Points []Point

func (Points) ConvertToV6 added in v1.1.0

func (pp Points) ConvertToV6() PointsV6

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 PointsV6 added in v1.1.0

type PointsV6 []PointV6

type ProtocolVersion

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

type Redeemer added in v0.4.0

type Redeemer map[RedeemerKey]RedeemerValue

func (*Redeemer) Unmarshal added in v0.4.0

func (r *Redeemer) Unmarshal(data json.RawMessage) error

type RedeemerKey added in v0.4.0

type RedeemerKey string

func (RedeemerKey) Index added in v0.4.0

func (a RedeemerKey) Index() int

func (RedeemerKey) RedeemerTag added in v0.4.0

func (a RedeemerKey) RedeemerTag() string

type RedeemerValue added in v0.4.0

type RedeemerValue struct {
	Memory int64 `json:"memory"`
	Steps  int64 `json:"steps"`
}

type Response

type Response struct {
	Type        string          `json:"type,omitempty"        dynamodbav:"type,omitempty"`
	Version     string          `json:"version,omitempty"     dynamodbav:"version,omitempty"`
	ServiceName string          `json:"servicename,omitempty" dynamodbav:"servicename,omitempty"`
	MethodName  string          `json:"methodname,omitempty"  dynamodbav:"methodname,omitempty"`
	Result      *Result         `json:"result,omitempty"      dynamodbav:"result,omitempty"`
	Reflection  json.RawMessage `json:"reflection,omitempty"  dynamodbav:"reflection,omitempty"`
}

type ResponseV6 added in v1.1.0

type ResponseV6 struct {
	Jsonrpc string    `json:"jsonrpc,omitempty"`
	Method  string    `json:"method,omitempty"`
	Result  *ResultV6 `json:"result,omitempty"`
}

func (ResponseV6) ConvertToV5 added in v1.1.0

func (responseV6 ResponseV6) ConvertToV5() (response Response)

type Result

type Result struct {
	IntersectionFound    *IntersectionFound    `json:",omitempty" dynamodbav:",omitempty"`
	IntersectionNotFound *IntersectionNotFound `json:",omitempty" dynamodbav:",omitempty"`
	RollForward          *RollForward          `json:",omitempty" dynamodbav:",omitempty"`
	RollBackward         *RollBackward         `json:",omitempty" dynamodbav:",omitempty"`
}

type ResultV6 added in v1.1.0

type ResultV6 struct {
	Direction    string   `json:"direction,omitempty"`
	BlockV6      *BlockV6 `json:"block,omitempty"`
	Point        *PointV6 `json:"point,omitempty"`        // roll backward (nextBlock)
	Intersection *PointV6 `json:"intersection,omitempty"` // intersection found (findIntersection)
	Error        *Error   `json:"error,omitempty"`        // intersection not found (findIntersection)
}

type RollBackward

type RollBackward struct {
	Point Point `json:"point,omitempty" dynamodbav:"point,omitempty"`
	Tip   Point `json:"tip,omitempty"   dynamodbav:"tip,omitempty"`
}

type RollForward

type RollForward struct {
	Block RollForwardBlock `json:"block,omitempty" dynamodbav:"block,omitempty"`
	Tip   Point            `json:"tip,omitempty"   dynamodbav:"tip,omitempty"`
}

type RollForwardBlock

type RollForwardBlock struct {
	Babbage *Block      `json:"babbage,omitempty" dynamodbav:"babbage,omitempty"`
	Allegra *Block      `json:"allegra,omitempty" dynamodbav:"allegra,omitempty"`
	Alonzo  *Block      `json:"alonzo,omitempty"  dynamodbav:"alonzo,omitempty"`
	Byron   *ByronBlock `json:"byron,omitempty"   dynamodbav:"byron,omitempty"`
	Mary    *Block      `json:"mary,omitempty"    dynamodbav:"mary,omitempty"`
	Shelley *Block      `json:"shelley,omitempty" dynamodbav:"shelley,omitempty"`
}

func (RollForwardBlock) PointStruct

func (r RollForwardBlock) PointStruct() PointStruct

func (RollForwardBlock) Transactions added in v0.3.4

func (r RollForwardBlock) Transactions() []Tx

type Transaction added in v1.1.0

type Transaction struct {
	ID        string             `json:"id,omitempty"`
	Spends    string             `json:"spends,omitempty"`
	TxInputs  []TxInV6           `json:"inputs,omitempty"`
	TxOutputs []TxOutV6          `json:"outputs,omitempty"`
	Datums    map[string]HexData `json:"datums,omitempty"`
	Redeemers json.RawMessage    `json:"redeemers,omitempty"`
	Fee       Fee                `json:"fee"`
	Cbor      string             `json:"cbor,omitempty"`
	Metadata  json.RawMessage    `json:"metadata,omitempty"`
	Mint      *Value             `json:"mint,omitempty"`
}

type Tx

type Tx struct {
	ID       string          `json:"id,omitempty"       dynamodbav:"id,omitempty"`
	Cbor     Cbor            `json:"raw,omitempty"`
	Body     TxBody          `json:"body,omitempty"     dynamodbav:"body,omitempty"`
	Metadata json.RawMessage `json:"metadata,omitempty" dynamodbav:"metadata,omitempty"`
	Witness  Witness         `json:"witness,omitempty"  dynamodbav:"witness,omitempty"`
}

type TxBody

type TxBody struct {
	Certificates            []json.RawMessage `json:"certificates,omitempty"            dynamodbav:"certificates,omitempty"`
	Collaterals             []Collateral      `json:"collaterals,omitempty"             dynamodbav:"collaterals,omitempty"`
	Fee                     num.Int           `json:"fee,omitempty"                     dynamodbav:"fee,omitempty"`
	Inputs                  []TxIn            `json:"inputs,omitempty"                  dynamodbav:"inputs,omitempty"`
	Mint                    *Value            `json:"mint,omitempty"                    dynamodbav:"mint,omitempty"`
	Network                 json.RawMessage   `json:"network,omitempty"                 dynamodbav:"network,omitempty"`
	Outputs                 TxOuts            `json:"outputs,omitempty"                 dynamodbav:"outputs,omitempty"`
	RequiredExtraSignatures []string          `json:"requiredExtraSignatures,omitempty" dynamodbav:"requiredExtraSignatures,omitempty"`
	ScriptIntegrityHash     string            `json:"scriptIntegrityHash,omitempty"     dynamodbav:"scriptIntegrityHash,omitempty"`
	TimeToLive              int64             `json:"timeToLive,omitempty"              dynamodbav:"timeToLive,omitempty"`
	Update                  json.RawMessage   `json:"update,omitempty"                  dynamodbav:"update,omitempty"`
	ValidityInterval        ValidityInterval  `json:"validityInterval"                  dynamodbav:"validityInterval,omitempty"`
	Withdrawals             map[string]int64  `json:"withdrawals,omitempty"             dynamodbav:"withdrawals,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 {
	TxHash string `json:"txId"  dynamodbav:"txId"`
	Index  int    `json:"index" dynamodbav:"index"`
}

func (TxIn) String

func (t TxIn) String() string

func (TxIn) TxID

func (t TxIn) TxID() TxID

type TxInV6 added in v1.1.0

type TxInV6 struct {
	Transaction struct {
		ID string `json:"id,omitempty"`
	} `json:"transaction,omitempty"`
	Index int `json:"index,omitempty"`
}

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     Value           `json:"value,omitempty"     dynamodbav:"value,omitempty"`
	Script    json.RawMessage `json:"script,omitempty"    dynamodbav:"script,omitempty"`
}

type TxOutV6 added in v1.1.0

type TxOutV6 struct {
	Address   string `json:"address,omitempty"`
	Value     map[string]map[string]num.Int
	Datum     string          `json:"datum"`
	DatumHash string          `json:"datumHash"`
	Script    json.RawMessage `json:"script,omitempty"`
}

type TxOuts

type TxOuts []TxOut

func (TxOuts) FindByAssetID

func (tt TxOuts) FindByAssetID(assetID AssetID) (TxOut, bool)

type ValidityInterval

type ValidityInterval struct {
	InvalidBefore    uint64 `json:"invalidBefore,omitempty"    dynamodbav:"invalidBefore,omitempty"`
	InvalidHereafter uint64 `json:"invalidHereafter,omitempty" dynamodbav:"invalidHereafter,omitempty"`
}

type Value

type Value struct {
	Coins  num.Int             `json:"coins,omitempty"  dynamodbav:"coins,omitempty"`
	Assets map[AssetID]num.Int `json:"assets,omitempty" dynamodbav:"assets,omitempty"`
}

type Witness

type Witness struct {
	Bootstrap  []json.RawMessage  `json:"bootstrap,omitempty"  dynamodbav:"bootstrap,omitempty"`
	Datums     map[string]HexData `json:"datums,omitempty"     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