gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 06/10: GetScopedCurrencyInfo


From: gnunet
Subject: [taler-taler-ios] 06/10: GetScopedCurrencyInfo
Date: Tue, 08 Aug 2023 12:29:25 +0200

This is an automated email from the git hooks/post-receive script.

marc-stibane pushed a commit to branch master
in repository taler-ios.

commit 949faafeaefa0ed08545b7315aec6309919594c3
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Aug 8 12:16:54 2023 +0200

    GetScopedCurrencyInfo
---
 TalerWallet1/Model/Model+Exchange.swift | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/TalerWallet1/Model/Model+Exchange.swift 
b/TalerWallet1/Model/Model+Exchange.swift
index 8446893..434311d 100644
--- a/TalerWallet1/Model/Model+Exchange.swift
+++ b/TalerWallet1/Model/Model+Exchange.swift
@@ -76,6 +76,26 @@ fileprivate struct AddExchange: 
WalletBackendFormattedRequest {
         var exchangeBaseUrl: String
     }
 }
+
+/// A request to get info about a currency
+struct ScopedCurrencyInfo: Decodable {
+    var decimalSeparator: String
+    var numFractionalDigits: Int        // 0 Yen, 2 €,$, 3 arabic
+    var numTinyDigits: Int              // SuperScriptDigits
+    var isCurrencyNameLeading: Bool
+}
+
+fileprivate struct GetScopedCurrencyInfo: WalletBackendFormattedRequest {
+    typealias Response = ScopedCurrencyInfo
+    func operation() -> String { return "getScopedCurrencyInfo" }
+    func args() -> Args { return Args(scope: scope) }
+
+    var scope: ScopeInfo
+
+    struct Args: Encodable {
+        var scope: ScopeInfo
+    }
+}
 // MARK: -
 extension WalletModel {
     /// ask wallet-core for its list of known exchanges
@@ -97,4 +117,12 @@ extension WalletModel {
         logger.info("adding exchange: \(url, privacy: .public)")
         _ = try await sendRequest(request)
     }
+
+    @MainActor func getScopedCurrencyInfoM(scope: ScopeInfo)
+    async throws -> ScopedCurrencyInfo {   // M for MainActor
+        let request = GetScopedCurrencyInfo(scope: scope)
+        let response = try await sendRequest(request, ASYNCDELAY)
+        return response
+    }
+
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]