Get error: "panic: could not borrow minter reference"

I am a newer for cadence.

I follow the NFT document, and test in [playgroudd](Flow Playground.

I deployed the two smart contracts, and setuped the account. When I want to minter the NFT, It failed:

I guess I should setup the account 2, But I don’t how to change account from 0x01 to 0x02, the signature is always created by 0x01

1 Like

Is any one here? Help me Plz, Thx

You can change the signer when you click the 0x01 icon in the transaction signer box. 0x01 will disappear when you click it, and you can click and assign another signer. Your error occurred because your NFT contract is deployed in 0x02 (on line 3) but the transaction signer is 0x01. (You could not borrow mint ref because it’s in 0x02 but your signer is 0x01) Only admin account who deployed NFT contract could authorize mint transaction. Setup transaction is just a step for receiving tokens, not for minting.

1 Like

Yes, I get it. Thank you very much!

1 Like

Hi @juyeon , I need one help. I want to make NFTMinter resource available for every user account .i.e.
Account 0x02 holds the NFTMinter resource in it’s private path, so only this account can use it. In my use case, I want to allow this resource to be available to all users .i.e it’s reference should be on a public path.

I wrote this one line of code in the init method of the contract -

self.account.link<&NFTMinter>(/public/NFTMinter, target: /storage/NFTMinter)

but I’m still getting the same error -

could not borrow minter reference.

What can be done here? Please let me know. :slight_smile:

Thanks!

HI @Kartik,

There are two possibilities:
You want the NFTMinter ressource to remain on one Account but to be accessible from other accounts, then you need to use a Ressource Interface, then store a link from private storage to public storage

You want everyone to deploy the NFTMinter ressource on their account, then you need first to initialize the NFTMinter on this accounts with ← create NFTMinter() then save it to private storage.

So depending on your needs, case 1 => Use a Ressouce Interface, case 2 => Initiate the Ressource first to the required accounts

2 Likes