Skip to content

Commit

Permalink
Merge pull request #96 from arkprotocol/custom_collections
Browse files Browse the repository at this point in the history
Handle custom collections
  • Loading branch information
jhernandezb authored May 13, 2024
2 parents 781eeee + 64ffd5f commit 4aab9d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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

0 comments on commit 4aab9d2

Please sign in to comment.