Swift
To interact with Keeper Wallet in your iOS app, complete the following steps:
For more information on using Swift implementation of WalletConnect, see their docs.
Step 1. Register your project in WalletConnect Cloud
Go to WalletConnect Cloud and sign in or sign up.
Click + New project.
Give your project a name and click Create.
On the project page, obtain a Project ID.
Step 2. Install WalletConnect
Cocoapods
Update Cocoapods spec repos. Type in terminal
pod repo update
Initialize Podfile if needed with
pod init
Add pod to your Podfile:
Install pods with
pod install
.
SwiftPackageManager
Open XCode.
Go to File → Add Packages.
Paste the repo GitHub url:
https://github.com/WalletConnect/WalletConnectSwiftV2
Click Add Package.
Select WalletConnect check mark.
Step 3. Set up the networking configuration
Step 4. Configure the Pair instance
Describe your app and define its appearance in Keeper Wallet when a user is prompted to connect or sign a transaction/order/message.
Step 5. Get a pairing URI for Keeper Wallet
Send a request to WalletConnect to get a pairing URI for Keeper Wallet.
Step 6. Connect Keeper Wallet
Here's how it works:
Your app calls Keeper, specifying the callback URL in the request.
The Keeper Wallet app opens and prompts the user to connect.
Once the user confirms or cancels the connection, your app receives a callback.
To call Keeper Wallet, use the universal link. For the callback, a universal link or a custom URL scheme must be defined for your app.
The result of connecting comes to the listener:
Step 7. Sign a transaction/order/message
Here is how it works:
Your app sends a signing request via WalletConnect.
Your app calls Keeper, specifying the callback URL in the request.
The Keeper Wallet app opens and prompts the user to sign the transaction, order, or custom message.
Once the user confirms or cancels the request, your app receives a callback.
Transaction
Example:
Order
Custom message
Call Keeper Wallet
Specify topic
and callback
in the request.
The result of signing the request comes to the listener:
Last updated
Was this helpful?