Skip to content

Commit

Permalink
feat: Change local hash generation to use V1 (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio committed May 6, 2022
1 parent 2647709 commit c06980d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Item/Item.router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,7 @@ describe('Item router', () => {
data: {
...Bridge.toFullItem(dbItem),
local_content_hash:
'QmXZgmKEUkoaq4rM5n24KA9FmNUCRyuAAjvDfVpgLWCLhb',
'bafkreiejcahiwp257urwn5u2wn5os3mcjhvid6eqhmok7tezzhvdm5njqy',
eth_address: wallet.address,
created_at: dbItem.created_at.toISOString(),
updated_at: currentDate.toISOString(),
Expand Down
8 changes: 6 additions & 2 deletions src/Item/hashes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ describe('when calculating the hashes of a standard wearable item', () => {
it("should return the hash of the item's entity", () => {
return expect(
calculateItemContentHash(dbItem, dbCollection)
).resolves.toEqual('QmehW1ccHcvdKp8NNhrr6PdxEDHGYa9j6xmu9Bojg8jcjN')
).resolves.toEqual(
'bafkreihtcjnfcahy3nomnhxiuyjyzj2fxzy3eab7ctmxl237nf2vsoqkmu'
)
})
})

Expand Down Expand Up @@ -114,7 +116,9 @@ describe('when calculating the hashes of a standard emote item', () => {
it("should return the hash of the item's entity", () => {
return expect(
calculateItemContentHash(dbItem, dbCollection)
).resolves.toEqual('QmPWgMRRqWMTgFY1nThCPvUi7PTeiR8v3ibCWqhwypYHnF')
).resolves.toEqual(
'bafkreiarnvngt5woehoequocda3o3jmyhq7zkiyafqg4vdrkfvaszaslza'
)
})
})

Expand Down
10 changes: 2 additions & 8 deletions src/Item/hashes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
calculateMultipleHashesADR32LegacyQmHash,
keccak256Hash,
} from '@dcl/hashing'
import { calculateMultipleHashesADR32, keccak256Hash } from '@dcl/hashing'
import { Locale, ThirdPartyWearable, StandardWearable } from '@dcl/schemas'
import { CollectionAttributes } from '../Collection'
import { isStandardItemPublished } from '../ItemAndCollection/utils'
Expand Down Expand Up @@ -106,10 +103,7 @@ async function calculateStandardItemContentHash(
file,
hash: item.contents[file],
}))
const { hash } = await calculateMultipleHashesADR32LegacyQmHash(
content,
metadata
)
const { hash } = await calculateMultipleHashesADR32(content, metadata)

return hash
}

0 comments on commit c06980d

Please sign in to comment.