add sepolia testnet (#129)

This commit is contained in:
Vadim Vlasov
2023-02-02 21:15:59 +08:00
committed by GitHub
parent 9f36f1ff18
commit bcc07b131f
6 changed files with 17 additions and 5 deletions

View File

@@ -11,7 +11,8 @@ enum class BlockchainType {
chain == Chain.OPTIMISM || chain == Chain.OPTIMISM ||
chain == Chain.BSC || chain == Chain.BSC ||
chain == Chain.TESTNET_GOERLI || chain == Chain.TESTNET_GOERLI ||
chain == Chain.ETHEREUM chain == Chain.ETHEREUM ||
chain == Chain.TESTNET_SEPOLIA
) { ) {
return EVM_POS return EVM_POS
} }

View File

@@ -49,7 +49,8 @@ enum class Chain(val id: Int, val chainCode: String, val chainName: String) {
"ROPSTEN", "ROPSTEN",
"Ropsten Testnet" "Ropsten Testnet"
), ),
TESTNET_RINKEBY(10007, "RINKEBY", "Rinkeby Testnet"); TESTNET_RINKEBY(10007, "RINKEBY", "Rinkeby Testnet"),
TESTNET_SEPOLIA(10008, "SEPOLIA", "Sepolia Testnet");
companion object { companion object {
fun byId(id: Int): Chain { fun byId(id: Int): Chain {

View File

@@ -64,7 +64,9 @@ class Global {
"ropsten" to Chain.TESTNET_ROPSTEN, "ropsten" to Chain.TESTNET_ROPSTEN,
"ropsten-testnet" to Chain.TESTNET_ROPSTEN, "ropsten-testnet" to Chain.TESTNET_ROPSTEN,
"bitcoin" to Chain.BITCOIN, "bitcoin" to Chain.BITCOIN,
"bitcoin-testnet" to Chain.TESTNET_BITCOIN "bitcoin-testnet" to Chain.TESTNET_BITCOIN,
"sepolia" to Chain.TESTNET_SEPOLIA,
"sepolia-testnet" to Chain.TESTNET_SEPOLIA,
) )
fun chainById(id: String?): Chain { fun chainById(id: String?): Chain {

View File

@@ -225,6 +225,10 @@ class DefaultEthereumMethods(
"\"5\"" "\"5\""
} }
Chain.TESTNET_SEPOLIA == chain -> {
"\"11155111\""
}
else -> throw RpcException(-32602, "Invalid chain") else -> throw RpcException(-32602, "Invalid chain")
} }
} }
@@ -263,6 +267,10 @@ class DefaultEthereumMethods(
"\"0x5\"" "\"0x5\""
} }
Chain.TESTNET_SEPOLIA == chain -> {
"\"0xaa36a7\""
}
else -> throw RpcException(-32602, "Invalid chain") else -> throw RpcException(-32602, "Invalid chain")
} }
} }

View File

@@ -59,7 +59,7 @@ open class EthereumMultistream(
private var subscribe = EthereumEgressSubscription(this, NoPendingTxes()) private var subscribe = EthereumEgressSubscription(this, NoPendingTxes())
private val supportsEIP1559 = when (chain) { private val supportsEIP1559 = when (chain) {
Chain.ETHEREUM, Chain.TESTNET_ROPSTEN, Chain.TESTNET_GOERLI, Chain.TESTNET_RINKEBY -> true Chain.ETHEREUM, Chain.TESTNET_ROPSTEN, Chain.TESTNET_GOERLI, Chain.TESTNET_RINKEBY, Chain.TESTNET_SEPOLIA -> true
else -> false else -> false
} }
private val feeEstimation = if (supportsEIP1559) EthereumPriorityFees(this, reader, 256) private val feeEstimation = if (supportsEIP1559) EthereumPriorityFees(this, reader, 256)