API

approve

Calling at start of the channel and approving it

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

reject

Calling at start of the channel and reject it

JS modules
WS
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

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

closeMutually

Mutually closing the channel

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

closeOneSide

Onesided closing of the channel

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