nft-storefront
nft-storefront copied to clipboard
Storefront get_listing_details script does not work as written
NFT Storefront contract function for ListingDetails is not called correctly by scripts
pub fun getDetails(): ListingDetails {
return self.details
}
the script in this repo:
pub fun main(account: Address, listingResourceID: UInt64): [UInt64] {
let storefrontRef = account
.getCapability<&NFTStorefront.Storefront{NFTStorefront.StorefrontPublic}>(
NFTStorefront.StorefrontPublicPath
)
.borrow()
?? panic("Could not borrow public storefront from address")
let listing = storefrontRef.borrowListing(listingResourceID: listingResourceID)
?? panic("No item with that ID")
return listing.getDetails()
}
it returns an array of uint64s? that doesnt work.
and this comment is a remnant from the kitty version of this contract:
// borrowSaleItem
// Returns a read-only view of the SaleItem for the given listingID if it is contained by this collection.
//
pub fun borrowListing(listingResourceID: UInt64): &Listing{ListingPublic}? {
if self.listings[listingResourceID] != nil {
return &self.listings[listingResourceID] as! &Listing{ListingPublic}
} else {
return nil
}
}
Thanks @bm-nJoi. In both cases, these look like typos in the Cadence source code. We'll work on a fix.