Skip to content

Commit

Permalink
Merge branch 'main' into feat/choose-cron-blocker
Browse files Browse the repository at this point in the history
  • Loading branch information
joldie777 committed Sep 2, 2024
2 parents 9a99aec + e0e697a commit 820cace
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 35 deletions.
48 changes: 18 additions & 30 deletions packages/neutron-sdk/src/bindings/msg.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{
bindings::types::{KVKey, ProtobufAny},
interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem, MAX_TX_FILTERS},
interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem},
proto_types::neutron::cron::ExecutionStage,
sudo::msg::RequestPacketTimeoutHeight,
NeutronError, NeutronResult,
NeutronResult,
};

use crate::bindings::dex::msg::DexMsg;
Expand Down Expand Up @@ -298,22 +298,14 @@ impl NeutronMsg {
connection_id,
update_period,
},
QueryPayload::TX(transactions_filters) => {
if transactions_filters.len() > MAX_TX_FILTERS {
return Err(NeutronError::TooManyTransactionFilters {
max: MAX_TX_FILTERS,
});
} else {
NeutronMsg::RegisterInterchainQuery {
query_type: QueryType::TX.into(),
keys: vec![],
transactions_filter: to_string(&transactions_filters)
.map_err(|e| StdError::generic_err(e.to_string()))?,
connection_id,
update_period,
}
}
}
QueryPayload::TX(transactions_filters) => NeutronMsg::RegisterInterchainQuery {
query_type: QueryType::TX.into(),
keys: vec![],
transactions_filter: to_string(&transactions_filters)
.map_err(|e| StdError::generic_err(e.to_string()))?,
connection_id,
update_period,
},
})
}

Expand All @@ -333,16 +325,7 @@ impl NeutronMsg {
new_update_period,
new_transactions_filter: match new_transactions_filter {
Some(filters) => {
if filters.len() > MAX_TX_FILTERS {
return Err(NeutronError::TooManyTransactionFilters {
max: MAX_TX_FILTERS,
});
} else {
Some(
to_string(&filters)
.map_err(|e| StdError::generic_err(e.to_string()))?,
)
}
Some(to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))?)
}
None => None,
},
Expand Down Expand Up @@ -435,11 +418,16 @@ impl NeutronMsg {
/// Basic helper to define burn tokens passed to TokenFactory module:
/// * **denom** is a name of the denom;
/// * **amount** is an amount of tokens to burn.
pub fn submit_burn_tokens(denom: impl Into<String>, amount: Uint128) -> Self {
/// * **burn_from_address** is an address tokens will be burned from
pub fn submit_burn_tokens(
denom: impl Into<String>,
amount: Uint128,
burn_from_address: Option<String>,
) -> Self {
NeutronMsg::BurnTokens {
denom: denom.into(),
amount,
burn_from_address: String::new(),
burn_from_address: burn_from_address.unwrap_or_default(),
}
}

Expand Down
3 changes: 0 additions & 3 deletions packages/neutron-sdk/src/errors/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ pub enum NeutronError {
#[error("Integration tests mock is active")]
IntegrationTestsMock {},

#[error("Too many transaction filters, max allowed: {max:?}")]
TooManyTransactionFilters { max: usize },

#[error("Can't deconstruct account denom balance key: {0}")]
AccountDenomBalanceKeyDeconstructionError(String),
}
Expand Down
2 changes: 0 additions & 2 deletions packages/neutron-sdk/src/interchain_queries/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ impl Serialize for TransactionFilterValue {
}
}

pub const MAX_TX_FILTERS: usize = 32;

#[derive(Serialize, Deserialize, Debug)]
pub struct TransactionFilterItem {
pub field: String,
Expand Down

0 comments on commit 820cace

Please sign in to comment.