ledger

package
v0.70.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 14

Documentation

Index

Constants

View Source
const (
	EraIdAllegra = 2

	BlockTypeAllegra = 3

	BlockHeaderTypeAllegra = 2

	TxTypeAllegra = 2
)
View Source
const (
	EraIdAlonzo = 4

	BlockTypeAlonzo = 5

	BlockHeaderTypeAlonzo = 4

	TxTypeAlonzo = 4
)
View Source
const (
	EraIdBabbage = 5

	BlockTypeBabbage = 6

	BlockHeaderTypeBabbage = 5

	TxTypeBabbage = 5
)
View Source
const (
	DatumOptionTypeHash = 0
	DatumOptionTypeData = 1
)
View Source
const (
	EraIdByron = 0

	BlockTypeByronEbb  = 0
	BlockTypeByronMain = 1

	BlockHeaderTypeByron = 0

	TxTypeByron = 0

	ByronSlotsPerEpoch = 21600
)
View Source
const (
	AddressHeaderTypeMask    = 0xF0
	AddressHeaderNetworkMask = 0x0F
	AddressHashSize          = 28

	AddressNetworkTestnet = 0
	AddressNetworkMainnet = 1

	AddressTypeKeyKey        = 0b0000
	AddressTypeScriptKey     = 0b0001
	AddressTypeKeyScript     = 0b0010
	AddressTypeScriptScript  = 0b0011
	AddressTypeKeyPointer    = 0b0100
	AddressTypeScriptPointer = 0b0101
	AddressTypeKeyNone       = 0b0110
	AddressTypeScriptNone    = 0b0111
	AddressTypeByron         = 0b1000
	AddressTypeNoneKey       = 0b1110
	AddressTypeNoneScript    = 0b1111
)
View Source
const (
	EraIdConway = 6

	BlockTypeConway = 7

	BlockHeaderTypeConway = 6

	TxTypeConway = 6
)
View Source
const (
	ApplyTxErrorUtxowFailure = 0

	UTXOWFailureUtxoFailure = 2

	UtxoFailureFromAlonzo = 1

	UtxoFailureBadInputsUtxo               = 0
	UtxoFailureOutsideValidityIntervalUtxo = 1
	UtxoFailureMaxTxSizeUtxo               = 2
	UtxoFailureInputSetEmpty               = 3
	UtxoFailureFeeTooSmallUtxo             = 4
	UtxoFailureValueNotConservedUtxo       = 5
	UtxoFailureOutputTooSmallUtxo          = 6
	UtxoFailureUtxosFailure                = 7
	UtxoFailureWrongNetwork                = 8
	UtxoFailureWrongNetworkWithdrawal      = 9
	UtxoFailureOutputBootAddrAttrsTooBig   = 10
	UtxoFailureTriesToForgeAda             = 11
	UtxoFailureOutputTooBigUtxo            = 12
	UtxoFailureInsufficientCollateral      = 13
	UtxoFailureScriptsNotPaidUtxo          = 14
	UtxoFailureExUnitsTooBigUtxo           = 15
	UtxoFailureCollateralContainsNonAda    = 16
	UtxoFailureWrongNetworkInTxBody        = 17
	UtxoFailureOutsideForecast             = 18
	UtxoFailureTooManyCollateralInputs     = 19
	UtxoFailureNoCollateralInputs          = 20
)
View Source
const (
	EraIdMary = 3

	BlockTypeMary = 4

	BlockHeaderTypeMary = 3

	TxTypeMary = 3
)
View Source
const (
	EraIdShelley = 1

	BlockTypeShelley = 2

	BlockHeaderTypeShelley = 1

	TxTypeShelley = 1
)

Variables

View Source
var BlockHeaderToBlockTypeMap = map[uint]uint{
	BlockHeaderTypeShelley: BlockTypeShelley,
	BlockHeaderTypeAllegra: BlockTypeAllegra,
	BlockHeaderTypeMary:    BlockTypeMary,
	BlockHeaderTypeAlonzo:  BlockTypeAlonzo,
	BlockHeaderTypeBabbage: BlockTypeBabbage,
	BlockHeaderTypeConway:  BlockTypeConway,
}

BlockHeaderToBlockTypeMap is a mapping of NtN chainsync block header types (era ID) to NtC block types

View Source
var BlockToBlockHeaderTypeMap = map[uint]uint{
	BlockTypeShelley: BlockHeaderTypeShelley,
	BlockTypeAllegra: BlockHeaderTypeAllegra,
	BlockTypeMary:    BlockHeaderTypeMary,
	BlockTypeAlonzo:  BlockHeaderTypeAlonzo,
	BlockTypeBabbage: BlockHeaderTypeBabbage,
	BlockTypeConway:  BlockHeaderTypeConway,
}

BlockToBlockHeaderTypeMap is a mapping of NtC chainsync block types to NtN block header types (era ID)

Functions

func DetermineBlockType added in v0.67.0

func DetermineBlockType(data []byte) (uint, error)

func DetermineTransactionType added in v0.55.0

func DetermineTransactionType(data []byte) (uint, error)

func NewEraMismatchErrorFromCbor

func NewEraMismatchErrorFromCbor(cborData []byte) (error, error)

func NewGenericErrorFromCbor

func NewGenericErrorFromCbor(cborData []byte) (error, error)

func NewShelleyTxValidationErrorFromCbor

func NewShelleyTxValidationErrorFromCbor(cborData []byte) (error, error)

func NewTxSubmitErrorFromCbor

func NewTxSubmitErrorFromCbor(cborData []byte) (error, error)

Helper function to try to parse CBOR as various error types

Types

type Address added in v0.43.0

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

func NewAddress added in v0.45.0

func NewAddress(addr string) (Address, error)

NewAddress returns an Address based on the provided bech32 address string

func NewAddressFromParts added in v0.50.0

func NewAddressFromParts(
	addrType uint8,
	networkId uint8,
	paymentAddr []byte,
	stakingAddr []byte,
) Address

NewAddressFromParts returns an Address based on the individual parts of the address that are provided

func (Address) Bytes added in v0.43.0

func (a Address) Bytes() []byte

Bytes returns the underlying bytes for the address

func (*Address) MarshalCBOR added in v0.43.0

func (a *Address) MarshalCBOR() ([]byte, error)

func (Address) MarshalJSON added in v0.44.0

func (a Address) MarshalJSON() ([]byte, error)

func (Address) PaymentAddress added in v0.68.0

func (a Address) PaymentAddress() *Address

PaymentAddress returns a new Address with only the payment address portion. This will return nil for anything other than payment and script addresses

func (Address) StakeAddress added in v0.45.0

func (a Address) StakeAddress() *Address

StakeAddress returns a new Address with only the stake key portion. This will return nil if the address is not a payment/staking key pair

func (Address) String added in v0.43.0

func (a Address) String() string

String returns the bech32-encoded version of the address

func (*Address) UnmarshalCBOR added in v0.43.0

func (a *Address) UnmarshalCBOR(data []byte) error

type AllegraBlock

type AllegraBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header                 *AllegraBlockHeader
	TransactionBodies      []AllegraTransactionBody
	TransactionWitnessSets []ShelleyTransactionWitnessSet
	TransactionMetadataSet map[uint]*cbor.Value
}

func NewAllegraBlockFromCbor

func NewAllegraBlockFromCbor(data []byte) (*AllegraBlock, error)

func (*AllegraBlock) BlockBodySize added in v0.57.0

func (b *AllegraBlock) BlockBodySize() uint64

func (*AllegraBlock) BlockNumber

func (b *AllegraBlock) BlockNumber() uint64

func (*AllegraBlock) Era

func (b *AllegraBlock) Era() Era

func (*AllegraBlock) Hash

func (b *AllegraBlock) Hash() string

func (*AllegraBlock) IssuerVkey added in v0.57.0

func (b *AllegraBlock) IssuerVkey() IssuerVkey

func (*AllegraBlock) SlotNumber

func (b *AllegraBlock) SlotNumber() uint64

func (*AllegraBlock) Transactions

func (b *AllegraBlock) Transactions() []Transaction

func (*AllegraBlock) UnmarshalCBOR

func (b *AllegraBlock) UnmarshalCBOR(cborData []byte) error

type AllegraBlockHeader

type AllegraBlockHeader struct {
	ShelleyBlockHeader
}

func (*AllegraBlockHeader) Era

func (h *AllegraBlockHeader) Era() Era

type AllegraTransaction

type AllegraTransaction struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Body       AllegraTransactionBody
	WitnessSet ShelleyTransactionWitnessSet
	TxMetadata *cbor.Value
}

func NewAllegraTransactionFromCbor

func NewAllegraTransactionFromCbor(data []byte) (*AllegraTransaction, error)

func (*AllegraTransaction) Cbor added in v0.56.0

func (t *AllegraTransaction) Cbor() []byte

func (AllegraTransaction) Fee added in v0.57.0

func (t AllegraTransaction) Fee() uint64

func (AllegraTransaction) Hash added in v0.46.0

func (t AllegraTransaction) Hash() string

func (AllegraTransaction) Inputs added in v0.46.0

func (t AllegraTransaction) Inputs() []TransactionInput

func (AllegraTransaction) Metadata

func (t AllegraTransaction) Metadata() *cbor.Value

func (AllegraTransaction) Outputs added in v0.46.0

func (t AllegraTransaction) Outputs() []TransactionOutput

func (AllegraTransaction) TTL added in v0.57.0

func (t AllegraTransaction) TTL() uint64

type AllegraTransactionBody

type AllegraTransactionBody struct {
	ShelleyTransactionBody
	ValidityIntervalStart uint64 `cbor:"8,keyasint,omitempty"`
}

func NewAllegraTransactionBodyFromCbor

func NewAllegraTransactionBodyFromCbor(
	data []byte,
) (*AllegraTransactionBody, error)

func (*AllegraTransactionBody) UnmarshalCBOR

func (b *AllegraTransactionBody) UnmarshalCBOR(cborData []byte) error

type AlonzoBlock

type AlonzoBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header                 *AlonzoBlockHeader
	TransactionBodies      []AlonzoTransactionBody
	TransactionWitnessSets []AlonzoTransactionWitnessSet
	TransactionMetadataSet map[uint]*cbor.Value
	InvalidTransactions    []uint
}

func NewAlonzoBlockFromCbor

func NewAlonzoBlockFromCbor(data []byte) (*AlonzoBlock, error)

func (*AlonzoBlock) BlockBodySize added in v0.57.0

func (b *AlonzoBlock) BlockBodySize() uint64

func (*AlonzoBlock) BlockNumber

func (b *AlonzoBlock) BlockNumber() uint64

func (*AlonzoBlock) Era

func (b *AlonzoBlock) Era() Era

func (*AlonzoBlock) Hash

func (b *AlonzoBlock) Hash() string

func (*AlonzoBlock) IssuerVkey added in v0.57.0

func (b *AlonzoBlock) IssuerVkey() IssuerVkey

func (*AlonzoBlock) SlotNumber

func (b *AlonzoBlock) SlotNumber() uint64

func (*AlonzoBlock) Transactions

func (b *AlonzoBlock) Transactions() []Transaction

func (*AlonzoBlock) UnmarshalCBOR

func (b *AlonzoBlock) UnmarshalCBOR(cborData []byte) error

type AlonzoBlockHeader

type AlonzoBlockHeader struct {
	ShelleyBlockHeader
}

func (*AlonzoBlockHeader) Era

func (h *AlonzoBlockHeader) Era() Era

type AlonzoTransaction

type AlonzoTransaction struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Body       AlonzoTransactionBody
	WitnessSet AlonzoTransactionWitnessSet
	IsValid    bool
	TxMetadata *cbor.Value
}

func NewAlonzoTransactionFromCbor

func NewAlonzoTransactionFromCbor(data []byte) (*AlonzoTransaction, error)

func (*AlonzoTransaction) Cbor added in v0.56.0

func (t *AlonzoTransaction) Cbor() []byte

func (AlonzoTransaction) Fee added in v0.57.0

func (t AlonzoTransaction) Fee() uint64

func (AlonzoTransaction) Hash added in v0.46.0

func (t AlonzoTransaction) Hash() string

func (AlonzoTransaction) Inputs added in v0.46.0

func (t AlonzoTransaction) Inputs() []TransactionInput

func (AlonzoTransaction) Metadata

func (t AlonzoTransaction) Metadata() *cbor.Value

func (AlonzoTransaction) Outputs added in v0.46.0

func (t AlonzoTransaction) Outputs() []TransactionOutput

func (AlonzoTransaction) TTL added in v0.57.0

func (t AlonzoTransaction) TTL() uint64

type AlonzoTransactionBody

type AlonzoTransactionBody struct {
	MaryTransactionBody
	TxOutputs       []AlonzoTransactionOutput `cbor:"1,keyasint,omitempty"`
	ScriptDataHash  Blake2b256                `cbor:"11,keyasint,omitempty"`
	Collateral      []ShelleyTransactionInput `cbor:"13,keyasint,omitempty"`
	RequiredSigners []Blake2b224              `cbor:"14,keyasint,omitempty"`
	NetworkId       uint8                     `cbor:"15,keyasint,omitempty"`
}

func NewAlonzoTransactionBodyFromCbor

func NewAlonzoTransactionBodyFromCbor(
	data []byte,
) (*AlonzoTransactionBody, error)

func (*AlonzoTransactionBody) Outputs

func (*AlonzoTransactionBody) UnmarshalCBOR

func (b *AlonzoTransactionBody) UnmarshalCBOR(cborData []byte) error

type AlonzoTransactionOutput

type AlonzoTransactionOutput struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	OutputAddress     Address
	OutputAmount      MaryTransactionOutputValue
	TxOutputDatumHash *Blake2b256
}

func NewAlonzoTransactionOutputFromCbor added in v0.69.0

func NewAlonzoTransactionOutputFromCbor(data []byte) (*AlonzoTransactionOutput, error)

func (AlonzoTransactionOutput) Address

func (o AlonzoTransactionOutput) Address() Address

func (AlonzoTransactionOutput) Amount

func (o AlonzoTransactionOutput) Amount() uint64

func (AlonzoTransactionOutput) Assets added in v0.43.0

func (AlonzoTransactionOutput) Datum added in v0.46.0

func (AlonzoTransactionOutput) DatumHash

func (o AlonzoTransactionOutput) DatumHash() *Blake2b256

func (AlonzoTransactionOutput) MarshalJSON added in v0.44.0

func (o AlonzoTransactionOutput) MarshalJSON() ([]byte, error)

func (*AlonzoTransactionOutput) UnmarshalCBOR

func (o *AlonzoTransactionOutput) UnmarshalCBOR(cborData []byte) error

type AlonzoTransactionWitnessSet

type AlonzoTransactionWitnessSet struct {
	ShelleyTransactionWitnessSet
	PlutusScripts []cbor.RawMessage `cbor:"3,keyasint,omitempty"`
	PlutusData    []cbor.RawMessage `cbor:"4,keyasint,omitempty"`
	Redeemers     []cbor.RawMessage `cbor:"5,keyasint,omitempty"`
}

func (*AlonzoTransactionWitnessSet) UnmarshalCBOR added in v0.56.0

func (t *AlonzoTransactionWitnessSet) UnmarshalCBOR(cborData []byte) error

type ApplyTxError

type ApplyTxError struct {
	cbor.StructAsArray
	Failures []error
}

func (*ApplyTxError) Error

func (e *ApplyTxError) Error() string

func (*ApplyTxError) UnmarshalCBOR

func (e *ApplyTxError) UnmarshalCBOR(data []byte) error

type AssetFingerprint added in v0.44.0

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

func NewAssetFingerprint added in v0.44.0

func NewAssetFingerprint(policyId []byte, assetName []byte) AssetFingerprint

func (AssetFingerprint) Hash added in v0.44.0

func (a AssetFingerprint) Hash() Blake2b160

func (AssetFingerprint) String added in v0.44.0

func (a AssetFingerprint) String() string

type BabbageBlock

type BabbageBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header                 *BabbageBlockHeader
	TransactionBodies      []BabbageTransactionBody
	TransactionWitnessSets []BabbageTransactionWitnessSet
	TransactionMetadataSet map[uint]*cbor.Value
	InvalidTransactions    []uint
}

func NewBabbageBlockFromCbor

func NewBabbageBlockFromCbor(data []byte) (*BabbageBlock, error)

func (*BabbageBlock) BlockBodySize added in v0.57.0

func (b *BabbageBlock) BlockBodySize() uint64

func (*BabbageBlock) BlockNumber

func (b *BabbageBlock) BlockNumber() uint64

func (*BabbageBlock) Era

func (b *BabbageBlock) Era() Era

func (*BabbageBlock) Hash

func (b *BabbageBlock) Hash() string

func (*BabbageBlock) IssuerVkey added in v0.57.0

func (b *BabbageBlock) IssuerVkey() IssuerVkey

func (*BabbageBlock) SlotNumber

func (b *BabbageBlock) SlotNumber() uint64

func (*BabbageBlock) Transactions

func (b *BabbageBlock) Transactions() []Transaction

func (*BabbageBlock) UnmarshalCBOR

func (b *BabbageBlock) UnmarshalCBOR(cborData []byte) error

type BabbageBlockHeader

type BabbageBlockHeader struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor

	Body struct {
		cbor.StructAsArray
		BlockNumber   uint64
		Slot          uint64
		PrevHash      Blake2b256
		IssuerVkey    IssuerVkey
		VrfKey        []byte
		VrfResult     interface{}
		BlockBodySize uint64
		BlockBodyHash Blake2b256
		OpCert        struct {
			cbor.StructAsArray
			HotVkey        []byte
			SequenceNumber uint32
			KesPeriod      uint32
			Signature      []byte
		}
		ProtoVersion struct {
			cbor.StructAsArray
			Major uint64
			Minor uint64
		}
	}
	Signature interface{}
	// contains filtered or unexported fields
}

func NewBabbageBlockHeaderFromCbor

func NewBabbageBlockHeaderFromCbor(data []byte) (*BabbageBlockHeader, error)

func (*BabbageBlockHeader) BlockBodySize added in v0.57.0

func (h *BabbageBlockHeader) BlockBodySize() uint64

func (*BabbageBlockHeader) BlockNumber

func (h *BabbageBlockHeader) BlockNumber() uint64

func (*BabbageBlockHeader) Era

func (h *BabbageBlockHeader) Era() Era

func (*BabbageBlockHeader) Hash

func (h *BabbageBlockHeader) Hash() string

func (*BabbageBlockHeader) IssuerVkey added in v0.57.0

func (h *BabbageBlockHeader) IssuerVkey() IssuerVkey

func (*BabbageBlockHeader) SlotNumber

func (h *BabbageBlockHeader) SlotNumber() uint64

func (*BabbageBlockHeader) UnmarshalCBOR

func (h *BabbageBlockHeader) UnmarshalCBOR(cborData []byte) error

type BabbageTransaction

type BabbageTransaction struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Body       BabbageTransactionBody
	WitnessSet BabbageTransactionWitnessSet
	IsValid    bool
	TxMetadata *cbor.Value
}

func NewBabbageTransactionFromCbor

func NewBabbageTransactionFromCbor(data []byte) (*BabbageTransaction, error)

func (*BabbageTransaction) Cbor added in v0.56.0

func (t *BabbageTransaction) Cbor() []byte

func (BabbageTransaction) Fee added in v0.57.0

func (t BabbageTransaction) Fee() uint64

func (BabbageTransaction) Hash added in v0.46.0

func (t BabbageTransaction) Hash() string

func (BabbageTransaction) Inputs added in v0.46.0

func (t BabbageTransaction) Inputs() []TransactionInput

func (BabbageTransaction) Metadata

func (t BabbageTransaction) Metadata() *cbor.Value

func (BabbageTransaction) Outputs added in v0.46.0

func (t BabbageTransaction) Outputs() []TransactionOutput

func (BabbageTransaction) TTL added in v0.57.0

func (t BabbageTransaction) TTL() uint64

type BabbageTransactionBody

type BabbageTransactionBody struct {
	AlonzoTransactionBody
	TxOutputs        []BabbageTransactionOutput `cbor:"1,keyasint,omitempty"`
	CollateralReturn BabbageTransactionOutput   `cbor:"16,keyasint,omitempty"`
	TotalCollateral  uint64                     `cbor:"17,keyasint,omitempty"`
	ReferenceInputs  []ShelleyTransactionInput  `cbor:"18,keyasint,omitempty"`
}

func NewBabbageTransactionBodyFromCbor

func NewBabbageTransactionBodyFromCbor(
	data []byte,
) (*BabbageTransactionBody, error)

func (*BabbageTransactionBody) Outputs

func (*BabbageTransactionBody) UnmarshalCBOR

func (b *BabbageTransactionBody) UnmarshalCBOR(cborData []byte) error

type BabbageTransactionOutput

type BabbageTransactionOutput struct {
	cbor.DecodeStoreCbor
	OutputAddress Address                              `cbor:"0,keyasint,omitempty"`
	OutputAmount  MaryTransactionOutputValue           `cbor:"1,keyasint,omitempty"`
	DatumOption   *BabbageTransactionOutputDatumOption `cbor:"2,keyasint,omitempty"`
	ScriptRef     *cbor.Tag                            `cbor:"3,keyasint,omitempty"`
	// contains filtered or unexported fields
}

func NewBabbageTransactionOutputFromCbor added in v0.69.0

func NewBabbageTransactionOutputFromCbor(data []byte) (*BabbageTransactionOutput, error)

func (BabbageTransactionOutput) Address

func (o BabbageTransactionOutput) Address() Address

func (BabbageTransactionOutput) Amount

func (o BabbageTransactionOutput) Amount() uint64

func (BabbageTransactionOutput) Assets added in v0.43.0

func (BabbageTransactionOutput) Datum added in v0.46.0

func (BabbageTransactionOutput) DatumHash added in v0.46.0

func (o BabbageTransactionOutput) DatumHash() *Blake2b256

func (BabbageTransactionOutput) MarshalJSON added in v0.44.0

func (o BabbageTransactionOutput) MarshalJSON() ([]byte, error)

func (*BabbageTransactionOutput) UnmarshalCBOR

func (o *BabbageTransactionOutput) UnmarshalCBOR(cborData []byte) error

type BabbageTransactionOutputDatumOption added in v0.46.0

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

func (*BabbageTransactionOutputDatumOption) MarshalCBOR added in v0.46.0

func (d *BabbageTransactionOutputDatumOption) MarshalCBOR() ([]byte, error)

func (*BabbageTransactionOutputDatumOption) UnmarshalCBOR added in v0.46.0

func (d *BabbageTransactionOutputDatumOption) UnmarshalCBOR(data []byte) error

type BabbageTransactionWitnessSet

type BabbageTransactionWitnessSet struct {
	AlonzoTransactionWitnessSet
	PlutusV2Scripts []cbor.RawMessage `cbor:"6,keyasint,omitempty"`
}

func (*BabbageTransactionWitnessSet) UnmarshalCBOR added in v0.56.0

func (t *BabbageTransactionWitnessSet) UnmarshalCBOR(cborData []byte) error

type BadInputsUtxo

type BadInputsUtxo struct {
	UtxoFailureErrorBase
	Inputs []TxIn
}

func (*BadInputsUtxo) Error

func (e *BadInputsUtxo) Error() string

type Blake2b160 added in v0.44.0

type Blake2b160 [20]byte

func NewBlake2b160 added in v0.44.0

func NewBlake2b160(data []byte) Blake2b160

func (Blake2b160) Bytes added in v0.44.0

func (b Blake2b160) Bytes() []byte

func (Blake2b160) String added in v0.44.0

func (b Blake2b160) String() string

type Blake2b224

type Blake2b224 [28]byte

func NewBlake2b224 added in v0.44.0

func NewBlake2b224(data []byte) Blake2b224

func (Blake2b224) Bytes added in v0.44.0

func (b Blake2b224) Bytes() []byte

func (Blake2b224) String

func (b Blake2b224) String() string

type Blake2b256

type Blake2b256 [32]byte

func NewBlake2b256 added in v0.44.0

func NewBlake2b256(data []byte) Blake2b256

func (Blake2b256) Bytes added in v0.44.0

func (b Blake2b256) Bytes() []byte

func (Blake2b256) String

func (b Blake2b256) String() string

type Block

type Block interface {
	BlockHeader
	Transactions() []Transaction
}

func NewBlockFromCbor

func NewBlockFromCbor(blockType uint, data []byte) (Block, error)

type BlockHeader

type BlockHeader interface {
	Hash() string
	BlockNumber() uint64
	SlotNumber() uint64
	IssuerVkey() IssuerVkey
	BlockBodySize() uint64
	Era() Era
	Cbor() []byte
}

func NewBlockHeaderFromCbor

func NewBlockHeaderFromCbor(blockType uint, data []byte) (BlockHeader, error)

XXX: should this take the block header type instead?

type ByronEpochBoundaryBlock

type ByronEpochBoundaryBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header *ByronEpochBoundaryBlockHeader
	Body   []Blake2b224
	Extra  []interface{}
}

func NewByronEpochBoundaryBlockFromCbor

func NewByronEpochBoundaryBlockFromCbor(
	data []byte,
) (*ByronEpochBoundaryBlock, error)

func (*ByronEpochBoundaryBlock) BlockBodySize added in v0.57.0

func (b *ByronEpochBoundaryBlock) BlockBodySize() uint64

func (*ByronEpochBoundaryBlock) BlockNumber

func (b *ByronEpochBoundaryBlock) BlockNumber() uint64

func (*ByronEpochBoundaryBlock) Era

func (b *ByronEpochBoundaryBlock) Era() Era

func (*ByronEpochBoundaryBlock) Hash

func (b *ByronEpochBoundaryBlock) Hash() string

func (*ByronEpochBoundaryBlock) IssuerVkey added in v0.57.0

func (b *ByronEpochBoundaryBlock) IssuerVkey() IssuerVkey

func (*ByronEpochBoundaryBlock) SlotNumber

func (b *ByronEpochBoundaryBlock) SlotNumber() uint64

func (*ByronEpochBoundaryBlock) Transactions

func (b *ByronEpochBoundaryBlock) Transactions() []Transaction

func (*ByronEpochBoundaryBlock) UnmarshalCBOR

func (b *ByronEpochBoundaryBlock) UnmarshalCBOR(cborData []byte) error

type ByronEpochBoundaryBlockHeader

type ByronEpochBoundaryBlockHeader struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor

	ProtocolMagic uint32
	PrevBlock     Blake2b256
	BodyProof     interface{}
	ConsensusData struct {
		cbor.StructAsArray
		Epoch      uint64
		Difficulty struct {
			cbor.StructAsArray
			Value uint64
		}
	}
	ExtraData interface{}
	// contains filtered or unexported fields
}

func NewByronEpochBoundaryBlockHeaderFromCbor

func NewByronEpochBoundaryBlockHeaderFromCbor(
	data []byte,
) (*ByronEpochBoundaryBlockHeader, error)

func (*ByronEpochBoundaryBlockHeader) BlockBodySize added in v0.57.0

func (h *ByronEpochBoundaryBlockHeader) BlockBodySize() uint64

func (*ByronEpochBoundaryBlockHeader) BlockNumber

func (h *ByronEpochBoundaryBlockHeader) BlockNumber() uint64

func (*ByronEpochBoundaryBlockHeader) Era

func (*ByronEpochBoundaryBlockHeader) Hash

func (*ByronEpochBoundaryBlockHeader) IssuerVkey added in v0.57.0

func (h *ByronEpochBoundaryBlockHeader) IssuerVkey() IssuerVkey

func (*ByronEpochBoundaryBlockHeader) SlotNumber

func (h *ByronEpochBoundaryBlockHeader) SlotNumber() uint64

func (*ByronEpochBoundaryBlockHeader) UnmarshalCBOR

func (h *ByronEpochBoundaryBlockHeader) UnmarshalCBOR(cborData []byte) error

type ByronMainBlock

type ByronMainBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header *ByronMainBlockHeader
	Body   ByronMainBlockBody
	Extra  []interface{}
}

func NewByronMainBlockFromCbor

func NewByronMainBlockFromCbor(data []byte) (*ByronMainBlock, error)

func (*ByronMainBlock) BlockBodySize added in v0.57.0

func (b *ByronMainBlock) BlockBodySize() uint64

func (*ByronMainBlock) BlockNumber

func (b *ByronMainBlock) BlockNumber() uint64

func (*ByronMainBlock) Era

func (b *ByronMainBlock) Era() Era

func (*ByronMainBlock) Hash

func (b *ByronMainBlock) Hash() string

func (*ByronMainBlock) IssuerVkey added in v0.57.0

func (b *ByronMainBlock) IssuerVkey() IssuerVkey

func (*ByronMainBlock) SlotNumber

func (b *ByronMainBlock) SlotNumber() uint64

func (*ByronMainBlock) Transactions

func (b *ByronMainBlock) Transactions() []Transaction

func (*ByronMainBlock) UnmarshalCBOR

func (b *ByronMainBlock) UnmarshalCBOR(cborData []byte) error

type ByronMainBlockBody

type ByronMainBlockBody struct {
	cbor.StructAsArray
	// TODO: split this to its own type
	TxPayload []struct {
		cbor.StructAsArray
		Transaction ByronTransaction
		// TODO: figure out what this field actually is
		Twit []cbor.Value
	}
	SscPayload cbor.Value
	DlgPayload []interface{}
	UpdPayload []interface{}
}

type ByronMainBlockHeader

type ByronMainBlockHeader struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor

	ProtocolMagic uint32
	PrevBlock     Blake2b256
	BodyProof     interface{}
	ConsensusData struct {
		cbor.StructAsArray
		// [slotid, pubkey, difficulty, blocksig]
		SlotId struct {
			cbor.StructAsArray
			Epoch uint64
			Slot  uint16
		}
		PubKey     []byte
		Difficulty struct {
			cbor.StructAsArray
			Unknown uint64
		}
		BlockSig []interface{}
	}
	ExtraData struct {
		cbor.StructAsArray
		BlockVersion struct {
			cbor.StructAsArray
			Major   uint16
			Minor   uint16
			Unknown uint8
		}
		SoftwareVersion struct {
			cbor.StructAsArray
			Name    string
			Unknown uint32
		}
		Attributes interface{}
		ExtraProof Blake2b256
	}
	// contains filtered or unexported fields
}

func NewByronMainBlockHeaderFromCbor

func NewByronMainBlockHeaderFromCbor(
	data []byte,
) (*ByronMainBlockHeader, error)

func (*ByronMainBlockHeader) BlockBodySize added in v0.57.0

func (h *ByronMainBlockHeader) BlockBodySize() uint64

func (*ByronMainBlockHeader) BlockNumber

func (h *ByronMainBlockHeader) BlockNumber() uint64

func (*ByronMainBlockHeader) Era

func (h *ByronMainBlockHeader) Era() Era

func (*ByronMainBlockHeader) Hash

func (h *ByronMainBlockHeader) Hash() string

func (*ByronMainBlockHeader) IssuerVkey added in v0.57.0

func (h *ByronMainBlockHeader) IssuerVkey() IssuerVkey

func (*ByronMainBlockHeader) SlotNumber

func (h *ByronMainBlockHeader) SlotNumber() uint64

func (*ByronMainBlockHeader) UnmarshalCBOR

func (h *ByronMainBlockHeader) UnmarshalCBOR(cborData []byte) error

type ByronTransaction

type ByronTransaction struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	// TODO: flesh these out
	TxInputs   []any
	TxOutputs  []any
	Attributes *cbor.Value
}

func NewByronTransactionFromCbor

func NewByronTransactionFromCbor(data []byte) (*ByronTransaction, error)

func (*ByronTransaction) Fee added in v0.57.0

func (t *ByronTransaction) Fee() uint64

func (*ByronTransaction) Hash added in v0.46.0

func (t *ByronTransaction) Hash() string

func (*ByronTransaction) Inputs added in v0.46.0

func (t *ByronTransaction) Inputs() []TransactionInput

func (*ByronTransaction) Metadata added in v0.46.0

func (t *ByronTransaction) Metadata() *cbor.Value

func (*ByronTransaction) Outputs added in v0.46.0

func (t *ByronTransaction) Outputs() []TransactionOutput

func (*ByronTransaction) TTL added in v0.57.0

func (t *ByronTransaction) TTL() uint64

type CollateralContainsNonADA

type CollateralContainsNonADA struct {
	UtxoFailureErrorBase
	// TODO: determine content/structure of this value
	Value cbor.Value
}

func (*CollateralContainsNonADA) Error

func (e *CollateralContainsNonADA) Error() string

type ConwayBlock added in v0.60.0

type ConwayBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header                 *ConwayBlockHeader
	TransactionBodies      []ConwayTransactionBody
	TransactionWitnessSets []BabbageTransactionWitnessSet
	TransactionMetadataSet map[uint]*cbor.Value
	InvalidTransactions    []uint
}

func NewConwayBlockFromCbor added in v0.60.0

func NewConwayBlockFromCbor(data []byte) (*ConwayBlock, error)

func (*ConwayBlock) BlockBodySize added in v0.60.0

func (b *ConwayBlock) BlockBodySize() uint64

func (*ConwayBlock) BlockNumber added in v0.60.0

func (b *ConwayBlock) BlockNumber() uint64

func (*ConwayBlock) Era added in v0.60.0

func (b *ConwayBlock) Era() Era

func (*ConwayBlock) Hash added in v0.60.0

func (b *ConwayBlock) Hash() string

func (*ConwayBlock) IssuerVkey added in v0.60.0

func (b *ConwayBlock) IssuerVkey() IssuerVkey

func (*ConwayBlock) SlotNumber added in v0.60.0

func (b *ConwayBlock) SlotNumber() uint64

func (*ConwayBlock) Transactions added in v0.60.0

func (b *ConwayBlock) Transactions() []Transaction

func (*ConwayBlock) UnmarshalCBOR added in v0.60.0

func (b *ConwayBlock) UnmarshalCBOR(cborData []byte) error

type ConwayBlockHeader added in v0.60.0

type ConwayBlockHeader struct {
	BabbageBlockHeader
}

func NewConwayBlockHeaderFromCbor added in v0.60.0

func NewConwayBlockHeaderFromCbor(data []byte) (*ConwayBlockHeader, error)

func (*ConwayBlockHeader) Era added in v0.60.0

func (h *ConwayBlockHeader) Era() Era

type ConwayTransaction added in v0.60.0

type ConwayTransaction struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Body       ConwayTransactionBody
	WitnessSet BabbageTransactionWitnessSet
	IsValid    bool
	TxMetadata *cbor.Value
}

func NewConwayTransactionFromCbor added in v0.60.0

func NewConwayTransactionFromCbor(data []byte) (*ConwayTransaction, error)

func (*ConwayTransaction) Cbor added in v0.60.0

func (t *ConwayTransaction) Cbor() []byte

func (ConwayTransaction) Fee added in v0.60.0

func (t ConwayTransaction) Fee() uint64

func (ConwayTransaction) Hash added in v0.60.0

func (t ConwayTransaction) Hash() string

func (ConwayTransaction) Inputs added in v0.60.0

func (t ConwayTransaction) Inputs() []TransactionInput

func (ConwayTransaction) Metadata added in v0.60.0

func (t ConwayTransaction) Metadata() *cbor.Value

func (ConwayTransaction) Outputs added in v0.60.0

func (t ConwayTransaction) Outputs() []TransactionOutput

func (ConwayTransaction) TTL added in v0.60.0

func (t ConwayTransaction) TTL() uint64

type ConwayTransactionBody added in v0.60.0

type ConwayTransactionBody struct {
	BabbageTransactionBody
	VotingProcedures     *cbor.Value `cbor:"19,keyasint,omitempty"`
	ProposalProcedures   *cbor.Value `cbor:"20,keyasint,omitempty"`
	CurrentTreasuryValue int64       `cbor:"21,keyasint,omitempty"`
	Donation             uint64      `cbor:"22,keyasint,omitempty"`
}

func NewConwayTransactionBodyFromCbor added in v0.60.0

func NewConwayTransactionBodyFromCbor(
	data []byte,
) (*ConwayTransactionBody, error)

func (*ConwayTransactionBody) UnmarshalCBOR added in v0.60.0

func (b *ConwayTransactionBody) UnmarshalCBOR(cborData []byte) error

type Era

type Era struct {
	Id   uint8
	Name string
}

func GetEraById

func GetEraById(eraId uint8) *Era

type EraMismatch

type EraMismatch struct {
	cbor.StructAsArray
	LedgerEra uint8
	OtherEra  uint8
}

func (*EraMismatch) Error

func (e *EraMismatch) Error() string

type ExUnitsTooBigUtxo

type ExUnitsTooBigUtxo struct {
	UtxoFailureErrorBase
	MaxAllowed int
	Supplied   int
}

func (*ExUnitsTooBigUtxo) Error

func (e *ExUnitsTooBigUtxo) Error() string

type FeeTooSmallUtxo

type FeeTooSmallUtxo struct {
	UtxoFailureErrorBase
	MinimumFee  uint64
	SuppliedFee uint64
}

func (*FeeTooSmallUtxo) Error

func (e *FeeTooSmallUtxo) Error() string

type GenericError

type GenericError struct {
	Value interface{}
	Cbor  []byte
}

func (*GenericError) Error

func (e *GenericError) Error() string

func (*GenericError) UnmarshalCBOR

func (e *GenericError) UnmarshalCBOR(data []byte) error

type InputSetEmptyUtxo

type InputSetEmptyUtxo struct {
	UtxoFailureErrorBase
}

func (*InputSetEmptyUtxo) Error

func (e *InputSetEmptyUtxo) Error() string

type InsufficientCollateral

type InsufficientCollateral struct {
	UtxoFailureErrorBase
	BalanceComputed    uint64
	RequiredCollateral uint64
}

func (*InsufficientCollateral) Error

func (e *InsufficientCollateral) Error() string

type IssuerVkey added in v0.58.0

type IssuerVkey [32]byte

IssuerVkey represents the verification key for the stake pool that minted a block

func (IssuerVkey) Hash added in v0.58.0

func (i IssuerVkey) Hash() Blake2b224

func (IssuerVkey) PoolId added in v0.58.0

func (i IssuerVkey) PoolId() string

type MaryBlock

type MaryBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header                 *MaryBlockHeader
	TransactionBodies      []MaryTransactionBody
	TransactionWitnessSets []ShelleyTransactionWitnessSet
	TransactionMetadataSet map[uint]*cbor.Value
}

func NewMaryBlockFromCbor

func NewMaryBlockFromCbor(data []byte) (*MaryBlock, error)

func (*MaryBlock) BlockBodySize added in v0.57.0

func (b *MaryBlock) BlockBodySize() uint64

func (*MaryBlock) BlockNumber

func (b *MaryBlock) BlockNumber() uint64

func (*MaryBlock) Era

func (b *MaryBlock) Era() Era

func (*MaryBlock) Hash

func (b *MaryBlock) Hash() string

func (*MaryBlock) IssuerVkey added in v0.57.0

func (b *MaryBlock) IssuerVkey() IssuerVkey

func (*MaryBlock) SlotNumber

func (b *MaryBlock) SlotNumber() uint64

func (*MaryBlock) Transactions

func (b *MaryBlock) Transactions() []Transaction

func (*MaryBlock) UnmarshalCBOR

func (b *MaryBlock) UnmarshalCBOR(cborData []byte) error

type MaryBlockHeader

type MaryBlockHeader struct {
	ShelleyBlockHeader
}

func (*MaryBlockHeader) Era

func (h *MaryBlockHeader) Era() Era

type MaryTransaction

type MaryTransaction struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Body       MaryTransactionBody
	WitnessSet ShelleyTransactionWitnessSet
	TxMetadata *cbor.Value
}

func NewMaryTransactionFromCbor

func NewMaryTransactionFromCbor(data []byte) (*MaryTransaction, error)

func (*MaryTransaction) Cbor added in v0.56.0

func (t *MaryTransaction) Cbor() []byte

func (MaryTransaction) Fee added in v0.57.0

func (t MaryTransaction) Fee() uint64

func (MaryTransaction) Hash added in v0.46.0

func (t MaryTransaction) Hash() string

func (MaryTransaction) Inputs added in v0.46.0

func (t MaryTransaction) Inputs() []TransactionInput

func (MaryTransaction) Metadata

func (t MaryTransaction) Metadata() *cbor.Value

func (MaryTransaction) Outputs added in v0.46.0

func (t MaryTransaction) Outputs() []TransactionOutput

func (MaryTransaction) TTL added in v0.57.0

func (t MaryTransaction) TTL() uint64

type MaryTransactionBody

type MaryTransactionBody struct {
	AllegraTransactionBody
	TxOutputs []MaryTransactionOutput        `cbor:"1,keyasint,omitempty"`
	Mint      MultiAsset[MultiAssetTypeMint] `cbor:"9,keyasint,omitempty"`
}

func NewMaryTransactionBodyFromCbor

func NewMaryTransactionBodyFromCbor(data []byte) (*MaryTransactionBody, error)

func (*MaryTransactionBody) Outputs

func (b *MaryTransactionBody) Outputs() []TransactionOutput

func (*MaryTransactionBody) UnmarshalCBOR

func (b *MaryTransactionBody) UnmarshalCBOR(cborData []byte) error

type MaryTransactionOutput

type MaryTransactionOutput struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	OutputAddress Address
	OutputAmount  MaryTransactionOutputValue
}

func NewMaryTransactionOutputFromCbor added in v0.69.0

func NewMaryTransactionOutputFromCbor(data []byte) (*MaryTransactionOutput, error)

func (MaryTransactionOutput) Address

func (o MaryTransactionOutput) Address() Address

func (MaryTransactionOutput) Amount

func (o MaryTransactionOutput) Amount() uint64

func (MaryTransactionOutput) Assets added in v0.43.0

func (MaryTransactionOutput) Datum added in v0.46.0

func (MaryTransactionOutput) DatumHash added in v0.46.0

func (o MaryTransactionOutput) DatumHash() *Blake2b256

func (MaryTransactionOutput) MarshalJSON added in v0.44.0

func (o MaryTransactionOutput) MarshalJSON() ([]byte, error)

type MaryTransactionOutputValue added in v0.42.0

type MaryTransactionOutputValue struct {
	cbor.StructAsArray
	Amount uint64
	// We use a pointer here to allow it to be nil
	Assets *MultiAsset[MultiAssetTypeOutput]
}

func (*MaryTransactionOutputValue) MarshalCBOR added in v0.42.0

func (v *MaryTransactionOutputValue) MarshalCBOR() ([]byte, error)

func (*MaryTransactionOutputValue) UnmarshalCBOR added in v0.42.0

func (v *MaryTransactionOutputValue) UnmarshalCBOR(data []byte) error

type MaxTxSizeUtxo

type MaxTxSizeUtxo struct {
	UtxoFailureErrorBase
	ActualSize int
	MaxSize    int
}

func (*MaxTxSizeUtxo) Error

func (e *MaxTxSizeUtxo) Error() string

type MultiAsset added in v0.43.0

type MultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint] struct {
	// contains filtered or unexported fields
}

MultiAsset represents a collection of policies, assets, and quantities. It's used for TX outputs (uint64) and TX asset minting (int64 to allow for negative values for burning)

func (*MultiAsset[T]) Asset added in v0.43.0

func (m *MultiAsset[T]) Asset(policyId Blake2b224, assetName []byte) T

func (*MultiAsset[T]) Assets added in v0.43.0

func (m *MultiAsset[T]) Assets(policyId Blake2b224) [][]byte

func (*MultiAsset[T]) MarshalCBOR added in v0.43.0

func (m *MultiAsset[T]) MarshalCBOR() ([]byte, error)

func (MultiAsset[T]) MarshalJSON added in v0.44.0

func (m MultiAsset[T]) MarshalJSON() ([]byte, error)

func (*MultiAsset[T]) Policies added in v0.43.0

func (m *MultiAsset[T]) Policies() []Blake2b224

func (*MultiAsset[T]) UnmarshalCBOR added in v0.43.0

func (m *MultiAsset[T]) UnmarshalCBOR(data []byte) error

type MultiAssetTypeMint added in v0.44.0

type MultiAssetTypeMint = int64

type MultiAssetTypeOutput added in v0.44.0

type MultiAssetTypeOutput = uint64

type NewErrorFromCborFunc

type NewErrorFromCborFunc func([]byte) (error, error)

Helper type to make the code a little cleaner

type NoCollateralInputs

type NoCollateralInputs struct {
	UtxoFailureErrorBase
}

func (*NoCollateralInputs) Error

func (e *NoCollateralInputs) Error() string

type OutputBootAddrAttrsTooBig

type OutputBootAddrAttrsTooBig struct {
	UtxoFailureErrorBase
	Outputs []TxOut
}

func (*OutputBootAddrAttrsTooBig) Error

func (e *OutputBootAddrAttrsTooBig) Error() string

type OutputTooBigUtxo

type OutputTooBigUtxo struct {
	UtxoFailureErrorBase
	Outputs []struct {
		ActualSize int
		MaxSize    int
		Output     TxOut
	}
}

func (*OutputTooBigUtxo) Error

func (e *OutputTooBigUtxo) Error() string

type OutputTooSmallUtxo

type OutputTooSmallUtxo struct {
	UtxoFailureErrorBase
	Outputs []TxOut
}

func (*OutputTooSmallUtxo) Error

func (e *OutputTooSmallUtxo) Error() string

type OutsideForecast

type OutsideForecast struct {
	UtxoFailureErrorBase
	Slot uint32
}

func (*OutsideForecast) Error

func (e *OutsideForecast) Error() string

type OutsideValidityIntervalUtxo

type OutsideValidityIntervalUtxo struct {
	UtxoFailureErrorBase
	ValidityInterval cbor.Value
	Slot             uint32
}

func (*OutsideValidityIntervalUtxo) Error

type ScriptsNotPaidUtxo

type ScriptsNotPaidUtxo struct {
	UtxoFailureErrorBase
	// TODO: determine content/structure of this value
	Value cbor.Value
}

func (*ScriptsNotPaidUtxo) Error

func (e *ScriptsNotPaidUtxo) Error() string

type ShelleyBlock

type ShelleyBlock struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Header                 *ShelleyBlockHeader
	TransactionBodies      []ShelleyTransactionBody
	TransactionWitnessSets []ShelleyTransactionWitnessSet
	TransactionMetadataSet map[uint]*cbor.Value
}

func NewShelleyBlockFromCbor

func NewShelleyBlockFromCbor(data []byte) (*ShelleyBlock, error)

func (*ShelleyBlock) BlockBodySize added in v0.57.0

func (b *ShelleyBlock) BlockBodySize() uint64

func (*ShelleyBlock) BlockNumber

func (b *ShelleyBlock) BlockNumber() uint64

func (*ShelleyBlock) Era

func (b *ShelleyBlock) Era() Era

func (*ShelleyBlock) Hash

func (b *ShelleyBlock) Hash() string

func (*ShelleyBlock) IssuerVkey added in v0.57.0

func (b *ShelleyBlock) IssuerVkey() IssuerVkey

func (*ShelleyBlock) SlotNumber

func (b *ShelleyBlock) SlotNumber() uint64

func (*ShelleyBlock) Transactions

func (b *ShelleyBlock) Transactions() []Transaction

func (*ShelleyBlock) UnmarshalCBOR

func (b *ShelleyBlock) UnmarshalCBOR(cborData []byte) error

type ShelleyBlockHeader

type ShelleyBlockHeader struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor

	Body struct {
		cbor.StructAsArray
		BlockNumber          uint64
		Slot                 uint64
		PrevHash             Blake2b256
		IssuerVkey           IssuerVkey
		VrfKey               []byte
		NonceVrf             interface{}
		LeaderVrf            interface{}
		BlockBodySize        uint64
		BlockBodyHash        Blake2b256
		OpCertHotVkey        []byte
		OpCertSequenceNumber uint32
		OpCertKesPeriod      uint32
		OpCertSignature      []byte
		ProtoMajorVersion    uint64
		ProtoMinorVersion    uint64
	}
	Signature interface{}
	// contains filtered or unexported fields
}

func NewShelleyBlockHeaderFromCbor

func NewShelleyBlockHeaderFromCbor(data []byte) (*ShelleyBlockHeader, error)

func (*ShelleyBlockHeader) BlockBodySize added in v0.57.0

func (h *ShelleyBlockHeader) BlockBodySize() uint64

func (*ShelleyBlockHeader) BlockNumber

func (h *ShelleyBlockHeader) BlockNumber() uint64

func (*ShelleyBlockHeader) Era

func (h *ShelleyBlockHeader) Era() Era

func (*ShelleyBlockHeader) Hash

func (h *ShelleyBlockHeader) Hash() string

func (*ShelleyBlockHeader) IssuerVkey added in v0.57.0

func (h *ShelleyBlockHeader) IssuerVkey() IssuerVkey

func (*ShelleyBlockHeader) SlotNumber

func (h *ShelleyBlockHeader) SlotNumber() uint64

func (*ShelleyBlockHeader) UnmarshalCBOR

func (h *ShelleyBlockHeader) UnmarshalCBOR(cborData []byte) error

type ShelleyTransaction

type ShelleyTransaction struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Body       ShelleyTransactionBody
	WitnessSet ShelleyTransactionWitnessSet
	TxMetadata *cbor.Value
}

func NewShelleyTransactionFromCbor

func NewShelleyTransactionFromCbor(data []byte) (*ShelleyTransaction, error)

func (*ShelleyTransaction) Cbor added in v0.56.0

func (t *ShelleyTransaction) Cbor() []byte

func (ShelleyTransaction) Fee added in v0.57.0

func (t ShelleyTransaction) Fee() uint64

func (ShelleyTransaction) Hash added in v0.46.0

func (t ShelleyTransaction) Hash() string

func (ShelleyTransaction) Inputs added in v0.46.0

func (t ShelleyTransaction) Inputs() []TransactionInput

func (ShelleyTransaction) Metadata

func (t ShelleyTransaction) Metadata() *cbor.Value

func (ShelleyTransaction) Outputs added in v0.46.0

func (t ShelleyTransaction) Outputs() []TransactionOutput

func (ShelleyTransaction) TTL added in v0.57.0

func (t ShelleyTransaction) TTL() uint64

type ShelleyTransactionBody

type ShelleyTransactionBody struct {
	cbor.DecodeStoreCbor

	TxInputs  []ShelleyTransactionInput  `cbor:"0,keyasint,omitempty"`
	TxOutputs []ShelleyTransactionOutput `cbor:"1,keyasint,omitempty"`
	TxFee     uint64                     `cbor:"2,keyasint,omitempty"`
	Ttl       uint64                     `cbor:"3,keyasint,omitempty"`
	// TODO: figure out how to parse properly
	Certificates cbor.RawMessage `cbor:"4,keyasint,omitempty"`
	// TODO: figure out how to parse this correctly
	// We keep the raw CBOR because it can contain a map with []byte keys, which
	// Go does not allow
	Withdrawals cbor.Value `cbor:"5,keyasint,omitempty"`
	Update      struct {
		cbor.StructAsArray
		ProtocolParamUpdates cbor.Value
		Epoch                uint64
	} `cbor:"6,keyasint,omitempty"`
	MetadataHash Blake2b256 `cbor:"7,keyasint,omitempty"`
	// contains filtered or unexported fields
}

func NewShelleyTransactionBodyFromCbor

func NewShelleyTransactionBodyFromCbor(
	data []byte,
) (*ShelleyTransactionBody, error)

func (*ShelleyTransactionBody) Fee

func (b *ShelleyTransactionBody) Fee() uint64

func (*ShelleyTransactionBody) Hash

func (b *ShelleyTransactionBody) Hash() string

func (*ShelleyTransactionBody) Inputs

func (*ShelleyTransactionBody) Outputs

func (*ShelleyTransactionBody) TTL added in v0.57.0

func (b *ShelleyTransactionBody) TTL() uint64

func (*ShelleyTransactionBody) UnmarshalCBOR

func (b *ShelleyTransactionBody) UnmarshalCBOR(cborData []byte) error

type ShelleyTransactionInput

type ShelleyTransactionInput struct {
	cbor.StructAsArray
	TxId        Blake2b256
	OutputIndex uint32
}

func (ShelleyTransactionInput) Id

func (ShelleyTransactionInput) Index

func (i ShelleyTransactionInput) Index() uint32

func (ShelleyTransactionInput) MarshalJSON added in v0.44.0

func (i ShelleyTransactionInput) MarshalJSON() ([]byte, error)

func (ShelleyTransactionInput) String added in v0.44.0

func (i ShelleyTransactionInput) String() string

type ShelleyTransactionOutput

type ShelleyTransactionOutput struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	OutputAddress Address `json:"address"`
	OutputAmount  uint64  `json:"amount"`
}

func NewShelleyTransactionOutputFromCbor added in v0.69.0

func NewShelleyTransactionOutputFromCbor(data []byte) (*ShelleyTransactionOutput, error)

func (ShelleyTransactionOutput) Address

func (o ShelleyTransactionOutput) Address() Address

func (ShelleyTransactionOutput) Amount

func (o ShelleyTransactionOutput) Amount() uint64

func (ShelleyTransactionOutput) Assets added in v0.43.0

func (ShelleyTransactionOutput) Datum added in v0.46.0

func (ShelleyTransactionOutput) DatumHash added in v0.46.0

func (o ShelleyTransactionOutput) DatumHash() *Blake2b256

type ShelleyTransactionWitnessSet

type ShelleyTransactionWitnessSet struct {
	cbor.DecodeStoreCbor
	VkeyWitnesses      []interface{} `cbor:"0,keyasint,omitempty"`
	MultisigScripts    []interface{} `cbor:"1,keyasint,omitempty"`
	BootstrapWitnesses []interface{} `cbor:"2,keyasint,omitempty"`
}

func (*ShelleyTransactionWitnessSet) UnmarshalCBOR added in v0.56.0

func (t *ShelleyTransactionWitnessSet) UnmarshalCBOR(cborData []byte) error

type ShelleyTxValidationError

type ShelleyTxValidationError struct {
	Era uint8
	Err ApplyTxError
}

func (*ShelleyTxValidationError) Error

func (e *ShelleyTxValidationError) Error() string

func (*ShelleyTxValidationError) UnmarshalCBOR

func (e *ShelleyTxValidationError) UnmarshalCBOR(data []byte) error

type TooManyCollateralInputs

type TooManyCollateralInputs struct {
	UtxoFailureErrorBase
	MaxAllowed int
	Supplied   int
}

func (*TooManyCollateralInputs) Error

func (e *TooManyCollateralInputs) Error() string

type Transaction added in v0.46.0

type Transaction interface {
	TransactionBody
	Metadata() *cbor.Value
}

func NewTransactionFromCbor

func NewTransactionFromCbor(txType uint, data []byte) (Transaction, error)

type TransactionBody

type TransactionBody interface {
	Hash() string
	Cbor() []byte
	Inputs() []TransactionInput
	Outputs() []TransactionOutput
	Fee() uint64
	TTL() uint64
}

func NewTransactionBodyFromCbor

func NewTransactionBodyFromCbor(
	txType uint,
	data []byte,
) (TransactionBody, error)

type TransactionInput added in v0.43.0

type TransactionInput interface {
	Id() Blake2b256
	Index() uint32
}

type TransactionOutput added in v0.43.0

type TransactionOutput interface {
	Address() Address
	Amount() uint64
	Assets() *MultiAsset[MultiAssetTypeOutput]
	Datum() *cbor.LazyValue
	DatumHash() *Blake2b256
	Cbor() []byte
}

func NewTransactionOutputFromCbor added in v0.69.0

func NewTransactionOutputFromCbor(data []byte) (TransactionOutput, error)

NewTransactionOutputFromCbor attempts to parse the provided arbitrary CBOR data as a transaction output from each of the eras, returning the first one that we can successfully decode

type TriesToForgeADA

type TriesToForgeADA struct {
	UtxoFailureErrorBase
}

func (*TriesToForgeADA) Error

func (e *TriesToForgeADA) Error() string

type TxIn

type TxIn struct {
	cbor.StructAsArray
	Utxo cbor.ByteString
	TxIx uint8
}

func (*TxIn) String

func (e *TxIn) String() string

type TxOut

type TxOut struct {
	cbor.Value
}

func (*TxOut) String

func (t *TxOut) String() string

type UtxoFailure

type UtxoFailure struct {
	cbor.StructAsArray
	Era uint8
	Err error
}

func (*UtxoFailure) Error

func (e *UtxoFailure) Error() string

func (*UtxoFailure) UnmarshalCBOR

func (e *UtxoFailure) UnmarshalCBOR(data []byte) error

type UtxoFailureErrorBase

type UtxoFailureErrorBase struct {
	cbor.StructAsArray
	Type uint8
}

type UtxosFailure

type UtxosFailure struct {
	UtxoFailureErrorBase
	Err GenericError
}

func (*UtxosFailure) Error

func (e *UtxosFailure) Error() string

type UtxowFailure

type UtxowFailure struct {
	cbor.StructAsArray
	Err error
}

func (*UtxowFailure) Error

func (e *UtxowFailure) Error() string

func (*UtxowFailure) UnmarshalCBOR

func (e *UtxowFailure) UnmarshalCBOR(data []byte) error

type ValueNotConservedUtxo

type ValueNotConservedUtxo struct {
	UtxoFailureErrorBase
	Consumed uint64
	Produced uint64
}

func (*ValueNotConservedUtxo) Error

func (e *ValueNotConservedUtxo) Error() string

type WrongNetwork

type WrongNetwork struct {
	UtxoFailureErrorBase
	ExpectedNetworkId int
	Addresses         cbor.Value
}

func (*WrongNetwork) Error

func (e *WrongNetwork) Error() string

type WrongNetworkInTxBody

type WrongNetworkInTxBody struct {
	UtxoFailureErrorBase
	ActualNetworkId      int
	TransactionNetworkId int
}

func (*WrongNetworkInTxBody) Error

func (e *WrongNetworkInTxBody) Error() string

type WrongNetworkWithdrawal

type WrongNetworkWithdrawal struct {
	UtxoFailureErrorBase
	ExpectedNetworkId int
	RewardAccounts    cbor.Value
}

func (*WrongNetworkWithdrawal) Error

func (e *WrongNetworkWithdrawal) Error() string

Jump to

Keyboard shortcuts

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