-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds /account/balance endpoint #1047
Conversation
src/Chainweb/Rosetta/RestAPI.hs
Outdated
-- Value of the transaction in atomic units represented as an | ||
-- arbitrary-sized signed integer. | ||
amount :: Integer | ||
amount = floor $ k * (realToFrac $ (10 :: Integer) ^ numDecimals) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with suggestion for unit test on atomic unit function
-- | Guarantees that the `ChainId` given actually belongs to this | ||
-- `ChainwebVersion`. | ||
readChainIdText :: ChainwebVersion -> T.Text -> Maybe ChainId | ||
readChainIdText v c = do | ||
cid <- readMaybe @Word (T.unpack c) | ||
mkChainId v cid | ||
|
||
|
||
kdaToRosettaAmount :: Decimal -> Amount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest a quick unit test for just this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged this PR into the #1050 and added a unit test for kdaToRosettaAmount
there
Closing this as it was merged into #1050 |
Research possible bug (checkpointer error keeps being thrown when I hit this endpoint in non-genesis case)Can't replicate and it seems to work fine with a local mining node now.