Hi,
I 'm updating my contracts on testnet after breaking change. I think it’s ok, now I can mint an NFT but when I want to sell my NFT using contract NFTStorefront I have an error that I don’t understand.
If you want you can view my contracts here : https://testnet.flowscan.org/account/0x28870fdd3d60055f
For minting I use this transaction :
//---------- testnet--------------
import NonFungibleToken from 0x631e88ae7f1d7c20
import LithokenNFT from 0x28870fdd3d60055f
//---------- local --------------------
//import NonFungibleToken, LithokenNFT from 0xf8d6e0586b0a20c7
//Mint LithokenNFT
transaction( adresse:Address, fee:UFix64, nbrEdit:UInt64, nomSerie:String, nameNFT:String, nameArtist:String, desc:String, dedi:String, tp:String, lienIPFS:String, nomCollection:String ) {
let minter: Capability<&LithokenNFT.Minter>
let receiver: Capability<&{NonFungibleToken.Receiver}>
//modif
let name: String
let artist: String
let description: String
let dedicace: String
let type: String
let ipfs: String
let collection: String
let nameSerie: String
let nbrEdition: UInt64
var i : UInt64
prepare(acct: AuthAccount) {
if acct.borrow<&LithokenNFT.Collection>(from: LithokenNFT.collectionStoragePath) == nil {
let collection <- LithokenNFT.createEmptyCollection() //as! @LithokenNFT.Collection
acct.save(<-collection, to: LithokenNFT.collectionStoragePath)
acct.link<&{NonFungibleToken.CollectionPublic,NonFungibleToken.Receiver,LithokenNFT.LithokenNFTCollectionPublic}>(LithokenNFT.collectionPublicPath, target: LithokenNFT.collectionStoragePath)
}
self.minter = LithokenNFT.minter()
self.receiver = acct.getCapability<&{NonFungibleToken.Receiver}>(LithokenNFT.collectionPublicPath)
//modif
self.name = nameNFT
self.artist = nameArtist
self.description = desc
self.dedicace = dedi
self.type= tp
self.ipfs= lienIPFS
self.collection= nomCollection
//self.edition=1
self.nameSerie=nomSerie
self.nbrEdition=nbrEdit
self.i = 1
}
execute {
if self.nbrEdition == 1{
let minter = self.minter.borrow() ?? panic("Could not borrow receiver capability (maybe receiver not configured?)")
minter.mintTo(creator: self.receiver, name:self.name ,artist:self.artist, description:self.description ,dedicace:self.dedicace ,type:self.type ,ipfs:self.ipfs, collection:self.collection, nomSerie:"", edition:self.nbrEdition ,nbrEdition:self.nbrEdition , royalties: [LithokenNFT.Royalty(Address:adresse, UFix64:fee)])
} else {
while self.i <= self.nbrEdition {
let minter = self.minter.borrow() ?? panic("Could not borrow receiver capability (maybe receiver not configured?)")
minter.mintTo(creator: self.receiver, name:self.name ,artist:self.artist, description:self.description ,dedicace:self.dedicace ,type:self.type ,ipfs:self.ipfs, collection:self.collection, nomSerie:self.nameSerie, edition:self.i ,nbrEdition:self.nbrEdition , royalties: [LithokenNFT.Royalty(Address:adresse, UFix64:fee)])
self.i= self.i+1
}
}
}
}
And for Sell my NFT to the Storefront I use this transaction :
//---------- testnet--------------
import RedevNFT from 0x28870fdd3d60055f
import LithokenNFT from 0x28870fdd3d60055f
import LithokenOrder from 0x28870fdd3d60055f
import FlowToken from 0x7e60df042a9c0868
import FungibleToken from 0x9a0766d93b6608b7
import NonFungibleToken from 0x631e88ae7f1d7c20
import NFTStorefront from 0x94b06cfca1d8a476
// Sell LithokenNFT token for FlowToken with NFTStorefront
//
transaction(tokenId: UInt64, price: UFix64) {
let nftProvider: Capability<&{NonFungibleToken.Provider,NonFungibleToken.CollectionPublic,RedevNFT.CollectionPublic}>
let storefront: &NFTStorefront.Storefront
prepare(acct: AuthAccount) {
let nftProviderPath = /private/LithokenNFTProviderForNFTStorefront
if !acct.getCapability<&{NonFungibleToken.Provider,NonFungibleToken.CollectionPublic,RedevNFT.CollectionPublic}>(nftProviderPath)!.check() {
acct.link<&{NonFungibleToken.Provider,NonFungibleToken.CollectionPublic,RedevNFT.CollectionPublic}>(nftProviderPath, target: LithokenNFT.collectionStoragePath)
}
self.nftProvider = acct.getCapability<&{NonFungibleToken.Provider,NonFungibleToken.CollectionPublic,RedevNFT.CollectionPublic}>(nftProviderPath)!
assert(self.nftProvider.borrow() != nil, message: "Missing or mis-typed nft collection provider")
if acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath) == nil {
let storefront <- NFTStorefront.createStorefront() as! @NFTStorefront.Storefront
acct.save(<-storefront, to: NFTStorefront.StorefrontStoragePath)
acct.link<&NFTStorefront.Storefront{NFTStorefront.StorefrontPublic}>(NFTStorefront.StorefrontPublicPath, target: NFTStorefront.StorefrontStoragePath)
}
self.storefront = acct.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath)
?? panic("Missing or mis-typed NFTStorefront Storefront")
}
execute {
let royalties: [LithokenOrder.PaymentPart] = []
let extraCuts: [LithokenOrder.PaymentPart] = []
for royalty in self.nftProvider.borrow()!.getRoyalties(id: tokenId) {
royalties.append(LithokenOrder.PaymentPart(address: royalty.address, rate: royalty.fee))
}
LithokenOrder.addOrder(
storefront: self.storefront,
nftProvider: self.nftProvider,
nftType: Type<@LithokenNFT.NFT>(),
nftId: tokenId,
vaultPath: /public/flowTokenReceiver,
vaultType: Type<@FlowToken.Vault>(),
price: price,
extraCuts: extraCuts,
royalties: royalties
)
}
}
For minting it is ok but for put in sell my NFT with the second transaction I get this error that I don’t understand :
|
44 | storefront: self.storefront,
| ^^^^^^^^^^^^^^^ expected `&NFTStorefront.Storefront`, got
`&NFTStorefront.Storefront`
expected &NFTStorefront.Storefront
, got &NFTStorefront.Storefront
???
Thank you for your help