router-wasm-bindings 1.0.3

Bindings for CustomMsg and CustomQuery for the Router blockchain
Documentation
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use cosmwasm_std::{CustomQuery, Empty};

#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)]
#[serde(rename_all = "snake_case")]
pub enum RouterQuery {
    TokenPrice { symbol: String },
    GasPrice { chain_id: String },
}

impl CustomQuery for RouterQuery {}

impl RouterQuery {
    /// returns the token symbol price
    pub fn token_price(symbol: String) -> Self {
        RouterQuery::TokenPrice { symbol }
    }

    /// returns the gas_price of the given chain
    pub fn gas_price(chain_id: String) -> Self {
        RouterQuery::GasPrice { chain_id }
    }
}

impl From<RouterQuery> for Empty {
    fn from(_value: RouterQuery) -> Empty {
        Empty {}
    }
}