Coder Social home page Coder Social logo

non-fungible-token-near-ts's Introduction

Table Of Content

near-login

near login
Please authorize NEAR CLI on at least one of your accounts.

If your browser doesn't automatically open, please visit this URL
https://wallet.testnet.near.org/login/?referrer=NEAR+CLI&public_key=ed25519%3A3smuY1MmEDfZNNCvgXbciUCgUFhf7h7QNhPxWu46Cvpn&success_url=http%3A%2F%2F127.0.0.1%3A5001
Please authorize at least one account at the URL above.

Which account did you authorize for use with NEAR CLI?
Enter it here (if not redirected automatically):
Logged in as [ vugomarscourse.testnet ] with public key [ ed25519:3smuY1... ] successfully

create-account sub account

near create-account nftk10.vugomarscourse.testnet --masterAccount vugomarscourse.testnet --initialBalance 20

create-account help

near create-account --help
near create-account <accountId>

create a new developer account (subaccount of the masterAccount, ex: app.alice.test)

Options:
      --help                     Show help  [boolean]
      --version                  Show version number  [boolean]
      --nodeUrl, --node_url      NEAR node URL  [string] [default: "https://rpc.testnet.near.org"]
      --networkId, --network_id  NEAR network ID, allows using different keys based on network  [string] [default: "testnet"]
      --helperUrl                NEAR contract helper URL  [string]
      --keyPath                  Path to master account key  [string]
      --accountId, --account_id  Unique identifier for the newly created account  [string] [required]
      --useLedgerKey             Use Ledger for signing with given HD key path  [string] [default: "44'/397'/0'/0'/1'"]
      --seedPhrase               Seed phrase mnemonic  [string]
      --seedPath                 HD path derivation  [string] [default: "m/44'/397'/0'"]
      --walletUrl                Website for NEAR Wallet  [string]
      --contractName             Account name of contract  [string]
      --masterAccount            Account used to create requested account.  [string] [required]
      --helperAccount            Expected top-level account for a network  [string]
  -v, --verbose                  Prints out verbose output  [boolean] [default: false]
  -f, --force                    Forcefully execute the desired action even if it is unsafe to do so  [boolean] [default: false]
      --publicKey                Public key to initialize the account with  [string]
      --newLedgerKey             HD key path to use with Ledger. Used to generate public key if not specified directly  [string] [default: "44'/397'/0'/0'/1'"]
      --initialBalance           Number of tokens to transfer to newly created account  [string] [default: "100"]

build:contract

pnpm run build:contract
Executing wasi-stub...
node_modules/near-sdk-js/cli/deps/binaryen/wasi-stub/run.sh build/hello_near.wasm >/dev/null

deploy first time

near deploy nftk10.vugomarscourse.testnet --wasmFile contract/build/hello_near.wasm --initFunction init --initArgs '{"owner_id" : "vugomarscourse.testnet"}'
Starting deployment. Account id: nftk10.vugomarscourse.testnet, node: https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: contract/build/hello_near.wasm
Transaction Id CHLUfHzx79Wd2geG76ffiEnNiHy6cuq8i1GURfX4H7vR
To see the transaction in the transaction explorer, please open this url in your browser

https://explorer.testnet.near.org/transactions/CHLUfHzx79Wd2geG76ffiEnNiHy6cuq8i1GURfX4H7vR

Done deploying and initializing nftk10.vugomarscourse.testnet

deploy

near deploy nftk10.vugomarscourse.testnet --wasmFile contract/build/hello_near.wasm
This account already has a deployed contract [ EmqF1cd3pgiQYzZYRUrfurhsPeTGzhHTvdk4UdEWhXnV ]. Do you want to proceed? (y/n) y
Starting deployment. Account id: nftk10.vugomarscourse.testnet, node: https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: contract/build/hello_near.wasm
Transaction Id Fm8baiWRh7kGWhwWAoCx8D5rPDux6KZMx4TB9gFUXidz
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/Fm8baiWRh7kGWhwWAoCx8D5rPDux6KZMx4TB9gFUXidz
Done deploying to nftk10.vugomarscourse.testnet
near view nftk10.vugomarscourse.testnet nft_metadata

nft_total_supply

near view nftk10.vugomarscourse.testnet nft_total_supply
View call: nftk10.vugomarscourse.testnet.nft_total_supply()
1

nft_mint

near call nftk10.vugomarscourse.testnet nft_mint '{"token_id": "token-03", "receiver_id": "vugomarscourse.testnet", "metadata": {"title": "NFT token 01", "description": "hello there this is nft token 01", "media": "https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link"}}' --accountId vugomarscourse.testnet

Scheduling a call: nftk10.vugomarscourse.testnet.nft_mint({"token_id": "token-03", "receiver_id": "vugomarscourse.testnet", "metadata": {"title": "NFT token 01", "description": "hello there this is nft token 01", "media": "https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link"}})
Doing account.functionCall()
Receipt: 9qM25U49P1oKpVdXmqkPEfDdEVSRpvZrZPfRnJEsfo6D
  Log [nftk10.vugomarscourse.testnet]: EVENT_LOG:{"standard":"nep171","version":"nft-1.0.0","event":"nft_mint","data":[{"owner_id":"vugomarscourse.testnet","token_ids":["token-03"]}]}
Transaction Id DF1geUgU8tqovaWyz3xbQCEAEfJsCxqe7iXTbyX7r2yU
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/DF1geUgU8tqovaWyz3xbQCEAEfJsCxqe7iXTbyX7r2yU
''

nft_token

near view nftk10.vugomarscourse.testnet nft_token '{"token_id": "token-01"}'
View call: nftk10.vugomarscourse.testnet.nft_token({"token_id": "token-01"})
{
  token_id: 'token-01',
  owner_id: 'vugomarscourse.testnet',
  metadata: {
    title: 'NFT token 01',
    description: 'hello there this is nft token 01',
    media: 'https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link'
  }
}

nft_tokens

near view nftk10.vugomarscourse.testnet nft_tokens
View call: nftk10.vugomarscourse.testnet.nft_tokens()
[
  {
    token_id: 'token-01',
    owner_id: 'vugomarscourse.testnet',
    metadata: {
      title: 'NFT token 01',
      description: 'hello there this is nft token 01',
      media: 'https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link'
    }
  },
  {
    token_id: 'token-02',
    owner_id: 'vugomarscourse.testnet',
    metadata: {
      title: 'NFT token 01',
      description: 'hello there this is nft token 01',
      media: 'https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link'
    }
  },
  {
    token_id: 'token-03',
    owner_id: 'vugomarscourse.testnet',
    metadata: {
      title: 'NFT token 01',
      description: 'hello there this is nft token 01',
      media: 'https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link'
    }
  }
]

nft_tokens_for_owner

near view nftk10.vugomarscourse.testnet nft_tokens_for_owner '{"owner_id": "vugomarscourse.testnet"}'
View call: nftk10.vugomarscourse.testnet.nft_tokens_for_owner({"owner_id": "vugomarscourse.testnet"})
[
  {
    token_id: 'token-01',
    owner_id: 'vugomarscourse.testnet',
    metadata: {
      title: 'NFT token 01',
      description: 'hello there this is nft token 01',
      media: 'https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link'
    }
  },
  {
    token_id: 'token-02',
    owner_id: 'vugomarscourse.testnet',
    metadata: {
      title: 'NFT token 01',
      description: 'hello there this is nft token 01',
      media: 'https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link'
    }
  },
  {
    token_id: 'token-03',
    owner_id: 'vugomarscourse.testnet',
    metadata: {
      title: 'NFT token 01',
      description: 'hello there this is nft token 01',
      media: 'https://bafybeihwe2nq3pimzra4n2oydvwbeubmccbb4g6urwmerwfurelyqt4lvi.ipfs.nftstorage.link'
    }
  }
]

non-fungible-token-near-ts's People

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.