From 2db62b8e396428735a522a24686412cad87a3fca Mon Sep 17 00:00:00 2001 From: owl352 Date: Sat, 16 Nov 2024 20:38:19 +0300 Subject: [PATCH 1/8] initial commit --- packages/api/src/utils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/api/src/utils.js b/packages/api/src/utils.js index f07c5a48..cdba0fa5 100644 --- a/packages/api/src/utils.js +++ b/packages/api/src/utils.js @@ -91,8 +91,11 @@ const decodeStateTransition = async (client, base64) => { case StateTransitionEnum.MASTERNODE_VOTE: { decoded.contestedResourcesVotePoll = stateTransition.getContestedDocumentResourceVotePoll().indexValues.map(buff => buff.toString('base64')) decoded.contractId = stateTransition.getContestedDocumentResourceVotePoll().contractId.toString() + decoded.indexName = stateTransition.getContestedDocumentResourceVotePoll().indexName + decoded.documentType = stateTransition.getContestedDocumentResourceVotePoll().documentTypeName decoded.modifiedDataIds = stateTransition.getModifiedDataIds().map(identifier => identifier.toString()) decoded.ownerId = stateTransition.getOwnerId().toString() + decoded.signature = stateTransition.getSignature().toString('hex') break } From 6939a11c7729276e19b0e45de4fa6c67138c66e2 Mon Sep 17 00:00:00 2001 From: owl352 Date: Fri, 29 Nov 2024 20:39:09 +0300 Subject: [PATCH 2/8] new fields --- packages/api/src/utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/api/src/utils.js b/packages/api/src/utils.js index 00a1f26f..d3d0f2c4 100644 --- a/packages/api/src/utils.js +++ b/packages/api/src/utils.js @@ -99,6 +99,10 @@ const decodeStateTransition = async (client, base64) => { decoded.modifiedDataIds = stateTransition.getModifiedDataIds().map(identifier => identifier.toString()) decoded.ownerId = stateTransition.getOwnerId().toString() decoded.signature = stateTransition.getSignature().toString('hex') + decoded.choice = stateTransition.getContestedDocumentResourceVotePoll().choice + decoded.proTxHash = stateTransition.getProTxHash().toString() + decoded.userFeeIncrease = stateTransition.getUserFeeIncrease() + decoded.raw = stateTransition.toBuffer().toString('hex') break } From 1640452820e7f0ecc9592f04d8bf0837ee714368 Mon Sep 17 00:00:00 2001 From: owl352 Date: Fri, 29 Nov 2024 20:48:09 +0300 Subject: [PATCH 3/8] units fix --- packages/api/test/unit/utils.spec.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/api/test/unit/utils.spec.js b/packages/api/test/unit/utils.spec.js index 43e86d42..b3b5bb6e 100644 --- a/packages/api/test/unit/utils.spec.js +++ b/packages/api/test/unit/utils.spec.js @@ -121,10 +121,17 @@ describe('Utils', () => { 'Egh0ZXN0MDEwMA==' ], contractId: 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', + indexName: 'parentNameAndLabel', + documentType: 'domain', modifiedDataIds: [ '2Ey6wdP5YYSqhq96KmU349CeSCsV4avrsNCaXqogGEr9' ], - ownerId: '2Ey6wdP5YYSqhq96KmU349CeSCsV4avrsNCaXqogGEr9' + ownerId: '2Ey6wdP5YYSqhq96KmU349CeSCsV4avrsNCaXqogGEr9', + signature: '1f6c69fa9201b57bb7e7c24b392de9056cce5a66bcf2154d57631419e9c68efa8e4d1ca11e81c35de31dd52321d0fbb25f6ff17f5ff69a9cf47fce54746ee72644', + choice: 'TowardsIdentity(4VRAaVi8vq492FznoHKTsQd4odaXa7vDxdghpTSQBVSV)', + proTxHash: 'DghTta8E4ySZsozAoF4WjnYxpADLw3i2B7trhYKQ2ovG', + userFeeIncrease: 0, + raw: '0800bc77a5a2cec455c79fb92fb683dbd87a2a92b663c9a46d0c50d11889b4aeb121126fac34e15653f82356cffd3d37c5cd84c1f634d4043340dbae781d93d6b87e000000e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c5315506646f6d61696e12706172656e744e616d65416e644c6162656c02120464617368120874657374303130300033daa5a3e330b61e5a4416ab224f0a45ef4e4cab1357b5f4a86fae9314717a561000411f6c69fa9201b57bb7e7c24b392de9056cce5a66bcf2154d57631419e9c68efa8e4d1ca11e81c35de31dd52321d0fbb25f6ff17f5ff69a9cf47fce54746ee72644' }) }) }) From b8fa81e37170486b5694b04e51c4fc3165539df1 Mon Sep 17 00:00:00 2001 From: owl352 Date: Fri, 29 Nov 2024 23:33:19 +0300 Subject: [PATCH 4/8] fix --- packages/api/src/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/api/src/utils.js b/packages/api/src/utils.js index 8d5f0f0b..0a582dda 100644 --- a/packages/api/src/utils.js +++ b/packages/api/src/utils.js @@ -272,13 +272,13 @@ const decodeStateTransition = async (client, base64) => { decoded.contractId = stateTransition.getContestedDocumentResourceVotePoll().contractId.toString() decoded.modifiedDataIds = stateTransition.getModifiedDataIds().map(identifier => identifier.toString()) decoded.ownerId = stateTransition.getOwnerId().toString() - decoded.indexName = stateTransition.getContestedDocumentResourceVotePoll().indexName - decoded.documentTypeName = stateTransition.getContestedDocumentResourceVotePoll().documentTypeName decoded.signature = stateTransition.getSignature().toString('hex') + decoded.documentTypeName = stateTransition.getContestedDocumentResourceVotePoll().documentTypeName + decoded.indexName = stateTransition.getContestedDocumentResourceVotePoll().indexName decoded.choice = stateTransition.getContestedDocumentResourceVotePoll().choice - decoded.proTxHash = stateTransition.getProTxHash().toString() decoded.userFeeIncrease = stateTransition.getUserFeeIncrease() decoded.raw = stateTransition.toBuffer().toString('hex') + decoded.proTxHash = stateTransition.getProTxHash().toString() break } From 0eb0c724bd9bc5546d13abc189ef758a821978d7 Mon Sep 17 00:00:00 2001 From: owl352 Date: Fri, 29 Nov 2024 23:33:40 +0300 Subject: [PATCH 5/8] fix --- packages/api/src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/src/utils.js b/packages/api/src/utils.js index 0a582dda..d71a7026 100644 --- a/packages/api/src/utils.js +++ b/packages/api/src/utils.js @@ -278,7 +278,7 @@ const decodeStateTransition = async (client, base64) => { decoded.choice = stateTransition.getContestedDocumentResourceVotePoll().choice decoded.userFeeIncrease = stateTransition.getUserFeeIncrease() decoded.raw = stateTransition.toBuffer().toString('hex') - decoded.proTxHash = stateTransition.getProTxHash().toString() + decoded.proTxHash = stateTransition.getProTxHash().toString('hex') break } From e7f4f2ac294dc3f1bde0e411877d8c8942d4164f Mon Sep 17 00:00:00 2001 From: owl352 Date: Sat, 30 Nov 2024 03:41:49 +0300 Subject: [PATCH 6/8] tests fix --- packages/api/test/unit/utils.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/api/test/unit/utils.spec.js b/packages/api/test/unit/utils.spec.js index 56d88760..d0533fe7 100644 --- a/packages/api/test/unit/utils.spec.js +++ b/packages/api/test/unit/utils.spec.js @@ -319,7 +319,8 @@ describe('Utils', () => { indexName: 'parentNameAndLabel', choice: 'TowardsIdentity(4VRAaVi8vq492FznoHKTsQd4odaXa7vDxdghpTSQBVSV)', raw: '0800bc77a5a2cec455c79fb92fb683dbd87a2a92b663c9a46d0c50d11889b4aeb121126fac34e15653f82356cffd3d37c5cd84c1f634d4043340dbae781d93d6b87e000000e668c659af66aee1e72c186dde7b5b7e0a1d712a09c40d5721f622bf53c5315506646f6d61696e12706172656e744e616d65416e644c6162656c02120464617368120874657374303130300033daa5a3e330b61e5a4416ab224f0a45ef4e4cab1357b5f4a86fae9314717a561000411f6c69fa9201b57bb7e7c24b392de9056cce5a66bcf2154d57631419e9c68efa8e4d1ca11e81c35de31dd52321d0fbb25f6ff17f5ff69a9cf47fce54746ee72644', - proTxHash: 'bc77a5a2cec455c79fb92fb683dbd87a2a92b663c9a46d0c50d11889b4aeb121' + proTxHash: 'bc77a5a2cec455c79fb92fb683dbd87a2a92b663c9a46d0c50d11889b4aeb121', + userFeeIncrease: 0 }) }) }) From bf61e0f6b81629414a72f57de0671fae9dcd1bef Mon Sep 17 00:00:00 2001 From: owl352 Date: Thu, 19 Dec 2024 20:55:23 +0300 Subject: [PATCH 7/8] update --- packages/api/src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/src/utils.js b/packages/api/src/utils.js index c46810bd..59ca701f 100644 --- a/packages/api/src/utils.js +++ b/packages/api/src/utils.js @@ -297,7 +297,7 @@ const decodeStateTransition = async (client, base64) => { decoded.contractId = stateTransition.getContestedDocumentResourceVotePoll().contractId.toString() decoded.modifiedDataIds = stateTransition.getModifiedDataIds().map(identifier => identifier.toString()) decoded.ownerId = stateTransition.getOwnerId().toString() - decoded.signature = stateTransition.getSignature().toString('hex') + decoded.signature = stateTransition.getSignature().toString('hex') ?? null decoded.documentTypeName = stateTransition.getContestedDocumentResourceVotePoll().documentTypeName decoded.indexName = stateTransition.getContestedDocumentResourceVotePoll().indexName decoded.choice = stateTransition.getContestedDocumentResourceVotePoll().choice From f53908a4f7ea22a0879453f022f7871c598c9621 Mon Sep 17 00:00:00 2001 From: owl352 Date: Thu, 19 Dec 2024 20:55:44 +0300 Subject: [PATCH 8/8] update --- packages/api/src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/src/utils.js b/packages/api/src/utils.js index 59ca701f..dc2aef54 100644 --- a/packages/api/src/utils.js +++ b/packages/api/src/utils.js @@ -297,7 +297,7 @@ const decodeStateTransition = async (client, base64) => { decoded.contractId = stateTransition.getContestedDocumentResourceVotePoll().contractId.toString() decoded.modifiedDataIds = stateTransition.getModifiedDataIds().map(identifier => identifier.toString()) decoded.ownerId = stateTransition.getOwnerId().toString() - decoded.signature = stateTransition.getSignature().toString('hex') ?? null + decoded.signature = stateTransition.getSignature()?.toString('hex') ?? null decoded.documentTypeName = stateTransition.getContestedDocumentResourceVotePoll().documentTypeName decoded.indexName = stateTransition.getContestedDocumentResourceVotePoll().indexName decoded.choice = stateTransition.getContestedDocumentResourceVotePoll().choice