oasis-gateway icon indicating copy to clipboard operation
oasis-gateway copied to clipboard

integration with the dashboard

Open eauge opened this issue 6 years ago • 5 comments

The developer gateway needs to work well with the dashboard. In order to do this, one feature that we need is how to keep track of the amount spent by each user. First, we need to be able to keep track of the wallet balance (https://github.com/oasislabs/developer-gateway/issues/95). But also, once a transaction is executed, we need to define how the information of how much a user has spent will be propagated outside the dashboard.

One way to do it would be to use callbacks. That'd be implemented as, every successful transaction executed will trigger a callback to an endpoint, that can keep track of how much a user has spent. However, since this is accounting, we may want a more reliable mechanism. Maybe this needs some thinking.

eauge avatar Jun 17 '19 14:06 eauge

can we synchronize through the database directly?

willscott avatar Jun 17 '19 14:06 willscott

@willscott synchronizing directly with the database maybe we should be our last option.

It would work, and it would be fast to implement. But this means that we would have custom code in the gateway, which is something that if we make it available to others we may want to avoid. If we could send a callback every time a request has been sent to the dashboard, or maybe keep in redis how much gas a specific user session has spent and then process that independently from the developer-gateway.

I don't know how to abstract accessing the database in a way that others can use it, I haven't really thought about it, but if you see a way to do it feel free to make a suggestion :).

eauge avatar Jun 17 '19 16:06 eauge

if it lives in a custom auth plugin, i'd guess it could be a part we don't release / stays internal to our deployment

willscott avatar Jun 17 '19 16:06 willscott

@willscott how would you manage the plugin? Do you suggest setting up a private repository where we import all the developer gateway code, and compile the code with our private plugins?

I'm fine with that, just to understand logistically how you would like to implement it

eauge avatar Jun 17 '19 16:06 eauge

yeah, a separate private repo seems reasonable. i'll put together a PR for how they'd link

willscott avatar Jun 17 '19 17:06 willscott