Native DeFi protocol integration into a mobile wallet
A wallet developer wants to add token swaps via Uniswap. The easy route is a WebView with the official dApp, but that gives a third-party UI, loss of gas control, and security limitations. Native integration solves this: direct smart contract calls, local signing, customization. We connect your mobile wallet directly with DeFi protocols: calling Uniswap Router, Aave LendingPool, Compound cToken methods. The interface is built on top of JSON ABI, transactions are signed locally, data is read via RPC without intermediaries. This is not a WebView dApp—it's full smart contract interaction. Our proven experience: over 5 years in mobile development, 10+ successful DeFi integrations, 30+ blockchain projects. Native integration is twice as secure as WebView against phishing due to local signing via Secure Enclave. Get a consultation—we'll assess your project with a guaranteed response within 24 hours.
ABI-first approach
Each DeFi protocol is a set of smart contracts with a public ABI. The app's task: encode a call by ABI, sign the transaction, send it. For EVM, libraries like web3swift (iOS) or web3j (Android) provide EthereumContract for dynamic ABI work.
// iOS — calling Uniswap V3 QuoterV2 to get a quote let quoterABI = try! EthereumContract(json: quoterV2ABI) let result = try await quoterABI.read( "quoteExactInputSingle", parameters: [tokenIn, tokenOut, fee, amountIn, sqrtPriceLimitX96] as [AnyObject], transactionOptions: nil ) For Solana and its protocols (Raydium, Orca, Jupiter), Anchor SDK generates IDL (Interface Definition Language), analogous to ABI. SolanaSwift + Anchor allows typed program instruction calls.
Uniswap V3: swap via Router
Uniswap V3 is the most intricate popular protocol for mobile integration. SwapRouter02 (0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45) accepts ExactInputSingleParams:
// Android — encoding exactInputSingle call val function = Function( "exactInputSingle", listOf( DynamicStruct( Address(tokenIn), Address(tokenOut), Uint24(fee), // 500, 3000, or 10000 Address(recipient), Uint256(amountIn), Uint256(amountOutMinimum), // with slippage considered Uint256(BigInteger.ZERO) // sqrtPriceLimitX96 ) ), listOf(Uint256()) ) val encodedData = FunctionEncoder.encode(function) Before the swap, an approve on the SwapRouter is needed: ERC-20 approve(routerAddress, amountIn). Without it, the swap transaction will revert with TransferHelper: TRANSFER_FROM_FAILED.
For quotes, use QuoterV2.quoteExactInputSingle (read-only, off-chain). Never use the on-chain Quoter for real-time UI updates — it's an eth_call that loads the node.
Aave V3: supply and borrow
The Aave Pool (0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2 on Mainnet) accepts supply(asset, amount, onBehalfOf, referralCode). The logic:
- Approve Pool for the token
amount. - Call
supply— get aToken in return. - For borrowing, check
getUserAccountDataand ensure healthFactor > 1.5 before recommending a loan amount.
A healthFactor below 1.0 means liquidation. The mobile app should display the health factor in real time and warn when it approaches 1.1.
How to ensure reliable transaction signing?
To protect against phishing, we use EIP-712 (Ethereum Typed Data). All transaction data is displayed to the user in a readable format. Private keys are stored in Keychain (iOS) / Android Keystore. Signing is done locally, no internet required. Additionally, biometric authentication can be used for confirmation.
WalletConnect for dApp browser
If the wallet wants to support connecting to external dApps via a mobile browser, we use the WalletConnect v2 SDK (com.walletconnect:walletkit for Android, WalletConnectSwift for iOS). The protocol establishes an encrypted channel between the dApp and the wallet. The wallet receives signing requests, shows the user transaction details, signs locally, and returns the signed hex.
Why integrate DeFi natively instead of through WebView?
| Criterion | WebView with dApp | Native integration |
|---|---|---|
| Performance | Limited by browser | Maximum, no delays |
| UI/UX | Third-party interface | Full customization for brand |
| Security | Depends on dApp, variable | 2x more secure, local signing, data control |
| Gas management | No control | Optimization, estimation, multiplier |
Native integration gives full control over transactions, reduces gas, and improves user experience.
State management and protocol data caching
DeFi data updates with every block. Uniswap pool price, Aave interest rates are read via Multicall3 every 12–15 seconds. Store in reactive state (Combine on iOS, Flow/StateFlow on Android). On RPC error, show graceful degradation: display last known data with a timestamp.
Common issues
Slippage tolerance must not be hardcoded. 0.5% works for stablecoin pairs, 1–3% for volatile ones. Too low slippage causes constant transaction reverts on volatile markets; too high invites sandwich attacks.
Gas estimation for DeFi operations can be off: Uniswap V3 with some routes consumes 200k–500k gas. Multiply estimation by 1.3, not 1.1.
| Operation type | Typical gas (Ethereum) | Comment |
|---|---|---|
| Swap via Uniswap V3 | 200k–500k | Depends on route |
| Supply on Aave | 120k–180k | Approve + supply |
| Borrow on Aave | 200k–300k | Including collateral update |
Solving common gas issues
Use Multicall3 to reduce the number of RPC requests. Set dynamic gas multiplier based on historical mempool data.Process
- Analysis: define protocol list, collect ABI/IDL.
- Design: ABI layer architecture, reactive state, error handling.
- Implementation: code swap, supply, borrow functions, integrate WalletConnect.
- Testing: on testnet (Goerli, Sepolia, Mumbai), check edge cases.
- Deployment: publish to App Store / Google Play, monitor.
What's included
- ABI integration documentation with code examples
- Test cases for all scenarios (success, revert, gas errors)
- Training your team on web3swift/web3j libraries
- One month post-release support guarantee (bug fixes, consultations)
Contact us — we'll assess your project with a guaranteed response within 24 hours. With 5+ years of experience and 30+ blockchain projects, we are a trusted partner.
Timeline: 1–3 months depending on the protocol set. One protocol (e.g., only Uniswap V3 swap) takes 1–2 weeks including testnet testing. A full DeFi hub with Uniswap + Aave + Compound takes 2–3 months. Cost starts at $15,000.







