Skip to content

Commit be29d75

Browse files
odysseus0claude
andcommitted
feat: make redirect URL configurable and document widget setup
- Add refundMetricsRedirectUrl to customFields for configurable redirects - Update component to use configured redirect URL - Add comprehensive documentation to README about widget configuration - Document that Flashbots docs shows both MEV and gas refunds, MEV clicks redirect to Protect 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 24e2a6b commit be29d75

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,25 @@ This command generates static content into the `build` directory and can be serv
4848
Create a PR and once merged, Github actions automatically deploy it.
4949

5050
The docs use Vercel for hosting, and deployment is done by Vercel on any merge into the master branch.
51+
52+
## Refund Metrics Widget
53+
54+
This site displays MEV and gas refund metrics in the navbar, fetched from the [Flashbots Refund Metrics API](https://github.com/flashbots/refund-metrics-dune-api).
55+
56+
### Configuration
57+
58+
To configure the widget, edit `docusaurus.config.js`:
59+
60+
```js
61+
customFields: {
62+
refundMetricsApiUrl: 'https://refund-metrics-dune-api.vercel.app',
63+
refundMetricsRedirectUrl: 'https://protect.flashbots.net/',
64+
},
65+
```
66+
67+
- `refundMetricsApiUrl`: The API endpoint for fetching metrics
68+
- `refundMetricsRedirectUrl`: Where to redirect when users click on MEV refunds
69+
70+
The widget implementation is in `src/components/MevMetrics.tsx`. For Flashbots docs, it:
71+
- Shows both MEV and gas refunds
72+
- Clicking on MEV refunds redirects to the configured URL (default: [Flashbots Protect](https://protect.flashbots.net/))

docusaurus.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ module.exports = async function createConfigAsync() {
122122
],
123123
customFields: {
124124
refundMetricsApiUrl: 'https://refund-metrics-dune-api.vercel.app',
125+
refundMetricsRedirectUrl: 'https://protect.flashbots.net/',
125126
},
126127
}
127128
}

src/components/MevMetrics.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export default function MevMetrics(): JSX.Element {
4646
};
4747

4848
const handleMevClick = () => {
49-
window.open('https://protect.flashbots.net/', '_blank', 'noopener,noreferrer');
49+
const redirectUrl = siteConfig.customFields?.refundMetricsRedirectUrl as string;
50+
window.open(redirectUrl, '_blank', 'noopener,noreferrer');
5051
};
5152

5253
return (

0 commit comments

Comments
 (0)