import type { NetworkId } from './networks' /** * Per-wallet feature-flag key for `enabledWallets`. An entry matches a wallet * when it equals (case-insensitively) either the wallet's `WalletMetadata.id` * or its `namespaceMetaData.tron.injectedId`. It is an open `string` because the * connector is metadata-driven — the wallet set comes from the passed-in * metadata, not a compiled union — so any backend-configured Tron wallet can be * gated without a UWC release. */ export type TronWalletId = string /** Config for the Tron full-node (TronGrid) HTTP client used to build/broadcast. */ export interface TronGridConfig { /** * Per-network full-node host URL. Override any default to route through a * Mesh proxy or a different endpoint. Keys are UWC `NetworkId`s. */ endpoints?: Partial> /** Sent as the `TRON-PRO-API-KEY` header when calling public TronGrid. */ apiKey?: string /** * fee_limit (in SUN) for TRC20 calls. Defaults to 100 TRX, which comfortably * covers a USDT transfer's energy cost. */ feeLimitSun?: number } /** * Public configuration for the Tron connector. Lives in `uwc-types` (like * `TonConnectConfig` / `WalletConnectConfig`) so it can thread through * `UniversalWalletConnector` once the core wiring lands; until then it is * supplied directly when constructing a `TronConnector`. * * The `enabledWallets` set is an OPTIONAL per-wallet feature-flag surface. When * omitted, the connector is fully catalog-driven: every wallet whose metadata * declares a `namespaceMetaData.tron.injectedId` is enabled — the backend * (Retool) is the single source of truth. Provide it only to gate a subset, so a * single wallet can be ramped up or disabled in production independently of the * others. Passing an empty set/array enables nothing (disables the connector). */ export interface TronConnectorConfig { /** * Optional allow-list of wallets to enable, matched against each wallet's * `WalletMetadata.id` or its `namespaceMetaData.tron.injectedId` * (case-insensitive). Wallets not enabled are neither surfaced by * `getAvailableWallets` nor connectable. * * **Omit it** to enable every wallet the passed-in metadata marks Tron-capable * (the recommended, catalog-driven default — consumers then need no hardcoded * wallet list). An **empty** set/array enables nothing. * * Matching by `WalletMetadata.id` requires the wallet metadata to be available * — i.e. `getAvailableWallets` is called with `expectedWallets` (the standard * path via core). A standalone caller that invokes `getAvailableWallets` * without `expectedWallets` has only the configured keys to go on, so those * keys must be **injectedIds** (e.g. `tronLink`, not `tronlink`). */ enabledWallets?: ReadonlySet | readonly TronWalletId[] /** Full-node endpoints, API key, and TRC20 fee limit. */ tronGrid?: TronGridConfig /** Timeout (ms) for the per-wallet injection probe during `connect()`. Default: 3000. */ readyStateTimeoutMs?: number /** * Timeout (ms) for the injection probe during `getAvailableWallets()`. * Deliberately short (default: 300) because absent wallets always wait out * the full timeout and discovery probes all enabled wallets in parallel. */ discoveryTimeoutMs?: number /** Poll cadence (ms) for the injection probe. Default: 50. */ readyStatePollIntervalMs?: number }