You can read the original post I wrote here
This post is being written at the time of
And includes changes since the original post was written (June 5).
Looping through all the wallets has been replaced by Probabilistic revenue sharing. Payment pointer is now being changed dynamically instead of opening new tab and closing the previous, which also fixed chromium stealing the focus.
User now cannot open more tabs in the puppeteer chromium instance, thus packages will keep getting monetized.
Event listeners are now being fired correctly along with the same arguments that you would expect to get in the browser. State is also being updated correctly.
Since probabilistic revenue sharing is being implemented, timeout is no longer needed. Packages are now selected for 65 seconds each randomly.
removeListener methods renamed to
Previously, the operations
invokeEventListener took O(n) time to find the package being referred to, blocking the main thread. This is now being done in constant time, thus improving performance.
nameHash store index of the packages. While
nameHash contains the index of the package corresponding to the key,
walletHash has array of such indexes for value, as more than one packages can have the same wallet.
In cases when more than one packages have the same wallet, the events are fired and states are changed for all these packages when any one of them is being monetized.
nameHash has keys of the type
This argument is the same as the response object which is passed by any event being fired in the browser, and is passed by the provider module being used. The correct package is identified by looking into the argument for wallet address, which is matched with
walletHash to get the correct index.
pending in previous versions. Fixed now
The main post has also been updated according to these new changes.
The only remaining problem is that monetization does not occur if puppeteer's chromium instance is specifically minimized, otherwise it works fine, even when not in focus. You can leave it running in the background and expect it to be working absolutely fine and as expected.