Skip to content

Commit

Permalink
fix for loading data from old collections
Browse files Browse the repository at this point in the history
  • Loading branch information
tempe-techie committed Oct 19, 2023
1 parent 9bad9a7 commit f18466a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default defineNuxtConfig({
punkNumberOfPrices: 5, // number of different prices (based on domain length), usually 1 (price()) or 5 (price1char() - price5char())
punkTldAddress: "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", // punk domain TLD address
randomPostsNumber: 1, // number of random post NFTs to show in the sidebar widget
rpcCustom: process.env.RPC_CUSTOM || "", // Custom RPC URL
rpcCustom: process.env.RPC_CUSTOM || "https://flare-api.flare.network/ext/C/rpc", // Custom RPC URL
showRepliesOnHomepage: true, // show replies on the homepage
stakingContractAddress: "", // this is also the stake/gov token address
stakeTokenSymbol: "", // stake token symbol (governance token symbol)
Expand Down
26 changes: 22 additions & 4 deletions pages/nft/collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ export default {
"function getCollectionPreviewImage(address) public view returns (string memory)",
"function descriptions(address) public view returns (string memory)", // OLD NFTs
"function mdTypes(address) public view returns (uint256)", // OLD NFTs
"function names(address) public view returns (string memory)" // OLD NFTs
"function names(address) public view returns (string memory)", // OLD NFTs
"function mds(address) public view returns (string memory, string memory, string memory, string memory, string memory, uint256)" // OLD NFTs
]);
const metadataContract = new ethers.Contract(this.mdAddress, metadataInterface, provider);
Expand All @@ -477,16 +478,24 @@ export default {
}
}
let mdsData;
// get description
if (collection?.description && collection.description !== "" && collection.description !== null) {
this.cDescription = collection.description;
} else {
try {
this.cDescription = await metadataContract.getCollectionDescription(this.cAddress);
} catch (e) {
this.cDescription = await metadataContract.descriptions(this.cAddress);
try {
this.cDescription = await metadataContract.descriptions(this.cAddress);
} catch (e) {
if (!mdsData) {
mdsData = await metadataContract.mds(this.cAddress);
}
this.cDescription = mdsData[1];
}
}
}
// get type
Expand All @@ -496,7 +505,16 @@ export default {
try {
this.cType = await metadataContract.getCollectionMetadataType(this.cAddress);
} catch (e) {
this.cType = await metadataContract.mdTypes(this.cAddress);
// TODO
try {
this.cType = await metadataContract.mdTypes(this.cAddress);
} catch (e) {
if (!mdsData) {
mdsData = await metadataContract.mds(this.cAddress);
}
this.cType = mdsData[5];
}
}
}
Expand Down

0 comments on commit f18466a

Please sign in to comment.