Core Functionality | NEAR Protocol Specification

NFT에 대한 표준 인터페이스.

기존 ERC-721에 비해 여러 향상된 기능이 추가됨 ⇒ 이전에는 2~3차례 contract call해야 했던 것을 한번에 해결 가능. 아래가 대표적인 예.

NFT Contract 인터페이스

Receiver Contract 인터페이스

nft_on_transfer

Receiver contract가 NFT를 받은 후, 몇 가지 action들을 수행한다. 만약 sender_id로 NFT를 돌려줘야 한다면, true를 return한다.

// Take some action after receiving a non-fungible token
//
// Requirements:
// * Contract MUST restrict calls to this function to a set of whitelisted NFT
//   contracts
//
// Arguments:
// * `sender_id`: the sender of `nft_transfer_call`
// * `previous_owner_id`: the account that owned the NFT prior to it being
//   transferred to this contract, which can differ from `sender_id` if using
//   Approval Management extension
// * `token_id`: the `token_id` argument given to `nft_transfer_call`
// * `msg`: information necessary for this contract to know how to process the
//   request. This may include method names and/or arguments.
//
// Returns true if token should be returned to `sender_id`
function nft_on_transfer(
	sender_id: string,
	previous_owner_id: string,
  token_id: string,
  msg: string,
): Promise<boolean>;

필수조건:

Arguments: