Token standards
Multi-token (NEP-245)
NEP-245 is the ERC-1155 of NEAR — many token types (fungible and non-fungible) in one contract, with batch transfers.
NEP-245 is the newest of the three, mirroring ERC-1155: one contract managing many token types at once — some fungible, some not — with efficient batch operations. Balances are keyed by (account, token_id).
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IERC1155 {
function balanceOf(address account, uint256 id)
external view returns (uint256);
function safeTransferFrom(
address from, address to, uint256 id, uint256 amount, bytes calldata data
) external;
function safeBatchTransferFrom(
address from, address to,
uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data
) external;
}use near_sdk::json_types::U128;
use near_sdk::AccountId;
// NEP-245 core (shape — see the standard for the exact signatures)
pub trait MultiTokenCore {
fn mt_balance_of(&self, account_id: AccountId, token_id: String) -> U128;
fn mt_transfer(
&mut self,
receiver_id: AccountId,
token_id: String,
amount: U128,
memo: Option<String>,
);
fn mt_batch_transfer(
&mut self,
receiver_id: AccountId,
token_ids: Vec<String>,
amounts: Vec<U128>,
memo: Option<String>,
);
}balanceOf(account, id) ↔ mt_balance_of(account_id, token_id); safeBatchTransferFrom ↔ mt_batch_transfer. Token ids are strings here too, and amounts are U128.
Use it when one contract issues a whole catalogue — game items, editions, tiers — so you deploy and register storage once instead of one contract per token.
NEP-245 is newer and less common than NEP-141/171; check the current standard for exact signatures and the transfer-and-call variant before implementing.