From 4e8d51fa9d428358bba641cae654ab181a584fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 17 Jan 2023 20:42:22 +0100 Subject: [PATCH] Rename AccountDetail -> TransferDetail (#125) This PR applies the changes from https://github.com/kadena-io/chainweb-api/pull/42 * Rename AccountDetail -> TransferDetail This PR applies the changes from https://github.com/kadena-io/chainweb-api/pull/42 * Update the chainweb-api pin after merging the PR --- cabal.project | 2 +- deps/chainweb-api/github.json | 4 ++-- exec/Chainweb/Server.hs | 27 +++++++++++++-------------- lib/ChainwebData/Spec.hs | 4 ++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/cabal.project b/cabal.project index e8c24a8a..368cbe3a 100644 --- a/cabal.project +++ b/cabal.project @@ -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 diff --git a/deps/chainweb-api/github.json b/deps/chainweb-api/github.json index a32161e0..090d8992 100644 --- a/deps/chainweb-api/github.json +++ b/deps/chainweb-api/github.json @@ -3,6 +3,6 @@ "repo": "chainweb-api", "branch": "master", "private": false, - "rev": "5ca78695338638195d73c27a5d1854d63e947e1a", - "sha256": "1mnnl9b1qxxswh29alcv865fhm3ryfknmw1mcirhqdiijawmc9nd" + "rev": "ca794bec5e7b3a7e58f4862459b712b78191971b", + "sha256": "03b79qrsflfqiij71y4fyq57lxf3skz2irj689j6y4mvzznx18xg" } diff --git a/exec/Chainweb/Server.hs b/exec/Chainweb/Server.hs index 66b9270b..b8ea271b 100644 --- a/exec/Chainweb/Server.hs +++ b/exec/Chainweb/Server.hs @@ -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 @@ -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 $ @@ -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 diff --git a/lib/ChainwebData/Spec.hs b/lib/ChainwebData/Spec.hs index 05a7f61c..07e96d33 100644 --- a/lib/ChainwebData/Spec.hs +++ b/lib/ChainwebData/Spec.hs @@ -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) @@ -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 }