Widget-Managed Deposits

Handle the signed transaction the widget prepares for the user

In Widget-Managed mode (the default), the widget runs the full deposit UI. The user picks a token and network, enters an amount, and taps "Continue". The widget then hands your app a ready-to-sign TransactionRequest via the onTransactionRequested callback — your app signs and broadcasts it.

Supported Tokens and Networks

Widget-Managed mode supports the following tokens, grouped by network:

NetworkTokens
EthereumETH, USDT, USDC, DAI, EURC, EURR, USDR, USAT, XAUT, SHIB, LINK, UNI, GRT, MKR, COMP, SNX, SUSHI, OMG, CHZ, ENJ, YFI, BAT, MANA
SolanaSOL, USDT, USDC, OOB
BNB Smart ChainBNB, USDT, USDC
PolygonUSDT, USDC

The supported set may change over time. For the authoritative list at runtime, use API-Managed Deposits with the List Crypto Currencies API.

Flow

  1. User selects a token and network from their available balances
  2. User reviews the amount and presses "Continue"
  3. The widget calls onTransactionRequested with the transaction data
  4. Your app navigates the user to a transaction confirmation screen
  5. User reviews and approves the transaction in your app
  6. Your app signs and broadcasts the transaction to the blockchain

The onTransactionRequested Callback

When the widget hands off a transaction, your app should navigate the user to a confirmation screen where they can review and approve it.

import { WidgetSDK, TransactionRequest } from '@oobit/react-native-sdk';

function WidgetScreen() {
  const navigation = useNavigation();

  const handleTransactionRequested = (transaction: TransactionRequest) => {
    // Navigate to your transaction confirmation screen
    navigation.navigate('TransactionConfirmation', { transaction });
  };

  return (
    <WidgetSDK
      accessToken={accessToken}
      userWalletAddress={walletAddress}
      onTransactionRequested={handleTransactionRequested}
      onClose={() => navigation.goBack()}
    />
  );
}
import { WidgetSDK, TransactionRequest } from '@oobit/react-web';

function WidgetPage() {
  const router = useRouter();

  const handleTransactionRequested = (transaction: TransactionRequest) => {
    // Navigate to your transaction confirmation screen
    router.push({ pathname: '/confirm', query: { transaction } });
  };

  return (
    <WidgetSDK
      accessToken={accessToken}
      userWalletAddress={walletAddress}
      onTransactionRequested={handleTransactionRequested}
      onClose={() => router.back()}
    />
  );
}

TransactionRequest Type

The TransactionRequest is a union type that can be either an EVM or Solana transaction. Use the type field to discriminate between chains.

type TransactionRequest = EvmTransactionRequest | SolanaTransactionRequest;

Discriminating by Chain

function handleTransaction(transaction: TransactionRequest) {
  switch (transaction.type) {
    case 'evm':
      // Handle EVM transaction (Ethereum, Polygon, BSC, etc.)
      handleEvmTransaction(transaction);
      break;
    case 'solana':
      // Handle Solana transaction
      handleSolanaTransaction(transaction);
      break;
  }
}

EVM Transactions

EVM transactions are used for Ethereum-compatible blockchains.

interface EvmTransactionRequest {
  type: 'evm';
  chainId: number;
  transaction: EvmTransactionData;
  tokenMetadata: TransactionTokenMetadata;
}

interface EvmTransactionData {
  to: string;
  data: string;
  value: string;
}
FieldTypeDescription
type'evm'Identifies this as an EVM transaction
chainIdnumberNetwork identifier (1 = Ethereum, 137 = Polygon, etc.)
transaction.tostringDestination address
transaction.datastringEncoded transaction data (hex)
transaction.valuestringNative token value in wei (hex)
tokenMetadataTransactionTokenMetadataToken info for display

Solana Transactions

Solana transactions are used for the Solana blockchain.

interface SolanaTransactionRequest {
  type: 'solana';
  transaction: string;
  tokenMetadata: TransactionTokenMetadata;
}
FieldTypeDescription
type'solana'Identifies this as a Solana transaction
transactionstringSerialized transaction (base64 encoded)
tokenMetadataTransactionTokenMetadataToken info for display

Token Metadata

Both transaction types include tokenMetadata for displaying transaction details to the user.

interface TransactionTokenMetadata {
  symbol: string;
  amount: string;
  decimals: number;
}
FieldTypeDescription
symbolstringToken symbol (e.g., "USDC", "ETH", "SOL")
amountstringHuman-readable amount to send
decimalsnumberToken decimal places

See Also