Documentation ¶
Overview ¶
Package grpc client provides a Go client for the Flow Access gRPC API.
The Access API provides a set of methods that can be used to submit transactions and read state from Flow. This client is compatible with the Access API implemented by the Access Node role, as well as the mock Access API exposed by the Flow Emulator.
The full Access API specification is here: https://docs.onflow.org/access-api/
Index ¶
- Constants
- type BaseClient
- func (c *BaseClient) Close() error
- func (c *BaseClient) ExecuteScriptAtBlockHeight(ctx context.Context, height uint64, script []byte, arguments []cadence.Value, ...) (cadence.Value, error)
- func (c *BaseClient) ExecuteScriptAtBlockID(ctx context.Context, blockID flow.Identifier, script []byte, ...) (cadence.Value, error)
- func (c *BaseClient) ExecuteScriptAtLatestBlock(ctx context.Context, script []byte, arguments []cadence.Value, ...) (cadence.Value, error)
- func (c *BaseClient) GetAccount(ctx context.Context, address flow.Address, opts ...grpc.CallOption) (*flow.Account, error)
- func (c *BaseClient) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, blockHeight uint64, ...) (*flow.Account, error)
- func (c *BaseClient) GetAccountAtLatestBlock(ctx context.Context, address flow.Address, opts ...grpc.CallOption) (*flow.Account, error)
- func (c *BaseClient) GetBlockByHeight(ctx context.Context, height uint64, opts ...grpc.CallOption) (*flow.Block, error)
- func (c *BaseClient) GetBlockByID(ctx context.Context, blockID flow.Identifier, opts ...grpc.CallOption) (*flow.Block, error)
- func (c *BaseClient) GetBlockHeaderByHeight(ctx context.Context, height uint64, opts ...grpc.CallOption) (*flow.BlockHeader, error)
- func (c *BaseClient) GetBlockHeaderByID(ctx context.Context, blockID flow.Identifier, opts ...grpc.CallOption) (*flow.BlockHeader, error)
- func (c *BaseClient) GetCollection(ctx context.Context, colID flow.Identifier, opts ...grpc.CallOption) (*flow.Collection, error)
- func (c *BaseClient) GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []flow.Identifier, ...) ([]flow.BlockEvents, error)
- func (c *BaseClient) GetEventsForHeightRange(ctx context.Context, query EventRangeQuery, opts ...grpc.CallOption) ([]flow.BlockEvents, error)
- func (c *BaseClient) GetExecutionResultForBlockID(ctx context.Context, blockID flow.Identifier, opts ...grpc.CallOption) (*flow.ExecutionResult, error)
- func (c *BaseClient) GetLatestBlock(ctx context.Context, isSealed bool, opts ...grpc.CallOption) (*flow.Block, error)
- func (c *BaseClient) GetLatestBlockHeader(ctx context.Context, isSealed bool, opts ...grpc.CallOption) (*flow.BlockHeader, error)
- func (c *BaseClient) GetLatestProtocolStateSnapshot(ctx context.Context, opts ...grpc.CallOption) ([]byte, error)
- func (c *BaseClient) GetTransaction(ctx context.Context, txID flow.Identifier, opts ...grpc.CallOption) (*flow.Transaction, error)
- func (c *BaseClient) GetTransactionResult(ctx context.Context, txID flow.Identifier, opts ...grpc.CallOption) (*flow.TransactionResult, error)
- func (c *BaseClient) Ping(ctx context.Context, opts ...grpc.CallOption) error
- func (c *BaseClient) SendTransaction(ctx context.Context, tx flow.Transaction, opts ...grpc.CallOption) error
- func (c *BaseClient) SetJSONOptions(options []json.Option)
- type Client
- func (c *Client) Close() error
- func (c *Client) ExecuteScriptAtBlockHeight(ctx context.Context, height uint64, script []byte, arguments []cadence.Value) (cadence.Value, error)
- func (c *Client) ExecuteScriptAtBlockID(ctx context.Context, blockID flow.Identifier, script []byte, ...) (cadence.Value, error)
- func (c *Client) ExecuteScriptAtLatestBlock(ctx context.Context, script []byte, arguments []cadence.Value) (cadence.Value, error)
- func (c *Client) GetAccount(ctx context.Context, address flow.Address) (*flow.Account, error)
- func (c *Client) GetAccountAtBlockHeight(ctx context.Context, address flow.Address, blockHeight uint64) (*flow.Account, error)
- func (c *Client) GetAccountAtLatestBlock(ctx context.Context, address flow.Address) (*flow.Account, error)
- func (c *Client) GetBlockByHeight(ctx context.Context, height uint64) (*flow.Block, error)
- func (c *Client) GetBlockByID(ctx context.Context, blockID flow.Identifier) (*flow.Block, error)
- func (c *Client) GetBlockHeaderByHeight(ctx context.Context, height uint64) (*flow.BlockHeader, error)
- func (c *Client) GetBlockHeaderByID(ctx context.Context, blockID flow.Identifier) (*flow.BlockHeader, error)
- func (c *Client) GetCollection(ctx context.Context, colID flow.Identifier) (*flow.Collection, error)
- func (c *Client) GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []flow.Identifier) ([]flow.BlockEvents, error)
- func (c *Client) GetEventsForHeightRange(ctx context.Context, eventType string, startHeight uint64, endHeight uint64) ([]flow.BlockEvents, error)
- func (c *Client) GetExecutionResultForBlockID(ctx context.Context, blockID flow.Identifier) (*flow.ExecutionResult, error)
- func (c *Client) GetLatestBlock(ctx context.Context, isSealed bool) (*flow.Block, error)
- func (c *Client) GetLatestBlockHeader(ctx context.Context, isSealed bool) (*flow.BlockHeader, error)
- func (c *Client) GetLatestProtocolStateSnapshot(ctx context.Context) ([]byte, error)
- func (c *Client) GetTransaction(ctx context.Context, txID flow.Identifier) (*flow.Transaction, error)
- func (c *Client) GetTransactionResult(ctx context.Context, txID flow.Identifier) (*flow.TransactionResult, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) SendTransaction(ctx context.Context, tx flow.Transaction) error
- type EntityToMessageError
- type EventRangeQuery
- type MessageToEntityError
- type RPCClient
- type RPCError
Constants ¶
const CanarynetHost = "access.canary.nodes.onflow.org:9000"
const EmulatorHost = "127.0.0.1:3569"
const MainnetHost = "access.mainnet.nodes.onflow.org:9000"
const TestnetHost = "access.devnet.nodes.onflow.org:9000"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseClient ¶
type BaseClient struct {
// contains filtered or unexported fields
}
BaseClient is a gRPC client for the Flow Access API exposing all grpc specific methods.
Use this client if you need advance access to the HTTP API. If you don't require special methods use the Client instead.
func NewBaseClient ¶
func NewBaseClient(url string, opts ...grpc.DialOption) (*BaseClient, error)
NewBaseClient creates a new gRPC handler for network communication.
func NewFromRPCClient ¶
func NewFromRPCClient(rpcClient RPCClient) *BaseClient
NewFromRPCClient initializes a Flow client using a pre-configured gRPC provider.
func (*BaseClient) ExecuteScriptAtBlockHeight ¶
func (*BaseClient) ExecuteScriptAtBlockID ¶
func (*BaseClient) ExecuteScriptAtLatestBlock ¶
func (*BaseClient) GetAccount ¶
func (c *BaseClient) GetAccount(ctx context.Context, address flow.Address, opts ...grpc.CallOption) (*flow.Account, error)
func (*BaseClient) GetAccountAtBlockHeight ¶
func (c *BaseClient) GetAccountAtBlockHeight( ctx context.Context, address flow.Address, blockHeight uint64, opts ...grpc.CallOption, ) (*flow.Account, error)
func (*BaseClient) GetAccountAtLatestBlock ¶
func (c *BaseClient) GetAccountAtLatestBlock( ctx context.Context, address flow.Address, opts ...grpc.CallOption, ) (*flow.Account, error)
func (*BaseClient) GetBlockByHeight ¶
func (c *BaseClient) GetBlockByHeight( ctx context.Context, height uint64, opts ...grpc.CallOption, ) (*flow.Block, error)
func (*BaseClient) GetBlockByID ¶
func (c *BaseClient) GetBlockByID( ctx context.Context, blockID flow.Identifier, opts ...grpc.CallOption, ) (*flow.Block, error)
func (*BaseClient) GetBlockHeaderByHeight ¶
func (c *BaseClient) GetBlockHeaderByHeight( ctx context.Context, height uint64, opts ...grpc.CallOption, ) (*flow.BlockHeader, error)
func (*BaseClient) GetBlockHeaderByID ¶
func (c *BaseClient) GetBlockHeaderByID( ctx context.Context, blockID flow.Identifier, opts ...grpc.CallOption, ) (*flow.BlockHeader, error)
func (*BaseClient) GetCollection ¶
func (c *BaseClient) GetCollection( ctx context.Context, colID flow.Identifier, opts ...grpc.CallOption, ) (*flow.Collection, error)
func (*BaseClient) GetEventsForBlockIDs ¶
func (c *BaseClient) GetEventsForBlockIDs( ctx context.Context, eventType string, blockIDs []flow.Identifier, opts ...grpc.CallOption, ) ([]flow.BlockEvents, error)
func (*BaseClient) GetEventsForHeightRange ¶
func (c *BaseClient) GetEventsForHeightRange( ctx context.Context, query EventRangeQuery, opts ...grpc.CallOption, ) ([]flow.BlockEvents, error)
func (*BaseClient) GetExecutionResultForBlockID ¶
func (c *BaseClient) GetExecutionResultForBlockID(ctx context.Context, blockID flow.Identifier, opts ...grpc.CallOption) (*flow.ExecutionResult, error)
func (*BaseClient) GetLatestBlock ¶
func (c *BaseClient) GetLatestBlock( ctx context.Context, isSealed bool, opts ...grpc.CallOption, ) (*flow.Block, error)
func (*BaseClient) GetLatestBlockHeader ¶
func (c *BaseClient) GetLatestBlockHeader( ctx context.Context, isSealed bool, opts ...grpc.CallOption, ) (*flow.BlockHeader, error)
func (*BaseClient) GetLatestProtocolStateSnapshot ¶
func (c *BaseClient) GetLatestProtocolStateSnapshot(ctx context.Context, opts ...grpc.CallOption) ([]byte, error)
func (*BaseClient) GetTransaction ¶
func (c *BaseClient) GetTransaction( ctx context.Context, txID flow.Identifier, opts ...grpc.CallOption, ) (*flow.Transaction, error)
func (*BaseClient) GetTransactionResult ¶
func (c *BaseClient) GetTransactionResult( ctx context.Context, txID flow.Identifier, opts ...grpc.CallOption, ) (*flow.TransactionResult, error)
func (*BaseClient) Ping ¶
func (c *BaseClient) Ping(ctx context.Context, opts ...grpc.CallOption) error
func (*BaseClient) SendTransaction ¶
func (c *BaseClient) SendTransaction( ctx context.Context, tx flow.Transaction, opts ...grpc.CallOption, ) error
func (*BaseClient) SetJSONOptions ¶ added in v0.26.3
func (c *BaseClient) SetJSONOptions(options []json.Option)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements all common gRPC methods providing a network agnostic API.
func NewClient ¶
func NewClient(host string, opts ...grpc.DialOption) (*Client, error)
NewClient creates an gRPC client exposing all the common access APIs. Client will use provided host for connection.
func (*Client) ExecuteScriptAtBlockHeight ¶
func (*Client) ExecuteScriptAtBlockID ¶
func (*Client) ExecuteScriptAtLatestBlock ¶
func (*Client) GetAccount ¶
func (*Client) GetAccountAtBlockHeight ¶
func (*Client) GetAccountAtLatestBlock ¶
func (*Client) GetBlockByHeight ¶
func (*Client) GetBlockByID ¶
func (*Client) GetBlockHeaderByHeight ¶
func (*Client) GetBlockHeaderByID ¶
func (*Client) GetCollection ¶
func (*Client) GetEventsForBlockIDs ¶
func (*Client) GetEventsForHeightRange ¶
func (*Client) GetExecutionResultForBlockID ¶
func (*Client) GetLatestBlock ¶
func (*Client) GetLatestBlockHeader ¶
func (*Client) GetLatestProtocolStateSnapshot ¶
func (*Client) GetTransaction ¶
func (*Client) GetTransactionResult ¶
type EntityToMessageError ¶
An EntityToMessageError indicates that an entity could not be converted to a protobuf message.
func (EntityToMessageError) Error ¶
func (e EntityToMessageError) Error() string
func (EntityToMessageError) Unwrap ¶
func (e EntityToMessageError) Unwrap() error
type EventRangeQuery ¶
type EventRangeQuery struct { // The event type to search for. Type string // The block height to begin looking for events (inclusive). StartHeight uint64 // The block height to end looking for events (inclusive). EndHeight uint64 }
EventRangeQuery defines a query for Flow events.
type MessageToEntityError ¶
A MessageToEntityError indicates that a protobuf message could not be converted to an SDK entity.
func (MessageToEntityError) Error ¶
func (e MessageToEntityError) Error() string
func (MessageToEntityError) Unwrap ¶
func (e MessageToEntityError) Unwrap() error
type RPCClient ¶
type RPCClient interface { access.AccessAPIClient }
RPCClient is an RPC client for the Flow Access API.
type RPCError ¶
type RPCError struct {
GRPCErr error
}
An RPCError is an error returned by an RPC call to an Access API.
An RPC error can be unwrapped to produce the original gRPC error.
func (RPCError) GRPCStatus ¶
GRPCStatus returns the gRPC status for this error.
This function satisfies the interface defined in the status.FromError function.