Hush SDK for Android lite wallets https://hush.is
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.1 KiB

package cash.z.ecc.android.sdk.model
/**
* The Zcash network. Should be one of [ZcashNetwork.Testnet] or [ZcashNetwork.Mainnet].
*
* The constructor for the network is public to allow for certain test cases to use a custom "darkside" network.
*/
data class ZcashNetwork(
val id: Int,
val networkName: String,
val saplingActivationHeight: BlockHeight
) {
@Suppress("MagicNumber")
companion object {
const val ID_TESTNET = 0
const val ID_MAINNET = 1
// You may notice there are extra checkpoints bundled in the SDK that match the
// sapling/orchard activation heights.
val Testnet = ZcashNetwork(
ID_TESTNET,
"testnet",
saplingActivationHeight = BlockHeight(1),
)
val Mainnet = ZcashNetwork(
ID_MAINNET,
"mainnet",
saplingActivationHeight = BlockHeight(1),
)
fun from(id: Int) = when (id) {
0 -> Testnet
1 -> Mainnet
else -> throw IllegalArgumentException("Unknown network id: $id")
}
}
}