Skip to content

Commit

Permalink
Merge pull request #74 from neutron-org/feat/NTRN-300-burn-fee-send-t…
Browse files Browse the repository at this point in the history
…o-treasury

feat: wasmbindings for TotalBurnedNeutronsAmount #NTRN-300
  • Loading branch information
pr0n00gler authored Jan 13, 2023
2 parents 1a2127a + b3e93d6 commit c19b40c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/neutron-sdk/schema/interchain_queries.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@
}
},
"additionalProperties": false
},
{
"description": "Query total amount of burned neutron fees",
"type": "object",
"required": [
"total_burned_neutrons_amount"
],
"properties": {
"total_burned_neutrons_amount": {
"type": "object"
}
},
"additionalProperties": false
}
],
"definitions": {
Expand Down
3 changes: 3 additions & 0 deletions packages/neutron-sdk/src/bindings/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ pub enum InterchainQueries {
/// **query_id** is an ID registered interchain query
query_id: u64,
},

/// Query total amount of burned neutron fees
TotalBurnedNeutronsAmount {},
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
Expand Down
1 change: 1 addition & 0 deletions packages/neutron-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod errors;
pub mod interchain_queries;
pub mod interchain_txs;
pub mod proto_types;
pub mod query;
pub mod sudo;

pub use errors::error::{NeutronError, NeutronResult};
Expand Down
1 change: 1 addition & 0 deletions packages/neutron-sdk/src/query/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod total_burned_neutrons;
18 changes: 18 additions & 0 deletions packages/neutron-sdk/src/query/total_burned_neutrons.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use crate::{bindings::query::InterchainQueries, NeutronResult};
use cosmwasm_std::{Coin, Deps};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct TotalBurnedNeutronsAmountResponse {
pub coin: Coin,
}

/// Returns total amount of burned neutron fees
pub fn query_total_burned_neutrons(
deps: Deps<InterchainQueries>,
) -> NeutronResult<TotalBurnedNeutronsAmountResponse> {
let query = InterchainQueries::TotalBurnedNeutronsAmount {};
Ok(deps.querier.query(&query.into())?)
}

0 comments on commit c19b40c

Please sign in to comment.