From 38378b5e770b1807a32610623dafd9e8449d50c3 Mon Sep 17 00:00:00 2001 From: ERussel Date: Fri, 5 Jul 2024 05:43:51 +0200 Subject: [PATCH] support metadata hash disable --- .../Common/Model/ChainRegistry/LocalChain/ChainModel.swift | 4 ++++ .../Substrate/MetadataHashOperationFactory.swift | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/novawallet/Common/Model/ChainRegistry/LocalChain/ChainModel.swift b/novawallet/Common/Model/ChainRegistry/LocalChain/ChainModel.swift index cbdfe82b40..25af5f0890 100644 --- a/novawallet/Common/Model/ChainRegistry/LocalChain/ChainModel.swift +++ b/novawallet/Common/Model/ChainRegistry/LocalChain/ChainModel.swift @@ -274,6 +274,10 @@ struct ChainModel: Equatable, Hashable { var supportsGenericLedgerApp: Bool { additional?.supportsGenericLedgerApp?.boolValue ?? false } + + var disabledCheckMetadataHash: Bool { + additional?.disabledCheckMetadataHash?.boolValue ?? false + } } extension ChainModel: Identifiable { diff --git a/novawallet/Common/Services/ExtrinsicService/Substrate/MetadataHashOperationFactory.swift b/novawallet/Common/Services/ExtrinsicService/Substrate/MetadataHashOperationFactory.swift index 5dedf3dc9c..d1fc260ed6 100644 --- a/novawallet/Common/Services/ExtrinsicService/Substrate/MetadataHashOperationFactory.swift +++ b/novawallet/Common/Services/ExtrinsicService/Substrate/MetadataHashOperationFactory.swift @@ -102,6 +102,10 @@ extension MetadataHashOperationFactory: MetadataHashOperationFactoryProtocol { connection: JSONRPCEngine, runtimeProvider: RuntimeCodingServiceProtocol ) -> CompoundOperationWrapper { + guard !chain.disabledCheckMetadataHash else { + return CompoundOperationWrapper.createWithResult(nil) + } + if let existingHash = cache.fetchValue(for: chain.chainId) { return CompoundOperationWrapper.createWithResult(existingHash) }