Crate z4_engine

Source

Modules§

request
Module for ws/http/p2p request with channel.

Macros§

json
Export serde_json’s json and Value. Construct a serde_json::Value from a JSON literal.

Structs§

Config
Z4 main config. config of engine
Engine
Z4 main engine. Engine
H160
Export useful types Fixed-size uninterpreted hash type with 20 bytes (160 bits) size.
HandleResult
Export useful types The result when after handling the message or task.
MethodValues
Export useful types method & multiple values for Param, compatible with jsonrpc
NetworkConfig
Export useful types Network config informato, use EIP-3085
NetworkCurrency
Export useful types Network native currency config
Peer
Export useful tdn core struct and functions.
PeerId
Export useful tdn core struct and functions. peer’s network id.
PeerKey
Export useful tdn core struct and functions. The keypair, include pk, sk, address
Player
Export useful types Standard player from chain & pozk
RoomMarket
Z4 main contracts.
SimpleGame
Z4 main contracts.
Token
Z4 main contracts.

Enums§

ChainMessage
The message type synced from chain
Error
Export useful types Z4 error
Network
Export useful types Network types
PoolMessage
The message type when send to pool
SendType
Export useful tdn core struct and functions. channel message send to TDN Group.
TaskMessage
Export useful types Task message type
Value
Export serde_json’s json and Value. Represents any valid JSON value.

Constants§

DEFAULT_NETWORK
Export useful types Default network
PLAYER_BYTES_LEN
Export useful types Player bytes length
ROOM_MARKET_ABI
Export useful types
SIMPLE_GAME_ABI
Export useful types
TOKEN_ABI
Export useful types
Z4_ROOM_MARKET_GROUP
Export useful types Z4 init room id/tdn group id

Traits§

Handler
Export useful types Handle message received from players
Param
Export useful types Serialize & deserialize for params
Task
Export useful types Timer tasks when game room started

Functions§

address_hex
Export useful types Convert address to hex string
address_to_peer
Export useful types convert address to peer
chain_channel
Create z4 scan(sync from chain) channel. Create scan channel
env_value
Export useful types Get value from env and parse it to T
env_values
Export useful types Get value array from env and parse it to T
generate_keypair
Export useful types Generate engine used keypair for player
handle_tasks
Export useful types Handle and listening tasks
hex_address
Export useful types Convert hex string to address
merge_json
Export useful types Merge two values
peer_to_address
Export useful types convert peer to address
rpc_response
Export useful tdn core struct and functions.
sign
Export useful types Sign for zk-friendly
simple_game_result
Export useful types Helper for generate simple game result, for ranking
verify
Export useful types Verify for zk-friendly

Type Aliases§

Address
Export useful types
GameId
Export useful types Game id = Address
GroupId
Export useful tdn core struct and functions. Type: GroupId
PublicKey
Export useful types Type PublicKey
Result
Export useful types Z4 main Result with Z4 error
RoomId
Export useful types Room id = u64
SecretKey
Export useful types Type SecretKey
Tasks
Export useful types Type helper for tasks