Skip (& don't break) on previous-gen preimage pallet (#8441)

* Skip (& don't break) on previous-gen preimage pallet

* typo
This commit is contained in:
Jaco 2022-11-29 13:04:23 +02:00 committed by GitHub
parent 9e882d7bba
commit aefef6d843
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,8 +82,11 @@ function usePreimageImpl (hashOrBounded?: Hash | HexString | FrameSupportPreimag
const { api } = useApi();
const hash = useMemo(
() => hashOrBounded && getPreimageHash(hashOrBounded),
[hashOrBounded]
// we need a hash _and_ be on the newest supported version of the pallet
// (after the application of bounded calls)
() => api.query.preimage?.preimageFor?.creator.meta.type.isMap && api.registry.lookup.getTypeDef(api.query.preimage.preimageFor.creator.meta.type.asMap.key).type === '(H256,u32)' && hashOrBounded &&
getPreimageHash(hashOrBounded),
[api, hashOrBounded]
);
const optStatus = useCall<Option<PalletPreimageRequestStatus>>(hash && api.query.preimage?.statusFor, [hash]);