osmosis-labs / osmosis-rust

Rust libraries for osmosis
Apache License 2.0
59 stars 52 forks source link

Implement querier wrapper for stargate queries in each module #22

Closed iboss-ptk closed 2 years ago

iboss-ptk commented 2 years ago

example from osmo-bindings

The idea is to have each module their own querier, for example, gamm has GammQuerier, tokenfactory has TokenfactoryQuerier, so it has consistent module system across cosmwasm and chain dev, rather than flattened querier.

Tasks

[ ] each package, use last component of the package path before /v(\d)+(beta(\d)+/)? if any, as a querier name eg.

let package_name = // extract with /([^.]*)(.v\d+(beta\d+)?)?$/ let ident = format_ident!("{}QuerierWrapper", to_pascal(package_name))

quote! { struct #ident { q: cosmwasm_std::QuerierWrapper }

impl #ident {
    fn new(q: cosmwasm_std::QuerierWrapper) -> Self {
        Self { q }
    }

    #(#methods)*
}

}