Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V8] V8 release create operations #174

Open
wants to merge 30 commits into
base: v8/develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f048691
Create, localStore, update v8 SDK updates
brkagithub Nov 22, 2024
b75abb9
Minor changes for ot node
brkagithub Nov 25, 2024
4755dea
Remove contract param from node API publish
brkagithub Nov 25, 2024
9664a97
Merge branch 'v8/develop' into v8/release-create-operation
brkagithub Nov 25, 2024
4de777a
Rename node api publish params + small fix
brkagithub Nov 25, 2024
ca0eea9
check whether status is not completed instead of whether it failed
brkagithub Nov 26, 2024
f65ac32
Update demo.js
brkagithub Nov 26, 2024
ec65446
Add create collection
brkagithub Nov 26, 2024
10eb6c6
Add missing constant
brkagithub Nov 26, 2024
9590770
Trim start and trim end each triple
brkagithub Nov 26, 2024
07c64f2
Updated dkg-evm-module, added publishOperationId argument
u-hubar Nov 28, 2024
0ee77a4
Added addLabels function and condition validation
ilijaMar Nov 29, 2024
562e616
Added addLabels function and condition validation (#177)
ilijaMar Nov 29, 2024
b533da6
[V8] Implement graph.get (#176)
aleksaelezovic Nov 29, 2024
6e99e46
Revert "Added addLabels function and condition validation (#177)" (#178)
Mihajlo-Pavlovic Nov 29, 2024
476d7e0
Added extra <>
ilijaMar Dec 3, 2024
ede5a0e
Changes for get follow the node (#180)
Mihajlo-Pavlovic Dec 3, 2024
3239571
Added LABEL_PREFIX constant
ilijaMar Dec 3, 2024
92ad383
[V8] Implement graph.query (#175)
aleksaelezovic Dec 4, 2024
e9d1009
Finality implementation
brkagithub Dec 4, 2024
f255370
Merge remote-tracking branch 'origin/v8/release-create-operation' int…
brkagithub Dec 4, 2024
19796cf
Improve finality dkg js
brkagithub Dec 4, 2024
d379bf1
Merge pull request #184 from OriginTrail/feature/node-finality
brkagithub Dec 4, 2024
fecfff7
Merge pull request #179 from OriginTrail/v8/addLabels
brkagithub Dec 4, 2024
2700326
fix query api
Mihajlo-Pavlovic Dec 4, 2024
e364e82
fix query api
Mihajlo-Pavlovic Dec 4, 2024
ca645fc
Merge branch 'v8/release-create-operation' into v8/feature/query
Mihajlo-Pavlovic Dec 4, 2024
28819f4
Merge pull request #183 from OriginTrail/v8/feature/query
brkagithub Dec 4, 2024
082d333
Changed package to use ES JS, added new assertion-tools
u-hubar Dec 4, 2024
2199560
New option–for–get to fetch subject ual (#189)
Mihajlo-Pavlovic Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 51 additions & 79 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
* @constant {number} MAX_FILE_SIZE
* - Max file size for publish
*/
const MAX_FILE_SIZE = 524288000;
export const MAX_FILE_SIZE = 524288000;

/**
* @constant {number} DID_PREFIX
* - DID prefix for graph database
*/
const DID_PREFIX = 'did:dkg';
export const DID_PREFIX = 'did:dkg';

const PRIVATE_ASSERTION_PREDICATE = 'https://ontology.origintrail.io/dkg/1.0#privateAssertionID';
export const PRIVATE_ASSERTION_PREDICATE =
'https://ontology.origintrail.io/dkg/1.0#privateAssertionID';

const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';

const BLOCKCHAINS = {
export const LABEL_PREFIX = '<http://example.org/label>';

export const BLOCKCHAINS = {
development: {
'hardhat1:31337': {
rpc: 'http://localhost:8545',
Expand All @@ -25,7 +28,12 @@ const BLOCKCHAINS = {
hubContract: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
},
},
devnet: {},
devnet: {
'base:84532': {
hubContract: '0x3e5dd82e7529F4e55AA64893D8f8879AE14BF87D',
rpc: 'https://sepolia.base.org',
},
},
stabledevnet_staging: {
'base:84532': {
hubContract: '0xAB4A4794Fc1F415C24807B947280aCa8dC492238',
Expand All @@ -48,37 +56,37 @@ const BLOCKCHAINS = {
mainnet: {},
};

const PARANET_NODES_ACCESS_POLICY = {
export const PARANET_NODES_ACCESS_POLICY = {
OPEN: 0,
CURATED: 1,
};

const PARANET_MINERS_ACCESS_POLICY = {
export const PARANET_MINERS_ACCESS_POLICY = {
OPEN: 0,
CURATED: 1,
};

const INCENTIVE_TYPE = {
export const INCENTIVE_TYPE = {
NEUROWEB: 'Neuroweb',
};

const BLOCKCHAINS_RENAME_PAIRS = {
export const BLOCKCHAINS_RENAME_PAIRS = {
hardhat1: 'hardhat1:31337',
hardhat2: 'hardhat2:31337',
'otp::devnet': 'otp:2160',
'otp::testnet': 'otp:20430',
'otp::mainnet': 'otp:2043',
};

const MAX_BLOCKCHAIN_CALL_RETRIES = 3;
export const MAX_BLOCKCHAIN_CALL_RETRIES = 3;

const TRANSACTION_RETRY_ERRORS = [
export const TRANSACTION_RETRY_ERRORS = [
'transaction was not mined',
'already known',
'replacement transaction underpriced',
];

const WEBSOCKET_PROVIDER_OPTIONS = {
export const WEBSOCKET_PROVIDER_OPTIONS = {
reconnect: {
auto: true,
delay: 1000, // ms
Expand All @@ -90,78 +98,77 @@ const WEBSOCKET_PROVIDER_OPTIONS = {
},
};

const OPERATIONS = {
export const OPERATIONS = {
PUBLISH: 'publish',
GET: 'get',
LOCAL_STORE: 'local-store',
QUERY: 'query',
PUBLISH_PARANET: 'publishParanet',
FINALITY: 'finality',
};

const OPERATION_STATUSES = {
export const OPERATION_STATUSES = {
PENDING: 'PENDING',
COMPLETED: 'COMPLETED',
FAILED: 'FAILED',
};

const ASSERTION_STATES = {
export const OPERATION_DELAYS = {
FINALITY: 5000,
};

export const ASSERTION_STATES = {
LATEST: 'latest',
LATEST_FINALIZED: 'latest_finalized',
};

const CONTENT_TYPES = {
export const CONTENT_TYPES = {
PUBLIC: 'public',
PRIVATE: 'private',
ALL: 'all',
};

const GET_OUTPUT_FORMATS = {
export const GET_OUTPUT_FORMATS = {
N_QUADS: 'n-quads',
JSON_LD: 'json-ld',
};

const ASSET_STATES = {
LATEST: 'LATEST',
FINALIZED: 'LATEST_FINALIZED',
};

const STORE_TYPES = {
export const STORE_TYPES = {
TRIPLE: 'TRIPLE',
TRIPLE_PARANET: 'TRIPLE_PARANET',
PENDING: 'PENDING',
};

const GRAPH_LOCATIONS = {
export const GRAPH_LOCATIONS = {
PUBLIC_KG: 'PUBLIC_KG',
LOCAL_KG: 'LOCAL_KG',
};

const GRAPH_STATES = {
export const GRAPH_STATES = {
CURRENT: 'CURRENT',
HISTORICAL: 'HISTORICAL',
};

const OT_NODE_TRIPLE_STORE_REPOSITORIES = {
export const OT_NODE_TRIPLE_STORE_REPOSITORIES = {
PUBLIC_CURRENT: 'publicCurrent',
PUBLIC_HISTORY: 'publicHistory',
PRIVATE_CURRENT: 'privateCurrent',
PRIVATE_HISTORY: 'privateHistory',
};

const QUERY_TYPES = {
export const QUERY_TYPES = {
CONSTRUCT: 'CONSTRUCT',
SELECT: 'SELECT',
};

const OPERATIONS_STEP_STATUS = {
export const OPERATIONS_STEP_STATUS = {
INCREASE_ALLOWANCE_COMPLETED: 'INCREASE_ALLOWANCE_COMPLETED',
CREATE_ASSET_COMPLETED: 'CREATE_ASSET_COMPLETED',
NETWORK_PUBLISH_COMPLETED: 'NETWORK_PUBLISH_COMPLETED',
};

const DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY = 0.5;
export const DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY = 0.5;

const DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
export const DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
development: { 'hardhat1:31337': 2, 'hardhat2:31337': 2, 'otp:2043': 2 },
devnet: {
'otp:2160': 2,
Expand All @@ -186,15 +193,15 @@ const DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS = {
},
};

const DEFAULT_NEUROWEB_FINALITY_PARAMETERS = {
export const DEFAULT_NEUROWEB_FINALITY_PARAMETERS = {
WAIT_NEUROWEB_TX_FINALIZATION: false,
TX_FINALITY_POLLING_INTERVAL: 6_000,
TX_FINALITY_MAX_WAIT_TIME: 60_000,
TX_REMINING_POLLING_INTERVAL: 6_000,
TX_REMINING_MAX_WAIT_TIME: 60_000,
};

const DEFAULT_PARAMETERS = {
export const DEFAULT_PARAMETERS = {
ENVIRONMENT: 'mainnet',
PORT: 8900,
FREQUENCY: 5,
Expand All @@ -203,7 +210,8 @@ const DEFAULT_PARAMETERS = {
IMMUTABLE: false,
VALIDATE: true,
OUTPUT_FORMAT: GET_OUTPUT_FORMATS.JSON_LD,
STATE: ASSET_STATES.LATEST,
STATE: null,
INCLUDE_METADATA: false,
CONTENT_TYPE: CONTENT_TYPES.PUBLIC,
GRAPH_LOCATION: GRAPH_LOCATIONS.LOCAL_KG,
GRAPH_STATE: GRAPH_STATES.CURRENT,
Expand All @@ -213,60 +221,24 @@ const DEFAULT_PARAMETERS = {
GAS_LIMIT_MULTIPLIER: 1,
};

const DEFAULT_GAS_PRICE = {
export const DEFAULT_GAS_PRICE = {
GNOSIS: '20',
OTP: '1',
};

const LOW_BID_SUGGESTION = 'low';
const MED_BID_SUGGESTION = 'med';
const HIGH_BID_SUGGESTION = 'high';
const ALL_BID_SUGGESTION = 'all';
const BID_SUGGESTION_RANGE_ENUM = [
export const LOW_BID_SUGGESTION = 'low';
export const MED_BID_SUGGESTION = 'med';
export const HIGH_BID_SUGGESTION = 'high';
export const ALL_BID_SUGGESTION = 'all';
export const BID_SUGGESTION_RANGE_ENUM = [
LOW_BID_SUGGESTION,
MED_BID_SUGGESTION,
HIGH_BID_SUGGESTION,
ALL_BID_SUGGESTION,
];

const PARANET_KNOWLEDGE_ASSET_ACCESS_POLICY = {
export const PARANET_KNOWLEDGE_ASSET_ACCESS_POLICY = {
OPEN: 0,
};

module.exports = {
MAX_FILE_SIZE,
DID_PREFIX,
PRIVATE_ASSERTION_PREDICATE,
ZERO_ADDRESS,
BLOCKCHAINS,
BLOCKCHAINS_RENAME_PAIRS,
MAX_BLOCKCHAIN_CALL_RETRIES,
TRANSACTION_RETRY_ERRORS,
WEBSOCKET_PROVIDER_OPTIONS,
OPERATIONS,
OPERATION_STATUSES,
ASSERTION_STATES,
CONTENT_TYPES,
GET_OUTPUT_FORMATS,
INCENTIVE_TYPE,
ASSET_STATES,
STORE_TYPES,
GRAPH_LOCATIONS,
GRAPH_STATES,
OT_NODE_TRIPLE_STORE_REPOSITORIES,
QUERY_TYPES,
OPERATIONS_STEP_STATUS,
DEFAULT_GET_LOCAL_STORE_RESULT_FREQUENCY,
DEFAULT_PROXIMITY_SCORE_FUNCTIONS_PAIR_IDS,
DEFAULT_NEUROWEB_FINALITY_PARAMETERS,
DEFAULT_PARAMETERS,
DEFAULT_GAS_PRICE,
LOW_BID_SUGGESTION,
MED_BID_SUGGESTION,
HIGH_BID_SUGGESTION,
ALL_BID_SUGGESTION,
BID_SUGGESTION_RANGE_ENUM,
PARANET_NODES_ACCESS_POLICY,
PARANET_MINERS_ACCESS_POLICY,
PARANET_KNOWLEDGE_ASSET_ACCESS_POLICY,
};
export const CHUNK_BYTE_SIZE = 32;
13 changes: 7 additions & 6 deletions examples/curated-paranet-demo.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const jsonld = require('jsonld');
const DKG = require('../index.js');
import jsonld from 'jsonld';
import DKG from '../index.js';

import {
PARANET_NODES_ACCESS_POLICY,
PARANET_MINERS_ACCESS_POLICY,
} from '../constants.js';

const ENVIRONMENT = 'development';
const OT_NODE_HOSTNAME = 'http://localhost';
const OT_NODE_PORT = '8900';
const PUBLIC_KEY = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266';
const PRIVATE_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';
const {
PARANET_NODES_ACCESS_POLICY,
PARANET_MINERS_ACCESS_POLICY,
} = require('../constants.js');

const DkgClient = new DKG({
environment: ENVIRONMENT,
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-private.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DKG = require('../index.js');
import DKG from '../index.js';

const ENVIRONMENT = 'development';
const OT_NODE_HOSTNAME = 'http://localhost';
Expand Down
Loading