diff --git a/Sources/ElixxirDAppsSDK/MessageSender.swift b/Sources/ElixxirDAppsSDK/MessageSender.swift index 888159b46e503b74ed83cd02b181793317a960ab..4e493b132666a40997a30f63e52dd58f7b3f63af 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 } } }