Skip to content

Commit

Permalink
fix issue with metadata view resolution (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
austinkline authored Aug 22, 2024
1 parent 87081fc commit 20d74e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/nft/BaseCollection.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ access(all) contract interface BaseCollection: ViewResolver {
)
case Type<MetadataViews.NFTCollectionDisplay>():
let c = getAccount(addr).contracts.borrow<&{BaseCollection}>(name: segments[2])!
let md = c.MetadataCap.borrow()
if md == nil {
let tmp = c.MetadataCap.borrow()
if tmp == nil {
return nil
}

return md!.collectionInfo.collectionDisplay
return tmp!.collectionInfo.getDisplay()
case Type<FlowtyDrops.DropResolver>():
return FlowtyDrops.DropResolver(cap: acct.capabilities.get<&{FlowtyDrops.ContainerPublic}>(FlowtyDrops.ContainerPublicPath))
}
Expand Down
4 changes: 4 additions & 0 deletions contracts/nft/NFTMetadata.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ access(all) contract NFTMetadata {
access(all) struct CollectionInfo {
access(all) var collectionDisplay: MetadataViews.NFTCollectionDisplay

access(all) fun getDisplay(): MetadataViews.NFTCollectionDisplay {
return self.collectionDisplay
}

init(collectionDisplay: MetadataViews.NFTCollectionDisplay) {
self.collectionDisplay = collectionDisplay
}
Expand Down

0 comments on commit 20d74e9

Please sign in to comment.