-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When I request a conversion with an amount which, because of the conversion rate, would result in a converted amount of less than 1n, an Internal Server Error is returned.
In the server logs I see:
[<NO_REQUEST_ID>] DEBUG Calculating exchange rate for BTC -> USD:
[<NO_REQUEST_ID>] DEBUG Base rate: 125341.55998122648:
[<NO_REQUEST_ID>] DEBUG Converted:: 0n
[<NO_REQUEST_ID>] ERROR KeetaAnchorHTTP.Server: Error: Invalid converted amount
at Object.getConversionRateAndFee (/workspace/demo-fx-anchor/apps/api/src/app.ts:44:11)
Expected Behavior
A Bad Request response is returned with a message that indicates what I did wrong, e.g. "Requested amount is too small".
Steps to reproduce
-
Start the anchor (or use the one deployed at
https://demo-fx-anchor.test.keeta.com). -
Request a conversion of
1nBTC (0.00000001) toUSD:curl 'http://localhost:8080/api/getEstimate' \ -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' \ --data-raw '{"request":{"from":"keeta_ao47xyunmfh5jcdkm7mgrfaaddp7a2nt2xvwrph6cgurvbeixh77qkfsglgms","to":"keeta_ap7wtjtyfc4yvt26jstau4n76uqnv4znjnz5pcgpnjsty5vjbxkvmk55yl4f6","amount":"0x1","affinity":"from"}}'
-
Observe the response
{"ok":false,"error":"Internal Server Error"}.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels