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

eve-js

v0.0.2

Published

A simple wrapper for using ethereum in the browser

Downloads

3

Readme

eve-js

Build apps with ethereum in the browser. A collection of helpers to build more readable webapps with ethereum.

Intended for use alongside browser plugins like (the amazing) Metamask that load web3 onto the window.

Methods

parseProtocolUrl(url)

Build a raw ethereum transaction by parsing an ethereum "protocol url" and query, according to this discussion here.

The transaction is encoded like ethereum:[to_address]?[params,...]

Put value, and gas in params to pass these options into the transaction, along with (optionally) one of the following to encode a function call

  • function: a string of the raw function signature like functionImCalling(arg_1_value, arg_2_value)

  • fn: the name of the function you'd like to call (as specified in the Contract's ABI), and a query-encoded abi like

    fn=functionImCalling&
    input.arg_1.type=string&
    input.arg_1=arg_1_value&
    input.arg_2.type=address&
    input.arg_2=arg_2_value
  • data: encoded bytecode of the transaction inputs as described here

buildAPIWithABI(abi)

Build an associative array (object) of javascript functions to call a Contract's functions from your application code. Call the function by name with the normal arguments from the Contract, a parameter options to optionally configure from, value, and gas, and a callback for the web3 provider.

eve = require 'eve-js'

# A hypothetical ethereum call that pays an
# invoice keyed off a unique string.

my_abi = [{
    constant: false,
    inputs: [{
        name: "purchaser",
        type: "string"}
    ],
    name: "payInvoice",
    outputs: [],
    payable: true,
    type: "function"
}]

# Build a function to use in your code
{payInvoice} = eve.buildAPIWithABI my_abi

# now call the function like...
invoice_address = 'my_invoice_address'
purchaser_key = window.user.my_unique_key
options = {}
payInvoice invoice_address, purchaser_key, options, (err, txid) ->
    # handle response here...

The functions will be called by passing them to window.web3, like Metamask provides.

execWithABI(abi, address, fn, args..., options, cb)

Call a function by name from a raw ABI and a Contract address. Optionally configure from, value, and to in options. Using the same example from above...

eve.execWithABI my_abi, invoice_address, 'PayInvoice', purchaser_key, {}, (err, txid) ->
    # handle response here...

send({to, from, gas, value}, cb)

Convenience function to send ether from raw transaction json. from and gas are optional.

eve = require 'eve-js'

bill_payer = '0x0'

my_accounts = {
    utilities: '0x0'
    dinner: '0x0'
    girlfriend: '0x0'
}

sendTransaction = (reason) ->
    eve.send {to: bill_payer, from: my_accounts[reason], value: 1000000000000000}