diff --git a/blockchain/src/main/java/com/tangem/blockchain/blockchains/near/NearWalletManager.kt b/blockchain/src/main/java/com/tangem/blockchain/blockchains/near/NearWalletManager.kt index b04916a1a..0a38865d8 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/blockchains/near/NearWalletManager.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/blockchains/near/NearWalletManager.kt @@ -55,6 +55,7 @@ class NearWalletManager( wallet.setReserveValue(NearAmount.DEPOSIT_VALUE) } else { wallet.setReserveValue(amountValue) + wallet.setAmount(Amount(BigDecimal.ZERO, wallet.blockchain)) } } diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt b/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt index 9b6e8d091..d03dc0ca8 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/Blockchain.kt @@ -105,8 +105,6 @@ enum class Blockchain( fun decimals(): Int = when (this) { Unknown -> 0 - Near, NearTestnet, - -> 5 Cardano, XRP, @@ -156,6 +154,9 @@ enum class Blockchain( OctaSpace, OctaSpaceTestnet, Decimal, DecimalTestnet, -> 18 + + Near, NearTestnet, + -> 24 } fun makeAddresses( @@ -410,6 +411,7 @@ enum class Blockchain( Stellar, StellarTestnet, Optimism, OptimismTestnet, TON, TONTestnet, + Near, NearTestnet -> true else -> false diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumWalletManagerAssembly.kt b/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumWalletManagerAssembly.kt index 32e0b4781..65dd3b123 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumWalletManagerAssembly.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/EthereumWalletManagerAssembly.kt @@ -5,6 +5,7 @@ import com.tangem.blockchain.blockchains.ethereum.EthereumTransactionHistoryProv import com.tangem.blockchain.blockchains.ethereum.EthereumWalletManager import com.tangem.blockchain.blockchains.ethereum.getEthereumJsonRpcProviders import com.tangem.blockchain.blockchains.ethereum.network.EthereumNetworkService +import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.assembly.WalletManagerAssembly import com.tangem.blockchain.common.assembly.WalletManagerAssemblyInput import com.tangem.blockchain.common.txhistory.DefaultTransactionHistoryProvider @@ -29,16 +30,22 @@ internal object EthereumWalletManagerAssembly : WalletManagerAssembly { + if (input.config.nowNodeCredentials != null && input.config.nowNodeCredentials.apiKey.isNotBlank()) { + EthereumTransactionHistoryProvider( + blockchain = blockchain, + blockBookApi = BlockBookApi( + config = BlockBookConfig.NowNodes(nowNodesCredentials = input.config.nowNodeCredentials), + blockchain = blockchain, + ) + ) + } else { + DefaultTransactionHistoryProvider + } + } + + else -> DefaultTransactionHistoryProvider } ) } diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/NearWalletManagerAssembly.kt b/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/NearWalletManagerAssembly.kt index b11c89195..e4a5c413f 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/NearWalletManagerAssembly.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/assembly/impl/NearWalletManagerAssembly.kt @@ -21,7 +21,8 @@ internal object NearWalletManagerAssembly : WalletManagerAssembly { - mapOf(AddressType.Default to DerivationPath("m/44'/397'/0'/0/0")) + mapOf(AddressType.Default to DerivationPath("m/44'/397'/0'")) } Blockchain.Chia, Blockchain.ChiaTestnet -> mapOf(AddressType.Default to DerivationPath("")) diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt index 08be807cc..e0682a94c 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV2.kt @@ -123,7 +123,7 @@ object DerivationConfigV2 : DerivationConfig() { mapOf(AddressType.Default to DerivationPath("m/44'/330'/0'/0/0")) } Blockchain.Near -> { - mapOf(AddressType.Default to DerivationPath("m/44'/397'/0'/0/0")) + mapOf(AddressType.Default to DerivationPath("m/44'/397'/0'")) } Blockchain.Chia, Blockchain.ChiaTestnet -> mapOf(AddressType.Default to DerivationPath("")) diff --git a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt index b30cfeb91..d7c720cd7 100644 --- a/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt +++ b/blockchain/src/main/java/com/tangem/blockchain/common/derivation/DerivationConfigV3.kt @@ -119,7 +119,7 @@ object DerivationConfigV3 : DerivationConfig() { mapOf(AddressType.Default to DerivationPath("m/44'/330'/0'/0/0")) } Blockchain.Near -> { - mapOf(AddressType.Default to DerivationPath("m/44'/397'/0'/0/0")) + mapOf(AddressType.Default to DerivationPath("m/44'/397'/0'")) } Blockchain.Chia, Blockchain.ChiaTestnet -> mapOf(AddressType.Default to DerivationPath(""))