diff --git a/client/general.go b/client/general.go index b63d9bc..f0d493e 100644 --- a/client/general.go +++ b/client/general.go @@ -29,8 +29,8 @@ func (c *Client) ChainTip() (*models.ChainTip, error) { return &chainTip, nil } -func (c *Client) EraHistory() (*models.EraHistory, error) { - url := "/era-history" +func (c *Client) EraSummaries() (*models.EraSummaries, error) { + url := "/era-summaries" resp, err := c.get(url) if err != nil { return nil, err @@ -42,16 +42,16 @@ func (c *Client) EraHistory() (*models.EraHistory, error) { return nil, fmt.Errorf("unexpected error: %d", resp.Body) } defer resp.Body.Close() - var eraHistory models.EraHistory - err = json.NewDecoder(resp.Body).Decode(&eraHistory) + var eraSummaries models.EraSummaries + err = json.NewDecoder(resp.Body).Decode(&eraSummaries) if err != nil { return nil, err } - return &eraHistory, nil + return &eraSummaries, nil } func (c *Client) ProtocolParameters() (*models.ProtocolParameters, error) { - url := "/protocol-params" + url := "/protocol-parameters" resp, err := c.get(url) if err != nil { return nil, err diff --git a/models/general.go b/models/general.go index e9f3176..92cc9a2 100644 --- a/models/general.go +++ b/models/general.go @@ -2,10 +2,8 @@ package models import "github.com/maestro-org/go-sdk/utils" -type ChainTipData struct { - BlockHash string `json:"block_hash"` - Height int64 `json:"height"` - Slot int64 `json:"slot"` +type BytesSize struct { + Bytes int64 `json:"bytes"` } type ChainTip struct { @@ -13,16 +11,10 @@ type ChainTip struct { LastUpdated utils.LastUpdated `json:"last_updated"` } -type EraTimeStamp struct { - Epoch int64 `json:"epoch"` - Slot int64 `json:"slot"` - Time int64 `json:"time"` -} - -type EraParams struct { - EpochLength int64 `json:"epoch_length"` - SafeZone int64 `json:"safe_zone"` - SlotLength int64 `json:"slot_length"` +type ChainTipData struct { + BlockHash string `json:"block_hash"` + Height int64 `json:"height"` + Slot int64 `json:"slot"` } type Era struct { @@ -31,14 +23,29 @@ type Era struct { Start EraTimeStamp `json:"start"` } -type EraHistory struct { +type EraParams struct { + EpochLength int64 `json:"epoch_length"` + SafeZone int64 `json:"safe_zone"` + SlotLength EraSlotLength `json:"slot_length"` +} + +type EraSummaries struct { Data []Era `json:"data"` LastUpdated utils.LastUpdated `json:"last_updated"` } -type ProtocolParameters struct { - Data ProtocolParams `json:"data"` - LastUpdated utils.LastUpdated `json:"last_updated"` +type EraSlotLength struct { + Milliseconds int64 `json:"milliseconds"` +} + +type EraTime struct { + Seconds int64 `json:"seconds"` +} + +type EraTimeStamp struct { + Epoch int64 `json:"epoch"` + Slot int64 `json:"slot"` + Time EraTime `json:"time"` } type ExUnits struct { @@ -46,9 +53,13 @@ type ExUnits struct { Steps int64 `json:"steps"` } -type StringExUnits struct { - Memory string `json:"memory"` - Steps string `json:"steps"` +type LovelaceAmount struct { + Lovelace int64 `json:"lovelace"` +} + +type ProtocolParameters struct { + Data ProtocolParams `json:"data"` + LastUpdated utils.LastUpdated `json:"last_updated"` } type ProtocolVersion struct { @@ -56,27 +67,37 @@ type ProtocolVersion struct { Minor int64 `json:"minor"` } +type StringExUnits struct { + Memory string `json:"memory"` + Steps string `json:"steps"` +} + +type AdaAmount struct { + LovelaceAmount LovelaceAmount `json:"ada"` +} + type ProtocolParams struct { - CoinsPerUtxoByte int64 `json:"coins_per_utxo_byte"` CollateralPercentage int64 `json:"collateral_percentage"` - CostModels any `json:"cost_models"` - DesiredNumberOfPools int64 `json:"desired_number_of_pools"` - MaxBlockBodySize int64 `json:"max_block_body_size"` - MaxBlockHeaderSize int64 `json:"max_block_header_size"` + DesiredNumberOfStakePools int64 `json:"desired_number_of_stake_pools"` + MaxBlockBodySize BytesSize `json:"max_block_body_size"` + MaxBlockHeaderSize BytesSize `json:"max_block_header_size"` MaxCollateralInputs int64 `json:"max_collateral_inputs"` MaxExecutionUnitsPerBlock ExUnits `json:"max_execution_units_per_block"` MaxExecutionUnitsPerTransaction ExUnits `json:"max_execution_units_per_transaction"` - MaxTxSize int64 `json:"max_tx_size"` - MaxValueSize int64 `json:"max_value_size"` + MaxTransactionSize BytesSize `json:"max_transaction_size"` + MaxValueSize BytesSize `json:"max_value_size"` MinFeeCoefficient int64 `json:"min_fee_coefficient"` - MinFeeConstant int64 `json:"min_fee_constant"` - MinPoolCost int64 `json:"min_pool_cost"` + MinFeeConstant AdaAmount `json:"min_fee_constant"` + MinStakePoolCost AdaAmount `json:"min_stake_pool_cost"` + MinUtxoDepositCoefficient int64 `json:"min_utxo_deposit_coefficient"` + MinUtxoDepositConstant AdaAmount `json:"min_utxo_deposit_constant"` MonetaryExpansion string `json:"monetary_expansion"` - PoolDeposit int64 `json:"pool_deposit"` - PoolInfluence string `json:"pool_influence"` - PoolRetirementEpochBound int64 `json:"pool_retirement_epoch_bound"` - Prices StringExUnits `json:"prices"` - ProtocolVersion ProtocolVersion `json:"protocol_version"` - StakeKeyDeposit int64 `json:"stake_key_deposit"` + PlutusCostModels any `json:"plutus_cost_models"` + ProtocolVersion ProtocolVersion `json:"version"` + ScriptExecutionPrices StringExUnits `json:"script_execution_prices"` + StakeCredentialDeposit AdaAmount `json:"stake_credential_deposit"` + StakePoolDeposit AdaAmount `json:"stake_pool_deposit"` + StakePoolPledgeInfluence string `json:"stake_pool_pledge_influence"` + StakePoolRetirementEpochBound int64 `json:"stake_pool_retirement_epoch_bound"` TreasuryExpansion string `json:"treasury_expansion"` } diff --git a/models/pools.go b/models/pools.go index 08adcad..02e24e6 100644 --- a/models/pools.go +++ b/models/pools.go @@ -29,7 +29,6 @@ type PoolMintedBlocks struct { } type StakePoolDelegator struct { - ActiveEpochNo int64 `json:"active_epoch_no"` Amount string `json:"amount"` LatestDelegationTxHash string `json:"latest_delegation_tx_hash"` StakeAddress string `json:"stake_address"` @@ -69,7 +68,6 @@ type Relay struct { } type StakePoolDetails struct { - ActiveEpochNo int64 `json:"active_epoch_no"` ActiveStake int64 `json:"active_stake"` BlockCount int64 `json:"block_count"` FixedCost int64 `json:"fixed_cost"` diff --git a/models/scripts.go b/models/scripts.go index 9f638ac..8081c54 100644 --- a/models/scripts.go +++ b/models/scripts.go @@ -7,6 +7,7 @@ type ScriptVersion string const ( PlutusV1 ScriptVersion = "plutusv1" PlutusV2 ScriptVersion = "plutusv2" + PlutusV3 ScriptVersion = "plutusv3" ) type Script struct { diff --git a/models/transactions.go b/models/transactions.go index 0cc7d58..d04fc8d 100644 --- a/models/transactions.go +++ b/models/transactions.go @@ -3,12 +3,24 @@ package models import "github.com/maestro-org/go-sdk/utils" type Certificates struct { - MirTransfers []any `json:"mir_transfers"` - PoolRegistrations []any `json:"pool_registrations"` - PoolRetirements []any `json:"pool_retirements"` - StakeDelegations []any `json:"stake_delegations"` - StakeDeregistrations []any `json:"stake_deregistrations"` - StakeRegistrationsReserves []any `json:"stake_registrations_reserves"` + AuthCommitteeHotCerts []any `json:"auth_committee_hot_certs"` + MirTransfers []any `json:"mir_transfers"` + PoolRegistrations []any `json:"pool_registrations"` + PoolRetirements []any `json:"pool_retirements"` + RegCerts []any `json:"reg_certs"` + RegDRepCerts []any `json:"reg_drep_certs"` + ResignCommitteeColdCerts []any `json:"resign_committee_cold_certs"` + StakeDelegations []any `json:"stake_delegations"` + StakeDeregistrations []any `json:"stake_deregistrations"` + StakeRegDelegations []any `json:"stake_reg_delegations"` + StakeRegistrations []any `json:"stake_registrations"` + StakeVoteDelegations []any `json:"stake_vote_delegations"` + StakeVoteRegDelegations []any `json:"stake_vote_reg_delegations"` + UnRegCerts []any `json:"unreg_certs"` + UnRegDRepCerts []any `json:"unreg_drep_certs"` + UpdateDRepCerts []any `json:"update_drep_certs"` + VoteDelegations []any `json:"vote_delegations"` + VoteRegDelegations []any `json:"vote_reg_delegations"` } type Redeemers struct { @@ -16,28 +28,36 @@ type Redeemers struct { Mints []any `json:"mints"` Spends []any `json:"spends"` Withdrawals []any `json:"withdrawals"` + Votes []any `json:"votes"` + Proposals []any `json:"proposals"` +} + +type MintAsset struct { + Unit string `json:"unit"` + Amount any `json:"amount"` } type TransactionDetail struct { AdditionalSigners []string `json:"additional_signers"` BlockAbsoluteSlot int64 `json:"block_absolute_slot"` + BlockEpoch int64 `json:"block_epoch"` BlockHash string `json:"block_hash"` BlockHeight int64 `json:"block_height"` BlockTimestamp int64 `json:"block_timestamp"` - BlockTxIndex int64 `json:"block_tx_index"` + BlockTxIndex int32 `json:"block_tx_index"` Certificates Certificates `json:"certificates"` CollateralInputs []Utxo `json:"collateral_inputs"` - CollateralReturn any `json:"collateral_return"` + CollateralReturn *Utxo `json:"collateral_return,omitempty"` Deposit int64 `json:"deposit"` Fee int64 `json:"fee"` Inputs []Utxo `json:"inputs"` - InvalidBefore int64 `json:"invalid_before"` - InvalidHereafter int64 `json:"invalid_hereafter"` - Metadata any `json:"metadata"` - Mint []any `json:"mint"` + InvalidBefore *int64 `json:"invalid_before,omitempty"` + InvalidHereafter *int64 `json:"invalid_hereafter,omitempty"` + Metadata interface{} `json:"metadata,omitempty"` + Mint []MintAsset `json:"mint"` Outputs []Utxo `json:"outputs"` Redeemers Redeemers `json:"redeemers"` - ReferenceInputs []any `json:"reference_inputs"` + ReferenceInputs []Utxo `json:"reference_inputs"` ScriptsExecuted []Script `json:"scripts_executed"` ScriptsSuccessful bool `json:"scripts_successful"` Size int64 `json:"size"`