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

@shareandcharge/settlement

v0.1.4

Published

Share & Charge smart contracts pertaining to settlement of charging sessions

Downloads

3

Readme

Share&Charge Settlement Smart Contracts

CircleCI

Share&Charge eMobility smart contracts written in Solidity for Ethereum-based networks.

Install

The contract definitions are available as an NPM package for programmatic access and usage:

npm install @shareandcharge/settlement

Usage

The package provides a class SnC which simplifies the work with the smart-contracts. The constructor takes 3 parameters:

  • stage - one of local, poa, test and tobalaba
  • privateKey - the private key of the account you want to sign your transactions with
  • provider - optionally you can override the default configuration for accessing the node by supplying your own provider

the packages uses ethers for communicating with the parity node.

the SnC class provides access to the smart contracts in the form of instantiated objects which expose all the implemented functions. The available smart-contracts are:

  • settlement - the wallet into which you have to send tokens in order for them to be used as payment
  • eurToken - the EUR stable coin token
  • usdToken - the USD stable coin token
  • chfToken - the CHF stable coin token (only on Tobabala)
  • at this stage we're not using the EVT token for staking. Hence its absence from the list

at this stage there are no faucets to get stable coins for test. Create an issue with your address and the environement on which you work and we'll send some tokens your way

once you have tokens you can provision your account in the Settlement contract by calling the provision function on the instantiated SnC object. That would look something like this:

snc.eurToken.provision(amount) // the amount must be a string and can be in scientific notation. e.g. 2.1e28

Once your account is provisioned, you can transfer the tokens by delegating the transaction to anyone. Get the signature by calling

getSignedTransferRaw(recipient: address, amount: string, currency: [EUR, USD, CHF or erc20 token address])

this signature can then be forwarded to a server which can submit it to the smart-contract without needing to know the signer's private key

Development

Clone and install dependencies:

$ git clone https://bitbucket.org/shareandcharge/contracts.git
$ cd sharecharge-contracts
$ npm install

In two different terminal sessions, ensure the contracts are working as expected:

$ npm run ganache
$ npm test

Initial deployment of the smart contracts:

truffle migrate --network=<STAGE>

Publish contract definitions ( defaults to "local"):

npm run publish-dev <STAGE>

The contract definitions are now available to be used in ./contract.defs.<STAGE>.json.