mirror of https://github.com/nucypher/nucypher.git
Internal w3 client support for polygon/matic and bor
parent
fab011e6e3
commit
f0f4ae8d6c
|
@ -64,6 +64,8 @@ PUBLIC_CHAINS = {
|
|||
42: "Kovan",
|
||||
77: "Sokol",
|
||||
100: "xDai",
|
||||
137: "Polygon/Mainnet",
|
||||
80001: "Polygon/Mumbai"
|
||||
}
|
||||
|
||||
LOCAL_CHAINS = {
|
||||
|
@ -84,7 +86,10 @@ POA_CHAINS = {
|
|||
class EthereumClient:
|
||||
is_local = False
|
||||
|
||||
# These two are used by Infura
|
||||
GETH = 'Geth'
|
||||
BOR = 'bor'
|
||||
|
||||
PARITY = 'Parity'
|
||||
ALT_PARITY = 'Parity-Ethereum'
|
||||
GANACHE = 'EthereumJS TestRPC'
|
||||
|
@ -162,11 +167,13 @@ class EthereumClient:
|
|||
Parity -> 'Parity-Ethereum/v2.5.1-beta-e0141f8-20190510/x86_64-linux-gnu/rustc1.34.1'
|
||||
Ganache -> 'EthereumJS TestRPC/v2.1.5/ethereum-js'
|
||||
PyEVM -> 'EthereumTester/0.1.0b39/linux/python3.6.7'
|
||||
Bor -> 'bor/v0.2.13-beta2-c227a072/linux-amd64/go1.17.5'
|
||||
"""
|
||||
clients = {
|
||||
|
||||
# Geth
|
||||
cls.GETH: GethClient,
|
||||
cls.BOR: BorClient,
|
||||
|
||||
# Parity
|
||||
cls.PARITY: ParityClient,
|
||||
|
@ -461,6 +468,10 @@ class GethClient(EthereumClient):
|
|||
return self.w3.geth.personal.list_wallets()
|
||||
|
||||
|
||||
class BorClient(GethClient):
|
||||
"""Geth to Bor adapter"""
|
||||
|
||||
|
||||
class ParityClient(EthereumClient):
|
||||
|
||||
@property
|
||||
|
|
|
@ -22,13 +22,21 @@ class NetworksInventory: # TODO: See #1564
|
|||
IBEX = 'ibex'
|
||||
LYNX = 'lynx'
|
||||
|
||||
# TODO: Use naming scheme to preserve multiple compatibility with multiple deployments to a single network?
|
||||
POLYGON = 'polygon'
|
||||
MUMBAI = 'mumbai'
|
||||
|
||||
UNKNOWN = 'unknown' # TODO: Is there a better way to signal an unknown network?
|
||||
DEFAULT = MAINNET
|
||||
|
||||
__to_ethereum_chain_id = {
|
||||
MAINNET: 1, # Ethereum Mainnet
|
||||
IBEX: 4, # Rinkeby
|
||||
LYNX: 5, # Goerli
|
||||
MAINNET: 1, # Ethereum Mainnet
|
||||
IBEX: 4, # Rinkeby
|
||||
LYNX: 5, # Goerli
|
||||
|
||||
# TODO: Use naming scheme?
|
||||
POLYGON: 137, # Polygon Mainnet
|
||||
MUMBAI: 80001, # Polygon Testnet (Mumbai)
|
||||
}
|
||||
|
||||
NETWORKS = tuple(__to_ethereum_chain_id.keys())
|
||||
|
|
Loading…
Reference in New Issue