finish up coins api

This commit is contained in:
Kashif 2020-11-11 20:44:40 +09:00 committed by Patrick O'Grady
parent 8032918639
commit 364e9fa6ca
No known key found for this signature in database
GPG key ID: 8DE11C985C0C8D85
3 changed files with 10 additions and 5 deletions

View file

@ -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)
}
}

View file

@ -99,6 +99,7 @@ func (s *NetworkAPIService) NetworkOptions(
OperationTypes: bitcoin.OperationTypes,
Errors: Errors,
HistoricalBalanceLookup: HistoricalBalanceLookup,
MempoolCoins: MempoolCoins,
},
}, nil
}

View file

@ -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