NEAR Intents: Using NEAR Tokens
How to use NEAR tokens with NEAR Intents
The Verifier contract only accepts NEP-141 tokens, so native NEAR must be wrapped before depositing. The wrap.near contract converts NEAR to wNEAR at a 1:1 ratio.
See wNEAR docs for a detailed reference guide.
[!TIP]
If you're using the 1Click Swap API or another managed integration, wrapping is handled for you - skip this guide.
Wrap and deposit
If you're integrating directly with the Verifier contract, you must wrap your NEAR first before depositing:
1. Wrap your NEAR
Call near_deposit on the wrap.near contract, attaching the amount of NEAR you want to wrap. This example wraps 0.01 NEAR:
NEAR CLI
near call wrap.near near_deposit '{}' \
--deposit 0.01 \
--gas 30000000000000 \
--useAccount your-account.near \
--networkId mainnet
NEAR API JS
import { Account, JsonRpcProvider, teraToGas, nearToYocto, KeyPairString } from "near-api-js";
const accountId = "your-account.near";
const privateKey = "ed25519:3D4YudU..." as KeyPairString;
const provider = new JsonRpcProvider({ url: "https://rpc.fastnear.com" });
const account = new Account(accountId, provider, privateKey);
await account.callFunction({
contractId: "wrap.near",
methodName: "near_deposit",
args: {},
gas: teraToGas("30"),
deposit: nearToYocto("0.01"),
});
See contract interaction example in near-api-examples repository.
2. Deposit wNEAR into the Verifier contract
Call ft_transfer_call on wrap.near to deposit your wNEAR. wNEAR has 24 decimals, so 0.01 wNEAR = 10000000000000000000000.
NEAR CLI
near call wrap.near ft_transfer_call \
'{"receiver_id": "intents.near", "amount": "10000000000000000000000", "msg": ""}' \
--deposit 0.000000000000000000000001 \
--gas 100000000000000 \
--useAccount your-account.near \
--networkId mainnet
NEAR API JS
await account.callFunction({
contractId: "wrap.near",
methodName: "ft_transfer_call",
args: {
receiver_id: "intents.near",
amount: "10000000000000000000000",
msg: "",
},
gas: teraToGas("100"),
deposit: 1n, // 1 yoctoNEAR
});
See contract interaction example in near-api-examples repository.
[!NOTE]
In the Verifier contract, wrapped NEAR is identified as
nep141:wrap.near.
See Deposits for details on the msg parameter and other deposit options.