Closed bohendo closed 4 years ago
And while we're at it, how about we either wait to return the channel client until the channel is available or expose a promise that'll resolve once it is.
This boiler plate is going to be required by every single connext app otherwise: https://github.com/ConnextProject/indra/blob/master/modules/daicard/src/App.js#L253
// Wait for channel to be available
const channelIsAvailable = async channel => {
const chan = await channel.getChannel();
return chan && chan.available;
};
while (!(await channelIsAvailable(channel))) {
await new Promise(res => setTimeout(() => res(), 1000));
}
Better would be:
const channel = await connext.connect(config)
await channel.isReady()
Describe the bug FYI yall I have a daicard that's broken. It's recieved a link payment and redemption fails with:
This error is kinda handled but it's handled after my card tries to redeem the payment (and crashes) so it never reaches the logic branch that'll fix it To Reproduce Steps to reproduce the behavior:
Expected behavior State should be restored if necessary before doing that other fancy stuff at the end of the client's
connect
functionYour Environment
rinkeby.daicard