Remove redundant type registration in loadOnReady (#12448)

The types are already registered on the same registry via the ApiPromise
constructor, so re-registering them here is a no-op for the intended case.
This commit is contained in:
Tarik Gul 2026-09-23 15:24:34 -04:00 committed by GitHub
parent 05aa55e844
commit 1fe7ed7903
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -133,9 +133,7 @@ async function retrieve (api: ApiPromise, injectedPromise: Promise<InjectedExten
};
}
async function loadOnReady (api: ApiPromise, endpoint: LinkOption | null, fork: Blockchain | null, injectedPromise: Promise<InjectedExtension[]>, store: KeyringStore | undefined, types: Record<string, Record<string, string>>, urlIsEthereum = false): Promise<ApiState> {
statics.registry.register(types);
async function loadOnReady (api: ApiPromise, endpoint: LinkOption | null, fork: Blockchain | null, injectedPromise: Promise<InjectedExtension[]>, store: KeyringStore | undefined, urlIsEthereum = false): Promise<ApiState> {
const { injectedAccounts, properties, systemChain, systemChainType, systemName, systemVersion } = await retrieve(api, injectedPromise);
const chainSS58 = properties.ss58Format.unwrapOr(DEFAULT_SS58).toNumber();
const ss58Format = settings.prefix === -1
@ -354,7 +352,7 @@ export function ApiCtxRoot ({ apiUrl, beforeApiInit, children, isElectron, store
};
createApi(apiUrl, new ApiSigner(statics.registry, queuePayload, queueSetTxStatus), isLocalFork, onError)
.then(({ fork, types }): void => {
.then(({ fork }): void => {
statics.api.on('connected', () => setIsApiConnected(true));
statics.api.on('disconnected', () => setIsApiConnected(false));
statics.api.on('error', onError);
@ -367,7 +365,7 @@ export function ApiCtxRoot ({ apiUrl, beforeApiInit, children, isElectron, store
const urlIsEthereum = !!location.href.includes('keyring-type=ethereum');
loadOnReady(statics.api, apiEndpoint, fork, injectedPromise, keyringStore, types, urlIsEthereum)
loadOnReady(statics.api, apiEndpoint, fork, injectedPromise, keyringStore, urlIsEthereum)
.then(setState)
.catch(onError);
});