diff --git a/docs/base-account/overview/what-is-base-account.mdx b/docs/base-account/overview/what-is-base-account.mdx index 7ae0197ec..f996994b9 100644 --- a/docs/base-account/overview/what-is-base-account.mdx +++ b/docs/base-account/overview/what-is-base-account.mdx @@ -12,16 +12,13 @@ A Base Account is a Smart-Wallet–backed account that gives every user: * **Universal sign-on** – one passkey works across every Base-enabled app. * **One-tap payments** – low-friction USDC payments built into the account layer. * **Private profile vault** – opt-in sharing of email, phone, shipping address, and more. -* **Multi-chain support** – one address that works across nine EVM networks (and counting). +* **Multi-chain support** – one address that works across many EVM networks. -> Under the hood, each Base Account is an ERC-4337 Smart Wallet that can be deployed on any EVM-compatible chain; nine EVM mainnet chains are enabled out of the box, including Base Mainnet. +> Under the hood, each Base Account is an ERC-4337 Smart Wallet that can be deployed on any EVM-compatible chain; many EVM mainnet chains are enabled out of the box, including Base Mainnet. - -**Supported networks** +import SupportedChains from "/snippets/supported-chains.mdx"; -- **Mainnet:** Base • Arbitrum • Optimism • Zora • Polygon • BNB • Avalanche • Lordchain • Ethereum Mainnet (not recommended due to costs) -- **Testnet:** Sepolia • Base Sepolia - + ## Why should developers care? diff --git a/docs/snippets/supported-chains.mdx b/docs/snippets/supported-chains.mdx new file mode 100644 index 000000000..3fe1ec983 --- /dev/null +++ b/docs/snippets/supported-chains.mdx @@ -0,0 +1,12 @@ +{/* Auto-generated by scripts/update-supported-chains.sh — do not edit manually */} + + +**Supported networks** + +**Full support** +- **Mainnet:** Base • Arbitrum • Optimism • Zora • Polygon • BNB Chain • Avalanche • Ethereum +- **Testnet:** Base Sepolia • Sepolia + +{/* DYNAMIC_CHAINS_START */} +{/* DYNAMIC_CHAINS_END */} + diff --git a/scripts/update-supported-chains.sh b/scripts/update-supported-chains.sh new file mode 100755 index 000000000..ae580b4c8 --- /dev/null +++ b/scripts/update-supported-chains.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +# Fetches the SCW getSupportedChains API and regenerates the +# docs/snippets/supported-chains.mdx file, inserting any chains +# tagged "simple-chain" into the dynamic section. +# +# Usage: +# bash scripts/update-supported-chains.sh +# +# The snippet has two parts: +# 1. Hardcoded core chains (manually maintained above the markers) +# 2. Dynamic "basic chains" pulled from the API (between the markers) +# +# Only chains with the "simple-chain" tag are inserted dynamically. +# If none are found, the dynamic section is left empty. + +set -euo pipefail + +API_URL="${API_URL:-https://api.wallet.coinbase.com/rpc/v3/scw/getSupportedChains}" +SNIPPET="docs/snippets/supported-chains.mdx" + +# Resolve paths relative to repo root +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +SNIPPET_PATH="$REPO_ROOT/$SNIPPET" + +if [ ! -f "$SNIPPET_PATH" ]; then + echo "Error: $SNIPPET not found at $SNIPPET_PATH" >&2 + exit 1 +fi + +# Fetch the API +RESPONSE=$(curl -sf "$API_URL") || { + echo "Error: failed to fetch $API_URL" >&2 + exit 1 +} + +# Extract simple-chain entries grouped by mainnet/testnet +DYNAMIC_BLOCK=$(echo "$RESPONSE" | python3 -c " +import sys, json + +data = json.load(sys.stdin) +chains = data.get('chains', []) + +simple = [c for c in chains if 'simple-chain' in c.get('tags', [])] + +if not simple: + sys.exit(0) # nothing to output + +mainnets = sorted([c['name'] for c in simple if 'testnet' not in c['networkId']]) +testnets = sorted([c['name'] for c in simple if 'testnet' in c['networkId']]) + +all_simple = sorted(mainnets + testnets) + +lines = [] +lines.append('**Basic support:** ' + ' • '.join(all_simple)) +lines.append('') +lines.append('Basic support only includes transfers through the [Base Account Web](https://account.base.app) surface for select tokens.') + +print('\n'.join(lines)) +") + +# Replace content between the markers in the snippet +python3 -c " +import sys + +snippet_path = sys.argv[1] +dynamic_block = sys.argv[2] + +with open(snippet_path, 'r') as f: + content = f.read() + +start_marker = '{/* DYNAMIC_CHAINS_START */}' +end_marker = '{/* DYNAMIC_CHAINS_END */}' + +start_idx = content.find(start_marker) +end_idx = content.find(end_marker) + +if start_idx == -1 or end_idx == -1: + print('Error: markers not found in snippet', file=sys.stderr) + sys.exit(1) + +# Build the replacement: markers + dynamic content between them +if dynamic_block.strip(): + replacement = start_marker + '\n' + dynamic_block + '\n' + end_marker +else: + replacement = start_marker + '\n' + end_marker + +new_content = content[:start_idx] + replacement + content[end_idx + len(end_marker):] + +with open(snippet_path, 'w') as f: + f.write(new_content) +" "$SNIPPET_PATH" "$DYNAMIC_BLOCK" + +echo "Updated $SNIPPET"