Git Product home page Git Product logo

near-heritage's Introduction

Near-heritage: The spicy hello word

This repository includes a complete project structure for AssemblyScript contracts targeting the NEAR platform. This is an spicy "hello world" in assemblyscript for new developers.

The goal of this project is to have a smart contract where a user adds NEARs to the smart contract for a limit of time and having the restriction that only the selected wallet can unlock these NEARs.

The example here is very basic. It's a simple contract demonstrating the following concepts:

  • a single contract
  • basic usage of timestamps
  • basic contract storage
  • basic usage of VMContext in the unit tests

The goal of this repository is to make it as easy as possible to get started writing unit and simulation tests for AssemblyScript contracts built to work with NEAR Protocol.

Usage

Getting started

  1. clone this repo to a local folder
  2. run yarn
  3. run yarn test

Top-level yarn commands

  • run yarn test to run all tests
    • (!) be sure to run yarn build:release at least once before:
      • run yarn test:unit to run only unit tests
      • run yarn test:simulate to run only simulation tests
  • run yarn build to quickly verify build status
  • run yarn clean to clean up build folder

Other documentation

  • Sample contract and test documentation

    • see /src/heritage/README for contract interface
    • see /src/heritage/__tests__/README for Sample unit testing details
  • Sample contract simulation tests

    • see /simulation/README for simulation testing

The file system

Please note that boilerplate project configuration files have been ommitted from the following lists for simplicity.

Contracts and Unit Tests

src
├── heritage                        <-- heritage contract
│   ├── README.md
│   ├── __tests__
│   │   ├── README.md
│   │   └── index.unit.spec.ts
│   └── assembly
│       ├── index.ts
│       └── models.ts
└── utils.ts                      <-- shared contract code

Helper Scripts

scripts
├── 1.init.sh
├── 2.run.sh
└── README.md                     <-- instructions

near-heritage's People

Contributors

bld84 avatar

Watchers

 avatar

Forkers

learn-near

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.