Catalog npm
Back to packageRELEASE DETAILS

2.0.0

npm

@0bsnetwork/zbs-react

React native libarary for 0bsnetwork.

react-native
Published27 Nov 2019
Direct dependencies25
Transitive dependenciesNot calculated

README

Current package documentation

zbs-react

A React Native library for interacting with 0bsNetwork. Currently, the functions implemented allow you to do the following;

  • Generate Addres - This creates a new wallet for your user, and returns an Address, and a Seed Phrase. You should store the seed phrase in your app (Encrypted, for production), so you can use it for future transactions. The address is the bit you give to the user!

  • SaveData - This creates a transaction that saves data to the blockchain. You can use this to save a json object to the blockchain. In return, you get a transaction ID that you can use to see the data once its on the blockchain at https://explorer.0bsnetwork.com by searching the transaction ID. You can also use that URL as a permalink, take a look at the URL format, should you need to link to this from your app to prove the data is saved.

  • sendTokens - This method allows you to transfer ZBS coin, or another token (Given an assetId) to another address, given a seed (Thus a private key).

  • generateDocumentHash - This creates a document hash for a file uploaded, however its currently only implemented in Android, and is experimental.

Getting started

$ npm install 0bsnetwork/zbs-react --save

Mostly automatic installation

$ react-native link 0bsnetwork/zbs-react

For Android, Add below code in your app gradle file


android {
	defaultConfig {
		multiDexEnabled true
	}
}

IMPORTANT: when using `generateDocumentHash` function it's necessary to pass absolute file path and request permissions (on Android) to read on the external storage, here an example: [React Native Offical Doc] (https://facebook.github.io/react-native/docs/permissionsandroid)

Usage

GenerateAddress

import RN0bsnetwork from "zbs-react";

const response = await RN0bsnetwork.generateAddress();
      var responseData = JSON.parse(response);
      this.setState({ seed: responseData.seed, address: responseData.address });


saveData

import RN0bsnetwork from "zbs-react";

let dataArray = [
	  {
        "type": "integer",
        "key": "integerVal",
        "value": 1
      },
      {
        "type": "boolean",
        "key": "booleanVal",
        "value": true
      },
      {
        "type": "string",
        "key": "stringVal",
        "value": "hello"
      }
]

let transfer = {data: dataArray, SEED_DATA: 'my long seed phrase ', NODE_URL: 'https://node1.testnet-0bsnetwork.com', assetId: '47dNzPs4KPFZchaahiDCLwsPSMsPDgy9CXfnutieHxMc'}

const transactionLog = await RN0bsnetwork.makeTransfer(transfer);

console.log(transactionLog);


sendTokens

import RN0bsnetwork from "zbs-react";

let transfer = {amount: 50, recipient:'3NBvF4xAGXJyrJNyS8B1yjrpBRdyT53MD6L', SEED_DATA: 'my long seed phrase ', NODE_URL: 'https://node1.testnet-0bsnetwork.com', assetId: '47dNzPs4KPFZchaahiDCLwsPSMsPDgy9CXfnutieHxMc'}

// Note: Exclude assetId to send ZBS.

const transactionLog = await RN0bsnetwork.makeTransfer(transfer);

console.log(transactionLog);

For all issues, questions or suggestions, raise an issue or message @justJamesDev on Telegram or raise a PR, All contributions welcome!

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 25

Native requirements
25 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@waves/marshall
Environment
{
  "local_name": "@waves/marshall",
  "alias": false,
  "peer_metadata": null
}
^0.6.0runtime
@waves/ts-lib-crypto
Environment
{
  "local_name": "@waves/ts-lib-crypto",
  "alias": false,
  "peer_metadata": null
}
^1.1.1runtime
ajv
Environment
{
  "local_name": "ajv",
  "alias": false,
  "peer_metadata": null
}
^6.5.5runtime
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^0.18.0runtime
@types/axios
Environment
{
  "local_name": "@types/axios",
  "alias": false,
  "peer_metadata": null
}
^0.14.0development
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^23.3.9development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^10.12.3development
copy-webpack-plugin
Environment
{
  "local_name": "copy-webpack-plugin",
  "alias": false,
  "peer_metadata": null
}
^4.5.2development
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
^23.6.0development
jsdoc-to-markdown
Environment
{
  "local_name": "jsdoc-to-markdown",
  "alias": false,
  "peer_metadata": null
}
^4.0.1development
nativescript-typedoc-theme
Environment
{
  "local_name": "nativescript-typedoc-theme",
  "alias": false,
  "peer_metadata": null
}
0.0.7development
ncp
Environment
{
  "local_name": "ncp",
  "alias": false,
  "peer_metadata": null
}
^2.0.0development
preprocess
Environment
{
  "local_name": "preprocess",
  "alias": false,
  "peer_metadata": null
}
^3.1.0development
rimraf
Environment
{
  "local_name": "rimraf",
  "alias": false,
  "peer_metadata": null
}
^2.6.2development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^23.10.4development
ts-jsdoc
Environment
{
  "local_name": "ts-jsdoc",
  "alias": false,
  "peer_metadata": null
}
^3.0.1development
ts-loader
Environment
{
  "local_name": "ts-loader",
  "alias": false,
  "peer_metadata": null
}
^5.1.0development
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
^7.0.1development
typedoc
Environment
{
  "local_name": "typedoc",
  "alias": false,
  "peer_metadata": null
}
^0.13.0development
typedoc-clarity-theme
Environment
{
  "local_name": "typedoc-clarity-theme",
  "alias": false,
  "peer_metadata": null
}
^1.1.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^3.2.2development
typescript-json-schema
Environment
{
  "local_name": "typescript-json-schema",
  "alias": false,
  "peer_metadata": null
}
^0.33.0development
webpack
Environment
{
  "local_name": "webpack",
  "alias": false,
  "peer_metadata": null
}
^4.17.2development
webpack-cli
Environment
{
  "local_name": "webpack-cli",
  "alias": false,
  "peer_metadata": null
}
^3.1.0development
react-native
Environment
{
  "local_name": "react-native",
  "alias": false,
  "peer_metadata": null
}
^0.59.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-j/khh6gILoxF0MYcvaxRBPGFuO/FaR5DnHVEJ+xt/qL1QvLKzpbqMTsyh83VRZfSC1WlyyjpPwO9gG3pJNOPcQ==",
  "shasum": "1eae217e291ec955f6a1922d10aa9e57f673909e",
  "tarball": "https://registry.npmjs.org/@0bsnetwork/zbs-react/-/zbs-react-2.0.0.tgz",
  "fileCount": 129,
  "unpackedSize": 444821,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd3pLTCRA9TVsSAnZWagAAMHYP/izzZmvkByMMZtVoDh83\ni+qLc0pati6M0ZHYrRcGo5ms9ZjQb4VgZfW9mxFRQLK/mrmRqB8LCeAZcfbw\nx7xyLsnvxup9gW3szEiE/koiY+CCKUkHq6kLOW++TOMR7PIsoiFeyickbmR5\nrwcBeU0+sJN492cm9EQa1YVh1CwYGRrtjFIDkPm058fZULGaPjKZzJi0mk+C\ntndkfBpMmaxfkS68HzTBek9eJ9hYSUW/0ds9KzCzdMQ3soHBYyMkLwCdDZ1y\nUJSdO3an3H6KtZhly1GiV2FPP44mIaMoNIq0Lz5P/DD65PghdiDh9XyvEPWd\nafw15bXn91+Mtrb3Oe21LOMtLLpn+aiL6sbTeGvZ/OGJk6/IhpDi7pPB4Znp\nn7yXXFvhb6Ui7sPiuh5FxFap0KIpNrYjaZzc/p8z1jWA6RvK9CGgobeSPMxV\nw+1IWsv1F3Mk0w4QQQR1o0y3OdFXpGTKjA0+jTQ3Q9/cTRVQj27JXBaW5Hn6\nlXWNx5eaLky3LF1PK63nWlVRBq/Q+PF6s+m0yTdFthf0UEu67+uwvm4/TL0j\nzYhWxNpClNebGpgCDqMAL9Is7d7p6SA2GTAbqFqz9WBSdgzFOfoy3B0En+jG\nqUu3WL/lRTHq+VYk7DkGapOoj7zFlTE28niZ46R511jR875+Ea+PO0A3av+q\nPTac\r\n=sm5R\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIHk4I0s7qSTuieRFDmg6VwaixktKnsMRkOHZLZAqkvp/AiEA8MsHk4BIsjA4TaNRWjD8tekbzgZb32BAUOKex85xJuE="
    }
  ]
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:05 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:08dc44b97afc4d5f3e2927abd3cf6cd4a21ef5c64bb7c5ec75b15d335c9bf8fa

Other collected versions

View all collected versions →