From 37629e49f1a9a0980071ebffd408a3e04c5ed762 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Tue, 7 Jun 2022 11:55:06 +0200 Subject: [PATCH] Use MessageSendReport in MessageSender --- Sources/ElixxirDAppsSDK/MessageSender.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sources/ElixxirDAppsSDK/MessageSender.swift b/Sources/ElixxirDAppsSDK/MessageSender.swift index 888159b4..4e493b13 100644 --- a/Sources/ElixxirDAppsSDK/MessageSender.swift +++ b/Sources/ElixxirDAppsSDK/MessageSender.swift @@ -1,12 +1,12 @@ import Bindings public struct MessageSender { - public var send: (Int, Data) throws -> Data + public var send: (Int, Data) throws -> MessageSendReport public func callAsFunction( messageType: Int, payload: Data - ) throws -> Data { + ) throws -> MessageSendReport { try send(messageType, payload) } } @@ -28,7 +28,10 @@ extension MessageSender { sendE2E: @escaping (Int, Data) throws -> Data ) -> MessageSender { MessageSender { messageType, payload in - try sendE2E(messageType, payload) + let reportData = try sendE2E(messageType, payload) + let decoder = JSONDecoder() + let report = try decoder.decode(MessageSendReport.self, from: reportData) + return report } } } -- GitLab