Non Fungible Token Tutorial

This tutorial is based on the ZERO to HERO series of NFT tutorial. We are almost copying what they have there, except for some changes and added additionals:

  • Make the code naming easier to understand, in some cases.
  • Explanation on the logic whenever it got confusing.
  • (Note: still need to think whether to implement this) We will also build a front-end for this, to make the example end-to-end.
  • But at the same time, show near-cli and their similarities? For this example or for other examples?

You might want to follow the original code. In fact, one suggests that as one might miss out stuffs (or deliberately leave out stuffs) that's available in the original site but not available here. Nevertheless, one tries to make this as standalone as possible so you don't have to refer back and forth.

Also, one isn't a fan of conclusions so one will skip recalling what we done, against the norm. To have a recall, visit the original references, or just read through the page again to recall.

References

To be added


#![allow(unused)]
fn main() {
let mut token = if let Some(token) = self.tokens_by_id.get(&token_id) {
  if token.owner_id != receiver_id {  // receiver_id is the receiver. 
    refund_approved_account_ids(owner_id, &approved_account_ids);
    return true;  
  }
  token
} else {  // no token object, it was burned. 
  refund_approved_account_ids(owner_id, &approved_account_ids);
  return true;
};
}

Cannot move out refund_approved_account_ids as it leads to different results.