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

Entropy field for Documents batch #394

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 packages/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,7 @@ POST /transaction/decode
"type": "domain",
"action": 0,
"data": {
"entropy": "f09a3ceacaa2f12b9879ba223d5b8c66c3106efe58edc511556f31ee9676412b",
"label": "Microsoft",
"normalizedLabel": "m1cr0s0ft",
"normalizedParentDomainName": "dash",
Expand Down
7 changes: 7 additions & 0 deletions packages/api/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ const decodeStateTransition = async (client, base64) => {
case DocumentActionEnum.Create: {
const prefundedBalance = documentTransition.getPrefundedVotingBalance()

out.entropy = Buffer.from(documentTransition.getEntropy()).toString('hex')

out.data = documentTransition.getData()
out.prefundedBalance = prefundedBalance
? Object.fromEntries(
Expand All @@ -91,8 +93,13 @@ const decodeStateTransition = async (client, base64) => {
case DocumentActionEnum.Replace: {
out.data = documentTransition.getData()

out.entropy = Buffer.from(documentTransition.getEntropy()).toString('hex')

break
}
case DocumentActionEnum.Delete: {
out.entropy = Buffer.from(documentTransition.getEntropy()).toString('hex')
}
}

return out
Expand Down
1 change: 1 addition & 0 deletions packages/api/test/unit/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe('Utils', () => {
prefundedBalance: null,
type: 'note',
action: 0,
entropy: 'f09a3ceacaa2f12b9879ba223d5b8c66c3106efe58edc511556f31ee9676412b',
data: {
message: 'Tutorial CI Test @ Thu, 08 Aug 2024 20:25:03 GMT'
}
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/app/api/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ Return identity by given identifier
GET /identity/GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec

{
"identifier": "GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec",
"identifier": "3igSMtXaaS9iRQHbWU1w4hHveKdxixwMpgmhLzjVhFZJ",
"revision": 0,
"balance": 49989647300,
"timestamp": "2024-10-12T18:51:44.592Z",
Expand Down Expand Up @@ -1044,6 +1044,7 @@ Response codes:
### Transfers by Identity
Return all transfers made by the given identity
* `limit` cannot be more then 100
* `type` cannot be less, then 0 and more then 8
```
GET /identities/GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec/transfers?hash=445E6F081DEE877867816AD3EF492E2C0BD1DDCCDC9C793B23DDDAF8AEA23118&page=1&limit=10&order=asc&type=6

Expand Down Expand Up @@ -1413,6 +1414,7 @@ POST /transaction/decode
"type": "domain",
"action": 0,
"data": {
"entropy": "f09a3ceacaa2f12b9879ba223d5b8c66c3106efe58edc511556f31ee9676412b",
"label": "Microsoft",
"normalizedLabel": "m1cr0s0ft",
"normalizedParentDomainName": "dash",
Expand Down
Loading