Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions frontend/src/components/BoingPoolsSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import BoingPoolsTab from './BoingPoolsTab';
import BoingYourLiquidityTab from './BoingYourLiquidityTab';
import BoingLiquidityAdvanced from './BoingLiquidityAdvanced';
import { useBoingPools } from '../hooks/useBoingPools';
import { useWallet } from '../contexts/WalletContext';
import { BOING_NATIVE_L1_CHAIN_ID } from '../config/networks';
import { getWindowBoingProvider, boingWalletMissingMessage } from '../utils/boingWalletDiscovery';
import { formatBoingExpressRpcError } from '../utils/boingExpressRpcError';
import { boingSwapPairHref, parsePoolsTab } from '../utils/swapPoolsRedirect';
import { useConnectBoingExpress } from './BoingOnlyGate';

const TABS = [
{ id: 'all', label: 'All pools' },
Expand All @@ -28,7 +25,7 @@ const TABS = [
export default function BoingPoolsSection({ account = null, initialQuery = '' }) {
const pools = useBoingPools(account || null);
const navigate = useNavigate();
const { connectWalletWithProvider } = useWallet();
const { connect: connectBoingExpress } = useConnectBoingExpress();
const [searchParams, setSearchParams] = useSearchParams();
const tab = parsePoolsTab(searchParams.get('tab'));
const [addFor, setAddFor] = useState(/** @type {any} */ (null));
Expand Down Expand Up @@ -78,18 +75,9 @@ export default function BoingPoolsSection({ account = null, initialQuery = '' })
setTab('liquidity');
return;
}
const provider = getWindowBoingProvider();
if (!provider) {
toast.error(boingWalletMissingMessage());
return;
}
try {
await connectWalletWithProvider(provider, 'boingExpress', BOING_NATIVE_L1_CHAIN_ID);
// The page re-renders for the connected wallet; the URL carries the pool across.
setTab('liquidity', { addPool: c.poolHex });
} catch (e) {
toast.error(formatBoingExpressRpcError(e));
}
await connectBoingExpress();
// The page re-renders for the connected wallet; the URL carries the pool across.
setTab('liquidity', { addPool: c.poolHex });
};

return (
Expand Down
16 changes: 5 additions & 11 deletions frontend/src/components/BoingSwapCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
WBOING_HEX,
} from '../services/boingSwapQuote';
import { getWindowBoingProvider, boingWalletMissingMessage } from '../utils/boingWalletDiscovery';
import { useConnectBoingExpress } from './BoingOnlyGate';
import { formatBoingExpressRpcError } from '../utils/boingExpressRpcError';
import { useWalletNativeValue } from '../hooks/useWalletNativeValue';
import { NATIVE_VALUE_MIN_EXPRESS_VERSION } from '../services/boingWalletNativeValue';
Expand Down Expand Up @@ -175,7 +176,8 @@ function TokenSelect({ side, token, tokens, balances, onPick, disabled, otherTok
* @param {{ slippagePercent?: number, prefill?: { key: number, tokenIn: string, tokenOut: string } }} props
*/
export default function BoingSwapCard({ slippagePercent = 0.5, prefill }) {
const { chainId, walletType, isConnected, getWalletProvider, account, connectWalletWithProvider } = useWallet();
const { chainId, walletType, isConnected, getWalletProvider, account } = useWallet();
const { connect: connectBoingExpress } = useConnectBoingExpress();
const { indexerPickerTokens } = useBoingNativeDexIntegration();
const client = useMemo(() => getSharedBoingClient(), []);

Expand Down Expand Up @@ -388,16 +390,8 @@ export default function BoingSwapCard({ slippagePercent = 0.5, prefill }) {

const onPrimary = async () => {
if (button.kind === 'connect') {
const provider = getWindowBoingProvider();
if (!provider) {
toast.error(boingWalletMissingMessage());
return;
}
try {
await connectWalletWithProvider(provider, 'boingExpress', BOING_NATIVE_L1_CHAIN_ID);
} catch (e) {
toast.error(formatBoingExpressRpcError(e));
}
// Same path as header / BoingOnlyGate: extension first, then boing.express web wallet.
await connectBoingExpress();
return;
}
if (button.disabled) return;
Expand Down
15 changes: 4 additions & 11 deletions frontend/src/components/BoingYourLiquidityTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
import { formatTokenAmount, isNativeBoingId, NATIVE_FEE_RESERVE, parseTokenAmount, sanitizeAmountInput, toAmountInput } from '../services/boingSwapQuote';
import { addLiquidityPreview, pairedAmount, removeLiquidityPreview, withSlippageFloor } from '../services/boingPoolsSimple';
import { executeAddLiquidity, executeRemoveLiquidity } from '../services/boingLiquidityTx';
import { getWindowBoingProvider, boingWalletMissingMessage } from '../utils/boingWalletDiscovery';
import { getWindowBoingProvider } from '../utils/boingWalletDiscovery';
import { formatBoingExpressRpcError } from '../utils/boingExpressRpcError';
import { useWalletNativeValue } from '../hooks/useWalletNativeValue';
import { NATIVE_VALUE_MIN_EXPRESS_VERSION } from '../services/boingWalletNativeValue';
import BoingTokenPairIcons from './BoingTokenPairIcons';
import { PoolDetails, PRIMARY_BTN } from './BoingPoolsTab';
import { useConnectBoingExpress } from './BoingOnlyGate';

const panel = { borderColor: 'var(--border-color)', backgroundColor: 'var(--bg-secondary)' };
const muted = { color: 'var(--text-tertiary)' };
Expand Down Expand Up @@ -44,7 +45,7 @@
return () => {
if (walletType !== 'boingExpress') throw new Error('Liquidity on Boing is confirmed in Boing Express. Connect it from the header.');
const provider = expressProvider(getWalletProvider);
if (!provider) throw new Error(boingWalletMissingMessage());

Check failure on line 48 in frontend/src/components/BoingYourLiquidityTab.jsx

View workflow job for this annotation

GitHub Actions / Lint Frontend

'boingWalletMissingMessage' is not defined
return (tx, o) =>
boingExpressContractCallSignSimulateSubmit(provider, tx, { senderHex: account, waitForInclusion: o?.waitForInclusion, returnSubmitMeta: true });
};
Expand Down Expand Up @@ -346,7 +347,8 @@

/** Your liquidity: positions (share, what you'd get back) with Add / Remove, and the add form. */
export default function BoingYourLiquidityTab({ pools, addFor, onAddForConsumed }) {
const { isConnected, account, chainId, connectWalletWithProvider } = useWallet();
const { isConnected, account, chainId } = useWallet();
const { connect } = useConnectBoingExpress();
const connected = Boolean(isConnected && account);
const [mode, setMode] = useState(/** @type {null | { kind: 'add' | 'remove', card?: any }} */ (null));

Expand All @@ -362,15 +364,6 @@
setMode(null);
pools.reload();
};
const connect = async () => {
const provider = getWindowBoingProvider();
if (!provider) return toast.error(boingWalletMissingMessage());
try {
await connectWalletWithProvider(provider, 'boingExpress', BOING_NATIVE_L1_CHAIN_ID);
} catch (e) {
toast.error(formatBoingExpressRpcError(e));
}
};

return (
<div className="space-y-4" data-testid="boing-your-liquidity-tab">
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/NativeBoingCreatePoolPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,11 @@ export default function NativeBoingCreatePoolPanel() {
style={{ borderColor: 'var(--border-color)' }}
data-testid="create-pool-success"
>
<p style={{ color: 'var(--text-primary)' }}>Pool created. It now shows in the swap token list and on Pools.</p>
<p style={{ color: 'var(--text-primary)' }}>
{lastResult.registerSkipped
? 'Pool created on-chain. Pair listing was skipped — it may not appear in Swap / Pools until an operator registers it.'
: 'Pool created. It now shows in the swap token list and on Pools.'}
</p>
<div className="mt-2 flex flex-wrap gap-2">
<Link
className="td-btn td-btn--primary"
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/utils/boingWalletDiscovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,12 @@ export async function switchToBoingTestnetInWallet(provider) {

export { BOING_TESTNET_CHAIN_HEX };

/** Chrome Web Store listing for the Boing Express extension. */
export const BOING_EXPRESS_CHROME_STORE_URL =
'https://chromewebstore.google.com/detail/hhknjdhknnghccmfnfafbkapjljicbfh';
/**
* Where users get Boing Express today.
* Chrome Web Store item ID is not published in-repo yet (was a literal `[REDACTED]`
* path that broke install CTAs). Point CTAs at the live web wallet until a real CWS URL lands.
*/
export const BOING_EXPRESS_CHROME_STORE_URL = 'https://boing.express';

/**
* User-facing message when no Boing Express provider is injected. Explains mobile / non-Chromium
Expand All @@ -168,5 +171,5 @@ export function boingWalletMissingMessage(userAgent) {
if (!chromium) {
return 'Boing Express is a Chrome extension. Open boing.finance in Chrome, Edge, or Brave with the extension installed (or use boing.express).';
}
return `Boing Express isn't installed in this browser. Install it from the Chrome Web Store (${BOING_EXPRESS_CHROME_STORE_URL}), then reload.`;
}
return "Boing Express isn't installed in this browser. Open https://boing.express to use the web wallet (or install the Chrome extension when the store listing is live), then reload.";
}
Loading