Documentation ¶
Index ¶
- type Adapter
- func (a *Adapter) ExecuteScriptAtBlockHeight(ctx context.Context, blockHeight uint64, script []byte, arguments [][]byte) ([]byte, error)
- func (a *Adapter) ExecuteScriptAtBlockID(ctx context.Context, blockID flowgo.Identifier, script []byte, ...) ([]byte, error)
- func (a *Adapter) ExecuteScriptAtLatestBlock(ctx context.Context, script []byte, arguments [][]byte) ([]byte, error)
- func (a *Adapter) GetAccount(ctx context.Context, address flowgo.Address) (*flowgo.Account, error)
- func (a *Adapter) GetAccountAtBlockHeight(ctx context.Context, address flowgo.Address, height uint64) (*flowgo.Account, error)
- func (a *Adapter) GetAccountAtLatestBlock(ctx context.Context, address flowgo.Address) (*flowgo.Account, error)
- func (a *Adapter) GetBlockByHeight(ctx context.Context, height uint64) (*flowgo.Block, error)
- func (a *Adapter) GetBlockByID(ctx context.Context, id flowgo.Identifier) (*flowgo.Block, error)
- func (a *Adapter) GetBlockHeaderByHeight(ctx context.Context, height uint64) (*flowgo.Header, error)
- func (a *Adapter) GetBlockHeaderByID(ctx context.Context, id flowgo.Identifier) (*flowgo.Header, error)
- func (a *Adapter) GetCollectionByID(ctx context.Context, id flowgo.Identifier) (*flowgo.LightCollection, error)
- func (a *Adapter) GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []flowgo.Identifier) ([]flowgo.BlockEvents, error)
- func (a *Adapter) GetEventsForHeightRange(ctx context.Context, eventType string, startHeight, endHeight uint64) ([]flowgo.BlockEvents, error)
- func (a *Adapter) GetLatestBlock(ctx context.Context, isSealed bool) (*flowgo.Block, error)
- func (a *Adapter) GetLatestBlockHeader(ctx context.Context, isSealed bool) (*flowgo.Header, error)
- func (a *Adapter) GetNetworkParameters(ctx context.Context) access.NetworkParameters
- func (a *Adapter) GetTransaction(ctx context.Context, id flowgo.Identifier) (*flowgo.TransactionBody, error)
- func (a *Adapter) GetTransactionResult(ctx context.Context, id flowgo.Identifier) (*access.TransactionResult, error)
- func (a *Adapter) Ping(ctx context.Context) error
- func (a *Adapter) SendTransaction(ctx context.Context, tx *flowgo.TransactionBody) error
- type Backend
- func (b *Backend) CommitBlock()
- func (b *Backend) DisableAutoMine()
- func (b *Backend) EnableAutoMine()
- func (b *Backend) ExecuteScriptAtBlockHeight(ctx context.Context, blockHeight uint64, script []byte, arguments [][]byte) ([]byte, error)
- func (b *Backend) ExecuteScriptAtBlockID(ctx context.Context, blockID sdk.Identifier, script []byte, arguments [][]byte) ([]byte, error)
- func (b *Backend) ExecuteScriptAtLatestBlock(ctx context.Context, script []byte, arguments [][]byte) ([]byte, error)
- func (b *Backend) GetAccount(ctx context.Context, address sdk.Address) (*sdk.Account, error)
- func (b *Backend) GetAccountAtBlockHeight(ctx context.Context, address sdk.Address, height uint64) (*sdk.Account, error)
- func (b *Backend) GetAccountAtLatestBlock(ctx context.Context, address sdk.Address) (*sdk.Account, error)
- func (b *Backend) GetBlockByHeight(ctx context.Context, height uint64) (*flowgo.Block, error)
- func (b *Backend) GetBlockByID(ctx context.Context, id sdk.Identifier) (*flowgo.Block, error)
- func (b *Backend) GetBlockHeaderByHeight(ctx context.Context, height uint64) (*flowgo.Header, error)
- func (b *Backend) GetBlockHeaderByID(ctx context.Context, id sdk.Identifier) (*flowgo.Header, error)
- func (b *Backend) GetCollectionByID(ctx context.Context, id sdk.Identifier) (*sdk.Collection, error)
- func (b *Backend) GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []sdk.Identifier) ([]flowgo.BlockEvents, error)
- func (b *Backend) GetEventsForHeightRange(ctx context.Context, eventType string, startHeight, endHeight uint64) ([]flowgo.BlockEvents, error)
- func (b *Backend) GetLatestBlock(ctx context.Context, isSealed bool) (*flowgo.Block, error)
- func (b *Backend) GetLatestBlockHeader(ctx context.Context, isSealed bool) (*flowgo.Header, error)
- func (b *Backend) GetNetworkParameters(ctx context.Context) access.NetworkParameters
- func (b *Backend) GetTransaction(ctx context.Context, id sdk.Identifier) (*sdk.Transaction, error)
- func (b *Backend) GetTransactionResult(ctx context.Context, id sdk.Identifier) (*sdk.TransactionResult, error)
- func (b *Backend) Ping(ctx context.Context) error
- func (b *Backend) SendTransaction(ctx context.Context, tx sdk.Transaction) error
- type Emulator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter wraps the emulator backend to be compatible with access.API.
func NewAdapter ¶
NewAdapter returns a new backend adapter.
func (*Adapter) ExecuteScriptAtBlockHeight ¶
func (*Adapter) ExecuteScriptAtBlockID ¶
func (*Adapter) ExecuteScriptAtLatestBlock ¶
func (*Adapter) GetAccount ¶
func (*Adapter) GetAccountAtBlockHeight ¶
func (*Adapter) GetAccountAtLatestBlock ¶
func (*Adapter) GetBlockByHeight ¶
func (*Adapter) GetBlockByID ¶
func (*Adapter) GetBlockHeaderByHeight ¶
func (*Adapter) GetBlockHeaderByID ¶
func (*Adapter) GetCollectionByID ¶
func (a *Adapter) GetCollectionByID(ctx context.Context, id flowgo.Identifier) (*flowgo.LightCollection, error)
func (*Adapter) GetEventsForBlockIDs ¶
func (a *Adapter) GetEventsForBlockIDs( ctx context.Context, eventType string, blockIDs []flowgo.Identifier, ) ([]flowgo.BlockEvents, error)
func (*Adapter) GetEventsForHeightRange ¶
func (*Adapter) GetLatestBlock ¶
func (*Adapter) GetLatestBlockHeader ¶
func (*Adapter) GetNetworkParameters ¶
func (a *Adapter) GetNetworkParameters(ctx context.Context) access.NetworkParameters
func (*Adapter) GetTransaction ¶
func (a *Adapter) GetTransaction(ctx context.Context, id flowgo.Identifier) (*flowgo.TransactionBody, error)
func (*Adapter) GetTransactionResult ¶
func (a *Adapter) GetTransactionResult(ctx context.Context, id flowgo.Identifier) (*access.TransactionResult, error)
func (*Adapter) SendTransaction ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend wraps an emulated blockchain and implements the RPC handlers required by the Access API.
func (*Backend) CommitBlock ¶
func (b *Backend) CommitBlock()
CommitBlock executes the current pending transactions and commits the results in a new block.
func (*Backend) DisableAutoMine ¶
func (b *Backend) DisableAutoMine()
DisableAutoMine disables the automine flag.
func (*Backend) EnableAutoMine ¶
func (b *Backend) EnableAutoMine()
EnableAutoMine enables the automine flag.
func (*Backend) ExecuteScriptAtBlockHeight ¶
func (b *Backend) ExecuteScriptAtBlockHeight( ctx context.Context, blockHeight uint64, script []byte, arguments [][]byte, ) ([]byte, error)
ExecuteScriptAtBlockHeight executes a script at a specific block height
func (*Backend) ExecuteScriptAtBlockID ¶
func (b *Backend) ExecuteScriptAtBlockID( ctx context.Context, blockID sdk.Identifier, script []byte, arguments [][]byte, ) ([]byte, error)
ExecuteScriptAtBlockID executes a script at a specific block ID
func (*Backend) ExecuteScriptAtLatestBlock ¶
func (b *Backend) ExecuteScriptAtLatestBlock( ctx context.Context, script []byte, arguments [][]byte, ) ([]byte, error)
ExecuteScriptAtLatestBlock executes a script at a the latest block
func (*Backend) GetAccount ¶
GetAccount returns an account by address at the latest sealed block.
func (*Backend) GetAccountAtBlockHeight ¶
func (*Backend) GetAccountAtLatestBlock ¶
func (b *Backend) GetAccountAtLatestBlock( ctx context.Context, address sdk.Address, ) (*sdk.Account, error)
GetAccountAtLatestBlock returns an account by address at the latest sealed block.
func (*Backend) GetBlockByHeight ¶
GetBlockByHeight gets a block by height.
func (*Backend) GetBlockByID ¶
GetBlockByHeight gets a block by ID.
func (*Backend) GetBlockHeaderByHeight ¶
func (b *Backend) GetBlockHeaderByHeight( ctx context.Context, height uint64, ) (*flowgo.Header, error)
GetBlockHeaderByHeight gets a block header by height.
func (*Backend) GetBlockHeaderByID ¶
func (b *Backend) GetBlockHeaderByID( ctx context.Context, id sdk.Identifier, ) (*flowgo.Header, error)
GetBlockHeaderByID gets a block header by ID.
func (*Backend) GetCollectionByID ¶
func (b *Backend) GetCollectionByID( ctx context.Context, id sdk.Identifier, ) (*sdk.Collection, error)
GetCollectionByID gets a collection by ID.
func (*Backend) GetEventsForBlockIDs ¶
func (b *Backend) GetEventsForBlockIDs( ctx context.Context, eventType string, blockIDs []sdk.Identifier, ) ([]flowgo.BlockEvents, error)
GetEventsForBlockIDs returns events matching a set of block IDs.
func (*Backend) GetEventsForHeightRange ¶
func (b *Backend) GetEventsForHeightRange( ctx context.Context, eventType string, startHeight, endHeight uint64, ) ([]flowgo.BlockEvents, error)
GetEventsForHeightRange returns events matching a query.
func (*Backend) GetLatestBlock ¶
GetLatestBlock gets the latest sealed block.
func (*Backend) GetLatestBlockHeader ¶
GetLatestBlockHeader gets the latest sealed block header.
func (*Backend) GetNetworkParameters ¶
func (b *Backend) GetNetworkParameters(ctx context.Context) access.NetworkParameters
func (*Backend) GetTransaction ¶
func (b *Backend) GetTransaction( ctx context.Context, id sdk.Identifier, ) (*sdk.Transaction, error)
GetTransaction gets a transaction by ID.
func (*Backend) GetTransactionResult ¶
func (b *Backend) GetTransactionResult( ctx context.Context, id sdk.Identifier, ) (*sdk.TransactionResult, error)
GetTransactionResult gets a transaction by ID.
func (*Backend) SendTransaction ¶
SendTransaction submits a transaction to the network.
type Emulator ¶
type Emulator interface { AddTransaction(tx sdk.Transaction) error ExecuteNextTransaction() (*types.TransactionResult, error) ExecuteBlock() ([]*types.TransactionResult, error) CommitBlock() (*flowgo.Block, error) ExecuteAndCommitBlock() (*flowgo.Block, []*types.TransactionResult, error) GetLatestBlock() (*flowgo.Block, error) GetBlockByID(id sdk.Identifier) (*flowgo.Block, error) GetBlockByHeight(height uint64) (*flowgo.Block, error) GetCollection(colID sdk.Identifier) (*sdk.Collection, error) GetTransaction(txID sdk.Identifier) (*sdk.Transaction, error) GetTransactionResult(txID sdk.Identifier) (*sdk.TransactionResult, error) GetAccount(address sdk.Address) (*sdk.Account, error) GetAccountAtBlock(address sdk.Address, blockHeight uint64) (*sdk.Account, error) GetEventsByHeight(blockHeight uint64, eventType string) ([]sdk.Event, error) ExecuteScript(script []byte, arguments [][]byte) (*types.ScriptResult, error) ExecuteScriptAtBlock(script []byte, arguments [][]byte, blockHeight uint64) (*types.ScriptResult, error) }
Emulator defines the method set of an emulated blockchain.