diff --git a/examples/demo.html b/examples/demo.html
index 22f011b2..b681c5ca 100644
--- a/examples/demo.html
+++ b/examples/demo.html
@@ -82,7 +82,8 @@
Asset data
-
+
+
@@ -129,7 +130,7 @@ Asset data
getUAL: '',
tableData: [
{
- assertionId: '',
+ assertionMerkleRoot: '',
UAL: '',
},
],
@@ -155,7 +156,7 @@ Asset data
},
methods: {
initializeDKGClient(blockchain) {
- console.log(this.selectedNetwork)
+ console.log(this.selectedNetwork);
window.DkgClient = new DKG({
environment: 'development',
endpoint: 'http://localhost',
@@ -174,7 +175,7 @@ Asset data
'el-icon-loading',
0,
);
- let { UAL, assertionId } = await DkgClient.asset.create(
+ let { UAL, assertionMerkleRoot } = await DkgClient.asset.create(
this.assetData,
this.publishOptions,
);
@@ -186,7 +187,7 @@ Asset data
4000,
);
this.disabled = false;
- this.tableData.push({ assertionId, UAL });
+ this.tableData.push({ assertionMerkleRoot, UAL });
},
async get() {
let loading = this.notification(
diff --git a/managers/assertion-operations-manager.js b/managers/assertion-operations-manager.js
index 1f66456f..3f8c0af6 100644
--- a/managers/assertion-operations-manager.js
+++ b/managers/assertion-operations-manager.js
@@ -26,7 +26,7 @@ export default class AssertionOperationsManager {
* @returns {Promise} a promise that resolves with a string representing the
* Merkle root of the formatted public assertion.
*/
- async getPublicAssertionId(content) {
+ async getPublicAssertionMerkleRoot(content) {
const assertions = await kaTools.formatGraph(content);
return kcTools.calculateMerkleRoot(assertions.public);
}
@@ -106,9 +106,9 @@ export default class AssertionOperationsManager {
const labelTriple = `<<<${subject}> <${predicate}> ${object}>> ${LABEL_PREFIX} <${condition.label}> .`;
resultAssertions.push(labelTriple);
} else if (condition.condition({ subject, predicate, object })) {
- const labelTriple = `<<<${subject}> <${predicate}> ${object}>> ${LABEL_PREFIX} <${condition.label}> .`;
- resultAssertions.push(labelTriple);
- }
+ const labelTriple = `<<<${subject}> <${predicate}> ${object}>> ${LABEL_PREFIX} <${condition.label}> .`;
+ resultAssertions.push(labelTriple);
+ }
});
});
return resultAssertions;
diff --git a/managers/asset-operations-manager.js b/managers/asset-operations-manager.js
index 50f6f305..1c98ae61 100644
--- a/managers/asset-operations-manager.js
+++ b/managers/asset-operations-manager.js
@@ -284,7 +284,7 @@ export default class AssetOperationsManager {
* @param {Object} content - The content of the knowledge collection to be created, contains public, private or both keys.
* @param {Object} [options={}] - Additional options for knowledge collection creation.
* @param {Object} [stepHooks=emptyHooks] - Hooks to execute during knowledge collection creation.
- * @returns {Object} Object containing UAL, publicAssertionId and operation status.
+ * @returns {Object} Object containing UAL, publicAssertionMerkleRoot and operation status.
*/
async create(content, options = {}, stepHooks = emptyHooks) {
this.validationService.validateJsonldOrNquads(content);
@@ -325,40 +325,40 @@ export default class AssetOperationsManager {
minimumNumberOfNodeReplications,
);
- let dataset = {};
+ let assertion = {};
if (typeof content === 'string') {
- dataset.public = this.processContent(content);
+ assertion.public = this.processContent(content);
} else if (
typeof content.public === 'string' ||
(!content.public && content.private && typeof content.private === 'string')
) {
if (content.public) {
- dataset.public = this.processContent(content.public);
+ assertion.public = this.processContent(content.public);
} else {
- dataset.public = [];
+ assertion.public = [];
}
if (content.private && typeof content.private === 'string') {
- dataset.private = this.processContent(content.private);
+ assertion.private = this.processContent(content.private);
}
} else {
- dataset = await kcTools.formatDataset(content);
+ assertion = await kcTools.formatDataset(content);
}
- if (dataset.private?.length) {
- dataset.private = kcTools.generateMissingIdsForBlankNodes(dataset.private);
+ if (assertion.private?.length) {
+ assertion.private = kcTools.generateMissingIdsForBlankNodes(assertion.private);
- const privateTriplesGrouped = kcTools.groupNquadsBySubject(dataset.private, true);
- dataset.private = privateTriplesGrouped.flat();
- const privateRoot = kcTools.calculateMerkleRoot(dataset.private);
+ const privateTriplesGrouped = kcTools.groupNquadsBySubject(assertion.private, true);
+ assertion.private = privateTriplesGrouped.flat();
+ const privateRoot = kcTools.calculateMerkleRoot(assertion.private);
- dataset.public.push(
+ assertion.public.push(
`<${kaTools.generateNamedNode()}> <${PRIVATE_ASSERTION_PREDICATE}> "${privateRoot}" .`,
);
- if (dataset.public.length) {
- dataset.public = kcTools.generateMissingIdsForBlankNodes(dataset.public);
+ if (assertion.public.length) {
+ assertion.public = kcTools.generateMissingIdsForBlankNodes(assertion.public);
}
- let publicTriplesGrouped = kcTools.groupNquadsBySubject(dataset.public, true);
+ let publicTriplesGrouped = kcTools.groupNquadsBySubject(assertion.public, true);
const mergedTriples = [];
let publicIndex = 0;
@@ -404,18 +404,18 @@ export default class AssetOperationsManager {
mergedTriples.push([this.generatePrivateRepresentation(privateSubject)]);
privateIndex++;
}
- // Update the public dataset with the merged triples
- dataset.public = mergedTriples.flat();
+ // Update the public assertion with the merged triples
+ assertion.public = mergedTriples.flat();
} else {
- // If there's no private dataset, ensure public is grouped correctly
- dataset.public = kcTools.groupNquadsBySubject(dataset.public, true).flat();
+ // If there's no private assertion, ensure public is grouped correctly
+ assertion.public = kcTools.groupNquadsBySubject(assertion.public, true).flat();
}
- const numberOfChunks = kcTools.calculateNumberOfChunks(dataset.public, CHUNK_BYTE_SIZE);
- const datasetSize = numberOfChunks * CHUNK_BYTE_SIZE;
+ const numberOfChunks = kcTools.calculateNumberOfChunks(assertion.public, CHUNK_BYTE_SIZE);
+ const assertionSize = numberOfChunks * CHUNK_BYTE_SIZE;
- this.validationService.validateAssertionSizeInBytes(datasetSize);
- const datasetRoot = kcTools.calculateMerkleRoot(dataset.public);
+ this.validationService.validateAssertionSizeInBytes(assertionSize);
+ const assertionMerkleRoot = kcTools.calculateMerkleRoot(assertion.public);
const contentAssetStorageAddress = await this.blockchainService.getContractAddress(
'KnowledgeCollectionStorage',
@@ -426,8 +426,8 @@ export default class AssetOperationsManager {
endpoint,
port,
authToken,
- datasetRoot,
- dataset,
+ assertionMerkleRoot,
+ assertion,
blockchain.name,
hashFunctionId,
minimumNumberOfNodeReplications,
@@ -448,7 +448,7 @@ export default class AssetOperationsManager {
!publishOperationResult.minAcksReached
) {
return {
- datasetRoot,
+ assertionMerkleRoot,
operation: {
publish: getOperationStatusObject(publishOperationResult, publishOperationId),
},
@@ -475,7 +475,7 @@ export default class AssetOperationsManager {
const estimatedPublishingCost =
tokenAmount ??
- (await this.blockchainService.getStakeWeightedAverageAsk()) * epochsNum * datasetSize;
+ (await this.blockchainService.getStakeWeightedAverageAsk()) * epochsNum * assertionSize;
let knowledgeCollectionId;
let mintKnowledgeAssetReceipt;
@@ -485,10 +485,10 @@ export default class AssetOperationsManager {
await this.blockchainService.createKnowledgeCollection(
{
publishOperationId,
- merkleRoot: datasetRoot,
- knowledgeAssetsAmount: kcTools.countDistinctSubjects(dataset.public),
- byteSize: datasetSize,
- triplesAmount: kaTools.getAssertionTriplesNumber(dataset.public),
+ merkleRoot: assertionMerkleRoot,
+ knowledgeAssetsAmount: kcTools.countDistinctSubjects(assertion.public),
+ byteSize: assertionSize,
+ triplesAmount: kaTools.getAssertionTriplesNumber(assertion.public),
chunksAmount: numberOfChunks,
epochs: epochsNum,
tokenAmount: estimatedPublishingCost,
@@ -510,10 +510,10 @@ export default class AssetOperationsManager {
({ knowledgeCollectionId, receipt: mintKnowledgeAssetReceipt } =
await this.blockchainService.createKnowledgeCollection(
{
- merkleRoot: datasetRoot,
- knowledgeAssetsAmount: kcTools.countDistinctSubjects(dataset.public),
- byteSize: datasetSize,
- triplesAmount: kaTools.getAssertionTriplesNumber(dataset.public),
+ merkleRoot: assertionMerkleRoot,
+ knowledgeAssetsAmount: kcTools.countDistinctSubjects(assertion.public),
+ byteSize: assertionSize,
+ triplesAmount: kaTools.getAssertionTriplesNumber(assertion.public),
chunksAmount: numberOfChunks,
epochs: epochsNum,
tokenAmount: estimatedPublishingCost,
@@ -549,7 +549,7 @@ export default class AssetOperationsManager {
return {
UAL,
- datasetRoot,
+ assertionMerkleRoot,
signatures: publishOperationResult.data.signatures,
operation: {
mintKnowledgeAsset: mintKnowledgeAssetReceipt,
@@ -632,7 +632,7 @@ export default class AssetOperationsManager {
const { tokenId } = resolveUAL(UAL);
- const state = await this.blockchainService.getAssertionIdByIndex(
+ const state = await this.blockchainService.getAssertionMerkleRootByIndex(
tokenId,
stateIndex,
blockchain,
@@ -665,7 +665,7 @@ export default class AssetOperationsManager {
const { tokenId } = resolveUAL(UAL);
- const states = await this.blockchainService.getAssertionIds(tokenId, blockchain);
+ const states = await this.blockchainService.getAssertionMerkleRoots(tokenId, blockchain);
const latestStateIndex = states.length - 1;
@@ -698,7 +698,7 @@ export default class AssetOperationsManager {
const { tokenId } = resolveUAL(UAL);
- const states = await this.blockchainService.getAssertionIds(tokenId, blockchain);
+ const states = await this.blockchainService.getAssertionMerkleRoots(tokenId, blockchain);
return {
UAL,
@@ -757,7 +757,7 @@ export default class AssetOperationsManager {
tokenAmountInWei =
(await this.blockchainService.getStakeWeightedAverageAsk()) *
epochsNumber *
- datasetSize; // need to get dataset size somewhere
+ assertionSize; // need to get assertion size somewhere
}
const receipt = await this.blockchainService.extendAssetStoringPeriod(
@@ -798,7 +798,7 @@ export default class AssetOperationsManager {
const authToken = this.inputService.getAuthToken(options);
const hashFunctionId = this.inputService.getHashFunctionId(options);
- const latestFinalizedState = await this.blockchainService.getLatestAssertionId(
+ const latestFinalizedState = await this.blockchainService.getLatestAssertionMerkleRoot(
tokenId,
blockchain,
);
@@ -840,13 +840,16 @@ export default class AssetOperationsManager {
async _getUpdateBidSuggestion(UAL, blockchain, size) {
const { contract, tokenId } = resolveUAL(UAL);
- const firstDatasetRoot = await this.blockchainService.getAssertionIdByIndex(
+ const firstassertionMerkleRoot = await this.blockchainService.getAssertionMerkleRootByIndex(
tokenId,
0,
blockchain,
);
- const keyword = ethers.solidityPacked(['address', 'bytes32'], [contract, firstDatasetRoot]);
+ const keyword = ethers.solidityPacked(
+ ['address', 'bytes32'],
+ [contract, firstassertionMerkleRoot],
+ );
const agreementId = ethers.sha256(
ethers.solidityPacked(['address', 'uint256', 'bytes'], [contract, tokenId, keyword]),
@@ -911,7 +914,7 @@ export default class AssetOperationsManager {
* @param {string} UAL - The Universal Asset Locator
* @param {Object} content - The content of the asset to be updated.
* @param {Object} [options={}] - Additional options for asset update.
- * @returns {Object} Object containing UAL, publicAssertionId and operation status.
+ * @returns {Object} Object containing UAL, publicAssertionMerkleRoot and operation status.
*/
async update(UAL, content, options = {}) {
this.validationService.validateJsonldOrNquads(content);
@@ -945,23 +948,23 @@ export default class AssetOperationsManager {
const { tokenId } = resolveUAL(UAL);
- let dataset;
+ let assertion;
if (typeof content === 'string') {
- dataset = content
+ assertion = content
.split('\n')
.map((line) => line.trimStart().trimEnd())
.filter((line) => line.trim() !== '');
} else {
- dataset = await kcTools.formatDataset(content);
+ assertion = await kcTools.formatDataset(content);
}
- const numberOfChunks = kcTools.calculateNumberOfChunks(dataset, CHUNK_BYTE_SIZE);
+ const numberOfChunks = kcTools.calculateNumberOfChunks(assertion, CHUNK_BYTE_SIZE);
- const datasetSize = numberOfChunks * CHUNK_BYTE_SIZE;
+ const assertionSize = numberOfChunks * CHUNK_BYTE_SIZE;
- this.validationService.validateAssertionSizeInBytes(datasetSize);
- const datasetRoot = kcTools.calculateMerkleRoot(dataset);
+ this.validationService.validateAssertionSizeInBytes(assertionSize);
+ const assertionMerkleRoot = kcTools.calculateMerkleRoot(assertion);
const contentAssetStorageAddress = await this.blockchainService.getContractAddress(
'ContentAssetStorage',
@@ -972,8 +975,8 @@ export default class AssetOperationsManager {
endpoint,
port,
authToken,
- datasetRoot,
- dataset,
+ assertionMerkleRoot,
+ assertion,
blockchain.name,
contentAssetStorageAddress,
tokenId,
@@ -991,7 +994,7 @@ export default class AssetOperationsManager {
if (updateOperationResult.status !== OPERATION_STATUSES.COMPLETED) {
return {
- datasetRoot,
+ assertionMerkleRoot,
operation: {
publish: getOperationStatusObject(updateOperationResult, updateOperationId),
},
@@ -1003,22 +1006,22 @@ export default class AssetOperationsManager {
if (tokenAmount != null) {
tokenAmountInWei = tokenAmount;
} else {
- tokenAmountInWei = await this._getUpdateBidSuggestion(UAL, blockchain, datasetSize);
+ tokenAmountInWei = await this._getUpdateBidSuggestion(UAL, blockchain, assertionSize);
}
const updateKnowledgeAssetReceipt = await this.blockchainService.updateAsset(
tokenId,
- datasetRoot,
- datasetSize,
- kaTools.getAssertionTriplesNumber(dataset),
- kcTools.calculateNumberOfChunks(dataset),
+ assertionMerkleRoot,
+ assertionSize,
+ kaTools.getAssertionTriplesNumber(assertion),
+ kcTools.calculateNumberOfChunks(assertion),
tokenAmountInWei,
blockchain,
);
return {
UAL,
- datasetRoot,
+ assertionMerkleRoot,
operation: {
updateKnowledgeAsset: updateKnowledgeAssetReceipt,
update: getOperationStatusObject(updateOperationResult, updateOperationId),
diff --git a/managers/graph-operations-manager.js b/managers/graph-operations-manager.js
index 0eb601df..6e1bf1b9 100644
--- a/managers/graph-operations-manager.js
+++ b/managers/graph-operations-manager.js
@@ -232,7 +232,7 @@ export default class GraphOperationsManager {
* @param {Object} content - The content of the knowledge collection to be created, contains public, private or both keys.
* @param {Object} [options={}] - Additional options for knowledge collection creation.
* @param {Object} [stepHooks=emptyHooks] - Hooks to execute during knowledge collection creation.
- * @returns {Object} Object containing UAL, publicAssertionId and operation status.
+ * @returns {Object} Object containing UAL, publicAssertionMerkleRoot and operation status.
*/
async create(content, options = {}, stepHooks = emptyHooks) {
this.validationService.validateJsonldOrNquads(content);
@@ -273,39 +273,39 @@ export default class GraphOperationsManager {
minimumNumberOfNodeReplications,
);
- let dataset = {};
+ let assertion = {};
if (typeof content === 'string') {
- dataset.public = this.processContent(content);
+ assertion.public = this.processContent(content);
} else if (
typeof content.public === 'string' ||
(!content.public && content.private && typeof content.private === 'string')
) {
if (content.public) {
- dataset.public = this.processContent(content.public);
+ assertion.public = this.processContent(content.public);
} else {
- dataset.public = [];
+ assertion.public = [];
}
if (content.private && typeof content.private === 'string') {
- dataset.private = this.processContent(content.private);
+ assertion.private = this.processContent(content.private);
}
} else {
- dataset = await kcTools.formatDataset(content);
+ assertion = await kcTools.formatDataset(content);
}
- if (dataset.private?.length) {
- dataset.private = kcTools.generateMissingIdsForBlankNodes(dataset.private);
+ if (assertion.private?.length) {
+ assertion.private = kcTools.generateMissingIdsForBlankNodes(assertion.private);
- const privateTriplesGrouped = kcTools.groupNquadsBySubject(dataset.private, true);
- dataset.private = privateTriplesGrouped.flat();
- const privateRoot = kcTools.calculateMerkleRoot(dataset.private);
- dataset.public.push(
+ const privateTriplesGrouped = kcTools.groupNquadsBySubject(assertion.private, true);
+ assertion.private = privateTriplesGrouped.flat();
+ const privateRoot = kcTools.calculateMerkleRoot(assertion.private);
+ assertion.public.push(
`<${kaTools.generateNamedNode()}> <${PRIVATE_ASSERTION_PREDICATE}> "${privateRoot}" .`,
);
- if (dataset.public.length) {
- dataset.public = kcTools.generateMissingIdsForBlankNodes(dataset.public);
+ if (assertion.public.length) {
+ assertion.public = kcTools.generateMissingIdsForBlankNodes(assertion.public);
}
- let publicTriplesGrouped = kcTools.groupNquadsBySubject(dataset.public, true);
+ let publicTriplesGrouped = kcTools.groupNquadsBySubject(assertion.public, true);
const mergedTriples = [];
let publicIndex = 0;
@@ -351,18 +351,18 @@ export default class GraphOperationsManager {
mergedTriples.push([this.generatePrivateRepresentation(privateSubject)]);
privateIndex++;
}
- // Update the public dataset with the merged triples
- dataset.public = mergedTriples.flat();
+ // Update the public assertion with the merged triples
+ assertion.public = mergedTriples.flat();
} else {
- // If there's no private dataset, ensure public is grouped correctly
- dataset.public = kcTools.groupNquadsBySubject(dataset.public, true).flat();
+ // If there's no private assertion, ensure public is grouped correctly
+ assertion.public = kcTools.groupNquadsBySubject(assertion.public, true).flat();
}
- const numberOfChunks = kcTools.calculateNumberOfChunks(dataset.public, CHUNK_BYTE_SIZE);
- const datasetSize = numberOfChunks * CHUNK_BYTE_SIZE;
+ const numberOfChunks = kcTools.calculateNumberOfChunks(assertion.public, CHUNK_BYTE_SIZE);
+ const assertionSize = numberOfChunks * CHUNK_BYTE_SIZE;
- this.validationService.validateAssertionSizeInBytes(datasetSize);
- const datasetRoot = kcTools.calculateMerkleRoot(dataset.public);
+ this.validationService.validateAssertionSizeInBytes(assertionSize);
+ const assertionMerkleRoot = kcTools.calculateMerkleRoot(assertion.public);
const contentAssetStorageAddress = await this.blockchainService.getContractAddress(
'ContentAssetStorage',
@@ -373,8 +373,8 @@ export default class GraphOperationsManager {
endpoint,
port,
authToken,
- datasetRoot,
- dataset,
+ assertionMerkleRoot,
+ assertion,
blockchain.name,
hashFunctionId,
minimumNumberOfNodeReplications,
@@ -392,7 +392,7 @@ export default class GraphOperationsManager {
if (publishOperationResult.status !== OPERATION_STATUSES.COMPLETED) {
return {
- datasetRoot,
+ assertionMerkleRoot,
operation: {
publish: getOperationStatusObject(publishOperationResult, publishOperationId),
},
@@ -401,7 +401,7 @@ export default class GraphOperationsManager {
const estimatedPublishingCost =
tokenAmount ??
- (await this.blockchainService.getStakeWeightedAverageAsk()) * epochsNum * datasetSize;
+ (await this.blockchainService.getStakeWeightedAverageAsk()) * epochsNum * assertionSize;
let tokenId;
let mintKnowledgeAssetReceipt;
@@ -411,9 +411,9 @@ export default class GraphOperationsManager {
await this.blockchainService.createAsset(
{
publishOperationId,
- datasetRoot,
- datasetSize,
- triplesNumber: kaTools.getAssertionTriplesNumber(dataset.public), // todo
+ assertionMerkleRoot,
+ assertionSize,
+ triplesNumber: kaTools.getAssertionTriplesNumber(assertion.public), // todo
chunksNumber: numberOfChunks,
epochsNum,
tokenAmount: estimatedPublishingCost,
@@ -432,10 +432,10 @@ export default class GraphOperationsManager {
await this.blockchainService.createAsset(
{
publishOperationId,
- datasetRoot,
- datasetSize,
- triplesNumber: kaTools.getAssertionTriplesNumber(dataset), // todo
- chunksNumber: kcTools.calculateNumberOfChunks(dataset),
+ assertionMerkleRoot,
+ assertionSize,
+ triplesNumber: kaTools.getAssertionTriplesNumber(assertion), // todo
+ chunksNumber: kcTools.calculateNumberOfChunks(assertion),
epochsNum,
tokenAmount: estimatedPublishingCost,
scoreFunctionId: scoreFunctionId ?? 1,
@@ -464,7 +464,7 @@ export default class GraphOperationsManager {
return {
UAL,
- datasetRoot,
+ assertionMerkleRoot,
signatures: publishOperationResult.data,
operation: {
mintKnowledgeAsset: mintKnowledgeAssetReceipt,
@@ -494,7 +494,7 @@ export default class GraphOperationsManager {
* @param {Object} content - The content of the asset to be created, contains public, private or both keys.
* @param {Object} [options={}] - Additional options for asset creation.
* @param {Object} [stepHooks=emptyHooks] - Hooks to execute during asset creation.
- * @returns {Object} Object containing UAL, publicAssertionId and operation status.
+ * @returns {Object} Object containing UAL, publicAssertionMerkleRoot and operation status.
*/
async localStore(content, options = {}, stepHooks = emptyHooks) {
this.validationService.validateJsonldOrNquads(content);
@@ -530,23 +530,23 @@ export default class GraphOperationsManager {
paranetUAL,
);
- let dataset;
+ let assertion;
if (typeof content === 'string') {
- dataset = content
+ assertion = content
.split('\n')
.map((line) => line.trimStart().trimEnd())
.filter((line) => line.trim() !== '');
} else {
- dataset = await kcTools.formatDataset(content);
+ assertion = await kcTools.formatDataset(content);
}
- const numberOfChunks = kcTools.calculateNumberOfChunks(dataset, CHUNK_BYTE_SIZE);
+ const numberOfChunks = kcTools.calculateNumberOfChunks(assertion, CHUNK_BYTE_SIZE);
- const datasetSize = numberOfChunks * CHUNK_BYTE_SIZE;
+ const assertionSize = numberOfChunks * CHUNK_BYTE_SIZE;
- this.validationService.validateAssertionSizeInBytes(datasetSize);
- const datasetRoot = kcTools.calculateMerkleRoot(dataset);
+ this.validationService.validateAssertionSizeInBytes(assertionSize);
+ const assertionMerkleRoot = kcTools.calculateMerkleRoot(assertion);
const contentAssetStorageAddress = await this.blockchainService.getContractAddress(
'ContentAssetStorage',
@@ -557,7 +557,7 @@ export default class GraphOperationsManager {
endpoint,
port,
authToken,
- dataset,
+ assertion,
null, // full path to cached assertions
);
@@ -573,7 +573,7 @@ export default class GraphOperationsManager {
if (localStoreOperationResult.status !== OPERATION_STATUSES.COMPLETED) {
return {
- datasetRoot,
+ assertionMerkleRoot,
operation: {
publish: getOperationStatusObject(
localStoreOperationResult,
@@ -585,15 +585,15 @@ export default class GraphOperationsManager {
const estimatedPublishingCost =
tokenAmount ??
- (await this.blockchainService.getStakeWeightedAverageAsk()) * epochsNum * datasetSize;
+ (await this.blockchainService.getStakeWeightedAverageAsk()) * epochsNum * assertionSize;
const { tokenId, receipt: mintKnowledgeAssetReceipt } =
await this.blockchainService.createAsset(
{
localStoreOperationId,
- datasetRoot,
- assertionSize: datasetSize,
- triplesNumber: kaTools.getAssertionTriplesNumber(dataset), // todo
+ assertionMerkleRoot,
+ assertionSize: assertionSize,
+ triplesNumber: kaTools.getAssertionTriplesNumber(assertion), // todo
chunksNumber: numberOfChunks,
epochsNum,
tokenAmount: estimatedPublishingCost,
@@ -616,14 +616,14 @@ export default class GraphOperationsManager {
// fullPathToCachedAssertion = path.join(
// absolutePath,
// directory,
- // assertions[0].assertionId,
+ // assertions[0].assertionMerkleRoot,
// );
// await writeFile(fullPathToCachedAssertion, JSON.stringify(assertions));
// }
return {
UAL,
- datasetRoot,
+ assertionMerkleRoot,
operation: {
mintKnowledgeAsset: mintKnowledgeAssetReceipt,
localStore: getOperationStatusObject(
diff --git a/services/blockchain-service/blockchain-service-base.js b/services/blockchain-service/blockchain-service-base.js
index c2924571..f7584236 100644
--- a/services/blockchain-service/blockchain-service-base.js
+++ b/services/blockchain-service/blockchain-service-base.js
@@ -325,7 +325,8 @@ export default class BlockchainServiceBase {
this[blockchain.name].contractAddresses[blockchain.hubContract][contractName] =
await this.callContractFunction(
'Hub',
- contractName.includes('AssetStorage') || contractName.includes('CollectionStorage')
+ contractName.includes('AssetStorage') ||
+ contractName.includes('CollectionStorage')
? 'getAssetStorageAddress'
: 'getContractAddress',
[contractName],
@@ -474,7 +475,11 @@ export default class BlockchainServiceBase {
);
}
- let { id } = await this.decodeEventLogs(receipt, 'KnowledgeCollectionCreated', blockchain);
+ let { id } = await this.decodeEventLogs(
+ receipt,
+ 'KnowledgeCollectionCreated',
+ blockchain,
+ );
id = parseInt(id, 10);
@@ -515,10 +520,10 @@ export default class BlockchainServiceBase {
);
}
- async getLatestAssertionId(tokenId, blockchain) {
+ async getLatestAssertionMerkleRoot(tokenId, blockchain) {
return this.callContractFunction(
'ContentAssetStorage',
- 'getLatestAssertionId',
+ 'getLatestAssertionMerkleRoot',
[tokenId],
blockchain,
);
@@ -655,29 +660,29 @@ export default class BlockchainServiceBase {
}
}
- async getAssertionIdByIndex(tokenId, index, blockchain) {
+ async getAssertionMerkleRootByIndex(tokenId, index, blockchain) {
return this.callContractFunction(
'ContentAssetStorage',
- 'getAssertionIdByIndex',
+ 'getAssertionMerkleRootByIndex',
[tokenId, index],
blockchain,
);
}
- async getAssertionIds(tokenId, blockchain) {
+ async getAssertionMerkleRoots(tokenId, blockchain) {
return this.callContractFunction(
'ContentAssetStorage',
- 'getAssertionIds',
+ 'getAssertionMerkleRoots',
[tokenId],
blockchain,
);
}
- async getAssertionIssuer(tokenId, assertionId, assertionIndex, blockchain) {
+ async getAssertionIssuer(tokenId, assertionMerkleRoot, assertionIndex, blockchain) {
return this.callContractFunction(
'ContentAssetStorage',
'getAssertionIssuer',
- [tokenId, assertionId, assertionIndex],
+ [tokenId, assertionMerkleRoot, assertionIndex],
blockchain,
);
}
@@ -701,11 +706,11 @@ export default class BlockchainServiceBase {
};
}
- async getAssertionSize(assertionId, blockchain) {
+ async getAssertionSize(assertionMerkleRoot, blockchain) {
return this.callContractFunction(
'AssertionStorage',
'getAssertionSize',
- [assertionId],
+ [assertionMerkleRoot],
blockchain,
);
}
diff --git a/services/node-api-service/implementations/http-service.js b/services/node-api-service/implementations/http-service.js
index e152940d..0fb7beb9 100644
--- a/services/node-api-service/implementations/http-service.js
+++ b/services/node-api-service/implementations/http-service.js
@@ -54,8 +54,8 @@ export default class HttpService {
endpoint,
port,
authToken,
- datasetRoot,
- dataset,
+ assertionMerkleRoot,
+ assertion,
blockchain,
hashFunctionId,
minimumNumberOfNodeReplications,
@@ -65,8 +65,8 @@ export default class HttpService {
method: 'post',
url: `${this.getBaseUrl(endpoint, port)}/publish`,
data: {
- datasetRoot,
- dataset,
+ assertionMerkleRoot,
+ assertion,
blockchain,
hashFunctionId,
minimumNumberOfNodeReplications,
@@ -153,7 +153,7 @@ export default class HttpService {
endpoint,
port,
authToken,
- assertionId,
+ assertionMerkleRoot,
assertion,
blockchain,
contract,
@@ -165,7 +165,7 @@ export default class HttpService {
method: 'post',
url: `${this.getBaseUrl(endpoint, port)}/update`,
data: {
- assertionId,
+ assertionMerkleRoot,
assertion,
blockchain,
contract,
@@ -227,30 +227,30 @@ export default class HttpService {
ual,
requiredConfirmations,
maxNumberOfRetries,
- frequency
+ frequency,
) {
let retries = 0;
let finality = 0;
-
+
const axios_config = {
method: 'get',
url: `${this.getBaseUrl(endpoint, port)}/finality`,
params: { ual },
headers: this.prepareRequestConfig(authToken),
};
-
+
do {
if (retries > maxNumberOfRetries) {
throw Error(
- `Unable to achieve required confirmations. Max number of retries (${maxNumberOfRetries}) reached.`
+ `Unable to achieve required confirmations. Max number of retries (${maxNumberOfRetries}) reached.`,
);
}
-
+
retries += 1;
-
+
// eslint-disable-next-line no-await-in-loop
await sleepForMilliseconds(frequency * 1000);
-
+
try {
// eslint-disable-next-line no-await-in-loop
const response = await axios(axios_config);
@@ -259,7 +259,7 @@ export default class HttpService {
finality = 0;
}
} while (finality < requiredConfirmations && retries <= maxNumberOfRetries);
-
+
return finality;
}