Skip to content

Commit

Permalink
fix: missing epoch parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Dec 7, 2023
1 parent 8dcd9ed commit f96cdef
Show file tree
Hide file tree
Showing 3 changed files with 410 additions and 21 deletions.
37 changes: 34 additions & 3 deletions api_epochs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type EpochStakeByPool struct {
// Epoch contains information on an epoch.
type Epoch struct {
// Sum of all the active stakes within the epoch in Lovelaces
ActiveStake string `json:"active_stake"`
ActiveStake *string `json:"active_stake"`

// Number of blocks within the epoch
BlockCount int `json:"block_count"`
Expand Down Expand Up @@ -92,7 +92,7 @@ type EpochParameters struct {
MaxTxSize int `json:"max_tx_size"`

// The maximum Val size
MaxValSize string `json:"max_val_size"`
MaxValSize *string `json:"max_val_size "`

// The linear factor for the minimum fee calculation for given epoch
MinFeeA int `json:"min_fee_a"`
Expand Down Expand Up @@ -127,8 +127,39 @@ type EpochParameters struct {
// Treasury expansion
Tau float32 `json:"tau"`

// The cost per UTXO word
// Cost per UTxO word for Alonzo. Cost per UTxO byte for Babbage and later.
// Deprecated: Use CoinsPerUTxOSize instead
CoinsPerUtxOWord string `json:"coins_per_utxo_word"`

// Cost models parameters for Plutus Core scripts
CostModels *interface{} `json:"cost_models"`

// The per word cost of script memory usage
PriceMem *float32 `json:"price_mem"`

// The cost of script execution step usage
PriceStep *float32 `json:"price_step"`

// The maximum number of execution memory allowed to be used in a single transaction
MaxTxExMem *string `json:"max_tx_ex_mem"`

// The maximum number of execution steps allowed to be used in a single transaction
MaxTxExSteps *string `json:"max_tx_ex_steps"`

// The maximum number of execution memory allowed to be used in a single block
MaxBlockExMem *string `json:"max_block_ex_mem"`

// The maximum number of execution steps allowed to be used in a single block
MaxBlockExSteps *string `json:"max_block_ex_steps"`

// The percentage of the transactions fee which must be provided as collateral when including non-native scripts
CollateralPercent *int `json:"collateral_percent"`

// The maximum number of collateral inputs allowed in a transaction
MaxCollateralInputs *int `json:"max_collateral_inputs"`

// Cost per UTxO word for Alonzo. Cost per UTxO byte for Babbage and later.
CoinsPerUTxOSize *string `json:"coins_per_utxo_size"`
}

type EpochResult struct {
Expand Down
2 changes: 1 addition & 1 deletion api_epochs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestEpochBlockDistributionByPoolIntegration(t *testing.T) {
func TestEpochParametersIntegration(t *testing.T) {
api := blockfrost.NewAPIClient(blockfrost.APIClientOptions{})

got, err := api.EpochParameters(context.TODO(), 225)
got, err := api.EpochParameters(context.TODO(), 453)
if err != nil {
t.Fatal(err)
}
Expand Down
Loading

0 comments on commit f96cdef

Please sign in to comment.