diff --git a/bitcoincashkit/src/main/kotlin/io/horizontalsystems/bitcoincash/BitcoinCashKit.kt b/bitcoincashkit/src/main/kotlin/io/horizontalsystems/bitcoincash/BitcoinCashKit.kt index f8fe5cdc..d65cfedf 100644 --- a/bitcoincashkit/src/main/kotlin/io/horizontalsystems/bitcoincash/BitcoinCashKit.kt +++ b/bitcoincashkit/src/main/kotlin/io/horizontalsystems/bitcoincash/BitcoinCashKit.kt @@ -260,7 +260,7 @@ class BitcoinCashKit : AbstractKit { is NetworkType.MainNet -> { if (syncMode is SyncMode.Blockchair) { - val blockchairApi = BlockchairApi(syncMode.key, network.blockchairChainId) + val blockchairApi = BlockchairApi(network.blockchairChainId) val blockchairBlockHashFetcher = BlockchairBlockHashFetcher(blockchairApi) val blockHashFetcher = BlockHashFetcher(hsBlockHashFetcher, blockchairBlockHashFetcher, checkpoint.block.height) val blockchairProvider = BlockchairTransactionProvider(blockchairApi, blockHashFetcher) @@ -305,7 +305,7 @@ class BitcoinCashKit : AbstractKit { "BitcoinCash-${networkType.description}-$walletId-${syncMode.javaClass.simpleName}" fun clear(context: Context, networkType: NetworkType, walletId: String) { - for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair(""))) { + for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair())) { try { SQLiteDatabase.deleteDatabase(context.getDatabasePath(getDatabaseName(networkType, walletId, syncMode))) } catch (ex: Exception) { diff --git a/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCore.kt b/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCore.kt index c7a7e67f..7cfaf98a 100644 --- a/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCore.kt +++ b/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCore.kt @@ -478,7 +478,7 @@ class BitcoinCore( sealed class SyncMode { class Full : SyncMode() class Api : SyncMode() - class Blockchair(val key: String) : SyncMode() + class Blockchair : SyncMode() } sealed class StateError : Exception() { diff --git a/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCoreBuilder.kt b/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCoreBuilder.kt index bc930fca..53e7aec6 100644 --- a/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCoreBuilder.kt +++ b/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/BitcoinCoreBuilder.kt @@ -399,7 +399,7 @@ class BitcoinCoreBuilder { val blockchairApi = if (apiTransactionProvider is BlockchairTransactionProvider) { apiTransactionProvider.blockchairApi } else { - BlockchairApi(syncMode.key, network.blockchairChainId) + BlockchairApi(network.blockchairChainId) } val lastBlockProvider = BlockchairLastBlockProvider(blockchairApi) apiSyncer = BlockchairApiSyncer( diff --git a/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/apisync/blockchair/BlockchairApi.kt b/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/apisync/blockchair/BlockchairApi.kt index 929fe07e..3af0574c 100644 --- a/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/apisync/blockchair/BlockchairApi.kt +++ b/bitcoincore/src/main/kotlin/io/horizontalsystems/bitcoincore/apisync/blockchair/BlockchairApi.kt @@ -12,10 +12,9 @@ import java.util.Locale import java.util.TimeZone class BlockchairApi( - private val secretKey: String, private val chainId: String, ) { - private val apiManager = ApiManager("https://api.blockchair.com") + private val apiManager = ApiManager("https://api.blocksdecoded.com/v1/blockchair") private val limit = 10000 private val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()) @@ -64,7 +63,7 @@ class BlockchairApi( } fun lastBlockHeader(): BlockHeaderItem { - val params = "?limit=0&key=$secretKey" + val params = "?limit=0" val url = "$chainId/stats" val response = apiManager.doOkHttpGet(url + params).asObject() val data = response.get("data").asObject() @@ -84,7 +83,7 @@ class BlockchairApi( receivedTransactionItems: List = emptyList() ): Pair, List> { try { - val params = "?transaction_details=true&limit=$limit,0&offset=${receivedTransactionItems.size}&key=$secretKey" + val params = "?transaction_details=true&limit=$limit,0&offset=${receivedTransactionItems.size}" val url = "$chainId/dashboards/addresses/${addresses.joinToString(separator = ",")}" val response = apiManager.doOkHttpGet(url + params).asObject() val data = response.get("data").asObject() @@ -134,7 +133,7 @@ class BlockchairApi( private fun fetchBlockHashes(heights: List): Map { try { - val params = "?limit=0&key=$secretKey" + val params = "?limit=0" val url = "$chainId/dashboards/blocks/${heights.joinToString(separator = ",")}" val response = apiManager.doOkHttpGet(url + params).asObject() diff --git a/bitcoinkit/src/main/kotlin/io/horizontalsystems/bitcoinkit/BitcoinKit.kt b/bitcoinkit/src/main/kotlin/io/horizontalsystems/bitcoinkit/BitcoinKit.kt index b6015370..81533a1f 100644 --- a/bitcoinkit/src/main/kotlin/io/horizontalsystems/bitcoinkit/BitcoinKit.kt +++ b/bitcoinkit/src/main/kotlin/io/horizontalsystems/bitcoinkit/BitcoinKit.kt @@ -318,7 +318,7 @@ class BitcoinKit : AbstractKit { NetworkType.MainNet -> { val hsBlockHashFetcher = HsBlockHashFetcher("https://api.blocksdecoded.com/v1/blockchains/bitcoin") if (syncMode is SyncMode.Blockchair) { - val blockchairApi = BlockchairApi(syncMode.key, network.blockchairChainId) + val blockchairApi = BlockchairApi(network.blockchairChainId) val blockchairBlockHashFetcher = BlockchairBlockHashFetcher(blockchairApi) val blockHashFetcher = BlockHashFetcher(hsBlockHashFetcher, blockchairBlockHashFetcher, checkpoint.block.height) val blockchairProvider = BlockchairTransactionProvider(blockchairApi, blockHashFetcher) @@ -367,7 +367,7 @@ class BitcoinKit : AbstractKit { * @param walletId The string wallet ID of the BitcoinKit. */ fun clear(context: Context, networkType: NetworkType, walletId: String) { - for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair(""))) { + for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair())) { for (purpose in Purpose.values()) try { SQLiteDatabase.deleteDatabase(context.getDatabasePath(getDatabaseName(networkType, walletId, syncMode, purpose))) } catch (ex: Exception) { diff --git a/dashkit/src/main/kotlin/io/horizontalsystems/dashkit/DashKit.kt b/dashkit/src/main/kotlin/io/horizontalsystems/dashkit/DashKit.kt index bf065342..82aa8734 100644 --- a/dashkit/src/main/kotlin/io/horizontalsystems/dashkit/DashKit.kt +++ b/dashkit/src/main/kotlin/io/horizontalsystems/dashkit/DashKit.kt @@ -291,7 +291,7 @@ class DashKit : AbstractKit, IInstantTransactionDelegate, BitcoinCore.Listener { val insightApiProvider = InsightApi("https://insight.dash.org/insight-api") if (syncMode is SyncMode.Blockchair) { - val blockchairApi = BlockchairApi(syncMode.key, network.blockchairChainId) + val blockchairApi = BlockchairApi(network.blockchairChainId) val blockchairBlockHashFetcher = BlockchairBlockHashFetcher(blockchairApi) val blockchairProvider = BlockchairTransactionProvider(blockchairApi, blockchairBlockHashFetcher) @@ -384,7 +384,7 @@ class DashKit : AbstractKit, IInstantTransactionDelegate, BitcoinCore.Listener { } fun clear(context: Context, networkType: NetworkType, walletId: String) { - for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair(""))) { + for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair())) { try { SQLiteDatabase.deleteDatabase(context.getDatabasePath(getDatabaseNameCore(networkType, walletId, syncMode))) SQLiteDatabase.deleteDatabase(context.getDatabasePath(getDatabaseName(networkType, walletId, syncMode))) diff --git a/ecashkit/src/main/kotlin/io/horizontalsystems/ecash/ECashKit.kt b/ecashkit/src/main/kotlin/io/horizontalsystems/ecash/ECashKit.kt index 88a114f4..54fdded6 100644 --- a/ecashkit/src/main/kotlin/io/horizontalsystems/ecash/ECashKit.kt +++ b/ecashkit/src/main/kotlin/io/horizontalsystems/ecash/ECashKit.kt @@ -239,7 +239,7 @@ class ECashKit : AbstractKit { NetworkType.MainNet -> { val chronikApiProvider = ChronikApi() if (syncMode is SyncMode.Blockchair) { - val blockchairApi = BlockchairApi(syncMode.key, network.blockchairChainId) + val blockchairApi = BlockchairApi(network.blockchairChainId) val blockchairBlockHashFetcher = BlockchairBlockHashFetcher(blockchairApi) val blockchairProvider = BlockchairTransactionProvider(blockchairApi, blockchairBlockHashFetcher) @@ -280,7 +280,7 @@ class ECashKit : AbstractKit { "ECash-${networkType.name}-$walletId-${syncMode.javaClass.simpleName}" fun clear(context: Context, networkType: NetworkType, walletId: String) { - for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair(""))) { + for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair())) { try { SQLiteDatabase.deleteDatabase(context.getDatabasePath(getDatabaseName(networkType, walletId, syncMode))) } catch (ex: Exception) { diff --git a/litecoinkit/src/main/kotlin/io/horizontalsystems/litecoinkit/LitecoinKit.kt b/litecoinkit/src/main/kotlin/io/horizontalsystems/litecoinkit/LitecoinKit.kt index 553cbd9e..3bedbd49 100644 --- a/litecoinkit/src/main/kotlin/io/horizontalsystems/litecoinkit/LitecoinKit.kt +++ b/litecoinkit/src/main/kotlin/io/horizontalsystems/litecoinkit/LitecoinKit.kt @@ -266,7 +266,7 @@ class LitecoinKit : AbstractKit { val bCoinApiProvider = BCoinApi("https://ltc.blocksdecoded.com/api") if (syncMode is SyncMode.Blockchair) { - val blockchairApi = BlockchairApi(syncMode.key, network.blockchairChainId) + val blockchairApi = BlockchairApi(network.blockchairChainId) val blockchairBlockHashFetcher = BlockchairBlockHashFetcher(blockchairApi) val blockchairProvider = BlockchairTransactionProvider(blockchairApi, blockchairBlockHashFetcher) @@ -301,7 +301,7 @@ class LitecoinKit : AbstractKit { "Litecoin-${networkType.name}-$walletId-${syncMode.javaClass.simpleName}-${purpose.name}" fun clear(context: Context, networkType: NetworkType, walletId: String) { - for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair(""))) { + for (syncMode in listOf(SyncMode.Api(), SyncMode.Full(), SyncMode.Blockchair())) { for (purpose in Purpose.values()) try { SQLiteDatabase.deleteDatabase(context.getDatabasePath(getDatabaseName(networkType, walletId, syncMode, purpose)))