feat: WM on Test wallet
Context
- closes #1358
- closes #1357
This PR introduces changes that will allow creation of asset scale 9 wallet addresses by default and all WM accounting logic is removed as there will be no difference between payment pointers.
Rapyd will only take into account asset scale 2 (this is unchanged) while we also keep track of an asset scale 9 "virtual" balance in our wallet's db. This virtual balance is separated into incomingBalance and outgoingBalance for each PP. Whenever scale 9 incoming or outgoing transfers add up to the lowest amount representable in scale 2 (i.e. 0.01), then Rapyd balance is updated. This is similar to the previous WM accounting logic, but it now applies to all transactions.
Changes TLDR;
- Allowing creation of asset scale 9 wallet addresses by default
- Deleted WM accounting logic, wallet addresses are WM ready by default
- Added virtual balance logic for dealing with scale 9 amounts
Important questions
- Should we drop
incomingBalanceandoutgoingBalancecolumns fromwalletAddressestable and move them toaccountstable? - Should we drop
debtcolumn in theaccountstable?
Something has happened with the quotes:
All the values are 0 and if you click send it is Internal Server error.
Regarding question nr 1.: Caching Wallet Addresses that are in use for WM is still a good ideea for latency, since in WM cases, we end up fetching the wallet address with a much higher frequency. Since we would not have anything that differentiates Wallet addresses that are in use in WM to ones that are not, I think an LRU cache would achieve the same goal here?
On nr 2 and 3, tbh I don't know how those fields are used in order to answer.
Thoughts? @dragosp1011 @raducristianpopa
Fee still is 0.... :(
I'll take another look at the frontend to make sure that every amount displayed is properly formatted with a single shared function instead of the already existing code that I added for doing that which is not clean. I'll update the PR with the refactor.
What will happen if we cache a WA, then update it, and then fetch it again before its expiry time has passed?
What will happen if we cache a WA, then update it, and then fetch it again before its expiry time has passed?
there are 2 options is this case: 1. invalidate the cache on update or 2. cache the WA after update
@sanducb please be aware that change the scale here too.
We will cherry pick the useful code we need from this. Integrating Gatehub sandbox and replacing Rapyd, sadly made this story n0t needed anymore, as only asset code 2 will be supported.