Documentation ¶
Index ¶
Constants ¶
View Source
const ( CodeSuccess = uint32(iota) CodeTxFailed CodeNoResult CodeServerUnresponsive CodeUnsupportedMessage CodeInvalidFormat )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v1.6.0
type Option func(*router)
func WithMockJobQueue ¶ added in v1.6.0
func WithMockJobQueue() Option
WithMockJobQueue runs the router with an in-memory job queue instead of a persistent one that writes to disk.
type Provider ¶
type Provider interface { GetMessageByFullName(string) (types.Message, bool) GetMessageByID(id types.MessageID) (types.Message, bool) HandleQueryEVM(group string, name string, abiRequest []byte) ([]byte, error) GetSignerComponentForPersona(string) (*component.SignerComponent, error) WaitForNextTick() bool AddEVMTransaction(id types.MessageID, msgValue any, tx *sign.Transaction, evmTxHash string) ( tick uint64, txHash types.TxHash, ) ConsumeEVMMsgResult(evmTxHash string) ([]byte, []error, string, bool) }
Provider provides the Router with the necessary functionality to handle API requests from the EVM. The ecs.Engine is expected to implement these methods.
type Router ¶
type Router interface { // RegisterGameShard registers this game shard to the base shard. This is ONLY needed so that the base shard can // route requests from the EVM to this game shard by using its namespace. RegisterGameShard(context.Context) error // SubmitTxBlob submits transactions processed in a tick to the base shard. SubmitTxBlob( ctx context.Context, processedTxs txpool.TxMap, epoch, unixTimestamp uint64, ) error TransactionIterator() iterator.Iterator // Shutdown gracefully stops the EVM gRPC handler. Shutdown() // Start serves the EVM gRPC server. Start() error }
Router provides functionality for Cardinal to interact with the EVM Base Shard. This involves a few responsibilities:
- Registering itself to the base shard.
- Receiving API requests from EVM smart contracts on the base shard.
- Sending transactions to the base shard's game sequencer.
- Querying transactions from the base shard to rebuild game state.
Click to show internal directories.
Click to hide internal directories.