What's the best way of getting the current balance on an account?


#1

Question originally asked by simon65#8315 in the Java Client Library Discord channel


What’s the best way of getting the current balance on an account? If I subscribe to RadixApplicationAPI.getBalance, it always seems to be the 2nd amount emitted, unless the balance is zero. Is that always the case? How long should one wait to be sure the last amount returned is the latest balance?


@TAlekhiNezh (Josh’s) response:
Yes, there are definitely issues with disconnecting at the moment. The best way to get the balance is what you said RadixApplicationAPI.getBalance and yes you are absolutely correct in that there are weird issues with multiple amounts being emitted at different times. It’s currently using a 3-second debouncer but that is quite fragile and we are working on making the balance which is emitted to only be explicitly the current balance.