[ecash-agora] Get true minimum buy amounts for agora offers
Summary:
Depends on D16919
Discovered some unhandled cases in implementing agora partials in Cashtab.
- Using the library as is, it is possible to create an AgoraPartial offer where the price of the minimum accepted offer is less than dust. In this case, that's not really the price...the price dust / min qty.
I made sure such an offer could not be created with Cashtab validation. But it's the kind of thing better handled at the lib level.
- minAcceptedTokens() is not necessarily the true minimum accepted tokens for an offer. Since only discrete quantities may be accepted, you must prepareAcceptedTokens(minAcceptedTokens) to get the true min. However, prepareAcceptedTokens may return a value lower than minAcceptedTokens...which will cause an agora offer for such an amount to fail script sig verify.
Update the minAcceptedTokens() to return the true min, i.e. the lowest possible discrete interval above minAcceptedTokens().
Test Plan: npm test
Reviewers: #bitcoin_abc, tobias_ruck
Reviewed By: #bitcoin_abc, tobias_ruck
Subscribers: tobias_ruck
Differential Revision: https://reviews.bitcoinabc.org/D16920