dkg 8.0.11__py3-none-any.whl → 8.0.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dkg/constants.py CHANGED
@@ -75,19 +75,9 @@ class OutputTypes(Enum):
75
75
  JSONLD: str = "JSON-LD"
76
76
 
77
77
 
78
- class Environments(Enum):
79
- DEVELOPMENT: str = "development"
80
- DEVNET: str = "devnet"
81
- TESTNET: str = "testnet"
82
- MAINNET: str = "mainnet"
83
-
84
-
85
78
  class BlockchainIds(Enum):
86
79
  HARDHAT_1: str = "hardhat1:31337"
87
80
  HARDHAT_2: str = "hardhat2:31337"
88
- BASE_DEVNET: str = "base:84532"
89
- GNOSIS_DEVNET: str = "gnosis:10200"
90
- NEUROWEB_DEVNET: str = "otp:2160"
91
81
  BASE_TESTNET: str = "base:84532"
92
82
  GNOSIS_TESTNET: str = "gnosis:10200"
93
83
  NEUROWEB_TESTNET: str = "otp:20430"
@@ -114,12 +104,6 @@ BLOCKCHAINS = {
114
104
  "rpc": "http://localhost:9545",
115
105
  },
116
106
  },
117
- "devnet": {
118
- "base:84532": {
119
- "hub": "0xE043daF4cC8ae2c720ef95fc82574a37a429c40A",
120
- "rpc": "https://sepolia.base.org",
121
- }
122
- },
123
107
  "testnet": {
124
108
  "base:84532": {
125
109
  "hub": "0xf21CE8f8b01548D97DCFb36869f1ccB0814a4e05",
@@ -152,11 +136,6 @@ BLOCKCHAINS = {
152
136
 
153
137
  DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
154
138
  "development": {"hardhat1:31337": 2, "hardhat2:31337": 2, "otp:2043": 2},
155
- "devnet": {
156
- "otp:2160": 2,
157
- "gnosis:10200": 2,
158
- "base:84532": 2,
159
- },
160
139
  "testnet": {
161
140
  "otp:20430": 2,
162
141
  "gnosis:10200": 2,
@@ -27,7 +27,7 @@ from dkg.exceptions import (
27
27
  AccountMissing,
28
28
  NetworkNotSupported,
29
29
  )
30
- from dkg.types import URI, Address, Environment, Wei
30
+ from dkg.types import URI, Address, Wei
31
31
  from web3.contract import Contract
32
32
  from web3.contract.contract import ContractFunction
33
33
  from web3.types import TxReceipt
@@ -39,13 +39,12 @@ from dkg.providers.blockchain.base_blockchain import BaseBlockchainProvider
39
39
  class AsyncBlockchainProvider(BaseBlockchainProvider):
40
40
  def __init__(
41
41
  self,
42
- environment: Environment,
43
42
  blockchain_id: str,
44
43
  rpc_uri: URI | None = None,
45
44
  gas_price: Wei | None = None,
46
45
  verify: bool = True,
47
46
  ):
48
- super().__init__(environment, blockchain_id, rpc_uri, gas_price)
47
+ super().__init__(blockchain_id, rpc_uri, gas_price)
49
48
 
50
49
  ssl_context = None if verify else False
51
50
  self.w3 = AsyncWeb3(
@@ -8,7 +8,7 @@ from dkg.exceptions import (
8
8
  EnvironmentNotSupported,
9
9
  RPCURINotDefined,
10
10
  )
11
- from dkg.types import URI, DataHexStr, Environment, Wei
11
+ from dkg.types import URI, DataHexStr, Wei
12
12
  from eth_account.signers.local import LocalAccount
13
13
  from eth_typing import ABI, ABIFunction
14
14
  from web3.logs import DISCARD
@@ -21,27 +21,26 @@ class BaseBlockchainProvider:
21
21
 
22
22
  def __init__(
23
23
  self,
24
- environment: Environment,
25
24
  blockchain_id: str,
26
25
  rpc_uri: URI | None = None,
27
26
  gas_price: Wei | None = None,
28
27
  ):
29
- if environment not in BLOCKCHAINS.keys():
30
- raise EnvironmentNotSupported(f"Environment {environment} isn't supported!")
31
-
32
- self.environment = environment
33
- self.rpc_uri = rpc_uri
34
- self.blockchain_id = (
35
- blockchain_id
36
- if blockchain_id in BLOCKCHAINS[self.environment].keys()
37
- else None
38
- )
28
+ self.environment = None
29
+ for env_name, chains_in_env in BLOCKCHAINS.items():
30
+ if blockchain_id in chains_in_env:
31
+ self.environment = env_name
32
+ break
33
+
34
+ if self.environment is None:
35
+ raise EnvironmentNotSupported(
36
+ f"Could not derive environment for blockchain_id: {blockchain_id}. "
37
+ "Ensure it's defined in BLOCKCHAINS constant."
38
+ )
39
39
 
40
- if self.rpc_uri is None and self.blockchain_id is not None:
41
- self.blockchain_id = blockchain_id
42
- self.rpc_uri = self.rpc_uri or BLOCKCHAINS[self.environment][
43
- self.blockchain_id
44
- ].get("rpc", None)
40
+ self.blockchain_id = blockchain_id
41
+ self.rpc_uri = rpc_uri or BLOCKCHAINS[self.environment][self.blockchain_id].get(
42
+ "rpc", None
43
+ )
45
44
 
46
45
  if self.rpc_uri is None:
47
46
  raise RPCURINotDefined(
@@ -26,7 +26,7 @@ from dkg.exceptions import (
26
26
  AccountMissing,
27
27
  NetworkNotSupported,
28
28
  )
29
- from dkg.types import URI, Address, Environment, Wei
29
+ from dkg.types import URI, Address, Wei
30
30
  from web3 import Web3
31
31
  from web3.contract import Contract
32
32
  from web3.contract.contract import ContractFunction
@@ -37,13 +37,12 @@ from dkg.providers.blockchain.base_blockchain import BaseBlockchainProvider
37
37
  class BlockchainProvider(BaseBlockchainProvider):
38
38
  def __init__(
39
39
  self,
40
- environment: Environment,
41
40
  blockchain_id: str,
42
41
  rpc_uri: URI | None = None,
43
42
  gas_price: Wei | None = None,
44
43
  verify: bool = True,
45
44
  ):
46
- super().__init__(environment, blockchain_id, rpc_uri, gas_price)
45
+ super().__init__(blockchain_id, rpc_uri, gas_price)
47
46
 
48
47
  self.w3 = Web3(
49
48
  Web3.HTTPProvider(self.rpc_uri, request_kwargs={"verify": verify})
dkg/types/blockchain.py CHANGED
@@ -50,7 +50,7 @@ ABIElement = ABIFunction | ABIEvent | ABIError
50
50
  ABI = list[ABIElement]
51
51
 
52
52
 
53
- Environment = Literal["development", "devnet", "testnet", "mainnet"]
53
+ Environment = Literal["development", "testnet", "mainnet"]
54
54
 
55
55
 
56
56
  class AgreementData(NamedTuple):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dkg
3
- Version: 8.0.11
3
+ Version: 8.0.12
4
4
  Summary: Python library for interacting with the OriginTrail Decentralized Knowledge Graph
5
5
  License: Apache-2.0
6
6
  Author: Uladzislau Hubar
@@ -3,7 +3,7 @@ dkg/assertion.py,sha256=-KIVT3LHlOHegGg68_KceC5O2r8B_povbofRjmLguVQ,2507
3
3
  dkg/clients/__init__.py,sha256=qKQ8TIbst7UZpJEpEJOZslgEX5EB0PU_H7cwk5-UDso,84
4
4
  dkg/clients/async_dkg.py,sha256=PM0suu8BFUhhS8_K_zoPTxKEXn5J1AFCwyB-JP-hLmc,4013
5
5
  dkg/clients/dkg.py,sha256=QTLm5nfeW0gx_t2e8JMO5gcIJaPvmy1L7ZOy7dSfhkc,3786
6
- dkg/constants.py,sha256=Zjr7N4cQr-9Kcut3KyYWiITXgsYyAM13TvKdDNbu4lY,5307
6
+ dkg/constants.py,sha256=PBX3AEK0bBeiG7sHBY65cZllo74q-H8hclqNbl4fj90,4776
7
7
  dkg/data/interfaces/AskStorage.json,sha256=hHWq3e0Kx8Cs3PKD4HL2xYRQ8DXRTxTL06QXqFyqlns,6773
8
8
  dkg/data/interfaces/Chronos.json,sha256=aIpCUgJ8omHidyt0GPkj02COT1LW8Tu66qDm7iquQJk,3595
9
9
  dkg/data/interfaces/Hub.json,sha256=ZcaePz10ff2Vm7VP-vWP63xLOuE0EE8jNruWvWmMjLw,12611
@@ -40,9 +40,9 @@ dkg/modules/paranet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
40
40
  dkg/modules/paranet/paranet.py,sha256=YulI-sP65sOlBYyUVbA008JByvy-bqnOnWt7vXsf5Kk,26959
41
41
  dkg/providers/__init__.py,sha256=mOHuyl44mpuLnXv920CJ1lsbSTlxNLCwK4xXeQsfv3s,251
42
42
  dkg/providers/blockchain/__init__.py,sha256=Vg5XQ9Fw5m0CQvpMTH5atgPIKKcnknX9peShsmOOtGg,158
43
- dkg/providers/blockchain/async_blockchain.py,sha256=c32RaNP7Qpo7aqP7ZVigkRiKKhb1B57Y4pwItzs9Md0,8766
44
- dkg/providers/blockchain/base_blockchain.py,sha256=VOF3qfwsfJJ3ykBEXDF6yOkKqWG0m-cLFsNC3K3pdPI,3647
45
- dkg/providers/blockchain/blockchain.py,sha256=HxLXkkK1vT_EsMfeIUZUubz6oktMECN19FUdsOAyArk,7906
43
+ dkg/providers/blockchain/async_blockchain.py,sha256=GpMTGKhsqB_m2f6InUAwiRJNisKQErgVSot869TnTV0,8706
44
+ dkg/providers/blockchain/base_blockchain.py,sha256=AW3PlcgfEthvHxxCcv0USXtnOmIixnjK9rg-HpfHuxA,3591
45
+ dkg/providers/blockchain/blockchain.py,sha256=-CoUpc1lRLiVpCWmYVI7dUOn_goreSqSkz0DZq66GAI,7846
46
46
  dkg/providers/node/__init__.py,sha256=Nx2m3bbwDa4y0gAR1WUKhxmw36F-TscKaZj1CKqlEF4,148
47
47
  dkg/providers/node/async_node_http.py,sha256=dBge8pS9Pnk8N4TTgKeewmWWJnSOgU48rQVbm5ZKKsc,2804
48
48
  dkg/providers/node/base_node_http.py,sha256=CCkVwyr_iQKCbknVmEpUDXZlQb8C-Z5ndqQdW-fQR0E,763
@@ -56,7 +56,7 @@ dkg/services/node_services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
56
56
  dkg/services/node_services/async_node_service.py,sha256=AGwpEIbL6HbqcL1Y8FjIwNynQyvvhQaBZdwZtu9X-BQ,5478
57
57
  dkg/services/node_services/node_service.py,sha256=gqCm-PXB0dWwqWw6OxD3AZ3oiS-z6dhxG_l4LDXv3OA,4811
58
58
  dkg/types/__init__.py,sha256=YewW48fOBq-FtecY12Tlr_0vGDuNc2uzpIiM-WERzBU,704
59
- dkg/types/blockchain.py,sha256=hsBpFLgpcEmgODLK0g_cUW1AB69ZZYeX4AcW6wpAMtA,1682
59
+ dkg/types/blockchain.py,sha256=T-A7PEa7v99RuCcmwzkOubQPJG4TXZHHjCgYr09lM7U,1672
60
60
  dkg/types/dkg_node.py,sha256=uGjaYUO4D55sHJrL_3aOL3Nul3RlAo_aL4HLoSrQxr0,838
61
61
  dkg/types/encoding.py,sha256=gOtt9XLoxs6TE7rOCrAx-aCOdsDdaTVn3bxu9HPavxc,915
62
62
  dkg/types/evm.py,sha256=gN2hSq4MQzobWE3YAiTZPcv5b65AVyUEQut8hWPnx68,971
@@ -75,8 +75,8 @@ dkg/utils/node_request.py,sha256=wppF8Xf0RkuAAcURcYgyjGAdMsXm0L5YEem8wFGE2g8,651
75
75
  dkg/utils/rdf.py,sha256=AvlcxZEeP58UbaGGvPX_ss69O-tgTXOJ9y9COZqVgkw,2973
76
76
  dkg/utils/string_transformations.py,sha256=eR51fVwTF9QKxEqXo9_1Bfw_k8iQajdXD6rKuTvhs70,972
77
77
  dkg/utils/ual.py,sha256=g7PFyS4Sbwjmwkq-eB20uRULEC2wlPGZr31BVQjs5OQ,1569
78
- dkg-8.0.11.dist-info/LICENSE,sha256=Dr70w2zcW8-jrPGlpTTTlJPL8lR4j2zpDD32tdEFgjY,11375
79
- dkg-8.0.11.dist-info/METADATA,sha256=gIDVZmuZ6j9G-UKdH1IUcsT4tGDDhmSPEIAwRUV-d6U,10821
80
- dkg-8.0.11.dist-info/NOTICE,sha256=Rk5toFR2ZqPwVZ3P_P4wE6U1xCnWR9KD3rNBqfPY7h8,368
81
- dkg-8.0.11.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
82
- dkg-8.0.11.dist-info/RECORD,,
78
+ dkg-8.0.12.dist-info/LICENSE,sha256=Dr70w2zcW8-jrPGlpTTTlJPL8lR4j2zpDD32tdEFgjY,11375
79
+ dkg-8.0.12.dist-info/METADATA,sha256=qoW7Du0ik1jwQC-qkG3nBQgZQLMoRtUrh4FMJXLJzcQ,10821
80
+ dkg-8.0.12.dist-info/NOTICE,sha256=Rk5toFR2ZqPwVZ3P_P4wE6U1xCnWR9KD3rNBqfPY7h8,368
81
+ dkg-8.0.12.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
82
+ dkg-8.0.12.dist-info/RECORD,,
File without changes
File without changes
File without changes