diff --git a/ledger/block.go b/ledger/block.go index be21a8a8..800edb39 100644 --- a/ledger/block.go +++ b/ledger/block.go @@ -1,4 +1,4 @@ -// Copyright 2023 Blink Labs Software +// Copyright 2024 Blink Labs Software // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,26 +17,12 @@ package ledger import ( "fmt" - utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano" + "github.com/blinklabs-io/gouroboros/ledger/common" ) -type Block interface { - BlockHeader - Type() int - Transactions() []Transaction - Utxorpc() *utxorpc.Block -} - -type BlockHeader interface { - Hash() string - PrevHash() string - BlockNumber() uint64 - SlotNumber() uint64 - IssuerVkey() IssuerVkey - BlockBodySize() uint64 - Era() Era - Cbor() []byte -} +// Compatibility aliases +type Block = common.Block +type BlockHeader = common.BlockHeader func NewBlockFromCbor(blockType uint, data []byte) (Block, error) { switch blockType { diff --git a/ledger/common/block.go b/ledger/common/block.go new file mode 100644 index 00000000..04105d30 --- /dev/null +++ b/ledger/common/block.go @@ -0,0 +1,21 @@ +package common + +import utxorpc "github.com/utxorpc/go-codegen/utxorpc/v1alpha/cardano" + +type Block interface { + BlockHeader + Type() int + Transactions() []Transaction + Utxorpc() *utxorpc.Block +} + +type BlockHeader interface { + Hash() string + PrevHash() string + BlockNumber() uint64 + SlotNumber() uint64 + IssuerVkey() IssuerVkey + BlockBodySize() uint64 + Era() Era + Cbor() []byte +}