@farcaster/snap 2.7.1 → 2.9.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.
@@ -23,17 +23,6 @@ export type SnapSendTransactionParams = {
23
23
  maxFeePerGas?: string;
24
24
  maxPriorityFeePerGas?: string;
25
25
  };
26
- export type SnapSendCallsParams = {
27
- version?: "1.0";
28
- chainId: string;
29
- atomicRequired?: boolean;
30
- id?: string;
31
- calls: Array<{
32
- to?: string;
33
- data?: string;
34
- value?: string;
35
- }>;
36
- };
37
26
  export type SnapActionHandlers = {
38
27
  submit: (target: string, inputs: Record<string, JsonValue>) => void;
39
28
  open_url: (target: string) => void;
@@ -45,6 +34,9 @@ export type SnapActionHandlers = {
45
34
  view_profile: (params: {
46
35
  fid: number;
47
36
  }) => void;
37
+ view_channel: (params: {
38
+ channelKey: string;
39
+ }) => void;
48
40
  compose_cast: (params: {
49
41
  text?: string;
50
42
  channelKey?: string;
@@ -64,7 +56,6 @@ export type SnapActionHandlers = {
64
56
  buyToken?: string;
65
57
  }) => void;
66
58
  send_transaction?: (params: SnapSendTransactionParams) => void;
67
- send_calls?: (params: SnapSendCallsParams) => void;
68
59
  };
69
60
  export type { SnapRenderState };
70
61
  export declare function SnapCard({ snap, handlers, loading, appearance, maxWidth, showOverflowWarning, onValidationError, validationErrorFallback, actionError, plain, loadingOverlay, initialRenderState, onRenderStateChange, }: {
@@ -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,
@@ -350,26 +353,6 @@ export function SnapViewCore({ snap, handlers, loading = false, appearance = "da
350
353
  maxPriorityFeePerGas: optionalString(p.maxPriorityFeePerGas),
351
354
  });
352
355
  break;
353
- case "send_calls":
354
- handlers.send_calls?.({
355
- version: p.version === "1.0" ? "1.0" : undefined,
356
- chainId: String(p.chainId ?? ""),
357
- atomicRequired: typeof p.atomicRequired === "boolean"
358
- ? p.atomicRequired
359
- : undefined,
360
- id: optionalString(p.id),
361
- calls: Array.isArray(p.calls)
362
- ? p.calls.map((call) => {
363
- const c = asRecord(call);
364
- return {
365
- to: optionalString(c.to),
366
- data: optionalString(c.data),
367
- value: optionalString(c.value),
368
- };
369
- })
370
- : [],
371
- });
372
- break;
373
356
  default:
374
357
  break;
375
358
  }
@@ -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,
@@ -175,26 +178,6 @@ export function SnapViewCoreInner({ snap, handlers, loading = false, loadingOver
175
178
  maxPriorityFeePerGas: optionalString(p.maxPriorityFeePerGas),
176
179
  });
177
180
  break;
178
- case "send_calls":
179
- h.send_calls?.({
180
- version: p.version === "1.0" ? "1.0" : undefined,
181
- chainId: String(p.chainId ?? ""),
182
- atomicRequired: typeof p.atomicRequired === "boolean"
183
- ? p.atomicRequired
184
- : undefined,
185
- id: optionalString(p.id),
186
- calls: Array.isArray(p.calls)
187
- ? p.calls.map((call) => {
188
- const c = asRecord(call);
189
- return {
190
- to: optionalString(c.to),
191
- data: optionalString(c.data),
192
- value: optionalString(c.value),
193
- };
194
- })
195
- : [],
196
- });
197
- break;
198
181
  default:
199
182
  break;
200
183
  }
@@ -22,17 +22,6 @@ export type SnapSendTransactionParams = {
22
22
  maxFeePerGas?: string;
23
23
  maxPriorityFeePerGas?: string;
24
24
  };
25
- export type SnapSendCallsParams = {
26
- version?: "1.0";
27
- chainId: string;
28
- atomicRequired?: boolean;
29
- id?: string;
30
- calls: Array<{
31
- to?: string;
32
- data?: string;
33
- value?: string;
34
- }>;
35
- };
36
25
  export type SnapActionHandlers = {
37
26
  submit: (target: string, inputs: Record<string, JsonValue>) => void;
38
27
  open_url: (target: string) => void;
@@ -44,6 +33,9 @@ export type SnapActionHandlers = {
44
33
  view_profile: (params: {
45
34
  fid: number;
46
35
  }) => void;
36
+ view_channel: (params: {
37
+ channelKey: string;
38
+ }) => void;
47
39
  compose_cast: (params: {
48
40
  text?: string;
49
41
  channelKey?: string;
@@ -63,5 +55,4 @@ export type SnapActionHandlers = {
63
55
  buyToken?: string;
64
56
  }) => void;
65
57
  send_transaction?: (params: SnapSendTransactionParams) => void;
66
- send_calls?: (params: SnapSendCallsParams) => void;
67
58
  };
@@ -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<{
@@ -585,20 +591,6 @@ export declare const snapJsonRenderCatalog: import("@json-render/core").Catalog<
585
591
  maxPriorityFeePerGas: z.ZodOptional<z.ZodString>;
586
592
  }, z.core.$strip>;
587
593
  };
588
- send_calls: {
589
- description: string;
590
- params: z.ZodObject<{
591
- version: z.ZodOptional<z.ZodLiteral<"1.0">>;
592
- chainId: z.ZodString;
593
- atomicRequired: z.ZodOptional<z.ZodBoolean>;
594
- id: z.ZodOptional<z.ZodString>;
595
- calls: z.ZodArray<z.ZodObject<{
596
- to: z.ZodOptional<z.ZodString>;
597
- data: z.ZodOptional<z.ZodString>;
598
- value: z.ZodOptional<z.ZodString>;
599
- }, z.core.$strip>>;
600
- }, z.core.$strip>;
601
- };
602
594
  paginator_next: {
603
595
  description: string;
604
596
  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({
@@ -164,20 +168,6 @@ export const snapJsonRenderCatalog = defineCatalog(snapJsonRenderSchema, {
164
168
  maxPriorityFeePerGas: z.string().optional(),
165
169
  }),
166
170
  },
167
- send_calls: {
168
- description: "Request one or more EVM calls through the host wallet using wallet_sendCalls.",
169
- params: z.object({
170
- version: z.literal("1.0").optional(),
171
- chainId: z.string(),
172
- atomicRequired: z.boolean().optional(),
173
- id: z.string().optional(),
174
- calls: z.array(z.object({
175
- to: z.string().optional(),
176
- data: z.string().optional(),
177
- value: z.string().optional(),
178
- })),
179
- }),
180
- },
181
171
  paginator_next: {
182
172
  description: "Move the snap's paginator to the next page locally. Does not POST and is ignored when no paginator is rendered.",
183
173
  params: z.object({ page: z.number().int().min(0).optional() }),
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.9.0",
4
4
  "description": "Farcaster Snaps 🫰",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,18 +36,6 @@ export type SnapSendTransactionParams = {
36
36
  maxPriorityFeePerGas?: string;
37
37
  };
38
38
 
39
- export type SnapSendCallsParams = {
40
- version?: "1.0";
41
- chainId: string;
42
- atomicRequired?: boolean;
43
- id?: string;
44
- calls: Array<{
45
- to?: string;
46
- data?: string;
47
- value?: string;
48
- }>;
49
- };
50
-
51
39
  export type SnapActionHandlers = {
52
40
  submit: (target: string, inputs: Record<string, JsonValue>) => void;
53
41
  open_url: (target: string) => void;
@@ -55,6 +43,7 @@ export type SnapActionHandlers = {
55
43
  open_mini_app: (target: string) => void;
56
44
  view_cast: (params: { hash: string }) => void;
57
45
  view_profile: (params: { fid: number }) => void;
46
+ view_channel: (params: { channelKey: string }) => void;
58
47
  compose_cast: (params: {
59
48
  text?: string;
60
49
  channelKey?: string;
@@ -69,7 +58,6 @@ export type SnapActionHandlers = {
69
58
  }) => void;
70
59
  swap_token: (params: { sellToken?: string; buyToken?: string }) => void;
71
60
  send_transaction?: (params: SnapSendTransactionParams) => void;
72
- send_calls?: (params: SnapSendCallsParams) => void;
73
61
  };
74
62
 
75
63
  export type { SnapRenderState };
@@ -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,
@@ -515,27 +518,6 @@ export function SnapViewCore({
515
518
  maxPriorityFeePerGas: optionalString(p.maxPriorityFeePerGas),
516
519
  });
517
520
  break;
518
- case "send_calls":
519
- handlers.send_calls?.({
520
- version: p.version === "1.0" ? "1.0" : undefined,
521
- chainId: String(p.chainId ?? ""),
522
- atomicRequired:
523
- typeof p.atomicRequired === "boolean"
524
- ? p.atomicRequired
525
- : undefined,
526
- id: optionalString(p.id),
527
- calls: Array.isArray(p.calls)
528
- ? p.calls.map((call) => {
529
- const c = asRecord(call);
530
- return {
531
- to: optionalString(c.to),
532
- data: optionalString(c.data),
533
- value: optionalString(c.value),
534
- };
535
- })
536
- : [],
537
- });
538
- break;
539
521
  default:
540
522
  break;
541
523
  }
@@ -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,
@@ -250,27 +253,6 @@ export function SnapViewCoreInner({
250
253
  maxPriorityFeePerGas: optionalString(p.maxPriorityFeePerGas),
251
254
  });
252
255
  break;
253
- case "send_calls":
254
- h.send_calls?.({
255
- version: p.version === "1.0" ? "1.0" : undefined,
256
- chainId: String(p.chainId ?? ""),
257
- atomicRequired:
258
- typeof p.atomicRequired === "boolean"
259
- ? p.atomicRequired
260
- : undefined,
261
- id: optionalString(p.id),
262
- calls: Array.isArray(p.calls)
263
- ? p.calls.map((call) => {
264
- const c = asRecord(call);
265
- return {
266
- to: optionalString(c.to),
267
- data: optionalString(c.data),
268
- value: optionalString(c.value),
269
- };
270
- })
271
- : [],
272
- });
273
- break;
274
256
  default:
275
257
  break;
276
258
  }
@@ -29,18 +29,6 @@ export type SnapSendTransactionParams = {
29
29
  maxPriorityFeePerGas?: string;
30
30
  };
31
31
 
32
- export type SnapSendCallsParams = {
33
- version?: "1.0";
34
- chainId: string;
35
- atomicRequired?: boolean;
36
- id?: string;
37
- calls: Array<{
38
- to?: string;
39
- data?: string;
40
- value?: string;
41
- }>;
42
- };
43
-
44
32
  export type SnapActionHandlers = {
45
33
  submit: (target: string, inputs: Record<string, JsonValue>) => void;
46
34
  open_url: (target: string) => void;
@@ -48,6 +36,7 @@ export type SnapActionHandlers = {
48
36
  open_mini_app: (target: string) => void;
49
37
  view_cast: (params: { hash: string }) => void;
50
38
  view_profile: (params: { fid: number }) => void;
39
+ view_channel: (params: { channelKey: string }) => void;
51
40
  compose_cast: (params: {
52
41
  text?: string;
53
42
  channelKey?: string;
@@ -62,5 +51,4 @@ export type SnapActionHandlers = {
62
51
  }) => void;
63
52
  swap_token: (params: { sellToken?: string; buyToken?: string }) => void;
64
53
  send_transaction?: (params: SnapSendTransactionParams) => void;
65
- send_calls?: (params: SnapSendCallsParams) => void;
66
54
  };
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({
@@ -186,23 +190,6 @@ export const snapJsonRenderCatalog = defineCatalog(snapJsonRenderSchema, {
186
190
  maxPriorityFeePerGas: z.string().optional(),
187
191
  }),
188
192
  },
189
- send_calls: {
190
- description:
191
- "Request one or more EVM calls through the host wallet using wallet_sendCalls.",
192
- params: z.object({
193
- version: z.literal("1.0").optional(),
194
- chainId: z.string(),
195
- atomicRequired: z.boolean().optional(),
196
- id: z.string().optional(),
197
- calls: z.array(
198
- z.object({
199
- to: z.string().optional(),
200
- data: z.string().optional(),
201
- value: z.string().optional(),
202
- }),
203
- ),
204
- }),
205
- },
206
193
  paginator_next: {
207
194
  description:
208
195
  "Move the snap's paginator to the next page locally. Does not POST and is ignored when no paginator is rendered.",