Overview
This guide outlines how to integrate and use external cryptocurrency wallets with the ParaSwift SDK. With the unified wallet architecture, the Swift SDK has removed all blockchain-specific dependencies and now provides a streamlined approach to external wallet connectivity. The SDK supports external wallets like MetaMask through deep-linking protocols and provides built-in authentication and transaction signing capabilities. You can also use external wallet addresses to authenticate with Para.Unified Wallet Architecture: The Swift SDK v2 has removed all blockchain-specific packages (web3swift, solana-swift, etc.) and now uses only BigInt for handling blockchain values. This provides a cleaner, more maintainable architecture while still supporting all necessary external wallet operations.The SDK now has minimal dependencies:
- BigInt: For handling large blockchain numbers (Wei, gas values, etc.)
- PhoneNumberKit: For phone number validation in authentication flows
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
LSApplicationQueriesSchemesas 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 identifier 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:The deep link handling has been simplified to use a static method. You no longer need to maintain a MetaMaskConnector instance at the app level just for handling deep links.
Connecting
To connect to MetaMask and retrieve the user’s accounts:Automatic Authentication: The MetaMask connector automatically attempts to authenticate with Para after a successful connection. This streamlines the user experience by reducing the number of manual steps required.
Sign Message
To request a signature for a message from MetaMask:Send Transaction
To send a transaction through MetaMask using the EVMTransaction model:Alternative: Raw Transaction Format
You can also use a raw transaction dictionary format:Properties
The MetaMask connector provides several useful properties:Supported Networks
The MetaMask connector works with any EVM-compatible network that MetaMask supports. Common networks include:| Network | Chain ID | Description |
|---|---|---|
| Ethereum Mainnet | 0x1 | Main Ethereum network |
| Sepolia Testnet | 0xaa36a7 | Ethereum test network |
| Polygon | 0x89 | Polygon mainnet |
| Arbitrum One | 0xa4b1 | Arbitrum Layer 2 |
| Base | 0x2105 | Base Layer 2 |
Working with BigUInt Values
Since the Swift SDK now uses BigInt for handling blockchain values, here are some utility patterns for working with Ether and Wei conversions:These utility functions help you convert between human-readable Ether amounts and the Wei values required by the blockchain. Always validate decimal inputs to prevent runtime crashes.