Skip to content

Commit

Permalink
Merge pull request #366 from tangem/merge_5.1_to_develop
Browse files Browse the repository at this point in the history
Merge 5.1 to develop
  • Loading branch information
kozarezvlad authored Nov 7, 2023
2 parents ded4cd8 + 206c751 commit 1e85f78
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class NearWalletManager(
wallet.setReserveValue(NearAmount.DEPOSIT_VALUE)
} else {
wallet.setReserveValue(amountValue)
wallet.setAmount(Amount(BigDecimal.ZERO, wallet.blockchain))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ enum class Blockchain(

fun decimals(): Int = when (this) {
Unknown -> 0
Near, NearTestnet,
-> 5

Cardano,
XRP,
Expand Down Expand Up @@ -156,6 +154,9 @@ enum class Blockchain(
OctaSpace, OctaSpaceTestnet,
Decimal, DecimalTestnet,
-> 18

Near, NearTestnet,
-> 24
}

fun makeAddresses(
Expand Down Expand Up @@ -410,6 +411,7 @@ enum class Blockchain(
Stellar, StellarTestnet,
Optimism, OptimismTestnet,
TON, TONTestnet,
Near, NearTestnet
-> true

else -> false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,16 +30,22 @@ internal object EthereumWalletManagerAssembly : WalletManagerAssembly<EthereumWa
tokens = input.config.blockcypherTokens
),
),
transactionHistoryProvider = 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
transactionHistoryProvider = when (blockchain) {
Blockchain.Ethereum -> {
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
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ internal object NearWalletManagerAssembly : WalletManagerAssembly<NearWalletMana
add(createNearJsonRpcProvider(isTestNet = false))
config.nowNodeCredentials?.apiKey.letNotBlank { add(createNowNodeJsonRpcProvider(it)) }
config.getBlockCredentials?.apiKey.letNotBlank { add(createGetBlockJsonRpcProvider(it)) }
config.infuraProjectId?.letNotBlank { add(getInfuraProvider(it)) }
// temporarily exclude before AND-5171 fix
// config.infuraProjectId?.letNotBlank { add(getInfuraProvider(it)) }
}
}
val txBuilder = NearTransactionBuilder(wallet.publicKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ object DerivationConfigV1 : DerivationConfig() {
mapOf(AddressType.Default to DerivationPath("m/44'/977'/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(""))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(""))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(""))

Expand Down

0 comments on commit 1e85f78

Please sign in to comment.