Skip to main content

How to bridge non-fungible tokens

The Non-Fungible Token (NFT) Connector enables the bridging of NFTs between NEAR and Calimero. This guide provides step-by-step instructions on how to bridge NFTs from NEAR Testnet to Calimero and back.

Bridging NFTs from NEAR to Calimero

To bridge an NFT from NEAR Testnet to Calimero, follow these steps:

  1. Lock the desired NFT by calling a single transaction to transfer it to the NFT Connector contract on NEAR. Ensure that you use the nft_transfer_call function instead of nft_transfer to prevent token loss.

    Here's an example of locking a non-fungible token on NEAR Testnet:

    near call nft-test.igi.testnet nft_transfer_call --args '{"receiver_id":"", "token_id":"0", "msg":""}' --accountId igi.testnet --depositYocto 1 --gas 300000000000000
  2. Once the token is transferred, the bridge service will be notified and attempt to verify the locking of tokens on NEAR. If the verification is successful, a wrapped token representing the NFT will be minted on the Calimero shard.


When locking NFTs on the source side NFT Connector, you MUST use the nft_transfer_call function. If you try to use nft_transfer, the tokens will be LOST.

Withdrawing NFTs back to NEAR

To withdraw a bridged NFT from Calimero back to NEAR, follow these steps:

  1. Call the withdraw function on the bridged token contract deployed on Calimero.

    • This action will effectively burn the token on Calimero.
    • The bridge service will be notified of the burn event and attempt to verify it on the NFT Connector contract on NEAR.
    • If the verification is successful, the tokens will be unlocked and made available on NEAR Testnet.

    Here's an example of withdrawing/burning the NFT token on Calimero:

    calimero cali99-calimero-testnet call nft-test_igi.nft_deployer.cali99.calimero.testnet withdraw --args '{"token_id":"0"}' --accountId igi.testnet --depositYocto 1 --gas 300000000000000

Wrapped Tokens Naming

Wrapped or bridged NFTs are named using the same method as Fungible Tokens (FTs). For a detailed description of the naming process, refer to the Fungible Token documentation.

Helper CLI

To simplify commands on the Calimero side, you can create a Calimero alias. Run the following command, replacing dev with staging for staging environments or removing it for production:

alias calimero='calimero_wrapper() {
local command="$2";
local max_gas="300000000000000";
local node_url="$1/neard-rpc/";
local args=();
if [[ "$command" == "call" ]]; then
near "${args[@]}" --gas $max_gas --nodeUrl "$node_url" --networkId "$1";
near "${args[@]}" --nodeUrl "$node_url" --networkId "$1";
}; calimero_wrapper'

Bridging NFTs from Calimero to NEAR

If the NFT was originally minted on Calimero and needs to be bridged to NEAR, the process is similar to the one described above. The only difference is that a lock transaction needs to be called on the Calimero side, and a withdraw transaction needs to be called on the NEAR side to bring the token back to Calimero.