@hot-labs/kit 1.0.45 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,7 @@ export interface BridgeProps {
26
26
  widget?: boolean;
27
27
  onClose: () => void;
28
28
  onProcess: (task: Promise<BridgeReview>) => void;
29
+ onSelectPair?: (from: Token, to: Token) => void;
29
30
  setup?: {
30
31
  mobileFullscreen?: boolean;
31
32
  autoClose?: boolean; // if true, the popup will close automatically when the transaction is successful
@@ -44,7 +45,7 @@ export interface BridgeProps {
44
45
 
45
46
  const FIXED = 6;
46
47
 
47
- export const Bridge = observer(({ hot, widget, setup, onClose, onProcess }: BridgeProps) => {
48
+ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSelectPair }: BridgeProps) => {
48
49
  const [isFiat, setIsFiat] = useState(false);
49
50
  const [type, setType] = useState<"exactIn" | "exactOut">(setup?.type || "exactIn");
50
51
  const [value, setValue] = useState<string>(setup?.amount?.toString() ?? "");
@@ -63,6 +64,10 @@ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess }: Brid
63
64
  review: BridgeReview;
64
65
  } | null>(null);
65
66
 
67
+ useEffect(() => {
68
+ onSelectPair?.(from, to);
69
+ }, [from, to]);
70
+
66
71
  const [sender, setSender] = useState<OmniWallet | "qr" | undefined>(() => {
67
72
  if (setup?.sender) return setup.sender;
68
73
  if (from.type === WalletType.OMNI) return hot.priorityWallet;