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

Migrated codebase to typescript #33

Merged
merged 21 commits into from
Aug 1, 2022
Merged

Migrated codebase to typescript #33

merged 21 commits into from
Aug 1, 2022

Conversation

CluEleSsUK
Copy link
Contributor

@CluEleSsUK CluEleSsUK commented Jul 7, 2022

  • modified directory structure to separate tests and lib
  • migrated codebase to Typescript
  • replaced standard linter with eslint
  • replaced ava with jest + ts-jest
  • fixed a few small bugs along the way

@CluEleSsUK CluEleSsUK marked this pull request as ready for review July 8, 2022 16:42
no new features or any API changes per se, but typescript upgrade seemed more
than a patch from a risk POV
@CluEleSsUK CluEleSsUK requested a review from AnomalRoil July 20, 2022 13:41
Copy link
Member

@AnomalRoil AnomalRoil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments. LGTM

lib/chain.ts Outdated Show resolved Hide resolved
lib/drand.ts Show resolved Hide resolved
}>

export interface NetworkClient {
get(round?: number, options?: ClientOptions): Promise<RandomnessBeacon>
Copy link
Member

@AnomalRoil AnomalRoil Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have the chainhash as an optional param here rather than in the DrandOptions?

this.controllers.push(controller)

try {
const url = `${this.url}/public/${round || 'latest'}${options.noCache ? '?' + Date.now() : ''}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you handling the chain hash at the url level then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just translated the old impl and curiously it ignores the chainHash and just calls the default public, e.g. https://pl-us.testnet.drand.sh/public/latest.

This needs rethought for sure

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because the chainHash endpoint is a new thing brought by the multibeacon support in 2022.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhhh right, that makes sense then. In that case, I will raise a separate PR for that when I implement unchained beacon verification (which I have already basically done in timelock, so I will port it over)

lib/polling-watcher.ts Outdated Show resolved Hide resolved
test/optimizing-client.test.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@CluEleSsUK CluEleSsUK merged commit bdfdb7a into master Aug 1, 2022
@CluEleSsUK CluEleSsUK deleted the feature/typescriptify branch August 1, 2022 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants