Skip to content

Commit f09ac97

Browse files
committed
select earliest escrow
1 parent 9020853 commit f09ac97

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

api/v1_coins.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const sharedSelectCoinSql = `
107107
artist_coins.ticker,
108108
artist_coins.decimals,
109109
artist_coins.user_id,
110-
sol_locker_vesting_escrows.recipient as escrow_recipient,
110+
earliest_escrow.recipient as escrow_recipient,
111111
artist_coins.logo_uri,
112112
artist_coins.banner_image_url,
113113
artist_coins.description,
@@ -211,8 +211,12 @@ const sharedSelectCoinSql = `
211211
ORDER BY created_at ASC
212212
LIMIT 1
213213
) AS reward_pool ON true
214-
LEFT JOIN sol_locker_vesting_escrows
215-
ON sol_locker_vesting_escrows.token_mint = artist_coins.mint
214+
LEFT JOIN (
215+
SELECT DISTINCT ON (token_mint) token_mint, recipient
216+
FROM sol_locker_vesting_escrows
217+
ORDER BY token_mint, created_at ASC
218+
) AS earliest_escrow
219+
ON earliest_escrow.token_mint = artist_coins.mint
216220
`
217221

218222
type GetArtistCoinsQueryParams struct {

0 commit comments

Comments
 (0)