Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt

Use this file to discover all available pages before exploring further.

The React Native SDK supports email OTP, OIDC ID-token auth, and low-level OIDC redirect auth. After auth completes, the SDK can automatically select the first existing wallet of the requested type or create one when needed. Use manual wallet selection when your app should present wallet choices.

Configure

Configure the SDK before using authentication, wallet, signing, transaction, balance, or access APIs.
import { configure } from 'oms-client-react-native-sdk'

await configure({
  projectAccessKey: 'YOUR_PROJECT_ACCESS_KEY',
  projectId: 'YOUR_PROJECT_ID',
})
Parameters
ParameterTypeDescription
projectAccessKeystringOMS project access key sent to the native SDKs.
projectIdstringOMS project ID used for request signing scope and session storage scope.
environmentOmsClientEnvironment or undefinedOptional override for walletApiUrl, apiRpcUrl, or indexerUrlTemplate.
Returns Returns Promise<void>.

Start Email Auth

Send a one-time code to the user’s email address.
import { startEmailAuth } from 'oms-client-react-native-sdk'

await startEmailAuth('user@example.com')
Parameters
ParameterTypeDescription
emailstringEmail address that receives the one-time code.
Returns Returns Promise<void>.

Complete Email Auth

Complete the flow with the code entered by the user. Automatic mode selects the first matching wallet or creates one when none exists.
import { completeEmailAuth } from 'oms-client-react-native-sdk'

const result = await completeEmailAuth({ code: '123456' })

if (result.type === 'walletSelected') {
  console.log('Wallet address:', result.walletAddress)
  console.log('Wallet ID:', result.wallet.id)
}
Use manual wallet selection when the app needs to choose between wallets before activating one.
const result = await completeEmailAuth({
  code: '123456',
  walletSelection: 'manual',
  walletType: 'ethereum',
})

if (result.type === 'walletSelection') {
  await result.pendingSelection.createAndSelectWallet('main')
}
Parameters
ParameterTypeDescription
codestringOne-time code entered by the user.
walletSelection'automatic' or 'manual'Defaults to 'automatic'. Use 'manual' to receive a pending wallet selection.
walletType'ethereum' or undefinedOptional wallet type. Defaults to ethereum.
Returns Returns Promise<OmsCompleteAuthResult>.
FieldTypeDescription
type'walletSelected' or 'walletSelection'Indicates whether a wallet was activated or manual selection is pending.
walletAddressstring or nullActive embedded wallet address in automatic mode.
walletOmsWallet or nullSelected or created wallet in automatic mode.
walletsOmsWallet[]Wallets returned by auth completion.
credentialOmsCredentialInfoCredential added by auth completion.
pendingSelectionOmsPendingWalletSelection or undefinedManual wallet selection helper.

Sign In With OIDC ID Token

Authenticate with an ID token your app receives from an OIDC provider.
import { signInWithOidcIdToken } from 'oms-client-react-native-sdk'

const result = await signInWithOidcIdToken({
  idToken: 'OIDC_ID_TOKEN',
  issuer: 'https://accounts.google.com',
  audience: 'YOUR_WEB_CLIENT_ID',
  walletSelection: 'automatic',
  walletType: 'ethereum',
})

if (result.type === 'walletSelected') {
  console.log('Wallet address:', result.walletAddress)
}
Parameters
ParameterTypeDescription
idTokenstringOIDC ID token issued to the app.
issuerstringExpected token issuer.
audiencestringExpected token audience, such as the app’s OIDC client ID.
walletSelection'automatic' or 'manual'Defaults to 'automatic'. Use 'manual' to receive a pending wallet selection.
walletType'ethereum' or undefinedOptional wallet type. Defaults to ethereum.
Returns Returns Promise<OmsCompleteAuthResult>.

OIDC Provider Config

Use OidcProviders.google to build the provider config for Google redirect auth.
import { OidcProviders } from 'oms-client-react-native-sdk'

const provider = OidcProviders.google({
  clientId: 'YOUR_WEB_CLIENT_ID',
  relayRedirectUri: null,
})
Parameters
ParameterTypeDescription
clientIdstring or undefinedGoogle OAuth client ID. Defaults to the SDK’s configured Google client ID.
relayRedirectUristring, null, or undefinedRelay callback URL. Omit it to use the provider default, or pass null to redirect directly to the app redirect URI.
scopesstring[] or undefinedOAuth scopes. Defaults to openid, email, and profile.
authorizeParamsRecord<string, string> or undefinedExtra authorization query parameters.
Returns Returns OidcProviderConfig.

Start OIDC Redirect Auth

Start an OIDC authorization-code PKCE flow. Apps own browser opening and deep-link handling. Use system auth browser UI such as Custom Tabs or ASWebAuthenticationSession, then pass the resulting app-link URL to handleOidcRedirectCallback.
import {
  OidcProviders,
  startOidcRedirectAuth,
} from 'oms-client-react-native-sdk'

const started = await startOidcRedirectAuth({
  provider: OidcProviders.google({ clientId: 'YOUR_WEB_CLIENT_ID' }),
  redirectUri: 'com.example.app:/oauth/callback',
  walletType: 'ethereum',
})

console.log('Open this URL with system auth UI:', started.authorizationUrl)
Parameters
ParameterTypeDescription
providerOidcProviderConfigOIDC provider config.
redirectUristringApp callback URL that receives the provider redirect.
walletType'ethereum' or undefinedOptional wallet type. Defaults to ethereum.
relayRedirectUristring, null, or undefinedOverrides the provider relay redirect URI.
authorizeParamsRecord<string, string> or nullExtra authorization query parameters.
Returns Returns Promise<OmsStartOidcRedirectAuthResult>.
FieldTypeDescription
authorizationUrlstringProvider authorization URL to open with system auth UI.
statestringOIDC state value stored for callback validation.
challengestringWallet auth challenge used in the OIDC request.

Handle OIDC Redirect Callback

Complete redirect auth after the provider sends the user back to your app.
import { handleOidcRedirectCallback } from 'oms-client-react-native-sdk'

const result = await handleOidcRedirectCallback({
  callbackUrl: 'com.example.app:/oauth/callback?code=CODE&state=STATE',
  walletSelection: 'manual',
})

if (result.type === 'walletSelection') {
  await result.pendingSelection.createAndSelectWallet('main')
}
Parameters
ParameterTypeDescription
callbackUrlstring, null, or undefinedFull callback URL containing OIDC code and state.
walletSelection'automatic' or 'manual'Defaults to 'automatic'. Use 'manual' to receive a pending wallet selection.
Returns Returns Promise<OmsOidcRedirectAuthResult>.
Result typeDescription
completedRedirect auth completed and returned an active wallet.
walletSelectionAuth completed and manual wallet selection is pending.
notOidcRedirectCallbackThe URL was not an OIDC redirect callback for this SDK.
noPendingAuthThere is no pending redirect auth flow to complete.
failedRedirect auth failed and includes a message.

List Wallets

List wallets available to the authenticated credential.
import { listWallets } from 'oms-client-react-native-sdk'

const wallets = await listWallets()

for (const wallet of wallets) {
  console.log(wallet.id, wallet.type, wallet.address)
}
Parameters Takes no parameters. Returns Returns Promise<OmsWallet[]>.

Use Wallet

Activate an existing wallet by server-side wallet ID.
import { useWallet } from 'oms-client-react-native-sdk'

const result = await useWallet('wallet-id')

console.log('Wallet address:', result.walletAddress)
Parameters
ParameterTypeDescription
walletIdstringWallet ID returned by auth completion or listWallets.
Returns Returns Promise<OmsWalletActivationResult>.

Create Wallet

Create and activate a new wallet for the authenticated user.
import { createWallet } from 'oms-client-react-native-sdk'

const result = await createWallet({
  walletType: 'ethereum',
  reference: 'main',
})

console.log('New wallet:', result.walletAddress)
Parameters
ParameterTypeDescription
walletType'ethereum' or undefinedWallet type to create. Defaults to ethereum.
referencestring, null, or undefinedOptional app-defined wallet reference.
Returns Returns Promise<OmsWalletActivationResult>.