External Wallets
Instructions for using external wallets with the ParaSwift SDK.
Overview
This guide outlines how to integrate and use external cryptocurrency wallets with the ParaSwift SDK. It covers setup, deep-linking protocols, authentication, and transaction signing processes for wallets such as MetaMask.
Deep Linking
The ParaSwift SDK communicates with other apps via deep linking. To enable deep linking for your application, you’ll need to configure your app appropriately.
Configure URL Schemes
First, you need to configure your app to handle custom URL schemes:
- Open your app’s Info.plist file
- Add a new entry for
LSApplicationQueriesSchemes
as an array - Add the URL schemes of supported wallets as strings to this array
Configure URL Types
Next, you need to set up URL Types to handle callbacks from external wallets:
- In Xcode, select your app target
- Go to “Info” tab
- Expand “URL Types”
- Click the ”+” button to add a new URL Type
- Set the “Identifier” to your app’s bundle identifier
- Set the “URL Schemes” to a unique scheme for your app
MetaMask Connector
Setup
Create and initialize the MetaMask connector with your app’s configuration:
Handle Deep Links
Handle incoming deep links from MetaMask by adding a URL handler in your SwiftUI app:
Connecting
To connect to MetaMask and retrieve the user’s accounts:
Sign Message
To request a signature for a message from MetaMask:
Send Transaction
To send a transaction through MetaMask using the standard transaction parameters:
Alternatively, you can use a raw transaction dictionary format:
Properties
The MetaMask connector provides several useful properties:
Advanced Configuration
Customizing MetaMask Connection
You can customize various aspects of the MetaMask connection by modifying the MetaMaskConfig:
Working with Different Networks
MetaMask supports multiple networks. You can check the current network and adjust your app’s behavior accordingly: