I'm trying to get the metadata for the Genesis collection from the DriverzNFT contract
this is the script I have
import DriverzNFT from 0xa039bd7d55a96c0c
import NonFungibleToken from 0x1d7e57aa55817448
import MetadataViews from 0x1d7e57aa55817448
pub fun main(address: Address): [&DriverzNFT.NFT] {
let collection = getAccount(address).getCapability(DriverzNFT.CollectionPublicPath)
.borrow<&DriverzNFT.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Receiver, MetadataViews.ResolverCollection}>(DriverzNFT.CollectionPublic)
?? panic("Can't get collection")
let returnVals: [&DriverzNFT.NFT] = []
let ids = collection.getIDs()
for id in ids {
returnVals.append(collection.borrowDriverzNFT(id: id))
}
return returnVals
}
Something is wrong here. I checked the transaction to see where the NFTs are stored and linked when they're sent over, and I checked the contract to see how the collection interface is built. Does anyone have any ideas why I can't pull this data???
The cadence script that I tried is written above. I used the following script to check if the NFT exists in an account:
import NonFungibleToken from 0x1d7e57aa55817448 import MetadataViews from 0x1d7e57aa55817448 import DriverzNFT from 0xa039bd7d55a96c0c
pub fun main(address: Address): Bool { return getAccount(address) .getCapability<&DriverzNFT.Collection{NonFungibleToken.CollectionPublic, NonFungibleToken.Receiver, MetadataViews.ResolverCollection}>(DriverzNFT.CollectionPublicPath) .check() }
And, this one worked and said that the NFT did exist in my account. But, why then wouldn't the other script share the data? Expecially if I am using the same path in the getCapability object.