dkg.js 6.0.0 → 6.0.2

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.
package/.eslintrc.js CHANGED
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  env: {
3
+ es2020: true,
3
4
  es6: true,
4
5
  browser: true,
5
6
  node: true,
@@ -29,4 +30,5 @@ module.exports = {
29
30
  },
30
31
  },
31
32
  ],
33
+ ignorePatterns: ['/dist/*'],
32
34
  };
package/README.md CHANGED
@@ -4,8 +4,6 @@
4
4
 
5
5
  **Javascript library for interaction with the OriginTrail Decentralized Knowledge Graph**
6
6
 
7
- **Note**: This library is currently in beta, so you can expect issues to arise. We'd appreciate that if you do run into trouble, you [open up an issue on this repository](https://github.com/OriginTrail/dkg.js/issues) and let us know.
8
- Also, there are two actively maintained versions, v5 and v6, make sure you are using the appropriate one.
9
7
  The official OriginTrail documentation for v6 can be found [here](https://docs.origintrail.io/dkg-v6-upcoming-version/introduction-to-dkg-v6-start-here).
10
8
 
11
9
 
@@ -53,7 +51,7 @@ More information is available on the OriginTrail [website](https://origintrail.i
53
51
 
54
52
  This library provides an interface into the OriginTrail Decentralized Knowledge Graph, enabling:
55
53
 
56
- * provisioning & updating assets on the public DKG
54
+ * creating & updating assets on the public DKG
57
55
  * network and local querying of information based on topics and identifiers
58
56
  * verifying the integrity of queried data
59
57
 
package/constants.js CHANGED
@@ -18,10 +18,22 @@ module.exports.BLOCKCHAINS = {
18
18
  rpc: 'http://localhost:7545',
19
19
  hubContract: '0x209679fA3B658Cd0fC74473aF28243bfe78a9b12',
20
20
  },
21
+ hardhat: {
22
+ rpc: 'http://localhost:8545',
23
+ hubContract: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
24
+ },
21
25
  polygon: {
22
26
  rpc: 'https://matic-mumbai.chainstacklabs.com',
23
27
  hubContract: '0xdaa16AC171CfE8Df6F79C06E7EEAb2249E2C9Ec8', // TODO: change to Asset Contract
24
28
  },
29
+ 'otp::alphanet': {
30
+ rpc: 'http://parachain-alphanet-02.origin-trail.network:9933',
31
+ hubContract: '0x7585a99C5C150a08f5CDeFD16465C6De8D41EbbD',
32
+ },
33
+ 'otp::devnet': {
34
+ rpc: 'https://lofar-tm-rpc.origin-trail.network',
35
+ hubContract: '0x833048F6e6BEa78E0AAdedeCd2Dc2231dda443FB',
36
+ },
25
37
  'otp::testnet': {
26
38
  rpc: 'https://lofar-testnet.origin-trail.network',
27
39
  hubContract: '0xBbfF7Ea6b2Addc1f38A0798329e12C08f03750A6',
@@ -44,19 +56,12 @@ module.exports.WEBSOCKET_PROVIDER_OPTIONS = {
44
56
  },
45
57
  };
46
58
 
47
- module.exports.PUBLISH_TRIPLES_NUMBER = 10;
48
- module.exports.PUBLISH_CHUNKS_NUMBER = 10;
49
- module.exports.PUBLISH_EPOCHS_NUM = 5;
50
- module.exports.PUBLISH_TOKEN_AMOUNT = 15;
51
- module.exports.DEFAULT_HASH_FUNCTION_ID = 1;
52
- module.exports.DEFAULT_GET_OPERATION_RESULT_FREQUENCY = 5;
53
- module.exports.DEFAULT_GET_OPERATION_RESULT_MAX_NUM_RETRIES = 5;
54
- module.exports.DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY = 0.5;
55
-
56
59
  module.exports.OPERATIONS = {
57
60
  PUBLISH: 'publish',
58
61
  GET: 'get',
62
+ UPDATE: 'update',
59
63
  LOCAL_STORE: 'local-store',
64
+ QUERY: 'query',
60
65
  };
61
66
 
62
67
  module.exports.OPERATION_STATUSES = {
@@ -65,13 +70,73 @@ module.exports.OPERATION_STATUSES = {
65
70
  FAILED: 'FAILED',
66
71
  };
67
72
 
73
+ module.exports.ASSERTION_STATES = {
74
+ LATEST: 'latest',
75
+ LATEST_FINALIZED: 'latest_finalized',
76
+ };
77
+
78
+ module.exports.CONTENT_TYPES = {
79
+ PUBLIC: 'public',
80
+ PRIVATE: 'private',
81
+ ALL: 'all',
82
+ };
83
+
68
84
  module.exports.GET_OUTPUT_FORMATS = {
69
85
  N_QUADS: 'n-quads',
70
86
  JSON_LD: 'json-ld',
71
87
  };
72
88
 
89
+ module.exports.ASSET_STATES = {
90
+ LATEST: 'LATEST',
91
+ FINALIZED: 'LATEST_FINALIZED',
92
+ };
93
+
94
+ module.exports.STORE_TYPES = {
95
+ TRIPLE: 'TRIPLE',
96
+ PENDING: 'PENDING',
97
+ };
98
+
99
+ module.exports.GRAPH_LOCATIONS = {
100
+ PUBLIC_KG: 'PUBLIC_KG',
101
+ LOCAL_KG: 'LOCAL_KG',
102
+ };
103
+
104
+ module.exports.GRAPH_STATES = {
105
+ CURRENT: 'CURRENT',
106
+ HISTORICAL: 'HISTORICAL',
107
+ };
108
+
109
+ module.exports.OT_NODE_TRIPLE_STORE_REPOSITORIES = {
110
+ PUBLIC_CURRENT: 'publicCurrent',
111
+ PUBLIC_HISTORY: 'publicHistory',
112
+ PRIVATE_CURRENT: 'privateCurrent',
113
+ PRIVATE_HISTORY: 'privateHistory',
114
+ };
115
+
116
+ module.exports.QUERY_TYPES = {
117
+ CONSTRUCT: 'CONSTRUCT',
118
+ SELECT: 'SELECT',
119
+ };
120
+
73
121
  module.exports.OPERATIONS_STEP_STATUS = {
74
122
  INCREASE_ALLOWANCE_COMPLETED: 'INCREASE_ALLOWANCE_COMPLETED',
75
123
  CREATE_ASSET_COMPLETED: 'CREATE_ASSET_COMPLETED',
76
124
  NETWORK_PUBLISH_COMPLETED: 'NETWORK_PUBLISH_COMPLETED',
77
125
  };
126
+
127
+ module.exports.DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY = 0.5;
128
+
129
+ module.exports.DEFAULT_PARAMETERS = {
130
+ PORT: 8900,
131
+ FREQUENCY: 5,
132
+ MAX_NUMBER_OF_RETRIES: 5,
133
+ HASH_FUNCTION_ID: 1,
134
+ SCORE_FUNCTION_ID: 1,
135
+ IMMUTABLE: false,
136
+ VALIDATE: true,
137
+ OUTPUT_FORMAT: this.GET_OUTPUT_FORMATS.JSON_LD,
138
+ STATE: this.ASSET_STATES.LATEST,
139
+ CONTENT_TYPE: this.CONTENT_TYPES.PUBLIC,
140
+ GRAPH_LOCATION: this.GRAPH_LOCATIONS.LOCAL_KG,
141
+ GRAPH_STATE: this.GRAPH_STATES.CURRENT,
142
+ };