adapters

package
v0.62.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertCCFEventsToJsonEvents added in v0.50.4

func ConvertCCFEventsToJsonEvents(events []flowgo.Event) ([]flowgo.Event, error)

Types

type AccessAdapter

type AccessAdapter struct {
	// contains filtered or unexported fields
}

AccessAdapter wraps the emulator adapters to be compatible with access.API.

func NewAccessAdapter

func NewAccessAdapter(logger *zerolog.Logger, emulator emulator.Emulator) *AccessAdapter

NewAccessAdapter returns a new AccessAdapter.

func (*AccessAdapter) ExecuteScriptAtBlockHeight

func (a *AccessAdapter) ExecuteScriptAtBlockHeight(
	_ context.Context,
	blockHeight uint64,
	script []byte,
	arguments [][]byte,
) ([]byte, error)

func (*AccessAdapter) ExecuteScriptAtBlockID

func (a *AccessAdapter) ExecuteScriptAtBlockID(
	_ context.Context,
	blockID flowgo.Identifier,
	script []byte,
	arguments [][]byte,
) ([]byte, error)

func (*AccessAdapter) ExecuteScriptAtLatestBlock

func (a *AccessAdapter) ExecuteScriptAtLatestBlock(
	_ context.Context,
	script []byte,
	arguments [][]byte,
) ([]byte, error)

func (*AccessAdapter) GetAccount

func (a *AccessAdapter) GetAccount(_ context.Context, address flowgo.Address) (*flowgo.Account, error)

func (*AccessAdapter) GetAccountAtBlockHeight

func (a *AccessAdapter) GetAccountAtBlockHeight(
	_ context.Context,
	address flowgo.Address,
	height uint64,
) (*flowgo.Account, error)

func (*AccessAdapter) GetAccountAtLatestBlock

func (a *AccessAdapter) GetAccountAtLatestBlock(ctx context.Context, address flowgo.Address) (*flowgo.Account, error)

func (*AccessAdapter) GetBlockByHeight

func (a *AccessAdapter) GetBlockByHeight(_ context.Context, height uint64) (*flowgo.Block, flowgo.BlockStatus, error)

func (*AccessAdapter) GetBlockByID

func (*AccessAdapter) GetBlockHeaderByHeight

func (a *AccessAdapter) GetBlockHeaderByHeight(_ context.Context, height uint64) (*flowgo.Header, flowgo.BlockStatus, error)

func (*AccessAdapter) GetBlockHeaderByID

func (a *AccessAdapter) GetBlockHeaderByID(_ context.Context, id flowgo.Identifier) (*flowgo.Header, flowgo.BlockStatus, error)

func (*AccessAdapter) GetCollectionByID

func (a *AccessAdapter) GetCollectionByID(_ context.Context, id flowgo.Identifier) (*flowgo.LightCollection, error)

func (*AccessAdapter) GetEventsForBlockIDs

func (a *AccessAdapter) GetEventsForBlockIDs(
	_ context.Context,
	eventType string,
	blockIDs []flowgo.Identifier,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) ([]flowgo.BlockEvents, error)

func (*AccessAdapter) GetEventsForHeightRange

func (a *AccessAdapter) GetEventsForHeightRange(
	_ context.Context,
	eventType string,
	startHeight, endHeight uint64,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) ([]flowgo.BlockEvents, error)

func (*AccessAdapter) GetExecutionResultByID

func (a *AccessAdapter) GetExecutionResultByID(_ context.Context, _ flowgo.Identifier) (*flowgo.ExecutionResult, error)

func (*AccessAdapter) GetExecutionResultForBlockID

func (a *AccessAdapter) GetExecutionResultForBlockID(_ context.Context, _ flowgo.Identifier) (*flowgo.ExecutionResult, error)

func (*AccessAdapter) GetLatestBlock

func (a *AccessAdapter) GetLatestBlock(_ context.Context, _ bool) (*flowgo.Block, flowgo.BlockStatus, error)

func (*AccessAdapter) GetLatestBlockHeader

func (a *AccessAdapter) GetLatestBlockHeader(_ context.Context, _ bool) (*flowgo.Header, flowgo.BlockStatus, error)

func (*AccessAdapter) GetLatestProtocolStateSnapshot

func (a *AccessAdapter) GetLatestProtocolStateSnapshot(_ context.Context) ([]byte, error)

func (*AccessAdapter) GetNetworkParameters

func (a *AccessAdapter) GetNetworkParameters(_ context.Context) access.NetworkParameters

func (*AccessAdapter) GetNodeVersionInfo

func (a *AccessAdapter) GetNodeVersionInfo(
	_ context.Context,
) (
	*access.NodeVersionInfo,
	error,
)

func (*AccessAdapter) GetProtocolStateSnapshotByBlockID added in v0.59.0

func (a *AccessAdapter) GetProtocolStateSnapshotByBlockID(_ context.Context, _ flowgo.Identifier) ([]byte, error)

func (*AccessAdapter) GetProtocolStateSnapshotByHeight added in v0.59.0

func (a *AccessAdapter) GetProtocolStateSnapshotByHeight(_ context.Context, _ uint64) ([]byte, error)

func (*AccessAdapter) GetSystemTransaction added in v0.59.0

func (a *AccessAdapter) GetSystemTransaction(_ context.Context, _ flowgo.Identifier) (*flowgo.TransactionBody, error)

func (*AccessAdapter) GetSystemTransactionResult added in v0.59.0

func (*AccessAdapter) GetTransaction

func (*AccessAdapter) GetTransactionResult

func (a *AccessAdapter) GetTransactionResult(
	_ context.Context,
	id flowgo.Identifier,
	_ flowgo.Identifier,
	_ flowgo.Identifier,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) (
	*access.TransactionResult,
	error,
)

func (*AccessAdapter) GetTransactionResultByIndex

func (a *AccessAdapter) GetTransactionResultByIndex(
	_ context.Context,
	blockID flowgo.Identifier,
	index uint32,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) (*access.TransactionResult, error)

func (*AccessAdapter) GetTransactionResultsByBlockID

func (a *AccessAdapter) GetTransactionResultsByBlockID(
	_ context.Context,
	blockID flowgo.Identifier,
	requiredEventEncodingVersion entities.EventEncodingVersion,
) ([]*access.TransactionResult, error)

func (*AccessAdapter) GetTransactionsByBlockID

func (a *AccessAdapter) GetTransactionsByBlockID(_ context.Context, blockID flowgo.Identifier) ([]*flowgo.TransactionBody, error)

func (*AccessAdapter) Ping

func (a *AccessAdapter) Ping(_ context.Context) error

func (*AccessAdapter) SendTransaction

func (a *AccessAdapter) SendTransaction(_ context.Context, tx *flowgo.TransactionBody) error

func (*AccessAdapter) SubscribeBlockDigestsFromLatest added in v0.62.0

func (a *AccessAdapter) SubscribeBlockDigestsFromLatest(_ context.Context, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlockDigestsFromStartBlockID added in v0.62.0

func (a *AccessAdapter) SubscribeBlockDigestsFromStartBlockID(_ context.Context, _ flowgo.Identifier, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlockDigestsFromStartHeight added in v0.62.0

func (a *AccessAdapter) SubscribeBlockDigestsFromStartHeight(_ context.Context, _ uint64, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlockHeadersFromLatest added in v0.62.0

func (a *AccessAdapter) SubscribeBlockHeadersFromLatest(_ context.Context, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlockHeadersFromStartBlockID added in v0.62.0

func (a *AccessAdapter) SubscribeBlockHeadersFromStartBlockID(_ context.Context, _ flowgo.Identifier, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlockHeadersFromStartHeight added in v0.62.0

func (a *AccessAdapter) SubscribeBlockHeadersFromStartHeight(_ context.Context, _ uint64, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlocksFromLatest added in v0.62.0

func (a *AccessAdapter) SubscribeBlocksFromLatest(_ context.Context, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlocksFromStartBlockID added in v0.62.0

func (a *AccessAdapter) SubscribeBlocksFromStartBlockID(_ context.Context, _ flowgo.Identifier, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeBlocksFromStartHeight added in v0.62.0

func (a *AccessAdapter) SubscribeBlocksFromStartHeight(_ context.Context, _ uint64, _ flowgo.BlockStatus) subscription.Subscription

func (*AccessAdapter) SubscribeTransactionStatuses added in v0.62.0

func (a *AccessAdapter) SubscribeTransactionStatuses(_ context.Context, _ *flowgo.TransactionBody) subscription.Subscription

type SDKAdapter

type SDKAdapter struct {
	// contains filtered or unexported fields
}

SDKAdapter wraps an emulated emulator and implements the RPC handlers required by the Access API.

func NewSDKAdapter

func NewSDKAdapter(logger *zerolog.Logger, emulator emulator.Emulator) *SDKAdapter

NewSDKAdapter returns a new SDKAdapter.

func (*SDKAdapter) CreateAccount

func (b *SDKAdapter) CreateAccount(ctx context.Context, publicKeys []*sdk.AccountKey, contracts []templates.Contract) (sdk.Address, error)

CreateAccount submits a transaction to create a new account with the given account keys and contracts. The transaction is paid by the service account.

func (*SDKAdapter) DisableAutoMine

func (b *SDKAdapter) DisableAutoMine()

func (*SDKAdapter) Emulator

func (b *SDKAdapter) Emulator() emulator.Emulator

func (*SDKAdapter) EnableAutoMine

func (b *SDKAdapter) EnableAutoMine()

func (*SDKAdapter) ExecuteScriptAtBlockHeight

func (b *SDKAdapter) ExecuteScriptAtBlockHeight(
	ctx context.Context,
	blockHeight uint64,
	script []byte,
	arguments [][]byte,
) ([]byte, error)

ExecuteScriptAtBlockHeight executes a script at a specific block height

func (*SDKAdapter) ExecuteScriptAtBlockID

func (b *SDKAdapter) ExecuteScriptAtBlockID(
	ctx context.Context,
	blockID sdk.Identifier,
	script []byte,
	arguments [][]byte,
) ([]byte, error)

ExecuteScriptAtBlockID executes a script at a specific block ID

func (*SDKAdapter) ExecuteScriptAtLatestBlock

func (b *SDKAdapter) ExecuteScriptAtLatestBlock(
	ctx context.Context,
	script []byte,
	arguments [][]byte,
) ([]byte, error)

ExecuteScriptAtLatestBlock executes a script at a the latest block

func (*SDKAdapter) GetAccount

func (b *SDKAdapter) GetAccount(
	ctx context.Context,
	address sdk.Address,
) (*sdk.Account, error)

GetAccount returns an account by address at the latest sealed block.

func (*SDKAdapter) GetAccountAtBlockHeight

func (b *SDKAdapter) GetAccountAtBlockHeight(
	ctx context.Context,
	address sdk.Address,
	height uint64,
) (*sdk.Account, error)

func (*SDKAdapter) GetAccountAtLatestBlock

func (b *SDKAdapter) GetAccountAtLatestBlock(
	ctx context.Context,
	address sdk.Address,
) (*sdk.Account, error)

GetAccountAtLatestBlock returns an account by address at the latest sealed block.

func (*SDKAdapter) GetBlockByHeight

func (b *SDKAdapter) GetBlockByHeight(
	ctx context.Context,
	height uint64,
) (
	*sdk.Block,
	sdk.BlockStatus,
	error,
)

GetBlockByHeight gets a block by height.

func (*SDKAdapter) GetBlockByID

func (b *SDKAdapter) GetBlockByID(
	_ context.Context,
	id sdk.Identifier,
) (
	*sdk.Block,
	sdk.BlockStatus,
	error,
)

GetBlockByID gets a block by ID.

func (*SDKAdapter) GetBlockHeaderByHeight

func (b *SDKAdapter) GetBlockHeaderByHeight(
	_ context.Context,
	height uint64,
) (
	*sdk.BlockHeader,
	sdk.BlockStatus,
	error,
)

GetBlockHeaderByHeight gets a block header by height.

func (*SDKAdapter) GetBlockHeaderByID

func (b *SDKAdapter) GetBlockHeaderByID(
	_ context.Context,
	id sdk.Identifier,
) (
	*sdk.BlockHeader,
	sdk.BlockStatus,
	error,
)

GetBlockHeaderByID gets a block header by ID.

func (*SDKAdapter) GetChainID

func (b *SDKAdapter) GetChainID(ctx context.Context) sdk.ChainID

func (*SDKAdapter) GetCollectionByID

func (b *SDKAdapter) GetCollectionByID(
	_ context.Context,
	id sdk.Identifier,
) (*sdk.Collection, error)

GetCollectionByID gets a collection by ID.

func (*SDKAdapter) GetEventsForBlockIDs

func (b *SDKAdapter) GetEventsForBlockIDs(ctx context.Context, eventType string, blockIDs []sdk.Identifier) ([]*sdk.BlockEvents, error)

func (*SDKAdapter) GetEventsForHeightRange

func (b *SDKAdapter) GetEventsForHeightRange(ctx context.Context, eventType string, startHeight, endHeight uint64) ([]*sdk.BlockEvents, error)

func (*SDKAdapter) GetExecutionResultForBlockID

func (b *SDKAdapter) GetExecutionResultForBlockID(_ context.Context, _ sdk.Identifier) (*sdk.ExecutionResult, error)

func (*SDKAdapter) GetLatestBlock

func (b *SDKAdapter) GetLatestBlock(
	_ context.Context,
	_ bool,
) (
	*sdk.Block,
	sdk.BlockStatus,
	error,
)

GetLatestBlock gets the latest sealed block.

func (*SDKAdapter) GetLatestBlockHeader

func (b *SDKAdapter) GetLatestBlockHeader(
	_ context.Context,
	_ bool,
) (
	*sdk.BlockHeader,
	sdk.BlockStatus,
	error,
)

GetLatestBlockHeader gets the latest sealed block header.

func (*SDKAdapter) GetLatestProtocolStateSnapshot

func (b *SDKAdapter) GetLatestProtocolStateSnapshot(_ context.Context) ([]byte, error)

func (*SDKAdapter) GetProtocolStateSnapshotByBlockID added in v0.59.0

func (a *SDKAdapter) GetProtocolStateSnapshotByBlockID(_ context.Context, _ flowgo.Identifier) ([]byte, error)

func (*SDKAdapter) GetProtocolStateSnapshotByHeight added in v0.59.0

func (a *SDKAdapter) GetProtocolStateSnapshotByHeight(_ context.Context, _ uint64) ([]byte, error)

func (*SDKAdapter) GetSystemTransaction added in v0.59.0

func (b *SDKAdapter) GetSystemTransaction(_ context.Context, _ flowgo.Identifier) (*flowgo.TransactionBody, error)

func (*SDKAdapter) GetSystemTransactionResult added in v0.59.0

func (*SDKAdapter) GetTransaction

func (b *SDKAdapter) GetTransaction(
	ctx context.Context,
	id sdk.Identifier,
) (*sdk.Transaction, error)

GetTransaction gets a transaction by ID.

func (*SDKAdapter) GetTransactionResult

func (b *SDKAdapter) GetTransactionResult(
	ctx context.Context,
	id sdk.Identifier,
) (*sdk.TransactionResult, error)

GetTransactionResult gets a transaction by ID.

func (*SDKAdapter) GetTransactionResultsByBlockID

func (b *SDKAdapter) GetTransactionResultsByBlockID(ctx context.Context, id sdk.Identifier) ([]*sdk.TransactionResult, error)

func (*SDKAdapter) GetTransactionsByBlockID

func (b *SDKAdapter) GetTransactionsByBlockID(ctx context.Context, id sdk.Identifier) ([]*sdk.Transaction, error)

func (*SDKAdapter) Ping

func (b *SDKAdapter) Ping(ctx context.Context) error

func (*SDKAdapter) SendTransaction

func (b *SDKAdapter) SendTransaction(ctx context.Context, tx sdk.Transaction) error

Jump to

Keyboard shortcuts

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