From 800d09e6f3193a8b2ac6a5766153c02fcded3af5 Mon Sep 17 00:00:00 2001 From: Martin Rieke Date: Fri, 7 Feb 2025 12:36:09 +0100 Subject: [PATCH] If possible, rpc-core should decode results into the lookupId type to avoid issues with multiple types that share the same name --- packages/rpc-core/src/bundle.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rpc-core/src/bundle.ts b/packages/rpc-core/src/bundle.ts index dcc37a0d7e3..372237efb88 100644 --- a/packages/rpc-core/src/bundle.ts +++ b/packages/rpc-core/src/bundle.ts @@ -13,6 +13,7 @@ import { Observable, publishReplay, refCount } from 'rxjs'; import { LRUCache } from '@polkadot/rpc-provider'; import { rpcDefinitions } from '@polkadot/types'; +import { unwrapStorageSi } from '@polkadot/types/util'; import { hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aConcat, u8aToU8a } from '@polkadot/util'; import { drr, refCountDelay } from './util/index.js'; @@ -507,7 +508,7 @@ export class RpcCore { private _newType (registry: Registry, blockHash: Uint8Array | string | null | undefined, key: StorageKey, input: string | Uint8Array | null, isEmpty: boolean, entryIndex = -1): Codec { // single return value (via state.getStorage), decode the value based on the // outputType that we have specified. Fallback to Raw on nothing - const type = key.outputType || 'Raw'; + const type = key.meta ? registry.createLookupType(unwrapStorageSi(key.meta.type)) : (key.outputType || 'Raw'); const meta = key.meta || EMPTY_META; const entryNum = entryIndex === -1 ? ''