Connect Wallets with dApps on Tezos
Octez Connect is an implementation of the wallet interaction standard tzip-10 which describes the connection of a dApp with a wallet.
The Octez Connect iOS SDK provides iOS developers with tools useful for setting up communication between native wallets supporting Tezos and dApps that implement the Octez Connect protocol.
This SDK is a fork of the Beacon iOS SDK (formerly maintained by AirGap/Papers), migrated to use Trilitech-hosted Matrix infrastructure and rebranded as Octez Connect.
To add Octez Connect iOS SDK with the Swift Package Manager, add the package dependency:
Open the Add Package Dependency window (as described in the official guide) and enter the Octez Connect iOS SDK GitHub repository URL:
https://github.com/trilitech/octez-connect-ios-sdk
Add the following dependency in your Package.swift file:
dependencies: [
.package(url: "https://github.com/trilitech/octez-connect-ios-sdk", from: "4.0.0")
]Then add the products to your target dependencies:
.target(
name: "MyTarget",
dependencies: [
.product(name: "OctezConnectCore", package: "octez-connect-ios-sdk"),
.product(name: "OctezConnectBlockchainTezos", package: "octez-connect-ios-sdk"),
.product(name: "OctezConnectClientWallet", package: "octez-connect-ios-sdk"),
.product(name: "OctezConnectTransportP2PMatrix", package: "octez-connect-ios-sdk")
]
)To add Octez Connect iOS SDK using CocoaPods, add the pods to your Podfile:
target 'MyTarget' do
use_frameworks!
pod 'OctezConnectCore', :git => 'https://github.com/trilitech/octez-connect-ios-sdk', :tag => '4.0.0'
# optional
pod 'OctezConnectClientDApp', :git => 'https://github.com/trilitech/octez-connect-ios-sdk', :tag => '4.0.0'
# optional
pod 'OctezConnectClientWallet', :git => 'https://github.com/trilitech/octez-connect-ios-sdk', :tag => '4.0.0'
# optional
pod 'OctezConnectBlockchainSubstrate', :git => 'https://github.com/trilitech/octez-connect-ios-sdk', :tag => '4.0.0'
# optional
pod 'OctezConnectBlockchainTezos', :git => 'https://github.com/trilitech/octez-connect-ios-sdk', :tag => '4.0.0'
# optional
pod 'OctezConnectTransportP2PMatrix', :git => 'https://github.com/trilitech/octez-connect-ios-sdk', :tag => '4.0.0'
endThe snippets below show how to quickly setup listening for incoming messages.
import OctezConnectCore
import OctezConnectBlockchainSubstrate
import OctezConnectBlockchainTezos
import OctezConnectClientWallet
import OctezConnectTransportP2PMatrix
class OctezConnectController {
private var client: Beacon.WalletClient?
func start() {
Beacon.WalletClient.create(
with: Beacon.Client.Configuration(
name: "My App",
blockchains: [Tezos.factory, Substrate.factory],
connections: [try Transport.P2P.Matrix.connection()]
)
) { result in
switch result {
case let .success(client):
self.client = client
self.listenForMessages()
case let .failure(error):
/* handle error */
}
}
}
func listenForMessages() {
client?.connect { result in
switch result {
case .success(_):
self.client?.listen { request in
/* process messages */
}
case let .failure(error):
/* handle error */
}
}
}
}The project is divided into the following packages:
Core packages are the basis for other packages. They are required for the SDK to work as expected.
| Module | Description | Dependencies | Required by |
|---|---|---|---|
OctezConnectCore |
Base for other modules | ✖️ | OctezConnectClientWallet OctezConnectBlockchainSubstrate OctezConnectBlockchainTezos OctezConnectTransportP2PMatrix |
Client packages ship with Octez Connect implementations for different parts of the network.
| Module | Description | Dependencies | Required by |
|---|---|---|---|
OctezConnectClientDApp |
Octez Connect implementation for dApps | OctezConnectCore |
✖️ |
OctezConnectClientWallet |
Octez Connect implementation for wallets | OctezConnectCore |
✖️ |
Blockchain packages provide support for different blockchains.
| Module | Description | Dependencies | Required by |
|---|---|---|---|
OctezConnectBlockchainSubstrate |
Substrate specific components | OctezConnectCore |
✖️ |
OctezConnectBlockchainTezos |
Tezos specific components | OctezConnectCore |
✖️ |
Transport packages provide various interfaces used to establish connection between Octez Connect clients.
| Module | Description | Dependencies | Required by |
|---|---|---|---|
OctezConnectTransportP2PMatrix |
P2P implementation which uses Matrix for the communication | OctezConnectCore |
✖️ |
If you're migrating from the Beacon iOS SDK (maintained by AirGap/Papers), see our Migration Guide for detailed instructions.
Quick Summary:
- Update dependencies to use
trilitech/octez-connect-ios-sdkrepository - Replace
import Beacon*withimport OctezConnect* - The public API (
Beacon.*,Transport.*, etc.) remains the same, so your existing code should work without modifications
For more examples, see the Demo/BeaconSDKDemo app in this repository.
- Octez Connect Web SDK - SDK for web developers
- Octez Connect Android SDK - SDK for Android developers
This project is licensed under the MIT License - see the LICENSE file for details.