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

refactor(sdk)!: Stateless Stream #2883

Merged
merged 18 commits into from
Nov 21, 2024
Merged

refactor(sdk)!: Stateless Stream #2883

merged 18 commits into from
Nov 21, 2024

Conversation

teogeb
Copy link
Contributor

@teogeb teogeb commented Nov 15, 2024

This is a breaking changes as this changes the API

Stream instances no longer have metadata field. Instead the metadata is queried from StreamRegistry.

  • StreamRegistry already caches the metadata. Now we explicity populate the cache e.g. in searchStreams() (which queries id + metadata) from The Graph).

API

These Stream methods are now async:

  • getMetadata()
  • getPartitionCount()
  • getDescription()
  • getStorageDayCount()

Also added StreamrClient#getStreamMetadata() method which is used by Stream#getMetadata().

Testing

Added new end-to-end tests to assert cache population logic. The new ProxyHttpServer helper class which is needed by those tests.

@github-actions github-actions bot added cli-tools Related to CLI Tools Package sdk node labels Nov 15, 2024
@github-actions github-actions bot added the docs label Nov 15, 2024
@teogeb teogeb requested a review from harbu November 18, 2024 11:13
@teogeb teogeb marked this pull request as ready for review November 18, 2024 11:13
teogeb added a commit that referenced this pull request Nov 18, 2024
Moved two Ethereum function selector utils from `FakeJsonRpcServer` to
test utils. These are soon needed in
#2883.

Also refactored methods (and one `FakeJsonRpcServer` usage) to use the
`id` utils from ethers
(https://github.com/ethers-io/ethers.js/blob/9e7e7f3e2f2d51019aaa782e6290e079c38332fb/src.ts/hash/id.ts#L16).
It does the same hash calculation as our implementation.

Note that the return value of the functions now includes the `0x`
prefix. It is therefore compatible e.g. with `ethers`
`FunctionFragment.getSelector()` method
(https://github.com/ethers-io/ethers.js/blob/9e7e7f3e2f2d51019aaa782e6290e079c38332fb/src.ts/abi/fragments.ts#L1449).
@teogeb teogeb requested a review from harbu November 21, 2024 11:55
@teogeb teogeb merged commit a53f21a into main Nov 21, 2024
24 checks passed
@teogeb teogeb deleted the sdk-stateless-stream branch November 21, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli-tools Related to CLI Tools Package docs node sdk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants