smartcontractkit / smartcontractkit/data-streams-sdk

Add 'once' support

Open
#61 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
11
Forks
16
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Hello, guys).

Just discovered that Stream extends EventEmitter, and EventEmitter has once() method, which really helpful in some cases.

Can you add, please, once(event: "report", listener: (report: Report) => void): this; to IStream?)

Current workaround is:

return new Promise<IPullPriceFeedResponse>(async (resolve, reject) => {
      (this.stream as unknown as EventEmitter).once('report', (report) => {
        try {
          const decoded = decodeReport(report.fullReport, report.feedID) as DecodedV3Report;

          resolve(decoded);
        } catch (error) {
          reject(error);
        }
      })
    })

Best regards.

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.

Research direction

Locate the IStream declaration and the Stream implementation described as extending EventEmitter, then inspect how existing event methods are typed. Add the requested once signature for report listeners and verify that the public stream interface exposes it consistently with the EventEmitter behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.