blockfrost

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 29

README


Official Blockfrost SDK Client

Build status Go report card GoDoc

Getting started

To use this SDK, you first need to log in to blockfrost.io, create your project and retrieve the API token.


Installation

blockfrost-go can be installed through go get

$ go get https://github.com/blockfrost/blockfrost-go

Usage

Cardano API
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/blockfrost/blockfrost-go"
)

func main() {
	api, err := blockfrost.NewAPIClient(
		blockfrost.APIClientOptions{
            ProjectID: "YOUR_PROJECT_ID_HERE", // Exclude to load from env:BLOCKFROST_PROJECT_ID
        },
	)
	if err != nil {
		log.Fatal(err)
	}

	info, err := api.Info(context.TODO())
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("API Info:\n\tUrl: %s\n\tVersion: %s", info.Url, info.Version)
}
IPFS
package main

import (
	"context"
	"flag"
	"fmt"
	"log"

	"github.com/blockfrost/blockfrost-go"
)

var (
	fp = flag.String("file", "", "Path to file")
)

func main() {
	flag.Parse()
	// Load project_id from env:BLOCKFROST_IPFS_PROJECT_ID
	ipfs := blockfrost.NewIPFSClient(blockfrost.IPFSClientOptions{})

	ipo, err := ipfs.Add(context.TODO(), *fp)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("IPFS Object: %+v\n", ipo)

	// Pin item to avoid being garbage collected.
	pin, err := ipfs.Pin(context.TODO(), ipo.IPFSHash)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Pin: %+v", pin)
}

More examples of usage can be found in example folder.

Developing

To run specific test:

go test -run <name>

To run all tests:

make test

License

Licensed under the Apache License 2.0, see LICENSE

Documentation

Index

Constants

View Source
const (
	CardanoMainNet = "https://cardano-mainnet.blockfrost.io/api/v0"
	CardanoTestNet = "https://cardano-testnet.blockfrost.io/api/v0"
	CardanoPreProd = "https://cardano-preprod.blockfrost.io/api/v0"
	CardanoPreview = "https://cardano-preview.blockfrost.io/api/v0"
	IPFSNet        = "https://ipfs.blockfrost.io/api/v0"
)
View Source
const (
	// Signatures older than this will be rejected by ConstructEvent
	DefaultTolerance time.Duration = 600 * time.Second
)

Variables

View Source
var (
	ErrNotSigned        error = errors.New("Missing blockfrost-signature header")
	ErrInvalidHeader    error = errors.New("Invalid blockfrost-signature header format")
	ErrTooOld           error = errors.New("Signature's timestamp is not within time tolerance")
	ErrNoValidSignature error = errors.New("No valid signature")
)

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	Info(ctx context.Context) (Info, error)
	Health(ctx context.Context) (Health, error)
	HealthClock(ctx context.Context) (HealthClock, error)
	Metrics(ctx context.Context) ([]Metric, error)
	MetricsEndpoints(ctx context.Context) ([]MetricsEndpoint, error)
	Block(ctx context.Context, hashOrNumber string) (Block, error)
	BlockLatest(ctx context.Context) (Block, error)
	BlockLatestTransactions(ctx context.Context) ([]Transaction, error)
	BlockTransactions(ctx context.Context, hashOrNumer string) ([]Transaction, error)
	BlocksNext(ctx context.Context, hashOrNumber string) ([]Block, error)
	BlocksPrevious(ctx context.Context, hashOrNumber string) ([]Block, error)
	BlockBySlot(ctx context.Context, slotNumber int) (Block, error)
	BlocksBySlotAndEpoch(ctx context.Context, slotNumber int, epochNumber int) (Block, error)
	BlocksAddresses(ctx context.Context, hashOrNumber string, query APIQueryParams) ([]BlockAffectedAddresses, error)
	BlocksAddressesAll(ctx context.Context, hashOrNumber string) <-chan BlockAffectedAddressesResult
	EpochLatest(ctx context.Context) (Epoch, error)
	LatestEpochParameters(ctx context.Context) (EpochParameters, error)
	Epoch(ctx context.Context, epochNumber int) (Epoch, error)
	EpochsNext(ctx context.Context, epochNumber int, query APIQueryParams) ([]Epoch, error)
	EpochNextAll(ctx context.Context, epochNumber int) <-chan EpochResult
	EpochsPrevious(ctx context.Context, epochNumber int, query APIQueryParams) ([]Epoch, error)
	EpochPreviousAll(ctx context.Context, epochNumber int) <-chan EpochResult
	EpochStakeDistribution(ctx context.Context, epochNumber int, query APIQueryParams) ([]EpochStake, error)
	EpochStakeDistributionAll(ctx context.Context, epochNumber int) <-chan EpochStakeResult
	EpochStakeDistributionByPool(ctx context.Context, epochNumber int, poolId string, query APIQueryParams) ([]EpochStakeByPool, error)
	EpochStakeDistributionByPoolAll(ctx context.Context, epochNumber int, poolId string) <-chan EpochStakeByPoolResult
	EpochBlockDistribution(ctx context.Context, epochNumber int, query APIQueryParams) ([]string, error)
	EpochBlockDistributionAll(ctx context.Context, epochNumber int) <-chan BlockDistributionResult
	EpochBlockDistributionByPool(ctx context.Context, epochNumber int, poolId string, query APIQueryParams) ([]string, error)
	EpochBlockDistributionByPoolAll(ctx context.Context, epochNumber int, poolId string) <-chan BlockDistributionResult
	EpochParameters(ctx context.Context, epochNumber int) (EpochParameters, error)
	Address(ctx context.Context, address string) (Address, error)
	AddressDetails(ctx context.Context, address string) (AddressDetails, error)
	AddressTransactions(ctx context.Context, address string, query APIQueryParams) ([]AddressTransactions, error)
	AddressTransactionsAll(ctx context.Context, address string) <-chan AddressTxResult
	AddressUTXOs(ctx context.Context, address string, query APIQueryParams) ([]AddressUTXO, error)
	AddressUTXOsAll(ctx context.Context, address string) <-chan AddressUTXOResult
	AddressUTXOsAsset(ctx context.Context, address, asset string, query APIQueryParams) ([]AddressUTXO, error)
	AddressUTXOsAssetAll(ctx context.Context, address, asset string) <-chan AddressUTXOResult
	Account(ctx context.Context, stakeAddress string) (Account, error)
	AccountHistory(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountHistory, error)
	AccountHistoryAll(ctx context.Context, address string) <-chan AccountHistoryResult
	AccountRewardsHistory(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountRewardsHistory, error)
	AccountRewardsHistoryAll(ctx context.Context, stakeAddress string) <-chan AccountRewardHisResult
	AccountDelegationHistory(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountDelegationHistory, error)
	AccountDelegationHistoryAll(ctx context.Context, stakeAddress string) <-chan AccDelegationHistoryResult
	AccountRegistrationHistory(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountRegistrationHistory, error)
	AccountRegistrationHistoryAll(ctx context.Context, stakeAddress string) <-chan AccountRegistrationHistoryResult
	AccountWithdrawalHistory(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountWithdrawalHistory, error)
	AccountWithdrawalHistoryAll(ctx context.Context, stakeAddress string) <-chan AccountWithdrawalHistoryResult
	AccountMIRHistory(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountMIRHistory, error)
	AccountMIRHistoryAll(ctx context.Context, stakeAddress string) <-chan AccountMIRHistoryResult
	AccountAssociatedAddresses(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountAssociatedAddress, error)
	AccountAssociatedAddressesAll(ctx context.Context, stakeAddress string) <-chan AccountAssociatedAddressesAll
	AccountAssociatedAssets(ctx context.Context, stakeAddress string, query APIQueryParams) ([]AccountAssociatedAsset, error)
	AccountAssociatedAssetsAll(ctx context.Context, stakeAddress string) <-chan AccountAssociatedAssetsAll
	Asset(ctx context.Context, asset string) (Asset, error)
	Assets(ctx context.Context, query APIQueryParams) ([]AssetByPolicy, error)
	AssetsAll(ctx context.Context) <-chan AssetByPolicyResult
	AssetHistory(ctx context.Context, asset string) ([]AssetHistory, error)
	AssetTransactions(ctx context.Context, asset string) ([]AssetTransaction, error)
	AssetAddresses(ctx context.Context, asset string, query APIQueryParams) ([]AssetAddress, error)
	AssetAddressesAll(ctx context.Context, asset string) <-chan AssetAddressesAll
	AssetsByPolicy(ctx context.Context, policyId string) ([]AssetByPolicy, error)
	Genesis(ctx context.Context) (GenesisBlock, error)
	Mempool(ctx context.Context, query APIQueryParams) ([]Mempool, error)
	MempoolAll(ctx context.Context) <-chan MempoolResult
	MempoolTx(ctx context.Context, hash string) (MempoolTransactionContent, error)
	MempoolByAddress(ctx context.Context, address string, query APIQueryParams) ([]Mempool, error)
	MempoolByAddressAll(ctx context.Context, address string) <-chan MempoolResult
	MetadataTxLabels(ctx context.Context, query APIQueryParams) ([]MetadataTxLabel, error)
	MetadataTxLabelsAll(ctx context.Context) <-chan MetadataTxLabelResult
	MetadataTxContentInJSON(ctx context.Context, label string, query APIQueryParams) ([]MetadataTxContentInJSON, error)
	MetadataTxContentInJSONAll(ctx context.Context, label string) <-chan MetadataTxContentInJSONResult
	MetadataTxContentInCBOR(ctx context.Context, label string, query APIQueryParams) ([]MetadataTxContentInCBOR, error)
	MetadataTxContentInCBORAll(ctx context.Context, label string) <-chan MetadataTxContentInCBORResult
	Network(ctx context.Context) (NetworkInfo, error)
	Nutlink(ctx context.Context, address string) (NutlinkAddress, error)
	Tickers(ctx context.Context, address string, query APIQueryParams) ([]Ticker, error)
	TickersAll(ctx context.Context, address string) <-chan TickerResult
	TickerRecords(ctx context.Context, ticker string, query APIQueryParams) ([]TickerRecord, error)
	TickerRecordsAll(ctx context.Context, ticker string) <-chan TickerRecordResult
	AddressTickerRecords(ctx context.Context, address string, ticker string, query APIQueryParams) ([]TickerRecord, error)
	AddressTickerRecordsAll(ctx context.Context, address string, ticker string) <-chan TickerRecordResult
	Script(ctx context.Context, address string) (Script, error)
	Scripts(ctx context.Context, query APIQueryParams) ([]Script, error)
	ScriptsAll(ctx context.Context) <-chan ScriptAllResult
	ScriptRedeemers(ctx context.Context, address string, query APIQueryParams) ([]ScriptRedeemer, error)
	ScriptRedeemersAll(ctx context.Context, address string) <-chan ScriptRedeemerResult
	Pool(ctx context.Context, poolID string) (Pool, error)
	Pools(ctx context.Context, query APIQueryParams) (Pools, error)
	PoolsAll(ctx context.Context) <-chan PoolsResult
	PoolsRetired(ctx context.Context, query APIQueryParams) ([]PoolRetired, error)
	PoolsRetiredAll(ctx context.Context) <-chan PoolsRetiredResult
	PoolsRetiring(ctx context.Context, query APIQueryParams) ([]PoolRetiring, error)
	PoolsRetiringAll(ctx context.Context) <-chan PoolsRetiringResult
	PoolHistory(ctx context.Context, poolID string, query APIQueryParams) ([]PoolHistory, error)
	PoolHistoryAll(ctx context.Context, poolId string) <-chan PoolHistoryResult
	PoolMetadata(ctx context.Context, poolID string) (PoolMetadata, error)
	PoolRelays(ctx context.Context, poolID string) ([]PoolRelay, error)
	PoolDelegators(ctx context.Context, poolID string, query APIQueryParams) ([]PoolDelegator, error)
	PoolDelegatorsAll(ctx context.Context, poolId string) <-chan PoolDelegatorsResult
	PoolBlocks(ctx context.Context, poolID string, query APIQueryParams) (PoolBlocks, error)
	PoolBlocksAll(ctx context.Context, poolId string) <-chan PoolBlocksResult
	PoolUpdates(ctx context.Context, poolID string, query APIQueryParams) ([]PoolUpdate, error)
	PoolUpdatesAll(ctx context.Context, poolId string) <-chan PoolUpdateResult
	Transaction(ctx context.Context, hash string) (TransactionContent, error)
	TransactionUTXOs(ctx context.Context, hash string) (TransactionUTXOs, error)
	TransactionStakeAddressCerts(ctx context.Context, hash string) ([]TransactionStakeAddressCert, error)
	TransactionWithdrawals(ctx context.Context, hash string) ([]TransactionWidthrawal, error)
	TransactionMIRs(ctx context.Context, hash string) ([]TransactionMIR, error)
	TransactionMetadata(ctx context.Context, hash string) ([]TransactionMetadata, error)
	TransactionMetadataInCBORs(ctx context.Context, hash string) ([]TransactionMetadataCbor, error)
	TransactionRedeemers(ctx context.Context, hash string) ([]TransactionRedeemer, error)
	TransactionDelegationCerts(ctx context.Context, hash string) ([]TransactionDelegation, error)
	TransactionPoolUpdates(ctx context.Context, hash string) ([]TransactionPoolCert, error)
	TransactionPoolUpdateCerts(ctx context.Context, hash string) ([]TransactionPoolCert, error)
	TransactionPoolRetirementCerts(ctx context.Context, hash string) ([]TransactionPoolCert, error)
	TransactionSubmit(ctx context.Context, cbor []byte) (string, error)
	TransactionEvaluate(ctx context.Context, cbor []byte) (OgmiosResponse, error)
	TransactionEvaluateUTXOs(ctx context.Context, cbor []byte, additionalUtxoSet AdditionalUtxoSet) (OgmiosResponse, error)
}

APIClient defines methods implemented by the api client.

func NewAPIClient

func NewAPIClient(options APIClientOptions) APIClient

NewAPIClient creates a client from APIClientOptions. If no options are provided, client with default configurations is returned.

type APIClientOptions

type APIClientOptions struct {
	// The project_id to use from blockfrost. If not set
	// `BLOCKFROST_PROJECT_ID` is loaded from env
	ProjectID string

	// Server url to use
	Server string

	// Max number of routines to use for *All methods
	MaxRoutines int

	// Underlying http client to use. If not set, default github.com/hashicorp/go-retryablehttp is used.
	Client *http.Client
}

APIClientOptions contains optios used to initialize an API Client using NewAPIClient

type APIError

type APIError struct {
	Response interface{}
}

APIError is used to describe errors from the API. See https://docs.blockfrost.io/#section/Errors

func (*APIError) Error

func (e *APIError) Error() string

type APIQueryParams

type APIQueryParams struct {
	Count int
	Page  int
	Order string
	From  string
	To    string
}

APIQueryParams contains query parameters. Marshalled to "count", "page", "order", "from", "to".

type AccDelegationHistoryResult

type AccDelegationHistoryResult struct {
	Res []AccountDelegationHistory
	Err error
}

type Account

type Account struct {
	// Bech32 stake address
	StakeAddress string `json:"stake_address"`

	// Registration state of an account
	Active bool `json:"active"`

	// Epoch of the most recent action - registration or deregistration
	ActiveEpoch *int64 `json:"active_epoch"`

	// Balance of the account in Lovelaces
	ControlledAmount string `json:"controlled_amount"`

	// Sum of all rewards for the account in the Lovelaces
	RewardsSum string `json:"rewards_sum"`

	// Sum of all the withdrawals for the account in Lovelaces
	WithdrawalsSum string `json:"withdrawals_sum"`

	// Sum of all funds from reserves for the account in the Lovelaces
	ReservesSum string `json:"reserves_sum"`

	// Sum of all funds from treasury for the account in the Lovelaces
	TreasurySum string `json:"treasury_sum"`

	// Sum of available rewards that haven't been withdrawn yet for the account in the Lovelaces
	WithdrawableAmount string `json:"withdrawable_amount"`

	// Bech32 pool ID that owns the account
	PoolID *string `json:"pool_id"`
}

Account return Specific account address Obtain information about a specific stake account.

type AccountAssociatedAddress

type AccountAssociatedAddress struct {
	// Address associated with the stake key
	Address string `json:"address"`
}

AccountAssociatedAddress return Account associated addresses Obtain information about the addresses of a specific account.

type AccountAssociatedAddressesAll

type AccountAssociatedAddressesAll struct {
	Res []AccountAssociatedAddress
	Err error
}

type AccountAssociatedAsset

type AccountAssociatedAsset struct {
	// The unit of the value.
	// Concatenation of asset policy_id and hex-encoded asset_name
	Unit string `json:"unit"`

	// The quantity of the unit
	Quantity string `json:"quantity"`
}

AccountAssociatedAsset return Assets associated with the account addresses Obtain information about assets associated with addresses of a specific account. Be careful, as an account could be part of a mangled address and does not necessarily mean the addresses are owned by user as the account.

type AccountAssociatedAssetsAll

type AccountAssociatedAssetsAll struct {
	Res []AccountAssociatedAsset
	Err error
}

type AccountDelegationHistory

type AccountDelegationHistory struct {
	// Epoch in which the delegation becomes active
	ActiveEpoch int32 `json:"active_epoch"`

	// Hash of the transaction containing the delegation
	TXHash string `json:"tx_hash"`

	// Rewards for given epoch in Lovelaces
	Amount string `json:"amount"`

	// Bech32 ID of pool being delegated to
	PoolID string `json:"pool_id"`
}

AccountDelegationHistory return Account delegation history Obtain information about the delegation of a specific account.

type AccountHistory

type AccountHistory struct {
	// Epoch in which the stake was active
	ActiveEpoch int32 `json:"active_epoch"`

	// Stake amount in Lovelaces
	Amount string `json:"amount"`

	// Bech32 ID of pool being delegated to
	PoolID string `json:"pool_id"`
}

AccountHistory return Account history Obtain information about the history of a specific account.

type AccountHistoryResult

type AccountHistoryResult struct {
	Res []AccountHistory
	Err error
}

type AccountMIRHistory

type AccountMIRHistory struct {
	// Hash of the transaction containing the MIR
	TXHash string `json:"tx_hash"`

	// MIR amount in Lovelaces
	Amount string `json:"amount"`
}

AccountMIRHistory return Account MIR history Obtain information about the MIRs of a specific account.

type AccountMIRHistoryResult

type AccountMIRHistoryResult struct {
	Res []AccountMIRHistory
	Err error
}

type AccountRegistrationHistory

type AccountRegistrationHistory struct {
	// Hash of the transaction containing the (de)registration certificate
	TXHash string `json:"tx_hash"`

	// Action in the certificate
	// Enum: "registered" "deregistered"
	Action string `json:"action"`
}

AccountRegistrationHistory return Account registration history Obtain information about the registrations and deregistrations of a specific account.

type AccountRegistrationHistoryResult

type AccountRegistrationHistoryResult struct {
	Res []AccountRegistrationHistory
	Err error
}

type AccountRewardHisResult

type AccountRewardHisResult struct {
	Res []AccountRewardsHistory
	Err error
}

type AccountRewardsHistory

type AccountRewardsHistory struct {
	// Epoch of the associated reward
	Epoch int32 `json:"epoch"`

	// Rewards for given epoch in Lovelaces
	Amount string `json:"amount"`

	// Bech32 pool ID being delegated to
	PoolID string `json:"pool_id"`
}

AccountRewardsHist return Account reward history Obtain information about the reward history of a specific account.

type AccountWithdrawalHistory

type AccountWithdrawalHistory struct {
	// Hash of the transaction containing the withdrawal
	TXHash string `json:"tx_hash"`

	// Withdrawal amount in Lovelaces
	Amount string `json:"amount"`
}

AccountWithdrawalHistory return Account withdrawal history Obtain information about the withdrawals of a specific account.

type AccountWithdrawalHistoryResult

type AccountWithdrawalHistoryResult struct {
	Res []AccountWithdrawalHistory
	Err error
}

type AdditionalUtxoSet added in v0.2.0

type AdditionalUtxoSet []struct {
	TxIn  AdditionalUtxoSetTxIn  `json:"txIn"`
	TxOut AdditionalUtxoSetTxOut `json:"txOut"`
}

AdditionalUtxoSet represents a slice of tuples (TxIn, TxOut)

type AdditionalUtxoSetTxIn added in v0.2.0

type AdditionalUtxoSetTxIn struct {
	TxID  string `json:"txId"`
	Index int    `json:"index"`
}

type AdditionalUtxoSetTxOut added in v0.2.0

type AdditionalUtxoSetTxOut struct {
	Address   string       `json:"address"`
	Value     Value        `json:"value"`
	DatumHash *string      `json:"datumHash"`
	Datum     interface{}  `json:"datum"` // Could be various types
	Script    *TxOutScript `json:"script"`
}

type Address

type Address struct {
	// Bech32 encoded addresses
	Address string          `json:"address"`
	Amount  []AddressAmount `json:"amount"`

	// Stake address that controls the key
	StakeAddress *string `json:"stake_address"`

	// Address era.
	// Enum: "byron" "shelley"
	Type string `json:"type"`

	// True if this is a script address
	Script bool `json:"script"`
}

type AddressAmount

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

type AddressDetails

type AddressDetails struct {
	// Bech32 encoded address
	Address     string          `json:"address"`
	ReceivedSum []AddressAmount `json:"received_sum"`
	SentSum     []AddressAmount `json:"sent_sum"`

	// Count of all transactions on the address
	TxCount int `json:"tx_count"`
}

type AddressTransactions

type AddressTransactions struct {
	// Hash of the transaction
	TxHash string `json:"tx_hash"`

	// Transaction index within the block
	TxIndex int `json:"tx_index"`

	// Block height
	BlockHeight int `json:"block_height"`

	// Block Time (Unix time)
	BlockTime int `json:"block_time"`
}

type AddressTxResult

type AddressTxResult struct {
	Res []AddressTransactions
	Err error
}

type AddressUTXO

type AddressUTXO struct {
	Address string `json:"address"`
	// Transaction hash of the UTXO
	TxHash string `json:"tx_hash"`

	// UTXO index in the transaction
	OutputIndex int             `json:"output_index"`
	Amount      []AddressAmount `json:"amount"`

	// Block hash of the UTXO
	Block string `json:"block"`

	// The hash of the transaction output datum
	DataHash *string `json:"data_hash"`

	InlineDatum         *string `json:"inline_datum"`
	ReferenceScriptHash *string `json:"reference_script_hash"`
}

type AddressUTXOResult

type AddressUTXOResult struct {
	Res []AddressUTXO
	Err error
}

type Asset

type Asset struct {
	// Hex-encoded asset full name
	Asset string `json:"asset"`

	// Policy ID of the asset
	PolicyId string `json:"policy_id"`

	// Hex-encoded asset name of the asset
	AssetName string `json:"asset_name"`

	// CIP14 based user-facing fingerprint
	Fingerprint string `json:"fingerprint"`

	// Current asset quantity
	Quantity string `json:"quantity"`

	// ID of the initial minting transaction
	InitialMintTxHash string `json:"initial_mint_tx_hash"`

	// Count of mint and burn transactions
	MintOrBurnCount int `json:"mint_or_burn_count"`

	// On-chain metadata which SHOULD adhere to the valid standards, based on which we perform the look up and display the asset (best effort)
	OnchainMetadata *interface{} `json:"onchain_metadata"`
	// Enum: "CIP25v1" "CIP25v2" "CIP68v1"
	// If on-chain metadata passes validation, we display the standard under which it is valid
	OnchainMetadataStandard *string `json:"onchain_metadata_standard"`
	// Arbitrary plutus data (CIP68).
	OnchainMetadataExtra *string `json:"onchain_metadata_extra"`
	// Off-chain metadata fetched from GitHub based on network.
	Metadata *AssetMetadata `json:"metadata"`
}

Assets contains information on an asset.

type AssetAddress

type AssetAddress struct {
	// Address containing the specific asset
	Address string `json:"address"`

	// Asset quantity on the specific address
	Quantity string `json:"quantity"`
}

type AssetAddressesAll added in v0.1.1

type AssetAddressesAll struct {
	Res []AssetAddress
	Err error
}

type AssetByPolicy added in v0.2.0

type AssetByPolicy struct {
	// Hex-encoded asset full name
	Asset string `json:"asset"`

	// Current asset quantity
	Quantity string `json:"quantity"`
}

Assets minted under a specific policy.

type AssetByPolicyResult added in v0.2.0

type AssetByPolicyResult struct {
	Res []AssetByPolicy
	Err error
}

type AssetHistory

type AssetHistory struct {
	// Hash of the transaction containing the asset actio
	TxHash string `json:"tx_hash"`

	// Action executed upon the asset policy.
	// Enum: "minted" "burned"
	Action string `json:"action"`

	// Asset amount of the specific action
	Amount string `json:"amount"`
}

AssetHistory contains history of an asset.

type AssetMetadata

type AssetMetadata struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Ticker      string `json:"ticker"`
	URL         string `json:"url"`
	Decimals    int    `json:"decimals"`
}

Contains metadata information about an asset.

type AssetResult

type AssetResult struct {
	Res []Asset
	Err error
}

type AssetTransaction

type AssetTransaction struct {
	// Hash of the transaction
	TxHash string `json:"tx_hash"`

	// Transaction index within the block
	TxIndex int `json:"tx_index"`

	// Block height
	BlockHeight int `json:"block_height"`

	// Block time
	BlockTime int `json:"block_time"`
}

AssetTransaction contains information on transactions belonging to an asset.

type AutoBanned

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

Autobanned defines model for HTTP `418` (Auto Banned).

type BadRequest

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

BadRequest defines model for HTTP `400` (Bad Request)

type Block

type Block struct {
	// Block creation time in UNIX time
	Time int `json:"time"`

	// Block number
	Height int `json:"height"`

	// Hash of the block
	Hash string `json:"hash"`

	// Slot number
	Slot int `json:"slot"`

	// Epoch number
	Epoch int `json:"epoch"`

	// Slot within the epoch
	EpochSlot int `json:"epoch_slot"`

	// Bech32 ID of the slot leader or specific block description in case there is no slot leader
	SlotLeader string `json:"slot_leader"`

	// Block size in Bytes
	Size int `json:"size"`

	// Number of transactions in the block
	TxCount int `json:"tx_count"`

	// Total output within the block in Lovelaces
	Output *string `json:"output"`

	// Total fees within the block in Lovelaces
	Fees *string `json:"fees"`

	// VRF key of the block
	BlockVRF *string `json:"block_vrf"`

	// The hash of the operational certificate of the block producer
	OPCert *string `json:"op_cert,omitempty"` // omitempty due to webhook test fixtures

	// The value of the counter used to produce the operational certificate
	OPCertCounter *string `json:"op_cert_counter,omitempty"` // omitempty due to webhook test fixtures

	// Hash of the previous block
	PreviousBlock string `json:"previous_block"`

	// Hash of the next block
	NextBlock *string `json:"next_block"`

	// Number of block confirmations
	Confirmations int `json:"confirmations"`
}

Block defines content of a block

type BlockAffectedAddresses added in v0.2.0

type BlockAffectedAddresses struct {
	Address      string `json:"address"`
	Transactions []struct {
		TxHash string `json:"tx_hash"`
	} `json:"transactions"`
}

type BlockAffectedAddressesResult added in v0.2.0

type BlockAffectedAddressesResult struct {
	Res []BlockAffectedAddresses
	Err error
}

type BlockDistributionResult

type BlockDistributionResult struct {
	Res []string
	Err error
}

type Epoch

type Epoch struct {
	// Sum of all the active stakes within the epoch in Lovelaces
	ActiveStake *string `json:"active_stake"`

	// Number of blocks within the epoch
	BlockCount int `json:"block_count"`

	// Unix time of the end of the epoch
	EndTime int `json:"end_time"`

	// Epoch number
	Epoch int `json:"epoch"`

	// Sum of all the fees within the epoch in Lovelaces
	Fees string `json:"fees"`

	// Unix time of the first block of the epoch
	FirstBlockTime int `json:"first_block_time"`

	// Unix time of the last block of the epoch
	LastBlockTime int `json:"last_block_time"`

	// Sum of all the transactions within the epoch in Lovelaces
	Output string `json:"output"`

	// Unix time of the start of the epoch
	StartTime int `json:"start_time"`

	// Number of transactions within the epoch
	TxCount int `json:"tx_count"`
}

Epoch contains information on an epoch.

type EpochParameters

type EpochParameters struct {
	// Pool pledge influence
	A0 float32 `json:"a0"`

	// Percentage of blocks produced by federated nodes
	DecentralisationParam float32 `json:"decentralisation_param"`

	// Epoch bound on pool retirement
	EMax int `json:"e_max"`

	// Epoch number
	Epoch int `json:"epoch"`

	// Seed for extra entropy
	ExtraEntropy *map[string]interface{} `json:"extra_entropy"`

	// The amount of a key registration deposit in Lovelaces
	KeyDeposit string `json:"key_deposit"`

	// Maximum block header size
	MaxBlockHeaderSize int `json:"max_block_header_size"`

	// Maximum block body size in Bytes
	MaxBlockSize int `json:"max_block_size"`

	// Maximum transaction size
	MaxTxSize int `json:"max_tx_size"`

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

	// The linear factor for the minimum fee calculation for given epoch
	MinFeeA int `json:"min_fee_a"`

	// The constant factor for the minimum fee calculation
	MinFeeB int `json:"min_fee_b"`

	// Minimum stake cost forced on the pool
	MinPoolCost string `json:"min_pool_cost"`

	// Minimum UTXO value
	MinUtxo string `json:"min_utxo"`

	// Desired number of pools
	NOpt int `json:"n_opt"`

	// Epoch number only used once
	Nonce string `json:"nonce"`

	// The amount of a pool registration deposit in Lovelaces
	PoolDeposit string `json:"pool_deposit"`

	// Accepted protocol major version
	ProtocolMajorVer int `json:"protocol_major_ver"`

	// Accepted protocol minor version
	ProtocolMinorVer int `json:"protocol_minor_ver"`

	// Monetary expansion
	Rho float32 `json:"rho"`

	// Treasury expansion
	Tau float32 `json:"tau"`

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

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

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

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

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

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

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

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

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

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

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

type EpochPayload added in v0.2.0

type EpochPayload struct {
	PreviousEpoch Epoch `json:"previous_epoch"`
	CurrentEpoch  struct {
		Epoch     int   `json:"epoch"`
		StartTime int64 `json:"start_time"`
		EndTime   int64 `json:"end_time"`
	} `json:"current_epoch"`
}

type EpochResult

type EpochResult struct {
	Res []Epoch
	Err error
}

type EpochStake

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

type EpochStakeByPool added in v0.2.0

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

type EpochStakeByPoolResult added in v0.2.0

type EpochStakeByPoolResult struct {
	Res []EpochStakeByPool
	Err error
}

type EpochStakeResult

type EpochStakeResult struct {
	Res []EpochStake
	Err error
}

type GenesisBlock

type GenesisBlock struct {
	// The proportion of slots in which blocks should be issued
	ActiveSlotsCoefficient float32 `json:"active_slots_coefficient"`

	// Determines the quorum needed for votes on the protocol parameter updates
	UpdateQuorum float32 `json:"update_quorum"`

	// The total number of lovelace in the system
	MaxLovelaceSupply string `json:"max_lovelace_supply"`

	// Network identifier
	NetworkMagic int `json:"network_magic"`

	// Number of slots in an epoch
	EpochLength int `json:"epoch_length"`

	// Time of slot 0 in UNIX time
	SystemStart int `json:"system_start"`

	// Number of slots in an KES period
	SlotsPerKesPeriod int `json:"slots_per_kes_period"`

	// Duration of one slot in seconds
	SlotLength int `json:"slot_length"`

	// The maximum number of time a KES key can be evolved before
	// a pool operator must create a new operational certificate
	MaxKesEvolutions int `json:"max_kes_evolutions"`

	// Security parameter k
	SecurityParam int `json:"security_param"`
}

GenesisBlock contains the information of the genesis block of the network.

type Health

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

Health describes boolean for backend server health status.

type HealthClock

type HealthClock struct {
	ServerTime int64 `json:"server_time"`
}

HealthClock describes current UNIX time

type IPFSClient

type IPFSClient interface {
	Add(ctx context.Context, filePath string) (IPFSObject, error)
	Pin(ctx context.Context, path string) (IPFSPinnedObject, error)
	PinnedObject(ctx context.Context, path string) (IPFSPinnedObject, error)
	PinnedObjects(ctx context.Context, query APIQueryParams) ([]IPFSPinnedObject, error)
	Remove(ctx context.Context, path string) (IPFSObject, error)
	Gateway(ctx context.Context, path string) ([]byte, error)
	PinnedObjectsAll(ctx context.Context) <-chan PinnedObjectResult
}

func NewIPFSClient

func NewIPFSClient(options IPFSClientOptions) IPFSClient

NewIPFSClient creates and returns an IPFS client configured using IPFSClientOptions. It will initialize the client with default options if provided with empty options

type IPFSClientOptions

type IPFSClientOptions struct {
	// The project_id to use from blockfrost. If not set
	// `BLOCKFROST_IPFS_PROJECT_ID` is loaded from env
	ProjectID string
	// Configures server to use. Can be toggled for test servers
	Server string
	// Max goroutines to use for *All Methods
	MaxRoutines int
	// Underlying http client to use. If not set, default github.com/hashicorp/go-retryablehttp is used.
	Client *http.Client
}

type IPFSObject

type IPFSObject struct {
	// Name of the file
	Name string `json:"name"`

	// IPFS hash of the file
	IPFSHash string `json:"ipfs_hash"`

	// IPFS node size in Bytes
	Size string `json:"size"`
}

IPFSObject contains information on an IPFS object

type IPFSPinnedObject

type IPFSPinnedObject struct {
	// Creation time of the IPFS object on our backends
	TimeCreated int `json:"time_created"`

	// Pin time of the IPFS object on our backends
	TimePinned int `json:"time_pinned"`

	// IPFS hash of the pinned object
	IPFSHash string `json:"ipfs_hash"`

	// Size of the object in Bytes
	State string `json:"state"`

	// State of the pinned object, which is queued when we are retriving object.
	// If this is successful the state is changed to pinned or failed if not.
	// The state gc means the pinned item has been garbage collected due to account being
	// over storage quota or after it has been moved to unpinned state by removing the object pin.
	//
	// Value: "queued|pinned|unpinned|failed|gc"
	Size string `json:"size"`
}

IPFSPinnedObject contains information on a pinned object

type Info

type Info struct {
	Url     string `json:"url"`
	Version string `json:"version"`
}

Info defines model for root endpoint `/`

type InternalServerError

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

InternalServerError defines model for HTTP `500` (Internal Server Error)

type Mempool added in v0.2.0

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

type MempoolResult added in v0.2.0

type MempoolResult struct {
	Res []Mempool
	Err error
}

type MempoolTransaction added in v0.2.0

type MempoolTransaction struct {
	// Count of asset mints and burns within the transaction
	AssetMintOrBurnCount int `json:"asset_mint_or_burn_count"`

	// Count of the delegations within the transaction
	DelegationCount int `json:"delegation_count"`

	// Deposit within the transaction in Lovelaces
	Deposit string `json:"deposit"`

	// Fees of the transaction in Lovelaces
	Fees string `json:"fees"`

	// Transaction hash
	Hash string `json:"hash"`

	// Left (included) endpoint of the timelock validity intervals
	InvalidBefore *string `json:"invalid_before"`

	// Right (excluded) endpoint of the timelock validity intervals
	InvalidHereafter *string `json:"invalid_hereafter"`

	// Count of the MIR certificates within the transaction
	MirCertCount int `json:"mir_cert_count"`
	OutputAmount []struct {
		// The quantity of the unit
		Quantity string `json:"quantity"`

		// The unit of the value
		Unit string `json:"unit"`
	} `json:"output_amount"`

	// Count of the stake pool retirement certificates within the transaction
	PoolRetireCount int `json:"pool_retire_count"`

	// Count of the stake pool registration and update certificates within the transaction
	PoolUpdateCount int `json:"pool_update_count"`

	// Count of redeemers within the transaction
	RedeemerCount int `json:"redeemer_count"`

	// Size of the transaction in Bytes
	Size int `json:"size"`

	// Count of the stake keys (de)registration and delegation certificates within the transaction
	StakeCertCount int `json:"stake_cert_count"`

	// Count of UTXOs within the transaction
	UtxoCount int `json:"utxo_count"`

	// Script passed validation
	ValidContract bool `json:"valid_contract"`

	// Count of the withdrawals within the transaction
	WithdrawalCount int `json:"withdrawal_count"`
}

type MempoolTransactionContent added in v0.2.0

type MempoolTransactionContent struct {
	Tx        MempoolTransaction            `json:"tx"`
	Inputs    []MempoolTransactionInput     `json:"inputs"`
	Outputs   []MempoolTransactionOutput    `json:"outputs"`
	Redeemers []MempoolTransactionRedeemers `json:"redeemers"`
}

type MempoolTransactionInput added in v0.2.0

type MempoolTransactionInput struct {
	Address     string  `json:"address"`
	OutputIndex float32 `json:"output_index"`
	TxHash      string  `json:"tx_hash"`
	Collateral  bool    `json:"collateral"`
	Reference   bool    `json:"reference"`
}

type MempoolTransactionOutput added in v0.2.0

type MempoolTransactionOutput struct {
	// Output address
	Address             string     `json:"address"`
	Amount              []TxAmount `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"`
}

type MempoolTransactionRedeemers added in v0.2.0

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

type MetadataTxContentInCBOR

type MetadataTxContentInCBOR struct {
	TxHash   string  `json:"tx_hash"`
	Metadata *string `json:"metadata"`
}

MetadataTxContentInCBOR return Transaction metadata content in CBOR Transaction metadata per label.

type MetadataTxContentInCBORResult

type MetadataTxContentInCBORResult struct {
	Res []MetadataTxContentInCBOR
	Err error
}

type MetadataTxContentInJSON

type MetadataTxContentInJSON struct {
	TxHash string `json:"tx_hash"`
	// 	string or object or Array of any or integer or number or boolean Nullable
	// Content of the JSON metadata
	JSONMetadata *interface{} `json:"json_metadata"`
}

MetadataTxContentInJSON Transaction metadata content raw in JSON Transaction metadata per label. This struct are more flexible on JSONMetadata field

type MetadataTxContentInJSONResult

type MetadataTxContentInJSONResult struct {
	Res []MetadataTxContentInJSON
	Err error
}

type MetadataTxLabel

type MetadataTxLabel struct {
	Label string  `json:"label"`
	Cip10 *string `json:"cip10"`
	Count string  `json:"count"`
}

MetadataTxLabel return Transaction metadata labels List of all used transaction metadata labels.

type MetadataTxLabelResult

type MetadataTxLabelResult struct {
	Res []MetadataTxLabel
	Err error
}

type Metric

type Metric struct {
	// Sum of all calls for a particular day
	Calls int `json:"calls"`

	// Starting time of the call count interval (ends midnight UTC) in UNIX time
	Time int `json:"time"`
}

Metric describes the Blockfrost usage metrics

type MetricsEndpoint

type MetricsEndpoint struct {
	// Sum of all calls for a particular day and endpoint
	Calls int `json:"calls"`

	// Endpoint parent name
	Endpoint string `json:"endpoint"`

	// Starting time of the call count interval (ends midnight UTC) in UNIX time
	Time int `json:"time"`
}

MetricsEndpoint

type NetworkInfo

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

NetworkInfo contains network stake and supply information on the network

type NetworkStake

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

NetworkStake contains information on the cardano network stake

type NetworkSupply

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

NetworkSupply contains information on network supply

type NotFound

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

NotFound defines model for HTTP `404` (Resource Not Found).

type NutlinkAddress

type NutlinkAddress struct {
	// Bech32 encoded address
	Address string `json:"address"`

	// URL of the specific metadata file
	MetadataUrl string `json:"metadata_url"`

	// Hash of the metadata file
	MetadataHash string `json:"metadata_hash"`

	// The cached metadata of the `metadata_url` file.
	Metadata NutlinkAddressMeta `json:"metadata"`
}

type NutlinkAddressMeta

type NutlinkAddressMeta struct {
	Ticker      string `json:"ticker"`
	Name        string `json:"name"`
	Description string `json:"description"`
	HomePage    string `json:"homepage"`
	Address     string `json:"address"`
}

type OgmiosResponse added in v0.2.0

type OgmiosResponse struct {
	Type        string `json:"type"`
	Version     string `json:"version"`
	ServiceName string `json:"servicename"`
	MethodName  string `json:"methodname"`
	Reflection  struct {
		Id string `json:"id"`
	} `json:"reflection"`
	Result json.RawMessage `json:"result"`
}

type OverusageLimit

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

OverusageLimit defines model for HTTP `429` (Over Usage).

type PinnedObjectResult

type PinnedObjectResult struct {
	Res []IPFSPinnedObject
	Err error
}

PinnedObjectResult contains response and error from an All method

type Pool

type Pool struct {
	PoolID         string   `json:"pool_id"`
	Hex            string   `json:"hex"`
	VrfKey         string   `json:"vrf_key"`
	BlocksMinted   int      `json:"blocks_minted"`
	LiveStake      string   `json:"live_stake"`
	LiveSize       float64  `json:"live_size"`
	LiveSaturation float64  `json:"live_saturation"`
	LiveDelegators int      `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"`
}

Pool information.

type PoolBlocks

type PoolBlocks []string

PoolBlocks return Stake pool blocks List of stake pools blocks.

type PoolBlocksResult

type PoolBlocksResult struct {
	Res PoolBlocks
	Err error
}

type PoolDelegator

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

PoolDelegator return Stake pool delegators List of current stake pools delegators.

type PoolDelegatorsResult

type PoolDelegatorsResult struct {
	Res []PoolDelegator
	Err error
}

type PoolHistory

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

PoolHistory return Stake pool history History of stake pool parameters over epochs.

type PoolHistoryResult

type PoolHistoryResult struct {
	Res []PoolHistory
	Err error
}

type PoolMetadata

type PoolMetadata 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"`
}

PoolMetadata return Stake pool metadata Stake pool registration metadata.

type PoolRelay

type PoolRelay struct {
	Ipv4   *string `json:"ipv4"`
	Ipv6   *string `json:"ipv6"`
	DNS    *string `json:"dns"`
	DNSSrv *string `json:"dns_srv"`
	Port   int     `json:"port"`
}

PoolRelay return Stake pool relays Relays of a stake pool.

type PoolRetired

type PoolRetired struct {
	PoolID string `json:"pool_id"`
	Epoch  int    `json:"epoch"`
}

List of retired stake pools List of already retired pools.

type PoolRetiring

type PoolRetiring struct {
	PoolID string `json:"pool_id"`
	Epoch  int    `json:"epoch"`
}

type PoolUpdate

type PoolUpdate struct {
	TxHash    string `json:"tx_hash"`
	CERTIndex int    `json:"cert_index"`
	Action    string `json:"action"`
}

PoolUpdate return Stake pool updates List of certificate updates to the stake pool.

type PoolUpdateResult

type PoolUpdateResult struct {
	Res []PoolUpdate
	Err error
}

type Pools

type Pools []string

List of stake pools List of registered stake pools.

type PoolsResult

type PoolsResult struct {
	Res Pools
	Err error
}

type PoolsRetiredResult

type PoolsRetiredResult struct {
	Res []PoolRetired
	Err error
}

type PoolsRetiringResult

type PoolsRetiringResult struct {
	Res []PoolRetiring
	Err error
}

type Quantity added in v0.2.0

type Quantity string

type Script

type Script struct {
	// Script hash
	ScriptHash string `json:"script_hash"`

	// Type of the script language
	Type string `json:"type"`

	// The size of the CBOR serialised script, if a Plutus script
	SerialisedSize *int `json:"serialised_size"`
}

Script contains information about a script

type ScriptAllResult

type ScriptAllResult struct {
	Res []Script
	Err error
}

type ScriptRedeemer

type ScriptRedeemer struct {
	// Hash of the transaction
	TxHash string `json:"tx_hash"`

	// The index of the redeemer pointer in the transaction
	TxIndex int `json:"tx_index"`

	// Validation purpose. Enum: "spend" "mint" "cert" "reward"
	Purpose string `json:"purpose"`

	// Datum hash
	DatumHash string `json:"datum_hash"`

	// The budget in Memory to run a script
	UnitMem string `json:"unit_mem"`

	// The budget in CPU steps to run a script
	UnitSteps string `json:"unit_steps"`

	// The fee consumed to run the script
	Fee string `json:"fee"`
}

ScriptRedeemer contains information about a script redeemer.

type ScriptRedeemerResult

type ScriptRedeemerResult struct {
	Res []ScriptRedeemer
	Err error
}

type StakeDelegationPayload added in v0.2.0

type StakeDelegationPayload struct {
	Tx          TransactionContent `json:"tx"`
	Delegations []struct {
		TransactionDelegation
		Pool Pool `json:"pool"`
	}
}

type Ticker

type Ticker struct {
	// Name of the ticker
	Name string `json:"name"`

	// Number of ticker records
	Count int `json:"count"`

	// Block height of the latest record
	LatestBlock int `json:"latest_block"`
}

type TickerRecord

type TickerRecord struct {
	// Hash of the transaction
	TxHash string `json:"tx_hash"`

	// Block height of the record
	BlockHeight int `json:"block_height"`

	// Transaction index within the block
	TxIndex int `json:"tx_index"`
}

type TickerRecordResult

type TickerRecordResult struct {
	Res []TickerRecord
	Err error
}

type TickerResult

type TickerResult struct {
	Res []Ticker
	Err error
}

type Transaction

type Transaction string

type TransactionContent

type TransactionContent struct {
	// Count of asset mints and burns within the transaction
	AssetMintOrBurnCount int `json:"asset_mint_or_burn_count"`

	// Block hash
	Block string `json:"block"`

	// Block number
	BlockHeight int `json:"block_height"`

	// Block creation time
	BlockTime int `json:"block_time"`

	// Count of the delegations within the transaction
	DelegationCount int `json:"delegation_count"`

	// Deposit within the transaction in Lovelaces
	Deposit string `json:"deposit"`

	// Fees of the transaction in Lovelaces
	Fees string `json:"fees"`

	// Transaction hash
	Hash string `json:"hash"`

	// Transaction index within the block
	Index int `json:"index"`

	// Left (included) endpoint of the timelock validity intervals
	InvalidBefore *string `json:"invalid_before"`

	// Right (excluded) endpoint of the timelock validity intervals
	InvalidHereafter *string `json:"invalid_hereafter"`

	// Count of the MIR certificates within the transaction
	MirCertCount int `json:"mir_cert_count"`
	OutputAmount []struct {
		// The quantity of the unit
		Quantity string `json:"quantity"`

		// The unit of the value
		Unit string `json:"unit"`
	} `json:"output_amount"`

	// Count of the stake pool retirement certificates within the transaction
	PoolRetireCount int `json:"pool_retire_count"`

	// Count of the stake pool registration and update certificates within the transaction
	PoolUpdateCount int `json:"pool_update_count"`

	// Count of redeemers within the transaction
	RedeemerCount int `json:"redeemer_count"`

	// Size of the transaction in Bytes
	Size int `json:"size"`

	// Slot number
	Slot int `json:"slot"`

	// Count of the stake keys (de)registration and delegation certificates within the transaction
	StakeCertCount int `json:"stake_cert_count"`

	// Count of UTXOs within the transaction
	UtxoCount int `json:"utxo_count"`

	// Script passed validation
	ValidContract bool `json:"valid_contract"`

	// Count of the withdrawals within the transaction
	WithdrawalCount int `json:"withdrawal_count"`
}

type TransactionDelegation

type TransactionDelegation struct {
	// Epoch in which the delegation becomes active
	ActiveEpoch int `json:"active_epoch"`

	// Bech32 delegation stake address
	Address string `json:"address"`

	// Index of the certificate within the transaction
	CertIndex int `json:"cert_index"`

	// Index of the certificate within the transaction
	Index int `json:"index"`

	// Bech32 ID of delegated stake pool
	PoolId string `json:"pool_id"`
}

type TransactionInput added in v0.2.0

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

type TransactionMIR

type TransactionMIR struct {
	// Bech32 stake address
	Address string `json:"address"`

	// MIR amount in Lovelaces
	Amount string `json:"amount"`

	// Index of the certificate within the transaction
	CertIndex int `json:"cert_index"`

	// Source of MIR funds
	Pot string `json:"pot"`
}

type TransactionMetadata

type TransactionMetadata struct {
	// Content of the metadata
	JsonMetadata interface{} `json:"json_metadata"`

	// Metadata label
	Label string `json:"label"`
}

type TransactionMetadataCbor

type TransactionMetadataCbor struct {
	// Deprecated: Use Metadata instead.
	CborMetadata *string `json:"cbor_metadata"`
	// Content of the CBOR metadata
	Metadata string `json:"metadata"`

	// Metadata label
	Label string `json:"label"`
}

type TransactionOutput added in v0.2.0

type TransactionOutput struct {
	Address             string     `json:"address"`
	Amount              []TxAmount `json:"amount"`
	OutputIndex         int        `json:"output_index"`
	DataHash            *string    `json:"data_hash"`
	InlineDatum         *string    `json:"inline_datum"`
	ReferenceScriptHash *string    `json:"reference_script_hash"`
}

type TransactionPayload added in v0.2.0

type TransactionPayload struct {
	Tx      TransactionContent  `json:"tx"`
	Inputs  []TransactionInput  `json:"inputs"`
	Outputs []TransactionOutput `json:"outputs"`
}

type TransactionPoolCert

type TransactionPoolCert struct {
	// Epoch that the delegation becomes active
	ActiveEpoch int `json:"active_epoch"`

	// Index of the certificate within the transaction
	CertIndex int `json:"cert_index"`

	// Fixed tax cost of the stake pool in Lovelaces
	FixedCost string `json:"fixed_cost"`

	// Margin tax cost of the stake pool
	MarginCost float32 `json:"margin_cost"`
	Metadata   *struct {
		// Description of the stake pool
		Description string `json:"description"`

		// Hash of the metadata file
		Hash string `json:"hash"`

		// Home page of the stake pool
		Homepage string `json:"homepage"`

		// Name of the stake pool
		Name string `json:"name"`

		// Ticker of the stake pool
		Ticker string `json:"ticker"`

		// URL to the stake pool metadata
		Url string `json:"url"`
	} `json:"metadata"`
	Owners []string `json:"owners"`

	// Stake pool certificate pledge in Lovelaces
	Pledge string `json:"pledge"`

	// Bech32 encoded pool ID
	PoolId string `json:"pool_id"`
	Relays []struct {
		// DNS name of the relay
		Dns string `json:"dns"`

		// DNS SRV entry of the relay
		DnsSrv string `json:"dns_srv"`

		// IPv4 address of the relay
		Ipv4 string `json:"ipv4"`

		// IPv6 address of the relay
		Ipv6 string `json:"ipv6"`

		// Network port of the relay
		Port int `json:"port"`
	} `json:"relays"`

	// Bech32 reward account of the stake pool
	RewardAccount string `json:"reward_account"`

	// VRF key hash
	VrfKey string `json:"vrf_key"`
}

type TransactionPoolRetires

type TransactionPoolRetires struct {
	// Index of the certificate within the transaction
	CertIndex int `json:"cert_index"`

	// Bech32 stake pool ID
	PoolId string `json:"pool_id"`

	// Retiring epoch
	RetiringEpoch int `json:"retiring_epoch"`
}

type TransactionRedeemer

type TransactionRedeemer struct {
	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"`
}

type TransactionStakeAddressCert

type TransactionStakeAddressCert struct {
	// Delegation stake address
	Address string `json:"address"`

	// Index of the certificate within the transaction
	CertIndex int `json:"cert_index"`

	// Registration boolean, false if deregistration
	Registration bool `json:"registration"`
}

type TransactionUTXOs

type TransactionUTXOs struct {
	// Transaction hash
	Hash    string              `json:"hash"`
	Inputs  []TransactionInput  `json:"inputs"`
	Outputs []TransactionOutput `json:"outputs"`
}

type TransactionWidthrawal

type TransactionWidthrawal struct {
	// Bech32 withdrawal address
	Address string `json:"address"`

	// Withdrawal amount in Lovelaces
	Amount string `json:"amount"`
}

type TxAmount

type TxAmount struct {
	// The quantity of the unit
	Quantity string `json:"quantity"`

	// The unit of the value
	Unit string `json:"unit"`
}

type TxOutScript added in v0.2.0

type TxOutScript interface{}

type UnauthorizedError

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

UnauthorizedEror defines model for HTTP `403` (Unauthorized).

type Value added in v0.2.0

type Value struct {
	Coins  Quantity            `json:"coins"`
	Assets map[string]Quantity `json:"assets,omitempty"`
}

type WebhookEvent added in v0.2.0

type WebhookEvent struct {
	WebhookEventCommon
}

func VerifyWebhookSignature added in v0.2.0

func VerifyWebhookSignature(payload []byte, header string, secret string) (*WebhookEvent, error)

func VerifyWebhookSignatureIgnoringTolerance added in v0.2.0

func VerifyWebhookSignatureIgnoringTolerance(payload []byte, header string, secret string) (*WebhookEvent, error)

func VerifyWebhookSignatureWithTolerance added in v0.2.0

func VerifyWebhookSignatureWithTolerance(payload []byte, header string, secret string, tolerance time.Duration) (*WebhookEvent, error)

type WebhookEventBlock added in v0.2.0

type WebhookEventBlock struct {
	WebhookEventCommon
	Payload Block `json:"payload"`
}

type WebhookEventCommon added in v0.2.0

type WebhookEventCommon struct {
	ID         string `json:"id"`
	WebhookID  string `json:"webhook_id"`
	Created    int    `json:"created"`
	APIVersion int    `json:"api_version,omitempty"` // omitempty because test fixtures do not include it
	Type       string `json:"type"`                  // block, transaction, delegation, epoch
}

type WebhookEventDelegation added in v0.2.0

type WebhookEventDelegation struct {
	WebhookEventCommon
	Payload []StakeDelegationPayload `json:"payload"`
}

type WebhookEventEpoch added in v0.2.0

type WebhookEventEpoch struct {
	WebhookEventCommon
	Payload EpochPayload `json:"payload"`
}

type WebhookEventTransaction added in v0.2.0

type WebhookEventTransaction struct {
	WebhookEventCommon
	Payload []TransactionPayload `json:"payload"`
}

type WebhookEventType added in v0.2.0

type WebhookEventType string
const (
	WebhookEventTypeBlock       WebhookEventType = "block"
	WebhookEventTypeDelegation  WebhookEventType = "delegation"
	WebhookEventTypeEpoch       WebhookEventType = "epoch"
	WebhookEventTypeTransaction WebhookEventType = "transaction"
)

Directories

Path Synopsis
example
basic
A basic example of how to initialize and get info from Blockfrost API using the SDK.
A basic example of how to initialize and get info from Blockfrost API using the SDK.
webhook
This example shows how to implement a webhook endpoint for receiving Blockfrost Webhook requests https://blockfrost.dev/start-building/webhooks/ Run using: go run example/webhook/main.go
This example shows how to implement a webhook endpoint for receiving Blockfrost Webhook requests https://blockfrost.dev/start-building/webhooks/ Run using: go run example/webhook/main.go
internal

Jump to

Keyboard shortcuts

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