Socket
Socket
Sign inDemoInstall

@connext/channel-commitments

Package Overview
Dependencies
67
Maintainers
5
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @connext/channel-commitments


Version published
Weekly downloads
2
Maintainers
5
Install size
7.51 MB
Created
Weekly downloads
 

Readme

Source

@connext/channel-commitments

Usage

The CommitmentClient is responsible for interacting with the backend to collect signatures for channel signers. It will be consumed by the claim UI to capture signatures from returning users to redeem commitments.

Interface

The class has the following interface:

class CommitmentClient {
  // What consumer should prompt user to sign
  public readonly SIGN_IN_PROMPT: string = "...";

  // This method should:
  // - generate the channel wallet from input signature
  // - store the backend URL
  // - store the injected provider
  // - create a new CommitmentClient + return it
  public async post(signature: string, backend?: string): Promise<void> {}
}

Quickstart

  1. Install the package:
npm i @connext/channel-commitments
  1. Instantiate the client in your application:
import { CommitmentClient } from "@connext/channel-commitments";

const client = new CommitmentClient();
  1. Generate the signature:
const signature = await injectedProvider.signMessage(client.SIGN_IN_PROMPT);
  1. Post signature to backend:
try {
  await client.post(signature);
} catch (e) {
  console.warn("Failed to post to client");
}

FAQs

Last updated on 22 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc