Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 5.1 to develop #366

Merged
merged 7 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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