File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -219,11 +219,24 @@ export default function useBeastMarket() {
219219 transaction ( `
220220 import FungibleToken from 0xFungibleToken
221221 import FUSD from 0xFUSD
222+ import NonFungibleToken from 0xNonFungibleToken
223+ import MetadataViews from 0xMetadataViews
222224 import BasicBeasts from 0xBasicBeasts
223225 import BeastMarket from 0xBeastMarket
224226
225227 transaction(sellerAddress: Address, beastID: UInt64, purchaseAmount: UFix64) {
226228 prepare(acct: AuthAccount) {
229+
230+ //Link the Beast collection
231+ if acct.borrow<&BasicBeasts.Collection{BasicBeasts.BeastCollectionPublic}>(from: BasicBeasts.CollectionStoragePath) == nil {
232+ acct.save(<- BasicBeasts.createEmptyCollection(), to: BasicBeasts.CollectionStoragePath)
233+ acct.unlink(BasicBeasts.CollectionPublicPath)
234+ acct.link<&BasicBeasts.Collection{NonFungibleToken.Receiver,
235+ NonFungibleToken.CollectionPublic,
236+ BasicBeasts.BeastCollectionPublic,
237+ MetadataViews.ResolverCollection}>
238+ (BasicBeasts.CollectionPublicPath, target: BasicBeasts.CollectionStoragePath)
239+ }
227240 // borrow a reference to the signer's collection
228241 let collection = acct.borrow<&BasicBeasts.Collection>(from: BasicBeasts.CollectionStoragePath)
229242 ?? panic("Could not borrow reference to the Beast Collection")
You can’t perform that action at this time.
0 commit comments