Coder Social home page Coder Social logo

oxheadalpha / nft-tutorial Goto Github PK

View Code? Open in Web Editor NEW
92.0 10.0 25.0 1.29 MB

Tezos FA2 NFT CLI Tool And Tutorial

License: MIT License

Shell 0.08% JavaScript 5.08% TypeScript 51.22% OCaml 43.62%
tezos nft smart-contracts blockchain fa2 tzip-12 tzip-16 tzip-21 ligo taquito

nft-tutorial's Introduction

Tutorial: Non-Fungible Tokens on Tezos Using FA2

Tutorial

The actual tutorial is located here.

Packages

The repo has three following yarn workspaces (packages):

How to Install And Use CLI Tool

Run the following command to install tznft CLI npm install -g @oxheadalpha/tznft

You can learn tznft command options by running $ tznft --help command or following the tutorial steps.

How to Build The Project

$ yarn install
$ yarn build

If you want to run tznft CLI from your local build, run yarn link command from tznft package directory.

nft-tutorial's People

Contributors

alex-kooper avatar dependabot[bot] avatar emishur avatar jacobarluck avatar obstropolos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nft-tutorial's Issues

Cannot build from source

Hi,
Following the steps in the README, when I run yarn build, tznft stops build at the compile-contract command.
image

How to use `minter_use_example_simple_admin_with_minters.mligo`

Hi, I've seen your tutorial and found it super useful. I'm trying to customize the contract to allow not only the admin to mint tokens and i found the example mentioned in the title.

But this is the issue, i understood how i have to change the fa2_nft_asset.mligo including the files you're writing in the example, but i'm not sure how to change the actual nft_asset_main entrypoint to match the example..

Can you provide an extended example or suggest the correct way to implement it?

Thank you for the amazing work!

How do I connect to mainnet?

New to Tezos, so I'm likely missing some basics. I see networks for sandbox and testnet. How do I connect to mainnet?

I have a feeling I need to run a node then connect to that, am I correct? Or is it as simple as the testnet and I just need a url and update nft-tutorial/tznft.json

Testnet boostrap results in empty implicit contract

Switching networks in tznft.json to testnet results in this error when trying to boostrap:

originating balance inspector contract...
inspector origination error {
  "message": "Http error response: (500) [{\"kind\":\"branch\",\"id\":\"proto.008-PtEdo2Zk.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n",
  "status": 500,
  "statusText": "Internal Server Error",
  "body": "[{\"kind\":\"branch\",\"id\":\"proto.008-PtEdo2Zk.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n",
  "url": "https://rpcalpha.tzbeta.net/chains/main/blocks/head/helpers/scripts/run_operation",
  "name": "HttpResponse"
}
failed to start. {"message":"Http error response: (500) [{\"kind\":\"branch\",\"id\":\"proto.008-PtEdo2Zk.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n","status":500,"statusText":"Internal Server Error","body":"[{\"kind\":\"branch\",\"id\":\"proto.008-PtEdo2Zk.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n","url":"https://rpcalpha.tzbeta.net/chains/main/blocks/head/helpers/scripts/run_operation","name":"HttpResponse"}

Unsuccessful tznft invocation exits with 0 return code

❯ tznft mint alice --tokens '0,T1,Igors Mega Token' '1, T2, Another One Bites The Dust'
no tznft.json config file found
Try to run tznft config-int command to create default config
unknown error:
Error: no tznft.json config file found
    at Object.loadUserConfig (/Users/itkach/dev/nft-tutorial/lib/config-util.js:61:15)
    at Object.<anonymous> (/Users/itkach/dev/nft-tutorial/lib/contracts.js:75:38)
    at Generator.next (<anonymous>)
    at /Users/itkach/dev/nft-tutorial/lib/contracts.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/itkach/dev/nft-tutorial/lib/contracts.js:23:12)
    at Object.mintNfts (/Users/itkach/dev/nft-tutorial/lib/contracts.js:72:12)
    at /Users/itkach/dev/nft-tutorial/lib/tznft.js:113:99
    at Generator.next (<anonymous>)
    at /Users/itkach/dev/nft-tutorial/lib/tznft.js:28:71

~
❯ echo $?
0

Expected result: non-zero return code

Incomplete build instruction

How to Buld The Project

  • typo in the headline
  • After installing yarn and cloning the repo I get the following error:
yarn install
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'install'

tznft bootstrap fails

❯ tznft bootstrap
9e9118368307f17860ac06f3f9b26516fd1a3df81e3868460072e455757338bf

starting sandbox...
sandbox started
originating balance inspector contract...
inspector origination error {}
failed to start. "{}"

/Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/rxjs/internal/util/hostReportError.js:4
    setTimeout(function () { throw err; }, 0);
                             ^

TypeError: Cannot read property 'forEach' of undefined
    at MapSubscriber.project (/Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/@taquito/taquito/dist/taquito.umd.js:1140:40)
    at MapSubscriber._next (/Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/rxjs/internal/operators/map.js:49:35)
    at MapSubscriber.Subscriber.next (/Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/rxjs/internal/Subscriber.js:66:18)
    at SwitchMapSubscriber.notifyNext (/Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/rxjs/internal/operators/switchMap.js:85:26)
    at SimpleInnerSubscriber._next (/Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/rxjs/internal/innerSubscribe.js:27:21)
    at SimpleInnerSubscriber.Subscriber.next (/Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/rxjs/internal/Subscriber.js:66:18)
    at /Users/itkach/.nvm/versions/node/v12.14.1/lib/node_modules/@tqtezos/nft-tutorial/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24
    at processTicksAndRejections (internal/process/task_queues.js:94:5)

tznft.js cannot find module

When trying to start the tutorial, after installing the global dependencies when I try to run tznft it gives me the following error:

`root@LAPTOP-IQTAJKDN://mnt/c/tezos-client/nft-tutorial# tznft init-config
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module '/mnt/c/Users/David Liendo/AppData/Roaming/npm/node_modules/@tqtezos/nft-tutorial/lib/tznft.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}`

How to use any other network

How do I use florencenet? mainnet? edonet? etc?

How can i change my config to use my mainnet wallet and hit mainnet, or a faucet wallet and hit florencenet.

`tznft bootstrap` does not work by default

I get this error when trying to run tznft bootstrap with the default configuration, just used tznft set-network testnet

± |master ?:3 ✗| → tznft bootstrap
originating balance inspector contract...
inspector origination error {
  "message": "Http error response: (500) [{\"kind\":\"branch\",\"id\":\"proto.010-PtGRANAD.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n",
  "status": 500,
  "statusText": "Internal Server Error",
  "body": "[{\"kind\":\"branch\",\"id\":\"proto.010-PtGRANAD.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n",
  "url": "https://testnet-tezos.giganode.io/chains/main/blocks/head/helpers/scripts/run_operation",
  "name": "HttpResponse"
}
failed to start. {"message":"Http error response: (500) [{\"kind\":\"branch\",\"id\":\"proto.010-PtGRANAD.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n","status":500,"statusText":"Internal Server Error","body":"[{\"kind\":\"branch\",\"id\":\"proto.010-PtGRANAD.implicit.empty_implicit_contract\",\"implicit\":\"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6\"}]\n","url":"https://testnet-tezos.giganode.io/chains/main/blocks/head/helpers/scripts/run_operation","name":"HttpResponse"}
unknown error:
HttpResponseError {
  message: 'Http error response: (500) [{"kind":"branch","id":"proto.010-PtGRANAD.implicit.empty_implicit_contract","implicit":"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6"}]\n',
  status: 500,
  statusText: 'Internal Server Error',
  body: '[{"kind":"branch","id":"proto.010-PtGRANAD.implicit.empty_implicit_contract","implicit":"tz1f6LtT8nER9aYaaNb7PPJq7rkhwpcXexU6"}]\n',
  url: 'https://testnet-tezos.giganode.io/chains/main/blocks/head/helpers/scripts/run_operation',
  name: 'HttpResponse'
}

tznft show-balance fails

tznft show-balance returns "invalid inspector storage state" because lib/contracts.js at line 133 checks if (Array.isArray(storage)) and storage is not an array but:

storage {
  state: [
    { request: [Object], balance: [BigNumber] },
    { request: [Object], balance: [BigNumber] }
  ]
}

So, when I edited it to:

        if (Array.isArray(storage.state))
            printBalances(storage.state);
        else {

It worked.

nft origination error

Getting the following error trying to create a collection on ghostnet:

nft origination error {
"method": "GET",
"url": "https://rpc.ghostnet.teztnets.xyz/chains/main/blocks/head/context/constants",
"cause": {
"message": "request to https://rpc.ghostnet.teztnets.xyz/chains/main/blocks/head/context/constants failed, reason: getaddrinfo ENOTFOUND rpc.ghostnet.teztnets.xyz",
"type": "system",
"errno": "ENOTFOUND",
"code": "ENOTFOUND"
},
"name": "HttpRequestFailed",
"message": "GET https://rpc.ghostnet.teztnets.xyz/chains/main/blocks/head/context/constants FetchError: request to https://rpc.ghostnet.teztnets.xyz/chains/main/blocks/head/context/constants failed, reason: getaddrinfo ENOTFOUND rpc.ghostnet.teztnets.xyz"
}
GET https://rpc.ghostnet.teztnets.xyz/chains/main/blocks/head/context/constants FetchError: request to https://rpc.ghostnet.teztnets.xyz/chains/main/blocks/head/context/constants failed, reason: getaddrinfo ENOTFOUND rpc.ghostnet.teztnets.xyz

Error in readme

Hi,
The flag to validate the metadata should be --errors_only instead of --errors-only.
Located at this line.

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.