dkg 8.0.0a3__py3-none-any.whl → 8.0.1__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/__init__.py +1 -1
- dkg/assertion.py +2 -2
- dkg/clients/__init__.py +4 -0
- dkg/clients/async_dkg.py +109 -0
- dkg/{main.py → clients/dkg.py} +42 -21
- dkg/constants.py +117 -6
- dkg/data/interfaces/AskStorage.json +366 -0
- dkg/data/interfaces/Chronos.json +202 -0
- dkg/data/interfaces/Hub.json +294 -2
- dkg/data/interfaces/IdentityStorage.json +58 -0
- dkg/data/interfaces/{ContentAsset.json → KnowledgeCollection.json} +256 -343
- dkg/data/interfaces/KnowledgeCollectionStorage.json +2312 -0
- dkg/data/interfaces/Paranet.json +30 -214
- dkg/data/interfaces/ParanetIncentivesPoolFactory.json +18 -2
- dkg/data/interfaces/ParanetKnowledgeMinersRegistry.json +20 -4
- dkg/data/interfaces/{ParanetNeurowebIncentivesPool.json → ParanetNeuroIncentivesPool.json} +7 -7
- dkg/data/interfaces/ParanetsRegistry.json +102 -32
- dkg/data/interfaces/Token.json +146 -17
- dkg/managers/__init__.py +0 -0
- dkg/managers/async_manager.py +69 -0
- dkg/{manager.py → managers/manager.py} +5 -3
- dkg/method.py +5 -2
- dkg/modules/__init__.py +0 -0
- dkg/modules/asset/__init__.py +0 -0
- dkg/modules/asset/asset.py +739 -0
- dkg/modules/asset/async_asset.py +751 -0
- dkg/modules/async_module.py +66 -0
- dkg/modules/graph/__init__.py +0 -0
- dkg/modules/graph/async_graph.py +118 -0
- dkg/modules/graph/graph.py +94 -0
- dkg/{module.py → modules/module.py} +1 -1
- dkg/modules/network/__init__.py +0 -0
- dkg/{network.py → modules/network/network.py} +4 -4
- dkg/modules/node/__init__.py +0 -0
- dkg/modules/node/async_node.py +39 -0
- dkg/{node.py → modules/node/node.py} +2 -2
- dkg/modules/paranet/__init__.py +0 -0
- dkg/{paranet.py → modules/paranet/paranet.py} +2 -2
- dkg/providers/__init__.py +9 -2
- dkg/providers/blockchain/__init__.py +4 -0
- dkg/providers/blockchain/async_blockchain.py +245 -0
- dkg/providers/blockchain/base_blockchain.py +102 -0
- dkg/providers/{blockchain.py → blockchain/blockchain.py} +15 -96
- dkg/providers/node/__init__.py +4 -0
- dkg/providers/node/async_node_http.py +72 -0
- dkg/providers/node/base_node_http.py +25 -0
- dkg/providers/{node_http.py → node/node_http.py} +12 -10
- dkg/services/__init__.py +0 -0
- dkg/services/blockchain_services/__init__.py +0 -0
- dkg/services/blockchain_services/async_blockchain_service.py +180 -0
- dkg/services/blockchain_services/blockchain_service.py +174 -0
- dkg/services/input_service.py +183 -0
- dkg/services/node_services/__init__.py +0 -0
- dkg/services/node_services/async_node_service.py +184 -0
- dkg/services/node_services/node_service.py +167 -0
- dkg/types/__init__.py +11 -11
- dkg/utils/blockchain_request.py +68 -42
- dkg/utils/knowledge_asset_tools.py +5 -0
- dkg/utils/knowledge_collection_tools.py +248 -0
- dkg/utils/node_request.py +59 -13
- dkg/utils/rdf.py +9 -3
- {dkg-8.0.0a3.dist-info → dkg-8.0.1.dist-info}/METADATA +28 -19
- dkg-8.0.1.dist-info/RECORD +82 -0
- {dkg-8.0.0a3.dist-info → dkg-8.0.1.dist-info}/WHEEL +1 -1
- dkg/asset.py +0 -912
- dkg/data/interfaces/AssertionStorage.json +0 -229
- dkg/data/interfaces/ContentAssetStorage.json +0 -706
- dkg/data/interfaces/ServiceAgreementStorageProxy.json +0 -1314
- dkg/graph.py +0 -63
- dkg-8.0.0a3.dist-info/RECORD +0 -52
- {dkg-8.0.0a3.dist-info → dkg-8.0.1.dist-info}/LICENSE +0 -0
- {dkg-8.0.0a3.dist-info → dkg-8.0.1.dist-info}/NOTICE +0 -0
@@ -10,6 +10,76 @@
|
|
10
10
|
"stateMutability": "nonpayable",
|
11
11
|
"type": "constructor"
|
12
12
|
},
|
13
|
+
{
|
14
|
+
"inputs": [
|
15
|
+
{
|
16
|
+
"internalType": "address",
|
17
|
+
"name": "addr",
|
18
|
+
"type": "address"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"name": "AddressAlreadyInSet",
|
22
|
+
"type": "error"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"inputs": [
|
26
|
+
{
|
27
|
+
"internalType": "address",
|
28
|
+
"name": "addr",
|
29
|
+
"type": "address"
|
30
|
+
}
|
31
|
+
],
|
32
|
+
"name": "AddressDoesNotExist",
|
33
|
+
"type": "error"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"inputs": [
|
37
|
+
{
|
38
|
+
"internalType": "string",
|
39
|
+
"name": "name",
|
40
|
+
"type": "string"
|
41
|
+
}
|
42
|
+
],
|
43
|
+
"name": "ContractAlreadyExists",
|
44
|
+
"type": "error"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"inputs": [
|
48
|
+
{
|
49
|
+
"internalType": "string",
|
50
|
+
"name": "name",
|
51
|
+
"type": "string"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"name": "ContractDoesNotExist",
|
55
|
+
"type": "error"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"inputs": [],
|
59
|
+
"name": "EmptyName",
|
60
|
+
"type": "error"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"inputs": [
|
64
|
+
{
|
65
|
+
"internalType": "string",
|
66
|
+
"name": "msg",
|
67
|
+
"type": "string"
|
68
|
+
}
|
69
|
+
],
|
70
|
+
"name": "UnauthorizedAccess",
|
71
|
+
"type": "error"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"inputs": [],
|
75
|
+
"name": "ZeroAddress",
|
76
|
+
"type": "error"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"inputs": [],
|
80
|
+
"name": "ZeroAddressHub",
|
81
|
+
"type": "error"
|
82
|
+
},
|
13
83
|
{
|
14
84
|
"inputs": [
|
15
85
|
{
|
@@ -100,7 +170,7 @@
|
|
100
170
|
"type": "address"
|
101
171
|
},
|
102
172
|
{
|
103
|
-
"internalType": "enum
|
173
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
104
174
|
"name": "status",
|
105
175
|
"type": "uint8"
|
106
176
|
}
|
@@ -123,7 +193,7 @@
|
|
123
193
|
"type": "uint72"
|
124
194
|
},
|
125
195
|
{
|
126
|
-
"internalType": "enum
|
196
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
127
197
|
"name": "status",
|
128
198
|
"type": "uint8"
|
129
199
|
}
|
@@ -187,7 +257,7 @@
|
|
187
257
|
"type": "address"
|
188
258
|
}
|
189
259
|
],
|
190
|
-
"internalType": "struct
|
260
|
+
"internalType": "struct UnorderedNamedContractDynamicSet.Contract[]",
|
191
261
|
"name": "",
|
192
262
|
"type": "tuple[]"
|
193
263
|
}
|
@@ -237,7 +307,7 @@
|
|
237
307
|
"type": "bytes"
|
238
308
|
}
|
239
309
|
],
|
240
|
-
"internalType": "struct
|
310
|
+
"internalType": "struct ParanetLib.Node[]",
|
241
311
|
"name": "",
|
242
312
|
"type": "tuple[]"
|
243
313
|
}
|
@@ -337,7 +407,7 @@
|
|
337
407
|
"name": "getKnowledgeAssetsAccessPolicy",
|
338
408
|
"outputs": [
|
339
409
|
{
|
340
|
-
"internalType": "enum
|
410
|
+
"internalType": "enum ParanetLib.KnowledgeAssetsAccessPolicy",
|
341
411
|
"name": "",
|
342
412
|
"type": "uint8"
|
343
413
|
}
|
@@ -460,12 +530,12 @@
|
|
460
530
|
"type": "address"
|
461
531
|
},
|
462
532
|
{
|
463
|
-
"internalType": "enum
|
533
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
464
534
|
"name": "status",
|
465
535
|
"type": "uint8"
|
466
536
|
}
|
467
537
|
],
|
468
|
-
"internalType": "struct
|
538
|
+
"internalType": "struct ParanetLib.ParanetKnowledgeMinerAccessRequest",
|
469
539
|
"name": "",
|
470
540
|
"type": "tuple"
|
471
541
|
}
|
@@ -506,12 +576,12 @@
|
|
506
576
|
"type": "address"
|
507
577
|
},
|
508
578
|
{
|
509
|
-
"internalType": "enum
|
579
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
510
580
|
"name": "status",
|
511
581
|
"type": "uint8"
|
512
582
|
}
|
513
583
|
],
|
514
|
-
"internalType": "struct
|
584
|
+
"internalType": "struct ParanetLib.ParanetKnowledgeMinerAccessRequest[]",
|
515
585
|
"name": "",
|
516
586
|
"type": "tuple[]"
|
517
587
|
}
|
@@ -614,12 +684,12 @@
|
|
614
684
|
"type": "address"
|
615
685
|
},
|
616
686
|
{
|
617
|
-
"internalType": "enum
|
687
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
618
688
|
"name": "status",
|
619
689
|
"type": "uint8"
|
620
690
|
}
|
621
691
|
],
|
622
|
-
"internalType": "struct
|
692
|
+
"internalType": "struct ParanetLib.ParanetKnowledgeMinerAccessRequest",
|
623
693
|
"name": "",
|
624
694
|
"type": "tuple"
|
625
695
|
}
|
@@ -660,12 +730,12 @@
|
|
660
730
|
"type": "uint72"
|
661
731
|
},
|
662
732
|
{
|
663
|
-
"internalType": "enum
|
733
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
664
734
|
"name": "status",
|
665
735
|
"type": "uint8"
|
666
736
|
}
|
667
737
|
],
|
668
|
-
"internalType": "struct
|
738
|
+
"internalType": "struct ParanetLib.ParanetNodeJoinRequest",
|
669
739
|
"name": "",
|
670
740
|
"type": "tuple"
|
671
741
|
}
|
@@ -684,7 +754,7 @@
|
|
684
754
|
"name": "getMinersAccessPolicy",
|
685
755
|
"outputs": [
|
686
756
|
{
|
687
|
-
"internalType": "enum
|
757
|
+
"internalType": "enum ParanetLib.MinersAccessPolicy",
|
688
758
|
"name": "",
|
689
759
|
"type": "uint8"
|
690
760
|
}
|
@@ -749,12 +819,12 @@
|
|
749
819
|
"type": "uint72"
|
750
820
|
},
|
751
821
|
{
|
752
|
-
"internalType": "enum
|
822
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
753
823
|
"name": "status",
|
754
824
|
"type": "uint8"
|
755
825
|
}
|
756
826
|
],
|
757
|
-
"internalType": "struct
|
827
|
+
"internalType": "struct ParanetLib.ParanetNodeJoinRequest",
|
758
828
|
"name": "",
|
759
829
|
"type": "tuple"
|
760
830
|
}
|
@@ -795,12 +865,12 @@
|
|
795
865
|
"type": "uint72"
|
796
866
|
},
|
797
867
|
{
|
798
|
-
"internalType": "enum
|
868
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
799
869
|
"name": "status",
|
800
870
|
"type": "uint8"
|
801
871
|
}
|
802
872
|
],
|
803
|
-
"internalType": "struct
|
873
|
+
"internalType": "struct ParanetLib.ParanetNodeJoinRequest[]",
|
804
874
|
"name": "",
|
805
875
|
"type": "tuple[]"
|
806
876
|
}
|
@@ -843,7 +913,7 @@
|
|
843
913
|
"name": "getNodesAccessPolicy",
|
844
914
|
"outputs": [
|
845
915
|
{
|
846
|
-
"internalType": "enum
|
916
|
+
"internalType": "enum ParanetLib.NodesAccessPolicy",
|
847
917
|
"name": "",
|
848
918
|
"type": "uint8"
|
849
919
|
}
|
@@ -908,17 +978,17 @@
|
|
908
978
|
"type": "string"
|
909
979
|
},
|
910
980
|
{
|
911
|
-
"internalType": "enum
|
981
|
+
"internalType": "enum ParanetLib.NodesAccessPolicy",
|
912
982
|
"name": "nodesAccessPolicy",
|
913
983
|
"type": "uint8"
|
914
984
|
},
|
915
985
|
{
|
916
|
-
"internalType": "enum
|
986
|
+
"internalType": "enum ParanetLib.MinersAccessPolicy",
|
917
987
|
"name": "minersAccessPolicy",
|
918
988
|
"type": "uint8"
|
919
989
|
},
|
920
990
|
{
|
921
|
-
"internalType": "enum
|
991
|
+
"internalType": "enum ParanetLib.KnowledgeAssetsAccessPolicy",
|
922
992
|
"name": "knowledgeAssetsAccessPolicy",
|
923
993
|
"type": "uint8"
|
924
994
|
},
|
@@ -928,7 +998,7 @@
|
|
928
998
|
"type": "uint96"
|
929
999
|
}
|
930
1000
|
],
|
931
|
-
"internalType": "struct
|
1001
|
+
"internalType": "struct ParanetLib.ParanetMetadata",
|
932
1002
|
"name": "",
|
933
1003
|
"type": "tuple"
|
934
1004
|
}
|
@@ -1027,7 +1097,7 @@
|
|
1027
1097
|
"name": "hub",
|
1028
1098
|
"outputs": [
|
1029
1099
|
{
|
1030
|
-
"internalType": "contract
|
1100
|
+
"internalType": "contract Hub",
|
1031
1101
|
"name": "",
|
1032
1102
|
"type": "address"
|
1033
1103
|
}
|
@@ -1186,17 +1256,17 @@
|
|
1186
1256
|
"type": "string"
|
1187
1257
|
},
|
1188
1258
|
{
|
1189
|
-
"internalType": "enum
|
1259
|
+
"internalType": "enum ParanetLib.NodesAccessPolicy",
|
1190
1260
|
"name": "nodesAccessPolicy",
|
1191
1261
|
"type": "uint8"
|
1192
1262
|
},
|
1193
1263
|
{
|
1194
|
-
"internalType": "enum
|
1264
|
+
"internalType": "enum ParanetLib.MinersAccessPolicy",
|
1195
1265
|
"name": "minersAccessPolicy",
|
1196
1266
|
"type": "uint8"
|
1197
1267
|
},
|
1198
1268
|
{
|
1199
|
-
"internalType": "enum
|
1269
|
+
"internalType": "enum ParanetLib.KnowledgeAssetsAccessPolicy",
|
1200
1270
|
"name": "knowledgeAssetsAccessPolicy",
|
1201
1271
|
"type": "uint8"
|
1202
1272
|
}
|
@@ -1433,7 +1503,7 @@
|
|
1433
1503
|
"type": "bytes32"
|
1434
1504
|
},
|
1435
1505
|
{
|
1436
|
-
"internalType": "enum
|
1506
|
+
"internalType": "enum ParanetLib.KnowledgeAssetsAccessPolicy",
|
1437
1507
|
"name": "knowledgeAssetsAccessPolicy",
|
1438
1508
|
"type": "uint8"
|
1439
1509
|
}
|
@@ -1451,7 +1521,7 @@
|
|
1451
1521
|
"type": "bytes32"
|
1452
1522
|
},
|
1453
1523
|
{
|
1454
|
-
"internalType": "enum
|
1524
|
+
"internalType": "enum ParanetLib.MinersAccessPolicy",
|
1455
1525
|
"name": "minersAccessPolicy",
|
1456
1526
|
"type": "uint8"
|
1457
1527
|
}
|
@@ -1487,7 +1557,7 @@
|
|
1487
1557
|
"type": "bytes32"
|
1488
1558
|
},
|
1489
1559
|
{
|
1490
|
-
"internalType": "enum
|
1560
|
+
"internalType": "enum ParanetLib.NodesAccessPolicy",
|
1491
1561
|
"name": "nodesAccessPolicy",
|
1492
1562
|
"type": "uint8"
|
1493
1563
|
}
|
@@ -1556,7 +1626,7 @@
|
|
1556
1626
|
"type": "uint256"
|
1557
1627
|
},
|
1558
1628
|
{
|
1559
|
-
"internalType": "enum
|
1629
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
1560
1630
|
"name": "status",
|
1561
1631
|
"type": "uint8"
|
1562
1632
|
}
|
@@ -1584,7 +1654,7 @@
|
|
1584
1654
|
"type": "uint256"
|
1585
1655
|
},
|
1586
1656
|
{
|
1587
|
-
"internalType": "enum
|
1657
|
+
"internalType": "enum ParanetLib.RequestStatus",
|
1588
1658
|
"name": "status",
|
1589
1659
|
"type": "uint8"
|
1590
1660
|
}
|
dkg/data/interfaces/Token.json
CHANGED
@@ -15,6 +15,135 @@
|
|
15
15
|
"stateMutability": "nonpayable",
|
16
16
|
"type": "constructor"
|
17
17
|
},
|
18
|
+
{
|
19
|
+
"inputs": [],
|
20
|
+
"name": "AccessControlBadConfirmation",
|
21
|
+
"type": "error"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"inputs": [
|
25
|
+
{
|
26
|
+
"internalType": "address",
|
27
|
+
"name": "account",
|
28
|
+
"type": "address"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"internalType": "bytes32",
|
32
|
+
"name": "neededRole",
|
33
|
+
"type": "bytes32"
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"name": "AccessControlUnauthorizedAccount",
|
37
|
+
"type": "error"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"inputs": [
|
41
|
+
{
|
42
|
+
"internalType": "address",
|
43
|
+
"name": "spender",
|
44
|
+
"type": "address"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"internalType": "uint256",
|
48
|
+
"name": "allowance",
|
49
|
+
"type": "uint256"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"internalType": "uint256",
|
53
|
+
"name": "needed",
|
54
|
+
"type": "uint256"
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"name": "ERC20InsufficientAllowance",
|
58
|
+
"type": "error"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"inputs": [
|
62
|
+
{
|
63
|
+
"internalType": "address",
|
64
|
+
"name": "sender",
|
65
|
+
"type": "address"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"internalType": "uint256",
|
69
|
+
"name": "balance",
|
70
|
+
"type": "uint256"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"internalType": "uint256",
|
74
|
+
"name": "needed",
|
75
|
+
"type": "uint256"
|
76
|
+
}
|
77
|
+
],
|
78
|
+
"name": "ERC20InsufficientBalance",
|
79
|
+
"type": "error"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"inputs": [
|
83
|
+
{
|
84
|
+
"internalType": "address",
|
85
|
+
"name": "approver",
|
86
|
+
"type": "address"
|
87
|
+
}
|
88
|
+
],
|
89
|
+
"name": "ERC20InvalidApprover",
|
90
|
+
"type": "error"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"inputs": [
|
94
|
+
{
|
95
|
+
"internalType": "address",
|
96
|
+
"name": "receiver",
|
97
|
+
"type": "address"
|
98
|
+
}
|
99
|
+
],
|
100
|
+
"name": "ERC20InvalidReceiver",
|
101
|
+
"type": "error"
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"inputs": [
|
105
|
+
{
|
106
|
+
"internalType": "address",
|
107
|
+
"name": "sender",
|
108
|
+
"type": "address"
|
109
|
+
}
|
110
|
+
],
|
111
|
+
"name": "ERC20InvalidSender",
|
112
|
+
"type": "error"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"inputs": [
|
116
|
+
{
|
117
|
+
"internalType": "address",
|
118
|
+
"name": "spender",
|
119
|
+
"type": "address"
|
120
|
+
}
|
121
|
+
],
|
122
|
+
"name": "ERC20InvalidSpender",
|
123
|
+
"type": "error"
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"inputs": [
|
127
|
+
{
|
128
|
+
"internalType": "address",
|
129
|
+
"name": "owner",
|
130
|
+
"type": "address"
|
131
|
+
}
|
132
|
+
],
|
133
|
+
"name": "OwnableInvalidOwner",
|
134
|
+
"type": "error"
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"inputs": [
|
138
|
+
{
|
139
|
+
"internalType": "address",
|
140
|
+
"name": "account",
|
141
|
+
"type": "address"
|
142
|
+
}
|
143
|
+
],
|
144
|
+
"name": "OwnableUnauthorizedAccount",
|
145
|
+
"type": "error"
|
146
|
+
},
|
18
147
|
{
|
19
148
|
"anonymous": false,
|
20
149
|
"inputs": [
|
@@ -218,7 +347,7 @@
|
|
218
347
|
},
|
219
348
|
{
|
220
349
|
"internalType": "uint256",
|
221
|
-
"name": "
|
350
|
+
"name": "value",
|
222
351
|
"type": "uint256"
|
223
352
|
}
|
224
353
|
],
|
@@ -326,6 +455,19 @@
|
|
326
455
|
"stateMutability": "nonpayable",
|
327
456
|
"type": "function"
|
328
457
|
},
|
458
|
+
{
|
459
|
+
"inputs": [
|
460
|
+
{
|
461
|
+
"internalType": "address",
|
462
|
+
"name": "minter",
|
463
|
+
"type": "address"
|
464
|
+
}
|
465
|
+
],
|
466
|
+
"name": "grantRole",
|
467
|
+
"outputs": [],
|
468
|
+
"stateMutability": "nonpayable",
|
469
|
+
"type": "function"
|
470
|
+
},
|
329
471
|
{
|
330
472
|
"inputs": [
|
331
473
|
{
|
@@ -434,7 +576,7 @@
|
|
434
576
|
},
|
435
577
|
{
|
436
578
|
"internalType": "address",
|
437
|
-
"name": "
|
579
|
+
"name": "callerConfirmation",
|
438
580
|
"type": "address"
|
439
581
|
}
|
440
582
|
],
|
@@ -461,19 +603,6 @@
|
|
461
603
|
"stateMutability": "nonpayable",
|
462
604
|
"type": "function"
|
463
605
|
},
|
464
|
-
{
|
465
|
-
"inputs": [
|
466
|
-
{
|
467
|
-
"internalType": "address",
|
468
|
-
"name": "minter",
|
469
|
-
"type": "address"
|
470
|
-
}
|
471
|
-
],
|
472
|
-
"name": "setupRole",
|
473
|
-
"outputs": [],
|
474
|
-
"stateMutability": "nonpayable",
|
475
|
-
"type": "function"
|
476
|
-
},
|
477
606
|
{
|
478
607
|
"inputs": [
|
479
608
|
{
|
@@ -528,7 +657,7 @@
|
|
528
657
|
},
|
529
658
|
{
|
530
659
|
"internalType": "uint256",
|
531
|
-
"name": "
|
660
|
+
"name": "value",
|
532
661
|
"type": "uint256"
|
533
662
|
}
|
534
663
|
],
|
@@ -557,7 +686,7 @@
|
|
557
686
|
},
|
558
687
|
{
|
559
688
|
"internalType": "uint256",
|
560
|
-
"name": "
|
689
|
+
"name": "value",
|
561
690
|
"type": "uint256"
|
562
691
|
}
|
563
692
|
],
|
dkg/managers/__init__.py
ADDED
File without changes
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
18
|
+
from typing import Any, Type
|
19
|
+
|
20
|
+
from dkg.dataclasses import BlockchainResponseDict, NodeResponseDict
|
21
|
+
from dkg.exceptions import InvalidRequest
|
22
|
+
from dkg.utils.blockchain_request import ContractInteraction, JSONRPCRequest
|
23
|
+
from dkg.utils.node_request import NodeCall
|
24
|
+
from dkg.providers.node.async_node_http import AsyncNodeHTTPProvider
|
25
|
+
from dkg.providers.blockchain.async_blockchain import AsyncBlockchainProvider
|
26
|
+
|
27
|
+
|
28
|
+
class AsyncRequestManager:
|
29
|
+
def __init__(
|
30
|
+
self,
|
31
|
+
node_provider: AsyncNodeHTTPProvider,
|
32
|
+
blockchain_provider: AsyncBlockchainProvider,
|
33
|
+
):
|
34
|
+
self._node_provider = node_provider
|
35
|
+
self._blockchain_provider = blockchain_provider
|
36
|
+
|
37
|
+
@property
|
38
|
+
def node_provider(self) -> AsyncNodeHTTPProvider:
|
39
|
+
return self._node_provider
|
40
|
+
|
41
|
+
@node_provider.setter
|
42
|
+
def node_provider(self, node_provider: AsyncNodeHTTPProvider) -> None:
|
43
|
+
self._node_provider = node_provider
|
44
|
+
|
45
|
+
@property
|
46
|
+
def blockchain_provider(self) -> AsyncBlockchainProvider:
|
47
|
+
return self._blockchain_provider
|
48
|
+
|
49
|
+
@blockchain_provider.setter
|
50
|
+
def blockchain_provider(self, blockchain_provider: AsyncBlockchainProvider) -> None:
|
51
|
+
self._blockchain_provider = blockchain_provider
|
52
|
+
|
53
|
+
async def blocking_request(
|
54
|
+
self,
|
55
|
+
request_type: Type[JSONRPCRequest | ContractInteraction | NodeCall],
|
56
|
+
request_params: dict[str, Any],
|
57
|
+
) -> BlockchainResponseDict | NodeResponseDict:
|
58
|
+
if issubclass(request_type, JSONRPCRequest):
|
59
|
+
return await self.blockchain_provider.make_json_rpc_request(
|
60
|
+
**request_params
|
61
|
+
)
|
62
|
+
elif issubclass(request_type, ContractInteraction):
|
63
|
+
return await self.blockchain_provider.call_function(**request_params)
|
64
|
+
elif issubclass(request_type, NodeCall):
|
65
|
+
return await self.node_provider.make_request(**request_params)
|
66
|
+
else:
|
67
|
+
raise InvalidRequest(
|
68
|
+
"Invalid Request. Manager can only process Blockchain/Node requests."
|
69
|
+
)
|
@@ -28,8 +28,8 @@ class DefaultRequestManager:
|
|
28
28
|
def __init__(
|
29
29
|
self, node_provider: NodeHTTPProvider, blockchain_provider: BlockchainProvider
|
30
30
|
):
|
31
|
-
self.
|
32
|
-
self.
|
31
|
+
self.node_provider = node_provider
|
32
|
+
self.blockchain_provider = blockchain_provider
|
33
33
|
|
34
34
|
@property
|
35
35
|
def node_provider(self) -> NodeHTTPProvider:
|
@@ -40,7 +40,9 @@ class DefaultRequestManager:
|
|
40
40
|
self._node_provider = node_provider
|
41
41
|
|
42
42
|
@property
|
43
|
-
def blockchain_provider(
|
43
|
+
def blockchain_provider(
|
44
|
+
self,
|
45
|
+
) -> BlockchainProvider:
|
44
46
|
return self._blockchain_provider
|
45
47
|
|
46
48
|
@blockchain_provider.setter
|
dkg/method.py
CHANGED
@@ -30,7 +30,8 @@ from dkg.utils.node_request import NodeCall
|
|
30
30
|
from dkg.utils.string_transformations import snake_to_camel
|
31
31
|
|
32
32
|
if TYPE_CHECKING:
|
33
|
-
from dkg.module import Module
|
33
|
+
from dkg.modules.module import Module
|
34
|
+
from dkg.modules.async_module import AsyncModule
|
34
35
|
|
35
36
|
|
36
37
|
class Method(Generic[TFunc]):
|
@@ -38,7 +39,9 @@ class Method(Generic[TFunc]):
|
|
38
39
|
self.action = action
|
39
40
|
|
40
41
|
def __get__(
|
41
|
-
self,
|
42
|
+
self,
|
43
|
+
obj: "Module | AsyncModule | None" = None,
|
44
|
+
_: Type["Module | AsyncModule"] | None = None,
|
42
45
|
) -> TFunc:
|
43
46
|
if obj is None:
|
44
47
|
raise TypeError(
|
dkg/modules/__init__.py
ADDED
File without changes
|
File without changes
|