OMS Wallet SDK for bare React Native apps and Expo development builds on iOS and Android.
- React Native 0.85 or newer with React 19.2 or newer
- Android
minSdk 24,compileSdk 36, Java 17, and Android 10 / API 29 or newer at runtime - iOS 15 or newer with Xcode 26
The package contains native code. Expo Go and React Native Web are not supported.
Install the package:
npm install @polygonlabs/oms-wallet-react-nativeReact Native autolinking connects the native modules. Install the iOS pods after adding the package:
npx pod-installInstall the package in an Expo SDK 56 app:
npx expo install @polygonlabs/oms-wallet-react-nativeCreate a native development build with prebuild or EAS Build:
npx expo prebuild
npx expo run:ios
# or: npx expo run:androidNo SDK config plugin is required. Add your redirect scheme to the app's Expo configuration when using redirect authentication.
Create one OMSWallet and reuse it for the lifetime of the app:
import { OMSWallet } from '@polygonlabs/oms-wallet-react-native';
const omsWallet = new OMSWallet({
publishableKey: '<publishable-key>',
});await omsWallet.wallet.startEmailAuth({
email: 'player@example.com',
sessionLifetimeSeconds: 604800,
});
const { walletAddress } = await omsWallet.wallet.completeEmailAuth({
code: '<otp-code>',
});
console.log(walletAddress);Automatic wallet selection is the default. Handle walletSelection only when an authentication call requests manual selection.
For mobile integrations, prefer the provider's native SDK when it can return an ID token:
await omsWallet.wallet.signInWithOidcIdToken({
idToken,
issuer: 'https://accounts.google.com',
audience: '<google-client-id>',
provider: 'google',
providerLabel: 'Google',
});The app presents the browser and passes the returned callback URI to OMS Wallet. For the fixed OMS Google and Apple configurations, use OmsRelayOidcProviders:
import { OmsRelayOidcProviders } from '@polygonlabs/oms-wallet-react-native';
const callbackUri = 'com.example.app://auth/callback';
const started = await omsWallet.wallet.startOidcRedirectAuth({
provider: OmsRelayOidcProviders.google,
omsRelayReturnUri: callbackUri,
});
// Present started.authorizationUrl with the app's authentication browser.
const callback = await omsWallet.wallet.handleOidcRedirectCallback({
callbackUrl: returnedCallbackUrl,
});Bare React Native apps can use an authentication-browser package such as react-native-inappbrowser-reborn. Expo apps can use expo-web-browser in a development build. CustomOidcProviderConfig is for a provider configuration owned by your project.
import {
FeeOptionSelectors,
Networks,
parseUnits,
} from '@polygonlabs/oms-wallet-react-native';
const signature = await omsWallet.wallet.signMessage({
network: Networks.polygon,
message: 'Hello from React Native',
});
const transaction = await omsWallet.wallet.sendTransaction({
network: Networks.polygon,
to: '0xRecipient',
value: parseUnits('0.01', 18),
selectFeeOption: FeeOptionSelectors.firstAvailable,
});sendTransaction and callContract wait for transaction status by default. Set waitForStatus: false to return after submission.
const walletAddress = await omsWallet.wallet.getWalletAddress();
const balances = await omsWallet.indexer.getBalances({
walletAddress: walletAddress!,
networks: [Networks.polygon],
includeMetadata: true,
});examples/sdk-example: bare React Native wallet demoexamples/trails-actions-example: bare React Native Trails actions demoexamples/expo-example: Expo development-build wallet demo
Apache-2.0