From 3e1a515f6214542866d5de49cf66206c377f62ed Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Tue, 7 Jun 2022 11:53:13 +0200 Subject: [PATCH] Use MessageSendReport in MessageDeliveryWaiter --- .../ElixxirDAppsSDK/MessageDeliveryWaiter.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift b/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift index 92b6ab96..38283a47 100644 --- a/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift +++ b/Sources/ElixxirDAppsSDK/MessageDeliveryWaiter.swift @@ -6,22 +6,24 @@ public struct MessageDeliveryWaiter { case notDelivered(timedOut: Bool) } - public var wait: (Data, Int, @escaping (Result) -> Void) throws -> Void + public var wait: (MessageSendReport, Int, @escaping (Result) -> Void) throws -> Void public func callAsFunction( - roundList: Data, + report: MessageSendReport, timeoutMS: Int, callback: @escaping (Result) -> Void - ) throws -> Void { - try wait(roundList, timeoutMS, callback) + ) throws { + try wait(report, timeoutMS, callback) } } extension MessageDeliveryWaiter { public static func live(bindingsClient: BindingsClient) -> MessageDeliveryWaiter { - MessageDeliveryWaiter { roundList, timeoutMS, callback in + MessageDeliveryWaiter { report, timeoutMS, callback in + let encoder = JSONEncoder() + let reportData = try encoder.encode(report) try bindingsClient.wait( - forMessageDelivery: roundList, + forMessageDelivery: reportData, mdc: Callback(onCallback: callback), timeoutMS: timeoutMS ) -- GitLab