Skip to content

Commit

Permalink
Merge pull request #455 from nova-wallet/develop
Browse files Browse the repository at this point in the history
v3.9.5
  • Loading branch information
ERussel authored Nov 2, 2022
2 parents 2572e82 + 84e759f commit 92d11c0
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 110 deletions.
34 changes: 15 additions & 19 deletions novawallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1349,8 +1349,6 @@
84906FEA28AFCC3F0049B57D /* LoadableStackCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84906FE928AFCC3F0049B57D /* LoadableStackCellView.swift */; };
84906FEC28AFD23B0049B57D /* LoadableStackActionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84906FEB28AFD23B0049B57D /* LoadableStackActionCell.swift */; };
84906FEF28B2C7090049B57D /* LedgerErrorPresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84906FEE28B2C7090049B57D /* LedgerErrorPresentable.swift */; };
8490895028D4A2DC00C3CCE9 /* WeightCompatabilityNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8490894F28D4A2DC00C3CCE9 /* WeightCompatabilityNode.swift */; };
8490895228D4A90100C3CCE9 /* WeightCompatibilityTypeMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8490895128D4A90100C3CCE9 /* WeightCompatibilityTypeMapper.swift */; };
8490895428D4BA7C00C3CCE9 /* CustomSiMappers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8490895328D4BA7C00C3CCE9 /* CustomSiMappers.swift */; };
849244922514EDE800477C1B /* SelectableViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849244912514EDE800477C1B /* SelectableViewModel.swift */; };
84939B1826E1690D000111DA /* TreasuryDepositEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84939B1726E1690D000111DA /* TreasuryDepositEvent.swift */; };
Expand Down Expand Up @@ -4108,8 +4106,6 @@
84906FE928AFCC3F0049B57D /* LoadableStackCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableStackCellView.swift; sourceTree = "<group>"; };
84906FEB28AFD23B0049B57D /* LoadableStackActionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableStackActionCell.swift; sourceTree = "<group>"; };
84906FEE28B2C7090049B57D /* LedgerErrorPresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LedgerErrorPresentable.swift; sourceTree = "<group>"; };
8490894F28D4A2DC00C3CCE9 /* WeightCompatabilityNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeightCompatabilityNode.swift; sourceTree = "<group>"; };
8490895128D4A90100C3CCE9 /* WeightCompatibilityTypeMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeightCompatibilityTypeMapper.swift; sourceTree = "<group>"; };
8490895328D4BA7C00C3CCE9 /* CustomSiMappers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSiMappers.swift; sourceTree = "<group>"; };
849244912514EDE800477C1B /* SelectableViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectableViewModel.swift; sourceTree = "<group>"; };
84939B1726E1690D000111DA /* TreasuryDepositEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TreasuryDepositEvent.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9224,8 +9220,6 @@
8490894E28D4A2C300C3CCE9 /* CustomNodes */ = {
isa = PBXGroup;
children = (
8490894F28D4A2DC00C3CCE9 /* WeightCompatabilityNode.swift */,
8490895128D4A90100C3CCE9 /* WeightCompatibilityTypeMapper.swift */,
8490895328D4BA7C00C3CCE9 /* CustomSiMappers.swift */,
);
path = CustomNodes;
Expand Down Expand Up @@ -14392,7 +14386,6 @@
8490386B262E22DC0016D541 /* NominatorPayoutInfoFactory.swift in Sources */,
2A028D28275688AF0061CB4C /* AddChainAccount.swift in Sources */,
F4CE0FF3273453E30094CD8A /* AcalaContributionSetupWireframe.swift in Sources */,
8490895228D4A90100C3CCE9 /* WeightCompatibilityTypeMapper.swift in Sources */,
8479607E283B60AA0084E779 /* ActionLoadingView.swift in Sources */,
84466B3A28B7653E00FA1E0D /* LedgerPerformOperationProtocols.swift in Sources */,
8430AB1726023D2D005B1066 /* BaseStashNextState.swift in Sources */,
Expand Down Expand Up @@ -15491,7 +15484,6 @@
8489A6D627FDA50D0040C066 /* AccountLocalStorageSubscriber.swift in Sources */,
846F758727B5550700536547 /* EthereumRpcRequest.swift in Sources */,
278F5341DC043EBED7C0733D /* CrowdloanListViewFactory.swift in Sources */,
8490895028D4A2DC00C3CCE9 /* WeightCompatabilityNode.swift in Sources */,
7CBE9FFAF8394786CA131D4D /* CustomValidatorListProtocols.swift in Sources */,
84D9C8EF28AD97E7007FB23B /* SupportedLedgerApps.swift in Sources */,
8482F62A280C4B770006C3A0 /* DAppAuthSettingsViewModel.swift in Sources */,
Expand Down Expand Up @@ -16424,7 +16416,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = 27GUNVKXNM;
DEVELOPMENT_TEAM = RD2HBGJZLF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = novawallet/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -16436,9 +16428,9 @@
);
MARKETING_VERSION = 2.4.4;
OTHER_SWIFT_FLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = io.nova.novawallet.dev;
PRODUCT_BUNDLE_IDENTIFIER = io.novafoundation.novawallet.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "nova-debug";
PROVISIONING_PROFILE_SPECIFIER = "Ruslan's Dev";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
};
Expand Down Expand Up @@ -16478,8 +16470,10 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 27GUNVKXNM;
DEVELOPMENT_TEAM = RD2HBGJZLF;
INFOPLIST_FILE = novawalletTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -16489,6 +16483,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = io.nova.novawalletTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -16504,7 +16500,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 27GUNVKXNM;
DEVELOPMENT_TEAM = RD2HBGJZLF;
INFOPLIST_FILE = novawalletTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -16589,7 +16585,7 @@
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = 27GUNVKXNM;
DEVELOPMENT_TEAM = RD2HBGJZLF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = novawallet/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -16601,7 +16597,7 @@
);
MARKETING_VERSION = 2.4.4;
OTHER_SWIFT_FLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = io.nova.novawallet.dev;
PRODUCT_BUNDLE_IDENTIFIER = io.novafoundation.novawallet.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "nova-wallet-dev";
SWIFT_VERSION = 5.0;
Expand All @@ -16617,7 +16613,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 27GUNVKXNM;
DEVELOPMENT_TEAM = RD2HBGJZLF;
INFOPLIST_FILE = novawalletTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -16697,7 +16693,7 @@
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = 27GUNVKXNM;
DEVELOPMENT_TEAM = RD2HBGJZLF;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = novawallet/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand All @@ -16708,7 +16704,7 @@
"$(FRAMEWORK_SEARCH_PATHS)",
);
MARKETING_VERSION = 2.4.4;
PRODUCT_BUNDLE_IDENTIFIER = io.nova.novawallet.staging;
PRODUCT_BUNDLE_IDENTIFIER = io.novafoundation.novawallet.staging;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "nova-wallet-staging";
SWIFT_VERSION = 5.0;
Expand All @@ -16724,7 +16720,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 27GUNVKXNM;
DEVELOPMENT_TEAM = RD2HBGJZLF;
INFOPLIST_FILE = novawalletTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
24 changes: 23 additions & 1 deletion novawallet/Common/Model/BlockWeights.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
import Foundation
import SubstrateSdk

enum BlockchainWeight {
typealias WeightV1 = StringScaleMapper<UInt64>

struct WeightV2: Decodable {
@StringCodable var refTime: UInt64
}
}

struct BlockWeights: Decodable {
@StringCodable var maxBlock: UInt64
enum CodingKeys: String, CodingKey {
case maxBlock
}

let maxBlock: UInt64

init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)

if let weight = try? container.decode(BlockchainWeight.WeightV2.self, forKey: .maxBlock) {
maxBlock = weight.refTime
} else {
maxBlock = try container.decode(BlockchainWeight.WeightV1.self, forKey: .maxBlock).value
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import SubstrateSdk
enum CustomSiMappers {
static var all: SiTypeMapping {
OneOfSiTypeMapper(innerMappers: [
SiDataTypeMapper(),
WeightCompatabilityTypeMapper()
SiDataTypeMapper()
])
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class StorageKeysQueryService<T>: Longrunable {
let prefixKeyClosure: () throws -> Data
let mapper: AnyMapper<Data, T>
let blockHash: Data?
let timeout: Int

private var state: State = .none
private var completionClosure: ((Result<ResultType, Error>) -> Void)?
Expand All @@ -39,14 +40,16 @@ final class StorageKeysQueryService<T>: Longrunable {
prefixKeyClosure: @escaping () throws -> Data,
mapper: AnyMapper<Data, T>,
pageSize: UInt32? = 1000,
blockHash: Data? = nil
blockHash: Data? = nil,
timeout: Int = 60
) {
self.connection = connection
self.operationManager = operationManager
self.prefixKeyClosure = prefixKeyClosure
self.pageSize = pageSize
self.mapper = mapper
self.blockHash = blockHash
self.timeout = timeout
}

private func loadNext() {
Expand Down Expand Up @@ -78,7 +81,8 @@ final class StorageKeysQueryService<T>: Longrunable {
let operation = JSONRPCOperation<PagedKeysRequest, [String]>(
engine: connection,
method: method,
parameters: request
parameters: request,
timeout: timeout
)

currentOperation = operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ protocol StorageRequestFactoryProtocol {
final class StorageRequestFactory: StorageRequestFactoryProtocol {
let remoteFactory: StorageKeyFactoryProtocol
let operationManager: OperationManagerProtocol
let timeout: Int

init(remoteFactory: StorageKeyFactoryProtocol, operationManager: OperationManagerProtocol) {
init(remoteFactory: StorageKeyFactoryProtocol, operationManager: OperationManagerProtocol, timeout: Int = 60) {
self.remoteFactory = remoteFactory
self.operationManager = operationManager
self.timeout = timeout
}

private func createMergeOperation<T>(
Expand Down Expand Up @@ -123,7 +125,8 @@ final class StorageRequestFactory: StorageRequestFactoryProtocol {
private func createQueryOperation(
for keys: @escaping () throws -> [Data],
at blockHash: Data?,
engine: JSONRPCEngine
engine: JSONRPCEngine,
timeout: Int
) -> BaseOperation<[[StorageUpdate]]> {
OperationCombiningService<[StorageUpdate]>(
operationManager: operationManager) {
Expand All @@ -145,7 +148,8 @@ final class StorageRequestFactory: StorageRequestFactoryProtocol {
let queryOperation = JSONRPCQueryOperation(
engine: engine,
method: RPCMethod.queryStorageAt,
parameters: params
parameters: params,
timeout: timeout
)

return CompoundOperationWrapper(targetOperation: queryOperation)
Expand Down Expand Up @@ -210,7 +214,7 @@ final class StorageRequestFactory: StorageRequestFactoryProtocol {
storagePath: StorageCodingPath,
at blockHash: Data?
) -> CompoundOperationWrapper<[StorageResponse<T>]> where T: Decodable {
let queryOperation = createQueryOperation(for: keys, at: blockHash, engine: engine)
let queryOperation = createQueryOperation(for: keys, at: blockHash, engine: engine, timeout: timeout)

let decodingOperation = StorageFallbackDecodingListOperation<T>(path: storagePath)
decodingOperation.configurationBlock = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@ extension ParachainStaking {
constantName: "DelegationBondLessDelay"
)
}

static var blocksPerRound: ConstantCodingPath {
ConstantCodingPath(moduleName: "ParachainStaking", constantName: "DefaultBlocksPerRound")
}
}
Loading

0 comments on commit 92d11c0

Please sign in to comment.