aeternity / ae_mdw

Aeternity Middleware in Elixir
26 stars 10 forks source link

Investigate a way to include source information when rendering any data on the endpoints #1031

Open sborrazas opened 1 year ago

sborrazas commented 1 year ago

Right now, the websocket tx object contains less data than the /txs list endpoint, which doesn't allow the frontend to render the new txs without making additional requests.

The data displayed on some of the requests not always comes from (or is serialized by) the middleware. We need to have a way to specify the clients where the data comes from: either the mdw or the node.

thepiwo commented 1 year ago

As we have discussed over the past days as well, maybe we can unify in the future to find one structure for each "entity" and always return that to be more consistent.

I think as devs of that api we are aware of how this came to be, but for consumers this can be painful

jyeshe commented 1 year ago

As we have discussed over the past days as well, maybe we can unify in the future to find one structure for each "entity" and always return that to be more consistent.

I think as devs of that api we are aware of how this came to be, but for consumers this can be painful

Agreed, even though the Mdw was practically rebuilt we need a next step of reviewing response/payload structures including in the v3 endpoints discussion also how to deliver websocket data.

jyeshe commented 1 year ago

~Right now, the websocket tx object contains less data than the /txs list endpoint, which doesn't allow the frontend to render the new txs without making additional requests.~

The data displayed on some of the requests not always comes from (or is serialized by) the middleware. We need to have a way to specify the clients where the data comes from: either the mdw or the node.

Regarding websockets this is done here in terms of synching time (when node or mdw has synced) but all data is serialized by the Node: https://github.com/aeternity/ae_mdw/blob/4b69441dfeb5425ec63bef8e63d1c44dfa90fd42/lib/ae_mdw_web/websocket/broadcaster.ex#L186-L187 https://github.com/aeternity/ae_mdw/blob/4b69441dfeb5425ec63bef8e63d1c44dfa90fd42/lib/ae_mdw_web/websocket/broadcaster.ex#L167-L168

sborrazas commented 1 year ago

Would we be able to serialize that data ourselves and include the additional information that the node doesn't include?

jyeshe commented 1 year ago

Would we be able to serialize that data ourselves and include the additional information that the node doesn't include?

I think it's possible and if we wanna avoid breaking changes the formatting can be part of the subscription.