Skip to content

Commit f6e988b

Browse files
authored
fix: use wrapped feeds in feed print command (#632)
1 parent 626300a commit f6e988b

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/command/feed/print.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,18 @@ export class Print extends FeedCommand implements LeafCommand {
9191

9292
this.console.log(createKeyValue('Topic', `${topic}`))
9393
const numberOfUpdates = feedIndex.toBigInt() + BigInt(1)
94-
this.console.log(createKeyValue('Number of Updates', numberOfUpdates.toString(0)))
94+
this.console.log(createKeyValue('Number of Updates', numberOfUpdates.toString()))
9595

9696
if (this.list) {
9797
for (let i = 0; i < numberOfUpdates; i++) {
98-
const indexBytes = Binary.numberToUint64(BigInt(i), 'BE')
99-
const identifier = Binary.keccak256(Binary.concatBytes(topic.toUint8Array(), indexBytes))
10098
const owner = Binary.hexToUint8Array(this.address)
101-
const soc = Binary.uint8ArrayToHex(Binary.keccak256(Binary.concatBytes(identifier, owner)))
102-
const chunk = await this.bee.downloadChunk(soc)
103-
// span + identifier + signature + span
104-
const cac = Binary.uint8ArrayToHex(chunk.slice(8 + 32 + 65 + 8, 8 + 32 + 65 + 32 + 8))
99+
const reader = this.bee.makeFeedReader(topic, owner)
100+
const socPayload = await reader.downloadPayload({ index: i })
101+
const merkleTree = await MerkleTree.root(socPayload.payload.toUint8Array())
102+
const cacAddress = Binary.uint8ArrayToHex(merkleTree.hash())
105103
this.console.log('')
106-
this.console.log(createKeyValue(`Update ${i}`, cac))
107-
this.console.log(`${this.bee.url}/bzz/${cac}/`)
104+
this.console.log(createKeyValue(`Update ${i}`, cacAddress))
105+
this.console.log(`${this.bee.url}/bzz/${cacAddress}/`)
108106
}
109107
} else {
110108
this.console.log('Run with --list to see all updates')

0 commit comments

Comments
 (0)