bindings

package
v2.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertProtoToJSONMarshal

func ConvertProtoToJSONMarshal(protoResponseType proto.Message, bz []byte, cdc codec.Codec) ([]byte, error)

ConvertProtoToJSONMarshal unmarshals the given bytes into a proto message and then marshals it to json. This is done so that clients calling stargate queries do not need to define their own proto unmarshalers, being able to use response directly by json marshalling, which is supported in cosmwasm.

func CustomQuerier

func CustomQuerier(oracleKeeper oraclekeeper.Keeper) func(ctx sdk.Context, request json.RawMessage) ([]byte, error)

CustomQuerier returns a custom querier for Akash-specific queries from CosmWasm contracts. This enables contracts to query Akash chain state (like oracle module parameters) using the custom query mechanism defined in wasmd.

The querier handles AkashQuery requests, which are JSON-encoded custom queries defined in contracts/*/src/querier.rs.

func Querier

func Querier(queryRouter baseapp.GRPCQueryRouter, cdc codec.Codec) func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error)

Querier dispatches whitelisted stargate queries

Types

type AkashQuery

type AkashQuery struct {
	// OracleParams queries the oracle module parameters
	OracleParams *OracleParamsQuery `json:"oracle_params,omitempty"`
	// GuardianSet queries the Wormhole guardian set from oracle params
	GuardianSet *GuardianSetQuery `json:"guardian_set,omitempty"`
}

AkashQuery represents custom Akash chain queries from CosmWasm contracts. This enum must match the Rust definition in contracts/*/src/querier.rs

The JSON serialization uses snake_case to match Rust's serde default.

type GuardianAddress

type GuardianAddress struct {
	// Bytes is the 20-byte guardian address (base64 encoded for JSON)
	Bytes string `json:"bytes"`
}

GuardianAddress represents a Wormhole guardian's Ethereum-style address. The address is 20 bytes, stored as base64-encoded Binary in Rust.

type GuardianSetQuery

type GuardianSetQuery struct{}

GuardianSetQuery is the query payload for guardian set. It's an empty struct as the Rust side uses `GuardianSet {}`.

type GuardianSetResponse

type GuardianSetResponse struct {
	// Addresses is the list of guardian addresses (20 bytes each, hex encoded)
	Addresses []GuardianAddress `json:"addresses"`
	// ExpirationTime is when this guardian set expires (0 = never)
	ExpirationTime uint64 `json:"expiration_time"`
}

GuardianSetResponse is the response wrapper for guardian set query. Must match: contracts/wormhole/src/querier.rs::GuardianSetResponse

type OracleParams

type OracleParams struct {
	// Sources contains addresses allowed to write prices (contract addresses)
	Sources []string `json:"sources"`
	// MinPriceSources is the minimum number of price sources required
	MinPriceSources uint32 `json:"min_price_sources"`
	// MaxPriceStalenessBlocks is the maximum price staleness in blocks
	MaxPriceStalenessBlocks int64 `json:"max_price_staleness_blocks"`
	// TwapWindow is the TWAP window in blocks
	TwapWindow int64 `json:"twap_window"`
	// MaxPriceDeviationBps is the maximum price deviation in basis points
	MaxPriceDeviationBps uint64 `json:"max_price_deviation_bps"`
	// PythParams contains Pyth-specific configuration (optional)
	PythParams *PythContractParams `json:"pyth_params,omitempty"`
	// WormholeParams contains Wormhole-specific configuration (optional)
	WormholeParams *WormholeContractParams `json:"wormhole_params,omitempty"`
}

OracleParams represents the oracle module parameters. Must match: contracts/pyth/src/querier.rs::OracleParams and proto: akash.oracle.v1.Params

type OracleParamsQuery

type OracleParamsQuery struct{}

OracleParamsQuery is the query payload for oracle params. It's an empty struct as the Rust side uses `OracleParams {}`.

type OracleParamsResponse

type OracleParamsResponse struct {
	Params OracleParams `json:"params"`
}

OracleParamsResponse is the response wrapper for oracle params query. Must match: contracts/pyth/src/querier.rs::OracleParamsResponse

type PythContractParams

type PythContractParams struct {
	// AktPriceFeedId is the Pyth price feed identifier for AKT/USD
	AktPriceFeedId string `json:"akt_price_feed_id"`
}

PythContractParams contains configuration for Pyth price feeds. Must match: contracts/pyth/src/querier.rs::PythContractParams and proto: akash.oracle.v1.PythContractParams

type WormholeContractParams

type WormholeContractParams struct {
	// GuardianAddresses is the list of guardian addresses (20 bytes each, hex encoded)
	GuardianAddresses []string `json:"guardian_addresses"`
}

WormholeContractParams contains configuration for Wormhole guardian set. Must match: contracts/wormhole/src/querier.rs::WormholeContractParams and proto: akash.oracle.v1.WormholeContractParams

Jump to

Keyboard shortcuts

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