'How to mint an NFT using `/sign_url` REST API of NEAR?

We're building a Marketplace in NEAR blockchain. Currently, integrating the mint feature.

We have build a NFT contract and deployed to our testnet account. Reference: https://examples.near.org/NFT

We need help with /sign_url API. It generates a link to NEAR Wallet with provided transaction details. May be used to redirect user to the wallet and perform a transaction without generation application-specific keys and granting access: enter image description here

We have generated approve transaction URL using /sign_url API: enter image description here

By opening and signing generated approve transaction URL and getting this error:

{"index":0,"kind":{"ExecutionError":"Smart contract panicked: panicked at 'assertion failed: `(left == right)`\n left: `\"mamba11.testnet\"`,\n right: `\"mamba-marketplace-v1.testnet\"`: Unauthorized', /home/gitpod/.cargo/registry/src/github.com-1ecc6299db9ec823/near-contract-standards-3.2.0/src/non_fungible_token/core/core_impl.rs:348:9"}} 

enter image description here

Please help us to solve this error.



Solution 1:[1]

I had the same issue when i was using mint function inside nft_mint(). The solution was to change mint function to internal_mint according to this example : https://github.com/near/near-sdk-rs/blob/master/examples/non-fungible-token/nft/src/lib.rs#L99 , and without checking owner_id at 98 row! Also you will need to change your near-sdk version to > 4.0.0 and near-contract-standarts to > 4.0.0. And i changed receiver_id type from ValidAccountId to AccountId.

Here are docs with description of internal_mint and mint functions https://github.com/near/near-sdk-rs/blob/master/near-contract-standards/src/non_fungible_token/core/core_impl.rs#L325

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DharmanBot