feat: render existing referral state without API auth - #18
Merged
Conversation
…ut API auth
The /referrals page kept showing the CreateCodeCard for users that
already had a code registered on-chain, because the dashboard load
went through the API key handshake (closed beta). For non-beta
wallets that was a dead end.
- api: add public GET /v1/referral/info?address=G... that returns
{ self, binding } from the indexer's referrers projection. No
auth required — same data shape as /v1/referral/me, just looked
up by query parameter instead of authed owner.
- sdk-web client: getReferralInfo(address) wraps the new endpoint.
- ReferralSignIn: probe getReferralInfo on wallet connect. If the
user already has a code, render ReferralStats + ClaimFeesCard
+ ShareLinkCard immediately. Otherwise fall through to the
existing CreateCodeCard. The optional 'Advanced — full
dashboard' panel is still available for whitelisted wallets to
unlock the trade-by-trade activity tables.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mertcicekci0
added a commit
that referenced
this pull request
May 18, 2026
Was meant to ship in #18 but got dropped from the staging set. Returns { self, binding } looked up by address (same shape as the authed /v1/referral/me, just keyed by query param). Lets the web referrals page render an existing code without going through the closed-beta API key handshake.
y4hyya
added a commit
that referenced
this pull request
Jul 18, 2026
…aluation (V-4) Closes the cross-vault drain and the deposit-timing wealth transfer: - V-1 isolation: DELETE sync_total_usdc (assigned the whole factory balance to one vault). Every leader op now credits a MEASURED balance delta to its own vault, and position/order → vault ownership maps (PositionVault/ OrderVault + capped VaultPositions/VaultOrders) gate leader_close/cancel with #16 NotVaultPosition. Fixes latent arity bugs (open/close now pass acceptable_price for the L0-10 market). - V-4 valuation: full_nav = liquid + Σ position equity (market.get_position _equity) + Σ pending-order collateral, fail-closed (#18). deposit/withdraw/ claim price at full NAV; withdraw caps payout at liquid cash (#17 Liquidity Deployed, never a silent haircut); claim measures gain on full NAV, capped by liquid + post-payout HWM reset. - reconcile_order (permissionless, idempotent): binds a keeper-executed order to its position, or credits a cancelled order's refund; order_reconciled event. - Launch controls: create_vault leader allowlist + max-vaults cap (#20), admin set_leader_allowlist/set_max_vaults, and the factory's first upgrade() hook. vault_factory 46,639 B optimized (84KB headroom). 12 new tests; 49 factory, 137 market pass. Off-chain (indexer decoders, api navFull, web full-NAV + #16-20, keeper reconcile) tracked for the sweep.
y4hyya
added a commit
that referenced
this pull request
Jul 18, 2026
…IF passthrough Leaders can now set protective orders on vault positions: - leader_set_stop_loss / leader_set_take_profit / leader_place_trailing_stop attach to a vault position (ownership via L0-20's PositionVault map, #16 on a foreign position); they lock nothing, so no delta accounting. - leader_place_stop_limit prefunds → measured-delta + OrderVault, reconciled by the existing reconcile_order (stop-limit drops the TIF arg — Soroban's 10-param cap; TIF passthrough lives on leader_place_limit_order, whose hardcoded GTC is replaced by a real time_in_force param — ARITY BUMP, tx-builders/SDK deferred to sweep). Executed-close reconciliation (the subtle path): a keeper-fired protective close settles proceeds to the factory with NO factory call, so the market now records each full close/liquidation's trader-proceeds in TEMPORARY storage (ClosedProceeds + get_closed_proceeds view). reconcile_position reads the EXACT amount and credits it — no fragile global-surplus attribution. While a stale position lingers, full_nav fail-closes (#18), so the keeper reconciles promptly. Partial-liq of a vault position stays a documented edge. market 99,667 B, vault_factory 52,919 B optimized. 6 new tests (5 factory + 1 market); 142 market + 54 factory pass.
y4hyya
added a commit
that referenced
this pull request
Jul 20, 2026
Global PauseBanner polls get_pause_state every 30s: mode 1 renders the amber exit-only strip (closes/protective orders/cancels/withdrawals work), mode 2 the red full-freeze strip; a pre-Batch-1 market (null read) renders nothing. Vault detail gains a Full NAV stat from the factory's get_full_nav — liquid + live position equity + pending order collateral, with honest '—' copy while the contract fail-closes (#18) awaiting reconciliation (which the keeper now performs automatically). Row omitted entirely on the pre-L0-20 factory. Recovery needs no user surface: the vault flow is admin-only and timelocked; withdrawals stay open by design.
y4hyya
added a commit
that referenced
this pull request
Jul 20, 2026
Indexer: trade_recorded decodes both the 6-field Batch-1 payload and the 5-field legacy one (volume NULL); migration 004 adds referral_trades.volume; handler + fixtures cover both generations. Types: canonical + vendored ReferralTradeRecordedEvent gain volume. Gateway: /v1/referral trade rows expose volume. tx-builders: Referral.buildReferralClaimOp/Args/Tx — the single source of truth for the wallet-only claim (XDR snapshot pinned). Web: ClaimFeesCard goes live behind a SAFETY GATE — claims enable only when the deployed registry reports referral_v1 (the v0 claim() would zero an earned balance without paying), with the earn/save economics line sourced from get_config, never hardcoded. ReferralError #16-#18 friendly copy added. Promise-copy elsewhere stays dark until the deploy by design (never advertise unpaid economics).
y4hyya
added a commit
that referenced
this pull request
Jul 21, 2026
…fail-soft) PauseStateService: cached get_pause_state read (effective mode, 72h degrade applied read-side) surfaced as health.market.pauseState; supported:false on the pre-Batch-1 market — unknown is never 'live'. VaultsService gains chain-backed fullNav(id) via the factory's get_full_nav view, served as navFull on /v1/vaults/:id (null = pre-Batch-1 / #18 fail-closed / transport failure — never a fabricated zero). Both optional deps so db-only test setups stay untouched. 21 api test files green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Public /v1/referral/info endpoint + web wires it up so wallets with a registered code see their dashboard immediately.