Skip to main content

DepositProvider

Wraps your app and manages the deposit lifecycle. Handles Auth Core context internally.
import { DepositProvider, CHAIN } from '@particle-network/universal-deposit/react';

<DepositProvider config={{
  destination: { chainId: CHAIN.POLYGON },
  autoSweep: true,
  minValueUSD: 1,
}}>
  <App />
</DepositProvider>

Config

PropertyTypeDefaultDescription
destination.chainIdnumberRequired. Destination chain (use CHAIN constant).
destination.addressstringOwner’s EOACustom sweep destination address.
supportedTokensTokenType[]AllTokens to watch.
supportedChainsnumber[]All 17 chainsChains to watch.
autoSweepbooleantrueAuto-sweep detected deposits.
minValueUSDnumber0.50Minimum USD value to trigger sweep.
pollingIntervalMsnumber3000Balance check interval (ms).
refundRefundConfig{ enabled: false }Auto-refund config (experimental).
uaProjectIdstringSDK defaultParticle project ID for UA operations only.

useDeposit

Primary hook. Pass ownerAddress to trigger auto-connection and start watching for deposits.
import { useDeposit } from '@particle-network/universal-deposit/react';

const {
  isReady, depositAddresses, pendingDeposits,
  sweep, status, currentDestination,
} = useDeposit({ ownerAddress: '0x...' });

Options

PropertyTypeDescription
ownerAddressstring | undefinedUser’s wallet address. Pass to trigger connection.

Return Value

PropertyTypeDescription
isConnectingbooleanSDK is initializing.
isConnectedbooleanAuth Core connected.
isReadybooleanClient ready for operations.
errorError | nullLast error.
disconnect() => Promise<void>Disconnect and cleanup.
statusClientStatusCurrent client status.
depositAddressesDepositAddresses | nullEVM and Solana deposit addresses.
pendingDepositsDetectedDeposit[]Detected but unsent deposits.
recentActivityActivityItem[]Activity history.
sweep(id?: string) => Promise<SweepResult[]>Trigger sweep (all or by ID).
setDestination(dest: DestinationConfig) => voidChange destination at runtime.
currentDestination{ address: string; chainId: number } | nullCurrent destination.

useDepositContext

Access the full context including recovery and refund methods. Returns everything from useDeposit plus:
import { useDepositContext } from '@particle-network/universal-deposit/react';

const { client, stuckFunds, recoverFunds, refundDeposit } = useDepositContext();

Extended Properties

PropertyTypeDescription
clientDepositClient | nullUnderlying client instance.
ownerAddressstring | nullUser’s wallet.
intermediaryAddressstring | nullJWT wallet.
connect(address: string) => Promise<void>Manual connect.
startWatching / stopWatching() => voidControl balance polling.
stuckFundsDetectedDeposit[]Stuck funds list.
isRecoveringbooleanRecovery in progress.
getStuckFunds() => Promise<DetectedDeposit[]>Refresh stuck funds.
recoverFunds() => Promise<RecoveryResult[]>Recover all funds.
isRefundingbooleanRefund in progress.
refundDeposit(id: string) => Promise<RefundResult>Refund specific deposit.
refundAll() => Promise<RefundResult[]>Refund all pending.
canRefund(id: string) => Promise<{ eligible: boolean; reason?: string }>Check eligibility.
refundConfigRefundConfigCurrent refund config.

Components

DepositWidget

Inline deposit UI with token selection, QR code, and activity feed.
import { DepositWidget } from '@particle-network/universal-deposit/react';

<DepositWidget fullWidth theme="dark" />
PropTypeDefaultDescription
clientDepositClientContextOptional client (uses context if omitted).
theme'dark' | 'light''dark'Color theme.
destinationDestinationConfigProvider configOverride destination.
onDestinationChange(dest) => voidDestination change callback.
showDestinationbooleantrueShow destination section.
fullWidthbooleanfalseExpand to container (default: 380px).
showHeaderbooleantrueShow header with title.
classNamestringCustom CSS class.
onClose() => voidClose handler.

DepositModal

Modal wrapper around DepositWidget. Accepts all DepositWidget props plus:
import { DepositModal } from '@particle-network/universal-deposit/react';

<DepositModal isOpen={open} onClose={() => setOpen(false)} />
PropTypeDescription
isOpenbooleanModal visibility.
onClose() => voidClose handler (required).
overlayClassNamestringCustom overlay CSS class.

RecoveryWidget

UI for scanning and recovering stuck funds.
import { RecoveryWidget } from '@particle-network/universal-deposit/react';

<RecoveryWidget autoScan theme="dark" />
PropTypeDefaultDescription
clientDepositClientContextOptional client.
theme'dark' | 'light''dark'Color theme.
autoScanbooleantrueAuto-scan on mount.
showModeSelectorbooleantrueShow recover/refund toggle.
defaultMode'recover' | 'refund''recover'Initial mode.
classNamestringCustom CSS class.
onClose() => voidClose handler.

RecoveryModal

Modal wrapper around RecoveryWidget. Accepts all RecoveryWidget props plus:
import { RecoveryModal } from '@particle-network/universal-deposit/react';

<RecoveryModal isOpen={open} onClose={() => setOpen(false)} />
PropTypeDescription
isOpenbooleanModal visibility.
onClose() => voidClose handler (required).
overlayClassNamestringCustom overlay CSS class.

Next Steps