{"id":13903057,"url":"https://github.com/WalletConnect/WalletConnectSwift","last_synced_at":"2025-07-18T00:33:04.751Z","repository":{"id":37601869,"uuid":"201234855","full_name":"WalletConnect/WalletConnectSwift","owner":"WalletConnect","description":"WalletConnect Swift SDK","archived":false,"fork":false,"pushed_at":"2023-06-07T09:13:21.000Z","size":485,"stargazers_count":353,"open_issues_count":43,"forks_count":171,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-07-01T12:24:12.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WalletConnect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-08-08T10:25:50.000Z","updated_at":"2025-06-16T15:16:56.000Z","dependencies_parsed_at":"2023-02-17T23:31:33.434Z","dependency_job_id":null,"html_url":"https://github.com/WalletConnect/WalletConnectSwift","commit_stats":{"total_commits":213,"total_committers":15,"mean_commits":14.2,"dds":0.6901408450704225,"last_synced_commit":"9e4dfba34fb35336fd5da551285d7986ff536cb8"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/WalletConnect/WalletConnectSwift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WalletConnect%2FWalletConnectSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WalletConnect%2FWalletConnectSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WalletConnect%2FWalletConnectSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WalletConnect%2FWalletConnectSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WalletConnect","download_url":"https://codeload.github.com/WalletConnect/WalletConnectSwift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WalletConnect%2FWalletConnectSwift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264564798,"owners_count":23628846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T22:01:35.578Z","updated_at":"2025-07-18T00:33:04.722Z","avatar_url":"https://github.com/WalletConnect.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# WalletConnectSwift\n\nSwift SDK implementing [WalletConnect 1.x.x](https://docs.walletconnect.org) protocol for native iOS Dapps and Wallets.\n\n# Features\n\n- Server (wallet side)\n  - Create, reconnect, disconnect, and update session\n  - Flexible, extendable request handling with `Codable` support via JSON RPC 2.0\n\n- Client (native dapp side)\n  - Create, reconnect, disconnect, and update session\n  - Default implementation of [WalletConnect SDK API](https://docs.walletconnect.org/json-rpc/ethereum)\n    - `personal_sign`\n    - `eth_sign`\n    - `eth_signTypedData`\n    - `eth_sendTransaction`\n    - `eth_signTransaction`\n    - `eth_sendRawTransaction`\n  - Send custom RPC requests with `Codable` support via JSON RPC 2.0\n\n# Example Code\nExample code is in a separate repository: https://github.com/WalletConnect/WalletConnectSwift-Example\n\n- Wallet Example App:\n  - Connecting via QR code reader\n  - Connecting via deep link (\"wc\" scheme)\n  - Reconnecting after restart\n  - Examples of request handlers\n- Dapp Example App:\n  - Connecting via QR code reader\n  - Connecting via deep link (\"wc\" scheme)\n  - Reconnecting after restart\n  - Examples of request handlers\n\n## Usage in a Wallet\n\nTo start connections, you need to create and retain a `Server` object to which you provide a delegate:\n\n```Swift\nlet server = Server(delegate: self)\n```\n\nThe library handles WalletConnect-specific session requests for you - `wc_sessionRequest` and `wc_sessionUpdate`. \n\nTo register for the important session update events, implement the delegate methods `shouldStart`, `didConnect`, `didDisconnect` and `didFailToConnect`.\n\nBy default, the server cannot handle any other reqeusts - you need to provide your implementation.\n\nYou do this by registering request handlers. You have the flexibility to register one handler per request method, or a catch-all request handler.\n\n\n```Swift\nserver.register(handler: PersonalSignHandler(for: self, server: server, wallet: wallet))\n```\n\nHandlers are asked (in order of registration) whether they can handle each request. First handler that returns `true` from `canHandle(request:)` method will get the `handle(request:)` call. All other handlers will be skipped.\n\nIn the request handler, check the incoming request's method in `canHandle` implementation, and handle actual request in the `handle(request:)` implementation.\n\n```Swift\nfunc canHandle(request: Request) -\u003e Bool {\n   return request.method == \"eth_signTransaction\"\n}\n```\n\nYou can send back response for the request through the server using `send` method:\n\n```Swift\nfunc handle(request: Request) {\n  // do you stuff here ...\n  \n  // error response - rejected by user\n  server.send(.reject(request))\n\n  // or send actual response - assuming the request.id exists, and MyCodableStruct type defined\n  try server.send(Response(url: request.url, value: MyCodableStruct(value: \"Something\"), id: request.id!))\n}\n```\n\nFor more details, see the `ExampleApps/ServerApp`\n\n\n## Usage in a Dapp\n\nTo start connections, you need to create and keep alive a `Client` object to which you provide `DappInfo` and a delegate:\n\n```Swift\nlet client = Client(delegate: self, dAppInfo: dAppInfo)\n```\n\nThe delegate then will receive calls when connection established, failed, or disconnected.\n\nUpon successful connection, you can invoke various API methods on the `Client`.\n\n```Swift\ntry? client.personal_sign(url: session.url, message: \"Hi there!\", account: session.walletInfo!.accounts[0]) {\n      [weak self] response in\n      // handle the response from Wallet here\n  }\n```\n\nYou can also send a custom request. The request ID required by JSON RPC is generated and handled by the library internally.\n\n```Swift\ntry? client.send(Request(url: url, method: \"eth_gasPrice\")) { [weak self] response in\n    // handle the response\n}\n```\n\nYou can convert the received response result to a `Decodable` type.\n\n```Swift\nlet nonceString = try response.result(as: String.self)\n```\n\nYou can also check if the wallet responded with error:\n\n```Swift\nif let error = response.error { // NSError\n  // handle error\n}\n```\n\nFor more details, see the `ExampleApps/ClientApp`\n\n## Logs\n\nFilter the type of logs being printed by changing the log level `LogService.level = .info`.\n\n# Running Example Apps\n\nPlease open `ExampleApps/ExampleApps.xcodeproj`\n\n# Installation\n\n## Prerequisites\n\n- iOS 13.0 or macOS 10.14\n- Swift 5\n\n## WalletConnectSwift dependencies\n\n- CryptoSwift - for cryptography operations\n\n## Swift Package Manager\n\nIn your `Package.swift`:\n\n    dependencies: [\n        .package(url: \"https://github.com/WalletConnect/WalletConnectSwift.git\", .upToNextMinor(from: \"1.2.0\"))\n    ]\n\n## CocoaPods\n\nIn your `Podfile`:\n\n    platform :ios, '13.0'\n    use_frameworks!\n\n    target 'MyApp' do\n      pod 'WalletConnectSwift'\n    end\n\n## Carthage\n\nIn your `Cartfile`:\n\n    github \"WalletConnect/WalletConnectSwift\"\n\nRun `carthage update` to build the framework and drag the WalletConnectSwift.framework in your Xcode project.\n\n# Acknowledgments\n\nWe'd like to thank [Trust Wallet](https://github.com/trustwallet/wallet-connect-swift) team for inspiration in implementing this library.\n\n# Contributors\n\n* Andrey Scherbovich ([sche](https://github.com/sche))\n* Dmitry Bespalov ([DmitryBespalov](https://github.com/DmitryBespalov))\n\n# License\n\nMIT License (see the LICENSE file).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWalletConnect%2FWalletConnectSwift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWalletConnect%2FWalletConnectSwift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWalletConnect%2FWalletConnectSwift/lists"}