{
  "name": "wallet-types-extended-user",
  "type": "registry:component",
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "components/wallet/types/extended-user.ts",
      "type": "registry:component",
      "content": "// Extended User Types - Optional wallet-specific extensions to AuthUser\nimport type { AuthUser } from \"../../../lib/types.js\";\n// import type { WalletBalance } from './wallet.js';\n\n// Optional wallet extension - can be passed to wallet components\nexport interface WalletUserExtension {\n\tpaymentKey?: string;\n\tordinalKey?: string;\n\tfundingAddress?: string;\n\tordinalAddress?: string;\n\tbalance?: {\n\t\tconfirmed: number;\n\t\tunconfirmed: number;\n\t};\n\tutxos?: Array<{\n\t\ttxid: string;\n\t\tvout: number;\n\t\tsatoshis: number;\n\t\tscript?: string;\n\t}>;\n\ttokenUtxos?: Array<{\n\t\ttxid: string;\n\t\tvout: number;\n\t\tsatoshis: number;\n\t\tscript?: string;\n\t\tid: string;\n\t\tamount: string;\n\t\tamt?: string; // js-1sat-ord compatibility\n\t}>;\n}\n\n// Combined type for wallet components - basic AuthUser + optional wallet data\nexport type WalletUser = AuthUser & Partial<WalletUserExtension>;\n\n// Helper to check if user has wallet capabilities\nexport function hasWalletCapabilities(\n\tuser: AuthUser | WalletUser,\n): user is WalletUser & WalletUserExtension {\n\treturn !!(user as WalletUser).paymentKey && !!(user as WalletUser).balance;\n}\n\n// Helper to safely get wallet properties with defaults\nexport function getWalletProps(user: AuthUser | WalletUser) {\n\tconst walletUser = user as WalletUser;\n\n\t// Ensure UTXOs have required properties for js-1sat-ord compatibility\n\tconst utxos = (walletUser.utxos || []).map((utxo) => ({\n\t\t...utxo,\n\t\tscript: utxo.script || \"\", // Provide empty string if missing\n\t}));\n\n\tconst tokenUtxos = (walletUser.tokenUtxos || []).map((utxo) => ({\n\t\ttxid: utxo.txid,\n\t\tvout: utxo.vout,\n\t\tscript: utxo.script || \"\",\n\t\tsatoshis: 1 as const, // Token UTXOs always contain exactly 1 satoshi in 1Sat Ordinals protocol\n\t\tid: utxo.id,\n\t\tamount: utxo.amount,\n\t\tamt: utxo.amt || utxo.amount, // Map amount to amt for js-1sat-ord\n\t}));\n\n\treturn {\n\t\tpaymentKey: walletUser.paymentKey,\n\t\tordinalKey: walletUser.ordinalKey,\n\t\tfundingAddress: walletUser.fundingAddress || walletUser.address,\n\t\tordinalAddress: walletUser.ordinalAddress || walletUser.address,\n\t\tbalance: walletUser.balance || { confirmed: 0, unconfirmed: 0 },\n\t\tutxos,\n\t\ttokenUtxos,\n\t};\n}\n",
      "target": "<%- config.aliases.components %>/user.tsx"
    }
  ]
}