Skip to content

Commit e9180e5

Browse files
authored
Add escrow recipient to coins response (#580)
Some coins were custom-created and don't have a dbc, in which case we need to have the coin creator wallet somehow, in order for the frontend to determine whether the user can attempt to claim vested coins. Tested locally.
1 parent 4c09d1c commit e9180e5

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

api/swagger/swagger-v1-full.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6315,6 +6315,10 @@ components:
63156315
type: string
63166316
description: The user ID of the coin owner
63176317
example: "7eP5n"
6318+
escrow_recipient:
6319+
type: string
6320+
description: The escrow recipient address for custom-created coins without DBCs
6321+
example: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"
63186322
coin_response:
63196323
type: object
63206324
properties:

api/swagger/swagger-v1.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5640,6 +5640,10 @@ components:
56405640
type: string
56415641
description: The ID of the user associated with the coin
56425642
example: "7eP5n"
5643+
escrow_recipient:
5644+
type: string
5645+
description: The escrow recipient address for custom-created coins without DBCs
5646+
example: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"
56435647
logo_uri:
56445648
type: string
56455649
description: URL to the coin's logo image

api/v1_coins.go

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,22 @@ import (
1010
)
1111

1212
type ArtistCoin struct {
13-
Name string `json:"name"`
14-
Ticker string `json:"ticker"`
15-
Mint string `json:"mint"`
16-
Decimals int `json:"decimals"`
17-
OwnerId trashid.HashId `db:"user_id" json:"owner_id"`
18-
LogoUri *string `json:"logo_uri,omitempty"`
19-
BannerImageUrl *string `json:"banner_image_url,omitempty"`
20-
Description *string `json:"description,omitempty"`
21-
Link1 *string `json:"link_1,omitempty"`
22-
Link2 *string `json:"link_2,omitempty"`
23-
Link3 *string `json:"link_3,omitempty"`
24-
Link4 *string `json:"link_4,omitempty"`
25-
HasDiscord bool `json:"has_discord"`
26-
CreatedAt time.Time `json:"created_at"`
27-
CoinUpdatedAt time.Time `json:"coin_updated_at"`
13+
Name string `json:"name"`
14+
Ticker string `json:"ticker"`
15+
Mint string `json:"mint"`
16+
Decimals int `json:"decimals"`
17+
OwnerId trashid.HashId `db:"user_id" json:"owner_id"`
18+
EscrowRecipient *string `json:"escrow_recipient,omitempty"`
19+
LogoUri *string `json:"logo_uri,omitempty"`
20+
BannerImageUrl *string `json:"banner_image_url,omitempty"`
21+
Description *string `json:"description,omitempty"`
22+
Link1 *string `json:"link_1,omitempty"`
23+
Link2 *string `json:"link_2,omitempty"`
24+
Link3 *string `json:"link_3,omitempty"`
25+
Link4 *string `json:"link_4,omitempty"`
26+
HasDiscord bool `json:"has_discord"`
27+
CreatedAt time.Time `json:"created_at"`
28+
CoinUpdatedAt time.Time `json:"coin_updated_at"`
2829

2930
MarketCap float64 `json:"marketCap" db:"market_cap"`
3031
FDV float64 `json:"fdv" db:"fdv"`
@@ -106,6 +107,7 @@ const sharedSelectCoinSql = `
106107
artist_coins.ticker,
107108
artist_coins.decimals,
108109
artist_coins.user_id,
110+
earliest_escrow.recipient as escrow_recipient,
109111
artist_coins.logo_uri,
110112
artist_coins.banner_image_url,
111113
artist_coins.description,
@@ -209,6 +211,12 @@ const sharedSelectCoinSql = `
209211
ORDER BY created_at ASC
210212
LIMIT 1
211213
) AS reward_pool ON true
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
212220
`
213221

214222
type GetArtistCoinsQueryParams struct {

0 commit comments

Comments
 (0)