There seems to be some mysterious bug(feature?) that if we pass both typesBundle and types as apiOptions, it will fail to decode some certain old blocks.
Change
To fix the issue and to be more concise, this PR puts everything needed into typesBundle, and pass it as the only param to api to avoid conflict.
we keep options for backward compatibility, but now we can also initialize api like this
const api = await new ApiPromise({
typesBundle: acalaTypesBundle,
provider,
}
we don't use lookupTypes and derivedTypes anymore, what are they, and do we still need them? If we do, should we include them into the bundle, or pass as apiOption?
Context
Our api initialization has some issue that it is not able to decode some old blocks. https://github.com/AcalaNetwork/bodhi.js/issues/920
There seems to be some mysterious bug(feature?) that if we pass both
typesBundle
andtypes
as apiOptions, it will fail to decode some certain old blocks.Change
To fix the issue and to be more concise, this PR puts everything needed into
typesBundle
, and pass it as the only param to api to avoid conflict.we keep
options
for backward compatibility, but now we can also initialize api like thisTest
tested with bodhi CI, and everything still works. Decoding old blocks also works now. https://github.com/AcalaNetwork/bodhi.js/pull/931
Question
we don't use
lookupTypes
andderivedTypes
anymore, what are they, and do we still need them? If we do, should we include them into the bundle, or pass as apiOption?