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

@kiroboio/web3-react-native-safe-transfer

v1.0.0

Published

Safe Transfer & Swap React Component for React Native apps

Downloads

4

Readme

@kiroboio/web3-react-native-safe-transfer

Example

Docs

Install

To install react-native versions of node packages needed for web3 and @kiroboio/safe-transfer-lib libs use rn-nodeify

rn-nodeify

rn-nodeify for web3 tutorial

npm i -D rn-nodeify
npm i --save react-native-crypto react-native-randombytes react-native-event-listeners react-native-securerandom react-native-sync-localstorage @kiroboio/web3-react-native-safe-transfer
npx react-native link react-native-randombytes
npm i --save-dev rn-nodeify@latest
./node_modules/.bin/rn-nodeify --install
npm i --save node-libs-browser
npm i base-64

IOS

cd ios/ && pod install && cd ..

XCode > Pods > react-native-udp > Build Phases > remove the GCDAsyncSocket.m reference

Modify metro.config

// metro.config.js

const extraNodeModules = require('node-libs-browser');
module.exports = {
  resolver: {
    extraNodeModules,
  },
  transformer: {
    getTransformOptions: async () => ({
    transform: {
      experimentalImportSupport: false,
      inlineRequires: false,
    },
   }),
  },
};

Modify shim

// shim.js

import { decode, encode } from 'base-64';
import localStorage from 'react-native-sync-localstorage';
import { EventRegister } from 'react-native-event-listeners'

const initialize = async () => {

  global.addEventListener = EventRegister.addEventListener;
  global.removeEventListener = EventRegister.removeEventListener;
  global.navigator.userAgent = 'ReactNative'

  await localStorage.getAllFromLocalStorage();
  global.localStorage = localStorage;
  global.sessionStorage = {
    _data: {},
    setItem: function (id, val) {
      return (this._data[id] = String(val));
    },
    getItem: function (id) {
      return Object.prototype.hasOwnProperty.call(this._data, 'id')
        ? this._data[id]
        : undefined;
    },
    removeItem: function (id) {
      return delete this._data[id];
    },
    clear: function () {
      return (this._data = {});
    },
  };

  global.DOMException = require('domexception');
}


if (!global.btoa) global.btoa = encode;
if (!global.atob) global.atob = decode;
if (typeof __dirname === 'undefined') global.__dirname = '/';
if (typeof __filename === 'undefined') global.__filename = '';
if (typeof process === 'undefined') {
  global.process = require('process');
} else {
  const bProcess = require('process');
  for (var p in bProcess) {
    if (!(p in process)) {
      process[p] = bProcess[p];
    }
  }
}
process.browser = false;
if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer;
if (typeof location === 'undefined')
  global.location = { port: 80, protocol: 'https:' };
const isDev = typeof __DEV__ === 'boolean' && __DEV__;
process.env['NODE_ENV'] = isDev ? 'development' : 'production';
if (typeof localStorage !== 'undefined') {
  localStorage.debug = isDev ? '*' : '';
}

require('crypto');
initialize();

import shim in your App root component

import './shim'

You can use @kiroboio/web3-react-native-safe-transfer library now

docs