npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@0bsnetwork/zbs-react

v2.0.0

Published

React native libarary for 0bsnetwork.

Downloads

5

Readme

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!