-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #490 from nolus-protocol/release-query
Release query
- Loading branch information
Showing
28 changed files
with
320 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use serde::Serialize; | ||
use thiserror::Error; | ||
|
||
use sdk::cosmwasm_std::{Addr, QuerierWrapper, StdError}; | ||
|
||
use super::{PlatformPackageRelease, ProtocolPackageRelease}; | ||
|
||
/// A common versioning API of each platform package | ||
#[derive(Serialize)] | ||
#[serde(deny_unknown_fields, rename_all = "snake_case")] | ||
pub enum PlatformPackage { | ||
/// Query the platform package for its release. | ||
/// | ||
/// The result is [versioning::PlatformPackageRelease] | ||
#[serde(rename = "platform_package_release")] | ||
Release {}, | ||
} | ||
|
||
/// A common versioning API of each protocol package | ||
#[derive(Serialize)] | ||
#[serde(deny_unknown_fields, rename_all = "snake_case")] | ||
pub enum ProtocolPackage { | ||
/// Query the protocol package for its release. | ||
/// | ||
/// The result is [versioning::ProtocolPackageRelease] | ||
#[serde(rename = "protocol_package_release")] | ||
Release {}, | ||
} | ||
|
||
#[derive(Error, Debug, PartialEq)] | ||
pub enum Error { | ||
#[error("[Versioning][Query] {0}")] | ||
Transmission(StdError), | ||
} | ||
|
||
pub fn platform_release( | ||
contract: Addr, | ||
querier: QuerierWrapper<'_>, | ||
) -> Result<PlatformPackageRelease, Error> { | ||
querier | ||
.query_wasm_smart(contract, &PlatformPackage::Release {}) | ||
.map_err(Error::Transmission) | ||
} | ||
|
||
pub fn protocol_release( | ||
contract: Addr, | ||
querier: QuerierWrapper<'_>, | ||
) -> Result<ProtocolPackageRelease, Error> { | ||
querier | ||
.query_wasm_smart(contract, &ProtocolPackage::Release {}) | ||
.map_err(Error::Transmission) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
use lease::api::{open::NewLeaseForm, query::StateQuery, ExecuteMsg}; | ||
use lease::api::{open::NewLeaseForm, query::QueryMsg, ExecuteMsg}; | ||
use sdk::cosmwasm_schema::{export_schema, schema_for}; | ||
|
||
fn main() { | ||
let out_dir = schema::prep_out_dir().expect("The output directory should be valid"); | ||
export_schema(&schema_for!(NewLeaseForm), &out_dir); | ||
export_schema(&schema_for!(ExecuteMsg), &out_dir); | ||
export_schema(&schema_for!(StateQuery), &out_dir); | ||
export_schema(&schema_for!(QueryMsg), &out_dir); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.