Documentation
¶
Index ¶
- type API
- type AccountTransactionExpandOptions
- type AccountTransactionFilter
- type AccountTransactionsBackend
- type AccountTransferExpandOptions
- type AccountTransferFilter
- type AccountTransfersBackend
- func (b *AccountTransfersBackend) GetAccountFungibleTokenTransfers(ctx context.Context, address flow.Address, limit uint32, ...) (*accessmodel.FungibleTokenTransfersPage, error)
- func (b *AccountTransfersBackend) GetAccountNonFungibleTokenTransfers(ctx context.Context, address flow.Address, limit uint32, ...) (*accessmodel.NonFungibleTokenTransfersPage, error)
- type Backend
- type Config
- type ContractDeploymentExpandOptions
- type ContractDeploymentFilter
- type ContractsBackend
- func (b *ContractsBackend) GetContract(ctx context.Context, id string, filter ContractDeploymentFilter, ...) (*accessmodel.ContractDeployment, error)
- func (b *ContractsBackend) GetContractDeployments(ctx context.Context, id string, limit uint32, ...) (*accessmodel.ContractDeploymentPage, error)
- func (b *ContractsBackend) GetContracts(ctx context.Context, limit uint32, ...) (*accessmodel.ContractDeploymentPage, error)
- func (b *ContractsBackend) GetContractsByAddress(ctx context.Context, address flow.Address, limit uint32, ...) (*accessmodel.ContractDeploymentPage, error)
- type ScheduledTransactionExpandOptions
- type ScheduledTransactionFilter
- type ScheduledTransactionsBackend
- func (b *ScheduledTransactionsBackend) GetScheduledTransaction(ctx context.Context, id uint64, ...) (*accessmodel.ScheduledTransaction, error)
- func (b *ScheduledTransactionsBackend) GetScheduledTransactions(ctx context.Context, limit uint32, ...) (*accessmodel.ScheduledTransactionsPage, error)
- func (b *ScheduledTransactionsBackend) GetScheduledTransactionsByAddress(ctx context.Context, address flow.Address, limit uint32, ...) (*accessmodel.ScheduledTransactionsPage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
// GetAccountTransactions returns a paginated list of transactions for the given account address.
// Results are ordered descending by block height (newest first).
//
// If the account is found but has no transactions, the response will include an empty array and no error.
//
// Expected error returns during normal operations:
// - [codes.NotFound] if the account is not found
// - [codes.FailedPrecondition] if the account transaction index has not been initialized
// - [codes.OutOfRange] if the cursor references a height outside the indexed range
// - [codes.InvalidArgument] if the query parameters are invalid
GetAccountTransactions(
ctx context.Context,
address flow.Address,
limit uint32,
cursor *accessmodel.AccountTransactionCursor,
filter AccountTransactionFilter,
expandOptions AccountTransactionExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.AccountTransactionsPage, error)
// GetAccountFungibleTokenTransfers returns a paginated list of fungible token transfers for
// the given account address. Results are ordered descending by block height (newest first).
//
// If the account has no transfers, the response will include an empty array and no error.
//
// Expected error returns during normal operations:
// - [codes.NotFound] if the account is not found
// - [codes.FailedPrecondition] if the fungible token transfer index has not been initialized
// - [codes.OutOfRange] if the cursor references a height outside the indexed range
// - [codes.InvalidArgument] if the query parameters are invalid
GetAccountFungibleTokenTransfers(
ctx context.Context,
address flow.Address,
limit uint32,
cursor *accessmodel.TransferCursor,
filter AccountTransferFilter,
expandOptions AccountTransferExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.FungibleTokenTransfersPage, error)
// GetAccountNonFungibleTokenTransfers returns a paginated list of non-fungible token transfers
// for the given account address. Results are ordered descending by block height (newest first).
//
// If the account has no transfers, the response will include an empty array and no error.
//
// Expected error returns during normal operations:
// - [codes.NotFound] if the account is not found
// - [codes.FailedPrecondition] if the non-fungible token transfer index has not been initialized
// - [codes.OutOfRange] if the cursor references a height outside the indexed range
// - [codes.InvalidArgument] if the query parameters are invalid
GetAccountNonFungibleTokenTransfers(
ctx context.Context,
address flow.Address,
limit uint32,
cursor *accessmodel.TransferCursor,
filter AccountTransferFilter,
expandOptions AccountTransferExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.NonFungibleTokenTransfersPage, error)
// GetScheduledTransaction returns a single scheduled transaction by its scheduler-assigned ID.
//
// Expected error returns during normal operations:
// - [codes.NotFound]: if no transaction with the given ID exists
// - [codes.FailedPrecondition]: if the index has not been initialized
GetScheduledTransaction(
ctx context.Context,
id uint64,
expandOptions ScheduledTransactionExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.ScheduledTransaction, error)
// GetScheduledTransactions returns a paginated list of scheduled transactions.
//
// Expected error returns during normal operations:
// - [codes.FailedPrecondition]: if the index has not been initialized
// - [codes.InvalidArgument]: if the query parameters are invalid
GetScheduledTransactions(
ctx context.Context,
limit uint32,
cursor *accessmodel.ScheduledTransactionCursor,
filter ScheduledTransactionFilter,
expandOptions ScheduledTransactionExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.ScheduledTransactionsPage, error)
// GetScheduledTransactionsByAddress returns a paginated list of scheduled transactions for the given address.
//
// Expected error returns during normal operations:
// - [codes.FailedPrecondition]: if the index has not been initialized
// - [codes.InvalidArgument]: if the query parameters are invalid
GetScheduledTransactionsByAddress(
ctx context.Context,
address flow.Address,
limit uint32,
cursor *accessmodel.ScheduledTransactionCursor,
filter ScheduledTransactionFilter,
expandOptions ScheduledTransactionExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.ScheduledTransactionsPage, error)
// GetContract returns the most recent deployment of the given contract.
//
// Expected error returns during normal operations:
// - [codes.NotFound]: if no contract with the given identifier exists
// - [codes.FailedPrecondition]: if the index has not been initialized
GetContract(
ctx context.Context,
id string,
filter ContractDeploymentFilter,
expandOptions ContractDeploymentExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.ContractDeployment, error)
// GetContractDeployments returns a paginated list of all deployments of the given contract,
// most recent first.
//
// Expected error returns during normal operations:
// - [codes.NotFound]: if no contract with the given identifier exists
// - [codes.FailedPrecondition]: if the index has not been initialized
// - [codes.InvalidArgument]: if query parameters are invalid
GetContractDeployments(
ctx context.Context,
id string,
limit uint32,
cursor *accessmodel.ContractDeploymentsCursor,
filter ContractDeploymentFilter,
expandOptions ContractDeploymentExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.ContractDeploymentPage, error)
// GetContracts returns a paginated list of contracts at their latest deployment.
//
// Expected error returns during normal operations:
// - [codes.FailedPrecondition]: if the index has not been initialized
// - [codes.InvalidArgument]: if query parameters are invalid
GetContracts(
ctx context.Context,
limit uint32,
cursor *accessmodel.ContractDeploymentsCursor,
filter ContractDeploymentFilter,
expandOptions ContractDeploymentExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.ContractDeploymentPage, error)
// GetContractsByAddress returns a paginated list of contracts at their latest deployment for
// the given address.
//
// Expected error returns during normal operations:
// - [codes.FailedPrecondition]: if the index has not been initialized
// - [codes.InvalidArgument]: if query parameters are invalid
GetContractsByAddress(
ctx context.Context,
address flow.Address,
limit uint32,
cursor *accessmodel.ContractDeploymentsCursor,
filter ContractDeploymentFilter,
expandOptions ContractDeploymentExpandOptions,
encodingVersion entities.EventEncodingVersion,
) (*accessmodel.ContractDeploymentPage, error)
}
API defines the extended access API for querying account transaction and transfer history.
type AccountTransactionExpandOptions ¶
func (*AccountTransactionExpandOptions) HasExpand ¶
func (o *AccountTransactionExpandOptions) HasExpand() bool
type AccountTransactionFilter ¶
type AccountTransactionFilter struct {
Roles []accessmodel.TransactionRole
}
func (*AccountTransactionFilter) Filter ¶
func (f *AccountTransactionFilter) Filter() storage.IndexFilter[*accessmodel.AccountTransaction]
type AccountTransactionsBackend ¶
type AccountTransactionsBackend struct {
// contains filtered or unexported fields
}
AccountTransactionsBackend implements the extended API for querying account transactions.
func NewAccountTransactionsBackend ¶
func NewAccountTransactionsBackend( log zerolog.Logger, base *backendBase, store storage.AccountTransactionsReader, chain flow.Chain, ) *AccountTransactionsBackend
NewAccountTransactionsBackend creates a new AccountTransactionsBackend instance.
func (*AccountTransactionsBackend) GetAccountTransactions ¶
func (b *AccountTransactionsBackend) GetAccountTransactions( ctx context.Context, address flow.Address, limit uint32, cursor *accessmodel.AccountTransactionCursor, filter AccountTransactionFilter, expandOptions AccountTransactionExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.AccountTransactionsPage, error)
GetAccountTransactions returns a paginated list of transactions for the given account address. Results are ordered descending by block height (newest first).
If the account is found but has no transactions, the response will include an empty array and no error.
Expected error returns during normal operations:
- codes.NotFound if the account is not found
- codes.FailedPrecondition if the account transaction index has not been initialized
- codes.OutOfRange if the cursor references a height outside the indexed range
- codes.InvalidArgument if the query parameters are invalid
type AccountTransferExpandOptions ¶
func (*AccountTransferExpandOptions) HasExpand ¶
func (o *AccountTransferExpandOptions) HasExpand() bool
type AccountTransferFilter ¶
type AccountTransferFilter struct {
TokenType string
SourceAddress flow.Address
RecipientAddress flow.Address
}
func (*AccountTransferFilter) FTFilter ¶
func (f *AccountTransferFilter) FTFilter() storage.IndexFilter[*accessmodel.FungibleTokenTransfer]
FTFilter returns a filter function for fungible token transfers based on the filter criteria. Returns nil when no filter criteria are set, indicating all transfers should be accepted.
func (*AccountTransferFilter) NFTFilter ¶
func (f *AccountTransferFilter) NFTFilter() storage.IndexFilter[*accessmodel.NonFungibleTokenTransfer]
NFTFilter returns a filter function for non-fungible token transfers based on the filter criteria. Returns nil when no filter criteria are set, indicating all transfers should be accepted.
type AccountTransfersBackend ¶
type AccountTransfersBackend struct {
// contains filtered or unexported fields
}
AccountTransfersBackend implements the extended API for querying account token transfers.
func NewAccountTransfersBackend ¶
func NewAccountTransfersBackend( log zerolog.Logger, base *backendBase, ftStore storage.FungibleTokenTransfersBootstrapper, nftStore storage.NonFungibleTokenTransfersBootstrapper, chain flow.Chain, ) *AccountTransfersBackend
NewAccountTransfersBackend creates a new AccountTransfersBackend instance.
func (*AccountTransfersBackend) GetAccountFungibleTokenTransfers ¶
func (b *AccountTransfersBackend) GetAccountFungibleTokenTransfers( ctx context.Context, address flow.Address, limit uint32, cursor *accessmodel.TransferCursor, filter AccountTransferFilter, expandOptions AccountTransferExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.FungibleTokenTransfersPage, error)
GetAccountFungibleTokenTransfers returns a paginated list of fungible token transfers for the given account address. Results are ordered descending by block height (newest first).
If the account has no transfers, the response will include an empty array and no error.
Expected error returns during normal operations:
- codes.NotFound if the account is not found
- codes.FailedPrecondition if the fungible token transfer index has not been initialized
- codes.OutOfRange if the cursor references a height outside the indexed range
- codes.InvalidArgument if the query parameters are invalid
func (*AccountTransfersBackend) GetAccountNonFungibleTokenTransfers ¶
func (b *AccountTransfersBackend) GetAccountNonFungibleTokenTransfers( ctx context.Context, address flow.Address, limit uint32, cursor *accessmodel.TransferCursor, filter AccountTransferFilter, expandOptions AccountTransferExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.NonFungibleTokenTransfersPage, error)
GetAccountNonFungibleTokenTransfers returns a paginated list of non-fungible token transfers for the given account address. Results are ordered descending by block height (newest first).
If the account has no transfers, the response will include an empty array and no error.
Expected error returns during normal operations:
- codes.NotFound if the account is not found
- codes.FailedPrecondition if the non-fungible token transfer index has not been initialized
- codes.OutOfRange if the cursor references a height outside the indexed range
- codes.InvalidArgument if the query parameters are invalid
type Backend ¶
type Backend struct {
*AccountTransactionsBackend
*AccountTransfersBackend
*ScheduledTransactionsBackend
*ContractsBackend
// contains filtered or unexported fields
}
Backend implements the extended API for querying account transactions and token transfers.
func New ¶
func New( log zerolog.Logger, config Config, chainID flow.ChainID, store storage.AccountTransactionsReader, ftStore storage.FungibleTokenTransfersBootstrapper, nftStore storage.NonFungibleTokenTransfersBootstrapper, state protocol.State, blocks storage.Blocks, headers storage.Headers, eventsIndex *index.EventsIndex, txResultsIndex *index.TransactionResultsIndex, txErrorMessageProvider error_messages.Provider, collections storage.CollectionsReader, transactions storage.TransactionsReader, scheduledTransactions storage.ScheduledTransactionsReader, scheduledTxIndex storage.ScheduledTransactionsIndexReader, contractsIndex storage.ContractDeploymentsIndexReader, txStatusDeriver *txstatus.TxStatusDeriver, scriptExecutor execution.ScriptExecutor, ) (*Backend, error)
New creates a new Backend instance.
type Config ¶
type Config struct {
DefaultPageSize uint32 // Page size used when limit is 0.
MaxPageSize uint32 // Maximum allowed page size.
}
Config holds configuration for the extended API backend.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration for the extended API backend.
type ContractDeploymentExpandOptions ¶
func (*ContractDeploymentExpandOptions) HasExpand ¶
func (o *ContractDeploymentExpandOptions) HasExpand() bool
type ContractDeploymentFilter ¶
type ContractDeploymentFilter struct {
// ContractName is a partial match against the name component of the contract identifier
// (e.g. "A.{addr}.{name}").
ContractName string
// StartBlock is an inclusive block height lower bound.
StartBlock *uint64
// EndBlock is an inclusive block height upper bound.
EndBlock *uint64
}
ContractDeploymentFilter specifies optional filter criteria for contract deployment queries. All fields are optional; nil/zero fields are ignored.
func (*ContractDeploymentFilter) Filter ¶
func (f *ContractDeploymentFilter) Filter() storage.IndexFilter[*accessmodel.ContractDeployment]
Filter builds a storage.IndexFilter from the non-nil filter fields.
type ContractsBackend ¶
type ContractsBackend struct {
// contains filtered or unexported fields
}
ContractsBackend implements the contracts portion of the extended API.
func NewContractsBackend ¶
func NewContractsBackend( log zerolog.Logger, base *backendBase, store storage.ContractDeploymentsIndexReader, ) *ContractsBackend
NewContractsBackend creates a new ContractsBackend.
func (*ContractsBackend) GetContract ¶
func (b *ContractsBackend) GetContract( ctx context.Context, id string, filter ContractDeploymentFilter, expandOptions ContractDeploymentExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.ContractDeployment, error)
GetContract returns the most recent deployment of the contract with the given identifier.
Expected error returns during normal operations:
- codes.NotFound: if no contract with the given identifier exists
- codes.FailedPrecondition: if the index has not been initialized
func (*ContractsBackend) GetContractDeployments ¶
func (b *ContractsBackend) GetContractDeployments( ctx context.Context, id string, limit uint32, cursor *accessmodel.ContractDeploymentsCursor, filter ContractDeploymentFilter, expandOptions ContractDeploymentExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.ContractDeploymentPage, error)
GetContractDeployments returns a paginated list of all deployments of the given contract, most recent first (descending by block height, then by TxIndex, then by EventIndex).
Expected error returns during normal operations:
- codes.NotFound: if no contract with the given identifier exists
- codes.FailedPrecondition: if the index has not been initialized
- codes.InvalidArgument: if query parameters are invalid
func (*ContractsBackend) GetContracts ¶
func (b *ContractsBackend) GetContracts( ctx context.Context, limit uint32, cursor *accessmodel.ContractDeploymentsCursor, filter ContractDeploymentFilter, expandOptions ContractDeploymentExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.ContractDeploymentPage, error)
GetContracts returns a paginated list of contracts at their latest deployment.
Expected error returns during normal operations:
- codes.FailedPrecondition: if the index has not been initialized
- codes.InvalidArgument: if query parameters are invalid
func (*ContractsBackend) GetContractsByAddress ¶
func (b *ContractsBackend) GetContractsByAddress( ctx context.Context, address flow.Address, limit uint32, cursor *accessmodel.ContractDeploymentsCursor, filter ContractDeploymentFilter, expandOptions ContractDeploymentExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.ContractDeploymentPage, error)
GetContractsByAddress returns a paginated list of contracts at their latest deployment for the given address.
Expected error returns during normal operations:
- codes.FailedPrecondition: if the index has not been initialized
- codes.InvalidArgument: if query parameters are invalid
type ScheduledTransactionExpandOptions ¶
func (*ScheduledTransactionExpandOptions) HasExpand ¶
func (o *ScheduledTransactionExpandOptions) HasExpand() bool
type ScheduledTransactionFilter ¶
type ScheduledTransactionFilter struct {
Statuses []accessmodel.ScheduledTransactionStatus
Priority *accessmodel.ScheduledTransactionPriority
StartTime *uint64 // inclusive UFix64 timestamp lower bound
EndTime *uint64 // inclusive UFix64 timestamp upper bound
TransactionHandlerOwner *flow.Address
TransactionHandlerTypeID *string
TransactionHandlerUUID *uint64
}
ScheduledTransactionFilter specifies optional filter criteria for scheduled transaction queries. All fields are optional; nil/zero fields are ignored.
func (*ScheduledTransactionFilter) Filter ¶
func (f *ScheduledTransactionFilter) Filter() storage.IndexFilter[*accessmodel.ScheduledTransaction]
Filter builds a storage.IndexFilter from the non-nil filter fields.
type ScheduledTransactionsBackend ¶
type ScheduledTransactionsBackend struct {
// contains filtered or unexported fields
}
ScheduledTransactionsBackend implements the extended API for querying scheduled transactions.
func NewScheduledTransactionsBackend ¶
func NewScheduledTransactionsBackend( log zerolog.Logger, base *backendBase, chainID flow.ChainID, store storage.ScheduledTransactionsIndexReader, contracts storage.ContractDeploymentsIndexReader, scheduledTransactions storage.ScheduledTransactionsReader, state protocol.State, scriptExecutor execution.ScriptExecutor, ) *ScheduledTransactionsBackend
NewScheduledTransactionsBackend creates a new ScheduledTransactionsBackend.
func (*ScheduledTransactionsBackend) GetScheduledTransaction ¶
func (b *ScheduledTransactionsBackend) GetScheduledTransaction( ctx context.Context, id uint64, expandOptions ScheduledTransactionExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.ScheduledTransaction, error)
GetScheduledTransaction returns a single scheduled transaction by its scheduler-assigned ID.
Expected error returns during normal operations:
- codes.NotFound: if no transaction with the given ID exists
- codes.FailedPrecondition: if the index has not been initialized
func (*ScheduledTransactionsBackend) GetScheduledTransactions ¶
func (b *ScheduledTransactionsBackend) GetScheduledTransactions( ctx context.Context, limit uint32, cursor *accessmodel.ScheduledTransactionCursor, filter ScheduledTransactionFilter, expandOptions ScheduledTransactionExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.ScheduledTransactionsPage, error)
GetScheduledTransactions returns a paginated list of scheduled transactions.
Expected error returns during normal operations:
- codes.FailedPrecondition: if the index has not been initialized
- codes.InvalidArgument: if the query parameters are invalid
func (*ScheduledTransactionsBackend) GetScheduledTransactionsByAddress ¶
func (b *ScheduledTransactionsBackend) GetScheduledTransactionsByAddress( ctx context.Context, address flow.Address, limit uint32, cursor *accessmodel.ScheduledTransactionCursor, filter ScheduledTransactionFilter, expandOptions ScheduledTransactionExpandOptions, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.ScheduledTransactionsPage, error)
GetScheduledTransactionsByAddress returns a paginated list of scheduled transactions for the given address.
Expected error returns during normal operations:
- codes.FailedPrecondition: if the index has not been initialized
- codes.InvalidArgument: if the query parameters are invalid