Skip to content

Commit

Permalink
Rename AccountDetail -> TransferDetail (#125)
Browse files Browse the repository at this point in the history
This PR applies the changes  from kadena-io/chainweb-api#42

* Rename AccountDetail -> TransferDetail

This PR applies the changes  from kadena-io/chainweb-api#42

* Update the chainweb-api pin after merging the PR
  • Loading branch information
enobayram authored Jan 17, 2023
1 parent c33f649 commit 4e8d51f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/kadena-io/chainweb-api.git
tag: 5ca78695338638195d73c27a5d1854d63e947e1a
tag: ca794bec5e7b3a7e58f4862459b712b78191971b

source-repository-package
type: git
Expand Down
4 changes: 2 additions & 2 deletions deps/chainweb-api/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"repo": "chainweb-api",
"branch": "master",
"private": false,
"rev": "5ca78695338638195d73c27a5d1854d63e947e1a",
"sha256": "1mnnl9b1qxxswh29alcv865fhm3ryfknmw1mcirhqdiijawmc9nd"
"rev": "ca794bec5e7b3a7e58f4862459b712b78191971b",
"sha256": "03b79qrsflfqiij71y4fyq57lxf3skz2irj689j6y4mvzznx18xg"
}
27 changes: 13 additions & 14 deletions exec/Chainweb/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ import Chainweb.Lookups
import Chainweb.RichList
import ChainwebData.Types
import ChainwebData.Api
import ChainwebData.AccountDetail
import ChainwebData.TransferDetail
import ChainwebData.EventDetail
import ChainwebData.AccountDetail ()
import qualified ChainwebData.Spec as Spec
import ChainwebData.Pagination
import ChainwebData.TxDetail
Expand Down Expand Up @@ -548,7 +547,7 @@ accountHandler
-> Maybe Limit
-> Maybe Offset
-> Maybe NextToken
-> Handler (NextHeaders [AccountDetail])
-> Handler (NextHeaders [TransferDetail])
accountHandler logger pool req account token chain limit mbOffset mbNext = do
let usedCoinType = fromMaybe "coin" token
liftIO $ logger Info $
Expand All @@ -575,17 +574,17 @@ accountHandler logger pool req account token chain limit mbOffset mbNext = do
transferSearchExtras
continuation
resultLimit
return $ maybe noHeader (addHeader . mkEventToken) mbCont $ results <&> \(tr, extras) -> AccountDetail
{ _acDetail_name = _tr_modulename tr
, _acDetail_chainid = fromIntegral $ _tr_chainid tr
, _acDetail_height = fromIntegral $ _tr_height tr
, _acDetail_blockHash = unDbHash $ unBlockId $ _tr_block tr
, _acDetail_requestKey = getTxHash $ _tr_requestkey tr
, _acDetail_idx = fromIntegral $ _tr_idx tr
, _acDetail_amount = StringEncoded $ getKDAScientific $ _tr_amount tr
, _acDetail_fromAccount = _tr_from_acct tr
, _acDetail_toAccount = _tr_to_acct tr
, _acDetail_blockTime = tseBlockTime extras
return $ maybe noHeader (addHeader . mkEventToken) mbCont $ results <&> \(tr, extras) -> TransferDetail
{ _trDetail_name = _tr_modulename tr
, _trDetail_chainid = fromIntegral $ _tr_chainid tr
, _trDetail_height = fromIntegral $ _tr_height tr
, _trDetail_blockHash = unDbHash $ unBlockId $ _tr_block tr
, _trDetail_requestKey = getTxHash $ _tr_requestkey tr
, _trDetail_idx = fromIntegral $ _tr_idx tr
, _trDetail_amount = StringEncoded $ getKDAScientific $ _tr_amount tr
, _trDetail_fromAccount = _tr_from_acct tr
, _trDetail_toAccount = _tr_to_acct tr
, _trDetail_blockTime = tseBlockTime extras
}

type EventSearchToken = BSContinuation EventCursor
Expand Down
4 changes: 2 additions & 2 deletions lib/ChainwebData/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import ChainwebData.EventDetail (EventDetail)
import ChainwebData.Util
import qualified Data.Aeson as A
import ChainwebData.TxDetail
import ChainwebData.AccountDetail (AccountDetail)
import ChainwebData.TransferDetail (TransferDetail)
import Chainweb.Api.StringEncoded (StringEncoded)
import Data.Scientific (Scientific)

Expand Down Expand Up @@ -63,7 +63,7 @@ instance ToSchema TxEvent where
declareNamedSchema = genericDeclareNamedSchema
defaultSchemaOptions{ fieldLabelModifier = lensyConstructorToNiceJson 9 }

instance ToSchema AccountDetail where
instance ToSchema TransferDetail where
declareNamedSchema = genericDeclareNamedSchema
defaultSchemaOptions{ fieldLabelModifier = lensyConstructorToNiceJson 10 }

Expand Down

0 comments on commit 4e8d51f

Please sign in to comment.