monosux/ethereum-block-by-date

Type definitions

Closed this issue ยท 6 comments

Hi! First and foremost, thank you for this great package!
It helped me a lot in one of my project and is working like a charm.

I've integrated the tool in a Typescript project and had to augment the package with some types in order to be able to use it.
I know that there are plans to completely migrate the module to Typescript #15, but I though that maybe I could share my work with the community in the meantime.

For this reason I just created a PR DefinitelyTyped/DefinitelyTyped#59366 that adds type definitions to ethereum-block-by-date.

Anyone is welcomed to review the PR in order to speed up its integration!
Also, please let me know if you would like to be added as an owner of @types/ethereum-block-by-date as it would make future changes easier. @monosux I'm pinging you here as you may be interested in this.

Thanks!

Hi @alexandre-abrioux,

Thank you very much for your job! That is great! I will check it and add it to the readme file.

Cool, thanks!
The PR just got accepted, so types are now available with @types/ethereum-block-by-date ๐Ÿ˜Š

Hi @alexandre-abrioux,

Thanks again for your job!

Since version 1.4.3 I added new optional parameters to getDate() and getEvery() functions. It is a boolean parameter to recheck the last block before request.

See an example for getDate():

let block = await dater.getDate(
    '2016-07-20T13:20:40Z', // Date, required. Any valid moment.js value: string, milliseconds, Date() object, moment() object.
    true, // Block after, optional. Search for the nearest block before or after the given date. By default true.
    false // Refresh boundaries, optional. Recheck the latest block before request. By default false.
);

And another one for getEvery():

let blocks = await dater.getEvery(
    'weeks', // Period, required. Valid value: years, quarters, months, weeks, days, hours, minutes
    '2019-09-02T12:00:00Z', // Start date, required. Any valid moment.js value: string, milliseconds, Date() object, moment() object.
    '2019-09-30T12:00:00Z', // End date, required. Any valid moment.js value: string, milliseconds, Date() object, moment() object.
    1, // Duration, optional, integer. By default 1.
    true, // Block after, optional. Search for the nearest block before or after the given date. By default true.
    false // Refresh boundaries, optional. Recheck the latest block before request. By default false.
);

Could you please update @types/ethereum-block-by-date and include these parameters?

Hey @monosux! I made the change here: DefinitelyTyped/DefinitelyTyped#59762
You're welcome to review the PR to accelerate the merge process.
I also added you as Definition Owner so that your code reviews on the type package will have a higher precedence of importance to the bot which maintains the repo (cf https://github.com/DefinitelyTyped/DefinitelyTyped#definition-owners).
Cheers!

The DefinitelyTyped package has been removed from the repository due to a protestware found in es5-ext, which is a dependency of web3. The @types/ethereum-block-by-date package is however still available on NPM.

If any type update is needed, the package will have to be re-introduced to DefinitelyTyped. The web3 dependency for the type package would probably need an update in this case.

See DefinitelyTyped/DefinitelyTyped#61450