Function Signature

function findWallet(
  options: Options
): Promise<Response>;
options
[Options](/sdk-reference/types#findwallet-options)
The options for finding a wallet.
Promise
Promise<[Response](/sdk-reference/types#findwallet-response)>
A promise that resolves with the response from finding a wallet.
Type Definitions: For detailed type information including all properties and their descriptions, visit the Types page.

Usage

import { TrustEngineSDK } from '@trust-engine/sdk';
import { useState } from 'react';

const sdk = new TrustEngineSDK();

export default function WalletFinder() {
  const [searchValue, setSearchValue] = useState('');
  const [searchType, setSearchType] = useState<'userID' | 'walletAddress'>('userID');
  const [isFinding, setIsFinding] = useState(false);
  const [result, setResult] = useState<any | null>(null);

  const handleFind = async () => {
    if (!searchValue) return;
    setIsFinding(true);
    try {
      const findResult = await sdk.findWallet({ [searchType]: searchValue });
      setResult(findResult);
    } catch (error) {
      console.error('❌ Failed to find wallet:', error.message);
      setResult({ error: error.message });
    } finally {
      setIsFinding(false);
    }
  };

  return (
    <div>
      <select value={searchType} onChange={(e) => setSearchType(e.target.value as any)}>
        <option value="userID">User ID</option>
        <option value="walletAddress">Wallet Address</option>
      </select>
      <input 
        type="text" 
        value={searchValue} 
        onChange={(e) => setSearchValue(e.target.value)}
        placeholder={`Enter ${searchType === 'userID' ? 'User ID' : 'Wallet Address'}`}
      />
      <button onClick={handleFind} disabled={isFinding}>
        {isFinding ? 'Finding...' : 'Find Wallet'}
      </button>
      {result && <pre>{JSON.stringify(result, null, 2)}</pre>}
    </div>
  );
}