@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 {
public readonly SIGN_IN_PROMPT: string = "...";
public async post(signature: string, backend?: string): Promise<void> {}
}
Quickstart
npm i @connext/channel-commitments
- Instantiate the client in your application:
import { CommitmentClient } from "@connext/channel-commitments";
const client = new CommitmentClient();
const signature = await injectedProvider.signMessage(client.SIGN_IN_PROMPT);
- Post signature to backend:
try {
await client.post(signature);
} catch (e) {
console.warn("Failed to post to client");
}