Skip to content
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

Handle custom collections #96

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ics721/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ where
for (key, channel) in entries {
INCOMING_CLASS_TOKEN_TO_CHANNEL.save(deps.storage, key, &channel)?;
}
Ok(Response::default().add_attribute("method", "callback_redeem_outgoing_channel_entries"))
Ok(Response::default().add_attribute("method", "callback_save_incoming_channel_entries"))
}

fn migrate(
Expand Down
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
Loading