Lightweight Web3 utilities for React Native wallets and DeFi apps. Zero native dependencies — safe to use in Expo and bare React Native projects.
Built by Rajan Kumar · Senior Frontend Developer · React Native · Web3
npm install react-native-web3-kit
# or
yarn add react-native-web3-kit- Address helpers — validate, shorten, and compare EVM addresses
- Amount formatting — gwei ↔ ETH conversion, wei parsing
- Chain metadata — Ethereum, Polygon, Arbitrum, Base explorers & RPC URLs
- App state hook — reconnect wallet/RPC when app returns to foreground
import { formatAddress, isValidAddress } from "react-native-web3-kit";
if (isValidAddress(userInput)) {
console.log(formatAddress(userInput)); // 0x742d...f44e
}import { gweiToEth, parseEthToWei } from "react-native-web3-kit";
gweiToEth(1_500_000_000n); // "1.5"
parseEthToWei("0.25"); // 250000000000000000nimport { getExplorerTxUrl } from "react-native-web3-kit";
getExplorerTxUrl(1, "0xabc..."); // https://etherscan.io/tx/0xabc...import { AppState } from "react-native";
import { useAppStateReconnect } from "react-native-web3-kit";
function WalletProvider({ children }) {
useAppStateReconnect(async () => {
await reconnectWallet();
}, { AppState });
return children;
}| Export | Description |
|---|---|
isValidAddress |
Validate EVM address format |
formatAddress |
Shorten address for UI |
addressesEqual |
Case-insensitive address compare |
gweiToEth |
Convert gwei bigint to ETH string |
parseEthToWei |
Parse decimal ETH to wei |
formatTxHash |
Shorten transaction hash |
CHAINS |
Common chain metadata |
getChainById |
Lookup chain by ID |
getExplorerAddressUrl |
Block explorer address URL |
getExplorerTxUrl |
Block explorer tx URL |
useAppStateReconnect |
Reconnect callback on foreground |
npm install
npm test
npm run buildIssues and PRs welcome! See CONTRIBUTING.md.
MIT © Rajan Kumar