Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Add autorefresh to accounts #356

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from
Open

Conversation

tluthra
Copy link

@tluthra tluthra commented Jul 18, 2018

PR Checklist (check all)

  • Updated CHANGELOG.md to describe the included fixes and changes made
  • Included issue number on the description of the PR
  • Commented on the relevant issue thread about this PR

Issue number

#318

Changelog

Added refresh balances/transactions every new block

Details

Add an additional web3 instance that uses infura's mainnet websocket
endpoint. On every new block we simply refresh the balance,
transactions and unique tokens for a given account.

Few things to note:

  • ACCOUNT_UPDATE_BALANCES_REQUEST wasn't being used so, removed it.
  • accountClearIntervals looks like it was replaced in favor of
    accountClearState, so removed that function as well.
  • web3 v1.0.0-beta34 that we're using has a bug connecting to any
    of the testnets on infura, downgrading to web3 v1.0.0-beta33 fixes
    the problem if we want to have a network specific subscription
    Invalid Websocket headers in 1.0.0-beta.34 web3/web3.js#1559

Add an additional web3 instance that uses infura's mainnet websocket
endpoint.  On every new block we simply refresh the balance,
transactions and unique tokens for a given account.

Few things to note:
- ACCOUNT_UPDATE_BALANCES_REQUEST wasn't being used so, removed it.
- accountClearIntervals looks like it was replaced in favor of
accountClearState, so removed that function as well.
- web3 v1.0.0-beta34 that we're using has a bug connecting to any
of the testnets on infura, downgrading to web3 v1.0.0-beta33 fixes
the problem if we want to have a network specific subscription
web3/web3.js#1559
@tluthra tluthra mentioned this pull request Jul 18, 2018
1 task
@jinchung
Copy link
Contributor

Thanks @tluthra ! I'll take a deeper look at this next week! Just want to make sure we won't run into issues with our rate limits on various APIs - cheers!

@jinchung jinchung self-assigned this Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants