Sell kittyItems transaction failed

Hi,
I run the kittyItems project (https://github.com/onflow/kitty-items) on flow emulator, I deployed all the contracts on “account-emulator” and I created another account on which I setup a vault fusd, I minted fusd on it, and I minted also an NFT on it. Now I want to put this NFT on marketplace “nftStorefront” but when I run the transaction sell_item_fusd.cdc, I obtain this error :
flow transactions send ./cadence/transactions/nftStorefront/sell_item_fusd.cdc --signer account_with_nft --arg UInt64:1 --arg UFix64:10.0

❌ Transaction Error 
execution error code 1101: [Error Code: 1101] cadence runtime error Execution failed:
error: assertion failed: Missing or mis-typed Kibble receiver
  --> 315c8626083fb38520b4e51c5027cf40be8c943e9d5917b16ee826f56cc76769:19:8
   |
19 |         assert(self.fusdReceiver.borrow() != nil, message: "Missing or mis-typed Kibble receiver")
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

the code sell_item_fusd.cdc :
import FungibleToken from “…/…/contracts/FungibleToken.cdc”
import NonFungibleToken from “…/…/contracts/NonFungibleToken.cdc”
import FUSD from “…/…/contracts/FUSD.cdc”
import KittyItems from “…/…/contracts/KittyItems.cdc”
import NFTStorefront from “…/…/contracts/NFTStorefront.cdc”

transaction(saleItemID: UInt64, saleItemPrice: UFix64) {

    let fusdReceiver: Capability<&FUSD.Vault{FungibleToken.Receiver}>
    let kittyItemsProvider: Capability<&KittyItems.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>
    let storefront: &NFTStorefront.Storefront

    prepare(account: AuthAccount) {
        // We need a provider capability, but one is not provided by default so we create one if needed.
        let kittyItemsCollectionProviderPrivatePath = /private/kittyItemsCollectionProvider

        self.fusdReceiver = account.getCapability<&FUSD.Vault{FungibleToken.Receiver}>(/public/fusdReciever)!
        
        assert(self.fusdReceiver.borrow() != nil, message: "Missing or mis-typed Kibble receiver")

        if !account.getCapability<&KittyItems.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(kittyItemsCollectionProviderPrivatePath)!.check() {
            account.link<&KittyItems.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(kittyItemsCollectionProviderPrivatePath, target: KittyItems.CollectionStoragePath)
        }

        self.kittyItemsProvider = account.getCapability<&KittyItems.Collection{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>(kittyItemsCollectionProviderPrivatePath)!
        
        assert(self.kittyItemsProvider.borrow() != nil, message: "Missing or mis-typed KittyItems.Collection provider")

        self.storefront = account.borrow<&NFTStorefront.Storefront>(from: NFTStorefront.StorefrontStoragePath)
            ?? panic("Missing or mis-typed NFTStorefront Storefront")
    }

    execute {
        let saleCut = NFTStorefront.SaleCut(
            receiver: self.fusdReceiver,
            amount: saleItemPrice
        )
        self.storefront.createSaleOffer(
            nftProviderCapability: self.kittyItemsProvider,
            nftType: Type<@KittyItems.NFT>(),
            nftID: saleItemID,
            salePaymentVaultType: Type<@FUSD.Vault>(),
            saleCuts: [saleCut]
        )
    }
}

I don’t know what this assert because I have a fusd vault on the account receiver. I have 30 fusd on it.
Have you an idea ?
Thanks for your help

OK, I’ve got it !! I have been looking for a long time and finally it is a smalllllll error

In the transaction code : self.fusdReceiver = account.getCapability<&FUSD.Vault{FungibleToken.Receiver}>(/public/fusdReciever)!

/public/fusdReciever instead of /public/fusdReceiver

Glad you were able to figure it out! Feel free to ask any other questions. :slight_smile:

1 Like

Awesome, was this a typo in the example code?

Yes this is a typo in the example code.
You can see this typo again :

at the line 17

Fixed here:

1 Like