@farcaster/snap 2.7.1 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,6 +45,9 @@ export type SnapActionHandlers = {
45
45
  view_profile: (params: {
46
46
  fid: number;
47
47
  }) => void;
48
+ view_channel: (params: {
49
+ channelKey: string;
50
+ }) => void;
48
51
  compose_cast: (params: {
49
52
  text?: string;
50
53
  channelKey?: string;
@@ -310,6 +310,9 @@ export function SnapViewCore({ snap, handlers, loading = false, appearance = "da
310
310
  case "view_profile":
311
311
  handlers.view_profile({ fid: Number(p.fid ?? 0) });
312
312
  break;
313
+ case "view_channel":
314
+ handlers.view_channel({ channelKey: String(p.channelKey ?? "") });
315
+ break;
313
316
  case "compose_cast":
314
317
  handlers.compose_cast({
315
318
  text: p.text ? String(p.text) : undefined,
@@ -137,6 +137,9 @@ export function SnapViewCoreInner({ snap, handlers, loading = false, loadingOver
137
137
  case "view_profile":
138
138
  h.view_profile({ fid: Number(p.fid ?? 0) });
139
139
  break;
140
+ case "view_channel":
141
+ h.view_channel({ channelKey: String(p.channelKey ?? "") });
142
+ break;
140
143
  case "compose_cast":
141
144
  h.compose_cast({
142
145
  text: p.text ? String(p.text) : undefined,
@@ -44,6 +44,9 @@ export type SnapActionHandlers = {
44
44
  view_profile: (params: {
45
45
  fid: number;
46
46
  }) => void;
47
+ view_channel: (params: {
48
+ channelKey: string;
49
+ }) => void;
47
50
  compose_cast: (params: {
48
51
  text?: string;
49
52
  channelKey?: string;
@@ -542,6 +542,12 @@ export declare const snapJsonRenderCatalog: import("@json-render/core").Catalog<
542
542
  fid: z.ZodNumber;
543
543
  }, z.core.$strip>;
544
544
  };
545
+ view_channel: {
546
+ description: string;
547
+ params: z.ZodObject<{
548
+ channelKey: z.ZodString;
549
+ }, z.core.$strip>;
550
+ };
545
551
  compose_cast: {
546
552
  description: string;
547
553
  params: z.ZodObject<{
@@ -123,6 +123,10 @@ export const snapJsonRenderCatalog = defineCatalog(snapJsonRenderSchema, {
123
123
  description: "Navigate to a user profile by FID.",
124
124
  params: z.object({ fid: z.number() }),
125
125
  },
126
+ view_channel: {
127
+ description: "Navigate to a Farcaster channel by channel key.",
128
+ params: z.object({ channelKey: z.string() }),
129
+ },
126
130
  compose_cast: {
127
131
  description: "Open the cast composer with optional pre-filled content.",
128
132
  params: z.object({
package/llms.txt CHANGED
@@ -172,7 +172,7 @@ Field values are sent in POST `inputs[name]` when a `submit` action fires.
172
172
  - `label` (string, optional, max 60)
173
173
  - POST value: string (single) or string[] (multiple)
174
174
 
175
- ## Actions (10 types)
175
+ ## Actions (11 types)
176
176
 
177
177
  Bound to buttons via `on.press`:
178
178
 
@@ -184,6 +184,7 @@ Bound to buttons via `on.press`:
184
184
  | `open_mini_app` | `target` (URL) | Open as Farcaster mini app |
185
185
  | `view_cast` | `hash` (string) | Navigate to a cast |
186
186
  | `view_profile` | `fid` (number) | Navigate to a profile |
187
+ | `view_channel` | `channelKey` (string) | Navigate to a channel |
187
188
  | `compose_cast` | `text?`, `channelKey?`, `embeds?` | Open cast composer. Put URLs in `embeds`, not `text` |
188
189
  | `view_token` | `token` (CAIP-19) | View token in wallet |
189
190
  | `send_token` | `token`, `amount?`, `recipientFid?`, `recipientAddress?` | Send token flow |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/snap",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "description": "Farcaster Snaps 🫰",
5
5
  "repository": {
6
6
  "type": "git",
@@ -55,6 +55,7 @@ export type SnapActionHandlers = {
55
55
  open_mini_app: (target: string) => void;
56
56
  view_cast: (params: { hash: string }) => void;
57
57
  view_profile: (params: { fid: number }) => void;
58
+ view_channel: (params: { channelKey: string }) => void;
58
59
  compose_cast: (params: {
59
60
  text?: string;
60
61
  channelKey?: string;
@@ -475,6 +475,9 @@ export function SnapViewCore({
475
475
  case "view_profile":
476
476
  handlers.view_profile({ fid: Number(p.fid ?? 0) });
477
477
  break;
478
+ case "view_channel":
479
+ handlers.view_channel({ channelKey: String(p.channelKey ?? "") });
480
+ break;
478
481
  case "compose_cast":
479
482
  handlers.compose_cast({
480
483
  text: p.text ? String(p.text) : undefined,
@@ -212,6 +212,9 @@ export function SnapViewCoreInner({
212
212
  case "view_profile":
213
213
  h.view_profile({ fid: Number(p.fid ?? 0) });
214
214
  break;
215
+ case "view_channel":
216
+ h.view_channel({ channelKey: String(p.channelKey ?? "") });
217
+ break;
215
218
  case "compose_cast":
216
219
  h.compose_cast({
217
220
  text: p.text ? String(p.text) : undefined,
@@ -48,6 +48,7 @@ export type SnapActionHandlers = {
48
48
  open_mini_app: (target: string) => void;
49
49
  view_cast: (params: { hash: string }) => void;
50
50
  view_profile: (params: { fid: number }) => void;
51
+ view_channel: (params: { channelKey: string }) => void;
51
52
  compose_cast: (params: {
52
53
  text?: string;
53
54
  channelKey?: string;
package/src/ui/catalog.ts CHANGED
@@ -144,6 +144,10 @@ export const snapJsonRenderCatalog = defineCatalog(snapJsonRenderSchema, {
144
144
  description: "Navigate to a user profile by FID.",
145
145
  params: z.object({ fid: z.number() }),
146
146
  },
147
+ view_channel: {
148
+ description: "Navigate to a Farcaster channel by channel key.",
149
+ params: z.object({ channelKey: z.string() }),
150
+ },
147
151
  compose_cast: {
148
152
  description: "Open the cast composer with optional pre-filled content.",
149
153
  params: z.object({