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

@cruxpay/rn-sdk

v0.0.4

Published

CruxPay React Native SDK

Downloads

2

Readme

Using bundled version in React Native

After installing @cruxpay/rn-sdk, you will need to

  1. Install and link react-native-get-random-values which works as a polyfill for the global crypto.getRandomValues
  2. Next, you will have to install and link @react-native-community/async-storage so that you can use the RNLocalStorage implementation of storage.StorageService as shown below.
// RNLocalStorage.js
import { CruxPay } from "@cruxpay/rn-sdk/dist/cruxpay-sdk-rn";
import AsyncStorage from "@react-native-community/async-storage";
class RNLocalStorage extends CruxPay.storage.StorageService {
    setItem = async (key, value) => AsyncStorage.setItem(key, value);
    getItem = async (key) => AsyncStorage.getItem(key);
}
export {RNLocalStorage};
  1. You can then use the sdk by providing an instance of RNLocalStorage as storage option and importing react-native-get-random-values before importing dist/cruxpay-sdk-rn.js (the bundled version of installed sdk)
import 'react-native-get-random-values';  // NOTE: necessary to imported first so that it can polyfill global crypto.getRandomValues
import {CruxPay} from "@cruxpay/rn-sdk/dist/cruxpay-sdk-rn";  // NOTE: this is from dist folder
import {RNLocalStorage} from "./RNLocalStorage";
const storage = new RNLocalStorage();
let cruxClientOptions = {
  getEncryptionKey: () => 'fookey',
  walletClientName: 'cruxdev',
  storage: storage
}
const cruxClient = new CruxPay.CruxClient(cruxClientOptions);
cruxClient.init().then(() => {
    console.log('CruxClient initialized');
}).catch((err) => {
    console.log('CruxClient error', err);
})

Using bundled version in React Native

After installing @cruxpay/rn-sdk, you will need to

  1. Install rn-nodeify which allows you to use node builtins in React Native.
npm install --save-dev rn-nodefiy
  1. Hack the specific builtins required via:
./node_modules/.bin/rn-nodeify --install "process,path,crypto,assert,stream,events,url,vm" —hack @cruxpay/rn-sdk
  1. Next, you will have to install and link @react-native-community/async-storage so that you can use the RNLocalStorage implementation of storage.StorageService as shown below.
npm install --save @react-native-community/async-storage
react-native link @react-native-community/async-storage
// RNLocalStorage.js
import { CruxPay } from "@cruxpay/rn-sdk";
import AsyncStorage from "@react-native-community/async-storage";
class RNLocalStorage extends CruxPay.storage.StorageService {
    setItem = async (key, value) => AsyncStorage.setItem(key, value);
    getItem = async (key) => AsyncStorage.getItem(key);
}
export {RNLocalStorage};
  1. You can then use the sdk by providing an instance of RNLocalStorage as storage option and importing shim.js before importing @cruxpay/rn-sdk
import './shim.js';  // NOTE: necessary to imported first so that it can polyfill the node builtins
import {CruxPay} from "@cruxpay/rn-sdk";
import {RNLocalStorage} from "./RNLocalStorage";
let cruxClientOptions = {
  getEncryptionKey: () => 'fookey',
  walletClientName: 'cruxdev',
  storage: new RNLocalStorage()
}
const cruxClient = new CruxPay.CruxClient(cruxClientOptions);
cruxClient.init().then(() => {
    console.log('CruxClient initialized');
}).catch((err) => {
    console.log('CruxClient error', err);
})

Refer to the documentation at @cruxprotocol/js-sdk