Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including connext with all npm packages installed. Try it out:

var connext = require("connext")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

connext v5.1.0

Browser SDK for Connext

Connext Browser SDK

The Connext Browser SDK is the simplest way to add micropayments to any web app.

Connext is the protocol for p2p micropayments, built using state channels on the Ethereum blockchain. This SDK creates a Connext client inside of an iframe in your browser page, and then uses that client along with some minimal UI components to dispatch transfers to a recipient.

The SDK supports the following features:

  • 🎩 Email-based login via Magic.
  • 💳 Debit card on/offboarding via Moonpay.
  • ⛽ End-to-end Ethereum gas (transaction fee) abstraction.
  • 💵 Transfers in USD by default, with optional customizeability to other currencies.
  • 🦊 Login using any popular Ethereum wallet such as Metamask. (coming soon!)

Installation

You can install the SDK using npm:

npm i --save connext

Usage

After installing, import the SDK into your web app, instantiate it and open the login UI.

import ConnextSDK from "connext";

const connext = new ConnextSDK();

// Login User
await connext.login();

// Get User ID
const publicIdentifier = connext.publicIdentifier;

// Get Token Balance
const balance = await connext.balance();

// Deposit Tokens
await connext.deposit();

// Transfer Tokens
await connext.transfer("indra987zxy...", "12.5");

// Withdraw Tokens
await connext.withdraw();

// Logout User
await connext.logout();

Documentation

For more documentation, please check the Github repo for Connext SDK

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free