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

eac-ico-starter

v0.0.1

Published

[<img src="https://s3.amazonaws.com/chronologic.network/ChronoLogic_logo.svg" width="128px">](https://github.com/chronologic)

Downloads

6

Readme

Note: Operational on the Kovan and Ropsten testnets. Mainnet release coming soon.

Build Status

Ethereum Alarm Clock ICO Starter

This JavaScript library allows you to easily schedule Ethereum transactions to happen in the future using Ethereum Alarm Clock.

You can create a scheduling functionality that, for the end user, will be just one button.

The primary use case is ICO contribution scheduling.

Live demo.

Usage in project

  1. Embed dist/js/eac-schedule.js into your page.
  2. Prepare the parameters for scheduling:
function getOptions() {
    var FEE = '2242000000000000'; // IN WEI

    function successHandler(result) {
        var transactionHash = result.transactionHash;

        $('#txhash').html(transactionHash);
        $('#success-info').show();
    }

    return {
        callValue: '100000000000000000', // WEI
        toAddress: '0x1332283369b529aaae2ba378189814b3fe3d6f6b',
        windowStart: '1518530927', // UNIX TIMESTAMP
        windowSize: 86400, // in seconds
        callGasAmount: 200000,
        callMethodSignature: 'buyRecipient(address)', // signature of a method you wish to call
        callMethodArguments: ['0xe87529a6123a74320e13a6dabf3606630683c029'], // parameter values, in this example user wallet address
        fee: FEE, // fee for scheduling paid for using EAC
        sendButtonSelector: '#send-btn',
        enabledInfoSelector: '#enabled-info', // show when MetaMask is enabled
        disabledInfoSelector: '#disabled-info', // show when there is no MetaMask
        lockedInfoSelector: '#locked-info', // show when MetaMask is locked
        wrongNetworkInfoSelector: '#wrong-network-info', // show when MetaMask network is different than networkId
        successHandler // callback when transaction has been scheduled,
        networkId: 42 // id of the Ethereum network for the scheduling functionality
    };
}
  1. Include the following code for the integration:
window.ScheduleSetup().then(function() {
    var Schedule = new window.Schedule(getOptions());
});

Documentation

Options

  • callValue : string - Future transaction value in Wei. Say contribution amount of the user is 1 ETH. In that case, you should pass '1000000000000000000', which is 10**18.

  • toAddress : string - Address to send the future transaction to. In terms of ICOs, it should be a smart contract address which has a method to buy tokens.

  • windowStart : number - UNIX timestamp when the window for execution will be open. It should usually be the time after the start of the ICO, so that when the contribution is sent, it will be accepted by the smart contract.

  • windowSize : number - Size of the execution window in seconds for the transaction.

  • callMethodSignature : string - Signature of the contract method you wish to call. This method should exist in the smart contract with the toAddress address.

  • callMethodArguments : array - Array of arguments to pass to a smart contract method call.

  • fee : string - Fee (in Wei) paid to Ethereum Alarm Clock maintainers for using scheduling.

  • sendButtonSelector : string - CSS selector for the button that, when clicked, will try to send a MetaMask transaction that will schedule the contribution.

  • enabledInfoSelector : string - CSS selector for the container that will be shown when MetaMask is enabled.

  • disabledInfoSelector : string - CSS selector for the container that will be shown when MetaMask is disabled.

  • lockedInfoSelector : string - CSS selector for the container that will be shown when MetaMask is locked.

  • wrongNetworkInfoSelector : string - CSS selector for the container that will be shown when MetaMask network is different than networkId.

  • successHandler : function(result) - Function that will be called when a transaction has been sent. First argument is an object that contains the transactionHash.

  • networkId : number - ID of the Ethereum network scheduling should work on. By default it is 1 - which is main net, 42 is Kovan.

Development guide

How to build and run locally

  1. Install NPM if not present on the system
  2. Clone the repo
  3. npm install - Install all NodeJS dependencies
  4. npm run dev - Run the dev server
  5. Check localhost:8080 in your browser

This is a way to see access the demo locally and adjust the parameters to your specific contract use case.

To create a production bundle please run: npm run build.

Testing

Please use npm run test to execute tests.