blockfrost

package
v0.86.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPaginationCount = 100
	MaxPaginationCount     = 100
	DefaultPaginationPage  = 1
	PaginationOrderAsc     = "asc"
	PaginationOrderDesc    = "desc"
)
View Source
const MaxPaginationPage = 21474836

MaxPaginationPage mirrors the hosted Blockfrost fastify schema bound for the page parameter.

Variables

View Source
var (
	ErrInvalidAddress  = errors.New("invalid address")
	ErrAddressNotFound = errors.New("address not found")
	ErrInvalidBlockID  = errors.New("invalid block id")
	ErrBlockNotFound   = errors.New("block not found")
	ErrEpochNotFound   = errors.New("epoch not found")
	// ErrHistoryNotRetained reports a historical query whose source rows
	// this node no longer holds, as opposed to a query whose answer is
	// genuinely empty.
	ErrHistoryNotRetained = errors.New("history not retained")
	ErrAssetNotFound      = errors.New("asset not found")
	ErrDRepNotFound       = errors.New("drep not found")
	ErrInvalidTransaction = errors.New("invalid transaction")
	// ErrTransactionRejected reports a well-formed transaction the mempool
	// declined, e.g. failing script validation or an unresolvable input. It
	// is distinct from ErrInvalidTransaction so submission does not report a
	// decodable transaction as malformed CBOR.
	ErrTransactionRejected = errors.New("transaction rejected")
	// ErrTransactionEvaluation reports a transaction that decoded cleanly but
	// could not be evaluated, e.g. an input the ledger cannot resolve or a
	// script that fails. It is deliberately distinct from
	// ErrInvalidTransaction so the evaluation endpoints do not report a
	// well-formed transaction as malformed CBOR.
	ErrTransactionEvaluation = errors.New("transaction evaluation failed")
	// ErrLedgerUnavailable reports a submission or evaluation that failed
	// because the node's own storage could not answer, not because the
	// transaction was at fault. It is the ledger-side counterpart of
	// ErrMempoolUnavailable: both name a node condition the caller can
	// retry rather than a transaction it must fix.
	ErrLedgerUnavailable = errors.New("ledger state unavailable")
	// ErrEvaluationOverloaded reports an evaluation refused because the node
	// is already evaluating as many transactions as it admits.
	ErrEvaluationOverloaded = errors.New("transaction evaluation overloaded")
	ErrInvalidPoolID        = errors.New("invalid pool id")
	ErrMempoolUnavailable   = errors.New("mempool unavailable")
	ErrMempoolFull          = errors.New("mempool full")
	ErrTransactionNotFound  = errors.New("transaction not found")
	ErrInvalidStakeAddress  = errors.New("invalid stake address")
	// ErrProtocolParamsUnavailable reports that no protocol parameters exist
	// for the requested point. Byron carries no protocol-parameter CBOR, so a
	// genuine Byron prefix reaches this during a from-genesis sync; it is an
	// expected state rather than a node fault, and callers must not
	// substitute Shelley-shaped defaults for it.
	ErrProtocolParamsUnavailable = errors.New(
		"protocol parameters not available",
	)
)
View Source
var (
	ErrScriptNotFound = errors.New("script not found")
	ErrDatumNotFound  = errors.New("datum not found")
)
View Source
var ErrInvalidBlockRange = errors.New("invalid block range position")

ErrInvalidBlockRange is returned when a from/to query value is not a valid block number or "block:index" position.

View Source
var ErrInvalidPaginationParameters = errors.New(
	"invalid pagination parameters",
)

Functions

func RegisterProvider added in v0.68.0

func RegisterProvider(host *plugin.Host) error

func SetPaginationHeaders

func SetPaginationHeaders(
	w http.ResponseWriter,
	totalItems int,
	params PaginationParams,
)

SetPaginationHeaders sets Blockfrost pagination headers.

Types

type AccountAddressTotalInfo added in v0.85.0

type AccountAddressTotalInfo struct {
	StakeAddress string
	ReceivedSum  []AddressAmountInfo
	SentSum      []AddressAmountInfo
	TxCount      int
}

AccountAddressTotalInfo is the lifetime received and sent totals across the addresses of an account. Each sum lists lovelace first.

type AccountAddressTotalResponse added in v0.85.0

type AccountAddressTotalResponse struct {
	StakeAddress string                  `json:"stake_address"`
	ReceivedSum  []AddressAmountResponse `json:"received_sum"`
	SentSum      []AddressAmountResponse `json:"sent_sum"`
	TxCount      int                     `json:"tx_count"`
}

AccountAddressTotalResponse is the lifetime received and sent totals across the addresses of an account.

type AccountAssociatedAddressInfo

type AccountAssociatedAddressInfo struct {
	Address string
}

AccountAssociatedAddressInfo holds a payment address associated with a stake key.

type AccountAssociatedAddressResponse

type AccountAssociatedAddressResponse struct {
	Address string `json:"address"`
}

AccountAssociatedAddressResponse represents a stake account associated payment address.

type AccountDelegationHistoryInfo

type AccountDelegationHistoryInfo struct {
	ActiveEpoch int32
	TxHash      string
	Amount      string
	PoolID      string
	TxSlot      int64
	BlockTime   int64
	BlockHeight int64
}

AccountDelegationHistoryInfo holds a stake-account delegation history row.

type AccountDelegationHistoryResponse

type AccountDelegationHistoryResponse struct {
	ActiveEpoch int32  `json:"active_epoch"`
	TxHash      string `json:"tx_hash"`
	Amount      string `json:"amount"`
	PoolID      string `json:"pool_id"`
	TxSlot      int64  `json:"tx_slot"`
	BlockTime   int64  `json:"block_time"`
	BlockHeight int64  `json:"block_height"`
}

AccountDelegationHistoryResponse represents a stake-account delegation history row.

type AccountInfo

type AccountInfo struct {
	StakeAddress       string
	Active             bool
	ActiveEpoch        *int64
	ControlledAmount   string
	RewardsSum         string
	WithdrawalsSum     string
	ReservesSum        string
	TreasurySum        string
	WithdrawableAmount string
	PoolID             *string
	DrepID             *string
	Registered         bool
}

AccountInfo holds stake-account data needed by the API.

type AccountMIRInfo added in v0.85.0

type AccountMIRInfo struct {
	TxHash string
	Amount string
}

AccountMIRInfo is one Move Instantaneous Rewards payment to an account.

type AccountMIRResponse added in v0.85.0

type AccountMIRResponse struct {
	TxHash string `json:"tx_hash"`
	Amount string `json:"amount"`
}

AccountMIRResponse is one Move Instantaneous Rewards payment to an account.

type AccountRegistrationHistoryInfo

type AccountRegistrationHistoryInfo struct {
	TxHash      string
	Action      string
	Deposit     string
	TxSlot      int64
	BlockTime   int64
	BlockHeight int64
}

AccountRegistrationHistoryInfo holds a stake-account registration history row.

type AccountRegistrationHistoryResponse

type AccountRegistrationHistoryResponse struct {
	TxHash      string `json:"tx_hash"`
	Action      string `json:"action"`
	Deposit     string `json:"deposit"`
	TxSlot      int64  `json:"tx_slot"`
	BlockTime   int64  `json:"block_time"`
	BlockHeight int64  `json:"block_height"`
}

AccountRegistrationHistoryResponse represents a stake-account registration history row.

type AccountResponse

type AccountResponse struct {
	StakeAddress       string  `json:"stake_address"`
	Active             bool    `json:"active"`
	ActiveEpoch        *int64  `json:"active_epoch"`
	ControlledAmount   string  `json:"controlled_amount"`
	RewardsSum         string  `json:"rewards_sum"`
	WithdrawalsSum     string  `json:"withdrawals_sum"`
	ReservesSum        string  `json:"reserves_sum"`
	TreasurySum        string  `json:"treasury_sum"`
	WithdrawableAmount string  `json:"withdrawable_amount"`
	PoolID             *string `json:"pool_id"`
	DrepID             *string `json:"drep_id"`
	Registered         bool    `json:"registered"`
}

AccountResponse represents a Blockfrost stake account.

type AccountRewardHistoryInfo

type AccountRewardHistoryInfo struct {
	Epoch  int32
	Amount string
	PoolID string
	// Type is the Blockfrost reward-type enum spelling (leader, member,
	// pool_deposit_refund) mapped from models.RewardAccountOutput.RewardType.
	Type string
}

AccountRewardHistoryInfo holds a stake-account reward history row.

type AccountRewardHistoryResponse

type AccountRewardHistoryResponse struct {
	Epoch  int32  `json:"epoch"`
	Amount string `json:"amount"`
	PoolID string `json:"pool_id"`
	// Type is one of leader, member, or pool_deposit_refund, per the
	// Blockfrost account_reward_content schema.
	Type string `json:"type"`
}

AccountRewardHistoryResponse represents a stake-account reward history row.

type AccountStakeHistoryInfo added in v0.85.0

type AccountStakeHistoryInfo struct {
	ActiveEpoch uint64
	Amount      string
	PoolID      string
}

AccountStakeHistoryInfo is the stake an account held in one epoch.

type AccountStakeHistoryResponse added in v0.85.0

type AccountStakeHistoryResponse struct {
	ActiveEpoch uint64 `json:"active_epoch"`
	Amount      string `json:"amount"`
	PoolID      string `json:"pool_id"`
}

AccountStakeHistoryResponse is the stake an account held in one epoch.

type AccountTransactionInfo added in v0.69.0

type AccountTransactionInfo struct {
	Address     string
	TxHash      string
	TxIndex     uint32
	BlockHeight uint64
	BlockTime   int64
}

AccountTransactionInfo holds a stake-account transaction row: one entry per distinct address (sharing the stake credential) involved in the transaction.

type AccountTransactionResponse added in v0.69.0

type AccountTransactionResponse struct {
	Address     string `json:"address"`
	TxHash      string `json:"tx_hash"`
	TxIndex     int    `json:"tx_index"`
	BlockHeight uint64 `json:"block_height"`
	BlockTime   int    `json:"block_time"`
}

AccountTransactionResponse represents a stake-account transaction object.

type AccountUTXOInfo added in v0.69.0

type AccountUTXOInfo struct {
	Address string
	TxHash  string
	// TxIndex is the deprecated Blockfrost alias for OutputIndex (the UTxO's
	// index within its producing transaction); it carries the same value.
	TxIndex             uint32
	OutputIndex         uint32
	Amount              []AddressAmountInfo
	Block               string
	DataHash            *string
	InlineDatum         *string
	ReferenceScriptHash *string
}

AccountUTXOInfo holds a stake-account UTxO row.

type AccountUTXOResponse added in v0.69.0

type AccountUTXOResponse struct {
	Address string `json:"address"`
	TxHash  string `json:"tx_hash"`
	// TxIndex is a deprecated Blockfrost alias for OutputIndex ("UTXO index
	// in the transaction"), kept for schema compatibility.
	TxIndex             int                     `json:"tx_index"`
	OutputIndex         int                     `json:"output_index"`
	Amount              []AddressAmountResponse `json:"amount"`
	Block               string                  `json:"block"`
	DataHash            *string                 `json:"data_hash"`
	InlineDatum         *string                 `json:"inline_datum"`
	ReferenceScriptHash *string                 `json:"reference_script_hash"`
}

AccountUTXOResponse represents a Blockfrost stake-account UTxO object.

type AccountWithdrawalInfo added in v0.69.0

type AccountWithdrawalInfo struct {
	TxHash      string
	Amount      string
	TxSlot      int64
	BlockTime   int64
	BlockHeight int64
}

AccountWithdrawalInfo holds a stake-account withdrawal history row.

type AccountWithdrawalResponse added in v0.69.0

type AccountWithdrawalResponse struct {
	TxHash      string `json:"tx_hash"`
	Amount      string `json:"amount"`
	TxSlot      int64  `json:"tx_slot"`
	BlockTime   int64  `json:"block_time"`
	BlockHeight int64  `json:"block_height"`
}

AccountWithdrawalResponse represents a stake-account withdrawal history row.

type AddressAmountInfo

type AddressAmountInfo struct {
	Unit     string
	Quantity string
}

AddressAmountInfo holds amount data needed by address UTxO responses.

type AddressAmountResponse

type AddressAmountResponse struct {
	Unit     string `json:"unit"`
	Quantity string `json:"quantity"`
}

AddressAmountResponse represents a Blockfrost address amount object.

type AddressExtendedAmountInfo added in v0.85.0

type AddressExtendedAmountInfo struct {
	Unit     string
	Quantity string
	// Decimals comes from the token registry; nil when unregistered.
	Decimals              *int
	HasNFTOnchainMetadata bool
}

AddressExtendedAmountInfo is one balance entry of an extended address.

type AddressExtendedAmountResponse added in v0.85.0

type AddressExtendedAmountResponse struct {
	Unit                  string `json:"unit"`
	Quantity              string `json:"quantity"`
	Decimals              *int   `json:"decimals"`
	HasNFTOnchainMetadata bool   `json:"has_nft_onchain_metadata"`
}

AddressExtendedAmountResponse is one balance entry of an extended address.

type AddressExtendedInfo added in v0.85.0

type AddressExtendedInfo struct {
	Address      string
	Amount       []AddressExtendedAmountInfo
	StakeAddress *string
	Type         string
	Script       bool
}

AddressExtendedInfo holds the extended address summary.

type AddressExtendedResponse added in v0.85.0

type AddressExtendedResponse struct {
	Address      string                          `json:"address"`
	Amount       []AddressExtendedAmountResponse `json:"amount"`
	StakeAddress *string                         `json:"stake_address"`
	Type         string                          `json:"type"`
	Script       bool                            `json:"script"`
}

AddressExtendedResponse represents a Blockfrost extended address object.

type AddressInfo added in v0.68.0

type AddressInfo struct {
	Address      string
	Amount       []AddressAmountInfo
	StakeAddress *string
	Type         string
	Script       bool
}

AddressInfo holds address summary data needed by the API.

type AddressQueryNode added in v0.85.0

type AddressQueryNode interface {
	// AddressExtended returns the address summary with per-asset decimals
	// and on-chain metadata flags.
	AddressExtended(
		ctx context.Context,
		address string,
	) (AddressExtendedInfo, error)

	// AddressTotal returns the lifetime received and sent sums and the
	// transaction count of an address.
	AddressTotal(
		ctx context.Context,
		address string,
	) (AddressTotalInfo, error)

	// AddressAssetUTXOs returns the paginated current UTxOs of an address
	// that hold the given asset, along with the total number of matching
	// results before pagination.
	AddressAssetUTXOs(
		ctx context.Context,
		address string,
		policyID string,
		assetName []byte,
		params PaginationParams,
	) ([]AddressUTXOInfo, int, error)
}

AddressQueryNode is the address aggregate surface of BlockfrostNode.

type AddressResponse added in v0.68.0

type AddressResponse struct {
	Address      string                  `json:"address"`
	Amount       []AddressAmountResponse `json:"amount"`
	StakeAddress *string                 `json:"stake_address"`
	Type         string                  `json:"type"`
	Script       bool                    `json:"script"`
}

AddressResponse represents a Blockfrost address summary object.

type AddressTotalInfo added in v0.85.0

type AddressTotalInfo struct {
	Address     string
	ReceivedSum []AddressAmountInfo
	SentSum     []AddressAmountInfo
	TxCount     int
}

AddressTotalInfo holds the lifetime totals of an address.

type AddressTotalResponse added in v0.85.0

type AddressTotalResponse struct {
	Address     string                  `json:"address"`
	ReceivedSum []AddressAmountResponse `json:"received_sum"`
	SentSum     []AddressAmountResponse `json:"sent_sum"`
	TxCount     int                     `json:"tx_count"`
}

AddressTotalResponse represents the Blockfrost address totals object.

type AddressTransactionInfo

type AddressTransactionInfo struct {
	TxHash      string
	TxIndex     uint32
	BlockHeight uint64
	BlockTime   int64
}

AddressTransactionInfo holds address transaction data needed by the API.

type AddressTransactionResponse

type AddressTransactionResponse struct {
	TxHash      string `json:"tx_hash"`
	TxIndex     int    `json:"tx_index"`
	BlockHeight uint64 `json:"block_height"`
	BlockTime   int    `json:"block_time"`
}

AddressTransactionResponse represents a Blockfrost address transaction object.

type AddressUTXOInfo

type AddressUTXOInfo struct {
	Address string
	TxHash  string
	// TxIndex is the deprecated Blockfrost alias for OutputIndex (the UTxO's
	// index within its producing transaction); it carries the same value.
	TxIndex             uint32
	OutputIndex         uint32
	Amount              []AddressAmountInfo
	Block               string
	DataHash            *string
	InlineDatum         *string
	ReferenceScriptHash *string
}

AddressUTXOInfo holds address UTxO data needed by the API.

type AddressUTXOResponse

type AddressUTXOResponse struct {
	Address string `json:"address"`
	TxHash  string `json:"tx_hash"`
	// TxIndex is a deprecated Blockfrost alias for OutputIndex ("UTXO index
	// in the transaction"), kept for schema compatibility.
	TxIndex             int                     `json:"tx_index"`
	OutputIndex         int                     `json:"output_index"`
	Amount              []AddressAmountResponse `json:"amount"`
	Block               string                  `json:"block"`
	DataHash            *string                 `json:"data_hash"`
	InlineDatum         *string                 `json:"inline_datum"`
	ReferenceScriptHash *string                 `json:"reference_script_hash"`
}

AddressUTXOResponse represents a Blockfrost address UTxO object.

type AssetAddressResponse added in v0.62.0

type AssetAddressResponse struct {
	Address  string `json:"address"`
	Quantity string `json:"quantity"`
}

AssetAddressResponse represents one entry in the GET /assets/{asset}/addresses response.

type AssetHistoryItemInfo added in v0.85.0

type AssetHistoryItemInfo struct {
	TxHash string
	Action string
	Amount string
}

AssetHistoryItemInfo is one mint or burn event of an asset. Action is "minted" or "burned" and Amount is the unsigned quantity.

type AssetHistoryResponse added in v0.85.0

type AssetHistoryResponse struct {
	TxHash string `json:"tx_hash"`
	Action string `json:"action"`
	Amount string `json:"amount"`
}

AssetHistoryResponse is one mint or burn event of an asset.

type AssetHolderInfo added in v0.62.0

type AssetHolderInfo struct {
	Address  string
	Quantity string
}

AssetHolderInfo holds address and quantity data for a single asset holder.

type AssetInfo

type AssetInfo struct {
	OnchainMetadata         *any
	OnchainMetadataStandard *string
	OnchainMetadataExtra    *string
	Metadata                *any
	Asset                   string
	PolicyID                string
	AssetName               string
	AssetNameASCII          string
	Fingerprint             string
	Quantity                string
	InitialMintTxHash       string
	MintOrBurnCount         int
}

AssetInfo holds native asset data needed by the API.

type AssetListItemInfo added in v0.85.0

type AssetListItemInfo struct {
	Asset    string
	Quantity string
}

AssetListItemInfo is one entry of an asset listing.

type AssetListItemResponse added in v0.85.0

type AssetListItemResponse struct {
	Asset    string `json:"asset"`
	Quantity string `json:"quantity"`
}

AssetListItemResponse is one entry of an asset listing.

type AssetQueryNode added in v0.85.0

type AssetQueryNode interface {
	// Assets returns the paginated list of every asset with a recorded
	// mint or burn, oldest first, along with the total before pagination.
	Assets(
		ctx context.Context,
		params PaginationParams,
	) ([]AssetListItemInfo, int, error)

	// AssetsByPolicy returns the paginated assets minted under a policy,
	// along with the total before pagination.
	AssetsByPolicy(
		ctx context.Context,
		policyID string,
		params PaginationParams,
	) ([]AssetListItemInfo, int, error)

	// AssetHistory returns the paginated mint and burn events of an asset,
	// along with the total before pagination.
	AssetHistory(
		ctx context.Context,
		policyID string,
		assetName []byte,
		params PaginationParams,
	) ([]AssetHistoryItemInfo, int, error)

	// AssetTransactions returns the paginated transactions that mint,
	// burn, create or spend an output holding the asset, optionally
	// restricted to an inclusive from/to block-range position.
	AssetTransactions(
		ctx context.Context,
		policyID string,
		assetName []byte,
		params TransactionRangeParams,
	) ([]AssetTransactionInfo, int, error)

	// AssetUTXOs returns the paginated current UTxOs holding the asset,
	// optionally restricted to an inclusive from/to block-range position of
	// the producing transaction.
	AssetUTXOs(
		ctx context.Context,
		policyID string,
		assetName []byte,
		params TransactionRangeParams,
	) ([]AssetUTXOInfo, int, error)
}

AssetQueryNode is the native asset listing surface of BlockfrostNode.

type AssetResponse

type AssetResponse struct {
	Asset                   string  `json:"asset"`
	PolicyID                string  `json:"policy_id"`
	AssetName               string  `json:"asset_name"`
	AssetNameASCII          string  `json:"asset_name_ascii"`
	Fingerprint             string  `json:"fingerprint"`
	Quantity                string  `json:"quantity"`
	InitialMintTxHash       string  `json:"initial_mint_tx_hash"`
	MintOrBurnCount         int     `json:"mint_or_burn_count"`
	OnchainMetadata         *any    `json:"onchain_metadata"`
	OnchainMetadataStandard *string `json:"onchain_metadata_standard"`
	OnchainMetadataExtra    *string `json:"onchain_metadata_extra"`
	Metadata                *any    `json:"metadata"`
}

AssetResponse represents a Blockfrost native asset object.

type AssetTransactionInfo added in v0.85.0

type AssetTransactionInfo struct {
	TxHash      string
	TxIndex     uint32
	BlockHeight uint64
	BlockTime   int64
}

AssetTransactionInfo is one transaction involving an asset.

type AssetUTXOInfo added in v0.85.0

type AssetUTXOInfo struct {
	Address             string
	TxHash              string
	OutputIndex         uint32
	Amount              []AddressAmountInfo
	Block               string
	BlockHeight         uint64
	BlockTime           int64
	DataHash            *string
	InlineDatum         *string
	InlineDatumJSON     json.RawMessage
	ReferenceScriptHash *string
}

AssetUTXOInfo is one current UTxO holding an asset.

type AssetUTXOResponse added in v0.85.0

type AssetUTXOResponse struct {
	Address             string                  `json:"address"`
	TxHash              string                  `json:"tx_hash"`
	OutputIndex         int                     `json:"output_index"`
	Amount              []AddressAmountResponse `json:"amount"`
	Block               string                  `json:"block"`
	BlockHeight         uint64                  `json:"block_height"`
	BlockTime           int64                   `json:"block_time"`
	DataHash            *string                 `json:"data_hash"`
	InlineDatum         *string                 `json:"inline_datum"`
	InlineDatumJSON     json.RawMessage         `json:"inline_datum_json"`
	ReferenceScriptHash *string                 `json:"reference_script_hash"`
}

AssetUTXOResponse is one current UTxO holding an asset. InlineDatumJSON is null for an output without an inline datum.

type BlockAddressInfo added in v0.85.0

type BlockAddressInfo struct {
	Address  string
	TxHashes []string
}

BlockAddressInfo holds an address affected by a block and the hashes of the block transactions touching it.

type BlockAddressResponse added in v0.85.0

type BlockAddressResponse struct {
	Address      string                            `json:"address"`
	Transactions []BlockAddressTransactionResponse `json:"transactions"`
}

BlockAddressResponse is one entry of the addresses affected by a block.

type BlockAddressTransactionResponse added in v0.85.0

type BlockAddressTransactionResponse struct {
	TxHash string `json:"tx_hash"`
}

BlockAddressTransactionResponse names one transaction touching an address.

type BlockInfo

type BlockInfo struct {
	Hash          string
	Slot          uint64
	Epoch         uint64
	EpochSlot     uint64
	Height        uint64
	Time          int64
	Size          uint64
	TxCount       int
	SlotLeader    string
	PreviousBlock string
	Confirmations uint64
	// Output is the total lovelace output of the block's transactions.
	Output string
	// Fees is the total lovelace fees of the block's transactions.
	Fees string
	// BlockVRF is the bech32-encoded (vrf_vk) VRF verification key from the
	// Praos/TPraos header, or nil for Byron/unknown headers.
	BlockVRF *string
	// OPCert is the hex-encoded operational certificate hot vkey, or nil for
	// Byron/unknown headers.
	OPCert *string
	// OPCertCounter is the operational certificate issue counter as a decimal
	// string, or nil for Byron/unknown headers.
	OPCertCounter *string
	// NextBlock is the hash of the block that builds on this one, or nil when
	// this block is the chain tip.
	NextBlock *string
}

BlockInfo holds block data needed by the API.

type BlockQueryNode added in v0.85.0

type BlockQueryNode interface {
	// BlockNext returns a page of the blocks following the identified
	// block and the number of heights between it and the tip. Page one holds
	// the nearest blocks; heights ascend within a page unless params.Order
	// is descending.
	BlockNext(
		ctx context.Context,
		id string,
		params PaginationParams,
	) ([]BlockInfo, int, error)

	// BlockPrevious returns a page of the blocks preceding the identified
	// block and the number of heights below it. Page one holds the nearest
	// blocks; heights ascend within a page unless params.Order is
	// descending.
	BlockPrevious(
		ctx context.Context,
		id string,
		params PaginationParams,
	) ([]BlockInfo, int, error)

	// BlockBySlot returns the block produced in an absolute slot.
	BlockBySlot(ctx context.Context, slot uint64) (BlockInfo, error)

	// BlockByEpochSlot returns the block produced in a slot counted from
	// the start of an epoch.
	BlockByEpochSlot(
		ctx context.Context,
		epoch uint64,
		epochSlot uint64,
	) (BlockInfo, error)

	// BlockTransactionHashes returns every transaction hash in the
	// identified block, in block order.
	BlockTransactionHashes(
		ctx context.Context,
		id string,
	) ([]string, error)

	// BlockTransactionCBOR returns every transaction in the identified block
	// with its raw CBOR, in block order.
	BlockTransactionCBOR(
		ctx context.Context,
		id string,
	) ([]BlockTransactionCBORInfo, error)

	// LatestBlockTransactionCBOR returns every transaction of the chain tip
	// block with its raw CBOR, in block order.
	LatestBlockTransactionCBOR(
		ctx context.Context,
	) ([]BlockTransactionCBORInfo, error)

	// BlockAddresses returns every address affected by the identified
	// block together with the transactions that touch it, ordered by
	// address.
	BlockAddresses(
		ctx context.Context,
		id string,
	) ([]BlockAddressInfo, error)
}

BlockQueryNode is the block navigation and block content surface of BlockfrostNode. Block identifiers are 64-character hex hashes or decimal heights, as for BlockByHashOrNumber.

type BlockRangePosition added in v0.69.0

type BlockRangePosition struct {
	Block uint64
	Index *uint32
}

BlockRangePosition holds a parsed Blockfrost account or address transactions from/to query value: a block number and an optional transaction index within that block (the "block:index" form).

type BlockResponse

type BlockResponse struct {
	Time          int64   `json:"time"`
	Height        uint64  `json:"height"`
	Hash          string  `json:"hash"`
	Slot          uint64  `json:"slot"`
	Epoch         uint64  `json:"epoch"`
	EpochSlot     uint64  `json:"epoch_slot"`
	SlotLeader    string  `json:"slot_leader"`
	Size          uint64  `json:"size"`
	TxCount       int     `json:"tx_count"`
	Output        *string `json:"output"`
	Fees          *string `json:"fees"`
	BlockVRF      *string `json:"block_vrf"`
	OPCert        *string `json:"op_cert"`
	OPCertCounter *string `json:"op_cert_counter"`
	PreviousBlock string  `json:"previous_block"`
	NextBlock     *string `json:"next_block"`
	Confirmations uint64  `json:"confirmations"`
}

BlockResponse represents a Blockfrost block object.

type BlockTransactionCBORInfo added in v0.85.0

type BlockTransactionCBORInfo struct {
	TxHash string
	CBOR   string
}

BlockTransactionCBORInfo holds a transaction hash and its raw hex CBOR.

type BlockTransactionCBORResponse added in v0.85.0

type BlockTransactionCBORResponse struct {
	TxHash string `json:"tx_hash"`
	CBOR   string `json:"cbor"`
}

BlockTransactionCBORResponse is one entry of the block transaction CBOR listings.

type Blockfrost

type Blockfrost struct {
	// contains filtered or unexported fields
}

Blockfrost is the Blockfrost-compatible REST API server.

func New

func New(
	cfg BlockfrostConfig,
	node BlockfrostNode,
	logger *slog.Logger,
) *Blockfrost

New creates a new Blockfrost API server instance.

func (*Blockfrost) Start

func (b *Blockfrost) Start(
	ctx context.Context,
) error

Start starts the HTTP server in a background goroutine.

func (*Blockfrost) Stop

func (b *Blockfrost) Stop(
	ctx context.Context,
) error

Stop gracefully shuts down the HTTP server, and does not return until the listening socket has been released -- see internal/apilistener.

type BlockfrostConfig

type BlockfrostConfig struct {
	// ListenAddress is the address to listen on.
	// Defaults to "127.0.0.1:3000".
	ListenAddress string
	// AuthToken authorizes transaction submission and evaluation.
	AuthToken string
	// MaxConcurrentMutations bounds transaction submission and evaluation
	// work across the server.
	MaxConcurrentMutations uint
	// MaxConcurrentMutationsPerClient bounds transaction submission and
	// evaluation work from one remote address.
	MaxConcurrentMutationsPerClient uint
	// CORSAllowedOrigins configures Access-Control-Allow-Origin.
	// Empty disables CORS.
	CORSAllowedOrigins []string
	TLS                apiconfig.EffectiveTLS
}

BlockfrostConfig holds configuration for the Blockfrost API server.

type BlockfrostNode

type BlockfrostNode interface {
	BlockQueryNode
	AddressQueryNode
	AssetQueryNode
	ScriptQueryNode
	MempoolQueryNode

	// ChainTip returns the current chain tip info.
	ChainTip() (ChainTipInfo, error)

	// LatestBlock returns information about the latest
	// block on the chain.
	LatestBlock() (BlockInfo, error)

	// BlockByHashOrNumber returns information about a block
	// identified by a 64-character hex hash or decimal height.
	BlockByHashOrNumber(id string) (BlockInfo, error)

	// LatestBlockTxHashes returns the transaction hashes
	// for the latest block.
	LatestBlockTxHashes() ([]string, error)

	// CurrentEpoch returns information about the current
	// epoch.
	CurrentEpoch() (EpochInfo, error)

	// Epoch returns the requested epoch. It returns ErrEpochNotFound for an
	// epoch the node has not reached.
	Epoch(ctx context.Context, epoch uint64) (EpochInfo, error)

	// EpochsAfter returns the epochs following epoch in ascending order,
	// along with the total number of following epochs.
	EpochsAfter(
		ctx context.Context,
		epoch uint64,
		params PaginationParams,
	) ([]EpochInfo, int, error)

	// EpochsBefore returns the epochs preceding epoch, nearest first, along
	// with the total number of preceding epochs.
	EpochsBefore(
		ctx context.Context,
		epoch uint64,
		params PaginationParams,
	) ([]EpochInfo, int, error)

	// EpochStakes returns the stake distribution active in an epoch, ordered
	// by pool then credential.
	EpochStakes(
		ctx context.Context,
		epoch uint64,
		params PaginationParams,
	) ([]EpochStakeInfo, int, error)

	// EpochPoolStakes returns the stake distribution of one pool active in an
	// epoch.
	EpochPoolStakes(
		ctx context.Context,
		epoch uint64,
		poolID string,
		params PaginationParams,
	) ([]EpochPoolStakeInfo, int, error)

	// EpochBlocks returns the hashes of the blocks minted in an epoch.
	EpochBlocks(
		ctx context.Context,
		epoch uint64,
		params PaginationParams,
	) ([]string, int, error)

	// EpochPoolBlocks returns the hashes of the blocks one pool minted in an
	// epoch.
	EpochPoolBlocks(
		ctx context.Context,
		epoch uint64,
		poolID string,
		params PaginationParams,
	) ([]string, int, error)

	// CurrentProtocolParams returns the current protocol
	// parameters.
	CurrentProtocolParams() (ProtocolParamsInfo, error)

	// EpochProtocolParams returns protocol parameters for a
	// specific epoch.
	EpochProtocolParams(epoch uint64) (ProtocolParamsInfo, error)

	// Network returns current network supply and stake information.
	Network() (NetworkInfo, error)

	// NetworkEras returns hard-fork era summaries.
	NetworkEras() ([]NetworkEraInfo, error)

	// Genesis returns Shelley genesis configuration values.
	Genesis() (GenesisInfo, error)

	// PoolsExtended returns the current active pools with
	// extended details.
	PoolsExtended(context.Context, PaginationParams) (
		[]PoolExtendedInfo, int, error,
	)

	// PoolsList returns the paginated list of registered (active,
	// non-retired) stake pool IDs, along with the total number of
	// matching results before pagination.
	PoolsList(ctx context.Context, params PaginationParams) ([]string, int, error)

	// Address returns summary information for an address,
	// including balances aggregated across its live UTxOs.
	Address(address string) (AddressInfo, error)

	// PoolsRetiring returns the paginated list of pools with a
	// pending retirement announcement, along with the total number
	// of matching results before pagination.
	PoolsRetiring(context.Context, PaginationParams) ([]PoolRetiringInfo, int, error)

	// GovernanceProposals returns the paginated proposal list along with the
	// total before pagination.
	GovernanceProposals(
		ctx context.Context,
		params PaginationParams,
	) ([]GovernanceProposalInfo, int, error)

	// GovernanceProposal returns a proposal, or
	// models.ErrGovernanceProposalNotFound.
	GovernanceProposal(
		ctx context.Context,
		ref GovActionRef,
	) (GovernanceProposalDetailInfo, error)

	// GovernanceProposalParameters returns the parameter update of a
	// parameter change proposal. Any other proposal reports
	// models.ErrGovernanceProposalNotFound.
	GovernanceProposalParameters(
		ctx context.Context,
		ref GovActionRef,
	) (GovernanceProposalParametersInfo, error)

	// GovernanceProposalWithdrawals returns the treasury withdrawals of a
	// proposal.
	GovernanceProposalWithdrawals(
		ctx context.Context,
		ref GovActionRef,
		params PaginationParams,
	) ([]GovernanceWithdrawalInfo, int, error)

	// GovernanceProposalVotes returns the votes cast on a proposal. It
	// returns ErrHistoryNotRetained when a vote's casting transaction can no
	// longer be located.
	GovernanceProposalVotes(
		ctx context.Context,
		ref GovActionRef,
		params PaginationParams,
	) ([]GovernanceProposalVoteInfo, int, error)

	// GovernanceProposalMetadata returns the off-chain document behind a
	// proposal's anchor, or models.ErrGovernanceProposalNotFound when it has
	// not been fetched.
	GovernanceProposalMetadata(
		ctx context.Context,
		ref GovActionRef,
	) (GovernanceProposalMetadataInfo, error)

	// DRepDelegators returns the registered delegators of a DRep.
	DRepDelegators(
		ctx context.Context,
		credential DRepCredential,
		params PaginationParams,
	) ([]DRepDelegatorInfo, int, error)

	// DRepMetadata returns the off-chain document behind a DRep's anchor.
	DRepMetadata(
		ctx context.Context,
		credential DRepCredential,
	) (DRepAnchorInfo, error)

	// DRepUpdates returns a DRep's registration, update and deregistration
	// certificates.
	DRepUpdates(
		ctx context.Context,
		credential DRepCredential,
		params PaginationParams,
	) ([]DRepUpdateInfo, int, error)

	// DRepVotes returns the votes a DRep cast. It returns
	// ErrHistoryNotRetained when a vote's casting transaction can no longer
	// be located.
	DRepVotes(
		ctx context.Context,
		credential DRepCredential,
		params PaginationParams,
	) ([]DRepVoteInfo, int, error)

	// PoolVotes returns the votes a pool cast. It returns
	// ErrHistoryNotRetained when a vote's casting transaction can no longer
	// be located.
	PoolVotes(
		ctx context.Context,
		poolID string,
		params PaginationParams,
	) ([]PoolVoteInfo, int, error)

	// GovernanceCommittee returns the constitutional committee.
	GovernanceCommittee(ctx context.Context) (CommitteeInfo, error)

	// CommitteeVotes returns the votes cast by committee members: all of
	// them for a nil credential, those of one hot credential, or, when cold
	// is set, those of every hot credential the cold one authorized. It
	// returns ErrHistoryNotRetained when a vote's casting transaction can no
	// longer be located.
	CommitteeVotes(
		ctx context.Context,
		credential *CommitteeCredentialRef,
		cold bool,
		params PaginationParams,
	) ([]CommitteeVoteInfo, int, error)

	// PoolsRetired returns the paginated list of pools whose retirement has
	// taken effect, along with the total before pagination.
	PoolsRetired(
		ctx context.Context,
		params PaginationParams,
	) ([]PoolRetiringInfo, int, error)

	// PoolHistory returns the per-epoch history of a pool.
	PoolHistory(
		ctx context.Context,
		poolID string,
		params PaginationParams,
	) ([]PoolHistoryInfo, int, error)

	// PoolRelays returns the relays of a pool's latest registration.
	PoolRelays(ctx context.Context, poolID string) ([]PoolRelayInfo, error)

	// PoolDelegators returns the registered delegators of a pool with their
	// live stake.
	PoolDelegators(
		ctx context.Context,
		poolID string,
		params PaginationParams,
	) ([]PoolDelegatorInfo, int, error)

	// PoolBlocks returns the hashes of the blocks a pool minted.
	PoolBlocks(
		ctx context.Context,
		poolID string,
		params PaginationParams,
	) ([]string, int, error)

	// PoolUpdates returns a pool's registration and retirement certificates.
	PoolUpdates(
		ctx context.Context,
		poolID string,
		params PaginationParams,
	) ([]PoolUpdateInfo, int, error)

	// PoolMetadata returns the registered metadata for a pool.
	PoolMetadata(poolID string) (PoolMetadataInfo, error)

	// PoolDetail returns the OpenAPI pool detail object for the requested
	// pool (bech32 or hex ID), computing epoch-sensitive aggregates
	// (blocks_epoch, live/active stake, saturation) as of the current
	// epoch.
	PoolDetail(ctx context.Context, poolID string) (PoolDetailInfo, error)

	// AddressUTXOs returns the paginated current UTxOs for
	// an address along with the total number of matching
	// results before pagination.
	AddressUTXOs(ctx context.Context,
		address string,
		params PaginationParams,
	) ([]AddressUTXOInfo, int, error)

	// AddressTransactions returns the paginated transaction
	// history for an address, optionally restricted to an
	// inclusive from/to block-range position, along with the total
	// number of matching results before pagination.
	AddressTransactions(
		ctx context.Context,
		address string,
		params TransactionRangeParams,
	) ([]AddressTransactionInfo, int, error)

	// MetadataTransactions returns the paginated transactions
	// containing the requested metadata label, with JSON values.
	MetadataTransactions(
		label uint64,
		params PaginationParams,
	) ([]MetadataTransactionJSONInfo, int, error)

	// MetadataTransactionsCBOR returns the paginated transactions
	// containing the requested metadata label, with CBOR values.
	MetadataTransactionsCBOR(
		label uint64,
		params PaginationParams,
	) ([]MetadataTransactionCBORInfo, int, error)

	// Transaction returns summary details for a transaction hash.
	Transaction(hash []byte) (TransactionInfo, error)

	// TransactionSubmit submits raw signed transaction CBOR to the mempool.
	TransactionSubmit(ctx context.Context, txCbor []byte) (string, error)

	// TransactionEvaluate evaluates script execution units for raw transaction
	// CBOR without submitting the transaction.
	TransactionEvaluate(context.Context, []byte) (TransactionEvaluationResponse, error)

	// TransactionCBOR returns raw signed transaction CBOR bytes.
	TransactionCBOR(hash []byte) ([]byte, error)

	// TransactionMetadata returns transaction metadata labels as JSON values.
	TransactionMetadata(hash []byte) ([]TransactionMetadataInfo, error)

	// TransactionMetadataCBOR returns transaction metadata labels as CBOR values.
	TransactionMetadataCBOR(hash []byte) ([]TransactionMetadataCBORInfo, error)

	// TransactionUTXOs returns transaction inputs and outputs.
	TransactionUTXOs(hash []byte) (TransactionUTXOsInfo, error)

	// TransactionDelegations returns delegation certificates in a transaction.
	TransactionDelegations(hash []byte) ([]TransactionDelegationInfo, error)

	// TransactionStakeAddresses returns stake address certificates in a transaction.
	TransactionStakeAddresses(
		hash []byte,
	) ([]TransactionStakeAddressInfo, error)

	// TransactionWithdrawals returns reward withdrawals in a transaction.
	TransactionWithdrawals(hash []byte) ([]TransactionWithdrawalInfo, error)

	// TransactionMIRs returns MIR certificates in a transaction.
	TransactionMIRs(hash []byte) ([]TransactionMIRInfo, error)

	// TransactionPoolUpdates returns pool registration certificates in a transaction.
	TransactionPoolUpdates(hash []byte) ([]TransactionPoolUpdateInfo, error)

	// TransactionPoolRetires returns pool retirement certificates in a transaction.
	TransactionPoolRetires(hash []byte) ([]TransactionPoolRetireInfo, error)

	// TransactionRedeemers returns Plutus redeemers in a transaction.
	TransactionRedeemers(hash []byte) ([]TransactionRedeemerInfo, error)

	// TransactionRequiredSigners returns required signing key hashes in a transaction.
	TransactionRequiredSigners(
		hash []byte,
	) ([]TransactionRequiredSignerInfo, error)

	// Asset returns native asset information for a
	// concatenated hex asset ID ({policy_id}{asset_name}).
	Asset(
		policyID string,
		assetName []byte,
	) (AssetInfo, error)

	// AssetAddresses returns paginated addresses currently holding the given
	// asset, along with the total holder count before pagination.
	AssetAddresses(
		ctx context.Context,
		policyID string,
		assetName []byte,
		params PaginationParams,
	) ([]AssetHolderInfo, int, error)

	// DRep returns governance DRep information for a parsed
	// DRep credential.
	DRep(context.Context, DRepCredential) (DRepInfo, error)

	// DReps returns the paginated DRep list along with the total
	// number of matching results before pagination.
	DReps(context.Context, DRepListParams) ([]DRepListItemInfo, int, error)

	// Account returns stake-account information for the
	// requested stake address.
	Account(string) (AccountInfo, error)

	// AccountAssociatedAddresses returns payment addresses
	// associated with the requested stake address.
	AccountAssociatedAddresses(context.Context,
		string,
		PaginationParams,
	) ([]AccountAssociatedAddressInfo, int, error)

	// AccountStakeHistory returns the stake an account held in each retained
	// epoch distribution. It returns ErrHistoryNotRetained when the account's
	// history predates the oldest retained distribution and none remains.
	AccountStakeHistory(context.Context,
		string,
		PaginationParams,
	) ([]AccountStakeHistoryInfo, int, error)

	// AccountMIRs returns the Move Instantaneous Rewards paid to the
	// requested stake address.
	AccountMIRs(context.Context,
		string,
		PaginationParams,
	) ([]AccountMIRInfo, int, error)

	// AccountAddressAssets returns the native assets held across the
	// addresses of the requested stake address.
	AccountAddressAssets(context.Context,
		string,
		PaginationParams,
	) ([]AddressAmountInfo, int, error)

	// AccountAddressTotal returns the received and sent totals across the
	// addresses of the requested stake address.
	AccountAddressTotal(
		context.Context,
		string,
	) (AccountAddressTotalInfo, error)

	// AccountDelegationHistory returns delegation history
	// rows for the requested stake address.
	AccountDelegationHistory(context.Context,
		string,
		PaginationParams,
	) ([]AccountDelegationHistoryInfo, int, error)

	// AccountRegistrationHistory returns registration
	// history rows for the requested stake address.
	AccountRegistrationHistory(context.Context,
		string,
		PaginationParams,
	) ([]AccountRegistrationHistoryInfo, int, error)

	// AccountRewardHistory returns reward history rows for
	// the requested stake address.
	AccountRewardHistory(context.Context,
		string,
		PaginationParams,
	) ([]AccountRewardHistoryInfo, int, error)

	// AccountUTXOs returns the current UTxOs controlled by the
	// stake credential behind the requested stake address.
	AccountUTXOs(context.Context,
		string,
		PaginationParams,
	) ([]AccountUTXOInfo, int, error)

	// AccountWithdrawals returns withdrawal history rows for
	// the requested stake address.
	AccountWithdrawals(context.Context,
		string,
		PaginationParams,
	) ([]AccountWithdrawalInfo, int, error)

	// AccountTransactions returns transactions associated with
	// addresses controlled by the stake credential behind the
	// requested stake address, optionally filtered by an
	// inclusive from/to block-range position.
	AccountTransactions(context.Context,
		string,
		TransactionRangeParams,
	) ([]AccountTransactionInfo, int, error)
}

BlockfrostNode is the interface that the Blockfrost API server uses to query the node for blockchain data. This decouples the HTTP server from the concrete Node struct and enables testing with mock implementations.

type ChainTipInfo

type ChainTipInfo struct {
	BlockHash   string
	Slot        uint64
	BlockNumber uint64
}

ChainTipInfo holds chain tip data needed by the API.

type CommitteeCredentialRef added in v0.85.0

type CommitteeCredentialRef struct {
	Hash      []byte
	HasScript bool
}

CommitteeCredentialRef is a committee credential with its key or script tag.

type CommitteeInfo added in v0.85.0

type CommitteeInfo struct {
	// GovActionID, ProposalTxHash and ProposalIndex name the enacted action
	// that last changed the committee; nil for the genesis committee.
	GovActionID    *string
	ProposalTxHash *string
	ProposalIndex  *int
	IsDissolved    bool
	QuorumNum      uint64
	QuorumDenom    uint64
	Members        []CommitteeMemberInfo
}

CommitteeInfo is the constitutional committee.

type CommitteeMemberInfo added in v0.85.0

type CommitteeMemberInfo struct {
	ColdID        string
	ColdHex       string
	ColdHasScript bool
	HotID         *string
	HotHex        *string
	HotHasScript  *bool
	// Status is authorized, not_authorized or resigned.
	Status          string
	ExpirationEpoch uint64
}

CommitteeMemberInfo is one member of the constitutional committee.

type CommitteeMemberResponse added in v0.85.0

type CommitteeMemberResponse struct {
	CCColdID        string  `json:"cc_cold_id"`
	CCColdHex       string  `json:"cc_cold_hex"`
	CCColdHasScript bool    `json:"cc_cold_has_script"`
	CCHotID         *string `json:"cc_hot_id"`
	CCHotHex        *string `json:"cc_hot_hex"`
	CCHotHasScript  *bool   `json:"cc_hot_has_script"`
	Status          string  `json:"status"`
	ExpirationEpoch uint64  `json:"expiration_epoch"`
}

CommitteeMemberResponse is one member of the constitutional committee.

type CommitteeQuorumResponse added in v0.85.0

type CommitteeQuorumResponse struct {
	Numerator   uint64 `json:"numerator"`
	Denominator uint64 `json:"denominator"`
}

CommitteeQuorumResponse is the committee quorum threshold.

type CommitteeResponse added in v0.85.0

type CommitteeResponse struct {
	GovActionID    *string                   `json:"gov_action_id"`
	ProposalTxHash *string                   `json:"proposal_tx_hash"`
	ProposalIndex  *int                      `json:"proposal_index"`
	IsDissolved    bool                      `json:"is_dissolved"`
	Quorum         CommitteeQuorumResponse   `json:"quorum"`
	Members        []CommitteeMemberResponse `json:"members"`
}

CommitteeResponse is the constitutional committee.

type CommitteeVoteInfo added in v0.85.0

type CommitteeVoteInfo struct {
	TxHash         string
	VoterHotID     string
	ProposalID     string
	ProposalTxHash string
	ProposalIndex  int
	GovernanceType string
	Vote           string
	MetadataURL    *string
	MetadataHash   *string
	BlockHeight    uint64
	BlockTime      int64
}

CommitteeVoteInfo is one vote a committee member cast.

type CommitteeVoteResponse added in v0.85.0

type CommitteeVoteResponse struct {
	TxHash         string  `json:"tx_hash"`
	VoterHotID     string  `json:"voter_hot_id"`
	ProposalID     string  `json:"proposal_id"`
	ProposalTxHash string  `json:"proposal_tx_hash"`
	ProposalIndex  int     `json:"proposal_index"`
	GovernanceType string  `json:"governance_type"`
	Vote           string  `json:"vote"`
	MetadataURL    *string `json:"metadata_url"`
	MetadataHash   *string `json:"metadata_hash"`
	BlockHeight    uint64  `json:"block_height"`
	BlockTime      int64   `json:"block_time"`
}

CommitteeVoteResponse is one vote a committee member cast.

type DRepAnchorInfo added in v0.85.0

type DRepAnchorInfo struct {
	DRepID       string
	Hex          string
	URL          string
	Hash         string
	JSONMetadata json.RawMessage
	Bytes        *string
	Error        *OffchainFetchErrorInfo
}

DRepAnchorInfo is the off-chain document behind a DRep's anchor. Error is set when the document could not be fetched or validated.

type DRepAnchorResponse added in v0.85.0

type DRepAnchorResponse struct {
	DRepID       string                      `json:"drep_id"`
	Hex          string                      `json:"hex"`
	URL          string                      `json:"url"`
	Hash         string                      `json:"hash"`
	JSONMetadata json.RawMessage             `json:"json_metadata"`
	Bytes        *string                     `json:"bytes"`
	Error        *OffchainFetchErrorResponse `json:"error,omitempty"`
}

DRepAnchorResponse is the off-chain document behind a DRep's anchor.

type DRepCredential

type DRepCredential struct {
	ID                 string
	Hash               []byte
	HasScript          bool
	CredentialTagKnown bool
	// Predefined is set for the special DReps
	// (drep_always_abstain, drep_always_no_confidence), which carry
	// no credential hash. The value is a models.DrepType* constant.
	Predefined *uint64
}

DRepCredential holds a parsed governance DRep identifier.

type DRepDelegatorInfo added in v0.85.0

type DRepDelegatorInfo struct {
	Address string
	Amount  string
}

DRepDelegatorInfo is one delegator of a DRep.

type DRepDelegatorResponse added in v0.85.0

type DRepDelegatorResponse struct {
	Address string `json:"address"`
	Amount  string `json:"amount"`
}

DRepDelegatorResponse is one delegator of a DRep.

type DRepInfo

type DRepInfo struct {
	DRepID          string
	Hex             string
	Amount          string
	Active          bool
	ActiveEpoch     *uint64
	HasScript       bool
	Retired         bool
	Expired         bool
	LastActiveEpoch *uint64
}

DRepInfo holds DRep data needed by the governance API, following the Blockfrost OpenAPI 0.1.90 drep schema.

type DRepListItemInfo added in v0.68.0

type DRepListItemInfo struct {
	DRepID          string
	Hex             string
	Amount          string
	HasScript       bool
	Retired         bool
	Expired         bool
	LastActiveEpoch *uint64
	Metadata        *DRepMetadataInfo
}

DRepListItemInfo is one entry of the DRep list endpoint. Unlike DRepInfo it always uses CIP-129 identifiers and carries the resolved anchor metadata.

type DRepListItemResponse added in v0.68.0

type DRepListItemResponse struct {
	DRepID          string                `json:"drep_id"`
	Hex             string                `json:"hex"`
	Amount          string                `json:"amount"`
	HasScript       bool                  `json:"has_script"`
	Retired         bool                  `json:"retired"`
	Expired         bool                  `json:"expired"`
	LastActiveEpoch *uint64               `json:"last_active_epoch"`
	Metadata        *DRepMetadataResponse `json:"metadata"`
}

DRepListItemResponse is one entry of the Blockfrost DRep list.

type DRepListParams added in v0.68.0

type DRepListParams struct {
	Pagination    PaginationParams
	OrderByAmount bool
	Retired       *bool
	Expired       *bool
}

DRepListParams holds query parameters for the DRep list endpoint.

type DRepMetadataInfo added in v0.68.0

type DRepMetadataInfo struct {
	URL          string
	Hash         string
	JSONMetadata json.RawMessage
	Bytes        string
}

DRepMetadataInfo is the resolved CIP-119 anchor document for a DRep.

type DRepMetadataResponse added in v0.68.0

type DRepMetadataResponse struct {
	URL          string          `json:"url"`
	Hash         string          `json:"hash"`
	JSONMetadata json.RawMessage `json:"json_metadata"`
	Bytes        string          `json:"bytes"`
}

DRepMetadataResponse is the resolved CIP-119 anchor document attached to a DRep list entry.

type DRepResponse

type DRepResponse struct {
	DRepID          string  `json:"drep_id"`
	Hex             string  `json:"hex"`
	Amount          string  `json:"amount"`
	Active          bool    `json:"active"`
	ActiveEpoch     *uint64 `json:"active_epoch"`
	HasScript       bool    `json:"has_script"`
	Retired         bool    `json:"retired"`
	Expired         bool    `json:"expired"`
	LastActiveEpoch *uint64 `json:"last_active_epoch"`
}

DRepResponse represents a Blockfrost governance DRep object (OpenAPI 0.1.90 drep schema; active and active_epoch are deprecated there but remain required).

type DRepUpdateInfo added in v0.85.0

type DRepUpdateInfo struct {
	TxHash    string
	CertIndex int
	// Action is registered, deregistered or updated.
	Action  string
	Deposit *string
}

DRepUpdateInfo is one registration, update or deregistration certificate of a DRep.

type DRepUpdateResponse added in v0.85.0

type DRepUpdateResponse struct {
	TxHash    string  `json:"tx_hash"`
	CertIndex int     `json:"cert_index"`
	Action    string  `json:"action"`
	Deposit   *string `json:"deposit"`
}

DRepUpdateResponse is one certificate of a DRep.

type DRepVoteInfo added in v0.85.0

type DRepVoteInfo struct {
	TxHash            string
	CertIndex         int
	ProposalID        string
	ProposalTxHash    string
	ProposalCertIndex int
	Vote              string
}

DRepVoteInfo is one vote a DRep cast.

type DRepVoteResponse added in v0.85.0

type DRepVoteResponse struct {
	TxHash            string `json:"tx_hash"`
	CertIndex         int    `json:"cert_index"`
	ProposalID        string `json:"proposal_id"`
	ProposalTxHash    string `json:"proposal_tx_hash"`
	ProposalCertIndex int    `json:"proposal_cert_index"`
	Vote              string `json:"vote"`
}

DRepVoteResponse is one vote a DRep cast.

type DatumCBORResponse added in v0.85.0

type DatumCBORResponse struct {
	CBOR string `json:"cbor"`
}

DatumCBORResponse carries the hex CBOR of a datum.

type DatumResponse added in v0.85.0

type DatumResponse struct {
	JSONValue json.RawMessage `json:"json_value"`
}

DatumResponse carries the detailed-schema JSON of a datum.

type EpochInfo

type EpochInfo struct {
	Epoch          uint64
	StartTime      int64
	EndTime        int64
	FirstBlockTime int64
	LastBlockTime  int64
	BlockCount     int
	TxCount        int
	// Output is the total lovelace of the outputs created in the epoch.
	Output string
	// Fees is the total lovelace of the fees paid in the epoch.
	Fees string
	// ActiveStake is the lovelace of stake active in the epoch, or nil when
	// the epoch has no captured stake distribution.
	ActiveStake *string
}

EpochInfo holds epoch data needed by the API.

type EpochPoolStakeInfo added in v0.85.0

type EpochPoolStakeInfo struct {
	StakeAddress string
	Amount       string
}

EpochPoolStakeInfo is one delegator's stake to a pool in an epoch's distribution.

type EpochPoolStakeResponse added in v0.85.0

type EpochPoolStakeResponse struct {
	StakeAddress string `json:"stake_address"`
	Amount       string `json:"amount"`
}

EpochPoolStakeResponse is one delegator's stake to a pool in an epoch's distribution.

type EpochResponse

type EpochResponse struct {
	Epoch          uint64  `json:"epoch"`
	StartTime      int64   `json:"start_time"`
	EndTime        int64   `json:"end_time"`
	FirstBlockTime int64   `json:"first_block_time"`
	LastBlockTime  int64   `json:"last_block_time"`
	BlockCount     int     `json:"block_count"`
	TxCount        int     `json:"tx_count"`
	Output         string  `json:"output"`
	Fees           string  `json:"fees"`
	ActiveStake    *string `json:"active_stake"`
}

EpochResponse represents a Blockfrost epoch object.

type EpochStakeInfo added in v0.85.0

type EpochStakeInfo struct {
	StakeAddress string
	PoolID       string
	Amount       string
}

EpochStakeInfo is one delegator's stake in an epoch's distribution.

type EpochStakeResponse added in v0.85.0

type EpochStakeResponse struct {
	StakeAddress string `json:"stake_address"`
	PoolID       string `json:"pool_id"`
	Amount       string `json:"amount"`
}

EpochStakeResponse is one delegator's stake in an epoch's distribution.

type ErrorResponse

type ErrorResponse struct {
	StatusCode int    `json:"status_code"`
	Error      string `json:"error"`
	Message    string `json:"message"`
}

ErrorResponse represents a Blockfrost error response.

type ExecutionUnitsResponse added in v0.70.2

type ExecutionUnitsResponse struct {
	Memory uint64 `json:"memory"`
	Steps  uint64 `json:"steps"`
}

ExecutionUnitsResponse contains the execution units consumed by a redeemer.

type GenesisInfo

type GenesisInfo struct {
	ActiveSlotsCoefficient float32
	UpdateQuorum           int
	MaxLovelaceSupply      string
	NetworkMagic           int
	EpochLength            int
	SystemStart            int
	SlotsPerKESPeriod      int
	SlotLength             int
	MaxKESEvolutions       int
	SecurityParam          int
}

GenesisInfo holds Shelley genesis configuration values.

type GenesisResponse

type GenesisResponse struct {
	ActiveSlotsCoefficient float32 `json:"active_slots_coefficient"`
	UpdateQuorum           int     `json:"update_quorum"`
	MaxLovelaceSupply      string  `json:"max_lovelace_supply"`
	NetworkMagic           int     `json:"network_magic"`
	EpochLength            int     `json:"epoch_length"`
	SystemStart            int     `json:"system_start"`
	SlotsPerKESPeriod      int     `json:"slots_per_kes_period"`
	SlotLength             int     `json:"slot_length"`
	MaxKESEvolutions       int     `json:"max_kes_evolutions"`
	SecurityParam          int     `json:"security_param"`
}

GenesisResponse represents Blockfrost genesis info.

type GovActionRef added in v0.85.0

type GovActionRef struct {
	TxHash []byte
	Index  uint32
}

GovActionRef identifies a governance action by its proposing transaction and its position inside it.

type GovernanceProposalDetailInfo added in v0.85.0

type GovernanceProposalDetailInfo struct {
	GovernanceProposalInfo
	Description   json.RawMessage
	Deposit       string
	ReturnAddress string
	RatifiedEpoch *uint64
	EnactedEpoch  *uint64
	DroppedEpoch  *uint64
	ExpiredEpoch  *uint64
	Expiration    uint64
}

GovernanceProposalDetailInfo is a governance proposal. Description is the governance action rendered as JSON.

type GovernanceProposalInfo added in v0.85.0

type GovernanceProposalInfo struct {
	ID             string
	TxHash         string
	CertIndex      int
	GovernanceType string
}

GovernanceProposalInfo is one entry of the proposal list.

type GovernanceProposalListResponse added in v0.85.0

type GovernanceProposalListResponse struct {
	ID             string `json:"id"`
	TxHash         string `json:"tx_hash"`
	CertIndex      int    `json:"cert_index"`
	GovernanceType string `json:"governance_type"`
}

GovernanceProposalListResponse is one entry of the Blockfrost proposal list.

type GovernanceProposalMetadataInfo added in v0.85.0

type GovernanceProposalMetadataInfo struct {
	ID           string
	TxHash       string
	CertIndex    int
	URL          string
	Hash         string
	JSONMetadata json.RawMessage
	Bytes        string
}

GovernanceProposalMetadataInfo is the off-chain document behind a proposal's anchor.

type GovernanceProposalMetadataResponse added in v0.85.0

type GovernanceProposalMetadataResponse struct {
	ID           string          `json:"id"`
	TxHash       string          `json:"tx_hash"`
	CertIndex    int             `json:"cert_index"`
	URL          string          `json:"url"`
	Hash         string          `json:"hash"`
	JSONMetadata json.RawMessage `json:"json_metadata"`
	Bytes        string          `json:"bytes"`
}

GovernanceProposalMetadataResponse is the off-chain document behind a proposal's anchor.

type GovernanceProposalParametersInfo added in v0.85.0

type GovernanceProposalParametersInfo struct {
	ID         string
	TxHash     string
	CertIndex  int
	Parameters ProposalParametersResponse
}

GovernanceProposalParametersInfo is the protocol parameter update a parameter change proposal carries.

type GovernanceProposalParametersResponse added in v0.85.0

type GovernanceProposalParametersResponse struct {
	ID         string                     `json:"id"`
	TxHash     string                     `json:"tx_hash"`
	CertIndex  int                        `json:"cert_index"`
	Parameters ProposalParametersResponse `json:"parameters"`
}

GovernanceProposalParametersResponse is the parameter update of a proposal.

type GovernanceProposalResponse added in v0.85.0

type GovernanceProposalResponse struct {
	ID                    string          `json:"id"`
	TxHash                string          `json:"tx_hash"`
	CertIndex             int             `json:"cert_index"`
	GovernanceType        string          `json:"governance_type"`
	GovernanceDescription json.RawMessage `json:"governance_description"`
	Deposit               string          `json:"deposit"`
	ReturnAddress         string          `json:"return_address"`
	RatifiedEpoch         *uint64         `json:"ratified_epoch"`
	EnactedEpoch          *uint64         `json:"enacted_epoch"`
	DroppedEpoch          *uint64         `json:"dropped_epoch"`
	ExpiredEpoch          *uint64         `json:"expired_epoch"`
	Expiration            uint64          `json:"expiration"`
}

GovernanceProposalResponse is a Blockfrost governance proposal.

type GovernanceProposalVoteInfo added in v0.85.0

type GovernanceProposalVoteInfo struct {
	TxHash    string
	CertIndex int
	// VoterRole is constitutional_committee, drep or spo.
	VoterRole string
	Voter     string
	// Vote is yes, no or abstain.
	Vote string
	// Counted is true only for the voter's latest cast on the proposal, and
	// false once its DRep deregistering invalidates the vote.
	Counted bool
}

GovernanceProposalVoteInfo is one vote cast on a proposal.

type GovernanceProposalVoteResponse added in v0.85.0

type GovernanceProposalVoteResponse struct {
	TxHash    string `json:"tx_hash"`
	CertIndex int    `json:"cert_index"`
	VoterRole string `json:"voter_role"`
	Voter     string `json:"voter"`
	Vote      string `json:"vote"`
	Counted   bool   `json:"counted"`
}

GovernanceProposalVoteResponse is one vote cast on a proposal.

type GovernanceWithdrawalInfo added in v0.85.0

type GovernanceWithdrawalInfo struct {
	StakeAddress string
	Amount       string
}

GovernanceWithdrawalInfo is one treasury withdrawal of a proposal.

type GovernanceWithdrawalResponse added in v0.85.0

type GovernanceWithdrawalResponse struct {
	StakeAddress string `json:"stake_address"`
	Amount       string `json:"amount"`
}

GovernanceWithdrawalResponse is one treasury withdrawal of a proposal.

type HealthResponse

type HealthResponse struct {
	IsHealthy bool `json:"is_healthy"`
}

HealthResponse is returned by GET /health.

type MempoolHashResponse added in v0.85.0

type MempoolHashResponse struct {
	TxHash string `json:"tx_hash"`
}

MempoolHashResponse is one entry of a mempool listing.

type MempoolInputResponse added in v0.85.0

type MempoolInputResponse struct {
	Address     *string `json:"address,omitempty"`
	TxHash      string  `json:"tx_hash"`
	OutputIndex int     `json:"output_index"`
	Collateral  bool    `json:"collateral"`
	Reference   *bool   `json:"reference,omitempty"`
}

MempoolInputResponse is one input of a mempool transaction. The address is omitted when the input does not resolve to a confirmed output.

type MempoolOutputResponse added in v0.85.0

type MempoolOutputResponse struct {
	Address             string                  `json:"address"`
	Amount              []AddressAmountResponse `json:"amount"`
	OutputIndex         int                     `json:"output_index"`
	DataHash            *string                 `json:"data_hash"`
	InlineDatum         *string                 `json:"inline_datum"`
	Collateral          bool                    `json:"collateral"`
	ReferenceScriptHash *string                 `json:"reference_script_hash"`
}

MempoolOutputResponse is one output of a mempool transaction.

type MempoolQueryNode added in v0.85.0

type MempoolQueryNode interface {
	// MempoolTransactions returns the paginated hashes of the transactions
	// in the mempool, along with the total before pagination.
	MempoolTransactions(
		ctx context.Context,
		params PaginationParams,
	) ([]string, int, error)

	// MempoolTransaction returns one mempool transaction.
	MempoolTransaction(
		ctx context.Context,
		hash []byte,
	) (MempoolTransactionInfo, error)

	// MempoolAddressTransactions returns the paginated hashes of the
	// mempool transactions that pay to or spend from an address, along with
	// the total before pagination.
	MempoolAddressTransactions(
		ctx context.Context,
		address string,
		params PaginationParams,
	) ([]string, int, error)
}

MempoolQueryNode is the mempool read surface of BlockfrostNode.

type MempoolRedeemerInfo added in v0.85.0

type MempoolRedeemerInfo struct {
	TxIndex   int
	Purpose   string
	UnitMem   string
	UnitSteps string
}

MempoolRedeemerInfo is one redeemer of a mempool transaction.

type MempoolRedeemerResponse added in v0.85.0

type MempoolRedeemerResponse struct {
	TxIndex   int    `json:"tx_index"`
	Purpose   string `json:"purpose"`
	UnitMem   string `json:"unit_mem"`
	UnitSteps string `json:"unit_steps"`
}

MempoolRedeemerResponse is one redeemer of a mempool transaction.

type MempoolTransactionInfo added in v0.85.0

type MempoolTransactionInfo struct {
	Tx        TransactionInfo
	Inputs    []TransactionInputInfo
	Outputs   []TransactionOutputInfo
	Redeemers []MempoolRedeemerInfo
}

MempoolTransactionInfo is one transaction in the mempool. Tx carries only the fields a transaction has before it is in a block.

type MempoolTransactionResponse added in v0.85.0

type MempoolTransactionResponse struct {
	Tx        MempoolTransactionSummaryResponse `json:"tx"`
	Inputs    []MempoolInputResponse            `json:"inputs"`
	Outputs   []MempoolOutputResponse           `json:"outputs"`
	Redeemers []MempoolRedeemerResponse         `json:"redeemers,omitempty"`
}

MempoolTransactionResponse represents a transaction in the mempool.

type MempoolTransactionSummaryResponse added in v0.85.0

type MempoolTransactionSummaryResponse struct {
	Hash               string                  `json:"hash"`
	OutputAmount       []AddressAmountResponse `json:"output_amount"`
	Fees               string                  `json:"fees"`
	Deposit            string                  `json:"deposit"`
	Size               int                     `json:"size"`
	InvalidBefore      *string                 `json:"invalid_before"`
	InvalidHereafter   *string                 `json:"invalid_hereafter"`
	UtxoCount          int                     `json:"utxo_count"`
	WithdrawalCount    int                     `json:"withdrawal_count"`
	MirCertCount       int                     `json:"mir_cert_count"`
	DelegationCount    int                     `json:"delegation_count"`
	StakeCertCount     int                     `json:"stake_cert_count"`
	PoolUpdateCount    int                     `json:"pool_update_count"`
	PoolRetireCount    int                     `json:"pool_retire_count"`
	AssetMintBurnCount int                     `json:"asset_mint_or_burn_count"`
	RedeemerCount      int                     `json:"redeemer_count"`
	ValidContract      bool                    `json:"valid_contract"`
}

MempoolTransactionSummaryResponse holds the fields a transaction has before it is in a block.

type MetadataTransactionCBORInfo

type MetadataTransactionCBORInfo struct {
	TxHash   string
	Metadata string
}

MetadataTransactionCBORInfo holds metadata label query data for the CBOR endpoint.

type MetadataTransactionCBORResponse

type MetadataTransactionCBORResponse struct {
	TxHash       string  `json:"tx_hash"`
	CborMetadata *string `json:"cbor_metadata"`
	Metadata     string  `json:"metadata"`
}

MetadataTransactionCBORResponse represents a Blockfrost metadata label transaction item with CBOR content.

type MetadataTransactionJSONInfo

type MetadataTransactionJSONInfo struct {
	TxHash       string
	JSONMetadata json.RawMessage
}

MetadataTransactionJSONInfo holds metadata label query data for the JSON endpoint.

type MetadataTransactionJSONResponse

type MetadataTransactionJSONResponse struct {
	TxHash       string          `json:"tx_hash"`
	JSONMetadata json.RawMessage `json:"json_metadata"`
}

MetadataTransactionJSONResponse represents a Blockfrost metadata label transaction item with JSON content.

type NetworkEraBound

type NetworkEraBound struct {
	Time  int64  `json:"time"`
	Slot  uint64 `json:"slot"`
	Epoch uint64 `json:"epoch"`
}

NetworkEraBound represents an era boundary.

type NetworkEraBoundInfo

type NetworkEraBoundInfo struct {
	Time  int64
	Slot  uint64
	Epoch uint64
}

NetworkEraBoundInfo holds an era boundary.

type NetworkEraInfo

type NetworkEraInfo struct {
	Era    string
	Start  NetworkEraBoundInfo
	End    *NetworkEraBoundInfo
	Params NetworkEraParamsInfo
}

NetworkEraInfo holds a Blockfrost hard-fork era summary.

type NetworkEraParameters

type NetworkEraParameters struct {
	EpochLength uint64 `json:"epoch_length"`
	SlotLength  uint64 `json:"slot_length"`
	SafeZone    uint64 `json:"safe_zone"`
}

NetworkEraParameters represents era timing parameters.

type NetworkEraParamsInfo

type NetworkEraParamsInfo struct {
	EpochLength uint64
	SlotLength  uint64
	SafeZone    uint64
}

NetworkEraParamsInfo holds era timing parameters.

type NetworkEraResponse

type NetworkEraResponse struct {
	Start      NetworkEraBound      `json:"start"`
	End        *NetworkEraBound     `json:"end"`
	Parameters NetworkEraParameters `json:"parameters"`
}

NetworkEraResponse represents a Blockfrost era summary. Per Blockfrost OpenAPI 0.1.88 (schema network-eras) each item carries only start, end, and parameters; the human-readable era name is intentionally omitted to keep the response shape compatible with the published schema.

type NetworkInfo

type NetworkInfo struct {
	Supply NetworkSupplyInfo
	Stake  NetworkStakeInfo
}

NetworkInfo holds network supply and stake data needed by the API.

type NetworkResponse

type NetworkResponse struct {
	Supply NetworkSupply `json:"supply"`
	Stake  NetworkStake  `json:"stake"`
}

NetworkResponse represents Blockfrost network info.

type NetworkStake

type NetworkStake struct {
	Live   string `json:"live"`
	Active string `json:"active"`
}

NetworkStake holds stake information.

type NetworkStakeInfo

type NetworkStakeInfo struct {
	Live   string
	Active string
}

NetworkStakeInfo holds network stake data needed by the API.

type NetworkSupply

type NetworkSupply struct {
	Max         string `json:"max"`
	Total       string `json:"total"`
	Circulating string `json:"circulating"`
	Locked      string `json:"locked"`
	Treasury    string `json:"treasury"`
	Reserves    string `json:"reserves"`
}

NetworkSupply holds supply information.

type NetworkSupplyInfo

type NetworkSupplyInfo struct {
	Max         string
	Total       string
	Circulating string
	Locked      string
	Treasury    string
	Reserves    string
}

NetworkSupplyInfo holds network supply data needed by the API.

type NodeAdapter

type NodeAdapter struct {
	// contains filtered or unexported fields
}

NodeAdapter wraps a real dingo Node's LedgerState to implement the BlockfrostNode interface.

func NewNodeAdapter

func NewNodeAdapter(
	ls *ledger.LedgerState,
	submitter TransactionSubmitter,
) (*NodeAdapter, error)

NewNodeAdapter creates a NodeAdapter that queries the given LedgerState for blockchain data.

func (*NodeAdapter) Account

func (a *NodeAdapter) Account(
	stakeAddress string,
) (AccountInfo, error)

Account returns stake-account information for the requested stake address.

func (*NodeAdapter) AccountAddressAssets added in v0.85.0

func (a *NodeAdapter) AccountAddressAssets(
	ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AddressAmountInfo, int, error)

AccountAddressAssets returns the native assets held across the addresses of an account.

func (*NodeAdapter) AccountAddressTotal added in v0.85.0

func (a *NodeAdapter) AccountAddressTotal(
	ctx context.Context,
	stakeAddress string,
) (AccountAddressTotalInfo, error)

AccountAddressTotal returns the lifetime received and sent totals across the addresses of an account.

func (*NodeAdapter) AccountAssociatedAddresses

func (a *NodeAdapter) AccountAssociatedAddresses(ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountAssociatedAddressInfo, int, error)

AccountAssociatedAddresses returns payment addresses associated with the requested stake address.

func (*NodeAdapter) AccountDelegationHistory

func (a *NodeAdapter) AccountDelegationHistory(ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountDelegationHistoryInfo, int, error)

AccountDelegationHistory returns delegation history rows for the requested stake address.

func (*NodeAdapter) AccountMIRs added in v0.85.0

func (a *NodeAdapter) AccountMIRs(
	ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountMIRInfo, int, error)

AccountMIRs returns the Move Instantaneous Rewards paid to an account.

func (*NodeAdapter) AccountRegistrationHistory

func (a *NodeAdapter) AccountRegistrationHistory(ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountRegistrationHistoryInfo, int, error)

AccountRegistrationHistory returns registration history rows for the requested stake address.

func (*NodeAdapter) AccountRewardHistory

func (a *NodeAdapter) AccountRewardHistory(ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountRewardHistoryInfo, int, error)

AccountRewardHistory returns reward history rows for the requested stake address.

func (*NodeAdapter) AccountStakeHistory added in v0.85.0

func (a *NodeAdapter) AccountStakeHistory(
	ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountStakeHistoryInfo, int, error)

AccountStakeHistory returns the stake an account held in each retained epoch-boundary distribution, one entry per active epoch. The snapshot labelled E is active in epoch E+1, and only snapshots whose epoch has begun are listed.

Per-credential rows are pruned outside API storage mode and before a node first retained them, so an account whose history may predate the oldest retained row and has no retained row at all is reported as ErrHistoryNotRetained rather than as an empty history. A partly retained history lists the retained epochs. A node with no retained rows at all cannot tell pruning from an account that never held stake, and answers empty.

func (*NodeAdapter) AccountTransactions added in v0.69.0

func (a *NodeAdapter) AccountTransactions(ctx context.Context,
	stakeAddress string,
	params TransactionRangeParams,
) ([]AccountTransactionInfo, int, error)

AccountTransactions returns transactions associated with addresses controlled by the stake credential behind stakeAddress, optionally filtered by an inclusive from/to block-range position.

Every step here is bounded by the requested page size, not by the credential's full transaction history: the (payment address, transaction) association rows are paginated in SQL against address_transaction (which already carries slot/tx_index, so the from/to range is a SQL predicate, not an in-memory filter), and the payment-credential script/key bit and block height/time are then resolved only for the <= count rows on the page.

func (*NodeAdapter) AccountUTXOs added in v0.69.0

func (a *NodeAdapter) AccountUTXOs(ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountUTXOInfo, int, error)

AccountUTXOs returns the current UTxOs controlled by the stake credential behind stakeAddress. It models NodeAdapter.AddressUTXOs, reusing the same CBOR-derived datum/reference-script recovery so the fields stay consistent with /addresses/{address}/utxos and /txs/{hash}/utxos. Unlike a single-address query, each row's address must be recovered per-UTxO from decoded output CBOR, because a stake credential can be shared by many distinct payment addresses.

func (*NodeAdapter) AccountWithdrawals added in v0.69.0

func (a *NodeAdapter) AccountWithdrawals(ctx context.Context,
	stakeAddress string,
	params PaginationParams,
) ([]AccountWithdrawalInfo, int, error)

AccountWithdrawals returns withdrawal history rows for the stake credential behind stakeAddress.

func (*NodeAdapter) Address added in v0.68.0

func (a *NodeAdapter) Address(
	address string,
) (AddressInfo, error)

Address returns summary details for the requested address, with balances aggregated across its live UTxOs. Addresses never seen on chain map to ErrAddressNotFound; addresses with spent history resolve with a zero lovelace balance.

func (*NodeAdapter) AddressAssetUTXOs added in v0.85.0

func (a *NodeAdapter) AddressAssetUTXOs(
	ctx context.Context,
	address string,
	policyID string,
	assetName []byte,
	params PaginationParams,
) ([]AddressUTXOInfo, int, error)

AddressAssetUTXOs returns the paginated current UTxOs of an address that hold the given asset.

func (*NodeAdapter) AddressExtended added in v0.85.0

func (a *NodeAdapter) AddressExtended(
	ctx context.Context,
	address string,
) (AddressExtendedInfo, error)

AddressExtended returns the address summary with registry decimals and the on-chain metadata flag of every asset held.

func (*NodeAdapter) AddressTotal added in v0.85.0

func (a *NodeAdapter) AddressTotal(
	ctx context.Context,
	address string,
) (AddressTotalInfo, error)

AddressTotal sums everything an address has ever received and sent. Every output paid to the address counts as received and every such output that has since been spent counts as sent, so the figures rest on the spent output history API storage mode retains.

func (*NodeAdapter) AddressTransactions

func (a *NodeAdapter) AddressTransactions(
	ctx context.Context,
	address string,
	params TransactionRangeParams,
) ([]AddressTransactionInfo, int, error)

AddressTransactions returns paginated transaction history for the requested address.

func (*NodeAdapter) AddressUTXOs

func (a *NodeAdapter) AddressUTXOs(ctx context.Context,
	address string,
	params PaginationParams,
) ([]AddressUTXOInfo, int, error)

func (*NodeAdapter) Asset

func (a *NodeAdapter) Asset(
	policyID string,
	assetName []byte,
) (AssetInfo, error)

Asset returns native asset information for a policy ID and raw asset name bytes.

func (*NodeAdapter) AssetAddresses added in v0.62.0

func (a *NodeAdapter) AssetAddresses(
	ctx context.Context,
	policyID string,
	assetName []byte,
	params PaginationParams,
) ([]AssetHolderInfo, int, error)

AssetAddresses returns paginated addresses currently holding the given asset.

func (*NodeAdapter) AssetHistory added in v0.85.0

func (a *NodeAdapter) AssetHistory(
	ctx context.Context,
	policyID string,
	assetName []byte,
	params PaginationParams,
) ([]AssetHistoryItemInfo, int, error)

AssetHistory returns the mint and burn events of an asset in chain order.

func (*NodeAdapter) AssetTransactions added in v0.85.0

func (a *NodeAdapter) AssetTransactions(
	ctx context.Context,
	policyID string,
	assetName []byte,
	params TransactionRangeParams,
) ([]AssetTransactionInfo, int, error)

AssetTransactions returns the transactions involving an asset in chain order, within the optional block range.

func (*NodeAdapter) AssetUTXOs added in v0.85.0

func (a *NodeAdapter) AssetUTXOs(
	ctx context.Context,
	policyID string,
	assetName []byte,
	params TransactionRangeParams,
) ([]AssetUTXOInfo, int, error)

AssetUTXOs returns the current UTxOs holding an asset in producing order. A block range bounds the producing transaction's position; the count and the page are both cut in SQL.

func (*NodeAdapter) Assets added in v0.85.0

func (a *NodeAdapter) Assets(
	ctx context.Context,
	params PaginationParams,
) ([]AssetListItemInfo, int, error)

Assets returns the assets with a recorded mint or burn, oldest first. The quantity of each is its live holdings, as in the single asset lookup.

func (*NodeAdapter) AssetsByPolicy added in v0.85.0

func (a *NodeAdapter) AssetsByPolicy(
	ctx context.Context,
	policyID string,
	params PaginationParams,
) ([]AssetListItemInfo, int, error)

AssetsByPolicy returns the assets minted under one policy.

func (*NodeAdapter) BlockAddresses added in v0.85.0

func (a *NodeAdapter) BlockAddresses(
	ctx context.Context,
	id string,
) ([]BlockAddressInfo, error)

BlockAddresses returns every address a block's transactions pay to or spend from. Output addresses come from the decoded block. Input addresses are recovered from the stored UTxOs the transactions consumed, which only the metadata index records. A phase-2 invalid transaction touches its collateral inputs and collateral return instead of its regular inputs and outputs.

func (*NodeAdapter) BlockByEpochSlot added in v0.85.0

func (a *NodeAdapter) BlockByEpochSlot(
	ctx context.Context,
	epoch uint64,
	epochSlot uint64,
) (BlockInfo, error)

BlockByEpochSlot returns the block produced in a slot counted from the start of an epoch.

func (*NodeAdapter) BlockByHashOrNumber

func (a *NodeAdapter) BlockByHashOrNumber(
	id string,
) (BlockInfo, error)

BlockByHashOrNumber returns block information by hash or height.

func (*NodeAdapter) BlockBySlot added in v0.85.0

func (a *NodeAdapter) BlockBySlot(
	ctx context.Context,
	slot uint64,
) (BlockInfo, error)

BlockBySlot returns the block produced in an absolute slot.

func (*NodeAdapter) BlockNext added in v0.85.0

func (a *NodeAdapter) BlockNext(
	ctx context.Context,
	id string,
	params PaginationParams,
) ([]BlockInfo, int, error)

BlockNext returns the blocks that follow the identified block.

func (*NodeAdapter) BlockPrevious added in v0.85.0

func (a *NodeAdapter) BlockPrevious(
	ctx context.Context,
	id string,
	params PaginationParams,
) ([]BlockInfo, int, error)

BlockPrevious returns the blocks that precede the identified block.

func (*NodeAdapter) BlockTransactionCBOR added in v0.85.0

func (a *NodeAdapter) BlockTransactionCBOR(
	ctx context.Context,
	id string,
) ([]BlockTransactionCBORInfo, error)

BlockTransactionCBOR returns the transactions of a block with their raw CBOR, in block order.

func (*NodeAdapter) BlockTransactionHashes added in v0.85.0

func (a *NodeAdapter) BlockTransactionHashes(
	ctx context.Context,
	id string,
) ([]string, error)

BlockTransactionHashes returns the transaction hashes of a block in block order.

func (*NodeAdapter) ChainTip

func (a *NodeAdapter) ChainTip() (
	ChainTipInfo, error,
)

ChainTip returns the current chain tip from the ledger state.

func (*NodeAdapter) CommitteeVotes added in v0.85.0

func (a *NodeAdapter) CommitteeVotes(
	ctx context.Context,
	credential *CommitteeCredentialRef,
	cold bool,
	params PaginationParams,
) ([]CommitteeVoteInfo, int, error)

CommitteeVotes returns the votes cast by committee members. A cold credential selects the votes of every hot credential it has authorized; a hot one selects only its own.

func (*NodeAdapter) CurrentEpoch

func (a *NodeAdapter) CurrentEpoch() (
	EpochInfo, error,
)

CurrentEpoch returns information about the current epoch.

func (*NodeAdapter) CurrentProtocolParams

func (a *NodeAdapter) CurrentProtocolParams() (
	ProtocolParamsInfo, error,
)

CurrentProtocolParams returns the current protocol parameters, with any synthetic (not-yet-real) PlutusV2 cost model omitted -- see LedgerState.GetCurrentPParamsForReporting. This is a reporting surface (GET /epochs/latest/parameters, and other callers' non-cost-model numeric reads), not an internal validation/fee-computation path, so the filtered view is correct here.

func (*NodeAdapter) DRep

func (a *NodeAdapter) DRep(
	ctx context.Context,
	credential DRepCredential,
) (DRepInfo, error)

DRep returns governance DRep information for the requested credential.

func (*NodeAdapter) DRepDelegators added in v0.85.0

func (a *NodeAdapter) DRepDelegators(
	ctx context.Context,
	credential DRepCredential,
	params PaginationParams,
) ([]DRepDelegatorInfo, int, error)

DRepDelegators returns the registered delegators of a DRep with their live stake.

func (*NodeAdapter) DRepMetadata added in v0.85.0

func (a *NodeAdapter) DRepMetadata(
	ctx context.Context,
	credential DRepCredential,
) (DRepAnchorInfo, error)

DRepMetadata returns the off-chain document behind a DRep's current anchor. A DRep with no anchor reports ErrDRepNotFound.

func (*NodeAdapter) DRepUpdates added in v0.85.0

func (a *NodeAdapter) DRepUpdates(
	ctx context.Context,
	credential DRepCredential,
	params PaginationParams,
) ([]DRepUpdateInfo, int, error)

DRepUpdates returns a DRep's registration, update and deregistration certificates.

func (*NodeAdapter) DRepVotes added in v0.85.0

func (a *NodeAdapter) DRepVotes(
	ctx context.Context,
	credential DRepCredential,
	params PaginationParams,
) ([]DRepVoteInfo, int, error)

DRepVotes returns the votes a DRep cast.

func (*NodeAdapter) DReps added in v0.68.0

func (a *NodeAdapter) DReps(
	ctx context.Context,
	params DRepListParams,
) ([]DRepListItemInfo, int, error)

DReps returns the paginated DRep list. Default ordering follows the credential's first on-chain appearance; order_by=amount sorts by delegated voting power with appearance order as the tie-break. The special always-abstain / always-no-confidence DReps are interleaved at the position of their first delegation, matching hosted Blockfrost.

func (*NodeAdapter) DatumCBOR added in v0.85.0

func (a *NodeAdapter) DatumCBOR(
	_ context.Context,
	hash []byte,
) (string, error)

DatumCBOR returns the hex CBOR of a datum.

func (*NodeAdapter) DatumJSON added in v0.85.0

func (a *NodeAdapter) DatumJSON(
	_ context.Context,
	hash []byte,
) (json.RawMessage, error)

DatumJSON returns the detailed-schema JSON of a datum.

func (*NodeAdapter) Epoch added in v0.85.0

func (a *NodeAdapter) Epoch(
	ctx context.Context,
	epoch uint64,
) (EpochInfo, error)

Epoch returns the requested epoch.

func (*NodeAdapter) EpochBlocks added in v0.85.0

func (a *NodeAdapter) EpochBlocks(
	ctx context.Context,
	epoch uint64,
	params PaginationParams,
) ([]string, int, error)

EpochBlocks returns the hashes of the blocks minted in an epoch.

func (*NodeAdapter) EpochPoolBlocks added in v0.85.0

func (a *NodeAdapter) EpochPoolBlocks(
	ctx context.Context,
	epoch uint64,
	poolID string,
	params PaginationParams,
) ([]string, int, error)

EpochPoolBlocks returns the hashes of the blocks one pool minted in an epoch.

func (*NodeAdapter) EpochPoolStakes added in v0.85.0

func (a *NodeAdapter) EpochPoolStakes(
	ctx context.Context,
	epoch uint64,
	poolID string,
	params PaginationParams,
) ([]EpochPoolStakeInfo, int, error)

EpochPoolStakes returns one pool's stake distribution active in an epoch.

func (*NodeAdapter) EpochProtocolParams

func (a *NodeAdapter) EpochProtocolParams(
	epoch uint64,
) (ProtocolParamsInfo, error)

EpochProtocolParams returns protocol parameters for the requested epoch.

func (*NodeAdapter) EpochStakes added in v0.85.0

func (a *NodeAdapter) EpochStakes(
	ctx context.Context,
	epoch uint64,
	params PaginationParams,
) ([]EpochStakeInfo, int, error)

EpochStakes returns the stake distribution active in an epoch.

func (*NodeAdapter) EpochsAfter added in v0.85.0

func (a *NodeAdapter) EpochsAfter(
	ctx context.Context,
	epoch uint64,
	params PaginationParams,
) ([]EpochInfo, int, error)

EpochsAfter returns the epochs following epoch in ascending order.

func (*NodeAdapter) EpochsBefore added in v0.85.0

func (a *NodeAdapter) EpochsBefore(
	ctx context.Context,
	epoch uint64,
	params PaginationParams,
) ([]EpochInfo, int, error)

EpochsBefore returns the epochs preceding epoch, nearest first.

func (*NodeAdapter) Genesis

func (a *NodeAdapter) Genesis() (GenesisInfo, error)

Genesis returns Shelley genesis configuration values.

func (*NodeAdapter) GovernanceCommittee added in v0.85.0

func (a *NodeAdapter) GovernanceCommittee(
	ctx context.Context,
) (CommitteeInfo, error)

GovernanceCommittee returns the constitutional committee.

func (*NodeAdapter) GovernanceProposal added in v0.85.0

func (a *NodeAdapter) GovernanceProposal(
	ctx context.Context,
	ref GovActionRef,
) (GovernanceProposalDetailInfo, error)

GovernanceProposal returns a proposal and its lifecycle.

func (*NodeAdapter) GovernanceProposalMetadata added in v0.85.0

func (a *NodeAdapter) GovernanceProposalMetadata(
	ctx context.Context,
	ref GovActionRef,
) (GovernanceProposalMetadataInfo, error)

GovernanceProposalMetadata returns the off-chain document behind a proposal's anchor. It reports models.ErrGovernanceProposalNotFound when the document has not been fetched.

func (*NodeAdapter) GovernanceProposalParameters added in v0.85.0

func (a *NodeAdapter) GovernanceProposalParameters(
	ctx context.Context,
	ref GovActionRef,
) (GovernanceProposalParametersInfo, error)

GovernanceProposalParameters returns the parameter update of a parameter change proposal. Any other proposal type has none and reports models.ErrGovernanceProposalNotFound.

func (*NodeAdapter) GovernanceProposalVotes added in v0.85.0

func (a *NodeAdapter) GovernanceProposalVotes(
	ctx context.Context,
	ref GovActionRef,
	params PaginationParams,
) ([]GovernanceProposalVoteInfo, int, error)

GovernanceProposalVotes returns the votes cast on a proposal.

func (*NodeAdapter) GovernanceProposalWithdrawals added in v0.85.0

func (a *NodeAdapter) GovernanceProposalWithdrawals(
	ctx context.Context,
	ref GovActionRef,
	params PaginationParams,
) ([]GovernanceWithdrawalInfo, int, error)

GovernanceProposalWithdrawals returns the treasury withdrawals of a proposal; any other proposal type has none.

func (*NodeAdapter) GovernanceProposals added in v0.85.0

func (a *NodeAdapter) GovernanceProposals(
	ctx context.Context,
	params PaginationParams,
) ([]GovernanceProposalInfo, int, error)

GovernanceProposals returns the paginated proposal list.

func (*NodeAdapter) LatestBlock

func (a *NodeAdapter) LatestBlock() (
	BlockInfo, error,
)

LatestBlock returns information about the latest block.

func (*NodeAdapter) LatestBlockTransactionCBOR added in v0.85.0

func (a *NodeAdapter) LatestBlockTransactionCBOR(
	ctx context.Context,
) ([]BlockTransactionCBORInfo, error)

LatestBlockTransactionCBOR returns the transactions of the chain tip block with their raw CBOR, in block order.

func (*NodeAdapter) LatestBlockTxHashes

func (a *NodeAdapter) LatestBlockTxHashes() (
	[]string, error,
)

LatestBlockTxHashes returns transaction hashes from the latest block.

func (*NodeAdapter) MempoolAddressTransactions added in v0.85.0

func (a *NodeAdapter) MempoolAddressTransactions(
	ctx context.Context,
	address string,
	params PaginationParams,
) ([]string, int, error)

MempoolAddressTransactions returns the hashes of the mempool transactions that pay to an address or spend one of its confirmed outputs, in admission order. A transaction marked as failing phase 2 pays only its collateral return and spends only its collateral, as when it is applied.

func (*NodeAdapter) MempoolTransaction added in v0.85.0

func (a *NodeAdapter) MempoolTransaction(
	ctx context.Context,
	hash []byte,
) (MempoolTransactionInfo, error)

MempoolTransaction returns one mempool transaction in the shape of a transaction that is not yet in a block.

func (*NodeAdapter) MempoolTransactions added in v0.85.0

func (a *NodeAdapter) MempoolTransactions(
	ctx context.Context,
	params PaginationParams,
) ([]string, int, error)

MempoolTransactions returns the hashes of the mempool transactions in admission order. An ascending page reads only the prefix of the pool it needs; a descending page starts at the newest transaction, so it reads the pool whole, which its capacity bounds.

func (*NodeAdapter) MetadataTransactions

func (a *NodeAdapter) MetadataTransactions(
	label uint64,
	params PaginationParams,
) ([]MetadataTransactionJSONInfo, int, error)

MetadataTransactions returns paginated transaction metadata values for the requested label in JSON form.

func (*NodeAdapter) MetadataTransactionsCBOR

func (a *NodeAdapter) MetadataTransactionsCBOR(
	label uint64,
	params PaginationParams,
) ([]MetadataTransactionCBORInfo, int, error)

MetadataTransactionsCBOR returns paginated transaction metadata values for the requested label in CBOR-hex form.

func (*NodeAdapter) Network

func (a *NodeAdapter) Network() (NetworkInfo, error)

Network returns current network supply and stake information.

func (*NodeAdapter) NetworkEras

func (a *NodeAdapter) NetworkEras() ([]NetworkEraInfo, error)

NetworkEras returns hard-fork era summaries.

func (*NodeAdapter) PoolBlocks added in v0.85.0

func (a *NodeAdapter) PoolBlocks(
	ctx context.Context,
	poolID string,
	params PaginationParams,
) ([]string, int, error)

PoolBlocks returns the hashes of the blocks a pool minted.

func (*NodeAdapter) PoolDelegators added in v0.85.0

func (a *NodeAdapter) PoolDelegators(
	ctx context.Context,
	poolID string,
	params PaginationParams,
) ([]PoolDelegatorInfo, int, error)

PoolDelegators returns the registered delegators of a pool.

func (*NodeAdapter) PoolDetail added in v0.69.0

func (a *NodeAdapter) PoolDetail(ctx context.Context, poolID string) (PoolDetailInfo, error)

PoolDetail returns the OpenAPI pool detail object for the requested pool (bech32 or hex ID). Epoch-sensitive aggregates (active stake, saturation, blocks_epoch) are computed for the current epoch.

func (*NodeAdapter) PoolHistory added in v0.85.0

func (a *NodeAdapter) PoolHistory(
	ctx context.Context,
	poolID string,
	params PaginationParams,
) ([]PoolHistoryInfo, int, error)

PoolHistory returns a pool's per-epoch stake, size, blocks and rewards. The snapshot labelled E is the distribution active in epoch E+1, so a row reports epoch E+1 and only snapshots whose epoch has begun are listed.

func (*NodeAdapter) PoolMetadata added in v0.69.0

func (a *NodeAdapter) PoolMetadata(
	poolID string,
) (PoolMetadataInfo, error)

PoolMetadata returns the registered metadata for the requested pool: the on-chain anchor from the latest registration plus the off-chain document fields when the cached fetch succeeded.

func (*NodeAdapter) PoolRelays added in v0.85.0

func (a *NodeAdapter) PoolRelays(
	ctx context.Context,
	poolID string,
) ([]PoolRelayInfo, error)

PoolRelays returns the relays of the pool's latest registration.

func (*NodeAdapter) PoolUpdates added in v0.85.0

func (a *NodeAdapter) PoolUpdates(
	ctx context.Context,
	poolID string,
	params PaginationParams,
) ([]PoolUpdateInfo, int, error)

PoolUpdates returns a pool's registration and retirement certificates.

func (*NodeAdapter) PoolVotes added in v0.85.0

func (a *NodeAdapter) PoolVotes(
	ctx context.Context,
	poolID string,
	params PaginationParams,
) ([]PoolVoteInfo, int, error)

PoolVotes returns the votes a pool cast.

func (*NodeAdapter) PoolsExtended

func (a *NodeAdapter) PoolsExtended(
	ctx context.Context,
	params PaginationParams,
) (
	[]PoolExtendedInfo, int, error,
)

PoolsExtended returns the current active pools with the fields required by the Blockfrost OpenAPI 0.1.90 pool_list_extended schema (active/live stake, blocks_minted, live_saturation, margin/pledge/cost, and the nullable off-chain metadata object).

func (*NodeAdapter) PoolsList added in v0.69.0

func (a *NodeAdapter) PoolsList(ctx context.Context,
	params PaginationParams,
) ([]string, int, error)

PoolsList returns the paginated list of currently registered (active, non-retired) stake pool IDs, along with the total number of matching results before pagination.

Ordering: the store query (GetActivePoolKeyHashesOrdered) returns every active pool key hash already sorted oldest-first by each pool's FIRST on-chain registration certificate -- not its most recent one -- which is the chain-derived order the pool_list schema's "oldest first, newest last" wording calls for (see poolorder.GetActivePoolKeyHashesOrdered's doc comment for the full rationale, including why this is a deliberate, reversible semantic choice rather than one the schema pins). asc uses that order as-is; desc reverses the same slice, so the two are exact reverses of each other by construction rather than by two independently-sorted queries agreeing. This ordering and the active/retired determination are verified identical across sqlite, postgres, and mysql against the same 8-pool fixture: see TestNodeAdapterPoolsListOrderingAndActiveSet (pools_list_test.go) and its direct-store postgres/mysql counterparts (database/plugin/metadata/{postgres,mysql}/pool_active_ordered_test.go).

Query cost: the result is one row per active pool (~3,000 on mainnet), the same result-set shape PoolsExtended already reads via GetActivePoolKeyHashes/GetActivePoolKeyHashesAtSlot; no per-page query is added. The underlying scan cost is bounded by the total historical pool_registration row count instead (verified via EXPLAIN on all three backends, see DATABASE.md), since the added_slot filter can't use the (pool_id, added_slot) index on any backend -- the same bound GetActivePoolKeyHashesAtSlot already pays for PoolsExtended. Pagination is applied in memory (slice), matching PoolsRetiring (GetRetiringPools + PoolsRetiring) rather than pushing LIMIT/OFFSET into SQL: the ORDER BY here is derived from a per-pool window-function ranking computed across the full registration/retirement history, so the whole active set must be ranked before any page boundary can be determined -- a SQL-side LIMIT/OFFSET would trim rows only after that ranking work is done, and would not reduce it. The response is bare pool ID strings, so slicing the resulting hash slice in memory before conversion is cheap relative to that query.

func (*NodeAdapter) PoolsRetired added in v0.85.0

func (a *NodeAdapter) PoolsRetired(
	ctx context.Context,
	params PaginationParams,
) ([]PoolRetiringInfo, int, error)

PoolsRetired returns the pools whose retirement has taken effect.

func (*NodeAdapter) PoolsRetiring added in v0.69.0

func (a *NodeAdapter) PoolsRetiring(
	ctx context.Context,
	params PaginationParams,
) ([]PoolRetiringInfo, int, error)

PoolsRetiring returns the paginated list of pools with a pending retirement: a retirement certificate for a future epoch that has not been cancelled by a later re-registration. Entries are ordered by retirement epoch and then announcement position, matching hosted Blockfrost.

func (*NodeAdapter) Script added in v0.85.0

func (a *NodeAdapter) Script(
	_ context.Context,
	hash []byte,
) (ScriptInfo, error)

Script returns the language of a script and, for a Plutus script, the size of its CBOR serialisation.

func (*NodeAdapter) ScriptCBOR added in v0.85.0

func (a *NodeAdapter) ScriptCBOR(
	_ context.Context,
	hash []byte,
) (*string, error)

ScriptCBOR returns the hex CBOR of a Plutus script. A native script yields nil.

func (*NodeAdapter) ScriptJSON added in v0.85.0

func (a *NodeAdapter) ScriptJSON(
	_ context.Context,
	hash []byte,
) (json.RawMessage, error)

ScriptJSON returns the JSON form of a native script. A Plutus script has no JSON form and yields nil.

func (*NodeAdapter) ScriptRedeemers added in v0.85.0

func (a *NodeAdapter) ScriptRedeemers(
	ctx context.Context,
	hash []byte,
	params PaginationParams,
) ([]ScriptRedeemerInfo, int, error)

ScriptRedeemers returns the redeemers that executed a script in chain order. Only transactions applied since the script index existed are listed.

func (*NodeAdapter) ScriptUTXOs added in v0.85.0

func (a *NodeAdapter) ScriptUTXOs(
	ctx context.Context,
	hash []byte,
	params PaginationParams,
) ([]ScriptUTXOInfo, int, error)

ScriptUTXOs returns the live UTxOs carrying the script as a reference script. Only outputs recorded since the script index existed are listed.

func (*NodeAdapter) Scripts added in v0.85.0

func (a *NodeAdapter) Scripts(
	ctx context.Context,
	params PaginationParams,
) ([]string, int, error)

Scripts returns the hashes of the stored scripts in the order they were first recorded.

func (*NodeAdapter) Transaction

func (a *NodeAdapter) Transaction(
	hash []byte,
) (TransactionInfo, error)

Transaction returns summary details for the requested transaction.

func (*NodeAdapter) TransactionCBOR

func (a *NodeAdapter) TransactionCBOR(
	hash []byte,
) ([]byte, error)

TransactionCBOR returns raw signed transaction CBOR bytes for the requested transaction hash.

func (*NodeAdapter) TransactionDelegations

func (a *NodeAdapter) TransactionDelegations(
	hash []byte,
) ([]TransactionDelegationInfo, error)

TransactionDelegations returns delegation certificates in the requested transaction.

func (*NodeAdapter) TransactionEvaluate added in v0.70.2

func (a *NodeAdapter) TransactionEvaluate(
	ctx context.Context,
	txCbor []byte,
) (TransactionEvaluationResponse, error)

TransactionEvaluate evaluates script execution units for raw transaction CBOR without submitting the transaction.

func (*NodeAdapter) TransactionMIRs

func (a *NodeAdapter) TransactionMIRs(
	hash []byte,
) ([]TransactionMIRInfo, error)

TransactionMIRs returns MIR certificate reward targets in the requested transaction.

func (*NodeAdapter) TransactionMetadata

func (a *NodeAdapter) TransactionMetadata(
	hash []byte,
) ([]TransactionMetadataInfo, error)

TransactionMetadata returns metadata labels for the requested transaction as JSON values.

func (*NodeAdapter) TransactionMetadataCBOR

func (a *NodeAdapter) TransactionMetadataCBOR(
	hash []byte,
) ([]TransactionMetadataCBORInfo, error)

TransactionMetadataCBOR returns metadata labels for the requested transaction as CBOR hex values.

func (*NodeAdapter) TransactionPoolRetires

func (a *NodeAdapter) TransactionPoolRetires(
	hash []byte,
) ([]TransactionPoolRetireInfo, error)

TransactionPoolRetires returns pool retirement certificates in the requested transaction.

func (*NodeAdapter) TransactionPoolUpdates

func (a *NodeAdapter) TransactionPoolUpdates(
	hash []byte,
) ([]TransactionPoolUpdateInfo, error)

TransactionPoolUpdates returns pool registration certificates in the requested transaction.

func (*NodeAdapter) TransactionRedeemers

func (a *NodeAdapter) TransactionRedeemers(
	hash []byte,
) ([]TransactionRedeemerInfo, error)

TransactionRedeemers returns Plutus redeemers stored for the requested transaction.

func (*NodeAdapter) TransactionRequiredSigners

func (a *NodeAdapter) TransactionRequiredSigners(
	hash []byte,
) ([]TransactionRequiredSignerInfo, error)

TransactionRequiredSigners returns the required signers (extra signing key hashes) declared in the requested transaction.

func (*NodeAdapter) TransactionStakeAddresses

func (a *NodeAdapter) TransactionStakeAddresses(
	hash []byte,
) ([]TransactionStakeAddressInfo, error)

TransactionStakeAddresses returns stake registration/deregistration certificates in the requested transaction.

func (*NodeAdapter) TransactionSubmit

func (a *NodeAdapter) TransactionSubmit(
	ctx context.Context,
	txCbor []byte,
) (string, error)

TransactionSubmit submits raw signed transaction CBOR to the mempool.

func (*NodeAdapter) TransactionUTXOs

func (a *NodeAdapter) TransactionUTXOs(
	hash []byte,
) (TransactionUTXOsInfo, error)

TransactionUTXOs returns inputs and outputs for the requested transaction.

func (*NodeAdapter) TransactionWithdrawals

func (a *NodeAdapter) TransactionWithdrawals(
	hash []byte,
) ([]TransactionWithdrawalInfo, error)

TransactionWithdrawals returns reward withdrawals in the requested transaction.

type OffchainFetchErrorInfo added in v0.69.0

type OffchainFetchErrorInfo struct {
	Code    string
	Message string
}

OffchainFetchErrorInfo describes a failed off-chain metadata fetch in Blockfrost's error-object form.

type OffchainFetchErrorResponse added in v0.69.0

type OffchainFetchErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

OffchainFetchErrorResponse is the Blockfrost error object attached to metadata whose off-chain document fetch failed.

type PaginationParams

type PaginationParams struct {
	Count int
	Page  int
	Order string
}

PaginationParams contains parsed pagination query values.

func ParsePagination

func ParsePagination(r *http.Request) (PaginationParams, error)

ParsePagination parses pagination query parameters and applies defaults and bounds clamping.

func ParsePaginationStrict added in v0.68.0

func ParsePaginationStrict(r *http.Request) (PaginationParams, string)

ParsePaginationStrict parses pagination query parameters with Blockfrost-compatible validation: out-of-range values are rejected with the hosted API's exact fastify error message instead of being clamped. The second return value is the error message, empty when parsing succeeded.

type PoolCalidusKeyInfo added in v0.69.0

type PoolCalidusKeyInfo struct {
	ID          string
	PubKey      string
	Nonce       uint64
	TxHash      string
	BlockHeight uint64
	BlockTime   int64
	Epoch       uint64
}

PoolCalidusKeyInfo holds a pool's latest valid CIP-0088 Calidus key registration (Blockfrost's calidus_key object). dingo does not currently ingest Calidus key registrations from any source, so every BlockfrostNode implementation returns a nil *PoolCalidusKeyInfo here; the type exists so PoolDetailInfo mirrors the OpenAPI schema exactly.

type PoolCalidusKeyResponse added in v0.69.0

type PoolCalidusKeyResponse struct {
	ID          string `json:"id"`
	PubKey      string `json:"pub_key"`
	Nonce       uint64 `json:"nonce"`
	TxHash      string `json:"tx_hash"`
	BlockHeight uint64 `json:"block_height"`
	BlockTime   int64  `json:"block_time"`
	Epoch       uint64 `json:"epoch"`
}

PoolCalidusKeyResponse represents a pool's latest valid CIP-0088 Calidus key registration. dingo does not ingest Calidus key registrations from any source, so this field is always null in responses.

type PoolDelegatorInfo added in v0.85.0

type PoolDelegatorInfo struct {
	Address   string
	LiveStake string
}

PoolDelegatorInfo is one delegator of a pool.

type PoolDelegatorResponse added in v0.85.0

type PoolDelegatorResponse struct {
	Address   string `json:"address"`
	LiveStake string `json:"live_stake"`
}

PoolDelegatorResponse is one delegator of a pool.

type PoolDetailInfo added in v0.69.0

type PoolDetailInfo struct {
	PoolID         string
	Hex            string
	VrfKey         string
	LiveStake      string
	ActiveStake    string
	DeclaredPledge string
	LivePledge     string
	FixedCost      string
	RewardAccount  string
	Owners         []string
	// Registration and Retirement are the transaction hashes of the pool's
	// registration and retirement certificates, oldest first. Certificates
	// with no linked transaction (rows synthesized by a Mithril
	// ledger-state import) are excluded since they have no originating
	// transaction to report.
	Registration   []string
	Retirement     []string
	CalidusKey     *PoolCalidusKeyInfo
	BlocksMinted   uint64
	BlocksEpoch    uint64
	LiveDelegators uint64
	LiveSize       float64
	LiveSaturation float64
	ActiveSize     float64
	MarginCost     float64
}

PoolDetailInfo holds pool data needed by the /pools/{pool_id} endpoint, following the Blockfrost OpenAPI 0.1.90 pool schema.

type PoolDetailResponse added in v0.69.0

type PoolDetailResponse struct {
	PoolID         string                  `json:"pool_id"`
	Hex            string                  `json:"hex"`
	VrfKey         string                  `json:"vrf_key"`
	BlocksMinted   uint64                  `json:"blocks_minted"`
	BlocksEpoch    uint64                  `json:"blocks_epoch"`
	LiveStake      string                  `json:"live_stake"`
	LiveSize       float64                 `json:"live_size"`
	LiveSaturation float64                 `json:"live_saturation"`
	LiveDelegators uint64                  `json:"live_delegators"`
	ActiveStake    string                  `json:"active_stake"`
	ActiveSize     float64                 `json:"active_size"`
	DeclaredPledge string                  `json:"declared_pledge"`
	LivePledge     string                  `json:"live_pledge"`
	MarginCost     float64                 `json:"margin_cost"`
	FixedCost      string                  `json:"fixed_cost"`
	RewardAccount  string                  `json:"reward_account"`
	Owners         []string                `json:"owners"`
	Registration   []string                `json:"registration"`
	Retirement     []string                `json:"retirement"`
	CalidusKey     *PoolCalidusKeyResponse `json:"calidus_key"`
}

PoolDetailResponse represents a Blockfrost pool detail object (OpenAPI 0.1.90 pool schema).

type PoolExtendedInfo

type PoolExtendedInfo struct {
	PoolID         string
	Hex            string
	ActiveStake    string
	LiveStake      string
	BlocksMinted   uint64
	LiveSaturation float64
	DeclaredPledge string
	MarginCost     float64
	FixedCost      string
	Metadata       *PoolExtendedMetadataInfo
}

PoolExtendedInfo holds pool data needed by the /pools/extended endpoint, following the Blockfrost OpenAPI 0.1.90 pool_list_extended schema. Neither vrf_key nor relays is part of that schema (vrf_key belongs to the pool-detail schema instead; see PoolDetailInfo), so this type omits both.

type PoolExtendedMetadataInfo added in v0.69.0

type PoolExtendedMetadataInfo struct {
	URL         *string
	Hash        *string
	Ticker      *string
	Name        *string
	Description *string
	Homepage    *string
	Error       *OffchainFetchErrorInfo
}

PoolExtendedMetadataInfo holds the nullable metadata object nested in pool_list_extended: the on-chain anchor (URL/hash) plus the off-chain document fields when fetched and validated, or Error when the fetch or validation failed. A nil *PoolExtendedMetadataInfo means the pool has no registered metadata anchor at all (metadata: null); this mirrors PoolMetadataInfo's fields but omits PoolID/Hex, which pool_list_extended carries at the parent object level instead of inside metadata.

type PoolExtendedMetadataResponse added in v0.69.0

type PoolExtendedMetadataResponse struct {
	URL         *string                     `json:"url"`
	Hash        *string                     `json:"hash"`
	Ticker      *string                     `json:"ticker"`
	Name        *string                     `json:"name"`
	Description *string                     `json:"description"`
	Homepage    *string                     `json:"homepage"`
	Error       *OffchainFetchErrorResponse `json:"error,omitempty"`
}

PoolExtendedMetadataResponse represents pool_list_extended's nullable metadata object. It mirrors PoolMetadataResponse's off-chain fields (minus pool_id/hex, which pool_list_extended carries at the parent level) and is omitted (metadata: null) entirely when the pool has no registered metadata anchor.

type PoolExtendedResponse

type PoolExtendedResponse struct {
	PoolID         string                        `json:"pool_id"`
	Hex            string                        `json:"hex"`
	ActiveStake    string                        `json:"active_stake"`
	LiveStake      string                        `json:"live_stake"`
	BlocksMinted   uint64                        `json:"blocks_minted"`
	LiveSaturation float64                       `json:"live_saturation"`
	DeclaredPledge string                        `json:"declared_pledge"`
	MarginCost     float64                       `json:"margin_cost"`
	FixedCost      string                        `json:"fixed_cost"`
	Metadata       *PoolExtendedMetadataResponse `json:"metadata"`
}

PoolExtendedResponse represents an extended stake pool list item, following the Blockfrost OpenAPI 0.1.90 pool_list_extended schema exactly. Neither vrf_key nor relays is part of that schema (vrf_key belongs to the pool-detail schema instead; see PoolDetailResponse), so this type omits both.

type PoolHistoryInfo added in v0.85.0

type PoolHistoryInfo struct {
	Epoch uint64
	// Blocks is the number of blocks the pool minted in the epoch.
	Blocks int
	// ActiveStake is the pool's active stake in lovelace.
	ActiveStake string
	// ActiveSize is the pool's share of the network's active stake.
	ActiveSize      float64
	DelegatorsCount uint64
	// Rewards is the lovelace distributed to the pool's delegators.
	Rewards string
	// Fees is the lovelace the pool operator earned.
	Fees string
}

PoolHistoryInfo is one epoch of a pool's history.

type PoolHistoryResponse added in v0.85.0

type PoolHistoryResponse struct {
	Epoch           uint64  `json:"epoch"`
	Blocks          int     `json:"blocks"`
	ActiveStake     string  `json:"active_stake"`
	ActiveSize      float64 `json:"active_size"`
	DelegatorsCount uint64  `json:"delegators_count"`
	Rewards         string  `json:"rewards"`
	Fees            string  `json:"fees"`
}

PoolHistoryResponse is one epoch of a pool's history.

type PoolMetadataInfo added in v0.69.0

type PoolMetadataInfo struct {
	PoolID      string
	Hex         string
	URL         *string
	Hash        *string
	Ticker      *string
	Name        *string
	Description *string
	Homepage    *string
	Error       *OffchainFetchErrorInfo
}

PoolMetadataInfo holds a pool's registered metadata: the on-chain anchor (URL and hash) plus the off-chain document fields when the document has been fetched and validated. Error carries the fetch failure when the document could not be retrieved or validated.

type PoolMetadataResponse added in v0.69.0

type PoolMetadataResponse struct {
	PoolID      string                      `json:"pool_id"`
	Hex         string                      `json:"hex"`
	URL         *string                     `json:"url"`
	Hash        *string                     `json:"hash"`
	Ticker      *string                     `json:"ticker"`
	Name        *string                     `json:"name"`
	Description *string                     `json:"description"`
	Homepage    *string                     `json:"homepage"`
	Error       *OffchainFetchErrorResponse `json:"error,omitempty"`
}

PoolMetadataResponse represents Blockfrost pool metadata. The error object is only present when the off-chain document fetch failed.

type PoolRelayInfo

type PoolRelayInfo struct {
	IPv4   string
	IPv6   string
	DNS    string
	DNSSrv string
	Port   int
}

PoolRelayInfo is one relay of a pool registration. Empty strings are absent values.

type PoolRelayResponse

type PoolRelayResponse struct {
	IPv4   *string `json:"ipv4"`
	IPv6   *string `json:"ipv6"`
	DNS    *string `json:"dns"`
	DNSSrv *string `json:"dns_srv"`
	Port   int     `json:"port"`
}

PoolRelayResponse is one relay of a pool registration.

type PoolRetiringInfo added in v0.69.0

type PoolRetiringInfo struct {
	PoolID string
	Epoch  uint64
}

PoolRetiringInfo is one entry of the retiring pools list.

type PoolRetiringResponse added in v0.69.0

type PoolRetiringResponse struct {
	PoolID string `json:"pool_id"`
	Epoch  uint64 `json:"epoch"`
}

PoolRetiringResponse is one entry of the Blockfrost retiring pools list.

type PoolUpdateInfo added in v0.85.0

type PoolUpdateInfo struct {
	TxHash    string
	CertIndex int
	// Action is "registered" or "deregistered".
	Action string
}

PoolUpdateInfo is one registration or retirement certificate of a pool.

type PoolUpdateResponse added in v0.85.0

type PoolUpdateResponse struct {
	TxHash    string `json:"tx_hash"`
	CertIndex int    `json:"cert_index"`
	Action    string `json:"action"`
}

PoolUpdateResponse is one registration or retirement certificate of a pool.

type PoolVoteInfo added in v0.85.0

type PoolVoteInfo struct {
	TxHash    string
	CertIndex int
	Vote      string
}

PoolVoteInfo is one vote a pool cast.

type PoolVoteResponse added in v0.85.0

type PoolVoteResponse struct {
	TxHash    string `json:"tx_hash"`
	CertIndex int    `json:"cert_index"`
	Vote      string `json:"vote"`
}

PoolVoteResponse is one vote a pool cast.

type ProposalParametersResponse added in v0.85.0

type ProposalParametersResponse struct {
	Epoch                      *uint64         `json:"epoch"`
	MinFeeA                    *uint64         `json:"min_fee_a"`
	MinFeeB                    *uint64         `json:"min_fee_b"`
	MaxBlockSize               *uint64         `json:"max_block_size"`
	MaxTxSize                  *uint64         `json:"max_tx_size"`
	MaxBlockHeaderSize         *uint64         `json:"max_block_header_size"`
	KeyDeposit                 *string         `json:"key_deposit"`
	PoolDeposit                *string         `json:"pool_deposit"`
	EMax                       *uint64         `json:"e_max"`
	NOpt                       *uint64         `json:"n_opt"`
	A0                         *float64        `json:"a0"`
	Rho                        *float64        `json:"rho"`
	Tau                        *float64        `json:"tau"`
	DecentralisationParam      *float64        `json:"decentralisation_param"`
	ExtraEntropy               *string         `json:"extra_entropy"`
	ProtocolMajorVer           *uint64         `json:"protocol_major_ver"`
	ProtocolMinorVer           *uint64         `json:"protocol_minor_ver"`
	MinUtxo                    *string         `json:"min_utxo"`
	MinPoolCost                *string         `json:"min_pool_cost"`
	CostModels                 json.RawMessage `json:"cost_models"`
	PriceMem                   *float64        `json:"price_mem"`
	PriceStep                  *float64        `json:"price_step"`
	MaxTxExMem                 *string         `json:"max_tx_ex_mem"`
	MaxTxExSteps               *string         `json:"max_tx_ex_steps"`
	MaxBlockExMem              *string         `json:"max_block_ex_mem"`
	MaxBlockExSteps            *string         `json:"max_block_ex_steps"`
	MaxValSize                 *string         `json:"max_val_size"`
	CollateralPercent          *uint64         `json:"collateral_percent"`
	MaxCollateralInputs        *uint64         `json:"max_collateral_inputs"`
	CoinsPerUtxoSize           *string         `json:"coins_per_utxo_size"`
	CoinsPerUtxoWord           *string         `json:"coins_per_utxo_word"`
	PvtMotionNoConfidence      *float64        `json:"pvt_motion_no_confidence"`
	PvtCommitteeNormal         *float64        `json:"pvt_committee_normal"`
	PvtCommitteeNoConfidence   *float64        `json:"pvt_committee_no_confidence"`
	PvtHardForkInitiation      *float64        `json:"pvt_hard_fork_initiation"`
	DvtMotionNoConfidence      *float64        `json:"dvt_motion_no_confidence"`
	DvtCommitteeNormal         *float64        `json:"dvt_committee_normal"`
	DvtCommitteeNoConfidence   *float64        `json:"dvt_committee_no_confidence"`
	DvtUpdateToConstitution    *float64        `json:"dvt_update_to_constitution"`
	DvtHardForkInitiation      *float64        `json:"dvt_hard_fork_initiation"`
	DvtPPNetworkGroup          *float64        `json:"dvt_p_p_network_group"`
	DvtPPEconomicGroup         *float64        `json:"dvt_p_p_economic_group"`
	DvtPPTechnicalGroup        *float64        `json:"dvt_p_p_technical_group"`
	DvtPPGovGroup              *float64        `json:"dvt_p_p_gov_group"`
	DvtTreasuryWithdrawal      *float64        `json:"dvt_treasury_withdrawal"`
	CommitteeMinSize           *string         `json:"committee_min_size"`
	CommitteeMaxTermLength     *string         `json:"committee_max_term_length"`
	GovActionLifetime          *string         `json:"gov_action_lifetime"`
	GovActionDeposit           *string         `json:"gov_action_deposit"`
	DRepDeposit                *string         `json:"drep_deposit"`
	DRepActivity               *string         `json:"drep_activity"`
	PvtppSecurityGroup         *float64        `json:"pvtpp_security_group"`
	PvtPPSecurityGroup         *float64        `json:"pvt_p_p_security_group"`
	MinFeeRefScriptCostPerByte *float64        `json:"min_fee_ref_script_cost_per_byte"`
}

ProposalParametersResponse is the protocol parameter update of a parameter change proposal. Parameters the proposal leaves unchanged are null.

type ProtocolParamsInfo

type ProtocolParamsInfo struct {
	Epoch               uint64
	MinFeeA             int
	MinFeeB             int
	MaxBlockSize        int
	MaxTxSize           int
	MaxBlockHeaderSize  int
	KeyDeposit          string
	PoolDeposit         string
	EMax                int
	NOpt                int
	A0                  float64
	Rho                 float64
	Tau                 float64
	ProtocolMajorVer    int
	ProtocolMinorVer    int
	MinPoolCost         string
	CoinsPerUtxoSize    string
	PriceMem            float64
	PriceStep           float64
	MaxTxExMem          string
	MaxTxExSteps        string
	MaxBlockExMem       string
	MaxBlockExSteps     string
	MaxValSize          string
	CollateralPercent   int
	MaxCollateralInputs int
	// Conway-era governance and reference-script parameters. These are nil
	// for pre-Conway eras where they do not apply.
	PvtMotionNoConfidence      *float64
	PvtCommitteeNormal         *float64
	PvtCommitteeNoConfidence   *float64
	PvtHardForkInitiation      *float64
	PvtPPSecurityGroup         *float64
	DvtMotionNoConfidence      *float64
	DvtCommitteeNormal         *float64
	DvtCommitteeNoConfidence   *float64
	DvtUpdateToConstitution    *float64
	DvtHardForkInitiation      *float64
	DvtPPNetworkGroup          *float64
	DvtPPEconomicGroup         *float64
	DvtPPTechnicalGroup        *float64
	DvtPPGovGroup              *float64
	DvtTreasuryWithdrawal      *float64
	CommitteeMinSize           *string
	CommitteeMaxTermLength     *string
	GovActionLifetime          *string
	GovActionDeposit           *string
	DRepDeposit                *string
	DRepActivity               *string
	MinFeeRefScriptCostPerByte *float64
	// CostModelsRaw holds cost models keyed by Plutus version name with raw
	// integer arrays, matching the Blockfrost cost_models_raw field. nil
	// when the era carries no cost models.
	CostModelsRaw *any
}

ProtocolParamsInfo holds protocol parameter data needed by the API.

type ProtocolParamsResponse

type ProtocolParamsResponse struct {
	Epoch              uint64  `json:"epoch"`
	MinFeeA            int     `json:"min_fee_a"`
	MinFeeB            int     `json:"min_fee_b"`
	MaxBlockSize       int     `json:"max_block_size"`
	MaxTxSize          int     `json:"max_tx_size"`
	MaxBlockHeaderSize int     `json:"max_block_header_size"`
	KeyDeposit         string  `json:"key_deposit"`
	PoolDeposit        string  `json:"pool_deposit"`
	EMax               int     `json:"e_max"`
	NOpt               int     `json:"n_opt"`
	A0                 float64 `json:"a0"`
	Rho                float64 `json:"rho"`
	Tau                float64 `json:"tau"`
	//nolint:tagliatelle
	DecentralisationParam float64         `json:"decentralisation_param"`
	ExtraEntropy          *map[string]any `json:"extra_entropy"`
	ProtocolMajorVer      int             `json:"protocol_major_ver"`
	ProtocolMinorVer      int             `json:"protocol_minor_ver"`
	MinUtxo               string          `json:"min_utxo"`
	MinPoolCost           string          `json:"min_pool_cost"`
	Nonce                 string          `json:"nonce"`
	CoinsPerUtxoSize      *string         `json:"coins_per_utxo_size"`
	CoinsPerUtxoWord      string          `json:"coins_per_utxo_word"`
	CostModels            *any            `json:"cost_models"`
	PriceMem              *float64        `json:"price_mem"`
	PriceStep             *float64        `json:"price_step"`
	MaxTxExMem            *string         `json:"max_tx_ex_mem"`
	MaxTxExSteps          *string         `json:"max_tx_ex_steps"`
	MaxBlockExMem         *string         `json:"max_block_ex_mem"`
	MaxBlockExSteps       *string         `json:"max_block_ex_steps"`
	MaxValSize            *string         `json:"max_val_size"`
	CollateralPercent     *int            `json:"collateral_percent"`
	MaxCollateralInputs   *int            `json:"max_collateral_inputs"`
	// Conway-era governance and reference-script parameters. These are
	// null for pre-Conway eras where they do not apply.
	PvtMotionNoConfidence    *float64 `json:"pvt_motion_no_confidence"`
	PvtCommitteeNormal       *float64 `json:"pvt_committee_normal"`
	PvtCommitteeNoConfidence *float64 `json:"pvt_committee_no_confidence"`
	PvtHardForkInitiation    *float64 `json:"pvt_hard_fork_initiation"`
	DvtMotionNoConfidence    *float64 `json:"dvt_motion_no_confidence"`
	DvtCommitteeNormal       *float64 `json:"dvt_committee_normal"`
	DvtCommitteeNoConfidence *float64 `json:"dvt_committee_no_confidence"`
	DvtUpdateToConstitution  *float64 `json:"dvt_update_to_constitution"`
	DvtHardForkInitiation    *float64 `json:"dvt_hard_fork_initiation"`
	//nolint:tagliatelle
	DvtPPNetworkGroup *float64 `json:"dvt_p_p_network_group"`
	//nolint:tagliatelle
	DvtPPEconomicGroup *float64 `json:"dvt_p_p_economic_group"`
	//nolint:tagliatelle
	DvtPPTechnicalGroup *float64 `json:"dvt_p_p_technical_group"`
	//nolint:tagliatelle
	DvtPPGovGroup          *float64 `json:"dvt_p_p_gov_group"`
	DvtTreasuryWithdrawal  *float64 `json:"dvt_treasury_withdrawal"`
	CommitteeMinSize       *string  `json:"committee_min_size"`
	CommitteeMaxTermLength *string  `json:"committee_max_term_length"`
	GovActionLifetime      *string  `json:"gov_action_lifetime"`
	GovActionDeposit       *string  `json:"gov_action_deposit"`
	DrepDeposit            *string  `json:"drep_deposit"`
	DrepActivity           *string  `json:"drep_activity"`
	PvtppSecurityGroup     *float64 `json:"pvtpp_security_group"`
	//nolint:tagliatelle
	PvtPPSecurityGroup         *float64 `json:"pvt_p_p_security_group"`
	MinFeeRefScriptCostPerByte *float64 `json:"min_fee_ref_script_cost_per_byte"`
	CostModelsRaw              *any     `json:"cost_models_raw"`
}

ProtocolParamsResponse represents Blockfrost protocol parameters.

type ProviderConfig added in v0.68.0

type ProviderConfig struct {
	Port                            uint                `yaml:"port"`
	Host                            string              `yaml:"host"`
	AuthToken                       string              `yaml:"authToken"`
	MaxConcurrentMutations          uint                `yaml:"maxConcurrentMutations"`
	MaxConcurrentMutationsPerClient uint                `yaml:"maxConcurrentMutationsPerClient"`
	TLS                             apiconfig.TLSPolicy `yaml:"tls"`
}

func DefaultProviderConfig added in v0.86.0

func DefaultProviderConfig() ProviderConfig

DefaultProviderConfig returns the secure defaults for the built-in Blockfrost provider.

type ProviderDependencies added in v0.68.0

type ProviderDependencies struct {
	Node               BlockfrostNode
	Logger             *slog.Logger
	Host               string
	CORSAllowedOrigins []string
}

type RootResponse

type RootResponse struct {
	URL     string `json:"url"`
	Version string `json:"version"`
}

RootResponse is returned by GET /.

type ScriptCBORResponse added in v0.85.0

type ScriptCBORResponse struct {
	CBOR *string `json:"cbor"`
}

ScriptCBORResponse carries the CBOR of a Plutus script, or null for a native script.

type ScriptInfo added in v0.85.0

type ScriptInfo struct {
	Hash           string
	Type           string
	SerialisedSize *int
}

ScriptInfo holds a script's language and serialised size. SerialisedSize is nil for a native script.

type ScriptJSONResponse added in v0.85.0

type ScriptJSONResponse struct {
	JSON json.RawMessage `json:"json"`
}

ScriptJSONResponse carries the JSON form of a native script, or null for a Plutus script.

type ScriptListItemResponse added in v0.85.0

type ScriptListItemResponse struct {
	ScriptHash string `json:"script_hash"`
}

ScriptListItemResponse is one entry of the script listing.

type ScriptQueryNode added in v0.85.0

type ScriptQueryNode interface {
	// Scripts returns the paginated hashes of every known script, along
	// with the total before pagination.
	Scripts(
		ctx context.Context,
		params PaginationParams,
	) ([]string, int, error)

	// Script returns the type and serialised size of a script.
	Script(ctx context.Context, hash []byte) (ScriptInfo, error)

	// ScriptJSON returns the JSON form of a native script, or nil for a
	// Plutus script.
	ScriptJSON(ctx context.Context, hash []byte) (json.RawMessage, error)

	// ScriptCBOR returns the hex CBOR of a Plutus script, or nil for a
	// native script.
	ScriptCBOR(ctx context.Context, hash []byte) (*string, error)

	// ScriptRedeemers returns the paginated redeemers that executed the
	// script, along with the total before pagination.
	ScriptRedeemers(
		ctx context.Context,
		hash []byte,
		params PaginationParams,
	) ([]ScriptRedeemerInfo, int, error)

	// ScriptUTXOs returns the paginated current UTxOs carrying the script
	// as a reference script, along with the total before pagination.
	ScriptUTXOs(
		ctx context.Context,
		hash []byte,
		params PaginationParams,
	) ([]ScriptUTXOInfo, int, error)

	// DatumJSON returns the detailed-schema JSON of a datum by hash.
	DatumJSON(ctx context.Context, hash []byte) (json.RawMessage, error)

	// DatumCBOR returns the hex CBOR of a datum by hash.
	DatumCBOR(ctx context.Context, hash []byte) (string, error)
}

ScriptQueryNode is the script and datum surface of BlockfrostNode.

type ScriptRedeemerInfo added in v0.85.0

type ScriptRedeemerInfo struct {
	TxHash           string
	TxIndex          int
	Purpose          string
	RedeemerDataHash string
	DatumHash        *string
	UnitMem          string
	UnitSteps        string
	Fee              string
}

ScriptRedeemerInfo is one redeemer that executed a script.

type ScriptRedeemerResponse added in v0.85.0

type ScriptRedeemerResponse struct {
	TxHash           string  `json:"tx_hash"`
	TxIndex          int     `json:"tx_index"`
	Purpose          string  `json:"purpose"`
	RedeemerDataHash string  `json:"redeemer_data_hash"`
	DatumHash        *string `json:"datum_hash"`
	UnitMem          string  `json:"unit_mem"`
	UnitSteps        string  `json:"unit_steps"`
	Fee              string  `json:"fee"`
}

ScriptRedeemerResponse is one redeemer that executed a script.

type ScriptResponse added in v0.85.0

type ScriptResponse struct {
	ScriptHash     string `json:"script_hash"`
	Type           string `json:"type"`
	SerialisedSize *int   `json:"serialised_size"`
}

ScriptResponse represents a Blockfrost script object. SerialisedSize is null for a native script.

type ScriptUTXOInfo added in v0.85.0

type ScriptUTXOInfo struct {
	Address             string
	TxHash              string
	OutputIndex         uint32
	Amount              []AddressAmountInfo
	Block               string
	DataHash            *string
	InlineDatum         *string
	ReferenceScriptHash string
}

ScriptUTXOInfo is one current UTxO carrying a reference script.

type ScriptUTXOResponse added in v0.85.0

type ScriptUTXOResponse struct {
	Address             string                  `json:"address"`
	TxHash              string                  `json:"tx_hash"`
	OutputIndex         int                     `json:"output_index"`
	Amount              []AddressAmountResponse `json:"amount"`
	Block               string                  `json:"block"`
	DataHash            *string                 `json:"data_hash"`
	InlineDatum         *string                 `json:"inline_datum"`
	ReferenceScriptHash string                  `json:"reference_script_hash"`
}

ScriptUTXOResponse is one UTxO carrying a script as a reference script.

type TransactionCBORResponse

type TransactionCBORResponse struct {
	CBOR string `json:"cbor"`
}

TransactionCBORResponse represents transaction CBOR in hex form.

type TransactionDelegationInfo

type TransactionDelegationInfo struct {
	Address     string
	PoolID      string
	Index       int
	CertIndex   int
	ActiveEpoch uint64
}

TransactionDelegationInfo holds one delegation certificate.

type TransactionDelegationResponse

type TransactionDelegationResponse struct {
	Address     string `json:"address"`
	PoolID      string `json:"pool_id"`
	Index       int    `json:"index"`
	CertIndex   int    `json:"cert_index"`
	ActiveEpoch uint64 `json:"active_epoch"`
}

TransactionDelegationResponse represents one delegation certificate.

type TransactionEvaluationEnvelope added in v0.70.3

type TransactionEvaluationEnvelope struct {
	Type        string                      `json:"type"`
	Version     string                      `json:"version"`
	ServiceName string                      `json:"servicename"`
	MethodName  string                      `json:"methodname"`
	Result      TransactionEvaluationResult `json:"result"`
	Reflection  any                         `json:"reflection"`
}

TransactionEvaluationEnvelope is the response body both evaluation endpoints return: the Ogmios v5 EvaluateTx response that Blockfrost passes through verbatim. Off-chain SDKs read the execution units from result.EvaluationResult, so the envelope is part of the wire contract rather than decoration.

type TransactionEvaluationResponse added in v0.70.2

type TransactionEvaluationResponse map[string]ExecutionUnitsResponse

TransactionEvaluationResponse contains the execution units calculated for each redeemer in a transaction. Keys use redeemer pointers such as "spend:0" and "mint:0".

type TransactionEvaluationResult added in v0.70.3

type TransactionEvaluationResult struct {
	EvaluationResult TransactionEvaluationResponse `json:"EvaluationResult"`
}

TransactionEvaluationResult holds the execution units of a successful evaluation under the key Ogmios uses for them.

type TransactionInfo

type TransactionInfo struct {
	InvalidBefore      *string
	InvalidHereafter   *string
	OutputAmount       []AddressAmountInfo
	Hash               string
	Block              string
	Deposit            string
	Fees               string
	TreasuryDonation   string
	Slot               uint64
	BlockHeight        uint64
	BlockTime          int64
	Size               int
	Index              uint32
	UtxoCount          int
	WithdrawalCount    int
	MirCertCount       int
	DelegationCount    int
	StakeCertCount     int
	PoolUpdateCount    int
	PoolRetireCount    int
	AssetMintBurnCount int
	RedeemerCount      int
	ValidContract      bool
}

TransactionInfo holds transaction summary data needed by the API.

type TransactionInputInfo

type TransactionInputInfo struct {
	ReferenceScriptHash *string
	InlineDatum         *string
	DataHash            *string
	Address             string
	TxHash              string
	Amount              []AddressAmountInfo
	OutputIndex         uint32
	Collateral          bool
	Reference           *bool
}

TransactionInputInfo holds one transaction input.

type TransactionInputResponse

type TransactionInputResponse struct {
	ReferenceScriptHash *string                 `json:"reference_script_hash"`
	InlineDatum         *string                 `json:"inline_datum"`
	DataHash            *string                 `json:"data_hash"`
	Reference           *bool                   `json:"reference"`
	Address             string                  `json:"address"`
	TxHash              string                  `json:"tx_hash"`
	Amount              []AddressAmountResponse `json:"amount"`
	OutputIndex         int                     `json:"output_index"`
	Collateral          bool                    `json:"collateral"`
}

TransactionInputResponse represents one transaction input.

type TransactionMIRInfo

type TransactionMIRInfo struct {
	Address   string
	Amount    string
	CertIndex int
	Pot       string
}

TransactionMIRInfo holds one MIR target.

type TransactionMIRResponse

type TransactionMIRResponse struct {
	Address   string `json:"address"`
	Amount    string `json:"amount"`
	CertIndex int    `json:"cert_index"`
	Pot       string `json:"pot"`
}

TransactionMIRResponse represents one MIR certificate target.

type TransactionMetadataCBORInfo

type TransactionMetadataCBORInfo struct {
	CBORMetadata string
	Label        string
}

TransactionMetadataCBORInfo holds a transaction metadata label and CBOR value.

type TransactionMetadataCBORResponse

type TransactionMetadataCBORResponse struct {
	CborMetadata *string `json:"cbor_metadata"`
	Metadata     string  `json:"metadata"`
	Label        string  `json:"label"`
}

TransactionMetadataCBORResponse represents one transaction metadata label in CBOR form.

type TransactionMetadataInfo

type TransactionMetadataInfo struct {
	JSONMetadata json.RawMessage
	Label        string
}

TransactionMetadataInfo holds a transaction metadata label and JSON value.

type TransactionMetadataResponse

type TransactionMetadataResponse struct {
	JSONMetadata json.RawMessage `json:"json_metadata"`
	Label        string          `json:"label"`
}

TransactionMetadataResponse represents one transaction metadata label in JSON form.

type TransactionOutputInfo

type TransactionOutputInfo struct {
	ReferenceScriptHash *string
	InlineDatum         *string
	DataHash            *string
	ConsumedByTx        *string
	Address             string
	Amount              []AddressAmountInfo
	OutputIndex         uint32
	Collateral          bool
}

TransactionOutputInfo holds one transaction output.

type TransactionOutputResponse

type TransactionOutputResponse struct {
	ReferenceScriptHash *string                 `json:"reference_script_hash"`
	InlineDatum         *string                 `json:"inline_datum"`
	DataHash            *string                 `json:"data_hash"`
	ConsumedByTx        *string                 `json:"consumed_by_tx"`
	Address             string                  `json:"address"`
	Amount              []AddressAmountResponse `json:"amount"`
	OutputIndex         int                     `json:"output_index"`
	Collateral          bool                    `json:"collateral"`
}

TransactionOutputResponse represents one transaction output.

type TransactionPoolMetadataInfo

type TransactionPoolMetadataInfo struct {
	URL  string
	Hash string
}

TransactionPoolMetadataInfo holds on-chain pool metadata pointer data.

type TransactionPoolMetadataResponse

type TransactionPoolMetadataResponse struct {
	Hash string `json:"hash"`
	URL  string `json:"url"`
}

TransactionPoolMetadataResponse represents pool metadata pointer data.

type TransactionPoolRelayInfo

type TransactionPoolRelayInfo struct {
	DNS    string
	DNSSrv string
	IPv4   string
	IPv6   string
	Port   *int
}

TransactionPoolRelayInfo holds one pool relay from a pool registration cert.

type TransactionPoolRelayResponse

type TransactionPoolRelayResponse struct {
	DNS    *string `json:"dns"`
	DNSSrv *string `json:"dns_srv"`
	IPv4   *string `json:"ipv4"`
	IPv6   *string `json:"ipv6"`
	Port   *int    `json:"port"`
}

TransactionPoolRelayResponse represents one relay in a pool registration cert.

type TransactionPoolRetireInfo

type TransactionPoolRetireInfo struct {
	PoolID        string
	CertIndex     int
	RetiringEpoch uint64
}

TransactionPoolRetireInfo holds one pool retirement certificate.

type TransactionPoolRetireResponse

type TransactionPoolRetireResponse struct {
	PoolID        string `json:"pool_id"`
	CertIndex     int    `json:"cert_index"`
	RetiringEpoch uint64 `json:"retiring_epoch"`
}

TransactionPoolRetireResponse represents one pool retirement certificate.

type TransactionPoolUpdateInfo

type TransactionPoolUpdateInfo struct {
	Metadata      *TransactionPoolMetadataInfo
	Owners        []string
	Relays        []TransactionPoolRelayInfo
	ActiveEpoch   uint64
	CertIndex     int
	FixedCost     string
	MarginCost    float64
	Pledge        string
	PoolID        string
	RewardAccount string
	VrfKey        string
}

TransactionPoolUpdateInfo holds one pool registration certificate.

type TransactionPoolUpdateResponse

type TransactionPoolUpdateResponse struct {
	Metadata      *TransactionPoolMetadataResponse `json:"metadata"`
	Owners        []string                         `json:"owners"`
	Relays        []TransactionPoolRelayResponse   `json:"relays"`
	ActiveEpoch   uint64                           `json:"active_epoch"`
	CertIndex     int                              `json:"cert_index"`
	FixedCost     string                           `json:"fixed_cost"`
	MarginCost    float64                          `json:"margin_cost"`
	Pledge        string                           `json:"pledge"`
	PoolID        string                           `json:"pool_id"`
	RewardAccount string                           `json:"reward_account"`
	VrfKey        string                           `json:"vrf_key"`
}

TransactionPoolUpdateResponse represents one pool registration certificate.

type TransactionRangeParams added in v0.81.0

type TransactionRangeParams struct {
	Pagination PaginationParams
	From       *BlockRangePosition
	To         *BlockRangePosition
}

TransactionRangeParams holds query parameters for the account and address transaction endpoints: standard pagination plus the optional inclusive from/to block-range filter.

type TransactionRedeemerInfo

type TransactionRedeemerInfo struct {
	DatumHash        *string
	TxIndex          int
	Purpose          string
	ScriptHash       string
	RedeemerDataHash string
	UnitMem          string
	UnitSteps        string
	Fee              string
}

TransactionRedeemerInfo holds one Plutus redeemer.

type TransactionRedeemerResponse

type TransactionRedeemerResponse struct {
	DatumHash        *string `json:"datum_hash"`
	TxIndex          int     `json:"tx_index"`
	Purpose          string  `json:"purpose"`
	ScriptHash       string  `json:"script_hash"`
	RedeemerDataHash string  `json:"redeemer_data_hash"`
	UnitMem          string  `json:"unit_mem"`
	UnitSteps        string  `json:"unit_steps"`
	Fee              string  `json:"fee"`
}

TransactionRedeemerResponse represents one Plutus redeemer.

type TransactionRejectedError added in v0.70.4

type TransactionRejectedError struct {
	Cause error
}

TransactionRejectedError reports a transaction the mempool judged and declined, carrying the reason as a separate error rather than only inside the message text. Handlers read Cause to report why the transaction was rejected instead of recovering it from the formatted message, which only works while the sentinel is the outermost prefix.

func (*TransactionRejectedError) Error added in v0.70.4

func (e *TransactionRejectedError) Error() string

func (*TransactionRejectedError) Unwrap added in v0.70.4

func (e *TransactionRejectedError) Unwrap() []error

Unwrap exposes the sentinel and the cause together, so errors.Is matches both ErrTransactionRejected and whatever the mempool returned.

type TransactionRequiredSignerInfo

type TransactionRequiredSignerInfo struct {
	WitnessHash string
}

TransactionRequiredSignerInfo holds one required signing key hash.

type TransactionRequiredSignerResponse

type TransactionRequiredSignerResponse struct {
	WitnessHash string `json:"witness_hash"`
}

TransactionRequiredSignerResponse represents one required signing key hash.

type TransactionResponse

type TransactionResponse struct {
	InvalidBefore      *string                 `json:"invalid_before"`
	InvalidHereafter   *string                 `json:"invalid_hereafter"`
	OutputAmount       []AddressAmountResponse `json:"output_amount"`
	Hash               string                  `json:"hash"`
	Block              string                  `json:"block"`
	Deposit            string                  `json:"deposit"`
	Fees               string                  `json:"fees"`
	TreasuryDonation   string                  `json:"treasury_donation"`
	Slot               uint64                  `json:"slot"`
	BlockHeight        uint64                  `json:"block_height"`
	BlockTime          int64                   `json:"block_time"`
	Size               int                     `json:"size"`
	Index              int                     `json:"index"`
	UtxoCount          int                     `json:"utxo_count"`
	WithdrawalCount    int                     `json:"withdrawal_count"`
	MirCertCount       int                     `json:"mir_cert_count"`
	DelegationCount    int                     `json:"delegation_count"`
	StakeCertCount     int                     `json:"stake_cert_count"`
	PoolUpdateCount    int                     `json:"pool_update_count"`
	PoolRetireCount    int                     `json:"pool_retire_count"`
	AssetMintBurnCount int                     `json:"asset_mint_or_burn_count"`
	RedeemerCount      int                     `json:"redeemer_count"`
	ValidContract      bool                    `json:"valid_contract"`
}

TransactionResponse represents a Blockfrost transaction content object.

type TransactionStakeAddressInfo

type TransactionStakeAddressInfo struct {
	Address      string
	CertIndex    int
	Registration bool
}

TransactionStakeAddressInfo holds one stake registration/deregistration certificate.

type TransactionStakeAddressResponse

type TransactionStakeAddressResponse struct {
	Address      string `json:"address"`
	CertIndex    int    `json:"cert_index"`
	Registration bool   `json:"registration"`
}

TransactionStakeAddressResponse represents one stake address certificate.

type TransactionSubmitter

type TransactionSubmitter interface {
	AddTransaction(ctx context.Context, txType uint, txBytes []byte) error
}

TransactionSubmitter accepts raw transaction CBOR for mempool admission.

type TransactionUTXOsInfo

type TransactionUTXOsInfo struct {
	Hash    string
	Inputs  []TransactionInputInfo
	Outputs []TransactionOutputInfo
}

TransactionUTXOsInfo holds transaction inputs and outputs.

type TransactionUTXOsResponse

type TransactionUTXOsResponse struct {
	Hash    string                      `json:"hash"`
	Inputs  []TransactionInputResponse  `json:"inputs"`
	Outputs []TransactionOutputResponse `json:"outputs"`
}

TransactionUTXOsResponse represents transaction inputs and outputs.

type TransactionWithdrawalInfo

type TransactionWithdrawalInfo struct {
	Address string
	Amount  string
}

TransactionWithdrawalInfo holds one reward withdrawal.

type TransactionWithdrawalResponse

type TransactionWithdrawalResponse struct {
	Address string `json:"address"`
	Amount  string `json:"amount"`
}

TransactionWithdrawalResponse represents one reward withdrawal.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL