Skip to content

Commit edecf03

Browse files
committed
fix: update message protobuf
1 parent b8a0e0a commit edecf03

File tree

2 files changed

+212
-7
lines changed

2 files changed

+212
-7
lines changed

.changeset/cool-ties-accept.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"frames.js": patch
3+
---
4+
5+
fix: update message protobuf

packages/frames.js/src/farcaster/generated/message.ts

Lines changed: 207 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable */
22
import Long from "long";
3-
// use minimal.js so it doesn't cause issues for pages-router in next.js
43
import _m0 from "protobufjs/minimal.js";
54
import { UserNameProof } from "./username_proof";
65

@@ -110,6 +109,8 @@ export enum MessageType {
110109
USERNAME_PROOF = 12,
111110
/** FRAME_ACTION - A Farcaster Frame action */
112111
FRAME_ACTION = 13,
112+
/** LINK_COMPACT_STATE - Link Compaction State Message */
113+
LINK_COMPACT_STATE = 14,
113114
}
114115

115116
export function messageTypeFromJSON(object: any): MessageType {
@@ -150,6 +151,9 @@ export function messageTypeFromJSON(object: any): MessageType {
150151
case 13:
151152
case "MESSAGE_TYPE_FRAME_ACTION":
152153
return MessageType.FRAME_ACTION;
154+
case 14:
155+
case "MESSAGE_TYPE_LINK_COMPACT_STATE":
156+
return MessageType.LINK_COMPACT_STATE;
153157
default:
154158
throw new tsProtoGlobalThis.Error(
155159
"Unrecognized enum value " + object + " for enum MessageType"
@@ -183,6 +187,8 @@ export function messageTypeToJSON(object: MessageType): string {
183187
return "MESSAGE_TYPE_USERNAME_PROOF";
184188
case MessageType.FRAME_ACTION:
185189
return "MESSAGE_TYPE_FRAME_ACTION";
190+
case MessageType.LINK_COMPACT_STATE:
191+
return "MESSAGE_TYPE_LINK_COMPACT_STATE";
186192
default:
187193
throw new tsProtoGlobalThis.Error(
188194
"Unrecognized enum value " + object + " for enum MessageType"
@@ -252,6 +258,8 @@ export enum UserDataType {
252258
URL = 5,
253259
/** USERNAME - Preferred Name for the user */
254260
USERNAME = 6,
261+
/** LOCATION - Current location for the user */
262+
LOCATION = 7,
255263
}
256264

257265
export function userDataTypeFromJSON(object: any): UserDataType {
@@ -274,6 +282,9 @@ export function userDataTypeFromJSON(object: any): UserDataType {
274282
case 6:
275283
case "USER_DATA_TYPE_USERNAME":
276284
return UserDataType.USERNAME;
285+
case 7:
286+
case "USER_DATA_TYPE_LOCATION":
287+
return UserDataType.LOCATION;
277288
default:
278289
throw new tsProtoGlobalThis.Error(
279290
"Unrecognized enum value " + object + " for enum UserDataType"
@@ -295,13 +306,49 @@ export function userDataTypeToJSON(object: UserDataType): string {
295306
return "USER_DATA_TYPE_URL";
296307
case UserDataType.USERNAME:
297308
return "USER_DATA_TYPE_USERNAME";
309+
case UserDataType.LOCATION:
310+
return "USER_DATA_TYPE_LOCATION";
298311
default:
299312
throw new tsProtoGlobalThis.Error(
300313
"Unrecognized enum value " + object + " for enum UserDataType"
301314
);
302315
}
303316
}
304317

318+
/** Type of cast */
319+
export enum CastType {
320+
CAST = 0,
321+
LONG_CAST = 1,
322+
}
323+
324+
export function castTypeFromJSON(object: any): CastType {
325+
switch (object) {
326+
case 0:
327+
case "CAST":
328+
return CastType.CAST;
329+
case 1:
330+
case "LONG_CAST":
331+
return CastType.LONG_CAST;
332+
default:
333+
throw new tsProtoGlobalThis.Error(
334+
"Unrecognized enum value " + object + " for enum CastType"
335+
);
336+
}
337+
}
338+
339+
export function castTypeToJSON(object: CastType): string {
340+
switch (object) {
341+
case CastType.CAST:
342+
return "CAST";
343+
case CastType.LONG_CAST:
344+
return "LONG_CAST";
345+
default:
346+
throw new tsProtoGlobalThis.Error(
347+
"Unrecognized enum value " + object + " for enum CastType"
348+
);
349+
}
350+
}
351+
305352
/** Type of Reaction */
306353
export enum ReactionType {
307354
NONE = 0,
@@ -423,6 +470,8 @@ export interface MessageData {
423470
linkBody?: LinkBody | undefined;
424471
usernameProofBody?: UserNameProof | undefined;
425472
frameActionBody?: FrameActionBody | undefined;
473+
/** Compaction messages */
474+
linkCompactStateBody?: LinkCompactStateBody | undefined;
426475
}
427476

428477
/** Adds metadata about a user */
@@ -454,6 +503,8 @@ export interface CastAddBody {
454503
mentionsPositions: number[];
455504
/** URLs or cast ids to be embedded in the cast */
456505
embeds: Embed[];
506+
/** Type of cast */
507+
type: CastType;
457508
}
458509

459510
/** Removes an existing Cast */
@@ -514,6 +565,13 @@ export interface LinkBody {
514565
targetFid?: number | undefined;
515566
}
516567

568+
/** A Compaction message for the Link Store */
569+
export interface LinkCompactStateBody {
570+
/** Type of link, <= 8 characters */
571+
type: string;
572+
targetFids: number[];
573+
}
574+
517575
/** A Farcaster Frame action */
518576
export interface FrameActionBody {
519577
/** URL of the Frame triggering the action */
@@ -726,6 +784,7 @@ function createBaseMessageData(): MessageData {
726784
linkBody: undefined,
727785
usernameProofBody: undefined,
728786
frameActionBody: undefined,
787+
linkCompactStateBody: undefined,
729788
};
730789
}
731790

@@ -797,6 +856,12 @@ export const MessageData = {
797856
writer.uint32(130).fork()
798857
).ldelim();
799858
}
859+
if (message.linkCompactStateBody !== undefined) {
860+
LinkCompactStateBody.encode(
861+
message.linkCompactStateBody,
862+
writer.uint32(138).fork()
863+
).ldelim();
864+
}
800865
return writer;
801866
},
802867

@@ -912,6 +977,16 @@ export const MessageData = {
912977
reader.uint32()
913978
);
914979
continue;
980+
case 17:
981+
if (tag != 138) {
982+
break;
983+
}
984+
985+
message.linkCompactStateBody = LinkCompactStateBody.decode(
986+
reader,
987+
reader.uint32()
988+
);
989+
continue;
915990
}
916991
if ((tag & 7) == 4 || tag == 0) {
917992
break;
@@ -956,6 +1031,9 @@ export const MessageData = {
9561031
frameActionBody: isSet(object.frameActionBody)
9571032
? FrameActionBody.fromJSON(object.frameActionBody)
9581033
: undefined,
1034+
linkCompactStateBody: isSet(object.linkCompactStateBody)
1035+
? LinkCompactStateBody.fromJSON(object.linkCompactStateBody)
1036+
: undefined,
9591037
};
9601038
},
9611039

@@ -1003,6 +1081,10 @@ export const MessageData = {
10031081
(obj.frameActionBody = message.frameActionBody
10041082
? FrameActionBody.toJSON(message.frameActionBody)
10051083
: undefined);
1084+
message.linkCompactStateBody !== undefined &&
1085+
(obj.linkCompactStateBody = message.linkCompactStateBody
1086+
? LinkCompactStateBody.toJSON(message.linkCompactStateBody)
1087+
: undefined);
10061088
return obj;
10071089
},
10081090

@@ -1059,6 +1141,11 @@ export const MessageData = {
10591141
object.frameActionBody !== undefined && object.frameActionBody !== null
10601142
? FrameActionBody.fromPartial(object.frameActionBody)
10611143
: undefined;
1144+
message.linkCompactStateBody =
1145+
object.linkCompactStateBody !== undefined &&
1146+
object.linkCompactStateBody !== null
1147+
? LinkCompactStateBody.fromPartial(object.linkCompactStateBody)
1148+
: undefined;
10621149
return message;
10631150
},
10641151
};
@@ -1227,6 +1314,7 @@ function createBaseCastAddBody(): CastAddBody {
12271314
text: "",
12281315
mentionsPositions: [],
12291316
embeds: [],
1317+
type: 0,
12301318
};
12311319
}
12321320

@@ -1260,6 +1348,9 @@ export const CastAddBody = {
12601348
for (const v of message.embeds) {
12611349
Embed.encode(v!, writer.uint32(50).fork()).ldelim();
12621350
}
1351+
if (message.type !== 0) {
1352+
writer.uint32(64).int32(message.type);
1353+
}
12631354
return writer;
12641355
},
12651356

@@ -1338,6 +1429,13 @@ export const CastAddBody = {
13381429

13391430
message.embeds.push(Embed.decode(reader, reader.uint32()));
13401431
continue;
1432+
case 8:
1433+
if (tag != 64) {
1434+
break;
1435+
}
1436+
1437+
message.type = reader.int32() as any;
1438+
continue;
13411439
}
13421440
if ((tag & 7) == 4 || tag == 0) {
13431441
break;
@@ -1366,6 +1464,7 @@ export const CastAddBody = {
13661464
embeds: Array.isArray(object?.embeds)
13671465
? object.embeds.map((e: any) => Embed.fromJSON(e))
13681466
: [],
1467+
type: isSet(object.type) ? castTypeFromJSON(object.type) : 0,
13691468
};
13701469
},
13711470

@@ -1399,6 +1498,7 @@ export const CastAddBody = {
13991498
} else {
14001499
obj.embeds = [];
14011500
}
1501+
message.type !== undefined && (obj.type = castTypeToJSON(message.type));
14021502
return obj;
14031503
},
14041504

@@ -1420,6 +1520,7 @@ export const CastAddBody = {
14201520
message.text = object.text ?? "";
14211521
message.mentionsPositions = object.mentionsPositions?.map((e) => e) || [];
14221522
message.embeds = object.embeds?.map((e) => Embed.fromPartial(e)) || [];
1523+
message.type = object.type ?? 0;
14231524
return message;
14241525
},
14251526
};
@@ -2018,6 +2119,105 @@ export const LinkBody = {
20182119
},
20192120
};
20202121

2122+
function createBaseLinkCompactStateBody(): LinkCompactStateBody {
2123+
return { type: "", targetFids: [] };
2124+
}
2125+
2126+
export const LinkCompactStateBody = {
2127+
encode(
2128+
message: LinkCompactStateBody,
2129+
writer: _m0.Writer = _m0.Writer.create()
2130+
): _m0.Writer {
2131+
if (message.type !== "") {
2132+
writer.uint32(10).string(message.type);
2133+
}
2134+
writer.uint32(18).fork();
2135+
for (const v of message.targetFids) {
2136+
writer.uint64(v);
2137+
}
2138+
writer.ldelim();
2139+
return writer;
2140+
},
2141+
2142+
decode(
2143+
input: _m0.Reader | Uint8Array,
2144+
length?: number
2145+
): LinkCompactStateBody {
2146+
const reader =
2147+
input instanceof _m0.Reader ? input : _m0.Reader.create(input);
2148+
let end = length === undefined ? reader.len : reader.pos + length;
2149+
const message = createBaseLinkCompactStateBody();
2150+
while (reader.pos < end) {
2151+
const tag = reader.uint32();
2152+
switch (tag >>> 3) {
2153+
case 1:
2154+
if (tag != 10) {
2155+
break;
2156+
}
2157+
2158+
message.type = reader.string();
2159+
continue;
2160+
case 2:
2161+
if (tag == 16) {
2162+
message.targetFids.push(longToNumber(reader.uint64() as Long));
2163+
continue;
2164+
}
2165+
2166+
if (tag == 18) {
2167+
const end2 = reader.uint32() + reader.pos;
2168+
while (reader.pos < end2) {
2169+
message.targetFids.push(longToNumber(reader.uint64() as Long));
2170+
}
2171+
2172+
continue;
2173+
}
2174+
2175+
break;
2176+
}
2177+
if ((tag & 7) == 4 || tag == 0) {
2178+
break;
2179+
}
2180+
reader.skipType(tag & 7);
2181+
}
2182+
return message;
2183+
},
2184+
2185+
fromJSON(object: any): LinkCompactStateBody {
2186+
return {
2187+
type: isSet(object.type) ? String(object.type) : "",
2188+
targetFids: Array.isArray(object?.targetFids)
2189+
? object.targetFids.map((e: any) => Number(e))
2190+
: [],
2191+
};
2192+
},
2193+
2194+
toJSON(message: LinkCompactStateBody): unknown {
2195+
const obj: any = {};
2196+
message.type !== undefined && (obj.type = message.type);
2197+
if (message.targetFids) {
2198+
obj.targetFids = message.targetFids.map((e) => Math.round(e));
2199+
} else {
2200+
obj.targetFids = [];
2201+
}
2202+
return obj;
2203+
},
2204+
2205+
create<I extends Exact<DeepPartial<LinkCompactStateBody>, I>>(
2206+
base?: I
2207+
): LinkCompactStateBody {
2208+
return LinkCompactStateBody.fromPartial(base ?? {});
2209+
},
2210+
2211+
fromPartial<I extends Exact<DeepPartial<LinkCompactStateBody>, I>>(
2212+
object: I
2213+
): LinkCompactStateBody {
2214+
const message = createBaseLinkCompactStateBody();
2215+
message.type = object.type ?? "";
2216+
message.targetFids = object.targetFids?.map((e) => e) || [];
2217+
return message;
2218+
},
2219+
};
2220+
20212221
function createBaseFrameActionBody(): FrameActionBody {
20222222
return {
20232223
url: new Uint8Array(),
@@ -2256,12 +2456,12 @@ type Builtin =
22562456
type DeepPartial<T> = T extends Builtin
22572457
? T
22582458
: T extends Array<infer U>
2259-
? Array<DeepPartial<U>>
2260-
: T extends ReadonlyArray<infer U>
2261-
? ReadonlyArray<DeepPartial<U>>
2262-
: T extends {}
2263-
? { [K in keyof T]?: DeepPartial<T[K]> }
2264-
: Partial<T>;
2459+
? Array<DeepPartial<U>>
2460+
: T extends ReadonlyArray<infer U>
2461+
? ReadonlyArray<DeepPartial<U>>
2462+
: T extends {}
2463+
? { [K in keyof T]?: DeepPartial<T[K]> }
2464+
: Partial<T>;
22652465

22662466
type KeysOfUnion<T> = T extends T ? keyof T : never;
22672467
type Exact<P, I extends P> = P extends Builtin

0 commit comments

Comments
 (0)