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

gas-station

v0.0.1

Published

A mobile wallet manager for blockchain apps.

Downloads

4

Readme

⛽️ Gas Station

Gas Station is a library for React Native apps to easily connect to the Ethereum network and complete transactions.

Description

Gas Station is a React Native library allowing you to build dApps (Decentralized Applications) which transform your mobile device into a light client node on the Ethereum Network and enables you to easily access Ethereum’s entire ecosystem, including interacting with Smart Contracts, make payment, and more.

Project status

We just got started. This is what the project timeline looks like:

  • May 20th: have react-native-geth up and running for iOS.
  • June 10th: finished basic UI for creating a wallet, getting funds, and approving transactions.
  • June 20th: finish interface and API for connecting with other apps to share wallets between apps.
  • July 1st: added Android support.
  • July 10th: first stable release for iOS and Android.

Supported platforms

  • iOS
  • Android support coming soon

Installation

Using NPM:

npm i gas-station
react-native link gas-station

Using Yarn:

yarn add gas-station
react-native link gas-station

Compatibility

Due to the rapid changes being made in the React Native ecosystem, we are not officially going to support this module on anything but the latest version of React Native. With that said, we will do our best to stay compatible with older versions as much that is practical, and the peer dependency of this requirement is set to "react-native": "*" explicitly for this reason. If you are using an older version of React Native with this module though, some features may be buggy.

Usage example

import { Alert } from 'react-native'
import GasStation from 'gas-station'
 
// Do this as soon as you need access to the Ethereum network
// Note that this will bring up a UI the first time it is called!
GasStation.requestUserLogin()
	.then(async (eth) => {
		// We now have access to the ethereum blockcahin
		const addresses = await eth.getAccounts()
		Alert.alert('Your wallet address', addresses[0])
	})
	.catch((e) => {
		// Node couldn't start or user cancelled login
	})

API documentation

All API methods below are asynchronous and return Promise instances.

getAccounts

Returns Array denoting the addresses of all wallets that the user has created or has given the current app access to.

getAddress

Retrieves the address associated with the user's default account.

Returns String with wallet address.

getBalanceAccount

Returns the wei balance of the current account.

Returns String balance.

getBalance

Returns the wei balance of the specified account.

Parameters

  • address String Address of account being looked up.

Returns String balance.

syncProgress

Retrieves the current progress of the sync algorithm.

Returns Object Return object sync progress or null

subscribeNewHead

Subscribes to notifications about the current blockchain head.

Returns Boolean – true if subscribed.

showAccounts

Brings up a modal window where the user can manage their accounts.

showTopUp

Brings up a modal window where the user can add Ethereum to their primary account, either by copying their address, viewing their wallet's QR code, or by opening the Coinbase app and starting a transaction to their wallet's address.

sendTransaction

Create and send a transaction. The user will see a modal window and will have to agree to sending the transaction.

Parameters

  • toAddress String Address destination
  • amount Number Amount
  • gasLimit Number Gas limit (optional, automatically set if left empty)
  • gasPrice Number Gas price (optional, automatically set if left empty)
  • data Number

Returns String – transaction HEX identifier

getSuggestedGasPrice

Retrieves the currently suggested gas price to allow a timely execution of a transaction.

Returns Double – suggested gas price

getPendingNonce

Retrieves this account's pending nonce. This is the nonce you should use when creating a transaction.

Returns Double – nonce