@farcaster/frame-core 0.0.29 → 0.0.32

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.
Files changed (74) hide show
  1. package/README.md +13 -0
  2. package/dist/actions/ComposeCast.d.ts +32 -0
  3. package/dist/actions/ComposeCast.js +2 -0
  4. package/dist/actions/index.d.ts +1 -0
  5. package/dist/actions/index.js +2 -1
  6. package/dist/errors.d.ts +3 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +3 -1
  9. package/dist/manifest.d.ts +101 -0
  10. package/dist/manifest.js +2 -0
  11. package/dist/schemas/embeds.d.ts +20 -20
  12. package/dist/schemas/embeds.js +1 -1
  13. package/dist/schemas/manifest.d.ts +92 -6
  14. package/dist/schemas/manifest.js +31 -0
  15. package/dist/schemas/shared.d.ts +4 -0
  16. package/dist/schemas/shared.js +29 -2
  17. package/dist/types.d.ts +3 -1
  18. package/dist/wallet/ethereum.d.ts +5 -1
  19. package/esm/actions/AddFrame.d.ts +23 -27
  20. package/esm/actions/AddFrame.js +9 -9
  21. package/esm/actions/ComposeCast.d.ts +32 -0
  22. package/esm/actions/ComposeCast.js +1 -0
  23. package/esm/actions/Ready.d.ts +11 -11
  24. package/esm/actions/Ready.js +2 -2
  25. package/esm/actions/SignIn.d.ts +33 -35
  26. package/esm/actions/SignIn.js +5 -5
  27. package/esm/actions/Swap.d.ts +43 -44
  28. package/esm/actions/Swap.js +1 -1
  29. package/esm/actions/ViewProfile.d.ts +3 -3
  30. package/esm/actions/ViewProfile.js +1 -1
  31. package/esm/actions/ViewToken.d.ts +3 -3
  32. package/esm/actions/ViewToken.js +1 -1
  33. package/esm/actions/index.d.ts +7 -6
  34. package/esm/actions/index.js +7 -6
  35. package/esm/context.d.ts +61 -65
  36. package/esm/context.js +1 -1
  37. package/esm/errors.d.ts +10 -9
  38. package/esm/errors.js +6 -6
  39. package/esm/index.d.ts +7 -5
  40. package/esm/index.js +7 -5
  41. package/esm/internal/types.d.ts +7 -18
  42. package/esm/internal/types.js +1 -1
  43. package/esm/manifest.d.ts +101 -0
  44. package/esm/manifest.js +1 -0
  45. package/esm/schemas/embeds.d.ts +239 -346
  46. package/esm/schemas/embeds.js +23 -31
  47. package/esm/schemas/events.d.ts +129 -225
  48. package/esm/schemas/events.js +17 -17
  49. package/esm/schemas/index.d.ts +5 -5
  50. package/esm/schemas/index.js +5 -5
  51. package/esm/schemas/manifest.d.ts +196 -154
  52. package/esm/schemas/manifest.js +54 -29
  53. package/esm/schemas/notifications.d.ts +58 -86
  54. package/esm/schemas/notifications.js +17 -17
  55. package/esm/schemas/shared.d.ts +39 -53
  56. package/esm/schemas/shared.js +49 -25
  57. package/esm/tsconfig.tsbuildinfo +1 -1
  58. package/esm/types.d.ts +53 -70
  59. package/esm/types.js +2 -2
  60. package/esm/wallet/ethereum.d.ts +39 -50
  61. package/esm/wallet/ethereum.js +1 -1
  62. package/esm/wallet/index.d.ts +1 -1
  63. package/esm/wallet/index.js +1 -1
  64. package/package.json +1 -1
  65. package/src/actions/ComposeCast.ts +36 -0
  66. package/src/actions/index.ts +1 -0
  67. package/src/errors.ts +4 -0
  68. package/src/index.ts +2 -0
  69. package/src/manifest.ts +113 -0
  70. package/src/schemas/embeds.ts +1 -1
  71. package/src/schemas/manifest.ts +33 -0
  72. package/src/schemas/shared.ts +36 -1
  73. package/src/types.ts +7 -0
  74. package/src/wallet/ethereum.ts +5 -1
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @farcaster/frame-core
2
+
3
+ Build onchain social apps
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @farcaster/core
9
+ ```
10
+
11
+ ## Documentation
12
+
13
+ For documentation and guides, visit [miniapps.farcaster.xyz](https://miniapps.farcaster.xyz).
@@ -0,0 +1,32 @@
1
+ export type Options<close extends boolean | undefined = undefined> = {
2
+ /**
3
+ * Suggested text for the body of the cast.
4
+ *
5
+ * Mentions can be included using the human-writeable form (e.g. @farcaster).
6
+ **/
7
+ text?: string;
8
+ /** Suggested embeds. Max two. */
9
+ embeds?: [] | [string] | [string, string];
10
+ /** Suggested parent. */
11
+ parent?: {
12
+ type: 'cast';
13
+ hash: string;
14
+ };
15
+ /** Whether the app should be closed when this action is called. */
16
+ close?: close;
17
+ };
18
+ export type Result<close extends boolean | undefined = undefined> = close extends true ? undefined : {
19
+ cast: {
20
+ /** Cast of the created cast */
21
+ hash: string;
22
+ /** Text of the created cast */
23
+ text?: string;
24
+ /** Embeds of the created cast */
25
+ embeds?: [] | [string] | [string, string];
26
+ /** Parent of the created cast */
27
+ parent?: {
28
+ type: 'cast';
29
+ hash: string;
30
+ };
31
+ };
32
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  export * as AddFrame from './AddFrame';
2
+ export * as ComposeCast from './ComposeCast';
2
3
  export * as Ready from './Ready';
3
4
  export * as SignIn from './SignIn';
4
5
  export * as Swap from './Swap';
@@ -33,8 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ViewToken = exports.ViewProfile = exports.Swap = exports.SignIn = exports.Ready = exports.AddFrame = void 0;
36
+ exports.ViewToken = exports.ViewProfile = exports.Swap = exports.SignIn = exports.Ready = exports.ComposeCast = exports.AddFrame = void 0;
37
37
  exports.AddFrame = __importStar(require("./AddFrame"));
38
+ exports.ComposeCast = __importStar(require("./ComposeCast"));
38
39
  exports.Ready = __importStar(require("./Ready"));
39
40
  exports.SignIn = __importStar(require("./SignIn"));
40
41
  exports.Swap = __importStar(require("./Swap"));
package/dist/errors.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ export type GlobalErrorType<name extends string = 'Error'> = Error & {
2
+ name: name;
3
+ };
1
4
  export declare class BaseError<cause extends Error | undefined = undefined> extends Error {
2
5
  name: string;
3
6
  cause: cause;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './actions';
2
2
  export * from './wallet';
3
+ export * as Errors from './errors';
3
4
  export * as Context from './context';
5
+ export * as Manifest from './manifest';
4
6
  export * from './types';
5
7
  export * from './schemas';
package/dist/index.js CHANGED
@@ -36,9 +36,11 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Context = void 0;
39
+ exports.Manifest = exports.Context = exports.Errors = void 0;
40
40
  __exportStar(require("./actions"), exports);
41
41
  __exportStar(require("./wallet"), exports);
42
+ exports.Errors = __importStar(require("./errors"));
42
43
  exports.Context = __importStar(require("./context"));
44
+ exports.Manifest = __importStar(require("./manifest"));
43
45
  __exportStar(require("./types"), exports);
44
46
  __exportStar(require("./schemas"), exports);
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Farcaster manifest for a domain hosted at `/.well-known/farcaster.json`
3
+ */
4
+ export type Manifest = {
5
+ accountAssociation: AccountAssociation;
6
+ frame: FrameConfig;
7
+ };
8
+ /**
9
+ * Signed domain association linking this frame to a Farcaster account
10
+ *
11
+ * A DomainAssociation can be generated using the {@link https://warpcast.com/~/developers/domains | Warpcast
12
+ * Domains Developer} tool.
13
+ */
14
+ export type AccountAssociation = {
15
+ /**
16
+ * Base64URL encoded JFS signature
17
+ */
18
+ header: string;
19
+ /**
20
+ * Base64URL encoded payload signature
21
+ */
22
+ payload: string;
23
+ /**
24
+ * Base64URL encoded signature
25
+ */
26
+ signature: string;
27
+ };
28
+ /**
29
+ * Frame configuration
30
+ *
31
+ * @example
32
+ * ``ts
33
+ * const frame: FrameConfig = {
34
+ * version: '1',
35
+ * name: 'Yoink!',
36
+ * homeUrl: 'https://yoink.party',
37
+ * iconUrl: 'https://yoink.party/img/icon.png',
38
+ * imageUrl: 'https://yoink.party/framesV2/opengraph-image',
39
+ * buttonTitle: '🚩 Start',
40
+ * splashImageUrl: 'https://yoink.party/img/splash.png',
41
+ * splashImageBackgroundColor: '#eeeee4',
42
+ * webhookUrl: 'https://yoink.party/webhook'
43
+ * };
44
+ * ``
45
+ */
46
+ export type FrameConfig = {
47
+ /**
48
+ * Manifest version
49
+ *
50
+ * Must be the literal '1'.
51
+ */
52
+ version: '1';
53
+ /**
54
+ * App name that will be displayed to users
55
+ *
56
+ * Max length of 32 characters.
57
+ */
58
+ name: string;
59
+ /**
60
+ * Default launch URL
61
+ *
62
+ * Max length of 1024 characters.
63
+ */
64
+ homeUrl: string;
65
+ /**
66
+ * Icon URL
67
+ *
68
+ * Max length of 1024 characters. Image must be 200x200px and less than 1MB.
69
+ */
70
+ iconUrl: string;
71
+ /**
72
+ * Image URL
73
+ *
74
+ * Max length of 1024 characters. Image must have a 3:2 ratio.
75
+ */
76
+ imageUrl: string;
77
+ /**
78
+ * Default button title to use when frame is rendered.
79
+ *
80
+ * Max length of 32 characters.
81
+ */
82
+ buttonTitle: string;
83
+ /**
84
+ * Splash image URL
85
+ *
86
+ * Max length of 1024 characters. Image must be 200x200px and less than 1MB.
87
+ */
88
+ splashImageUrl?: string;
89
+ /**
90
+ * Splash background color
91
+ *
92
+ * Must be a hex color code.
93
+ */
94
+ splashBackgroundColor?: string;
95
+ /**
96
+ * URL to which clients will POST server events.
97
+ * Max length of 1024 characters.
98
+ * Required if the frame application uses notifications.
99
+ */
100
+ webhookUrl?: string;
101
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,19 +2,19 @@ import { z } from 'zod';
2
2
  export declare const actionLaunchFrameSchema: z.ZodObject<{
3
3
  type: z.ZodLiteral<"launch_frame">;
4
4
  name: z.ZodString;
5
- url: z.ZodString;
5
+ url: z.ZodOptional<z.ZodString>;
6
6
  splashImageUrl: z.ZodOptional<z.ZodString>;
7
7
  splashBackgroundColor: z.ZodOptional<z.ZodString>;
8
8
  }, "strip", z.ZodTypeAny, {
9
9
  type: "launch_frame";
10
10
  name: string;
11
- url: string;
11
+ url?: string | undefined;
12
12
  splashImageUrl?: string | undefined;
13
13
  splashBackgroundColor?: string | undefined;
14
14
  }, {
15
15
  type: "launch_frame";
16
16
  name: string;
17
- url: string;
17
+ url?: string | undefined;
18
18
  splashImageUrl?: string | undefined;
19
19
  splashBackgroundColor?: string | undefined;
20
20
  }>;
@@ -31,19 +31,19 @@ export declare const actionViewTokenSchema: z.ZodObject<{
31
31
  export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
32
32
  type: z.ZodLiteral<"launch_frame">;
33
33
  name: z.ZodString;
34
- url: z.ZodString;
34
+ url: z.ZodOptional<z.ZodString>;
35
35
  splashImageUrl: z.ZodOptional<z.ZodString>;
36
36
  splashBackgroundColor: z.ZodOptional<z.ZodString>;
37
37
  }, "strip", z.ZodTypeAny, {
38
38
  type: "launch_frame";
39
39
  name: string;
40
- url: string;
40
+ url?: string | undefined;
41
41
  splashImageUrl?: string | undefined;
42
42
  splashBackgroundColor?: string | undefined;
43
43
  }, {
44
44
  type: "launch_frame";
45
45
  name: string;
46
- url: string;
46
+ url?: string | undefined;
47
47
  splashImageUrl?: string | undefined;
48
48
  splashBackgroundColor?: string | undefined;
49
49
  }>, z.ZodObject<{
@@ -61,19 +61,19 @@ export declare const buttonSchema: z.ZodObject<{
61
61
  action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
62
62
  type: z.ZodLiteral<"launch_frame">;
63
63
  name: z.ZodString;
64
- url: z.ZodString;
64
+ url: z.ZodOptional<z.ZodString>;
65
65
  splashImageUrl: z.ZodOptional<z.ZodString>;
66
66
  splashBackgroundColor: z.ZodOptional<z.ZodString>;
67
67
  }, "strip", z.ZodTypeAny, {
68
68
  type: "launch_frame";
69
69
  name: string;
70
- url: string;
70
+ url?: string | undefined;
71
71
  splashImageUrl?: string | undefined;
72
72
  splashBackgroundColor?: string | undefined;
73
73
  }, {
74
74
  type: "launch_frame";
75
75
  name: string;
76
- url: string;
76
+ url?: string | undefined;
77
77
  splashImageUrl?: string | undefined;
78
78
  splashBackgroundColor?: string | undefined;
79
79
  }>, z.ZodObject<{
@@ -91,7 +91,7 @@ export declare const buttonSchema: z.ZodObject<{
91
91
  action: {
92
92
  type: "launch_frame";
93
93
  name: string;
94
- url: string;
94
+ url?: string | undefined;
95
95
  splashImageUrl?: string | undefined;
96
96
  splashBackgroundColor?: string | undefined;
97
97
  } | {
@@ -103,7 +103,7 @@ export declare const buttonSchema: z.ZodObject<{
103
103
  action: {
104
104
  type: "launch_frame";
105
105
  name: string;
106
- url: string;
106
+ url?: string | undefined;
107
107
  splashImageUrl?: string | undefined;
108
108
  splashBackgroundColor?: string | undefined;
109
109
  } | {
@@ -120,19 +120,19 @@ export declare const frameEmbedNextSchema: z.ZodObject<{
120
120
  action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
121
121
  type: z.ZodLiteral<"launch_frame">;
122
122
  name: z.ZodString;
123
- url: z.ZodString;
123
+ url: z.ZodOptional<z.ZodString>;
124
124
  splashImageUrl: z.ZodOptional<z.ZodString>;
125
125
  splashBackgroundColor: z.ZodOptional<z.ZodString>;
126
126
  }, "strip", z.ZodTypeAny, {
127
127
  type: "launch_frame";
128
128
  name: string;
129
- url: string;
129
+ url?: string | undefined;
130
130
  splashImageUrl?: string | undefined;
131
131
  splashBackgroundColor?: string | undefined;
132
132
  }, {
133
133
  type: "launch_frame";
134
134
  name: string;
135
- url: string;
135
+ url?: string | undefined;
136
136
  splashImageUrl?: string | undefined;
137
137
  splashBackgroundColor?: string | undefined;
138
138
  }>, z.ZodObject<{
@@ -150,7 +150,7 @@ export declare const frameEmbedNextSchema: z.ZodObject<{
150
150
  action: {
151
151
  type: "launch_frame";
152
152
  name: string;
153
- url: string;
153
+ url?: string | undefined;
154
154
  splashImageUrl?: string | undefined;
155
155
  splashBackgroundColor?: string | undefined;
156
156
  } | {
@@ -162,7 +162,7 @@ export declare const frameEmbedNextSchema: z.ZodObject<{
162
162
  action: {
163
163
  type: "launch_frame";
164
164
  name: string;
165
- url: string;
165
+ url?: string | undefined;
166
166
  splashImageUrl?: string | undefined;
167
167
  splashBackgroundColor?: string | undefined;
168
168
  } | {
@@ -178,7 +178,7 @@ export declare const frameEmbedNextSchema: z.ZodObject<{
178
178
  action: {
179
179
  type: "launch_frame";
180
180
  name: string;
181
- url: string;
181
+ url?: string | undefined;
182
182
  splashImageUrl?: string | undefined;
183
183
  splashBackgroundColor?: string | undefined;
184
184
  } | {
@@ -195,7 +195,7 @@ export declare const frameEmbedNextSchema: z.ZodObject<{
195
195
  action: {
196
196
  type: "launch_frame";
197
197
  name: string;
198
- url: string;
198
+ url?: string | undefined;
199
199
  splashImageUrl?: string | undefined;
200
200
  splashBackgroundColor?: string | undefined;
201
201
  } | {
@@ -213,7 +213,7 @@ export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.SafeParseR
213
213
  action: {
214
214
  type: "launch_frame";
215
215
  name: string;
216
- url: string;
216
+ url?: string | undefined;
217
217
  splashImageUrl?: string | undefined;
218
218
  splashBackgroundColor?: string | undefined;
219
219
  } | {
@@ -230,7 +230,7 @@ export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.SafeParseR
230
230
  action: {
231
231
  type: "launch_frame";
232
232
  name: string;
233
- url: string;
233
+ url?: string | undefined;
234
234
  splashImageUrl?: string | undefined;
235
235
  splashBackgroundColor?: string | undefined;
236
236
  } | {
@@ -6,7 +6,7 @@ const shared_1 = require("./shared");
6
6
  exports.actionLaunchFrameSchema = zod_1.z.object({
7
7
  type: zod_1.z.literal('launch_frame'),
8
8
  name: shared_1.frameNameSchema,
9
- url: shared_1.secureUrlSchema,
9
+ url: shared_1.secureUrlSchema.optional(),
10
10
  splashImageUrl: shared_1.secureUrlSchema.optional(),
11
11
  splashBackgroundColor: shared_1.hexColorSchema.optional(),
12
12
  });
@@ -4,14 +4,27 @@ export declare const domainFrameConfigSchema: z.ZodObject<{
4
4
  name: z.ZodString;
5
5
  iconUrl: z.ZodString;
6
6
  homeUrl: z.ZodString;
7
+ /** deprecated, set ogImageUrl instead */
7
8
  imageUrl: z.ZodOptional<z.ZodString>;
9
+ /** deprecated, will rely on fc:frame meta tag */
8
10
  buttonTitle: z.ZodOptional<z.ZodString>;
9
11
  splashImageUrl: z.ZodOptional<z.ZodString>;
10
12
  splashBackgroundColor: z.ZodOptional<z.ZodString>;
11
13
  webhookUrl: z.ZodOptional<z.ZodString>;
14
+ /** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
15
+ subtitle: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
16
+ description: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
17
+ screenshotUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18
+ primaryCategory: z.ZodOptional<z.ZodEnum<["games", "social", "finance", "utility", "productivity", "health-fitness", "news-media", "music", "shopping", "education", "developer-tools", "entertainment", "art-creativity"]>>;
19
+ tags: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, "many">>;
20
+ heroImageUrl: z.ZodOptional<z.ZodString>;
21
+ tagline: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
22
+ ogTitle: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
23
+ ogDescription: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
24
+ ogImageUrl: z.ZodOptional<z.ZodString>;
12
25
  }, "strip", z.ZodTypeAny, {
13
26
  name: string;
14
- version: "next" | "0.0.0" | "0.0.1" | "1";
27
+ version: "next" | "1" | "0.0.0" | "0.0.1";
15
28
  iconUrl: string;
16
29
  homeUrl: string;
17
30
  splashImageUrl?: string | undefined;
@@ -19,9 +32,19 @@ export declare const domainFrameConfigSchema: z.ZodObject<{
19
32
  imageUrl?: string | undefined;
20
33
  buttonTitle?: string | undefined;
21
34
  webhookUrl?: string | undefined;
35
+ subtitle?: string | undefined;
36
+ description?: string | undefined;
37
+ screenshotUrls?: string[] | undefined;
38
+ primaryCategory?: "games" | "social" | "finance" | "utility" | "productivity" | "health-fitness" | "news-media" | "music" | "shopping" | "education" | "developer-tools" | "entertainment" | "art-creativity" | undefined;
39
+ tags?: string[] | undefined;
40
+ heroImageUrl?: string | undefined;
41
+ tagline?: string | undefined;
42
+ ogTitle?: string | undefined;
43
+ ogDescription?: string | undefined;
44
+ ogImageUrl?: string | undefined;
22
45
  }, {
23
46
  name: string;
24
- version: "next" | "0.0.0" | "0.0.1" | "1";
47
+ version: "next" | "1" | "0.0.0" | "0.0.1";
25
48
  iconUrl: string;
26
49
  homeUrl: string;
27
50
  splashImageUrl?: string | undefined;
@@ -29,6 +52,16 @@ export declare const domainFrameConfigSchema: z.ZodObject<{
29
52
  imageUrl?: string | undefined;
30
53
  buttonTitle?: string | undefined;
31
54
  webhookUrl?: string | undefined;
55
+ subtitle?: string | undefined;
56
+ description?: string | undefined;
57
+ screenshotUrls?: string[] | undefined;
58
+ primaryCategory?: "games" | "social" | "finance" | "utility" | "productivity" | "health-fitness" | "news-media" | "music" | "shopping" | "education" | "developer-tools" | "entertainment" | "art-creativity" | undefined;
59
+ tags?: string[] | undefined;
60
+ heroImageUrl?: string | undefined;
61
+ tagline?: string | undefined;
62
+ ogTitle?: string | undefined;
63
+ ogDescription?: string | undefined;
64
+ ogImageUrl?: string | undefined;
32
65
  }>;
33
66
  export declare const domainManifestSchema: z.ZodObject<{
34
67
  accountAssociation: z.ZodObject<{
@@ -49,14 +82,27 @@ export declare const domainManifestSchema: z.ZodObject<{
49
82
  name: z.ZodString;
50
83
  iconUrl: z.ZodString;
51
84
  homeUrl: z.ZodString;
85
+ /** deprecated, set ogImageUrl instead */
52
86
  imageUrl: z.ZodOptional<z.ZodString>;
87
+ /** deprecated, will rely on fc:frame meta tag */
53
88
  buttonTitle: z.ZodOptional<z.ZodString>;
54
89
  splashImageUrl: z.ZodOptional<z.ZodString>;
55
90
  splashBackgroundColor: z.ZodOptional<z.ZodString>;
56
91
  webhookUrl: z.ZodOptional<z.ZodString>;
92
+ /** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
93
+ subtitle: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
94
+ description: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
95
+ screenshotUrls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
96
+ primaryCategory: z.ZodOptional<z.ZodEnum<["games", "social", "finance", "utility", "productivity", "health-fitness", "news-media", "music", "shopping", "education", "developer-tools", "entertainment", "art-creativity"]>>;
97
+ tags: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, "many">>;
98
+ heroImageUrl: z.ZodOptional<z.ZodString>;
99
+ tagline: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
100
+ ogTitle: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
101
+ ogDescription: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>;
102
+ ogImageUrl: z.ZodOptional<z.ZodString>;
57
103
  }, "strip", z.ZodTypeAny, {
58
104
  name: string;
59
- version: "next" | "0.0.0" | "0.0.1" | "1";
105
+ version: "next" | "1" | "0.0.0" | "0.0.1";
60
106
  iconUrl: string;
61
107
  homeUrl: string;
62
108
  splashImageUrl?: string | undefined;
@@ -64,9 +110,19 @@ export declare const domainManifestSchema: z.ZodObject<{
64
110
  imageUrl?: string | undefined;
65
111
  buttonTitle?: string | undefined;
66
112
  webhookUrl?: string | undefined;
113
+ subtitle?: string | undefined;
114
+ description?: string | undefined;
115
+ screenshotUrls?: string[] | undefined;
116
+ primaryCategory?: "games" | "social" | "finance" | "utility" | "productivity" | "health-fitness" | "news-media" | "music" | "shopping" | "education" | "developer-tools" | "entertainment" | "art-creativity" | undefined;
117
+ tags?: string[] | undefined;
118
+ heroImageUrl?: string | undefined;
119
+ tagline?: string | undefined;
120
+ ogTitle?: string | undefined;
121
+ ogDescription?: string | undefined;
122
+ ogImageUrl?: string | undefined;
67
123
  }, {
68
124
  name: string;
69
- version: "next" | "0.0.0" | "0.0.1" | "1";
125
+ version: "next" | "1" | "0.0.0" | "0.0.1";
70
126
  iconUrl: string;
71
127
  homeUrl: string;
72
128
  splashImageUrl?: string | undefined;
@@ -74,6 +130,16 @@ export declare const domainManifestSchema: z.ZodObject<{
74
130
  imageUrl?: string | undefined;
75
131
  buttonTitle?: string | undefined;
76
132
  webhookUrl?: string | undefined;
133
+ subtitle?: string | undefined;
134
+ description?: string | undefined;
135
+ screenshotUrls?: string[] | undefined;
136
+ primaryCategory?: "games" | "social" | "finance" | "utility" | "productivity" | "health-fitness" | "news-media" | "music" | "shopping" | "education" | "developer-tools" | "entertainment" | "art-creativity" | undefined;
137
+ tags?: string[] | undefined;
138
+ heroImageUrl?: string | undefined;
139
+ tagline?: string | undefined;
140
+ ogTitle?: string | undefined;
141
+ ogDescription?: string | undefined;
142
+ ogImageUrl?: string | undefined;
77
143
  }>>;
78
144
  }, "strip", z.ZodTypeAny, {
79
145
  accountAssociation: {
@@ -83,7 +149,7 @@ export declare const domainManifestSchema: z.ZodObject<{
83
149
  };
84
150
  frame?: {
85
151
  name: string;
86
- version: "next" | "0.0.0" | "0.0.1" | "1";
152
+ version: "next" | "1" | "0.0.0" | "0.0.1";
87
153
  iconUrl: string;
88
154
  homeUrl: string;
89
155
  splashImageUrl?: string | undefined;
@@ -91,6 +157,16 @@ export declare const domainManifestSchema: z.ZodObject<{
91
157
  imageUrl?: string | undefined;
92
158
  buttonTitle?: string | undefined;
93
159
  webhookUrl?: string | undefined;
160
+ subtitle?: string | undefined;
161
+ description?: string | undefined;
162
+ screenshotUrls?: string[] | undefined;
163
+ primaryCategory?: "games" | "social" | "finance" | "utility" | "productivity" | "health-fitness" | "news-media" | "music" | "shopping" | "education" | "developer-tools" | "entertainment" | "art-creativity" | undefined;
164
+ tags?: string[] | undefined;
165
+ heroImageUrl?: string | undefined;
166
+ tagline?: string | undefined;
167
+ ogTitle?: string | undefined;
168
+ ogDescription?: string | undefined;
169
+ ogImageUrl?: string | undefined;
94
170
  } | undefined;
95
171
  }, {
96
172
  accountAssociation: {
@@ -100,7 +176,7 @@ export declare const domainManifestSchema: z.ZodObject<{
100
176
  };
101
177
  frame?: {
102
178
  name: string;
103
- version: "next" | "0.0.0" | "0.0.1" | "1";
179
+ version: "next" | "1" | "0.0.0" | "0.0.1";
104
180
  iconUrl: string;
105
181
  homeUrl: string;
106
182
  splashImageUrl?: string | undefined;
@@ -108,5 +184,15 @@ export declare const domainManifestSchema: z.ZodObject<{
108
184
  imageUrl?: string | undefined;
109
185
  buttonTitle?: string | undefined;
110
186
  webhookUrl?: string | undefined;
187
+ subtitle?: string | undefined;
188
+ description?: string | undefined;
189
+ screenshotUrls?: string[] | undefined;
190
+ primaryCategory?: "games" | "social" | "finance" | "utility" | "productivity" | "health-fitness" | "news-media" | "music" | "shopping" | "education" | "developer-tools" | "entertainment" | "art-creativity" | undefined;
191
+ tags?: string[] | undefined;
192
+ heroImageUrl?: string | undefined;
193
+ tagline?: string | undefined;
194
+ ogTitle?: string | undefined;
195
+ ogDescription?: string | undefined;
196
+ ogImageUrl?: string | undefined;
111
197
  } | undefined;
112
198
  }>;
@@ -3,6 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.domainManifestSchema = exports.domainFrameConfigSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const shared_1 = require("./shared");
6
+ const primaryCategorySchema = zod_1.z.enum([
7
+ 'games',
8
+ 'social',
9
+ 'finance',
10
+ 'utility',
11
+ 'productivity',
12
+ 'health-fitness',
13
+ 'news-media',
14
+ 'music',
15
+ 'shopping',
16
+ 'education',
17
+ 'developer-tools',
18
+ 'entertainment',
19
+ 'art-creativity',
20
+ ]);
6
21
  exports.domainFrameConfigSchema = zod_1.z.object({
7
22
  // 0.0.0 and 0.0.1 are not technically part of the spec but kept for
8
23
  // backwards compatibilty. next should always resolve to the most recent
@@ -16,11 +31,27 @@ exports.domainFrameConfigSchema = zod_1.z.object({
16
31
  name: shared_1.frameNameSchema,
17
32
  iconUrl: shared_1.secureUrlSchema,
18
33
  homeUrl: shared_1.secureUrlSchema,
34
+ /** deprecated, set ogImageUrl instead */
19
35
  imageUrl: shared_1.secureUrlSchema.optional(),
36
+ /** deprecated, will rely on fc:frame meta tag */
20
37
  buttonTitle: shared_1.buttonTitleSchema.optional(),
21
38
  splashImageUrl: shared_1.secureUrlSchema.optional(),
22
39
  splashBackgroundColor: shared_1.hexColorSchema.optional(),
23
40
  webhookUrl: shared_1.secureUrlSchema.optional(),
41
+ /** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
42
+ subtitle: (0, shared_1.createSimpleStringSchema)({ max: 30 }).optional(),
43
+ description: (0, shared_1.createSimpleStringSchema)({ max: 170 }).optional(),
44
+ screenshotUrls: zod_1.z.array(shared_1.secureUrlSchema).max(3).optional(),
45
+ primaryCategory: primaryCategorySchema.optional(),
46
+ tags: zod_1.z
47
+ .array((0, shared_1.createSimpleStringSchema)({ max: 20, noSpaces: true }))
48
+ .max(5)
49
+ .optional(),
50
+ heroImageUrl: shared_1.secureUrlSchema.optional(),
51
+ tagline: (0, shared_1.createSimpleStringSchema)({ max: 30 }).optional(),
52
+ ogTitle: (0, shared_1.createSimpleStringSchema)({ max: 30 }).optional(),
53
+ ogDescription: (0, shared_1.createSimpleStringSchema)({ max: 100 }).optional(),
54
+ ogImageUrl: shared_1.secureUrlSchema.optional(),
24
55
  });
25
56
  exports.domainManifestSchema = zod_1.z.object({
26
57
  accountAssociation: shared_1.encodedJsonFarcasterSignatureSchema,
@@ -1,4 +1,8 @@
1
1
  import { z } from 'zod';
2
+ export declare const createSimpleStringSchema: ({ max, noSpaces, }?: {
3
+ max?: number;
4
+ noSpaces?: boolean;
5
+ }) => z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
2
6
  export declare const secureUrlSchema: z.ZodString;
3
7
  export declare const frameNameSchema: z.ZodString;
4
8
  export declare const buttonTitleSchema: z.ZodString;
@@ -1,12 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsonFarcasterSignatureHeaderSchema = exports.encodedJsonFarcasterSignatureSchema = exports.aspectRatioSchema = exports.hexColorSchema = exports.caip19TokenSchema = exports.buttonTitleSchema = exports.frameNameSchema = exports.secureUrlSchema = void 0;
3
+ exports.jsonFarcasterSignatureHeaderSchema = exports.encodedJsonFarcasterSignatureSchema = exports.aspectRatioSchema = exports.hexColorSchema = exports.caip19TokenSchema = exports.buttonTitleSchema = exports.frameNameSchema = exports.secureUrlSchema = exports.createSimpleStringSchema = void 0;
4
4
  const zod_1 = require("zod");
5
+ const SPECIAL_CHARS_PATTERN = /[@#$%^&*+=\/\\|~«»]/;
6
+ const REPEATED_PUNCTUATION_PATTERN = /(!{2,}|\?{2,}|-{2,})/;
7
+ // Unicode ranges for emoji detection:
8
+ // \u{1F300}-\u{1F9FF} - Miscellaneous Symbols, Pictographs, Emoticons, Transport, Map, and Supplemental
9
+ // \u{2702}-\u{27B0} - Dingbats
10
+ // \u{2600}-\u{26FF} - Miscellaneous Symbols
11
+ // \u{2B00}-\u{2BFF} - Miscellaneous Symbols and Arrows
12
+ const EMOJI_PATTERN = /[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u;
13
+ const createSimpleStringSchema = ({ max, noSpaces, } = {}) => {
14
+ const stringValidations = noSpaces
15
+ ? zod_1.z
16
+ .string()
17
+ .max(max ?? Number.POSITIVE_INFINITY)
18
+ .regex(/^\S*$/, 'Spaces are not allowed')
19
+ : zod_1.z.string().max(max ?? Number.POSITIVE_INFINITY);
20
+ return stringValidations
21
+ .refine((value) => !EMOJI_PATTERN.test(value), {
22
+ message: 'Emojis and symbols are not allowed',
23
+ })
24
+ .refine((value) => !SPECIAL_CHARS_PATTERN.test(value), {
25
+ message: 'Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed',
26
+ })
27
+ .refine((value) => !REPEATED_PUNCTUATION_PATTERN.test(value), {
28
+ message: 'Repeated punctuations (!!, ??, --) are not allowed',
29
+ });
30
+ };
31
+ exports.createSimpleStringSchema = createSimpleStringSchema;
5
32
  exports.secureUrlSchema = zod_1.z
6
33
  .string()
7
34
  .url()
8
35
  .startsWith('https://', { message: 'Must be an https url' })
9
- .max(512);
36
+ .max(1024);
10
37
  exports.frameNameSchema = zod_1.z.string().max(32);
11
38
  exports.buttonTitleSchema = zod_1.z.string().max(32);
12
39
  const CAIP_19_REGEX = /^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/;