Skip to content

Override method to get wallet balance #13

@mpetrunic

Description

@mpetrunic

By default getBalance method will query node every time it's called which generates too many api calls and it's prone to failure.
I would propose that wallet subscribes to balance updates and keeps cached balance. This would allow us to have balance healthcheck without generating api calls.

I think listener is something like:

provider.on(wallet.address, function(newBalance) {
    console.log(newBalance);
});

We should verify that it uses websocket and not polling with infura

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions