1

Now I am trying to implement NFT purchasing functionality based on a substrate node.

I got this function from the polkadot js documentation.

buyItem(collection: u32, item: u32, bid_price: u128)

    interface: api.tx.uniques.buyItem
    summary: See [Pallet::buy_item]. 

but when I try this function. I got this (the image)

enter image description here

Of course, the function caller is a buyer.

I hope to get any advice to get this works.

1 Answer 1

1

Looks like there are two checks in buy_item that result in NoPermission:

ensure!(details.owner != buyer, Error::<T, I>::NoPermission);

The owner is not allowed to buy the NFT.

if let Some(only_buyer) = price_info.1 {
    ensure!(only_buyer == buyer, Error::<T, I>::NoPermission);
}

There is a whitelisted_buyer and only they are allowed to buy the NFT.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.