Giter VIP home page Giter VIP logo

ext-nft-example's Introduction

Hands-on with EXT NFT πŸ’ŽπŸ–οΈ

A simple NFT implementation using Toniq Labs' EXT token standard. <-- Make sure to check it out to get all the details. Be aware, to make this a more useable demonstration, we omit the access control you'd want in a real implementation.

Note: EXT is an evolving standard, and not the only one around in the community!

Now, try it out 🧐!

  1. Run mintNFT 🌿: Punch in any old principal to mint an NFT under that principal's ownership. (Example principal: bhvmm-kkp5p-pzycc-apxyy-26mff-zazxc-gyotq-dlvtq-ilprx-g47sw-zae.)
  2. Run readLedger πŸ“œ: There's your NFT!
  3. Run transfer πŸ’°: You can use this data for the parameters, or come up with your own:
    • to: (principal) azv7s-jmrxi-gq23o-pcf2z-flpmo-3etck-tciq3-3qo3m-t7phq-4bfdi-lae
    • from: (principal) bhvmm-kkp5p-pzycc-apxyy-26mff-zazxc-gyotq-dlvtq-ilprx-g47sw-zae
    • token: use your canister id! (If you're in the playground, it will be at the top of your candid UI after you deploy)
    • notify: false
    • amount: 1

In EXT, tokens have a globally unique, hex encoded uuid based on the following structure: \x0Atid {domain seperator}{canister id}{token index}.

Now you have the primitive capabilities of an NFT under your superhero belt πŸ±β€πŸ! Wow, you're doing it.

A Little More Detail πŸ”Ž

The EXT token standard gets its name from it's EXTensible πŸ”— nature. A standard implementation of the core module must provide the following functionality:

Extensions (extensions : query () -> async [Extension];)
Get the extensions that this canister implements. After reading the results of this call, you know what functionality to expect from this canister.

Balance (balance: query (request : BalanceRequest) -> async BalanceResponse;)
Check a user's balance for a token.

Transfer (transfer: shared (request : TransferRequest) -> async TransferResponse;)
Transfer tokens between users.


This example implements the @ext/nonfungible extension, which means that it also provides these functions:

MintNFT (mintNFT: shared (request : MintRequest) -> async ();)
Add an NFT to the ledger.

Bearer (bearer: shared query (token : TokenIdentifier) -> async Result<AccountIdentifier, CommonError>;)

For the sake of utility, this example also implements a readLedger method, which is handy, but isn't currently a part of the EXT standard.

That's It!

You thought minting NFTs meant expensive fees and burning trees? Guess again! 🌲πŸ”₯πŸ’΅πŸ”₯πŸ§―πŸ§‘β€πŸš’β™ΎοΈ You can add anything your mind can dream up 🧠🀯.

ext-nft-example's People

Contributors

jorgenbuilder avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.