biot.ws
  • Initial page
  • Getting started
    • Welcome
    • Installation
  • API
    • Apps
    • Wallet
    • Address
    • Messages
    • Sign
    • Correspondents
    • Events
  • Channels
    • What's it?
    • Channels manager
    • Auto renewable channels
    • API
    • Example of regular payments
    • Examples
Powered by GitBook
On this page
  • approve
  • reject
  • transfer
  • closeMutually
  • closeOneSide
  1. Channels

API

approve

Calling at start of the channel and approving it

await channel.approve();
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'approve']
}));

reject

Calling at start of the channel and reject it

await channel.reject();
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'reject']
}));

transfer

Transfer moneys inside of the channel to the second side.

Params:

amount - {number} - How much money we transfer?

message - {string|object} - Transfer message

await channel.transfer(100, 'hello!');
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'transfer', 100, 'hello!']
}));

closeMutually

Mutually closing the channel

await channel.closeMutually();
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'closeMutually']
}));

closeOneSide

Onesided closing of the channel

await channel.closeOneSide();
socket.send(JSON.stringify({
    id: i++,
    name: 'channel',
    args: [channelId, 'closeOneSide']
}));
PreviousAuto renewable channelsNextExample of regular payments

Last updated 6 years ago