GithubHelp home page GithubHelp logo

near-marketplace-contract's Introduction

near-marketplace-contract

Learning Points

  1. There are two types of function calls, view and change. Calls that are view will only read data from the blockchain, while calls that are change will write data to the blockchain and modify its state. Calls that are view are free, while we need to pay gas for change calls.

  2. We will create one account that we will use to interact with the smart contract, and another account that we will deploy the smart contract to. The second account will be a subaccount of the first account, and will look like a subdomain.

  3. https://dacade.org/communities/near/courses/near-101/learning-modules/b52ba9f1-caac-4339-96ed-fad3b1ab6bbd Commands

    near login
    
    near create-account ${SUBACCOUNT_ID}.${ACCOUNT_ID} --masterAccount ${ACCOUNT_ID} --initialBalance ${INITIAL_BALANCE}
    
    yarn asb  # compile
    
    near deploy --accountId=${ACCOUNT_ID} --wasmFile=${PATH_TO_WASM}  # ACCOUNT_ID=account for deployment, which is a subaccount.
    
    near call ${CONTRACT_ACCOUNT_ID} ${METHOD_NAME} ${PAYLOAD} --accountId=${ACCOUNT_ID}
    
    near view ${CONTRACT_ACCOUNT_ID} ${METHOD_NAME} ${PAYLOAD}
    
    near call mycontract.myaccount.testnet buyProduct '{"productId": "0"}' --depositYocto=1000000000000000000000000 --accountId=buyeraccount.myaccount.testnet

Barriers

  1. Unsupported platform whilst "yarn add -D near-sdk-as" https://docs.near.org/docs/faq/developer-faq#near-sdk-as

  2. sudo yarn add global near-cli will NOT make "near" work.

    sudo npm i -g near-cli will make "near" work

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.