Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
1ec72d4
Integrated with KCs
br41nlet Dec 13, 2024
65098c6
done
Mihajlo-Pavlovic Dec 13, 2024
7aa9020
fix 1
Mihajlo-Pavlovic Dec 13, 2024
d38c5f2
rename 1
Mihajlo-Pavlovic Dec 13, 2024
7312cc1
Add tokens count
Mihajlo-Pavlovic Dec 13, 2024
c361289
Add last fixes
Mihajlo-Pavlovic Dec 13, 2024
018caf4
fixes
Mihajlo-Pavlovic Dec 13, 2024
a818c10
Bumped package version
br41nlet Dec 13, 2024
af89ee2
Fixes for blockchain
Mihajlo-Pavlovic Dec 13, 2024
ce386dd
simplify code
Mihajlo-Pavlovic Dec 14, 2024
236dab6
improve
Mihajlo-Pavlovic Dec 14, 2024
ec61366
remove redundancy
Mihajlo-Pavlovic Dec 14, 2024
1805307
fix
Mihajlo-Pavlovic Dec 14, 2024
457fd9d
Merge branch 'v8/kcs-integration' into v8/public-private-pairing-rework
Mihajlo-Pavlovic Dec 16, 2024
8a1fc08
Merge pull request #195 from OriginTrail/v8/public-private-pairing-re…
Mihajlo-Pavlovic Dec 16, 2024
b1f031b
Get improvment
Mihajlo-Pavlovic Dec 16, 2024
a13370f
try fix esm/cjs compat
aleksaelezovic Dec 16, 2024
775490f
depend on correct (new) assertion-tools version
aleksaelezovic Dec 16, 2024
a370fd3
Merge branch 'v8/kcs-integration' into v8/fix-esm-compat
br41nlet Dec 16, 2024
7cacc3d
Merge pull request #198 from aleksaelezovic/v8/fix-esm-compat
br41nlet Dec 16, 2024
0bb85dd
Merged
br41nlet Dec 16, 2024
90f484c
fix webpack issues
aleksaelezovic Dec 17, 2024
42527cd
new build
aleksaelezovic Dec 17, 2024
23be6cc
Merge pull request #199 from aleksaelezovic/v8/fix-esm-compat
br41nlet Dec 17, 2024
f7fc11a
Updated package
br41nlet Dec 17, 2024
0e75363
Adding api version
ilijaMar Dec 17, 2024
f87a70b
Changed default from v0 to v1
ilijaMar Dec 17, 2024
256a583
Asset create calls graph create
ilijaMar Dec 17, 2024
618b94a
Updated graph create to newer version
ilijaMar Dec 17, 2024
43be461
Private representation added with public sujbect if pair exsits
Mihajlo-Pavlovic Dec 17, 2024
9b8fc7f
remove token count
Mihajlo-Pavlovic Dec 17, 2024
2a3ac69
Swaped graph and asset
ilijaMar Dec 18, 2024
a312781
Repositories support
brkagithub Dec 18, 2024
966b5f9
Fixes and enable bid suggestion
Mihajlo-Pavlovic Dec 18, 2024
5d9bcbf
Merge pull request #201 from OriginTrail/remove-private-representatio…
Mihajlo-Pavlovic Dec 18, 2024
2699c3a
Merge pull request #202 from OriginTrail/v8/repositories-support
Mihajlo-Pavlovic Dec 18, 2024
e8b92b2
Changed max file size
ilijaMar Dec 18, 2024
a450f17
Merge branch 'v8/kcs-integration' into v8/addintApiVersion
Mihajlo-Pavlovic Dec 18, 2024
d57a0a6
Merge pull request #200 from OriginTrail/v8/addintApiVersion
Mihajlo-Pavlovic Dec 18, 2024
f7d9934
Integration + remove paranet UAL from create + remove update
brkagithub Dec 18, 2024
7b688d0
Merge remote-tracking branch 'origin/v8/kcs-integration' into v8/inte…
brkagithub Dec 18, 2024
08b4345
Merge branch 'v8/kcs-integration' into v8/integrate-w-new-contracts
brkagithub Dec 18, 2024
1a816ec
Merge pull request #203 from OriginTrail/v8/integrate-w-new-contracts
brkagithub Dec 18, 2024
cb85d31
remove extra create
brkagithub Dec 18, 2024
8bb83cd
Add missing imports
brkagithub Dec 18, 2024
a470054
Release sigma dkg.js
brkagithub Dec 18, 2024
a8d05ad
Add new hubs and update version
brkagithub Dec 19, 2024
5257fa3
fix ask, add new hub for testnet
brkagithub Dec 19, 2024
1562d2f
Release new version
brkagithub Dec 20, 2024
004a012
Push dkg min js
brkagithub Dec 20, 2024
58644fe
Bump version
brkagithub Dec 20, 2024
524987f
Ayo sigma boy
br41nlet Dec 20, 2024
467e382
Add hubs to constants
Mihajlo-Pavlovic Dec 20, 2024
d3b4f28
version bump
Mihajlo-Pavlovic Dec 20, 2024
3837456
Merge pull request #205 from OriginTrail/add-testnet-hubs
Mihajlo-Pavlovic Dec 20, 2024
c5359e9
Implement correct publishing cost formula
Mihajlo-Pavlovic Dec 20, 2024
49f7d8c
Version bump
Mihajlo-Pavlovic Dec 20, 2024
451c729
Add new hubs
brkagithub Dec 23, 2024
f617d1a
Dont send chunk size, send immutable
brkagithub Dec 23, 2024
f4dfc16
Update hubs again
brkagithub Dec 23, 2024
c01ef75
Merge pull request #206 from OriginTrail/improvement/add-other-testne…
brkagithub Dec 23, 2024
5613ec9
Fixes for RC
Mihajlo-Pavlovic Dec 24, 2024
0241af8
Update newest hubs
brkagithub Dec 24, 2024
b951c8f
Bump version
brkagithub Dec 24, 2024
a239d72
Merge branch 'v8/kcs-integration' into improvement/add-other-testnet-…
Mihajlo-Pavlovic Dec 24, 2024
1387f37
Merge pull request #207 from OriginTrail/improvement/add-other-testne…
Mihajlo-Pavlovic Dec 24, 2024
a05e7ed
Bump version and hubs
brkagithub Dec 25, 2024
abd1008
sigma boy
brkagithub Dec 25, 2024
df7e392
remove console log
brkagithub Dec 25, 2024
fe99ddd
fix bid
Mihajlo-Pavlovic Dec 25, 2024
8a4f834
Fixes
Mihajlo-Pavlovic Dec 25, 2024
8596691
Fix get
Mihajlo-Pavlovic Dec 25, 2024
eb8d18a
Merge pull request #208 from OriginTrail/improvement/add-other-testne…
brkagithub Dec 26, 2024
31fc380
8.0.0
brkagithub Dec 26, 2024
7959e7a
min js
brkagithub Dec 26, 2024
9a66f9f
Change oracle for gnosis
brkagithub Dec 26, 2024
f498b20
dd try catch to gnosis gas oracle
brkagithub Dec 26, 2024
a701d09
PR feedback
brkagithub Dec 26, 2024
198a731
Run build
Mihajlo-Pavlovic Dec 26, 2024
a1e019d
Merge pull request #210 from OriginTrail/fix/gnosis-gas-price
Mihajlo-Pavlovic Dec 26, 2024
b71d768
version bump
Mihajlo-Pavlovic Dec 26, 2024
5d94b7c
correct version for npm
Mihajlo-Pavlovic Dec 26, 2024
00a8886
Change defaults for other blockchains, fix defaulting
brkagithub Dec 26, 2024
d9bca33
merge
brkagithub Dec 26, 2024
8611005
Merge remote-tracking branch 'origin/v8/kcs-integration' into fix/gno…
brkagithub Dec 26, 2024
ac801ae
Bump verison, build again, fix typos
brkagithub Dec 26, 2024
4be5dea
Merge pull request #211 from OriginTrail/fix/gnosis-gas-price
br41nlet Dec 26, 2024
e168965
Implement get/increase allowance for new contracts
brkagithub Dec 27, 2024
ad287e2
Merge pull request #212 from OriginTrail/v8/allowance-backwards-compa…
brkagithub Dec 27, 2024
2ddb486
Add validation for signatures
Mihajlo-Pavlovic Dec 27, 2024
53a2289
add signature validaton code
Mihajlo-Pavlovic Dec 30, 2024
89fc850
Fix decrease allowance issue
Jan 13, 2025
dd74aaa
Fixed demo.js
ilijaMar Jan 13, 2025
129ece2
Changeg constant name
ilijaMar Jan 13, 2025
b25e108
Merge remote-tracking branch 'origin/v8/updating-demo' into v8/decrea…
Jan 13, 2025
1ce759f
Add dotenv adn fix demo
Jan 13, 2025
3dc61fc
Add development pub key
Jan 13, 2025
e2bcd2b
PR suggesstions
Jan 13, 2025
bdf7f7c
Capitalize constants
Jan 13, 2025
daa1839
remove knowledgeCollectionAddress as a param of increaseKnowledgeColl…
Jan 13, 2025
5237e10
Bump version num
Jan 13, 2025
86dd523
Merge pull request #215 from OriginTrail/v8/decrease-allowance-and-de…
zsculac Jan 13, 2025
c5cf29e
Apdated publish finality
ilijaMar Jan 17, 2025
7d4422b
Merge pull request #216 from OriginTrail/v8/adding-publish-finality
Mihajlo-Pavlovic Jan 17, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env
node_modules/
.idea/

Expand Down
60 changes: 53 additions & 7 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @constant {number} MAX_FILE_SIZE
* - Max file size for publish
*/
export const MAX_FILE_SIZE = 524288000;
export const MAX_FILE_SIZE = 10000000;

/**
* @constant {number} DID_PREFIX
Expand All @@ -22,6 +22,25 @@ export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';

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

export const BLOCKCHAIN_IDS = {
HARDHAT_1: 'hardhat1:31337',
HARDHAT_2: 'hardhat2:31337',
BASE_DEVNET: 'base:84532',
GNOSIS_DEVNET: 'gnosis:10200',
NEUROWEB_DEVNET: 'otp:2160',
BASE_TESTNET: 'base:84532',
GNOSIS_TESTNET: 'gnosis:10200',
NEUROWEB_TESTNET: 'otp:20430',
BASE_MAINNET: 'base:8453',
GNOSIS_MAINNET: 'gnosis:100',
NEUROWEB_MAINNET: 'otp:2043',
};
export const ENVIRONMENTS = {
MAINNET: 'mainnet',
TESTNET: 'testnet',
DEVNET: 'devnet',
DEVELOPMENT: 'development',
};
export const BLOCKCHAINS = {
development: {
'hardhat1:31337': {
Expand All @@ -35,7 +54,7 @@ export const BLOCKCHAINS = {
},
devnet: {
'base:84532': {
hubContract: '0x3e5dd82e7529F4e55AA64893D8f8879AE14BF87D',
hubContract: '0xE043daF4cC8ae2c720ef95fc82574a37a429c40A',
rpc: 'https://sepolia.base.org',
},
},
Expand All @@ -52,13 +71,35 @@ export const BLOCKCHAINS = {
},
},
testnet: {
// This is V8 TESTNET HUB don't use this for V6
'base:84532': {
hubContract: '0xCca0eA14540588A09c85cD6A6Fc53eA3A7010692',
hubContract: '0xf21CE8f8b01548D97DCFb36869f1ccB0814a4e05',
rpc: 'https://sepolia.base.org',
},
'otp:20430': {
hubContract: '0xd7d073b560412c6A7F33dD670d323D01061E5DEb',
rpc: 'https://lofar-testnet.origin-trail.network',
},
'gnosis:10200': {
hubContract: '0x2c08AC4B630c009F709521e56Ac385A6af70650f',
rpc: 'https://rpc.chiadochain.net',
gasPriceOracleLink: 'https://blockscout.chiadochain.net/api/v1/gas-price-oracle',
},
},
mainnet: {
'base:8453': {
hubContract: '0x99Aa571fD5e681c2D27ee08A7b7989DB02541d13',
rpc: 'https://mainnet.base.org',
},
'otp:2043': {
hubContract: '0x0957e25BD33034948abc28204ddA54b6E1142D6F',
rpc: 'https://astrosat-parachain-rpc.origin-trail.network',
},
'gnosis:100': {
hubContract: '0x882D0BF07F956b1b94BBfe9E77F47c6fc7D4EC8f',
rpc: 'https://rpc.gnosischain.com/',
gasPriceOracleLink: 'https://blockscout.com/xdai/mainnet/api/v1/gas-price-oracle',
},
},
mainnet: {},
};

export const PARANET_NODES_ACCESS_POLICY = {
Expand Down Expand Up @@ -228,8 +269,13 @@ export const DEFAULT_PARAMETERS = {
};

export const DEFAULT_GAS_PRICE = {
GNOSIS: '20',
OTP: '1',
GNOSIS: '6',
OTP: '0.001',
BASE: '0.086',
};

export const DEFAULT_GAS_PRICE_WEI = {
GNOSIS: '6000000000',
};

export const LOW_BID_SUGGESTION = 'low';
Expand Down
2 changes: 1 addition & 1 deletion dist/dkg.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions dist/dkg.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@

/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */

/*! https://mths.be/punycode v1.4.1 by @mathias */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */

/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */

/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/**
* A JavaScript implementation of the JSON-LD API.
*
Expand Down
165 changes: 165 additions & 0 deletions examples/demo.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
const jsonld = require('jsonld');
const DKG = require('../index.cjs');

const ENVIRONMENT = 'development';
const OT_NODE_HOSTNAME = 'http://localhost';
const OT_NODE_PORT = '8900';
const PUBLIC_KEY = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266';
const PRIVATE_KEY = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80';

const DkgClient = new DKG({
environment: ENVIRONMENT,
endpoint: OT_NODE_HOSTNAME,
port: OT_NODE_PORT,
blockchain: {
name: 'hardhat2',
publicKey: PUBLIC_KEY,
privateKey: PRIVATE_KEY,
},
maxNumberOfRetries: 30,
frequency: 2,
contentType: 'all',
nodeApiVersion: '/v1',
});

function divider() {
console.log('==================================================');
console.log('==================================================');
console.log('==================================================');
}

(async () => {
// const content = {
// public: `<uuid:1> <http://schema.org/city> <uuid:nis> .
// <uuid:3> <http://schema.org/company> "TL" .`,
// private: `<uuid:2> <http://schema.org/city> <uuid:belgrade> .
// <uuid:2> <http://schema.org/company> "OT" .
// <uuid:2> <http://schema.org/user> <uuid:user:1> .
// <uuid:3> <http://schema.org/user> <uuid:user:1> .

// `,
// };
const content = {
public: {
'@context': ['https://schema.org'],
'@id': 'uuid:1',
company: 'OT',
user: {
'@id': 'uuid:user:1',
},
city: {
'@id': 'uuid:belgrade',
},
},
private: {
'@context': ['https://schema.org'],
'@graph': [
{
'@id': 'uuid:user:1',
name: 'Adam',
lastname: 'Smith',
},
{
'@id': 'uuid:belgrade',
title: 'Belgrade',
postCode: '11000',
},
{
problem: 'empty',
},
{
solution: 'generate',
},
],
},
};

// divider();

const nodeInfo = await DkgClient.node.info();
console.log('======================== NODE INFO RECEIVED');
console.log(nodeInfo);

// divider();

// console.time('Publish (1 replication, 3 finalizations)')
// const result0 = await DkgClient.asset.create(content, {
// epochsNum: 2,
// tokenAmount: '100',
// minimumNumberOfFinalizationConfirmations: 3,
// minimumNumberOfNodeReplications: 1,
// });
// console.timeEnd('Publish (1 replication, 3 finalizations)')

// console.log(JSON.stringify(result0));

// divider();

// console.time('Publish (1 replication, 1 finalization)')
// const result1 = await DkgClient.asset.create(content, {
// epochsNum: 2,
// tokenAmount: '100',
// minimumNumberOfFinalizationConfirmations: 1,
// minimumNumberOfNodeReplications: 1,
// });
// console.timeEnd('Publish (1 replication, 1 finalization)')

// console.log(JSON.stringify(result1));

divider();

console.time('Publish (3 replications, 3 finalizations)');
const result2 = await DkgClient.asset.create(content, {
epochsNum: 2,
tokenAmount: '100000000000',
minimumNumberOfFinalizationConfirmations: 3,
minimumNumberOfNodeReplications: 3,
});
console.timeEnd('Publish (3 replications, 3 finalizations)');

console.log(result2);

// divider();

// console.time('Publish (5 replications, 5 finalizations)')
// const result3 = await DkgClient.asset.create(content, {
// epochsNum: 2,
// tokenAmount: '100',
// minimumNumberOfFinalizationConfirmations: 5,
// minimumNumberOfNodeReplications: 5,
// });
// console.timeEnd('Publish (5 replications, 5 finalizations)')

// console.log(JSON.stringify(result3));

// divider();

// const createCollectionResult = await DkgClient.graph.create(content, {
// epochsNum: 2,
// tokenAmount: '100',
// minimumNumberOfFinalizationConfirmations: 1,
// });
// console.log('======================== ASSET CREATED');
// console.log(createCollectionResult);

// divider();

// const publishFinalityResult = await DkgClient.graph.publishFinality(createAssetResult.UAL);
// console.log('======================== ASSET FINALITY');
// console.log(publishFinalityResult);

// const getOperationResult = await DkgClient.graph.get(createCollectionResult.UAL);
// console.log('======================== ASSET GET');
// console.log(getOperationResult);

// divider();

// const queryOperationResult = await DkgClient.graph.query(
// `select ?s ?p ?o where { ?s ?p ?o }`,
// 'SELECT',
// );
// console.log('======================== ASSET QUERY');
// console.log(queryOperationResult);

// divider();
})();
Loading