wasmbinding

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NibiruWasmOptions

func NibiruWasmOptions(
	grpcQueryRouter *baseapp.GRPCQueryRouter,
	appCodec codec.Codec,
	sudoKeeper keeper.Keeper,
) []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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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