Skip to content

Commit 39c6061

Browse files
committed
chore: fetch protos; update social links to include tg and discord
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 84d3092 commit 39c6061

12 files changed

Lines changed: 187 additions & 8 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="18dp"
3+
android:height="18dp"
4+
android:viewportWidth="18"
5+
android:viewportHeight="18">
6+
<group>
7+
<clip-path
8+
android:pathData="M0,0h17.244v17.632h-17.244z"/>
9+
<path
10+
android:pathData="M14.648,3.818C13.535,3.297 12.357,2.927 11.146,2.718C10.995,2.99 10.819,3.357 10.697,3.649C9.391,3.453 8.097,3.453 6.815,3.649C6.694,3.357 6.514,2.99 6.361,2.718C5.149,2.927 3.97,3.298 2.856,3.821C0.64,7.17 0.039,10.437 0.339,13.657C1.809,14.755 3.234,15.422 4.635,15.858C4.983,15.379 5.291,14.873 5.555,14.343C5.052,14.151 4.567,13.915 4.106,13.638C4.227,13.548 4.346,13.454 4.461,13.357C7.255,14.663 10.29,14.663 13.05,13.357C13.166,13.453 13.284,13.547 13.405,13.638C12.943,13.916 12.458,14.153 11.954,14.344C12.219,14.876 12.526,15.383 12.874,15.859C14.276,15.423 15.702,14.756 17.172,13.657C17.524,9.924 16.57,6.688 14.648,3.818ZM5.935,11.677C5.097,11.677 4.409,10.894 4.409,9.94C4.409,8.987 5.082,8.203 5.935,8.203C6.789,8.203 7.476,8.986 7.462,9.94C7.463,10.894 6.789,11.677 5.935,11.677ZM11.576,11.677C10.737,11.677 10.05,10.894 10.05,9.94C10.05,8.987 10.722,8.203 11.576,8.203C12.429,8.203 13.117,8.986 13.102,9.94C13.102,10.894 12.429,11.677 11.576,11.677Z"
11+
android:strokeAlpha="0.4"
12+
android:fillColor="#ffffff"
13+
android:fillAlpha="0.4"/>
14+
</group>
15+
</vector>

apps/flipcash/core/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@
417417

418418
<string name="label_social_website">Website</string>
419419
<string name="label_social_x">\@%1$s</string>
420+
<string name="label_social_tg">Telegram</string>
421+
<string name="label_social_discord">Discord</string>
420422

421423
<string name="action_retry">Retry</string>
422424
<string name="error_unableToLoadChartData">Unable To Load</string>

apps/flipcash/features/tokens/src/main/kotlin/com/flipcash/app/tokens/internal/components/info/SocialChip.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ internal fun SocialChip(
4747
when (socialLink) {
4848
is SocialLink.Website -> R.drawable.ic_social_web
4949
is SocialLink.X -> R.drawable.ic_social_x
50+
is SocialLink.Discord -> R.drawable.ic_social_discord
51+
is SocialLink.Telegram -> R.drawable.ic_social_tg
5052
}
5153
),
5254
contentDescription = null,
@@ -57,6 +59,8 @@ internal fun SocialChip(
5759
text = when (socialLink) {
5860
is SocialLink.Website -> stringResource(R.string.label_social_website)
5961
is SocialLink.X -> stringResource(R.string.label_social_x, socialLink.username)
62+
is SocialLink.Discord -> stringResource(R.string.label_social_discord)
63+
is SocialLink.Telegram -> stringResource(R.string.label_social_tg)
6064
},
6165
color = CodeTheme.colors.textMain,
6266
style = CodeTheme.typography.textMedium

apps/flipcash/shared/persistence/db/src/main/kotlin/com/flipcash/app/persistence/converters/TokenTypeConverters.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ sealed interface SocialLinkSerialized {
5151
@Serializable
5252
@SerialName("x")
5353
data class X(val username: String) : SocialLinkSerialized
54+
55+
@Serializable
56+
@SerialName("tg")
57+
data class Telegram(val username: String) : SocialLinkSerialized
58+
59+
@Serializable
60+
@SerialName("discord")
61+
data class Discord(val inviteCode: String) : SocialLinkSerialized
5462
}
5563

5664
@Serializable

apps/flipcash/shared/persistence/sources/src/main/kotlin/com/flipcash/app/persistence/sources/mapper/tokens/EntityToTokenMapper.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ private fun LaunchpadMetadataEmbedded.toDomain() = LaunchpadMetadata(
7171
private fun SocialLinkSerialized.toDomain(): SocialLink = when (this) {
7272
is SocialLinkSerialized.Website -> SocialLink.Website(url)
7373
is SocialLinkSerialized.X -> SocialLink.X(username)
74+
is SocialLinkSerialized.Discord -> SocialLink.Discord(inviteCode)
75+
is SocialLinkSerialized.Telegram -> SocialLink.Telegram(username)
7476
}
7577

7678
private fun BillCustomizationsSerialized.toDomain() = TokenBillCustomizations(

apps/flipcash/shared/persistence/sources/src/main/kotlin/com/flipcash/app/persistence/sources/mapper/tokens/TokenToEntityMapper.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ private fun LaunchpadMetadata.toEmbedded() = LaunchpadMetadataEmbedded(
6767
private fun SocialLink.toSerialized(): SocialLinkSerialized = when (this) {
6868
is SocialLink.Website -> SocialLinkSerialized.Website(url)
6969
is SocialLink.X -> SocialLinkSerialized.X(username)
70+
is SocialLink.Discord -> SocialLinkSerialized.Discord(inviteCode)
71+
is SocialLink.Telegram -> SocialLinkSerialized.Telegram(username)
7072
}
7173

7274
private fun TokenBillCustomizations.toSerialized() = BillCustomizationsSerialized(

apps/flipcash/shared/tokens/src/main/kotlin/com/flipcash/app/tokens/data/MarketCapPoint.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ fun List<MarketCapPoint>.collapse(
2323
Period.All -> minOfOrNull { it.x } ?: now
2424
}
2525

26-
val filtered = filter { it.x >= startTime }
27-
if (filtered.isEmpty()) return emptyList()
26+
val filtered = filter { it.x >= startTime }.ifEmpty {
27+
// No points fall within the period window — use the closest point
28+
// so the chart still renders with targetPoints entries.
29+
val nearest = minByOrNull { kotlin.math.abs(it.x - startTime) }
30+
?: return emptyList()
31+
listOf(nearest)
32+
}
2833

2934
val duration = now - startTime
3035
val intervalMs = (duration / targetPoints).coerceAtLeast(1)

definitions/opencode/protos/src/main/proto/account/v1/account_service.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ option java_package = "com.codeinc.opencode.gen.account.v1";
77
option objc_class_prefix = "CPBAccountV1";
88

99
import "common/v1/model.proto";
10+
import "currency/v1/currency_service.proto";
1011
import "transaction/v1/transaction_service.proto";
1112
import "google/protobuf/timestamp.proto";
1213

@@ -199,6 +200,12 @@ message TokenAccountInfo {
199200
// The token account's mint
200201
common.v1.SolanaAccountId mint = 12;
201202

203+
// Mint metadata for the token account's mint
204+
currency.v1.Mint mint_metadata = 16;
205+
206+
// Live mint reserve state, if applicable
207+
currency.v1.VerifiedLaunchpadCurrencyReserveState live_reserve_state = 17;
208+
202209
// Time the account was created, if available. For OCP accounts, this is
203210
// the time of intent submission. Otherwise, for external accounts, it is
204211
// the time created on the blockchain.

definitions/opencode/protos/src/main/proto/currency/v1/currency_service.proto

Lines changed: 110 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ service Currency {
1313
rpc GetHistoricalMintData(GetHistoricalMintDataRequest) returns (GetHistoricalMintDataResponse);
1414
// StreamLiveMintData streams live mint data for a set of mints
1515
rpc StreamLiveMintData(stream StreamLiveMintDataRequest) returns (stream StreamLiveMintDataResponse);
16+
// Launch launches a new currency on the launchpad
17+
rpc Launch(LaunchRequest) returns (LaunchResponse);
18+
// UpdateIcon uploads and updates the icon for a currency
19+
rpc UpdateIcon(UpdateIconRequest) returns (UpdateIconResponse);
20+
// UpdateMetadata updates mutable metadata for a currency
21+
rpc UpdateMetadata(UpdateMetadataRequest) returns (UpdateMetadataResponse);
22+
// Discover returns a set of currencies to discover
23+
rpc Discover(DiscoverRequest) returns (stream DiscoverResponse);
1624
}
1725
message GetMintsRequest {
1826
repeated common.v1.SolanaAccountId addresses = 1 ;
@@ -129,8 +137,6 @@ message LaunchpadMetadata {
129137
// The address where core mint tokens are locked against the liquidity pool
130138
common.v1.SolanaAccountId core_mint_vault = 6;
131139
// Current circulating mint token supply in quarks
132-
//
133-
// Deprecated: Use supply value from StreamLiveMintData
134140
uint64 supply_from_bonding = 7;
135141
// Precent fee for sells in basis points, currently hardcoded to 1%
136142
uint32 sell_fee_bps = 8;
@@ -179,15 +185,25 @@ message VerifiedLaunchapdCurrencyReserveStateBatch {
179185
}
180186
message SocialLink {
181187
oneof type {
182-
Website website = 1;
183-
X x = 2;
188+
Website website = 1;
189+
X x = 2;
190+
Telegram telegram = 3;
191+
Discord discord = 4;
184192
}
185193
message Website {
186194
string url = 1 ;
187195
}
188196
message X {
189197
string username = 1 ;
190198
}
199+
message Telegram {
200+
// Telegram username (without the @ prefix)
201+
string username = 1 ;
202+
}
203+
message Discord {
204+
// Discord invite code (e.g. "abc123" from discord.gg/abc123)
205+
string invite_code = 1 ;
206+
}
191207
}
192208
message BillCustomization {
193209
// Bill background colors (from top to bottom)
@@ -197,3 +213,93 @@ message Color {
197213
// Hex colour value (e.g. "#19191A")
198214
string hex = 1 ;
199215
}
216+
message LaunchRequest {
217+
// The owner account launching the currency
218+
common.v1.SolanaAccountId owner = 1;
219+
// The signature is of serialize(LaunchRequest) without this field set
220+
// using the private key of the owner account. This provides an authentication
221+
// mechanism to the RPC.
222+
common.v1.Signature signature = 2;
223+
// The name of the currency to launch
224+
string name = 3 ;
225+
// The ticker symbol for the currency. If not provided, a default will be
226+
// generated using the currency name.
227+
string symbol = 4 ;
228+
}
229+
message LaunchResponse {
230+
Result result = 1;
231+
enum Result {
232+
OK = 0;
233+
// The launch was denied
234+
DENIED = 1;
235+
// A similar currency already exists
236+
EXISTS = 2;
237+
}
238+
// The mint address of the launched currency on success
239+
common.v1.SolanaAccountId mint = 2;
240+
}
241+
message UpdateIconRequest {
242+
// The owner account of the currency
243+
common.v1.SolanaAccountId owner = 1;
244+
// The signature is of serialize(UpdateIconRequest) without this field set
245+
// using the private key of the owner account. This provides an authentication
246+
// mechanism to the RPC.
247+
common.v1.Signature signature = 2;
248+
// The mint address of the currency to update
249+
common.v1.SolanaAccountId mint = 3;
250+
// The raw image data for the icon
251+
bytes icon = 4 ;
252+
}
253+
message UpdateIconResponse {
254+
Result result = 1;
255+
enum Result {
256+
OK = 0;
257+
NOT_FOUND = 1;
258+
DENIED = 2;
259+
INVALID_ICON = 3;
260+
}
261+
}
262+
message UpdateMetadataRequest {
263+
// The owner account of the currency
264+
common.v1.SolanaAccountId owner = 1;
265+
// The signature is of serialize(UpdateMetadataRequest) without this field set
266+
// using the private key of the owner account. This provides an authentication
267+
// mechanism to the RPC.
268+
common.v1.Signature signature = 2;
269+
// The mint address of the currency to update
270+
common.v1.SolanaAccountId mint = 3;
271+
// Updated currency description. If not provided, description is not updated.
272+
DescriptionUpdate new_description = 4;
273+
// Updated bill customization. If not provided, bill customization is not updated.
274+
BillCustomizationUpdate new_bill_customization = 5;
275+
// Updated social links. This replaces the entire set of social links. If not
276+
// provided, social links are not updated.
277+
SocialLinksUpdate new_social_links = 6;
278+
message DescriptionUpdate {
279+
string value = 1 ;
280+
}
281+
message BillCustomizationUpdate {
282+
BillCustomization value = 1;
283+
}
284+
message SocialLinksUpdate {
285+
repeated SocialLink value = 1 ;
286+
}
287+
}
288+
message UpdateMetadataResponse {
289+
Result result = 1;
290+
enum Result {
291+
OK = 0;
292+
NOT_FOUND = 1;
293+
DENIED = 2;
294+
}
295+
}
296+
message DiscoverRequest {
297+
}
298+
message DiscoverResponse {
299+
Result result = 1;
300+
enum Result {
301+
OK = 0;
302+
NOT_FOUND = 1;
303+
}
304+
repeated Mint mint = 2 ;
305+
}

definitions/opencode/protos/src/main/proto/messaging/v1/messaging_service.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ option go_package = "github.com/code-payments/ocp-protobuf-api/generated/go/mess
44
option java_package = "com.codeinc.opencode.gen.messaging.v1";
55
option objc_class_prefix = "CPBMessagingV1";
66
import "common/v1/model.proto";
7+
import "currency/v1/currency_service.proto";
78
import "transaction/v1/transaction_service.proto";
89

910
service Messaging {
@@ -142,6 +143,10 @@ message RequestToGrabBill {
142143
// should be sent.
143144
common.v1.SolanaAccountId requestor_account = 1;
144145
}
146+
message RequestToGiveBillServerContext {
147+
// Mint metadata for the bill's mint
148+
currency.v1.Mint mint_metadata = 1;
149+
}
145150
// Request that a bill be given in the desired mint
146151
//
147152
// This message type is only initiated by clients.
@@ -172,4 +177,11 @@ message Message {
172177
RequestToGrabBill request_to_grab_bill = 3;
173178
RequestToGiveBill request_to_give_bill = 4;
174179
}
180+
// Additional server-provided context for messages sent by client
181+
AdditionalServerContext additional_context = 5;
182+
}
183+
message AdditionalServerContext {
184+
oneof type {
185+
RequestToGiveBillServerContext request_to_give_bill = 1;
186+
}
175187
}

0 commit comments

Comments
 (0)