-
Notifications
You must be signed in to change notification settings - Fork 14
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
Bound querier conversion #127
Conversation
Codecov Report
@@ Coverage Diff @@
## main #127 +/- ##
==========================================
+ Coverage 79.96% 80.02% +0.05%
==========================================
Files 32 33 +1
Lines 1692 1717 +25
==========================================
+ Hits 1353 1374 +21
- Misses 339 343 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
LGTM, except their constructors are not exactly proper (consistency) - just fix them and then merge.
sylvia-derive/src/message.rs
Outdated
pub fn borrowed(&self, querier: &'a #sylvia ::cw_std::QuerierWrapper<'a, C>) -> Self { | ||
Self::new(self.contract, querier) | ||
} |
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, this one is on me as I messed up signature, but we want this to be:
pub fn new(contract: &'a #sylvia ::cw_std::Addr, querier: &'a #sylvia ::cw_std::QuerierWrapper<'a, C>) -> Self {
Self {contract, querier}
}
So basically, your new
should be called borrowed.
sylvia-derive/src/message.rs
Outdated
pub fn new(contract: &'a #sylvia ::cw_std::Addr, querier: &'a #sylvia ::cw_std::QuerierWrapper<'a, C>) -> Self { | ||
Self {contract, querier} | ||
} |
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 don't think we ever need this function, but if so, then the signature is bad - Addr
for this should be taken by owned value.
The reason this is probably needed is that if we store the address in the contract, then we probably store it as Remote
, and we want to use the .querier()
function to create a BoundQuerier
. We use a borrowed(...)
function only to make a shorthand to Remote::borrowed(addr).querier(querier)
, but then I would prefer it to be called borrowed
just like in Remote
.
PR3 of #28