-
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.
Merge branch 'release-app_5.19' into merge_5.18_5.19
- Loading branch information
Showing
77 changed files
with
1,519 additions
and
248 deletions.
There are no files selected for viewing
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
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
44 changes: 44 additions & 0 deletions
44
blockchain/src/main/java/com/tangem/blockchain/blockchains/clore/CloreMainNetParams.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,44 @@ | ||
package com.tangem.blockchain.blockchains.clore | ||
|
||
import org.bitcoinj.core.Block | ||
import org.bitcoinj.core.Utils | ||
import org.bitcoinj.params.AbstractBitcoinNetParams | ||
|
||
@Suppress("MagicNumber") | ||
internal class CloreMainNetParams : AbstractBitcoinNetParams() { | ||
init { | ||
interval = INTERVAL | ||
targetTimespan = TARGET_TIMESPAN | ||
|
||
// 00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff | ||
maxTarget = Utils.decodeCompactBits(0x1e0fffffL) | ||
addressHeader = 23 | ||
p2shHeader = 122 | ||
port = 8788 | ||
bip32HeaderP2PKHpub = 0x0488b21e // The 4 byte header that serializes in base58 to "xpub". | ||
bip32HeaderP2PKHpriv = 0x0488ade4 // The 4 byte header that serializes in base58 to "xprv" | ||
majorityEnforceBlockUpgrade = MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE | ||
majorityRejectBlockOutdated = MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED | ||
majorityWindow = MAINNET_MAJORITY_WINDOW | ||
id = ID_MAINNET | ||
dnsSeeds = arrayOf( | ||
"seed.clore.ai", | ||
"seed1.clore.ai", | ||
"seed2.clore.ai", | ||
) | ||
} | ||
|
||
override fun getPaymentProtocolId(): String { | ||
return PAYMENT_PROTOCOL_ID_MAINNET | ||
} | ||
|
||
override fun getGenesisBlock(): Block { | ||
return Block.createGenesis(this) // Stub genesis block | ||
} | ||
|
||
private companion object { | ||
private const val MAINNET_MAJORITY_WINDOW = 1000 | ||
private const val MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED = 950 | ||
private const val MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE = 750 | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
blockchain/src/main/java/com/tangem/blockchain/blockchains/clore/CloreProvidersBuilder.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,27 @@ | ||
package com.tangem.blockchain.blockchains.clore | ||
|
||
import com.tangem.blockchain.blockchains.bitcoin.network.BitcoinNetworkProvider | ||
import com.tangem.blockchain.common.Blockchain | ||
import com.tangem.blockchain.common.BlockchainSdkConfig | ||
import com.tangem.blockchain.common.network.providers.NetworkProvidersBuilder | ||
import com.tangem.blockchain.common.network.providers.ProviderType | ||
import com.tangem.blockchain.network.blockbook.BlockBookNetworkProviderFactory | ||
|
||
internal class CloreProvidersBuilder( | ||
override val providerTypes: List<ProviderType>, | ||
private val config: BlockchainSdkConfig, | ||
) : NetworkProvidersBuilder<BitcoinNetworkProvider>() { | ||
|
||
private val blockBookProviderFactory by lazy { BlockBookNetworkProviderFactory(config) } | ||
|
||
override fun createProviders(blockchain: Blockchain): List<BitcoinNetworkProvider> { | ||
return providerTypes.mapNotNull { | ||
when (it) { | ||
is ProviderType.Public -> | ||
blockBookProviderFactory | ||
.createCloreBlockProvider(blockchain = blockchain, baseHost = it.url) | ||
else -> null | ||
} | ||
} | ||
} | ||
} |
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
3 changes: 2 additions & 1 deletion
3
...rc/main/java/com/tangem/blockchain/blockchains/ducatus/network/bitcore/BitcoreSendBody.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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.tangem.blockchain.blockchains.ducatus.network.bitcore | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class BitcoreSendBody(val rawTx: List<String>) | ||
data class BitcoreSendBody(@Json(name = "rawTx") val rawTx: List<String>) |
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
28 changes: 14 additions & 14 deletions
28
...ain/java/com/tangem/blockchain/blockchains/ethereum/models/EthereumCompiledTransaction.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 |
---|---|---|
@@ -1,33 +1,33 @@ | ||
package com.tangem.blockchain.blockchains.ethereum.models | ||
|
||
import kotlinx.serialization.Serializable | ||
import shadow.com.google.gson.annotations.SerializedName | ||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
|
||
/** | ||
* Model of filled Ethereum transaction used in staking | ||
*/ | ||
@Serializable | ||
@JsonClass(generateAdapter = true) | ||
data class EthereumCompiledTransaction( | ||
@SerializedName("from") | ||
@Json(name = "from") | ||
val from: String, | ||
@SerializedName("gasLimit") | ||
@Json(name = "gasLimit") | ||
val gasLimit: String, | ||
@SerializedName("value") | ||
@Json(name = "value") | ||
val value: String?, | ||
@SerializedName("to") | ||
@Json(name = "to") | ||
val to: String, | ||
@SerializedName("data") | ||
@Json(name = "data") | ||
val data: String, | ||
@SerializedName("nonce") | ||
@Json(name = "nonce") | ||
val nonce: Int, | ||
@SerializedName("type") | ||
@Json(name = "type") | ||
val type: Int, | ||
@SerializedName("gasPrice") | ||
@Json(name = "gasPrice") | ||
val gasPrice: String?, | ||
@SerializedName("maxFeePerGas") | ||
@Json(name = "maxFeePerGas") | ||
val maxFeePerGas: String?, | ||
@SerializedName("maxPriorityFeePerGas") | ||
@Json(name = "maxPriorityFeePerGas") | ||
val maxPriorityFeePerGas: String?, | ||
@SerializedName("chainId") | ||
@Json(name = "chainId") | ||
val chainId: Int, | ||
) |
18 changes: 18 additions & 0 deletions
18
.../main/java/com/tangem/blockchain/blockchains/ethereum/providers/ChilizProvidersBuilder.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,18 @@ | ||
package com.tangem.blockchain.blockchains.ethereum.providers | ||
|
||
import com.tangem.blockchain.blockchains.ethereum.network.EthereumJsonRpcProvider | ||
import com.tangem.blockchain.common.Blockchain | ||
import com.tangem.blockchain.common.network.providers.OnlyPublicProvidersBuilder | ||
import com.tangem.blockchain.common.network.providers.ProviderType | ||
|
||
internal class ChilizProvidersBuilder( | ||
override val providerTypes: List<ProviderType>, | ||
) : OnlyPublicProvidersBuilder<EthereumJsonRpcProvider>( | ||
providerTypes = providerTypes, | ||
testnetProviders = listOf( | ||
"https://spicy-rpc.chiliz.com/", | ||
"https://chiliz-spicy.publicnode.com/", | ||
), | ||
) { | ||
override fun createProvider(url: String, blockchain: Blockchain) = EthereumJsonRpcProvider(url) | ||
} |
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
Oops, something went wrong.