Skip to content

v1CoinInsights#279

Merged
rickyrombo merged 7 commits intomainfrom
mjp-insights
Jul 31, 2025
Merged

v1CoinInsights#279
rickyrombo merged 7 commits intomainfrom
mjp-insights

Conversation

@rickyrombo
Copy link
Copy Markdown
Contributor

@rickyrombo rickyrombo commented Jul 30, 2025

  • Adds sol_user_balances that tracks user balances by mint. This had the effect of bringing the members related queries back down to < 3 seconds ( < 1s when primed) on my local db which is ~clone of prod
    • Updates on associated token accounts being added/removed
    • Updates on claimable token accounts being added
    • Updates on sol_token_balance_changes being added
    • Created a test to ensure this behavior
  • Moves the members and members24hrChangePercent and the Birdeye token overview into a separate route, v1/coins/:mint/insights, as information from these is really likely to only be used for specific purposes, where as v1/coins will be used all the time to list coins.
    • @faridsalau let me know what deps you were having on these and I'll bubble them up to our db. eg. I imagine logoURI is one? I know you want to have the description in here as well.
      • Yes, logoURI only

Comment thread sql/01_schema.sql
-- Name: associated_wallets associated_wallets_blocknumber_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.associated_wallets
Copy link
Copy Markdown
Contributor Author

@rickyrombo rickyrombo Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot of these are an oops from my local - once this is merged I'll refresh 01_schema.sql from prod

Copy link
Copy Markdown
Member

@raymondjacobson raymondjacobson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phenomenal testing

END IF;

-- For DELETE, always run
IF TG_OP = 'DELETE' THEN
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is DELETE to handle the case where we want to wipe the db?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah or if we decide to move to just deleting rows instead of maintaining an is_delete column or something. just good for coverage imo.

NOW(),
NOW()
FROM (
SELECT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this query reads better as

select user_id, balance
from users
left join associated_wallets
left join sol_claimable_accounts

rather than the union, but non blocking. just expressing my feels

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but then you gotta coalesce two balance columns together and you end up inserting for every user rather than just those with wallets/accounts... i think it's fine...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok true that

@rickyrombo rickyrombo merged commit 8cffe07 into main Jul 31, 2025
3 checks passed
@rickyrombo rickyrombo deleted the mjp-insights branch July 31, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants