extended

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

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

type AccountTransactionExpandOptions struct {
	Result      bool
	Transaction bool
}

func (*AccountTransactionExpandOptions) HasExpand

func (o *AccountTransactionExpandOptions) HasExpand() bool

type AccountTransactionFilter

type AccountTransactionFilter struct {
	Roles []accessmodel.TransactionRole
}

func (*AccountTransactionFilter) Filter

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

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:

type AccountTransferExpandOptions

type AccountTransferExpandOptions struct {
	Transaction bool
	Result      bool
}

func (*AccountTransferExpandOptions) HasExpand

func (o *AccountTransferExpandOptions) HasExpand() bool

type AccountTransferFilter

type AccountTransferFilter struct {
	TokenType        string
	SourceAddress    flow.Address
	RecipientAddress flow.Address
}

func (*AccountTransferFilter) FTFilter

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

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:

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:

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

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

type ContractDeploymentExpandOptions struct {
	Code        bool
	Transaction bool
	Result      bool
}

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

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

GetContract returns the most recent deployment of the contract with the given identifier.

Expected error returns during normal operations:

func (*ContractsBackend) GetContractDeployments

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:

func (*ContractsBackend) GetContracts

GetContracts returns a paginated list of contracts at their latest deployment.

Expected error returns during normal operations:

func (*ContractsBackend) GetContractsByAddress

GetContractsByAddress returns a paginated list of contracts at their latest deployment for the given address.

Expected error returns during normal operations:

type ScheduledTransactionExpandOptions

type ScheduledTransactionExpandOptions struct {
	Result          bool
	Transaction     bool
	HandlerContract bool
}

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

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

GetScheduledTransaction returns a single scheduled transaction by its scheduler-assigned ID.

Expected error returns during normal operations:

func (*ScheduledTransactionsBackend) GetScheduledTransactions

GetScheduledTransactions returns a paginated list of scheduled transactions.

Expected error returns during normal operations:

func (*ScheduledTransactionsBackend) GetScheduledTransactionsByAddress

GetScheduledTransactionsByAddress returns a paginated list of scheduled transactions for the given address.

Expected error returns during normal operations:

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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