-
Notifications
You must be signed in to change notification settings - Fork 20
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
Added instantiate2 #309
Added instantiate2 #309
Conversation
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.
Would be nice to slightly improve user experience using instanitate2
/// Send a Instantiate2Msg to a contract. | ||
fn instantiate2<I: Serialize + Debug>( | ||
&self, | ||
code_id: u64, | ||
init_msg: &I, | ||
label: Option<&str>, | ||
admin: Option<&Addr>, | ||
coins: &[cosmwasm_std::Coin], | ||
salt: Binary, | ||
) -> Result<Self::Response, Self::Error>; | ||
|
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.
Is it possible to return (yet) not executed instantiate2 struct instead? Main use for instantiate2 will be knowing the address, before instantiating. I'm expecting experience to be something like:
let contract1 = chain.instantiate2(...)?;
let contract1_addr = contract1.addr()?;
let contract2 = chain.instantiate2(...)?;
let contract2_addr = contract2.addr()?;
// ...
contract1.submit(Contract1InstantiateMsg{
contract2_addr: contract2_addr.to_string()
})?;
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.
I'm not sure I understand what you mean here ? You want a function that would return the instantiate2 addr if ever it was instantiated ?
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.
I'm not sure I understand what you mean here ? You want a function that would return the instantiate2 addr if ever it was instantiated ?
Yes, I want function that can return the address of pre-filled, but not executed instantiate2 message.
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.
Using helpers such as https://docs.rs/cosmwasm-std/latest/cosmwasm_std/fn.instantiate2_address.html would be annoying, so I would prefer it to be as a part of API
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.
OK,implemented what we discussed
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.
So this is now a method on the wasm querier correct?
Codecov ReportAttention:
Additional details and impacted files
|
* Added first queriers * Added bank + Wasm traits * Removed deprecated code * Lint * Format * Generalized querier getter (#318) * show POC of generalized querier getter * update * fix merge and impl for all envs * Doon't verify mockj error anymore * Fixed test * update `QueryHandler` and WasmQuerier functions * fix smart query URL * fix compile * format and clippy --------- Co-authored-by: Kayanski <kowalski.kowalskin@gmail.com> * Added instantiate2 (#309) * Added instantiate2 * some fixes * Added instantiate2 addr getter * Format * Nits * Merged daemon queriers * Corrected querier in tests * Renamed queriers * fix tests * Fix tests * Renamed trait types * Changed types for osmosis test tube * Feature fix * Removed unused querier traits, adapted all daemon queriers with same structure --------- Co-authored-by: CyberHoward <88450409+CyberHoward@users.noreply.github.com>
* Added first queriers * Added bank + Wasm traits * Added cw-multi-test 0.20.0 * Removed secp, removed ibc-relayer-types * Removed ibc-relayer-types completely * updated prost typesé * Start testing authz * Added authz test * Removed deprecated code * Lint * Format * add authz querier * tx handler error with anyhow test * format * Added authz builder method for options * Some nits * Revert with_authz, added sender options setter * Check rest of authz queries * Added mock state env id * Added fee grant in daemon builder and interface * Format * fix find_wasm_path_with * Generalized querier getter (#318) * show POC of generalized querier getter * update * fix merge and impl for all envs * Doon't verify mockj error anymore * Fixed test * update `QueryHandler` and WasmQuerier functions * fix smart query URL * fix compile * format and clippy --------- Co-authored-by: Kayanski <kowalski.kowalskin@gmail.com> * Added instantiate2 (#309) * Added instantiate2 * some fixes * Added instantiate2 addr getter * Format * Nits * Merged daemon queriers * Corrected querier in tests * Renamed queriers * fix tests * Fix tests * Renamed trait types * Changed types for osmosis test tube * Fixed features --------- Co-authored-by: Buckram <buckram123@gmail.com> Co-authored-by: CyberHoward <88450409+CyberHoward@users.noreply.github.com>
This PR aims at adding instantiate2 support directly inside the TxHandler trait
Closes ORC-62
Not using fix_msg because cosmwasm discourages it https://medium.com/cosmwasm/dev-note-3-limitations-of-instantiate2-and-how-to-deal-with-them-a3f946874230