feat(trade): make builder fee env-driven and off by default - #104
feat(trade): make builder fee env-driven and off by default#104vipineth wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Code ReviewOverviewThis PR removes the hardcoded builder fee and replaces it with an env-driven opt-in ( What's Good
Issues1.
2. Return type annotation on // current
export function parseBuilderConfig(env: PublicEnv = import.meta.env): BuilderConfig {Since export function parseBuilderConfig(env: PublicEnv = import.meta.env): BuilderConfig | undefined {The PR says 3. Same point — the export is typed as Nits
SummarySolid PR. The env-driven approach is correct, the validation is tight, and the two bug fixes are well-targeted. Address the |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Code ReviewOverviewThis PR converts the hardcoded builder fee into an env-driven opt-in and removes it from the official deployment. It also fixes two pre-existing bugs: a stray What's Good
Issues1. UI guard inconsistency with
The fix is one of:
Since there's no concrete use-case for attribution-only builders right now, option 2 is simpler. 2. function warnDisabled(): undefined {
if (import.meta.env.DEV) { // reads global, not injected env
console.warn(...)
}
}In tests, 3. The first early-return SummaryThe core logic is correct and well-tested. The one real issue worth addressing before merge is the Suggested change for the render guards (all three order summaries): // Before
{!!DEFAULT_BUILDER_CONFIG?.f && (
// After — guard on existence, not value
{DEFAULT_BUILDER_CONFIG !== undefined && (Or equivalently, reject 🤖 Generated with Claude Code |
Summary
Removes the builder fee from the official deployment and makes it configurable via env instead of a hardcoded constant. No fee is charged unless a deployment opts in.
Previously
apps/terminal/src/config/hyperliquid.tshardcoded the builder address and a 0.01% fee, which was injected into everyorderaction.Env vars
VITE_BUILDER_ADDRESS0x744e…A7E0x+ 40 hexVITE_BUILDER_FEE_BPS11= 0.01%, one decimal place max, max 100Basis points are converted to the API's tenth-of-a-bp
funit internally, so the Hyperliquid quirk stays out of the config surface. One decimal place is allowed (0.5bps) to keep the API's 0.1 bp granularity.Both set and valid → fee on. Both unset → off. Half-configured or malformed → off, with a DEV-only
console.warn. Parsing follows the existingconfig/env.tspattern (plain function, default-param env injection) rather than introducing zod for two values.DEFAULT_BUILDER_CONFIGkeeps its name andBuilderConfigtype, so no consumer changes were forced.Fee-disabled path
builderfield — the SDK strips undefined keys before msgpack signingapproveAgentonly)maxBuilderFeeinfo query never firesBug fixes included
0render — the three order summaries guarded on{DEFAULT_BUILDER_CONFIG?.f && …}. A fee of0(attribution-only, a legal config) made React render a literal0. Now!!-guarded.maxBuilderFeerequest —use-agent-status.tscalledbuilderFeeQuery.refetch()unconditionally. TanStack Query v5refetch()ignoresenabled: false, so a request fired withzeroAddresson every registration even with no builder configured. Now conditional.Verification
pnpm check— 435 files cleanpnpm typecheck— all packages, zero errorspnpm test— 333 passed, 1 skipped (includes 17 newbuilder-config.test.tscases)pnpm build:all— both apps build.output/anddist/for the old builder address → 0 matchesDeploy notes
VITE_BUILDER_*vars exist in Vercel Production or Previewapps/website/src/components/Faq.astrotoo🤖 Generated with Claude Code