dkg 0.1.0b6__tar.gz → 1.0.0__tar.gz
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-1.0.0/NOTICE +9 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/PKG-INFO +3 -141
- {dkg-0.1.0b6 → dkg-1.0.0}/README.md +0 -139
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/asset.py +106 -28
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/constants.py +13 -9
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/data/interfaces/ContentAsset.json +133 -3
- dkg-1.0.0/dkg/data/interfaces/Paranet.json +821 -0
- dkg-0.1.0b6/dkg/data/interfaces/Identity.json → dkg-1.0.0/dkg/data/interfaces/ParanetIncentivesPoolFactory.json +67 -86
- dkg-1.0.0/dkg/data/interfaces/ParanetKnowledgeMinersRegistry.json +919 -0
- dkg-1.0.0/dkg/data/interfaces/ParanetNeurowebIncentivesPool.json +1102 -0
- dkg-0.1.0b6/dkg/data/interfaces/ServiceAgreementStorageV1.json → dkg-1.0.0/dkg/data/interfaces/ParanetsRegistry.json +331 -360
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/dataclasses.py +28 -8
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/main.py +6 -3
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/method.py +55 -39
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/module.py +1 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/network.py +20 -10
- dkg-1.0.0/dkg/paranet.py +477 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/providers/blockchain.py +57 -26
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/__init__.py +1 -0
- dkg-1.0.0/dkg/types/general.py +44 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/blockchain_request.py +149 -4
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/node_request.py +77 -80
- {dkg-0.1.0b6 → dkg-1.0.0}/pyproject.toml +2 -2
- dkg-0.1.0b6/dkg/data/interfaces/Assertion.json +0 -157
- dkg-0.1.0b6/dkg/data/interfaces/CommitManagerV1.json +0 -549
- dkg-0.1.0b6/dkg/data/interfaces/CommitManagerV1U1.json +0 -735
- dkg-0.1.0b6/dkg/data/interfaces/HashingProxy.json +0 -253
- dkg-0.1.0b6/dkg/data/interfaces/IdentityStorage.json +0 -342
- dkg-0.1.0b6/dkg/data/interfaces/ParametersStorage.json +0 -487
- dkg-0.1.0b6/dkg/data/interfaces/Profile.json +0 -318
- dkg-0.1.0b6/dkg/data/interfaces/ProfileStorage.json +0 -596
- dkg-0.1.0b6/dkg/data/interfaces/ProofManagerV1.json +0 -540
- dkg-0.1.0b6/dkg/data/interfaces/ProofManagerV1U1.json +0 -561
- dkg-0.1.0b6/dkg/data/interfaces/ScoringProxy.json +0 -268
- dkg-0.1.0b6/dkg/data/interfaces/ServiceAgreementStorageV1U1.json +0 -1097
- dkg-0.1.0b6/dkg/data/interfaces/ServiceAgreementV1.json +0 -745
- dkg-0.1.0b6/dkg/data/interfaces/ShardingTable.json +0 -294
- dkg-0.1.0b6/dkg/data/interfaces/ShardingTableStorage.json +0 -317
- dkg-0.1.0b6/dkg/data/interfaces/Staking.json +0 -482
- dkg-0.1.0b6/dkg/data/interfaces/StakingStorage.json +0 -407
- dkg-0.1.0b6/dkg/data/interfaces/WhitelistStorage.json +0 -124
- {dkg-0.1.0b6 → dkg-1.0.0}/LICENSE +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/__init__.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/assertion.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/data/interfaces/AssertionStorage.json +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/data/interfaces/ContentAssetStorage.json +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/data/interfaces/Hub.json +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/data/interfaces/ServiceAgreementStorageProxy.json +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/data/interfaces/Token.json +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/data/interfaces/UnfinalizedStateStorage.json +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/exceptions.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/graph.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/manager.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/node.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/providers/__init__.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/providers/node_http.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/blockchain.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/dkg_node.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/encoding.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/evm.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/generics.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/network.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/types/rdf.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/__init__.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/decorators.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/merkle.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/metadata.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/rdf.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/string_transformations.py +0 -0
- {dkg-0.1.0b6 → dkg-1.0.0}/dkg/utils/ual.py +0 -0
dkg-1.0.0/NOTICE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
OriginTrail dkg.py
|
2
|
+
Copyright 2023 Trace Labs
|
3
|
+
|
4
|
+
This product includes software developed at
|
5
|
+
Trace Labs (https://tracelabs.io/).
|
6
|
+
|
7
|
+
The Initial Developer of some parts of the framework, which are copied from, derived from, or
|
8
|
+
inspired by web3.py, is The Ethereum Foundation (https://ethereum.foundation/).
|
9
|
+
Copyright 2016 - 2023 The Ethereum Foundation. All Rights Reserved.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dkg
|
3
|
-
Version: 0.
|
3
|
+
Version: 1.0.0
|
4
4
|
Summary: Python library for interacting with the OriginTrail Decentralized Knowledge Graph
|
5
5
|
License: Apache-2.0
|
6
6
|
Author: Uladzislau Hubar
|
@@ -10,6 +10,7 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
13
14
|
Requires-Dist: eth-abi (>=5.0.1,<6.0.0)
|
14
15
|
Requires-Dist: eth-account (>=0.11.0,<0.12.0)
|
15
16
|
Requires-Dist: hexbytes (>=0.3.0,<0.4.0)
|
@@ -17,7 +18,7 @@ Requires-Dist: ot-pyld (>=2.1.1,<3.0.0)
|
|
17
18
|
Requires-Dist: pandas (>=1.5.3,<2.0.0)
|
18
19
|
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
19
20
|
Requires-Dist: rdflib (>=6.3.2,<7.0.0)
|
20
|
-
Requires-Dist: web3 (>=6.
|
21
|
+
Requires-Dist: web3 (>=6.19.0,<7.0.0)
|
21
22
|
Description-Content-Type: text/markdown
|
22
23
|
|
23
24
|
<a name="readme-top"></a>
|
@@ -45,23 +46,6 @@ ___
|
|
45
46
|
</p>
|
46
47
|
</div>
|
47
48
|
|
48
|
-
</br>
|
49
|
-
|
50
|
-
> **Disclaimer: Beta Version**
|
51
|
-
>
|
52
|
-
> Welcome to the beta version of our client! This software is currently in the beta testing phase, which means it is not the final release version. As a beta version, it may still contain bugs, undergo frequent updates, and have limited features.
|
53
|
-
Important Points to Note:
|
54
|
-
|
55
|
-
> **Use at Your Own Risk:** While we have made efforts to ensure the stability and reliability of the beta version, there is a possibility of encountering unexpected issues. Please use this software at your own risk.
|
56
|
-
|
57
|
-
> **Limited Support:** As this is a beta release, our support resources may be focused on addressing critical bugs and gathering feedback from users. Therefore, support for beta versions may be limited compared to our stable releases.
|
58
|
-
|
59
|
-
> **Feedback Appreciated:** Your feedback is invaluable to us. If you encounter any issues, have suggestions, or want to share your experiences with the beta version, please let us know. Your feedback will help us improve the software for the final release.
|
60
|
-
|
61
|
-
> **Not for Production Use:** The beta version is intended for testing and evaluation purposes only. It is not recommended for use in a production environment where stability and reliability are crucial.
|
62
|
-
|
63
|
-
</br>
|
64
|
-
|
65
49
|
<details open>
|
66
50
|
<summary>
|
67
51
|
<b>Table of Contents</b>
|
@@ -82,17 +66,6 @@ Important Points to Note:
|
|
82
66
|
<li><a href="#installation">Installation</a></li>
|
83
67
|
</ul>
|
84
68
|
</li>
|
85
|
-
<li>
|
86
|
-
<a href="#📜-roadmap">📜 Roadmap</a>
|
87
|
-
<ul>
|
88
|
-
<li><a href="#1️⃣-pre-development-phase">1️⃣ Pre-development Phase</a></li>
|
89
|
-
<li><a href="#2️⃣-development-phase">2️⃣ Development Phase</a></li>
|
90
|
-
<li><a href="#3️⃣-documentation-phase">3️⃣ Documentation Phase</a></li>
|
91
|
-
<li><a href="#4️⃣-pre-release-phase">4️⃣ Pre-release Phase</a></li>
|
92
|
-
<li><a href="#5️⃣-release">5️⃣ Release</a></li>
|
93
|
-
<li><a href="#6️⃣-post-release">6️⃣ Post-release</a></li>
|
94
|
-
</ul>
|
95
|
-
</li>
|
96
69
|
<li><a href="#📄-license">📄 License</a></li>
|
97
70
|
<li><a href="#🤝-contributing">🤝 Contributing</a></li>
|
98
71
|
<li><a href="#❤️-thanks-to-all-contributors">❤️ Contributors</a></li>
|
@@ -243,117 +216,6 @@ python3 examples/demo.py
|
|
243
216
|
<br/>
|
244
217
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
245
218
|
|
246
|
-
## 📜 Roadmap
|
247
|
-
|
248
|
-
This roadmap outlines the goals for the first major release of the `dkg.py`. Each section represents a stage in the development process and the features we plan to implement.
|
249
|
-
|
250
|
-
<details open>
|
251
|
-
<summary>
|
252
|
-
|
253
|
-
### 1️⃣ Pre-development Phase
|
254
|
-
|
255
|
-
</summary>
|
256
|
-
|
257
|
-
- [x] **Requirement Analysis and Planning**
|
258
|
-
- [x] Define the project's scope
|
259
|
-
- [x] Identify the core functionalities
|
260
|
-
|
261
|
-
- [x] **Design**
|
262
|
-
- [x] Plan the library's architecture
|
263
|
-
- [x] Establish coding standards
|
264
|
-
|
265
|
-
- [ ] **Setup Development Environment**
|
266
|
-
- [x] Setup development, testing and production environments
|
267
|
-
- [ ] Add pytest config
|
268
|
-
- [ ] Add mypy config
|
269
|
-
- [ ] Add tox config ?
|
270
|
-
- [ ] Setup Continuous Integration (CI) and Continuous Deployment (CD) pipeline
|
271
|
-
</details>
|
272
|
-
|
273
|
-
<details open>
|
274
|
-
<summary>
|
275
|
-
|
276
|
-
### 2️⃣ Development Phase
|
277
|
-
</summary>
|
278
|
-
|
279
|
-
| Feature | Status | Tests coverage |
|
280
|
-
|:-:|:-:|:-:|
|
281
|
-
| Get Allowance | 🟩 Completed | ❌ |
|
282
|
-
| Set Allowance | 🟩 Completed | ❌ |
|
283
|
-
| Increase Allowance | 🟩 Completed | ❌ |
|
284
|
-
| Decrease Allowance | 🟩 Completed | ❌ |
|
285
|
-
| Get Bid Suggestion | 🟩 Completed | ❌ |
|
286
|
-
| Create | 🟩 Completed | ❌ |
|
287
|
-
| Transfer | 🟩 Completed | ❌ |
|
288
|
-
| Update | 🟩 Completed | ❌ |
|
289
|
-
| Wait for finalization | 🟥 Not Started | ❌ |
|
290
|
-
| Cancel update | 🟩 Completed | ❌ |
|
291
|
-
| Burn | 🟩 Completed | ❌ |
|
292
|
-
| Get | 🟩 Completed | ❌ |
|
293
|
-
| Query | 🟩 Completed | ❌ |
|
294
|
-
| Extend storing period | 🟩 Completed | ❌ |
|
295
|
-
| Add tokens | 🟩 Completed | ❌ |
|
296
|
-
| Add update tokens | 🟩 Completed | ❌ |
|
297
|
-
| Get owner | 🟩 Completed | ❌ |
|
298
|
-
| Experimental | 🟥 Not Started | ❌ |
|
299
|
-
</details>
|
300
|
-
|
301
|
-
<details open>
|
302
|
-
<summary>
|
303
|
-
|
304
|
-
### 3️⃣ Documentation Phase
|
305
|
-
</summary>
|
306
|
-
|
307
|
-
- [ ] Write comprehensive documentation
|
308
|
-
- [x] Provide examples and use-cases
|
309
|
-
- [ ] Review and finalize documentation
|
310
|
-
</details>
|
311
|
-
|
312
|
-
<details open>
|
313
|
-
<summary>
|
314
|
-
|
315
|
-
### 4️⃣ Pre-release Phase
|
316
|
-
</summary>
|
317
|
-
|
318
|
-
- [ ] **Beta Release**
|
319
|
-
- [X] Release a beta version for testing
|
320
|
-
- [ ] Gather and address feedback
|
321
|
-
|
322
|
-
- **Bug Fixes**
|
323
|
-
- Identify and fix bugs
|
324
|
-
|
325
|
-
- [ ] **Final Testing and QA**
|
326
|
-
- [ ] Perform comprehensive testing
|
327
|
-
- [ ] Ensure the library meets quality standards
|
328
|
-
</details>
|
329
|
-
|
330
|
-
<details open>
|
331
|
-
<summary>
|
332
|
-
|
333
|
-
### 5️⃣ Release
|
334
|
-
</summary>
|
335
|
-
|
336
|
-
- [ ] Merge the first version into the main branch
|
337
|
-
- [ ] Release the v1.0.0 of the `dkg.py` library
|
338
|
-
</details>
|
339
|
-
|
340
|
-
<details open>
|
341
|
-
<summary>
|
342
|
-
|
343
|
-
### 6️⃣ Post-release
|
344
|
-
</summary>
|
345
|
-
|
346
|
-
- Monitor for any issues
|
347
|
-
- Plan for next versions based on user feedback and usage
|
348
|
-
</details>
|
349
|
-
|
350
|
-
<br/>
|
351
|
-
|
352
|
-
**Note:** This roadmap is subject to changes. Each step will be accompanied by appropriate documentation, testing and code review to maintain the quality of the library.
|
353
|
-
|
354
|
-
<br/>
|
355
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
356
|
-
|
357
219
|
## 📄 License
|
358
220
|
|
359
221
|
Distributed under the Apache-2.0 License. See `LICENSE` file for more information.
|
@@ -23,23 +23,6 @@ ___
|
|
23
23
|
</p>
|
24
24
|
</div>
|
25
25
|
|
26
|
-
</br>
|
27
|
-
|
28
|
-
> **Disclaimer: Beta Version**
|
29
|
-
>
|
30
|
-
> Welcome to the beta version of our client! This software is currently in the beta testing phase, which means it is not the final release version. As a beta version, it may still contain bugs, undergo frequent updates, and have limited features.
|
31
|
-
Important Points to Note:
|
32
|
-
|
33
|
-
> **Use at Your Own Risk:** While we have made efforts to ensure the stability and reliability of the beta version, there is a possibility of encountering unexpected issues. Please use this software at your own risk.
|
34
|
-
|
35
|
-
> **Limited Support:** As this is a beta release, our support resources may be focused on addressing critical bugs and gathering feedback from users. Therefore, support for beta versions may be limited compared to our stable releases.
|
36
|
-
|
37
|
-
> **Feedback Appreciated:** Your feedback is invaluable to us. If you encounter any issues, have suggestions, or want to share your experiences with the beta version, please let us know. Your feedback will help us improve the software for the final release.
|
38
|
-
|
39
|
-
> **Not for Production Use:** The beta version is intended for testing and evaluation purposes only. It is not recommended for use in a production environment where stability and reliability are crucial.
|
40
|
-
|
41
|
-
</br>
|
42
|
-
|
43
26
|
<details open>
|
44
27
|
<summary>
|
45
28
|
<b>Table of Contents</b>
|
@@ -60,17 +43,6 @@ Important Points to Note:
|
|
60
43
|
<li><a href="#installation">Installation</a></li>
|
61
44
|
</ul>
|
62
45
|
</li>
|
63
|
-
<li>
|
64
|
-
<a href="#📜-roadmap">📜 Roadmap</a>
|
65
|
-
<ul>
|
66
|
-
<li><a href="#1️⃣-pre-development-phase">1️⃣ Pre-development Phase</a></li>
|
67
|
-
<li><a href="#2️⃣-development-phase">2️⃣ Development Phase</a></li>
|
68
|
-
<li><a href="#3️⃣-documentation-phase">3️⃣ Documentation Phase</a></li>
|
69
|
-
<li><a href="#4️⃣-pre-release-phase">4️⃣ Pre-release Phase</a></li>
|
70
|
-
<li><a href="#5️⃣-release">5️⃣ Release</a></li>
|
71
|
-
<li><a href="#6️⃣-post-release">6️⃣ Post-release</a></li>
|
72
|
-
</ul>
|
73
|
-
</li>
|
74
46
|
<li><a href="#📄-license">📄 License</a></li>
|
75
47
|
<li><a href="#🤝-contributing">🤝 Contributing</a></li>
|
76
48
|
<li><a href="#❤️-thanks-to-all-contributors">❤️ Contributors</a></li>
|
@@ -221,117 +193,6 @@ python3 examples/demo.py
|
|
221
193
|
<br/>
|
222
194
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
223
195
|
|
224
|
-
## 📜 Roadmap
|
225
|
-
|
226
|
-
This roadmap outlines the goals for the first major release of the `dkg.py`. Each section represents a stage in the development process and the features we plan to implement.
|
227
|
-
|
228
|
-
<details open>
|
229
|
-
<summary>
|
230
|
-
|
231
|
-
### 1️⃣ Pre-development Phase
|
232
|
-
|
233
|
-
</summary>
|
234
|
-
|
235
|
-
- [x] **Requirement Analysis and Planning**
|
236
|
-
- [x] Define the project's scope
|
237
|
-
- [x] Identify the core functionalities
|
238
|
-
|
239
|
-
- [x] **Design**
|
240
|
-
- [x] Plan the library's architecture
|
241
|
-
- [x] Establish coding standards
|
242
|
-
|
243
|
-
- [ ] **Setup Development Environment**
|
244
|
-
- [x] Setup development, testing and production environments
|
245
|
-
- [ ] Add pytest config
|
246
|
-
- [ ] Add mypy config
|
247
|
-
- [ ] Add tox config ?
|
248
|
-
- [ ] Setup Continuous Integration (CI) and Continuous Deployment (CD) pipeline
|
249
|
-
</details>
|
250
|
-
|
251
|
-
<details open>
|
252
|
-
<summary>
|
253
|
-
|
254
|
-
### 2️⃣ Development Phase
|
255
|
-
</summary>
|
256
|
-
|
257
|
-
| Feature | Status | Tests coverage |
|
258
|
-
|:-:|:-:|:-:|
|
259
|
-
| Get Allowance | 🟩 Completed | ❌ |
|
260
|
-
| Set Allowance | 🟩 Completed | ❌ |
|
261
|
-
| Increase Allowance | 🟩 Completed | ❌ |
|
262
|
-
| Decrease Allowance | 🟩 Completed | ❌ |
|
263
|
-
| Get Bid Suggestion | 🟩 Completed | ❌ |
|
264
|
-
| Create | 🟩 Completed | ❌ |
|
265
|
-
| Transfer | 🟩 Completed | ❌ |
|
266
|
-
| Update | 🟩 Completed | ❌ |
|
267
|
-
| Wait for finalization | 🟥 Not Started | ❌ |
|
268
|
-
| Cancel update | 🟩 Completed | ❌ |
|
269
|
-
| Burn | 🟩 Completed | ❌ |
|
270
|
-
| Get | 🟩 Completed | ❌ |
|
271
|
-
| Query | 🟩 Completed | ❌ |
|
272
|
-
| Extend storing period | 🟩 Completed | ❌ |
|
273
|
-
| Add tokens | 🟩 Completed | ❌ |
|
274
|
-
| Add update tokens | 🟩 Completed | ❌ |
|
275
|
-
| Get owner | 🟩 Completed | ❌ |
|
276
|
-
| Experimental | 🟥 Not Started | ❌ |
|
277
|
-
</details>
|
278
|
-
|
279
|
-
<details open>
|
280
|
-
<summary>
|
281
|
-
|
282
|
-
### 3️⃣ Documentation Phase
|
283
|
-
</summary>
|
284
|
-
|
285
|
-
- [ ] Write comprehensive documentation
|
286
|
-
- [x] Provide examples and use-cases
|
287
|
-
- [ ] Review and finalize documentation
|
288
|
-
</details>
|
289
|
-
|
290
|
-
<details open>
|
291
|
-
<summary>
|
292
|
-
|
293
|
-
### 4️⃣ Pre-release Phase
|
294
|
-
</summary>
|
295
|
-
|
296
|
-
- [ ] **Beta Release**
|
297
|
-
- [X] Release a beta version for testing
|
298
|
-
- [ ] Gather and address feedback
|
299
|
-
|
300
|
-
- **Bug Fixes**
|
301
|
-
- Identify and fix bugs
|
302
|
-
|
303
|
-
- [ ] **Final Testing and QA**
|
304
|
-
- [ ] Perform comprehensive testing
|
305
|
-
- [ ] Ensure the library meets quality standards
|
306
|
-
</details>
|
307
|
-
|
308
|
-
<details open>
|
309
|
-
<summary>
|
310
|
-
|
311
|
-
### 5️⃣ Release
|
312
|
-
</summary>
|
313
|
-
|
314
|
-
- [ ] Merge the first version into the main branch
|
315
|
-
- [ ] Release the v1.0.0 of the `dkg.py` library
|
316
|
-
</details>
|
317
|
-
|
318
|
-
<details open>
|
319
|
-
<summary>
|
320
|
-
|
321
|
-
### 6️⃣ Post-release
|
322
|
-
</summary>
|
323
|
-
|
324
|
-
- Monitor for any issues
|
325
|
-
- Plan for next versions based on user feedback and usage
|
326
|
-
</details>
|
327
|
-
|
328
|
-
<br/>
|
329
|
-
|
330
|
-
**Note:** This roadmap is subject to changes. Each step will be accompanied by appropriate documentation, testing and code review to maintain the quality of the library.
|
331
|
-
|
332
|
-
<br/>
|
333
|
-
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
334
|
-
|
335
196
|
## 📄 License
|
336
197
|
|
337
198
|
Distributed under the Apache-2.0 License. See `LICENSE` file for more information.
|
@@ -34,6 +34,7 @@ from dkg.constants import (
|
|
34
34
|
PRIVATE_HISTORICAL_REPOSITORY,
|
35
35
|
)
|
36
36
|
from dkg.dataclasses import (
|
37
|
+
BidSuggestionRange,
|
37
38
|
KnowledgeAssetContentVisibility,
|
38
39
|
KnowledgeAssetEnumStates,
|
39
40
|
NodeResponseDict,
|
@@ -68,7 +69,7 @@ from dkg.utils.rdf import format_content, normalize_dataset
|
|
68
69
|
from dkg.utils.ual import format_ual, parse_ual
|
69
70
|
|
70
71
|
|
71
|
-
class
|
72
|
+
class KnowledgeAsset(Module):
|
72
73
|
def __init__(self, manager: DefaultRequestManager):
|
73
74
|
self.manager = manager
|
74
75
|
|
@@ -195,6 +196,7 @@ class ContentAsset(Module):
|
|
195
196
|
|
196
197
|
_get_asset_storage_address = Method(BlockchainRequest.get_asset_storage_address)
|
197
198
|
_create = Method(BlockchainRequest.create_asset)
|
199
|
+
_mint_paranet_knowledge_asset = Method(BlockchainRequest.mint_knowledge_asset)
|
198
200
|
|
199
201
|
_get_bid_suggestion = Method(NodeRequest.bid_suggestion)
|
200
202
|
_local_store = Method(NodeRequest.local_store)
|
@@ -207,6 +209,7 @@ class ContentAsset(Module):
|
|
207
209
|
token_amount: Wei | None = None,
|
208
210
|
immutable: bool = False,
|
209
211
|
content_type: Literal["JSON-LD", "N-Quads"] = "JSON-LD",
|
212
|
+
paranet_ual: UAL | None = None,
|
210
213
|
) -> dict[str, UAL | HexStr | dict[str, dict[str, str] | TxReceipt]]:
|
211
214
|
blockchain_id = self.manager.blockchain_provider.blockchain_id
|
212
215
|
assertions = format_content(content, content_type)
|
@@ -230,6 +233,7 @@ class ContentAsset(Module):
|
|
230
233
|
content_asset_storage_address,
|
231
234
|
public_assertion_id,
|
232
235
|
DEFAULT_HASH_FUNCTION_ID,
|
236
|
+
token_amount or BidSuggestionRange.LOW,
|
233
237
|
)["bidSuggestion"]
|
234
238
|
)
|
235
239
|
|
@@ -240,20 +244,54 @@ class ContentAsset(Module):
|
|
240
244
|
result = {"publicAssertionId": public_assertion_id, "operation": {}}
|
241
245
|
|
242
246
|
try:
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
247
|
+
if paranet_ual is None:
|
248
|
+
receipt: TxReceipt = self._create(
|
249
|
+
{
|
250
|
+
"assertionId": Web3.to_bytes(hexstr=public_assertion_id),
|
251
|
+
"size": public_assertion_metadata["size"],
|
252
|
+
"triplesNumber": public_assertion_metadata["triples_number"],
|
253
|
+
"chunksNumber": public_assertion_metadata["chunks_number"],
|
254
|
+
"tokenAmount": token_amount,
|
255
|
+
"epochsNumber": epochs_number,
|
256
|
+
"scoreFunctionId": DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS[
|
257
|
+
self.manager.blockchain_provider.environment
|
258
|
+
][blockchain_id],
|
259
|
+
"immutable_": immutable,
|
260
|
+
}
|
261
|
+
)
|
262
|
+
else:
|
263
|
+
parsed_paranet_ual = parse_ual(paranet_ual)
|
264
|
+
paranet_knowledge_asset_storage, paranet_knowledge_asset_token_id = (
|
265
|
+
parsed_paranet_ual["contract_address"],
|
266
|
+
parsed_paranet_ual["token_id"],
|
267
|
+
)
|
268
|
+
|
269
|
+
receipt: TxReceipt = self._mint_paranet_knowledge_asset(
|
270
|
+
paranet_knowledge_asset_storage,
|
271
|
+
paranet_knowledge_asset_token_id,
|
272
|
+
{
|
273
|
+
"assertionId": Web3.to_bytes(hexstr=public_assertion_id),
|
274
|
+
"size": public_assertion_metadata["size"],
|
275
|
+
"triplesNumber": public_assertion_metadata["triples_number"],
|
276
|
+
"chunksNumber": public_assertion_metadata["chunks_number"],
|
277
|
+
"tokenAmount": token_amount,
|
278
|
+
"epochsNumber": epochs_number,
|
279
|
+
"scoreFunctionId": DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS[
|
280
|
+
self.manager.blockchain_provider.environment
|
281
|
+
][blockchain_id],
|
282
|
+
"immutable_": immutable,
|
283
|
+
},
|
284
|
+
)
|
285
|
+
|
286
|
+
result["paranetId"] = Web3.to_hex(
|
287
|
+
Web3.solidity_keccak(
|
288
|
+
["address", "uint256"],
|
289
|
+
[
|
290
|
+
paranet_knowledge_asset_storage,
|
291
|
+
paranet_knowledge_asset_token_id,
|
292
|
+
],
|
293
|
+
)
|
294
|
+
)
|
257
295
|
except ContractLogicError as err:
|
258
296
|
if is_allowance_increased:
|
259
297
|
self.decrease_allowance(token_amount)
|
@@ -278,7 +316,7 @@ class ContentAsset(Module):
|
|
278
316
|
"tokenId": token_id,
|
279
317
|
"assertionId": public_assertion_id,
|
280
318
|
"assertion": assertions["public"],
|
281
|
-
"storeType": StoreTypes.TRIPLE
|
319
|
+
"storeType": StoreTypes.TRIPLE,
|
282
320
|
}
|
283
321
|
]
|
284
322
|
|
@@ -293,7 +331,7 @@ class ContentAsset(Module):
|
|
293
331
|
sort_pairs=True,
|
294
332
|
).root,
|
295
333
|
"assertion": assertions["private"],
|
296
|
-
"storeType": StoreTypes.TRIPLE
|
334
|
+
"storeType": StoreTypes.TRIPLE,
|
297
335
|
}
|
298
336
|
)
|
299
337
|
|
@@ -323,6 +361,42 @@ class ContentAsset(Module):
|
|
323
361
|
|
324
362
|
return result
|
325
363
|
|
364
|
+
_submit_knowledge_asset = Method(BlockchainRequest.submit_knowledge_asset)
|
365
|
+
|
366
|
+
def submit_to_paranet(
|
367
|
+
self, ual: UAL, paranet_ual: UAL
|
368
|
+
) -> dict[str, UAL | Address | TxReceipt]:
|
369
|
+
parsed_ual = parse_ual(ual)
|
370
|
+
knowledge_asset_storage, knowledge_asset_token_id = (
|
371
|
+
parsed_ual["contract_address"],
|
372
|
+
parsed_ual["token_id"],
|
373
|
+
)
|
374
|
+
|
375
|
+
parsed_paranet_ual = parse_ual(paranet_ual)
|
376
|
+
paranet_knowledge_asset_storage, paranet_knowledge_asset_token_id = (
|
377
|
+
parsed_paranet_ual["contract_address"],
|
378
|
+
parsed_paranet_ual["token_id"],
|
379
|
+
)
|
380
|
+
|
381
|
+
receipt: TxReceipt = self._submit_knowledge_asset(
|
382
|
+
paranet_knowledge_asset_storage,
|
383
|
+
paranet_knowledge_asset_token_id,
|
384
|
+
knowledge_asset_storage,
|
385
|
+
knowledge_asset_token_id,
|
386
|
+
)
|
387
|
+
|
388
|
+
return {
|
389
|
+
"UAL": ual,
|
390
|
+
"paranetUAL": paranet_ual,
|
391
|
+
"paranetId": Web3.to_hex(
|
392
|
+
Web3.solidity_keccak(
|
393
|
+
["address", "uint256"],
|
394
|
+
[knowledge_asset_storage, knowledge_asset_token_id],
|
395
|
+
)
|
396
|
+
),
|
397
|
+
"operation": json.loads(Web3.to_json(receipt)),
|
398
|
+
}
|
399
|
+
|
326
400
|
_transfer = Method(BlockchainRequest.transfer_asset)
|
327
401
|
|
328
402
|
def transfer(
|
@@ -396,6 +470,7 @@ class ContentAsset(Module):
|
|
396
470
|
content_asset_storage_address,
|
397
471
|
public_assertion_id,
|
398
472
|
DEFAULT_HASH_FUNCTION_ID,
|
473
|
+
token_amount or BidSuggestionRange.LOW,
|
399
474
|
)["bidSuggestion"]
|
400
475
|
)
|
401
476
|
|
@@ -427,7 +502,7 @@ class ContentAsset(Module):
|
|
427
502
|
"tokenId": token_id,
|
428
503
|
"assertionId": public_assertion_id,
|
429
504
|
"assertion": assertions["public"],
|
430
|
-
"storeType": StoreTypes.PENDING
|
505
|
+
"storeType": StoreTypes.PENDING,
|
431
506
|
}
|
432
507
|
]
|
433
508
|
|
@@ -442,7 +517,7 @@ class ContentAsset(Module):
|
|
442
517
|
sort_pairs=True,
|
443
518
|
).root,
|
444
519
|
"assertion": assertions["private"],
|
445
|
-
"storeType": StoreTypes.PENDING
|
520
|
+
"storeType": StoreTypes.PENDING,
|
446
521
|
}
|
447
522
|
)
|
448
523
|
|
@@ -460,7 +535,7 @@ class ContentAsset(Module):
|
|
460
535
|
operation_result = self.get_operation_result(operation_id, "update")
|
461
536
|
|
462
537
|
return {
|
463
|
-
"UAL":
|
538
|
+
"UAL": ual,
|
464
539
|
"publicAssertionId": public_assertion_id,
|
465
540
|
"operation": {
|
466
541
|
"operationId": operation_id,
|
@@ -499,8 +574,8 @@ class ContentAsset(Module):
|
|
499
574
|
def get(
|
500
575
|
self,
|
501
576
|
ual: UAL,
|
502
|
-
state: str | HexStr | int = KnowledgeAssetEnumStates.LATEST
|
503
|
-
content_visibility: str = KnowledgeAssetContentVisibility.ALL
|
577
|
+
state: str | HexStr | int = KnowledgeAssetEnumStates.LATEST,
|
578
|
+
content_visibility: str = KnowledgeAssetContentVisibility.ALL,
|
504
579
|
output_format: Literal["JSON-LD", "N-Quads"] = "JSON-LD",
|
505
580
|
validate: bool = True,
|
506
581
|
) -> dict[str, UAL | HexStr | list[JSONLD] | dict[str, str]]:
|
@@ -528,10 +603,10 @@ class ContentAsset(Module):
|
|
528
603
|
is_state_finalized = False
|
529
604
|
|
530
605
|
match state:
|
531
|
-
case KnowledgeAssetEnumStates.LATEST
|
606
|
+
case KnowledgeAssetEnumStates.LATEST:
|
532
607
|
public_assertion_id, is_state_finalized = handle_latest_state(token_id)
|
533
608
|
|
534
|
-
case KnowledgeAssetEnumStates.LATEST_FINALIZED
|
609
|
+
case KnowledgeAssetEnumStates.LATEST_FINALIZED:
|
535
610
|
public_assertion_id, is_state_finalized = handle_latest_finalized_state(
|
536
611
|
token_id
|
537
612
|
)
|
@@ -592,7 +667,7 @@ class ContentAsset(Module):
|
|
592
667
|
)
|
593
668
|
|
594
669
|
result = {"operation": {}}
|
595
|
-
if content_visibility != KnowledgeAssetContentVisibility.PRIVATE
|
670
|
+
if content_visibility != KnowledgeAssetContentVisibility.PRIVATE:
|
596
671
|
formatted_public_assertion = public_assertion
|
597
672
|
|
598
673
|
match output_format:
|
@@ -609,7 +684,7 @@ class ContentAsset(Module):
|
|
609
684
|
f"{output_format} isn't supported!"
|
610
685
|
)
|
611
686
|
|
612
|
-
if content_visibility == KnowledgeAssetContentVisibility.PUBLIC
|
687
|
+
if content_visibility == KnowledgeAssetContentVisibility.PUBLIC:
|
613
688
|
result = {
|
614
689
|
**result,
|
615
690
|
"asertion": formatted_public_assertion,
|
@@ -626,7 +701,7 @@ class ContentAsset(Module):
|
|
626
701
|
"status": get_public_operation_result["status"],
|
627
702
|
}
|
628
703
|
|
629
|
-
if content_visibility != KnowledgeAssetContentVisibility.PUBLIC
|
704
|
+
if content_visibility != KnowledgeAssetContentVisibility.PUBLIC:
|
630
705
|
private_assertion_link_triples = list(
|
631
706
|
filter(
|
632
707
|
lambda element: PRIVATE_ASSERTION_PREDICATE in element,
|
@@ -702,7 +777,7 @@ class ContentAsset(Module):
|
|
702
777
|
f"{output_format} isn't supported!"
|
703
778
|
)
|
704
779
|
|
705
|
-
if content_visibility == KnowledgeAssetContentVisibility
|
780
|
+
if content_visibility == KnowledgeAssetContentVisibility:
|
706
781
|
result = {
|
707
782
|
**result,
|
708
783
|
"assertion": formatted_private_assertion,
|
@@ -751,6 +826,7 @@ class ContentAsset(Module):
|
|
751
826
|
content_asset_storage_address,
|
752
827
|
latest_finalized_state,
|
753
828
|
DEFAULT_HASH_FUNCTION_ID,
|
829
|
+
token_amount or BidSuggestionRange.LOW,
|
754
830
|
)["bidSuggestion"]
|
755
831
|
)
|
756
832
|
|
@@ -806,6 +882,7 @@ class ContentAsset(Module):
|
|
806
882
|
content_asset_storage_address,
|
807
883
|
latest_finalized_state,
|
808
884
|
DEFAULT_HASH_FUNCTION_ID,
|
885
|
+
token_amount or BidSuggestionRange.LOW,
|
809
886
|
)["bidSuggestion"]
|
810
887
|
) - sum(agreement_data.tokensInfo)
|
811
888
|
|
@@ -863,6 +940,7 @@ class ContentAsset(Module):
|
|
863
940
|
content_asset_storage_address,
|
864
941
|
unfinalized_state,
|
865
942
|
DEFAULT_HASH_FUNCTION_ID,
|
943
|
+
token_amount or BidSuggestionRange.LOW,
|
866
944
|
)["bidSuggestion"]
|
867
945
|
) - sum(agreement_data.tokensInfo)
|
868
946
|
|