GraphQL API
The GraphQL API runs on Cloudflare Workers. Key areas:
- Search: internal (
entriesIndex,usersIndex) andsearchExternalMusic - Playback helpers:
externalAudioUrlresolving for Audius/Sound.xyz - Mining:
mineExternalEntryorchestrates R2 pinning, Soroban ops, Algolia index - Investing:
investEntryinvokes contract and syncs Algolia fields - Earnings:
claimableEarningsPreview(read-only) andclaimEarnings - Share lifecycle:
sellShares(id, amount)invokes contractsell_shares, then updates Algolia for the sold entry and refreshes APR/escrow for impacted entries - Admin tools:
mergeEntries(fromId, toId)merges two entries on-chain and updates Algolia;removeEntry(id)removes an entry and its R2 assets (admin‑only)
Mining highlights:
- Balance check uses available credits (excludes reserve)
- Media pinned as-is to R2; content-type detection ensures streaming
- Metadata pinned to R2; CID becomes Algolia id
- Partition: escrow = min(1 XLM * topAPR%, 0.3); remaining split 50/50 (issuer payment, user equity invest)
- Strict ordering: only index in Algolia after Soroban ops succeed