Skip to content

Commit

Permalink
Merge pull request #867 from novasamatech/feature/remove-parallel-end…
Browse files Browse the repository at this point in the history
…point

Disable parallel endpoint
  • Loading branch information
ERussel authored Oct 26, 2023
2 parents c8fa2f4 + 7c72311 commit 2923df9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 41 deletions.
4 changes: 2 additions & 2 deletions novawallet/Common/Configs/ApplicationConfigs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ extension ApplicationConfig: ApplicationConfigProtocol {

var chainListURL: URL {
#if F_RELEASE
URL(string: "https://raw.githubusercontent.com/novasamatech/nova-utils/master/chains/v14/chains.json")!
URL(string: "https://raw.githubusercontent.com/novasamatech/nova-utils/master/chains/v15/chains.json")!
#else
URL(string: "https://raw.githubusercontent.com/novasamatech/nova-utils/master/chains/v14/chains_dev.json")!
URL(string: "https://raw.githubusercontent.com/novasamatech/nova-utils/master/chains/v15/chains_dev.json")!
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ final class AcalaContributionSource: ExternalContributionSourceProtocol {
accountId _: AccountId,
chain _: ChainModel
) -> CompoundOperationWrapper<[ExternalContribution]> {
let paraIdWrapper = paraIdOperationFactory.createParaIdOperation(for: acalaChainId)

let mergeOperation = ClosureOperation<[ExternalContribution]> { [sourceName] in
let paraId = try paraIdWrapper.targetOperation.extractNoCancellableResultData()

return [ExternalContribution(source: sourceName, amount: 0, paraId: paraId)]
}

mergeOperation.addDependency(paraIdWrapper.targetOperation)

return CompoundOperationWrapper(targetOperation: mergeOperation, dependencies: paraIdWrapper.allOperations)
CompoundOperationWrapper.createWithResult([])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,12 @@ import Foundation
import RobinHood

final class ParallelContributionSource: ExternalContributionSourceProtocol {
static let baseURL = URL(string: "https://auction-service-prod.parallel.fi/crowdloan/rewards")!
var sourceName: String { "Parallel" }

func getContributions(accountId: AccountId, chain: ChainModel) -> CompoundOperationWrapper<[ExternalContribution]> {
guard let accountAddress = try? accountId.toAddress(using: chain.chainFormat) else {
return CompoundOperationWrapper.createWithError(ChainAccountFetchingError.accountNotExists)
}

let url = Self.baseURL
.appendingPathComponent(chain.name.lowercased())
.appendingPathComponent(accountAddress)

let requestFactory = BlockNetworkRequestFactory {
var request = URLRequest(url: url)
request.httpMethod = HttpMethod.get.rawValue
return request
}

let resultFactory = AnyNetworkResultFactory<[ExternalContribution]> { [sourceName] data in
let resultData = try JSONDecoder().decode(
[ParallelContributionResponse].self,
from: data
)

return resultData.map { ExternalContribution(source: sourceName, amount: $0.amount, paraId: $0.paraId) }
}

let operation = NetworkOperation(requestFactory: requestFactory, resultFactory: resultFactory)

return CompoundOperationWrapper(targetOperation: operation)
func getContributions(
accountId _: AccountId,
chain _: ChainModel
) -> CompoundOperationWrapper<[ExternalContribution]> {
CompoundOperationWrapper.createWithResult([])
}
}

0 comments on commit 2923df9

Please sign in to comment.