Swift (iOS)
Integrate the widget into iOS applications using WKWebView with proper wallet injection.Implementation
- Use
WKWebViewwith unique client url injectedinwindowmust be initialized with your wallet
Code Example
View Model
Kotlin (Android)
Integrate the widget into Android applications using WebView with custom wallet injection.Implementation
- Use
WebViewwith unique client url injectedinwindowmust be initialized with your wallet
Activity Code
View Model
Layout XML
React Native
Integrate the widget into React Native applications using react-native-webview.Implementation
- Use
WebViewwith unique client url injectedinwindowmust be initialized with your wallet
Code Example
Web Integration (No Custom Wallet)
For web applications where you don’t need custom wallet integration, use a simple iframe approach.Implementation
- Use
iframewith unique client url - For wallet connection, RainbowKit is used internally
Code Example
Sending events from host to widget (postMessage)
If you embed the widget via an iframe and need to notify it about host-side events (e.g. theme change), usepostMessage.
Host → widget message format:
setThemewith payload{ theme: "light" | "dark" }
event.origin. Configure allowed origins contacting our team.
Responsive Integration
Security Considerations
When integrating the widget across platforms, consider these security aspects:JavaScript Injection
- Always validate and sanitize any data before injecting JavaScript
- Use secure communication channels between your app and the widget
- Implement proper error handling for wallet injection failures
Network Security
- Ensure HTTPS is used for all widget URLs
- Implement certificate pinning where possible
- Handle network failures gracefully
Wallet Security
- Never expose private keys or sensitive wallet data
- Use secure storage mechanisms for wallet credentials
- Implement proper session management
Testing Integration
Platform-Specific Testing
iOS Testing:- Test on different iOS versions and device sizes
- Verify WKWebView security settings
- Test wallet injection scenarios
- Test on various Android versions and devices
- Verify WebView security configurations
- Test JavaScript bridge functionality
- Test on both iOS and Android platforms
- Verify WebView component behavior
- Test navigation and state management
- Test iframe behavior across browsers
- Verify responsive design
- Test wallet connection flows
Troubleshooting
Common Issues
Wallet Injection Failures:- Ensure URLs are properly formatted for each platform
- Test deep linking and navigation flows
- Verify consistent behavior across platforms