polkadot-js / api

Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
Apache License 2.0
1.06k stars 342 forks source link

Crash in absence of Babe/Aura/Timestamp pallet in the runtime #5899

Closed gupnik closed 3 weeks ago

gupnik commented 4 weeks ago

https://github.com/polkadot-js/api/blob/a437f98b3132861cf8184c3678523ead0fcade54/packages/api-derive/src/tx/signingInfo.ts#L73C1-L80C2 assumes the presence of babe or aura or timestamp in the runtime. @kianenigma was just exploring a minimal template for PBA without these pallets which caused a crash in PJS.

Crash in PJS for runtimes without babe or aura or timestamp pallet.

In general, could we try to remove any assumptions about the pallets in the runtime? If some of them are indeed assumed to be present, could we please mention those as requirements in the README. Thank you!

TarikGul commented 3 weeks ago

In general, could we try to remove any assumptions about the pallets in the runtime?

The issue here was with the period. It wasn't accounting for the fact that it might be undefined. I fixed it in the above PR. That being said, the api.derives are were originally built for the UI but put in this repo to allow other users to use them, but it's hard to cater to everyone's use case at times.

polkadot-js-bot commented 2 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.