-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: split ledger era compat types to separate files (#696)
- Loading branch information
Showing
8 changed files
with
324 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// 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. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ledger | ||
|
||
import "github.com/blinklabs-io/gouroboros/ledger/allegra" | ||
|
||
// The below are compatability types, constants, and functions for the Allegra era | ||
// to keep existing code working after a refactor of the ledger package | ||
|
||
// Allegra types | ||
type AllegraBlock = allegra.AllegraBlock | ||
type AllegraTransaction = allegra.AllegraTransaction | ||
type AllegraTransactionBody = allegra.AllegraTransactionBody | ||
type AllegraProtocolParameters = allegra.AllegraProtocolParameters | ||
type AllegraProtocolParameterUpdate = allegra.AllegraProtocolParameterUpdate | ||
|
||
// Allegra constants | ||
const ( | ||
EraIdAllegra = allegra.EraIdAllegra | ||
BlockTypeAllegra = allegra.BlockTypeAllegra | ||
BlockHeaderTypeAllegra = allegra.BlockHeaderTypeAllegra | ||
TxTypeAllegra = allegra.TxTypeAllegra | ||
) | ||
|
||
// Allegra functions | ||
var ( | ||
NewAllegraBlockFromCbor = allegra.NewAllegraBlockFromCbor | ||
NewAllegraTransactionFromCbor = allegra.NewAllegraTransactionFromCbor | ||
NewAllegraTransactionBodyFromCbor = allegra.NewAllegraTransactionBodyFromCbor | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// 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. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ledger | ||
|
||
import "github.com/blinklabs-io/gouroboros/ledger/alonzo" | ||
|
||
// The below are compatability types, constants, and functions for the Alonzo era | ||
// to keep existing code working after a refactor of the ledger package | ||
|
||
// Alonzo types | ||
type AlonzoBlock = alonzo.AlonzoBlock | ||
type AlonzoBlockHeader = alonzo.AlonzoBlockHeader | ||
type AlonzoTransaction = alonzo.AlonzoTransaction | ||
type AlonzoTransactionBody = alonzo.AlonzoTransactionBody | ||
type AlonzoTransactionOutput = alonzo.AlonzoTransactionOutput | ||
type AlonzoTransactionWitnessSet = alonzo.AlonzoTransactionWitnessSet | ||
type AlonzoProtocolParameters = alonzo.AlonzoProtocolParameters | ||
type AlonzoProtocolParameterUpdate = alonzo.AlonzoProtocolParameterUpdate | ||
|
||
// Alonzo constants | ||
const ( | ||
EraIdAlonzo = alonzo.EraIdAlonzo | ||
BlockTypeAlonzo = alonzo.BlockTypeAlonzo | ||
BlockHeaderTypeAlonzo = alonzo.BlockHeaderTypeAlonzo | ||
TxTypeAlonzo = alonzo.TxTypeAlonzo | ||
) | ||
|
||
// Alonzo functions | ||
var ( | ||
NewAlonzoBlockFromCbor = alonzo.NewAlonzoBlockFromCbor | ||
NewAlonzoTransactionFromCbor = alonzo.NewAlonzoTransactionFromCbor | ||
NewAlonzoTransactionBodyFromCbor = alonzo.NewAlonzoTransactionBodyFromCbor | ||
NewAlonzoTransactionOutputFromCbor = alonzo.NewAlonzoTransactionOutputFromCbor | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 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. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ledger | ||
|
||
import "github.com/blinklabs-io/gouroboros/ledger/babbage" | ||
|
||
// The below are compatability types, constants, and functions for the Babbage era | ||
// to keep existing code working after a refactor of the ledger package | ||
|
||
// Babbage types | ||
type BabbageBlock = babbage.BabbageBlock | ||
type BabbageBlockHeader = babbage.BabbageBlockHeader | ||
type BabbageTransaction = babbage.BabbageTransaction | ||
type BabbageTransactionBody = babbage.BabbageTransactionBody | ||
type BabbageTransactionOutput = babbage.BabbageTransactionOutput | ||
type BabbageTransactionWitnessSet = babbage.BabbageTransactionWitnessSet | ||
type BabbageProtocolParameters = babbage.BabbageProtocolParameters | ||
type BabbageProtocolParameterUpdate = babbage.BabbageProtocolParameterUpdate | ||
|
||
// Babbage constants | ||
const ( | ||
EraIdBabbage = babbage.EraIdBabbage | ||
BlockTypeBabbage = babbage.BlockTypeBabbage | ||
BlockHeaderTypeBabbage = babbage.BlockHeaderTypeBabbage | ||
TxTypeBabbage = babbage.TxTypeBabbage | ||
) | ||
|
||
// Babbage functions | ||
var ( | ||
NewBabbageBlockFromCbor = babbage.NewBabbageBlockFromCbor | ||
NewBabbageBlockHeaderFromCbor = babbage.NewBabbageBlockHeaderFromCbor | ||
NewBabbageTransactionFromCbor = babbage.NewBabbageTransactionFromCbor | ||
NewBabbageTransactionBodyFromCbor = babbage.NewBabbageTransactionBodyFromCbor | ||
NewBabbageTransactionOutputFromCbor = babbage.NewBabbageTransactionOutputFromCbor | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// 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. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ledger | ||
|
||
import "github.com/blinklabs-io/gouroboros/ledger/byron" | ||
|
||
// The below are compatability types, constants, and functions for the Byron era | ||
// to keep existing code working after a refactor of the ledger package | ||
|
||
// Byron types | ||
type ByronEpochBoundaryBlock = byron.ByronEpochBoundaryBlock | ||
type ByronMainBlock = byron.ByronMainBlock | ||
type ByronEpochBounaryBlockHeader = byron.ByronEpochBoundaryBlockHeader | ||
type ByronMainBlockHeader = byron.ByronMainBlockHeader | ||
type ByronTransaction = byron.ByronTransaction | ||
type ByronTransactionInput = byron.ByronTransactionInput | ||
type ByronTransactionOutput = byron.ByronTransactionOutput | ||
|
||
// Byron constants | ||
const ( | ||
EraIdByron = byron.EraIdByron | ||
BlockTypeByronEbb = byron.BlockTypeByronEbb | ||
BlockTypeByronMain = byron.BlockTypeByronMain | ||
BlockHeaderTypeByron = byron.BlockHeaderTypeByron | ||
TxTypeByron = byron.TxTypeByron | ||
) | ||
|
||
// Byron functions | ||
var ( | ||
NewByronEpochBoundaryBlockFromCbor = byron.NewByronEpochBoundaryBlockFromCbor | ||
NewByronMainBlockFromCbor = byron.NewByronMainBlockFromCbor | ||
NewByronEpochBoundaryBlockHeaderFromCbor = byron.NewByronEpochBoundaryBlockHeaderFromCbor | ||
NewByronMainBlockHeaderFromCbor = byron.NewByronMainBlockHeaderFromCbor | ||
NewByronTransactionInput = byron.NewByronTransactionInput | ||
NewByronTransactionFromCbor = byron.NewByronTransactionFromCbor | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.