Documentation
¶
Index ¶
- func NibiruWasmOptions(grpcQueryRouter *baseapp.GRPCQueryRouter, appCodec codec.Codec, ...) []wasmkeeper.Option
- func WasmAcceptedStargateQueries() wasmkeeper.AcceptedStargateQueries
- func WasmMessageHandler(args MsgHandlerArgs) wasmkeeper.Messenger
- type MessageRouter
- type MsgHandlerArgs
- type SDKMessageHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NibiruWasmOptions ¶
func NibiruWasmOptions( grpcQueryRouter *baseapp.GRPCQueryRouter, appCodec codec.Codec, msgHandlerArgs MsgHandlerArgs, ) []wasmkeeper.Option
NibiruWasmOptions: Wasm Options are extension points to instantiate the Wasm keeper with non-default values
func WasmAcceptedStargateQueries ¶
func WasmAcceptedStargateQueries() wasmkeeper.AcceptedStargateQueries
WasmAcceptedStargateQueries: Specifies which `QueryRequest::Stargate` types can be sent to the application.
### On Stargate Queries:
A Stargate query is encoded the same way as abci_query, with path and protobuf encoded request data. The format is defined in [ADR-21](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-021-protobuf-query-encoding.md). - The response is protobuf encoded data directly without a JSON response wrapper. The caller is responsible for compiling the proper protobuf definitions for both requests and responses.
```rust enum QueryRequest { Stargate { /// this is the fully qualified service path used for routing, /// eg. custom/cosmos_sdk.x.bank.v1.Query/QueryBalance path: String, /// this is the expected protobuf message type (not any), binary encoded data: Binary, }, // ... } ```
### Relationship with Protobuf Message:
A protobuf message with type URL "/cosmos.bank.v1beta1.QueryBalanceResponse" communicates a lot of information. From this type URL, we know:
- The protobuf message has package "cosmos.bank.v1beta1"
- The protobuf message has name "QueryBalanceResponse"
That is, a type URL is of the form "/[PB_MSG.PACKAGE]/[PB_MSG.NAME]"
The `QueryRequest::Stargate.path` is defined based on method name of the gRPC service description, not the type URL. In this example:
- The service name is "cosmos.bank.v1beta1.Query"
- The method name for this request on that service is "Balance"
This results in the expected `Stargate.path` of "/[SERVICE_NAME]/[METHOD]". By convention, the gRPC query service corresponding to a package is always "[PB_MSG.PACKAGE].Query".
Given only the `PB_MSG.PACKAGE` and the `PB_MSG.NAME` of either the query request or response, we should know the `QueryRequest::Stargate.path` deterministically.
func WasmMessageHandler ¶
func WasmMessageHandler( args MsgHandlerArgs, ) wasmkeeper.Messenger
WasmMessageHandler is a replacement constructor for wasmkeeper.NewDefaultMessageHandler inside of wasmkeeper.NewKeeper.
Types ¶
type MessageRouter ¶
type MessageRouter interface {
Handler(msg sdk.Msg) baseapp.MsgServiceHandler
}
MessageRouter ADR 031 request type routing
type MsgHandlerArgs ¶
type MsgHandlerArgs struct { Router MessageRouter Ics4Wrapper wasm.ICS4Wrapper ChannelKeeper wasm.ChannelKeeper CapabilityKeeper wasm.CapabilityKeeper BankKeeper wasm.Burner Unpacker sdkcodec.AnyUnpacker PortSource wasm.ICS20TransferPortSource }
type SDKMessageHandler ¶
type SDKMessageHandler struct {
// contains filtered or unexported fields
}
SDKMessageHandler can handles messages that can be encoded into sdk.Message types and routed.
func NewSDKMessageHandler ¶
func NewSDKMessageHandler(router MessageRouter, encoders msgEncoder) SDKMessageHandler
func (SDKMessageHandler) DispatchMsg ¶
func (h SDKMessageHandler) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error)