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

@helium/react-native-sdk

v3.0.5

Published

Helium React Native SDK

Downloads

402

Readme

Helium React Native SDK

The Helium React Native SDK is a collection of modules that can be used by a React Native application to interact with Hotspots and the Helium Blockchain. It has first class support for Typescript.

For usage, refer to the Helium Maker Starter App which utilizes this SDK to build out the base features needed to add Hotspots to the Helium Blockchain.

Along with this you may find the following Helium documentation useful:

Installation

yarn add @helium/react-native-sdk
# or
npm install @helium/react-native-sdk

Usage

Please browse the documentation for more information.

You can import the different modules such as Account, Location, HotspotBleManager, heliumHttpClient, and AddGateway to get started.

import { Account, Location, AddGateway } from '@helium/react-native-sdk';

// example usage of Account.createKeypair
const { keypairRaw, address, mnemonic } = await Account.createKeypair();

Example App

There is an example app included with this SDK. It's intended for reference only and currently does not build on the Apple M1 processor. A practical use of this SDK can be seen here Helium Maker Starter App

Using Bluetooth

Use the {@link HotspotBleManager} to interact with a Hotspot via bluetooth.

Import the Bluetooth modules

import { HotspotBleProvider, useHotspotBle } from '@helium/react-native-sdk';

// some examples of the functions you may want to use
const { startScan, stopScan, connect, scannedDevices } = useHotspotBle();

Getting Started with Bluetooth

In order to get started with the {@link HotspotBleManager} you must first wrap your root app component in a {@link HotspotBleProvider}.

For example:

import React from 'react';
import { HotspotBleProvider } from '@helium/react-native-sdk';

const App = () => (
  <HotspotBleProvider>
    <YourRootAppComponent />
  </HotspotBleProvider>
);

You are now ready to use the {@link HotspotBleManager} throughout your application.

Scanning for Hotspots

You can use the {@link HotspotBleManager} to {@link startScan}, {@link stopScan}, and read information from {@link scannedDevices}. Check out the {@link Device} docs for more info on scanned devices.

For a full working example see the example app.

import React, { useEffect } from 'react';
import { useHotspotBle } from '@helium/react-native-sdk';

const { startScan, stopScan, scannedDevices } = useHotspotBle();

useEffect(() => {
  // you would probably want to call this on a button click, we scan right away
  startScan((error) => {
    if (error) {
      console.error(error);
    }
  });
}, []);

useEffect(() => {
  // you would probably want to call this on a button click, but we stop after 10 seconds
  setTimeout(stopScan, 10000);
}, []);

const ScanComponent = () => <Text>{scannedDevices[0]?.localName}</Text>;

Connect to a Hotspot

After scanning, you can connect to {@link scannedDevices} by calling {@link connect}.

import { useHotspotBle } from '@helium/react-native-sdk';

const { connect, scannedDevices } = useHotspotBle();
connect(scannedDevices[0]);

Interact with a connected Hotspot

Once {@link connect} has been called you can use the other {@link HotspotBleManager} to interact with a connected {@link Device}. For example, you may want to call {@link getDiagnosticInfo} to read the hotspot's diagnostic information or {@link readWifiNetworks} to display available wifi networks the hotspot can see and then {@link setWifi} to set a network.

Visit the example app for full examples of Wifi Setup, WifiSettings, or Diagnostics.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

Apache License 2.0