ledger

package
v0.38.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 4 Imported by: 14

Documentation

Index

Constants

View Source
const (
	ERA_ID_ALLEGRA = 2

	BLOCK_TYPE_ALLEGRA = 3

	BLOCK_HEADER_TYPE_ALLEGRA = 2

	TX_TYPE_ALLEGRA = 2
)
View Source
const (
	ERA_ID_ALONZO = 4

	BLOCK_TYPE_ALONZO = 5

	BLOCK_HEADER_TYPE_ALONZO = 4

	TX_TYPE_ALONZO = 4
)
View Source
const (
	ERA_ID_BABBAGE = 5

	BLOCK_TYPE_BABBAGE = 6

	BLOCK_HEADER_TYPE_BABBAGE = 5

	TX_TYPE_BABBAGE = 5
)
View Source
const (
	ERA_ID_BYRON = 0

	BLOCK_TYPE_BYRON_EBB  = 0
	BLOCK_TYPE_BYRON_MAIN = 1

	BLOCK_HEADER_TYPE_BYRON = 0

	TX_TYPE_BYRON = 0

	BYRON_SLOTS_PER_EPOCH = 21600
)
View Source
const (
	APPLY_TX_ERROR_UTXOW_FAILURE = 0

	UTXOW_FAILURE_UTXO_FAILURE = 2

	UTXO_FAILURE_FROM_ALONZO = 1

	UTXO_FAILURE_BAD_INPUTS_UTXO                = 0
	UTXO_FAILURE_OUTSIDE_VALIDITY_INTERVAL_UTXO = 1
	UTXO_FAILURE_MAX_TX_SIZE_UTXO               = 2
	UTXO_FAILURE_INPUT_SET_EMPTY                = 3
	UTXO_FAILURE_FEE_TOO_SMALL_UTXO             = 4
	UTXO_FAILURE_VALUE_NOT_CONSERVED_UTXO       = 5
	UTXO_FAILURE_OUTPUT_TOO_SMALL_UTXO          = 6
	UTXO_FAILURE_UTXOS_FAILURE                  = 7
	UTXO_FAILURE_WRONG_NETWORK                  = 8
	UTXO_FAILURE_WRONG_NETWORK_WITHDRAWAL       = 9
	UTXO_FAILURE_OUTPUT_BOOT_ADDR_ATTRS_TOO_BIG = 10
	UTXO_FAILURE_TRIES_TO_FORGE_ADA             = 11
	UTXO_FAILURE_OUTPUT_TOO_BIG_UTXO            = 12
	UTXO_FAILURE_INSUFFICIENT_COLLATERAL        = 13
	UTXO_FAILURE_SCRIPTS_NOT_PAID_UTXO          = 14
	UTXO_FAILURE_EX_UNITS_TOO_BIG_UTXO          = 15
	UTXO_FAILURE_COLLATERAL_CONTAINS_NON_ADA    = 16
	UTXO_FAILURE_WRONG_NETWORK_IN_TX_BODY       = 17
	UTXO_FAILURE_OUTSIDE_FORECAST               = 18
	UTXO_FAILURE_TOO_MANY_COLLATERAL_INPUTS     = 19
	UTXO_FAILURE_NO_COLLATERAL_INPUTS           = 20
)
View Source
const (
	ERA_ID_MARY = 3

	BLOCK_TYPE_MARY = 4

	BLOCK_HEADER_TYPE_MARY = 3

	TX_TYPE_MARY = 3
)
View Source
const (
	ERA_ID_SHELLEY = 1

	BLOCK_TYPE_SHELLEY = 2

	BLOCK_HEADER_TYPE_SHELLEY = 1

	TX_TYPE_SHELLEY = 1
)

Variables

This section is empty.

Functions

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 NewTransactionBodyFromCbor

func NewTransactionBodyFromCbor(txType uint, data []byte) (interface{}, error)

func NewTransactionFromCbor

func NewTransactionFromCbor(txType uint, data []byte) (interface{}, error)

func NewTxSubmitErrorFromCbor

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

Helper function to try to parse CBOR as various error types

Types

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) BlockNumber

func (b *AllegraBlock) BlockNumber() uint64

func (*AllegraBlock) Era

func (b *AllegraBlock) Era() Era

func (*AllegraBlock) Hash

func (b *AllegraBlock) Hash() string

func (*AllegraBlock) SlotNumber

func (b *AllegraBlock) SlotNumber() uint64

func (*AllegraBlock) Transactions

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

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
	Body       AllegraTransactionBody
	WitnessSet ShelleyTransactionWitnessSet
	Metadata   cbor.Value
}

func NewAllegraTransactionFromCbor

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

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) BlockNumber

func (b *AlonzoBlock) BlockNumber() uint64

func (*AlonzoBlock) Era

func (b *AlonzoBlock) Era() Era

func (*AlonzoBlock) Hash

func (b *AlonzoBlock) Hash() string

func (*AlonzoBlock) SlotNumber

func (b *AlonzoBlock) SlotNumber() uint64

func (*AlonzoBlock) Transactions

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

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
	Body       AlonzoTransactionBody
	WitnessSet AlonzoTransactionWitnessSet
	IsValid    bool
	Metadata   cbor.Value
}

func NewAlonzoTransactionFromCbor

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

type AlonzoTransactionBody

type AlonzoTransactionBody struct {
	MaryTransactionBody
	Outputs         []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) UnmarshalCBOR

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

type AlonzoTransactionOutput

type AlonzoTransactionOutput struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	Address   Blake2b256
	Amount    cbor.Value
	DatumHash Blake2b256
}

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"`
}

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 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) BlockNumber

func (b *BabbageBlock) BlockNumber() uint64

func (*BabbageBlock) Era

func (b *BabbageBlock) Era() Era

func (*BabbageBlock) Hash

func (b *BabbageBlock) Hash() string

func (*BabbageBlock) SlotNumber

func (b *BabbageBlock) SlotNumber() uint64

func (*BabbageBlock) Transactions

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

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    interface{}
		VrfKey        interface{}
		VrfResult     interface{}
		BlockBodySize uint32
		BlockBodyHash Blake2b256
		OpCert        struct {
			cbor.StructAsArray
			HotVkey        interface{}
			SequenceNumber uint32
			KesPeriod      uint32
			Signature      interface{}
		}
		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) BlockNumber

func (h *BabbageBlockHeader) BlockNumber() uint64

func (*BabbageBlockHeader) Era

func (h *BabbageBlockHeader) Era() Era

func (*BabbageBlockHeader) Hash

func (h *BabbageBlockHeader) Hash() string

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
	Body       BabbageTransactionBody
	WitnessSet BabbageTransactionWitnessSet
	IsValid    bool
	Metadata   cbor.Value
}

func NewBabbageTransactionFromCbor

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

type BabbageTransactionBody

type BabbageTransactionBody struct {
	AlonzoTransactionBody
	Outputs          []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) UnmarshalCBOR

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

type BabbageTransactionOutput

type BabbageTransactionOutput struct {
	Address     Blake2b256        `cbor:"0,keyasint,omitempty"`
	Amount      cbor.Value        `cbor:"1,keyasint,omitempty"`
	DatumOption []cbor.RawMessage `cbor:"2,keyasint,omitempty"`
	ScriptRef   cbor.Tag          `cbor:"3,keyasint,omitempty"`
	// contains filtered or unexported fields
}

func (*BabbageTransactionOutput) UnmarshalCBOR

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

type BabbageTransactionWitnessSet

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

type BadInputsUtxo

type BadInputsUtxo struct {
	UtxoFailureErrorBase
	Inputs []TxIn
}

func (*BadInputsUtxo) Error

func (e *BadInputsUtxo) Error() string

type Blake2b224

type Blake2b224 [28]byte

func (Blake2b224) String

func (b Blake2b224) String() string

type Blake2b256

type Blake2b256 [32]byte

func (Blake2b256) String

func (b Blake2b256) String() string

type Block

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

func NewBlockFromCbor

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

type BlockHeader

type BlockHeader interface {
	Hash() string
	BlockNumber() uint64
	SlotNumber() 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) BlockNumber

func (b *ByronEpochBoundaryBlock) BlockNumber() uint64

func (*ByronEpochBoundaryBlock) Era

func (b *ByronEpochBoundaryBlock) Era() Era

func (*ByronEpochBoundaryBlock) Hash

func (b *ByronEpochBoundaryBlock) Hash() string

func (*ByronEpochBoundaryBlock) SlotNumber

func (b *ByronEpochBoundaryBlock) SlotNumber() uint64

func (*ByronEpochBoundaryBlock) Transactions

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

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) BlockNumber

func (h *ByronEpochBoundaryBlockHeader) BlockNumber() uint64

func (*ByronEpochBoundaryBlockHeader) Era

func (*ByronEpochBoundaryBlockHeader) Hash

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) BlockNumber

func (b *ByronMainBlock) BlockNumber() uint64

func (*ByronMainBlock) Era

func (b *ByronMainBlock) Era() Era

func (*ByronMainBlock) Hash

func (b *ByronMainBlock) Hash() string

func (*ByronMainBlock) SlotNumber

func (b *ByronMainBlock) SlotNumber() uint64

func (*ByronMainBlock) Transactions

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

func (*ByronMainBlock) UnmarshalCBOR

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

type ByronMainBlockBody

type ByronMainBlockBody struct {
	cbor.StructAsArray
	TxPayload  []ByronTransactionBody
	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) BlockNumber

func (h *ByronMainBlockHeader) BlockNumber() uint64

func (*ByronMainBlockHeader) Era

func (h *ByronMainBlockHeader) Era() Era

func (*ByronMainBlockHeader) Hash

func (h *ByronMainBlockHeader) Hash() string

func (*ByronMainBlockHeader) SlotNumber

func (h *ByronMainBlockHeader) SlotNumber() uint64

func (*ByronMainBlockHeader) UnmarshalCBOR

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

type ByronTransaction

type ByronTransaction interface{}

TODO: flesh this out

func NewByronTransactionFromCbor

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

type ByronTransactionBody

type ByronTransactionBody interface{}

TODO: flesh this out

func NewByronTransactionBodyFromCbor

func NewByronTransactionBodyFromCbor(data []byte) (*ByronTransactionBody, error)

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 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 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) BlockNumber

func (b *MaryBlock) BlockNumber() uint64

func (*MaryBlock) Era

func (b *MaryBlock) Era() Era

func (*MaryBlock) Hash

func (b *MaryBlock) Hash() string

func (*MaryBlock) SlotNumber

func (b *MaryBlock) SlotNumber() uint64

func (*MaryBlock) Transactions

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

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
	Body       MaryTransactionBody
	WitnessSet ShelleyTransactionWitnessSet
	Metadata   cbor.Value
}

func NewMaryTransactionFromCbor

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

type MaryTransactionBody

type MaryTransactionBody struct {
	AllegraTransactionBody
	Outputs []MaryTransactionOutput `cbor:"1,keyasint,omitempty"`
	// TODO: further parsing of this field
	Mint cbor.Value `cbor:"9,keyasint,omitempty"`
}

func NewMaryTransactionBodyFromCbor

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

func (*MaryTransactionBody) UnmarshalCBOR

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

type MaryTransactionOutput

type MaryTransactionOutput struct {
	cbor.StructAsArray
	Address Blake2b256
	Amount  cbor.Value
}

type MaxTxSizeUtxo

type MaxTxSizeUtxo struct {
	UtxoFailureErrorBase
	ActualSize int
	MaxSize    int
}

func (*MaxTxSizeUtxo) Error

func (e *MaxTxSizeUtxo) Error() string

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) BlockNumber

func (b *ShelleyBlock) BlockNumber() uint64

func (*ShelleyBlock) Era

func (b *ShelleyBlock) Era() Era

func (*ShelleyBlock) Hash

func (b *ShelleyBlock) Hash() string

func (*ShelleyBlock) SlotNumber

func (b *ShelleyBlock) SlotNumber() uint64

func (*ShelleyBlock) Transactions

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

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           interface{}
		VrfKey               interface{}
		NonceVrf             interface{}
		LeaderVrf            interface{}
		BlockBodySize        uint32
		BlockBodyHash        Blake2b256
		OpCertHotVkey        interface{}
		OpCertSequenceNumber uint32
		OpCertKesPeriod      uint32
		OpCertSignature      interface{}
		ProtoMajorVersion    uint64
		ProtoMinorVersion    uint64
	}
	Signature interface{}
	// contains filtered or unexported fields
}

func NewShelleyBlockHeaderFromCbor

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

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) SlotNumber

func (h *ShelleyBlockHeader) SlotNumber() uint64

func (*ShelleyBlockHeader) UnmarshalCBOR

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

type ShelleyTransaction

type ShelleyTransaction struct {
	cbor.StructAsArray
	Body       ShelleyTransactionBody
	WitnessSet ShelleyTransactionWitnessSet
	Metadata   cbor.Value
}

func NewShelleyTransactionFromCbor

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

type ShelleyTransactionBody

type ShelleyTransactionBody struct {
	cbor.DecodeStoreCbor

	Inputs  []ShelleyTransactionInput  `cbor:"0,keyasint,omitempty"`
	Outputs []ShelleyTransactionOutput `cbor:"1,keyasint,omitempty"`
	Fee     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) Hash

func (b *ShelleyTransactionBody) Hash() string

func (*ShelleyTransactionBody) UnmarshalCBOR

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

type ShelleyTransactionInput

type ShelleyTransactionInput struct {
	cbor.StructAsArray
	Id    Blake2b256
	Index uint32
}

type ShelleyTransactionOutput

type ShelleyTransactionOutput struct {
	cbor.StructAsArray
	Address Blake2b256
	Amount  uint64
}

type ShelleyTransactionWitnessSet

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

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 TransactionBody

type TransactionBody interface {
	Hash() string
	Cbor() []byte
}

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 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