multiformats / multiformats/js-multiformats

Proposal: Make `Link` and `Block` interfaces compatible

Open
#227 5 comments 0 reactions 1 assignee View on GitHub

@Gozala is already working on this.

Since Dec 6, 2022.

Dominant language
TypeScript
Stars
268
Forks
57
PR merge metrics
No merged PRs in 30d

Description

As things stand today it is impossible to satisfy both Link and Block interfaces with a same instance, because both they collide on bytes field:

https://github.com/multiformats/js-multiformats/blob/15c52c8a5384e1bc84cccfa34ed6c7a78eb23978/src/block/interface.ts#L47-L55

https://github.com/multiformats/js-multiformats/blob/15c52c8a5384e1bc84cccfa34ed6c7a78eb23978/src/link/interface.ts#L21-L42

This is unfortunate because we're finding ourselves in a position where we would like to satisfy both interfaces along with following DAG interface:

interface DAG {
   links(): IterableIterator<Link|Block>
}

More broadly speaking we would like an ability to give a link with it's data attached (when we have it).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.