API Reference

React SDK — API Reference

This page documents the public API surface of @nexus-cross/crossx-sdk-react.

Components

CROSSxProvider

import { CROSSxProvider } from '@nexus-cross/crossx-sdk-react'

<CROSSxProvider config={SDKConfig}>
  {children}
</CROSSxProvider>
PropTypeDescription
configSDKConfigSDK configuration (see Core SDK Config)
childrenReactNodeChild components

Internally creates an SDK instance and calls initialize() on mount. Auth state is kept in sync via SDK's authChanged and addressChanged events using useSyncExternalStore.

Hooks

useAuth()

const {
  isAuthenticated,
  isLoading,
  error,
  signIn,
  signInWithCreate,
  signOut,
} = useAuth()
PropertyTypeDescription
isAuthenticatedbooleantrue if user is logged in (reactive)
isLoadingbooleantrue during sign-in/out operations
errorstring | nullLast authentication error message
signIn() => Promise<AuthResult>Open OAuth sign-in (provider selector modal)
signInWithCreate() => Promise<SignInWithCreateResult>Sign in + auto wallet creation + migration
signOut() => Promise<void>Clear session

signIn() and signInWithCreate() do not accept options. They call the underlying SDK methods directly. For specifying a provider programmatically, access the SDK via useCROSSx().

useWallet()

const {
  address,
  isLoading,
  error,
  signMessage,
  sendTransaction,
} = useWallet()
PropertyTypeDescription
addressstring | nullCurrent wallet address (reactive)
isLoadingbooleanLoading state
errorstring | nullLast error message
signMessage(chainId: string, message: string) => Promise<SignMessageResp>Sign personal message
sendTransaction(chainId: string, tx: EvmTransactionRequest) => Promise<SendTxResp>Send transaction

For advanced wallet operations (balance, gas, provider, typed data, etc.), use useCROSSx() to access the SDK instance directly.

useCROSSx()

const { sdk, isInitialized, isAuthenticated, walletAddress } = useCROSSx()
PropertyTypeDescription
sdkCROSSxSDK | nullDirect SDK instance access
isInitializedbooleantrue after initialize() completes
isAuthenticatedbooleanReactive auth state (synced via authChanged event)
walletAddressstring | nullReactive address (synced via addressChanged event)

All methods from the Core SDK API are available through sdk, including selectWallet(currentAddress?) for multi-wallet selection.

Type Re-exports

All types are re-exported from @nexus-cross/crossx-sdk-core:

import type {
  SDKConfig,
  AuthResult,
  SignMessageResp,
  SendTxResp,
  SignInOptions,
  EvmTransactionRequest,
  ChainIdValue,
} from '@nexus-cross/crossx-sdk-react'

import { ChainId } from '@nexus-cross/crossx-sdk-react'

Difference from @nexus-cross/crossx-sdk-wagmi

Featuresdk-reactsdk-wagmi
wagmi dependencyNoneRequired
wagmi hooksNot availableFull support
Setup complexitySimpleMedium
Recommended forNon-wagmi React appswagmi-based apps

© 2025 NEXUS Co., Ltd. All Rights Reserved.