-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AND-5051 Added support for transaction history in ETH like blockchains
- Loading branch information
Showing
5 changed files
with
54 additions
and
25 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
.../java/com/tangem/blockchain/blockchains/ethereum/EthereumTransactionHistoryProviderExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.tangem.blockchain.blockchains.ethereum | ||
|
||
import com.tangem.blockchain.common.Blockchain | ||
import com.tangem.blockchain.common.BlockchainSdkConfig | ||
import com.tangem.blockchain.common.txhistory.DefaultTransactionHistoryProvider | ||
import com.tangem.blockchain.common.txhistory.TransactionHistoryProvider | ||
import com.tangem.blockchain.network.blockbook.config.BlockBookConfig | ||
import com.tangem.blockchain.network.blockbook.network.BlockBookApi | ||
|
||
internal fun Blockchain.getEthereumTransactionHistoryProvider( | ||
config: BlockchainSdkConfig, | ||
): TransactionHistoryProvider { | ||
return when (this) { | ||
Blockchain.Ethereum, | ||
Blockchain.EthereumTestnet, | ||
Blockchain.Arbitrum, | ||
Blockchain.Avalanche, | ||
Blockchain.BSC, | ||
Blockchain.Polygon, | ||
Blockchain.EthereumPow, | ||
Blockchain.Kava, | ||
-> { | ||
if (config.nowNodeCredentials != null && config.nowNodeCredentials.apiKey.isNotBlank()) { | ||
EthereumTransactionHistoryProvider( | ||
blockchain = this, | ||
BlockBookApi( | ||
config = BlockBookConfig.NowNodes(nowNodesCredentials = config.nowNodeCredentials), | ||
blockchain = this, | ||
) | ||
) | ||
} else { | ||
DefaultTransactionHistoryProvider | ||
} | ||
} | ||
else -> DefaultTransactionHistoryProvider | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters