Giter Club home page Giter Club logo

starter-kit's Introduction

starter-kit

The NP starter kit describes how to launch a NP RApp in minutes. Quickstart assumes that the local development environment for Reach has been setup.

quickstart

commands

git clone [email protected]:nash-protocol/starter-kit.git 
cd starter-kit 
source np.sh 
np

output

{"info":66944916}

how does it work

NP provides a nonintrusive wrapper allowing apps to be configurable before deployment and created on the fly without incurring global storage.
Connect to the constructor and receive an app id.
Activate the app by paying for deployment and storage cost. After activation, your RApp takes control.

how to activate my app

In your the frontend of your NPR included Contractee participation. Currently, a placeholder fee is required for activation. Later an appropriate fee amount will be used.

ctc = acc.contract(backend, id)
backend.Contractee(ctc, {})

templates

Templates improve the developer and user experience by pre-opting into assets before the first message by the contract manager.

Each template behaves more or less the same at this point with exception of earlier templates. The difference is the number of assets that are opted in before reaching the main program.

atom - 0 assets
hydrogen - 1 asset ...

Simply update the .env file and index.rsh to switch templates.

common

index

import { useConstructor } from '@nash-protocol/starter-kit#<tag>:util.rsh'
import { Participants as AppParticipants,Views, Api, App, Event } from 'interface.rsh'
export const main = Reach.App(() => 
  App(useConstructor(AppParticipants, Views, Api, Event)));

interface

export const Participants = () => [];
export const Views = () => [];
export const Api = () => [];
export const Event = () => [];
export const App = (_) => {
  Anybody.publish();
  commit();
  exit();
};

.env

export REACH_VERSION=<version number or hash>
API_ENDPOINT_TESTNET=<launcher endpoint>
TEMPLATE_NAME=<template name>
ZB_AUTH_TOKEN=<api key>

main program head

The main program should look like this to get started

export const App = (map) => {
  const [
    { amt, ttl }, // activation cost, time to live
    [addr, _], // constructors
    [Manager, Relay], // your participants
    [v], // your views
    [a], // your apis
    [e], // your events
  ] = map;

If not using map then this works

export const App = (_) => {

The first participants message SHOULD receive payment in amt from Manager. amt SHOULD be transfered to addr to compensate the constuctor for deployment cost and associated min balance changes. Payment of activation fee ensures sustainable use of launcher service.

  Manager.publish(max, tokenAmount)
    // checks
    .pay([amt])
    .timeout(relativeTime(ttl), () => {
      Anybody.publish();
      commit();
      exit();
    });
  transfer(amt).to(addr);

atom

Template with no asset pre-optin

atom-v0.1.10r1

index
import { useConstructor } from '@nash-protocol/starter-kit#atom-v0.1.10r1:util.rsh'
import { Participants as AppParticipants,Views, Api, App } from 'interface.rsh'
export const main = Reach.App(() => 
  App(useConstructor(AppParticipants, Views, Api)));
.env
export REACH_VERSION=27cb9643 # v0.1.11-rc.7
API_ENDPOINT_TESTNET="https://launcher.testnet.zestbloom.com"
TEMPLATE_NAME="atom"
ZB_AUTH_TOKEN=

hydrogen

Template with 1 asset pre-optin

helium

Template with 2 asset pre-optin

lithium

Template with 3 asset pre-optin

carbon

Template with 6 asset pre-optin

terms

  • NP - Nash Protocol
  • RAap - Reach App
  • NPR - NP Reach App
  • Activation - Hand off between constructor and contractee require fee to pay for deployment and storage cost incurred by constructor

dependencies

  • Reach development environment (reach compiler)
  • sed - stream editor
  • grep - pattern matching
  • curl - request remote resource

starter-kit's People

Contributors

temptemp3 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.