-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: support new x/posts
features
#301
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6149eae
build(deps): bump desmos into v6.2.0
dadamu 1a05b6e
feat: add new posts msgs to constructor
dadamu 3fcb832
feat: support new posts features
dadamu e6246fc
chore: run lint
dadamu 271fb3e
test: add move post interaction test
dadamu b4ab9ef
test: add second contract for post transfer owner testing
dadamu 08dfc33
test: add post owner request interation tests
dadamu e2f7f22
test: add query post owner transfer request interation test
dadamu 1c118ba
chore: run lint
dadamu 7edaefa
test: fix accept/refuse msgs
dadamu 33185f0
chore: improve naming
dadamu f7e6773
fix: change array into vector
dadamu 144cd56
chore: run lint
dadamu 629053d
fix: remove deprecated offset
dadamu 678f0ee
chore: run fmt
dadamu bd48feb
fix: target contract profile dtag
dadamu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,68 @@ | ||
mod msg; | ||
mod query; | ||
|
||
use crate::chain_communication::DesmosCli; | ||
use cosmwasm_std::Addr; | ||
|
||
use test_contract::msg::QueryMsg::DesmosChain; | ||
|
||
use desmos_bindings::cosmos_types::PageRequest; | ||
use desmos_bindings::posts::msg::PostsMsg; | ||
use desmos_bindings::posts::types::{ | ||
Entities, Post, QuerySubspacePostsRequest, QuerySubspacePostsResponse, ReplySetting, Url, | ||
}; | ||
|
||
/// Creates a post inside the given subspace for interaction testing | ||
pub fn create_test_post(subspace_id: u64, contract_address: &str) -> Post { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make test stateless, we can create a post then return it for the test, then we can avoid from a lot of const number like |
||
let desmos_cli = DesmosCli::default(); | ||
|
||
// Create a post | ||
let create_post_msg = PostsMsg::create_post( | ||
subspace_id, | ||
0, | ||
None, | ||
"Sample post", | ||
Some(Entities { | ||
urls: vec![Url { | ||
start: 0, | ||
end: 1, | ||
url: "https://ipfs.infura.io/ipfs/QmT3AenKHkhCeesTUdnarqUVu91mmBk1cxQknxnUd79gY7" | ||
.into(), | ||
display_url: "IPFS".into(), | ||
}], | ||
hashtags: vec![], | ||
mentions: vec![], | ||
}), | ||
vec![], | ||
vec![], | ||
Addr::unchecked(contract_address), | ||
None, | ||
ReplySetting::Everyone, | ||
vec![], | ||
); | ||
desmos_cli | ||
.execute_contract(contract_address, vec![create_post_msg.into()]) | ||
.assert_success(); | ||
|
||
// query the created post | ||
let result: QuerySubspacePostsResponse = desmos_cli | ||
.wasm_query( | ||
contract_address, | ||
&DesmosChain { | ||
request: QuerySubspacePostsRequest { | ||
subspace_id, | ||
pagination: Some(PageRequest { | ||
key: vec![], | ||
limit: 1, | ||
offset: 0, | ||
count_total: false, | ||
reverse: true, | ||
}), | ||
} | ||
.into(), | ||
}, | ||
) | ||
.to_object(); | ||
|
||
result.posts.first().unwrap().clone() | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add offset parameter for triggering between sender contract and receiver contract.