`ChunkReference` is misleading or should be exposed
Hi, I would like to use the type ChunkReference as an argument for some functions in a lib that I'm writing, but it seems that although the type is exported it is not exposed in the API. There is a reason for that?
Oh, now I noticed that there is a type Reference that is exposed, but it is HexString instead of Bytes: https://github.com/ethersphere/bee-js/blob/master/src/types/index.ts#L21
So I imagine that the ChunkReference is intended only to be used in the context of the feed module, and the high-level Reference is the one that I should use. Is that right?
Hey there :-)
I see, we have might have some inconsistency here, which was raised by some of our refactors. Generally, across the public API we use Reference which as you pointed out is an HexString. But for Feed's purposes, we are internally working with the binary representation of the Reference and because of that ChunkReference was introduced and is also accepted by Feed's API. We might do some clean-up for this.
To answer your question, yes Reference is the way to go.
Thanks. I just asked because before I was using bytes, and then I found the ChunkReference type and I would like to used it, but HexString works fine for me.
By the way, could you expose the hash module in the utils folder? I saw that it was moved there, but it was not added to the expose.ts file. Currently, I'm doing the keccak256Hash myself, but it would be good to reuse as much as possible of existing code. :)
Should I close this issue then?
Sweet, sounds good!
By the way, could you expose the hash module in the utils folder? I saw that it was moved there, but it was not added to the expose.ts file. Currently, I'm doing the keccak256Hash myself, but it would be good to reuse as much as possible of existing code. :)
Yeah, good idea.
Should I close this issue then?
No, we will keep it as issue for clearing up the confuse between Reference and ChunkReference, maybe with some rename.