From 364e9fa6caf7e5024f1264ee5e72d7af3b4b69e6 Mon Sep 17 00:00:00 2001 From: Kashif Date: Wed, 11 Nov 2020 20:44:40 +0900 Subject: [PATCH] finish up coins api --- services/account_service.go | 11 ++++++----- services/network_service.go | 1 + services/types.go | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/services/account_service.go b/services/account_service.go index 37cc080..8c8adff 100644 --- a/services/account_service.go +++ b/services/account_service.go @@ -115,16 +115,17 @@ func (s *AccountAPIService) AccountCoins( BlockIdentifier: block, Coins: coins, } - //@Todo include_mempool query + + //@Todo include_mempool query unsupported + //https://github.com/coinbase/rosetta-bitcoin/issues/36#issuecomment-724992022 + //Once mempoolcoins are supported also change the bool service/types.go:MempoolCoins to true if len(request.Currencies) > 0 { filtered := []*types.Coin{} + for _, curr := range request.Currencies { - if curr == nil { - continue - } for _, coin := range coins { - if coin.Amount.Currency.Symbol == curr.Symbol { + if types.Hash(curr) == types.Hash(coin.Amount.Currency) { filtered = append(filtered, coin) } } diff --git a/services/network_service.go b/services/network_service.go index edeb721..04dcb02 100644 --- a/services/network_service.go +++ b/services/network_service.go @@ -99,6 +99,7 @@ func (s *NetworkAPIService) NetworkOptions( OperationTypes: bitcoin.OperationTypes, Errors: Errors, HistoricalBalanceLookup: HistoricalBalanceLookup, + MempoolCoins: MempoolCoins, }, }, nil } diff --git a/services/types.go b/services/types.go index cf64ed2..21edf0e 100644 --- a/services/types.go +++ b/services/types.go @@ -31,6 +31,9 @@ const ( // that historical balance lookup is supported. HistoricalBalanceLookup = true + //Include mempool coins when fetching account coints + MempoolCoins = false + // inlineFetchLimit is the maximum number // of transactions to fetch inline. inlineFetchLimit = 100