Skip to content

Commit

Permalink
Add name helper
Browse files Browse the repository at this point in the history
  • Loading branch information
shanev committed Jun 2, 2023
1 parent 8c0ff33 commit 25cd367
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contracts/sg721-name/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ impl NameCollectionContract {
self.0.clone()
}

pub fn name(&self, querier: &QuerierWrapper, address: &str) -> StdResult<String> {
let res: String = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
msg: to_binary(&QueryMsg::Name {
address: address.to_string(),
})?,
}))?;

Ok(res)
}

pub fn image_nft(&self, querier: &QuerierWrapper, name: &str) -> StdResult<Option<NFT>> {
let res: Option<NFT> = querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
contract_addr: self.addr().into(),
Expand Down

0 comments on commit 25cd367

Please sign in to comment.