@statechannels/channel-client > ChannelClient

ChannelClient class

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Class that wraps the JSON-RPC interface of @statechannels/iframe-channel-provider

export declare class ChannelClient implements BrowserChannelClientInterface
Implements: [BrowserChannelClientInterface](/typescript-api/channel-client.browserchannelclientinterface)


This class exposes a convenient API feturing event emitters and async methods returning Promises. Together with @statechannels/iframe-channel-provider, it allows a Dapp to speak to the statechannels wallet.


(constructor)(provider)(BETA) Create a new instance of the Channel Client


channelStateReplaySubject<ChannelResult>(BETA) rxjs Observable which emits ChannelResults for all channels of interest
destinationAddressstring | undefined(BETA) Get my destination address
providerChannelProviderInterface(BETA) E.g. instance of the @statechannels/iframe-channel-provider class, suitably configured
signingAddressstring | undefined(BETA) Get my state channel (ephemeral) signingAddress
walletVersionstring | undefined(BETA) Get the wallet version


approveBudgetAndFund(receiveCapacity, sendCapacity, hubAddress, hubOutcomeAddress)(BETA) Requests approval for a new budget for this domain, as well as for an appropriately funded ledger channel with the hub
challengeChannel(channelId)(BETA) Requests a challenge for a channel
closeAndWithdraw(hubParticipantId)(BETA) Requests the funds to be withdrawn from this domain's ledger channel
closeChannel(channelId)(BETA) Requests a close for a channel
createChannel(participants, allocations, appDefinition, appData, fundingStrategy)(BETA) Requests a new channel to be created
getBudget(hubParticipantId)(BETA) Requests the latest budget for this domain
getChannels(includeClosed)(BETA) Requests the latest state for all channels.
getState(channelId)(BETA) Requests the latest state for a channel
joinChannel(channelId)(BETA) Join a proposed state channel
onBudgetUpdated(callback)(BETA) Registers callback that will fire when a domain budget is updated.
onChannelProposed(callback)(BETA) Registers a callback that will fire when a state channel is proposed.
onChannelUpdated(callback)(BETA) Registers a callback that will fire when a state channel is updated.
onMessageQueued(callback)(BETA) Registers a callback that will fire when an outbound message is ready to be dispatched.
pushMessage(message)(BETA) Accepts inbound messages from other state channel participants.
updateChannel(channelId, allocations, appData)(BETA) Updates the state of a channel
Last updated on by geoknee