Wallet Integration
TheWalletDelegate protocol is the bridge between the Privacy Boost SDK and your wallet. This guide covers implementing it for various wallet types, expanding on the brief examples in Authentication.
Protocol Definition
Implementation Requirements
Return Values
- Addresses: Checksummed hex strings with
0xprefix (42 characters) - Signatures: Hex strings with
0xprefix (132 characters for 65 bytes) - Transaction hashes: Hex strings with
0xprefix (66 characters) - Chain ID: Integer matching expected network
Async Behavior
All WalletDelegate methods areasync throws. The SDK awaits each call, so your implementation can use native Swift concurrency (async/await).
WalletConnect Integration
Example using WalletConnect Swift SDK:Web3.swift Integration
Example using web3.swift with a local keystore:Testing with Mock Wallet
For testing, create a mock delegate:Error Handling
Throw appropriate errors from delegate methods:Best Practices
- Validate inputs - Check addresses and data formats before processing
- Handle timeouts - Set reasonable timeouts for wallet operations
- User feedback - Show loading indicators during signing/transactions
- Error messages - Provide clear error messages for user-facing errors
- Thread safety - Ensure delegate methods can be called from any thread
Next Steps
- Getting Started - iOS SDK overview