spb/os-vault Public
Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.
Swift 96%
Shell 3.4%
Makefile 0.6%
1import Foundation23/// The abstract websocket task provider, default is URLSession4public protocol WebSocketTaskProvider {5 init(configuration: URLSessionConfiguration, delegate: URLSessionDelegate?, delegateQueue queue: OperationQueue?)6 func createWebSocketTask(with url: URL) -> WebSocketTask7}89extension URLSession: WebSocketTaskProvider {10 public func createWebSocketTask(with url: URL) -> WebSocketTask {11 webSocketTask(with: url)12 }13}1415/// Abstract websocket task, default is URLSessionWebSocketTask16public protocol WebSocketTask {17 func resume()18 func cancel()19 func send(_ message: URLSessionWebSocketTask.Message) async throws20 func receive() async throws -> URLSessionWebSocketTask.Message21 func sendPing(pongReceiveHandler: @escaping (Error?) -> Void)22}2324extension URLSessionWebSocketTask: WebSocketTask {}2526/// Delegate for listening socket's events27public protocol SolanaSocketEventsDelegate: AnyObject {28 func connected()29 func nativeAccountNotification(notification: SocketNativeAccountNotification)30 func tokenAccountNotification(notification: SocketTokenAccountNotification)31 func programNotification(notification: SocketProgramAccountNotification)32 func signatureNotification(notification: SocketSignatureNotification)33 func logsNotification(notification: SocketLogsNotification)34 func unsubscribed(id: String)35 func subscribed(socketId: UInt64, id: String)36 func disconnected(reason: String, code: Int)37 func error(error: Error?)38}3940public extension SolanaSocketEventsDelegate {41 func connected() {}4243 func nativeAccountNotification(notification _: SocketNativeAccountNotification) {}4445 func tokenAccountNotification(notification _: SocketTokenAccountNotification) {}4647 func programNotification(notification _: SocketProgramAccountNotification) {}4849 func signatureNotification(notification _: SocketSignatureNotification) {}5051 func logsNotification(notification _: SocketLogsNotification) {}5253 func unsubscribed(id _: String) {}5455 func subscribed(socketId _: UInt64, id _: String) {}5657 func disconnected(reason _: String, code _: Int) {}5859 func error(error _: Error?) {}60}61