Skip to content

Commit

Permalink
define UniversalCollectionInfoResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
taitruong committed May 7, 2024
1 parent 781eeee commit bcc5996
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions packages/ics721/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ pub struct UniversalAllNftInfoResponse {
pub info: UniversalNftInfoResponse,
}

/// Based on `cw721::ContractInfoResponse v0.18`
#[derive(Deserialize)]
pub struct UniversalCollectionInfoResponse {
pub name: String,
pub symbol: String,
}

#[derive(Deserialize)]
pub struct UniversalNftInfoResponse {
pub token_uri: Option<String>,
Expand Down
6 changes: 3 additions & 3 deletions packages/ics721/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use cosmwasm_std::{Addr, DepsMut, Empty, Env, StdResult};
use cw721::{ContractInfoResponse, NumTokensResponse};
use cw721::NumTokensResponse;
use cw_ownable::Ownership;

use crate::state::CollectionData;
use crate::state::{CollectionData, UniversalCollectionInfoResponse};

pub fn get_collection_data(deps: &DepsMut, collection: &Addr) -> StdResult<CollectionData> {
// cw721 v0.17 and higher holds ownership in the contract
Expand All @@ -21,7 +21,7 @@ pub fn get_collection_data(deps: &DepsMut, collection: &Addr) -> StdResult<Colle
}
};
let contract_info = deps.querier.query_wasm_contract_info(collection)?;
let ContractInfoResponse { name, symbol } = deps.querier.query_wasm_smart(
let UniversalCollectionInfoResponse { name, symbol } = deps.querier.query_wasm_smart(
collection,
&cw721_base::msg::QueryMsg::<Empty>::ContractInfo {},
)?;
Expand Down

0 comments on commit bcc5996

Please sign in to comment.