Implements SDK-v2

Apply for NodeJS

#Install SDK
yarn add
#Copy wasm binary to your root project:
cp node_modules/incognito-js/privacy.wasm .
//In your application ex : main.js
//Load SDK & Init object
const incognitoJs = require('incognito-js/build/node');
//Load WebAssembly:
await incognitoJs.goServices.implementGoMethodUseWasm();
// Implement storage

Apply for Browser

//Copy wasm binary to your root project:
//cp node_modules/incognito-js/privacy.wasm .
import * as incognitoJs from 'incognito-js';
// Load WebAssembly:
await incognitoJs.goServices.implementGoMethodUseWasm();
// Next implement storage.

Or import Javascript file to html

<script src="...incognito-js/build/web/browser/index.js"></script>
// Load WebAssembly:
await incognitoJs.goServices.implementGoMethodUseWasm();

With React-Native

Please use react-native-incognito-js for React Native.

Implements storage

incognitoJs need to cache some data into storage to work correctly like coin infomation, tx history,... So please implement incognitoJs storage service:

setMethod: (key: string, value: string) {
return new Promise((resolve, reject) => {
// store data to storage device, for example:
// localStorage on Browser
// AsyncStorage on React Native
if (error) {
getMethod: (key: string) {
return new Promise(() => {
// get data from device storage
removeMethod: (key: string) {
return new Promise(() => {
// remove data from device storage