Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
reset Art paths and add cacheKey to art since blocto wants it
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjarte Stien Karlsen committed Apr 26, 2021
1 parent 13f78d1 commit a99dda5
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions contracts/Art.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ pub contract Art: NonFungibleToken {
pub fun content() : String?

pub let royalty: {String: Royalty}
pub fun cacheKey() : String

}

pub struct Metadata {
Expand Down Expand Up @@ -103,6 +105,13 @@ pub contract Art: NonFungibleToken {
self.description=metadata.description
}

pub fun cacheKey() : String {
if self.url != nil {
return self.url!
}
return self.contentId!.toString()
}

//return the content for this NFT
pub fun content() : String {
if self.url != nil {
Expand Down Expand Up @@ -200,9 +209,11 @@ pub contract Art: NonFungibleToken {
pub struct ArtData {
pub let metadata: Art.Metadata
pub let id: UInt64
init(metadata: Art.Metadata, id: UInt64) {
pub let cacheKey: String
init(metadata: Art.Metadata, id: UInt64, cacheKey: String) {
self.metadata= metadata
self.id=id
self.cacheKey=cacheKey
}
}

Expand All @@ -228,7 +239,8 @@ pub contract Art: NonFungibleToken {
var art=artCollection.borrowArt(id: id)
artData.append(ArtData(
metadata: art!.metadata,
id: id))
id: id,
cacheKey: art!.cacheKey()))
}
}
return artData
Expand Down Expand Up @@ -329,8 +341,8 @@ pub contract Art: NonFungibleToken {
init() {
// Initialize the total supply
self.totalSupply = 0
self.CollectionPublicPath=/public/versusArtCollection3
self.CollectionStoragePath=/storage/versusArtCollection3
self.CollectionPublicPath=/public/versusArtCollection
self.CollectionStoragePath=/storage/versusArtCollection

self.account.save<@NonFungibleToken.Collection>(<- Art.createEmptyCollection(), to: Art.CollectionStoragePath)
self.account.link<&{Art.CollectionPublic}>(Art.CollectionPublicPath, target: Art.CollectionStoragePath)
Expand Down

0 comments on commit a99dda5

Please sign in to comment.