That storage cost error isn’t about your account balance - it’s the deposit you need to attach to your contract call. NEAR requires you to attach yoctoNEAR to cover storage for the token data when minting NFTs. You’re missing the attachedDeposit parameter in your JavaScript call. From your error, you need about 6.29 NEAR per token. Try this: window.contract.create_nft_batch({ nft_data: nft_array }, “300000000000000”, “6290000000000000000000”). For multiple NFTs, just multiply that storage cost by your array length. In your Rust contract, validate the attached deposit using env::attached_deposit() and calculate total storage needed before processing the batch. This way the caller has to provide enough funds upfront for all the tokens.
Yep, that’s the storage deposit problem. Your JS call is missing the deposit amount - that’s why it’s panicking. Try window.contract.create_nft_batch({ nft_data: nft_array }, "300000000000000", "6290000000000000000000") but multiply the deposit by your array length for batch minting. You might want to add some Rust checks to fail early if the deposit isn’t enough.
Oh interesting! Classic NEAR storage issue. Are you handling storage deposit calculation dynamically in your batch function?
Batch minting storage costs vary a lot based on metadata size per NFT. That 6.29 NEAR might just be for one token - if you’re processing multiple tokens the total could be way higher.
Have you tried checking actual storage requirements before minting? Calculate env::storage_usage() before and after each token creation to get real costs. You could refund excess deposit back to the caller too.
Also wondering - fixed-cost system where users pay set amount regardless of metadata size, or variable pricing? What happens if someone tries minting 50 NFTs at once? Any limits in place?
Btw, add validation in your rust code to check if env::attached_deposit() is sufficient before starting batch process. Otherwise users get partway through and fail - super frustrating.