Skip to content

Commit

Permalink
Merge branch 'feature/bug_fixes' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Jan 25, 2024
2 parents ff33204 + c751e35 commit 3e805be
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Kukai Mobile/Modules/Side Menu/OnrampViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,8 @@ class OnrampViewModel: ViewModel, UITableViewDiffableDataSourceHandler {

private func buildTransakURL(withBaseURL: String, andAddress address: String, completion: @escaping ((Result<URL, KukaiError>) -> Void)) {
let apiKey = "f1336570-699b-4181-9bd1-cdd57206981f" // "3b0e81f3-37dc-41f3-9837-bd8d2c350313" : "f1336570-699b-4181-9bd1-cdd57206981f"
let walletData: [String: Any] = [
"coins": [
"XTZ": [ address ]
]
]

guard let jsonData = try? JSONSerialization.data(withJSONObject: walletData),
let jsonString = String(data: jsonData, encoding: .utf8),
let url = URL(string: "\(withBaseURL)?apiKey=\(apiKey)&cryptoCurrencyCode=XTZ&walletAddressesData=\(jsonString)&disableWalletAddressForm=true") else {

guard let url = URL(string: "\(withBaseURL)?apiKey=\(apiKey)&cryptoCurrencyCode=XTZ&walletAddressesData={\"coins\":{\"XTZ\":{\"address\":\"\(address)\"}}}&disableWalletAddressForm=true}") else {
completion(Result.failure(KukaiError.unknown()))
return
}
Expand All @@ -141,7 +134,7 @@ class OnrampViewModel: ViewModel, UITableViewDiffableDataSourceHandler {

let data = try? JSONSerialization.data(withJSONObject: params)
DependencyManager.shared.tezosNodeClient.networkService.request(url: kukaiServiceURL, isPOST: true, withBody: data, forReturnType: Data.self) { result in
guard let res = try? result.get(), let sigString = String(data: res, encoding: .utf8), let sanitised = sigString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
guard let res = try? result.get(), let sigString = String(data: res, encoding: .utf8), let sanitised = sigString.addingPercentEncoding(withAllowedCharacters: .alphanumerics) else {
completion(Result.failure(result.getFailure()))
return
}
Expand Down

0 comments on commit 3e805be

Please sign in to comment.