Documentation ¶
Overview ¶
Package access provides a client interface for the Flow Access API.
Index ¶
- Variables
- func InterceptRateLimitUnary(ctx context.Context, method string, req, res interface{}, cc *grpc.ClientConn, ...) error
- func IsRateLimited(err error) bool
- type Client
- func (c Client) Account(ctx context.Context, addr []byte) (*entities.Account, error)
- func (c Client) AccountAtHeight(ctx context.Context, addr []byte, height uint64) (*entities.Account, error)
- func (c Client) BlockByHeight(ctx context.Context, height uint64) (*entities.Block, error)
- func (c Client) BlockByID(ctx context.Context, blockID []byte) (*entities.Block, error)
- func (c Client) BlockEvents(ctx context.Context, blockID []byte, typ string) ([]*entities.Event, error)
- func (c Client) BlockHeaderByHeight(ctx context.Context, height uint64) (*entities.BlockHeader, error)
- func (c Client) BlockHeaderByID(ctx context.Context, blockID []byte) (*entities.BlockHeader, error)
- func (c Client) CollectionByID(ctx context.Context, id []byte) (*entities.Collection, error)
- func (c Client) Execute(ctx context.Context, blockID []byte, script []byte, args []cadence.Value) (cadence.Value, error)
- func (c Client) ExecutionResultForBlockID(ctx context.Context, blockID []byte) (*entities.ExecutionResult, error)
- func (c Client) LatestBlockHeader(ctx context.Context) (*entities.BlockHeader, error)
- func (c Client) LatestFinalizedBlockHeader(ctx context.Context) (*entities.BlockHeader, error)
- func (c Client) Ping(ctx context.Context) error
- func (c *Client) SendTransaction(ctx context.Context, txn *entities.Transaction) ([]byte, error)
- func (c Client) ServerAddress() string
- func (c Client) Transaction(ctx context.Context, hash []byte) (*entities.Transaction, error)
- func (c Client) TransactionResult(ctx context.Context, blockID []byte, txnIndex uint32) (*access.TransactionResultResponse, error)
- func (c Client) TransactionResultByHash(ctx context.Context, hash []byte) (*access.TransactionResultResponse, error)
- func (c Client) TransactionResultsByBlockID(ctx context.Context, blockID []byte) ([]*access.TransactionResultResponse, error)
- func (c Client) TransactionsByBlockID(ctx context.Context, blockID []byte) ([]*entities.Transaction, error)
- type MemoryGauge
- type NodeConfig
- type Pool
Constants ¶
This section is empty.
Variables ¶
var ( // NoopMemoryGauge provides a no-op implementation of Cadence's // common.MemoryGauge. NoopMemoryGauge = MemoryGauge{} )
Functions ¶
func InterceptRateLimitUnary ¶
func InterceptRateLimitUnary(ctx context.Context, method string, req, res interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
InterceptRateLimitUnary handles any rate limit headers set by Access API proxy servers.
func IsRateLimited ¶
IsRateLimited should return true if an upstream Access API server or Envoy has returned an error indicating that a request has been rate-limited.
NOTE(tav): This function needs to be kept in sync with the error message used in the InterceptRateLimitUnary function above and the one within the Flow Access API server's rate limit implementation.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for the Flow Access API.
All methods except SendTransaction impose a default timeout of one minute.
func (Client) Account ¶
Account returns the account for the given address from the latest sealed execution state.
func (Client) AccountAtHeight ¶
func (c Client) AccountAtHeight(ctx context.Context, addr []byte, height uint64) (*entities.Account, error)
AccountAtHeight returns the account for the given address at the given block height.
func (Client) BlockByHeight ¶
BlockByHeight returns the block for the given height.
func (Client) BlockEvents ¶
func (c Client) BlockEvents(ctx context.Context, blockID []byte, typ string) ([]*entities.Event, error)
BlockEvents returns the events for the given block ID and event type.
func (Client) BlockHeaderByHeight ¶
func (c Client) BlockHeaderByHeight(ctx context.Context, height uint64) (*entities.BlockHeader, error)
BlockHeaderByHeight returns the block header for the given height.
func (Client) BlockHeaderByID ¶
BlockHeaderByID returns the block header for the given block ID.
func (Client) CollectionByID ¶
CollectionByID returns the collection of transactions for the given collection ID.
func (Client) Execute ¶
func (c Client) Execute(ctx context.Context, blockID []byte, script []byte, args []cadence.Value) (cadence.Value, error)
Execute returns the given Cadence script at the specified block ID.
func (Client) ExecutionResultForBlockID ¶
func (c Client) ExecutionResultForBlockID(ctx context.Context, blockID []byte) (*entities.ExecutionResult, error)
ExecutionResultForBlockID returns the execution result for the given block ID.
func (Client) LatestBlockHeader ¶
LatestBlockHeader returns the block header for the most recently sealed block.
func (Client) LatestFinalizedBlockHeader ¶ added in v0.4.18
LatestFinalizedBlockHeader returns the block header for the most recently finalized block, i.e. one which hasn't been sealed yet.
func (*Client) SendTransaction ¶
SendTransaction submits a transaction to the Flow network, and returns the transaction hash.
func (Client) ServerAddress ¶
ServerAddress returns the host:port of the Access API server.
func (Client) Transaction ¶
Transaction returns the transaction info for the given transaction hash.
func (Client) TransactionResult ¶
func (c Client) TransactionResult(ctx context.Context, blockID []byte, txnIndex uint32) (*access.TransactionResultResponse, error)
TransactionResult returns the transaction result for the given transaction index within the specified block.
func (Client) TransactionResultByHash ¶ added in v0.4.23
func (c Client) TransactionResultByHash(ctx context.Context, hash []byte) (*access.TransactionResultResponse, error)
TransactionResultByHash returns the transaction result for the given transaction hash. In case of duplicates for the same transaction hash, the returned result will only be for one of the submissions.
func (Client) TransactionResultsByBlockID ¶
func (c Client) TransactionResultsByBlockID(ctx context.Context, blockID []byte) ([]*access.TransactionResultResponse, error)
TransactionResultsByBlockID returns the transaction results for the given block ID.
func (Client) TransactionsByBlockID ¶
func (c Client) TransactionsByBlockID(ctx context.Context, blockID []byte) ([]*entities.Transaction, error)
TransactionsByBlockID returns the transactions for the given block ID.
type MemoryGauge ¶ added in v0.4.18
type MemoryGauge struct { }
MemoryGauge implements a no-op memory gauge to support Cadence JSON decoding.
func (MemoryGauge) MeterMemory ¶ added in v0.4.18
func (m MemoryGauge) MeterMemory(usage common.MemoryUsage) error
MeterMemory implements the common.MemoryGauge interface.
type NodeConfig ¶
type NodeConfig struct { // Address specifies the host:port for the gRPC endpoint. Address string `json:"address"` // PublicKey indicates that it should use TLS using libp2p certs derived // from the given public key. PublicKey string `json:"public_key"` // TLS indicates that it should use TLS using the system root CAs. TLS bool `json:"tls"` }
NodeConfig defines the metadata needed to securely connect to an Access API server.