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

happychain

v3.3.8

Published

HappyChain is a payment api for Ethereum applications. The missing blockchain API for Ethereum http://happycha.in

Downloads

14

Readme

Getting started with HappyChain NPM module

npm module for HappyChain

Installation

Install and save happychain from npm.

npm install --save happychain

Then require it in your js file

var happychain = require('happychain');

HappyChain API functions Reference

HappyChain.getKey()

Inputs: email, password Outputs: key, secret

Retrieves your key and secret if you already have an account. If you dont have an account, creates a new one and returns a key/secret. Outputs get returned into a callback.

Note: We dont reccomend putting in a real password, auth details aren't being encrypted until they hit our api, do so at your own peril.

Usage:

var email = '[email protected]';
var password = 'Adminadmin2017!';

happychain.getKey(email, password, function(auth_details) {
  var key = auth_details.key;
  var secret = auth_details.secret;

  console.log('client: happyPay.getKey()');
  console.log('email = '+email);
  console.log('key = '+key);
  console.log('secret = '+secret);
})

HappyChain.newToken()

Inputs: Outputs: token object

Generates an empty token object to be filled out into a callback. You can console.log() it to find out what the possible data fields are. You should call this on your client side and fill out the data fields there so that no credit card info touches your servers.

HappyChain.tokenize()

Inputs: key, secret, token Outputs: updated token object

Sends the card info to happychain servers and returns a token in a callback. The token is a redacted version of the information which is saveable on your servers without violating PCI compliancy. Like above, call only from the client side to make sure credit card info never touches your servers.

HappyChain.chargeCard()

Inputs: key, secret, token, amount Outputs: receipt

Actually charges the card. The tokenization and charge process are separated to facilitate recurring payments or a second attempt at a payment if the payment fails. Returns a receipt object in the callback. For now, the receipt object only has a success field.

HappyChain.chargeEth() [COMING SOON]

Inputs: key, secret, to, from, from_key, amount Outputs: 1st callback(transaction hash), 2nd callback(transaction receipt)

Not deployed yet because of some minor eth.filter() issues. This will eventually be an easy to integrate "Pay with Eth" button that works with metamask out of the box!

Example usage:

happyPay.getKey("email", "password", function(results){
	var key = results.key;
	var secret = results.secret;

	happyPay.newToken(function(token){
		token.cardnumber = "123456789101112";
		token.cvv = "123";

		happyPay.tokenize(key, secret, token, function(token) {
			var amount = 100
			console.log("key" + key)
			
			happyPay.chargeCard(key, secret, token, amount, function(receipt) {
				console.log(receipt);
			})
		});
	})
})