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 extra fields in contract info response #95

Closed
wants to merge 2 commits into from
Closed
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 justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set dotenv-load

platform := if arch() =~ "aarch64" {"linux/arm64"} else {"linux/amd64"}
image := if arch() =~ "aarch64" {"cosmwasm/workspace-optimizer-arm64:0.15.0"} else {"cosmwasm/workspace-optimizer:0.15.0"}
image := if arch() =~ "aarch64" {"cosmwasm/workspace-optimizer-arm64:0.15.1"} else {"cosmwasm/workspace-optimizer:0.15.1"}

alias log := optimize-watch

Expand Down
20 changes: 18 additions & 2 deletions packages/ics721/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Addr, DepsMut, Empty, Env, StdResult};
use cw721::{ContractInfoResponse, NumTokensResponse};
use cw721::NumTokensResponse;
use cw_ownable::Ownership;

use crate::state::CollectionData;

#[cw_serde]
pub struct ContractInfoResponse {
pub name: String,
pub symbol: String,
pub minter: Option<String>,
pub royalty_bps: Option<Vec<u64>>,
pub royalty_addrs: Option<Vec<String>>,
}

pub fn get_collection_data(deps: &DepsMut, collection: &Addr) -> StdResult<CollectionData> {
// cw721 v0.17 and higher holds ownership in the contract
let ownership: StdResult<Ownership<Addr>> = deps
Expand All @@ -21,7 +31,13 @@ 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 ContractInfoResponse {
name,
symbol,
minter: _,
royalty_bps: _,
royalty_addrs: _,
} = deps.querier.query_wasm_smart(
collection,
&cw721_base::msg::QueryMsg::<Empty>::ContractInfo {},
)?;
Expand Down
Loading