Giter Site home page Giter Site logo

near-petshelter-contract's Introduction

Pet Shelter Contract

This repository includes NEAR smart contract written in Rust programming language. The smart contract allows to add pets, adopt pets and donate Near. UI repository for the project can be found here: https://github.com/vadkutsen/near-petshelter-ui

Step 0: Install near-cli

near-cli is a command line interface (CLI) for interacting with the NEAR blockchain. To install it globally:

yarn install --global near-cli

Or, if you'd rather use the locally-installed version, you can prefix all near commands with npx

Ensure that it's installed with near --version (or npx near --version)

Step 1: Create an account for the contract

Each account on NEAR can have at most one contract deployed to it. If you've already created an account such as your-name.testnet, you can deploy your contract to your-sub-account.your-name.testnet. Assuming you've already created an account on NEAR Wallet, here's how to create your-sub-account.your-name.testnet:

  1. Authorize NEAR CLI, following the commands it gives you:

    near login

  2. Create a subaccount (replace YOUR-NAME and YOUR-SUB-ACCOUNT below with your actual account name):

    near create-account YOUR-SUB-ACCOUNT.YOUR-NAME.testnet --masterAccount YOUR-NAME.testnet

Step 2: Make sure the contract works as expected - run tests

You can easily test the smart contract code using cargo:

cargo test

Step 3: Build the contract

Assuming that all the tests passed ok, you can go ahead and compile the smart contract:

cargo build --target wasm32-unknown-unknown --release

Step 4: Deploy!

For development purposes you can use dev-deploy command and your smart contract will be deployed to the live NEAR TestNet with a throwaway account:

near dev-deploy --wasmFile target/wasm32-unknown-unknown/release/YOUR_CONTRACT_NAME.wasm

When you're ready to make it permanent, here's how:

near deploy --wasmFile target/wasm32-unknown-unknown/release/YOUR_CONTRACT_NAME.wasm --accountId YOUR_ACCOUNT_HERE

near-petshelter-contract's People

Contributors

vadkutsen avatar

Watchers

 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.