Skip to content

Commit

Permalink
Merge pull request #438 from nova-wallet/develop
Browse files Browse the repository at this point in the history
v3.9.1
  • Loading branch information
ERussel authored Oct 14, 2022
2 parents 771b2a5 + b4146d9 commit 2572e82
Show file tree
Hide file tree
Showing 29 changed files with 773 additions and 221 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ platform :ios, '13.0'
abstract_target 'novawalletAll' do
use_frameworks!

pod 'SubstrateSdk', :git => 'https://github.com/nova-wallet/substrate-sdk-ios.git', :tag => '1.4.0'
pod 'SubstrateSdk', :git => 'https://github.com/nova-wallet/substrate-sdk-ios.git', :tag => '1.5.0'
pod 'SwiftLint'
pod 'R.swift', :inhibit_warnings => true
pod 'SoraKeystore', '~> 1.0.0'
Expand All @@ -27,7 +27,7 @@ abstract_target 'novawalletAll' do
inherit! :search_paths

pod 'Cuckoo'
pod 'SubstrateSdk', :git => 'https://github.com/nova-wallet/substrate-sdk-ios.git', :tag => '1.4.0'
pod 'SubstrateSdk', :git => 'https://github.com/nova-wallet/substrate-sdk-ios.git', :tag => '1.5.0'
pod 'SoraFoundation', '~> 1.0.0'
pod 'R.swift', :inhibit_warnings => true
pod 'FireMock', :inhibit_warnings => true
Expand Down
27 changes: 13 additions & 14 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ PODS:
- SoraUI/Skrull (1.11.1)
- Sourcery (1.4.1)
- Starscream (4.0.5)
- SubstrateSdk (1.4.0):
- SubstrateSdk (1.5.0):
- BigInt (~> 5.0)
- IrohaCrypto/ed25519 (~> 0.9.0)
- IrohaCrypto/Scrypt (~> 0.9.0)
Expand Down Expand Up @@ -137,39 +137,38 @@ DEPENDENCIES:
- SoraUI (from `https://github.com/ERussel/UIkit-iOS.git`, tag `1.11.1`)
- Sourcery (~> 1.4)
- Starscream (from `https://github.com/ERussel/Starscream.git`, tag `4.0.5`)
- SubstrateSdk (from `https://github.com/nova-wallet/substrate-sdk-ios.git`, tag `1.4.0`)
- SubstrateSdk (from `https://github.com/nova-wallet/substrate-sdk-ios.git`, tag `1.5.0`)
- SVGKit (from `https://github.com/SVGKit/SVGKit.git`, tag `3.0.0`)
- SwiftFormat/CLI (~> 0.47.13)
- SwiftLint
- SwiftRLP (from `https://github.com/ERussel/SwiftRLP.git`)
- SwiftyBeaver

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- BigInt
- IrohaCrypto
- keccak.c
- scrypt.c
- secp256k1.c
- TweetNacl
- xxHash-Swift
trunk:
- BigInt
- Charts
- CocoaLumberjack
- Cuckoo
- FireMock
- IrohaCrypto
- keccak.c
- Kingfisher
- R.swift
- R.swift.Library
- ReachabilitySwift
- RobinHood
- scrypt.c
- secp256k1.c
- SnapKit
- SoraFoundation
- SoraKeystore
- Sourcery
- SwiftFormat
- SwiftLint
- SwiftyBeaver
- TweetNacl
- xxHash-Swift

EXTERNAL SOURCES:
CommonWallet:
Expand All @@ -183,7 +182,7 @@ EXTERNAL SOURCES:
:tag: 4.0.5
SubstrateSdk:
:git: https://github.com/nova-wallet/substrate-sdk-ios.git
:tag: 1.4.0
:tag: 1.5.0
SVGKit:
:git: https://github.com/SVGKit/SVGKit.git
:tag: 3.0.0
Expand All @@ -202,7 +201,7 @@ CHECKOUT OPTIONS:
:tag: 4.0.5
SubstrateSdk:
:git: https://github.com/nova-wallet/substrate-sdk-ios.git
:tag: 1.4.0
:tag: 1.5.0
SVGKit:
:git: https://github.com/SVGKit/SVGKit.git
:tag: 3.0.0
Expand Down Expand Up @@ -232,7 +231,7 @@ SPEC CHECKSUMS:
SoraUI: e5ceb2cffe40145e589aa464e2e0a8d054011e0b
Sourcery: db66600e8b285c427701821598d07cf3c7e6c476
Starscream: 8cc648110705c09a15f0de84352c7f9595b7cb05
SubstrateSdk: 2335047caaddbd33b4cb38e0604d325989d1023c
SubstrateSdk: 6923efefde7463684701e9f4f5b0216eb6578a71
SVGKit: 132b010efbf57ec345309fe4a7f627c0a40c5d63
SwiftFormat: 73573b89257437c550b03d934889725fbf8f75e5
SwiftLint: 99f82d07b837b942dd563c668de129a03fc3fb52
Expand All @@ -241,6 +240,6 @@ SPEC CHECKSUMS:
TweetNacl: 3abf4d1d2082b0114e7a67410e300892448951e6
xxHash-Swift: 30bd6a7507b3b7348a277c49b1cb6346c2905ec7

PODFILE CHECKSUM: 7f7a144b623e89cffdcf1bdc1bdbc2d88d2493df
PODFILE CHECKSUM: 4d0db693ac4524f7e22cfc95b6546c23edf7f2d1

COCOAPODS: 1.11.3
16 changes: 16 additions & 0 deletions novawallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@
846952A42852A1640083E0B4 /* StakingDuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846952A32852A1640083E0B4 /* StakingDuration.swift */; };
846952A62852A1E60083E0B4 /* AuraStakingDurationFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846952A52852A1E60083E0B4 /* AuraStakingDurationFactory.swift */; };
8469936B26CD1BBE002CC786 /* RuntimePoolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8469936A26CD1BBE002CC786 /* RuntimePoolTests.swift */; };
8469D5A628F5E8F20074FEE3 /* Staking.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8469D5A528F5E8F20074FEE3 /* Staking.swift */; };
846A2601267C768500429A7F /* CrowdloanContributionMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846A2600267C768500429A7F /* CrowdloanContributionMapper.swift */; };
846A2606267C792000429A7F /* CrowdloanContributionResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846A2605267C792000429A7F /* CrowdloanContributionResponse.swift */; };
846A2C4325271CDE00731018 /* TransactionType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846A2C4225271CDE00731018 /* TransactionType.swift */; };
Expand Down Expand Up @@ -2101,6 +2102,7 @@
880855F828D09DA8004255E7 /* CrowdloanContributionDataMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880855F728D09DA8004255E7 /* CrowdloanContributionDataMapper.swift */; };
880855FA28D0BAA2004255E7 /* CrowdloanContributionLocalSubscriptionFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880855F928D0BAA2004255E7 /* CrowdloanContributionLocalSubscriptionFactory.swift */; };
880855FC28D0C3DF004255E7 /* CrowdloansLocalStorageSubscriber.swift in Sources */ = {isa = PBXBuildFile; fileRef = 880855FB28D0C3DF004255E7 /* CrowdloansLocalStorageSubscriber.swift */; };
8820134828EB04300027CD80 /* SkeletonableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8820134728EB04300027CD80 /* SkeletonableView.swift */; };
8828C05828B4A67000555CB6 /* Prism.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8828C05728B4A67000555CB6 /* Prism.swift */; };
8828C05A28B4A6A800555CB6 /* Samples.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8828C05928B4A6A800555CB6 /* Samples.swift */; };
8828F4F328AD2734009E0B7C /* CrowdloansCalculator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8828F4F228AD2734009E0B7C /* CrowdloansCalculator.swift */; };
Expand Down Expand Up @@ -3733,6 +3735,7 @@
846952A32852A1640083E0B4 /* StakingDuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StakingDuration.swift; sourceTree = "<group>"; };
846952A52852A1E60083E0B4 /* AuraStakingDurationFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuraStakingDurationFactory.swift; sourceTree = "<group>"; };
8469936A26CD1BBE002CC786 /* RuntimePoolTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuntimePoolTests.swift; sourceTree = "<group>"; };
8469D5A528F5E8F20074FEE3 /* Staking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Staking.swift; sourceTree = "<group>"; };
846A2600267C768500429A7F /* CrowdloanContributionMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrowdloanContributionMapper.swift; sourceTree = "<group>"; };
846A2605267C792000429A7F /* CrowdloanContributionResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrowdloanContributionResponse.swift; sourceTree = "<group>"; };
846A2C4225271CDE00731018 /* TransactionType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionType.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4863,6 +4866,7 @@
880855F728D09DA8004255E7 /* CrowdloanContributionDataMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CrowdloanContributionDataMapper.swift; sourceTree = "<group>"; };
880855F928D0BAA2004255E7 /* CrowdloanContributionLocalSubscriptionFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrowdloanContributionLocalSubscriptionFactory.swift; sourceTree = "<group>"; };
880855FB28D0C3DF004255E7 /* CrowdloansLocalStorageSubscriber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrowdloansLocalStorageSubscriber.swift; sourceTree = "<group>"; };
8820134728EB04300027CD80 /* SkeletonableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkeletonableView.swift; sourceTree = "<group>"; };
8821119C96944A0E3526E93A /* StakingRedeemViewFactory.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = StakingRedeemViewFactory.swift; sourceTree = "<group>"; };
8828C05728B4A67000555CB6 /* Prism.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Prism.swift; sourceTree = "<group>"; };
8828C05928B4A6A800555CB6 /* Samples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Samples.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -7073,6 +7077,7 @@
8438E1DC24C18F11001BDB13 /* Types */ = {
isa = PBXGroup;
children = (
8469D5A428F5E8D40074FEE3 /* Staking */,
84BFE89A28C23A0900140F1F /* AutomationTime */,
84FB9E18285C57C000B42FC0 /* Xcm */,
848DAEFC282293BD00D56F55 /* ParachainStaking */,
Expand Down Expand Up @@ -7874,6 +7879,14 @@
path = StakingDuration;
sourceTree = "<group>";
};
8469D5A428F5E8D40074FEE3 /* Staking */ = {
isa = PBXGroup;
children = (
8469D5A528F5E8F20074FEE3 /* Staking.swift */,
);
path = Staking;
sourceTree = "<group>";
};
846A682A274693D400D1A47A /* Crowdloan */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -9392,6 +9405,7 @@
8498430226592D29006BBB9F /* CrowdloanStatusSectionView.swift */,
88D997B128ABC90E006135A5 /* AboutCrowdloansView.swift */,
88D997AD28AB86FD006135A5 /* YourContributionsView.swift */,
8820134728EB04300027CD80 /* SkeletonableView.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -14725,6 +14739,7 @@
84C1FA16278C9BB1008B2711 /* DAppBrowserAccountSubscribingState.swift in Sources */,
84C5ADE628141D21006D7388 /* LinkView.swift in Sources */,
84C2064028D1EAD2006D0D52 /* AccountAssetBalanceTrigger.swift in Sources */,
8469D5A628F5E8F20074FEE3 /* Staking.swift in Sources */,
848FFE8325E686C200652AA5 /* StorageDecodingOperation.swift in Sources */,
8488ECDF258CE118004591CC /* PurchaseCompleted.swift in Sources */,
84AE7AA727D36E4D00495267 /* IconDetailsGenericView.swift in Sources */,
Expand Down Expand Up @@ -15650,6 +15665,7 @@
40087CC8E6A91976807F7D44 /* DAppBrowserWireframe.swift in Sources */,
37E229641DCDF64AC5AF1DCD /* DAppBrowserPresenter.swift in Sources */,
91530F7301CA39654E008580 /* DAppBrowserInteractor.swift in Sources */,
8820134828EB04300027CD80 /* SkeletonableView.swift in Sources */,
DE03CA5AD7F1D0B80DFF13B6 /* DAppBrowserViewController.swift in Sources */,
70C0E48EE41B4C7229F5946C /* DAppBrowserViewLayout.swift in Sources */,
FDE2CA45061C620567AC329C /* DAppBrowserViewFactory.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ final class CrowdloanContributionLocalSubscriptionFactory: SubstrateLocalSubscri
return provider
}

let offchainSources: [ExternalContributionSourceProtocol] = [
ParallelContributionSource(),
AcalaContributionSource(
paraIdOperationFactory: paraIdOperationFactory,
acalaChainId: KnowChainId.acala
)
]
let offchainSources = ExternalContributionSourcesFactory.createExternalSources(
for: chain.chainId,
paraIdOperationFactory: paraIdOperationFactory
)

let onChainSyncService = createOnChainSyncService(chainId: chain.chainId, accountId: accountId)
let offChainSyncServices = createOffChainSyncServices(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ extension StorageKeyFactoryProtocol {
)
}

func historyDepth() throws -> Data {
try createStorageKey(
moduleName: "Staking",
storageName: "HistoryDepth"
)
}

func key(from codingPath: StorageCodingPath) throws -> Data {
try createStorageKey(moduleName: codingPath.moduleName, storageName: codingPath.itemName)
}
Expand Down
5 changes: 3 additions & 2 deletions novawallet/Common/Extension/UIKit/SkeletonRow+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ extension SingleSkeleton {
containerView: UIView,
spaceSize: CGSize,
offset: CGPoint,
size: CGSize
size: CGSize,
cornerRadii: CGSize = CGSize(width: 0.5, height: 0.5)
) -> SingleSkeleton {
let targetFrame = targetView.convert(targetView.bounds, to: containerView)

Expand All @@ -43,7 +44,7 @@ extension SingleSkeleton {
height: spaceSize.skrullMapY(size.height)
)

return SingleSkeleton(position: spaceSize.skrullMap(point: position), size: mappedSize).round()
return SingleSkeleton(position: spaceSize.skrullMap(point: position), size: mappedSize).round(cornerRadii)
}

static func createRow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ extension PayoutRewardsService {
storagePath: .activeEra
)

let historyDepthWrapper: CompoundOperationWrapper<[StorageResponse<StringScaleMapper<UInt32>>]> =
storageRequestFactory.queryItems(
engine: engine,
keys: { [try keyFactory.historyDepth()] },
factory: { try codingFactoryOperation.extractNoCancellableResultData() },
storagePath: .historyDepth
)
let historyDepthWrapper = createHistoryDepthWrapper(
dependingOn: codingFactoryOperation,
storageRequestFactory: storageRequestFactory,
connection: engine
)

let dependecies = currentEraWrapper.allOperations + activeEraWrapper.allOperations
+ historyDepthWrapper.allOperations
Expand All @@ -44,7 +42,6 @@ extension PayoutRewardsService {
let activeEra = try activeEraWrapper.targetOperation.extractNoCancellableResultData()
.first?.value?.index,
let historyDepth = try historyDepthWrapper.targetOperation.extractNoCancellableResultData()
.first?.value?.value
else {
throw PayoutRewardsServiceError.unknown
}
Expand All @@ -61,6 +58,58 @@ extension PayoutRewardsService {
return CompoundOperationWrapper(targetOperation: mergeOperation, dependencies: dependecies)
}

func createHistoryDepthWrapper(
dependingOn codingFactoryOperation: BaseOperation<RuntimeCoderFactoryProtocol>,
storageRequestFactory: StorageRequestFactoryProtocol,
connection: JSONRPCEngine
) -> CompoundOperationWrapper<UInt32?> {
let combiningService = OperationCombiningService<UInt32?>(operationManager: operationManager) {
let codingFactory = try codingFactoryOperation.extractNoCancellableResultData()
let runtimeMetadata = codingFactory.metadata

if runtimeMetadata.getStorageMetadata(for: Staking.historyDepthStoragePath) != nil {
let wrapper: CompoundOperationWrapper<StorageResponse<StringScaleMapper<UInt32>>> =
storageRequestFactory.queryItem(
engine: connection,
factory: { codingFactory },
storagePath: Staking.historyDepthStoragePath
)

let mapOperation = ClosureOperation<UInt32?> {
try wrapper.targetOperation.extractNoCancellableResultData().value?.value
}

mapOperation.addDependency(wrapper.targetOperation)

return [CompoundOperationWrapper(targetOperation: mapOperation, dependencies: wrapper.allOperations)]
} else {
let constantFetchOperation = PrimitiveConstantOperation<UInt32>(
path: Staking.historyDepthCostantPath
)

constantFetchOperation.codingFactory = codingFactory

let mapOperation = ClosureOperation<UInt32?> {
try constantFetchOperation.extractNoCancellableResultData()
}

mapOperation.addDependency(constantFetchOperation)

return [CompoundOperationWrapper(targetOperation: mapOperation, dependencies: [constantFetchOperation])]
}
}

let historyDepthFetchOperation = combiningService.longrunOperation()

let mapOperation = ClosureOperation<UInt32?> {
try historyDepthFetchOperation.extractNoCancellableResultData().first ?? nil
}

mapOperation.addDependency(historyDepthFetchOperation)

return CompoundOperationWrapper(targetOperation: mapOperation, dependencies: [historyDepthFetchOperation])
}

func createErasRewardDistributionOperationWrapper(
dependingOn unclaimedErasOperation: BaseOperation<[AccountId: [EraIndex]]>,
engine: JSONRPCEngine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ final class StakingRemoteSubscriptionService: RemoteSubscriptionService,
.activeEra,
.currentEra,
.totalIssuance,
.historyDepth,
.minNominatorBond,
.maxNominatorsCount,
.counterForNominators
Expand Down
11 changes: 11 additions & 0 deletions novawallet/Common/Substrate/Types/Staking/Staking.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation

enum Staking {
static var historyDepthStoragePath: StorageCodingPath {
StorageCodingPath(moduleName: "Staking", itemName: "HistoryDepth")
}

static var historyDepthCostantPath: ConstantCodingPath {
ConstantCodingPath(moduleName: "Staking", constantName: "HistoryDepth")
}
}
3 changes: 2 additions & 1 deletion novawallet/Modules/AssetList/AssetListPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ extension AssetListPresenter: AssetListPresenterProtocol {
let initState = AssetListInitState(
priceResult: priceResult,
balanceResults: balanceResults,
allChains: allChains
allChains: allChains,
crowdloansResult: crowdloansResult
)

wireframe.showAssetsSearch(from: view, initState: initState, delegate: self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class AssetListBaseInteractor: WalletLocalStorageSubscriber, WalletLocalSubscrip
clearCrowdloansSubscription()
crowdloanChainIds = newCrowdloanChainIds

for chain in crowdloanChains {
crowdloanChains.forEach { chain in
let request = chain.accountRequest()

guard let accountId = selectedMetaAccount.fetch(for: request)?.accountId else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class AssetListBasePresenter: AssetListBaseInteractorOutputProtocol {
balances = [:]
groups = Self.createGroupsDiffCalculator(from: [])
groupLists = [:]
crowdloansResult = nil
}

func storeChainChanges(_ changes: [DataProviderChange<ChainModel>]) {
Expand Down Expand Up @@ -66,6 +67,7 @@ class AssetListBasePresenter: AssetListBaseInteractorOutputProtocol {
allChains = initState.allChains
balanceResults = initState.balanceResults
priceResult = initState.priceResult
crowdloansResult = initState.crowdloansResult
}

func createAssetAccountInfo(
Expand Down
1 change: 1 addition & 0 deletions novawallet/Modules/AssetList/Base/AssetListInitState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ struct AssetListInitState {
let priceResult: Result<[ChainAssetId: PriceData], Error>?
let balanceResults: [ChainAssetId: Result<BigUInt, Error>]
let allChains: [ChainModel.Id: ChainModel]
let crowdloansResult: Result<[ChainModel.Id: [CrowdloanContributionData]], Error>?
}
Loading

0 comments on commit 2572e82

Please sign in to comment.