Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Msg filter #872

Draft
wants to merge 7 commits into
base: development
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add cw-msg-filter to workspace, fmt markdown
  • Loading branch information
Jake Hartnell committed Aug 2, 2024
commit bae45a6dc7e07eb6d97a32cb4edc7c7c1f70781f
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -90,6 +90,7 @@ cw-admin-factory = { path = "./contracts/external/cw-admin-factory", version = "
cw-denom = { path = "./packages/cw-denom", version = "2.5.0" }
cw-fund-distributor = { path = "./contracts/distribution/cw-fund-distributor", version = "2.5.0" }
cw-hooks = { path = "./packages/cw-hooks", version = "2.5.0" }
cw-msg-filter = { path = "./packages/cw-msg-filter", version = "2.5.0" }
cw-paginate-storage = { path = "./packages/cw-paginate-storage", version = "2.5.0" }
cw-payroll-factory = { path = "./contracts/external/cw-payroll-factory", version = "2.5.0" }
cw-stake-tracker = { path = "./packages/cw-stake-tracker", version = "2.5.0" }
2 changes: 1 addition & 1 deletion packages/cw-msg-filter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ repository = { workspace = true }
version = { workspace = true }

[dependencies]
cosmwasm-std = { workspace = true }
cosmwasm-std = { workspace = true, features = ["staking"] }
cosmwasm-schema = { workspace = true }
serde_json = { workspace = true }
thiserror = { workspace = true }
2 changes: 2 additions & 0 deletions packages/cw-msg-filter/README.md
Original file line number Diff line number Diff line change
@@ -72,11 +72,13 @@ match filter.filter_messages(&messages) {
The main struct for configuring message filtering rules.

#### Fields:

- `allowed_msgs`: Optional `Vec<AllowedMsg>` specifying which messages are permitted.
- `max_msg_count`: Optional `u8` setting the maximum number of messages allowed.
- `spending_limits`: Optional `Vec<Coin>` specifying spending limits per denomination.

#### Methods:

- `validate_config(&self) -> Result<(), ConfigValidationError>`: Validates the configuration of the `MsgFilter`.
- `check_messages(&self, messages: &[CosmosMsg]) -> Result<(), MsgFilterError>`: Checks if all messages are allowed according to the filter rules.
- `filter_messages<'a>(&self, messages: &'a [CosmosMsg]) -> Result<Vec<&'a CosmosMsg>, MsgFilterError>`: Returns a list of messages that meet the filter criteria.
Loading