pendingChannelIds.forEach(async channelId => { if (isLocked || !didInit) { return } const paymentChannel = await machinomy.channelById(channelId) if (paymentChannel) { // Initialize channel with a 0 tip await this.initChannel() // Remove channelId from watchers this.store.dispatch(actions.removePendingChannel(channelId)) } })
public async populateChannels (): Promise<void> { const machinomy = await this.getMachinomy() const channels = await machinomy.channels() if (!channels || !channels.length) { try { const channelIds = await this.getChannelsByPublicKey() for (let i = 0; i < channelIds.length; i++) { await machinomy.channelById(channelIds[i]) } await this.populateChannels() } catch (err) { console.log(err) } } else { this.store.dispatch(actions.setChannels(channels.map( (ch: PaymentChannel) => PaymentChannelSerde.instance.serialize(ch)))) } }