Git Product home page Git Product logo

onboarding-sdk's Introduction

Onboarding SDK ⚡

SDK from CypherWallet for DAPP Developers to easliy onboard thier new users with necessary tokens

Getting Started

To Integrate

Web

Inject the CypherWallet Signon-SDK from the CDN link https://public.cypherd.io/js/onboardingsdk.js

<script src="https://public.cypherd.io/js/onboardingsdk.jss"> </script>
window.Cypher({
  address: '0xdEc1bc71bf91431D60eF2742f412DCd1c5A204B8', // user wallet address
  targetChainIdHex: '0x5', // Required: Chain Id in Hexadecimal
  requiredTokenBalance: 1, // Required: Token Value Required with respect to native currency or token value
  isTestnet: true, // Optional: enable testnet for developer testing
  callBack: (success) => { // Optional
    if(){
      console.log('User wallet has a necessary token or currency');
    }else{
      console.log('Failed to load user wallet necessary token or currency');
    }
  } //
});

Detailed documentation available at https://developer.cypherwallet.io/

Npm (In Progress)

  1. Install the singon-sdk npm i -S @cypher
  2. Import the Cypher into Code

To Contribute

# Install dependencies
npm install

# Now you can run various yarn commands:
npm run cli
npm run lint
npm run test
npm run build-all
npm run ts-node <filename>
npm run esbuild-browser
...
  • For publishing to npm, use npm publish

esbuild

esbuild is an extremely fast bundler that supports a large part of the TypeScript syntax. This project uses it to bundle for browsers (and Node.js if you want).

# Build for browsers
yarn esbuild-browser:dev
yarn esbuild-browser:watch

# Build the cli for node
yarn esbuild-node:dev
yarn esbuild-node:watch

You can generate a full clean build with npm run build-all (which uses both tsc and esbuild).

  • package.json includes scripts for various esbuild commands

  • esbuild has a --global-name=xyz flag, to store the exports from the entry point in a global variable. See also the esbuild "Global name" docs.

  • esbuild for the browser uses the IIFE (immediately-invoked function expression) format, which executes the bundled code on load (see also evanw/esbuild#29)

Tests with Jest

You can write Jest tests

import { greet } from './main'

test('the data is peanut butter', () => {
  expect(1).toBe(1)
});

test('greeting', () => {
  expect(greet('Foo')).toBe('Hello Foo')
});

Run the tests with yarn test, no separate compile step is necessary.

  • See also the Jest documentation.
  • The tests can be automatically run in CI (GitHub Actions, GitLab CI): [.github/workflows/lint-and-test.yml], [.gitlab-ci.yml]
  • Take a look at other modern test runners such as ava, uvu and tape

Documentation, published with CI

You can auto-generate API documentation from the TypeScript source files using TypeDoc. The generated documentation can be published to GitHub / GitLab pages through the CI.

Generate the documentation, using src/main.ts as entrypoint (configured in package.json):

yarn docs

The resulting HTML is saved in docs/.

You can publish the documentation through CI:

References

Feedback

onboarding-sdk's People

Contributors

mohanramcypherd avatar shan-c avatar kubecypherd avatar cysedhu avatar rixhy-cyd avatar germanier avatar dependabot[bot] avatar raks-cypherd 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.