@farcaster/frame-core 0.0.0-canary-20250630194123 → 0.0.0-canary-20250630212526
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.
- package/dist/index.d.ts +153 -10
- package/dist/index.js +18 -33
- package/esm/index.d.ts +153 -10
- package/esm/index.js +17 -10
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -7
- package/src/index.ts +50 -10
- package/dist/actions/AddMiniApp.d.ts +0 -36
- package/dist/actions/AddMiniApp.js +0 -57
- package/dist/actions/ComposeCast.d.ts +0 -37
- package/dist/actions/ComposeCast.js +0 -2
- package/dist/actions/Haptics.d.ts +0 -5
- package/dist/actions/Haptics.js +0 -2
- package/dist/actions/Ready.d.ts +0 -13
- package/dist/actions/Ready.js +0 -6
- package/dist/actions/SendToken.d.ts +0 -48
- package/dist/actions/SendToken.js +0 -2
- package/dist/actions/SignIn.d.ts +0 -55
- package/dist/actions/SignIn.js +0 -47
- package/dist/actions/SwapToken.d.ts +0 -46
- package/dist/actions/SwapToken.js +0 -2
- package/dist/actions/ViewCast.d.ts +0 -25
- package/dist/actions/ViewCast.js +0 -2
- package/dist/actions/ViewProfile.d.ts +0 -4
- package/dist/actions/ViewProfile.js +0 -2
- package/dist/actions/ViewToken.d.ts +0 -4
- package/dist/actions/ViewToken.js +0 -2
- package/dist/actions/index.d.ts +0 -10
- package/dist/actions/index.js +0 -46
- package/dist/back.d.ts +0 -13
- package/dist/back.js +0 -6
- package/dist/context.d.ts +0 -94
- package/dist/context.js +0 -2
- package/dist/errors.d.ts +0 -13
- package/dist/errors.js +0 -12
- package/dist/internal/types.d.ts +0 -8
- package/dist/internal/types.js +0 -2
- package/dist/manifest.d.ts +0 -107
- package/dist/manifest.js +0 -2
- package/dist/schemas/embeds.d.ts +0 -72
- package/dist/schemas/embeds.js +0 -32
- package/dist/schemas/events.d.ts +0 -43
- package/dist/schemas/events.js +0 -25
- package/dist/schemas/index.d.ts +0 -5
- package/dist/schemas/index.js +0 -21
- package/dist/schemas/manifest.d.ts +0 -160
- package/dist/schemas/manifest.js +0 -114
- package/dist/schemas/notifications.d.ts +0 -22
- package/dist/schemas/notifications.js +0 -23
- package/dist/schemas/shared.d.ts +0 -24
- package/dist/schemas/shared.js +0 -110
- package/dist/solana.d.ts +0 -72
- package/dist/solana.js +0 -15
- package/dist/solanaWire.d.ts +0 -3
- package/dist/solanaWire.js +0 -84
- package/dist/types.d.ts +0 -87
- package/dist/types.js +0 -41
- package/dist/wallet/ethereum.d.ts +0 -47
- package/dist/wallet/ethereum.js +0 -2
- package/dist/wallet/index.d.ts +0 -1
- package/dist/wallet/index.js +0 -37
- package/esm/actions/AddMiniApp.d.ts +0 -36
- package/esm/actions/AddMiniApp.js +0 -19
- package/esm/actions/ComposeCast.d.ts +0 -37
- package/esm/actions/ComposeCast.js +0 -1
- package/esm/actions/Haptics.d.ts +0 -5
- package/esm/actions/Haptics.js +0 -1
- package/esm/actions/Ready.d.ts +0 -13
- package/esm/actions/Ready.js +0 -3
- package/esm/actions/SendToken.d.ts +0 -48
- package/esm/actions/SendToken.js +0 -1
- package/esm/actions/SignIn.d.ts +0 -55
- package/esm/actions/SignIn.js +0 -10
- package/esm/actions/SwapToken.d.ts +0 -46
- package/esm/actions/SwapToken.js +0 -1
- package/esm/actions/ViewCast.d.ts +0 -25
- package/esm/actions/ViewCast.js +0 -1
- package/esm/actions/ViewProfile.d.ts +0 -4
- package/esm/actions/ViewProfile.js +0 -1
- package/esm/actions/ViewToken.d.ts +0 -4
- package/esm/actions/ViewToken.js +0 -1
- package/esm/actions/index.d.ts +0 -10
- package/esm/actions/index.js +0 -10
- package/esm/back.d.ts +0 -13
- package/esm/back.js +0 -3
- package/esm/context.d.ts +0 -94
- package/esm/context.js +0 -1
- package/esm/errors.d.ts +0 -13
- package/esm/errors.js +0 -8
- package/esm/internal/types.d.ts +0 -8
- package/esm/internal/types.js +0 -1
- package/esm/manifest.d.ts +0 -107
- package/esm/manifest.js +0 -1
- package/esm/schemas/embeds.d.ts +0 -72
- package/esm/schemas/embeds.js +0 -28
- package/esm/schemas/events.d.ts +0 -43
- package/esm/schemas/events.js +0 -22
- package/esm/schemas/index.d.ts +0 -5
- package/esm/schemas/index.js +0 -5
- package/esm/schemas/manifest.d.ts +0 -160
- package/esm/schemas/manifest.js +0 -111
- package/esm/schemas/notifications.d.ts +0 -22
- package/esm/schemas/notifications.js +0 -20
- package/esm/schemas/shared.d.ts +0 -24
- package/esm/schemas/shared.js +0 -106
- package/esm/solana.d.ts +0 -72
- package/esm/solana.js +0 -11
- package/esm/solanaWire.d.ts +0 -3
- package/esm/solanaWire.js +0 -80
- package/esm/types.d.ts +0 -87
- package/esm/types.js +0 -23
- package/esm/wallet/ethereum.d.ts +0 -47
- package/esm/wallet/ethereum.js +0 -1
- package/esm/wallet/index.d.ts +0 -1
- package/esm/wallet/index.js +0 -1
- package/src/actions/AddMiniApp.ts +0 -51
- package/src/actions/ComposeCast.ts +0 -44
- package/src/actions/Haptics.ts +0 -9
- package/src/actions/Ready.ts +0 -15
- package/src/actions/SendToken.ts +0 -57
- package/src/actions/SignIn.ts +0 -67
- package/src/actions/SwapToken.ts +0 -54
- package/src/actions/ViewCast.ts +0 -27
- package/src/actions/ViewProfile.ts +0 -5
- package/src/actions/ViewToken.ts +0 -5
- package/src/actions/index.ts +0 -10
- package/src/back.ts +0 -15
- package/src/context.ts +0 -117
- package/src/errors.ts +0 -21
- package/src/internal/types.ts +0 -20
- package/src/manifest.ts +0 -120
- package/src/schemas/embeds.ts +0 -44
- package/src/schemas/events.ts +0 -41
- package/src/schemas/index.ts +0 -5
- package/src/schemas/manifest.ts +0 -125
- package/src/schemas/notifications.ts +0 -33
- package/src/schemas/shared.ts +0 -138
- package/src/solana.ts +0 -108
- package/src/solanaWire.ts +0 -120
- package/src/types.ts +0 -155
- package/src/wallet/ethereum.ts +0 -65
- package/src/wallet/index.ts +0 -1
package/esm/schemas/embeds.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
export declare const actionLaunchFrameSchema: z.ZodObject<{
|
|
3
|
-
type: z.ZodLiteral<"launch_frame">;
|
|
4
|
-
name: z.ZodString;
|
|
5
|
-
url: z.ZodOptional<z.ZodString>;
|
|
6
|
-
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
7
|
-
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
export declare const actionViewTokenSchema: z.ZodObject<{
|
|
10
|
-
type: z.ZodLiteral<"view_token">;
|
|
11
|
-
token: z.ZodString;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export declare const actionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
-
type: z.ZodLiteral<"launch_frame">;
|
|
15
|
-
name: z.ZodString;
|
|
16
|
-
url: z.ZodOptional<z.ZodString>;
|
|
17
|
-
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
18
|
-
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
-
type: z.ZodLiteral<"view_token">;
|
|
21
|
-
token: z.ZodString;
|
|
22
|
-
}, z.core.$strip>]>;
|
|
23
|
-
export declare const buttonSchema: z.ZodObject<{
|
|
24
|
-
title: z.ZodString;
|
|
25
|
-
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
|
-
type: z.ZodLiteral<"launch_frame">;
|
|
27
|
-
name: z.ZodString;
|
|
28
|
-
url: z.ZodOptional<z.ZodString>;
|
|
29
|
-
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
30
|
-
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
31
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
-
type: z.ZodLiteral<"view_token">;
|
|
33
|
-
token: z.ZodString;
|
|
34
|
-
}, z.core.$strip>]>;
|
|
35
|
-
}, z.core.$strip>;
|
|
36
|
-
export declare const frameEmbedNextSchema: z.ZodObject<{
|
|
37
|
-
version: z.ZodLiteral<"next">;
|
|
38
|
-
imageUrl: z.ZodString;
|
|
39
|
-
aspectRatio: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"1:1">, z.ZodLiteral<"3:2">]>>;
|
|
40
|
-
button: z.ZodObject<{
|
|
41
|
-
title: z.ZodString;
|
|
42
|
-
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
|
-
type: z.ZodLiteral<"launch_frame">;
|
|
44
|
-
name: z.ZodString;
|
|
45
|
-
url: z.ZodOptional<z.ZodString>;
|
|
46
|
-
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
47
|
-
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
48
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
-
type: z.ZodLiteral<"view_token">;
|
|
50
|
-
token: z.ZodString;
|
|
51
|
-
}, z.core.$strip>]>;
|
|
52
|
-
}, z.core.$strip>;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.ZodSafeParseResult<{
|
|
55
|
-
version: "next";
|
|
56
|
-
imageUrl: string;
|
|
57
|
-
button: {
|
|
58
|
-
title: string;
|
|
59
|
-
action: {
|
|
60
|
-
type: "launch_frame";
|
|
61
|
-
name: string;
|
|
62
|
-
url?: string | undefined;
|
|
63
|
-
splashImageUrl?: string | undefined;
|
|
64
|
-
splashBackgroundColor?: string | undefined;
|
|
65
|
-
} | {
|
|
66
|
-
type: "view_token";
|
|
67
|
-
token: string;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
aspectRatio?: "1:1" | "3:2" | undefined;
|
|
71
|
-
}>;
|
|
72
|
-
export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>;
|
package/esm/schemas/embeds.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { aspectRatioSchema, buttonTitleSchema, caip19TokenSchema, frameNameSchema, hexColorSchema, secureUrlSchema, } from "./shared.js";
|
|
3
|
-
export const actionLaunchFrameSchema = z.object({
|
|
4
|
-
type: z.literal('launch_frame'),
|
|
5
|
-
name: frameNameSchema,
|
|
6
|
-
url: secureUrlSchema.optional(),
|
|
7
|
-
splashImageUrl: secureUrlSchema.optional(),
|
|
8
|
-
splashBackgroundColor: hexColorSchema.optional(),
|
|
9
|
-
});
|
|
10
|
-
export const actionViewTokenSchema = z.object({
|
|
11
|
-
type: z.literal('view_token'),
|
|
12
|
-
token: caip19TokenSchema,
|
|
13
|
-
});
|
|
14
|
-
export const actionSchema = z.discriminatedUnion('type', [
|
|
15
|
-
actionLaunchFrameSchema,
|
|
16
|
-
actionViewTokenSchema,
|
|
17
|
-
]);
|
|
18
|
-
export const buttonSchema = z.object({
|
|
19
|
-
title: buttonTitleSchema,
|
|
20
|
-
action: actionSchema,
|
|
21
|
-
});
|
|
22
|
-
export const frameEmbedNextSchema = z.object({
|
|
23
|
-
version: z.literal('next'),
|
|
24
|
-
imageUrl: secureUrlSchema,
|
|
25
|
-
aspectRatio: aspectRatioSchema.optional(),
|
|
26
|
-
button: buttonSchema,
|
|
27
|
-
});
|
|
28
|
-
export const safeParseFrameEmbed = (rawResponse) => frameEmbedNextSchema.safeParse(rawResponse);
|
package/esm/schemas/events.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
export declare const eventFrameAddedSchema: z.ZodObject<{
|
|
3
|
-
event: z.ZodLiteral<"frame_added">;
|
|
4
|
-
notificationDetails: z.ZodOptional<z.ZodObject<{
|
|
5
|
-
url: z.ZodString;
|
|
6
|
-
token: z.ZodString;
|
|
7
|
-
}, z.core.$strip>>;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
|
-
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
|
|
10
|
-
export declare const eventFrameRemovedSchema: z.ZodObject<{
|
|
11
|
-
event: z.ZodLiteral<"frame_removed">;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
|
|
14
|
-
export declare const eventNotificationsEnabledSchema: z.ZodObject<{
|
|
15
|
-
event: z.ZodLiteral<"notifications_enabled">;
|
|
16
|
-
notificationDetails: z.ZodObject<{
|
|
17
|
-
url: z.ZodNonOptional<z.ZodString>;
|
|
18
|
-
token: z.ZodNonOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>;
|
|
22
|
-
export declare const notificationsDisabledSchema: z.ZodObject<{
|
|
23
|
-
event: z.ZodLiteral<"notifications_disabled">;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>;
|
|
26
|
-
export declare const serverEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
-
event: z.ZodLiteral<"frame_added">;
|
|
28
|
-
notificationDetails: z.ZodOptional<z.ZodObject<{
|
|
29
|
-
url: z.ZodString;
|
|
30
|
-
token: z.ZodString;
|
|
31
|
-
}, z.core.$strip>>;
|
|
32
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
-
event: z.ZodLiteral<"frame_removed">;
|
|
34
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
-
event: z.ZodLiteral<"notifications_enabled">;
|
|
36
|
-
notificationDetails: z.ZodObject<{
|
|
37
|
-
url: z.ZodNonOptional<z.ZodString>;
|
|
38
|
-
token: z.ZodNonOptional<z.ZodString>;
|
|
39
|
-
}, z.core.$strip>;
|
|
40
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
-
event: z.ZodLiteral<"notifications_disabled">;
|
|
42
|
-
}, z.core.$strip>]>;
|
|
43
|
-
export type FrameServerEvent = z.infer<typeof serverEventSchema>;
|
package/esm/schemas/events.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { notificationDetailsSchema } from "./notifications.js";
|
|
3
|
-
export const eventFrameAddedSchema = z.object({
|
|
4
|
-
event: z.literal('frame_added'),
|
|
5
|
-
notificationDetails: notificationDetailsSchema.optional(),
|
|
6
|
-
});
|
|
7
|
-
export const eventFrameRemovedSchema = z.object({
|
|
8
|
-
event: z.literal('frame_removed'),
|
|
9
|
-
});
|
|
10
|
-
export const eventNotificationsEnabledSchema = z.object({
|
|
11
|
-
event: z.literal('notifications_enabled'),
|
|
12
|
-
notificationDetails: notificationDetailsSchema.required(),
|
|
13
|
-
});
|
|
14
|
-
export const notificationsDisabledSchema = z.object({
|
|
15
|
-
event: z.literal('notifications_disabled'),
|
|
16
|
-
});
|
|
17
|
-
export const serverEventSchema = z.discriminatedUnion('event', [
|
|
18
|
-
eventFrameAddedSchema,
|
|
19
|
-
eventFrameRemovedSchema,
|
|
20
|
-
eventNotificationsEnabledSchema,
|
|
21
|
-
notificationsDisabledSchema,
|
|
22
|
-
]);
|
package/esm/schemas/index.d.ts
DELETED
package/esm/schemas/index.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
export declare const domainFrameConfigSchema: z.ZodObject<{
|
|
3
|
-
version: z.ZodUnion<readonly [z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;
|
|
4
|
-
name: z.ZodString;
|
|
5
|
-
iconUrl: z.ZodString;
|
|
6
|
-
homeUrl: z.ZodString;
|
|
7
|
-
imageUrl: z.ZodOptional<z.ZodString>;
|
|
8
|
-
buttonTitle: z.ZodOptional<z.ZodString>;
|
|
9
|
-
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
10
|
-
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
11
|
-
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
12
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
13
|
-
description: z.ZodOptional<z.ZodString>;
|
|
14
|
-
screenshotUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
-
primaryCategory: z.ZodOptional<z.ZodEnum<{
|
|
16
|
-
games: "games";
|
|
17
|
-
social: "social";
|
|
18
|
-
finance: "finance";
|
|
19
|
-
utility: "utility";
|
|
20
|
-
productivity: "productivity";
|
|
21
|
-
"health-fitness": "health-fitness";
|
|
22
|
-
"news-media": "news-media";
|
|
23
|
-
music: "music";
|
|
24
|
-
shopping: "shopping";
|
|
25
|
-
education: "education";
|
|
26
|
-
"developer-tools": "developer-tools";
|
|
27
|
-
entertainment: "entertainment";
|
|
28
|
-
"art-creativity": "art-creativity";
|
|
29
|
-
}>>;
|
|
30
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
31
|
-
heroImageUrl: z.ZodOptional<z.ZodString>;
|
|
32
|
-
tagline: z.ZodOptional<z.ZodString>;
|
|
33
|
-
ogTitle: z.ZodOptional<z.ZodString>;
|
|
34
|
-
ogDescription: z.ZodOptional<z.ZodString>;
|
|
35
|
-
ogImageUrl: z.ZodOptional<z.ZodString>;
|
|
36
|
-
noindex: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
-
requiredChains: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
38
|
-
"eip155:1": "eip155:1";
|
|
39
|
-
"eip155:8453": "eip155:8453";
|
|
40
|
-
"eip155:42161": "eip155:42161";
|
|
41
|
-
"eip155:421614": "eip155:421614";
|
|
42
|
-
"eip155:84532": "eip155:84532";
|
|
43
|
-
"eip155:666666666": "eip155:666666666";
|
|
44
|
-
"eip155:100": "eip155:100";
|
|
45
|
-
"eip155:10": "eip155:10";
|
|
46
|
-
"eip155:11155420": "eip155:11155420";
|
|
47
|
-
"eip155:137": "eip155:137";
|
|
48
|
-
"eip155:11155111": "eip155:11155111";
|
|
49
|
-
"eip155:7777777": "eip155:7777777";
|
|
50
|
-
"eip155:130": "eip155:130";
|
|
51
|
-
"eip155:10143": "eip155:10143";
|
|
52
|
-
"eip155:42220": "eip155:42220";
|
|
53
|
-
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
54
|
-
}>>, z.ZodTransform<("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[], ("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[]>>>;
|
|
55
|
-
requiredCapabilities: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
56
|
-
"wallet.getEthereumProvider": "wallet.getEthereumProvider";
|
|
57
|
-
"wallet.getSolanaProvider": "wallet.getSolanaProvider";
|
|
58
|
-
"actions.ready": "actions.ready";
|
|
59
|
-
"actions.openUrl": "actions.openUrl";
|
|
60
|
-
"actions.close": "actions.close";
|
|
61
|
-
"actions.setPrimaryButton": "actions.setPrimaryButton";
|
|
62
|
-
"actions.addMiniApp": "actions.addMiniApp";
|
|
63
|
-
"actions.signIn": "actions.signIn";
|
|
64
|
-
"actions.viewCast": "actions.viewCast";
|
|
65
|
-
"actions.viewProfile": "actions.viewProfile";
|
|
66
|
-
"actions.composeCast": "actions.composeCast";
|
|
67
|
-
"actions.viewToken": "actions.viewToken";
|
|
68
|
-
"actions.sendToken": "actions.sendToken";
|
|
69
|
-
"actions.swapToken": "actions.swapToken";
|
|
70
|
-
"haptics.impactOccurred": "haptics.impactOccurred";
|
|
71
|
-
"haptics.notificationOccurred": "haptics.notificationOccurred";
|
|
72
|
-
"haptics.selectionChanged": "haptics.selectionChanged";
|
|
73
|
-
back: "back";
|
|
74
|
-
}>>, z.ZodTransform<("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[], ("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[]>>>;
|
|
75
|
-
castShareUrl: z.ZodOptional<z.ZodString>;
|
|
76
|
-
canonicalDomain: z.ZodOptional<z.ZodString>;
|
|
77
|
-
}, z.core.$strip>;
|
|
78
|
-
export declare const domainManifestSchema: z.ZodObject<{
|
|
79
|
-
accountAssociation: z.ZodObject<{
|
|
80
|
-
header: z.ZodString;
|
|
81
|
-
payload: z.ZodString;
|
|
82
|
-
signature: z.ZodString;
|
|
83
|
-
}, z.core.$strip>;
|
|
84
|
-
frame: z.ZodOptional<z.ZodObject<{
|
|
85
|
-
version: z.ZodUnion<readonly [z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;
|
|
86
|
-
name: z.ZodString;
|
|
87
|
-
iconUrl: z.ZodString;
|
|
88
|
-
homeUrl: z.ZodString;
|
|
89
|
-
imageUrl: z.ZodOptional<z.ZodString>;
|
|
90
|
-
buttonTitle: z.ZodOptional<z.ZodString>;
|
|
91
|
-
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
92
|
-
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
93
|
-
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
94
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
95
|
-
description: z.ZodOptional<z.ZodString>;
|
|
96
|
-
screenshotUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
97
|
-
primaryCategory: z.ZodOptional<z.ZodEnum<{
|
|
98
|
-
games: "games";
|
|
99
|
-
social: "social";
|
|
100
|
-
finance: "finance";
|
|
101
|
-
utility: "utility";
|
|
102
|
-
productivity: "productivity";
|
|
103
|
-
"health-fitness": "health-fitness";
|
|
104
|
-
"news-media": "news-media";
|
|
105
|
-
music: "music";
|
|
106
|
-
shopping: "shopping";
|
|
107
|
-
education: "education";
|
|
108
|
-
"developer-tools": "developer-tools";
|
|
109
|
-
entertainment: "entertainment";
|
|
110
|
-
"art-creativity": "art-creativity";
|
|
111
|
-
}>>;
|
|
112
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
|
-
heroImageUrl: z.ZodOptional<z.ZodString>;
|
|
114
|
-
tagline: z.ZodOptional<z.ZodString>;
|
|
115
|
-
ogTitle: z.ZodOptional<z.ZodString>;
|
|
116
|
-
ogDescription: z.ZodOptional<z.ZodString>;
|
|
117
|
-
ogImageUrl: z.ZodOptional<z.ZodString>;
|
|
118
|
-
noindex: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
-
requiredChains: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
120
|
-
"eip155:1": "eip155:1";
|
|
121
|
-
"eip155:8453": "eip155:8453";
|
|
122
|
-
"eip155:42161": "eip155:42161";
|
|
123
|
-
"eip155:421614": "eip155:421614";
|
|
124
|
-
"eip155:84532": "eip155:84532";
|
|
125
|
-
"eip155:666666666": "eip155:666666666";
|
|
126
|
-
"eip155:100": "eip155:100";
|
|
127
|
-
"eip155:10": "eip155:10";
|
|
128
|
-
"eip155:11155420": "eip155:11155420";
|
|
129
|
-
"eip155:137": "eip155:137";
|
|
130
|
-
"eip155:11155111": "eip155:11155111";
|
|
131
|
-
"eip155:7777777": "eip155:7777777";
|
|
132
|
-
"eip155:130": "eip155:130";
|
|
133
|
-
"eip155:10143": "eip155:10143";
|
|
134
|
-
"eip155:42220": "eip155:42220";
|
|
135
|
-
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
136
|
-
}>>, z.ZodTransform<("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[], ("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[]>>>;
|
|
137
|
-
requiredCapabilities: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
|
|
138
|
-
"wallet.getEthereumProvider": "wallet.getEthereumProvider";
|
|
139
|
-
"wallet.getSolanaProvider": "wallet.getSolanaProvider";
|
|
140
|
-
"actions.ready": "actions.ready";
|
|
141
|
-
"actions.openUrl": "actions.openUrl";
|
|
142
|
-
"actions.close": "actions.close";
|
|
143
|
-
"actions.setPrimaryButton": "actions.setPrimaryButton";
|
|
144
|
-
"actions.addMiniApp": "actions.addMiniApp";
|
|
145
|
-
"actions.signIn": "actions.signIn";
|
|
146
|
-
"actions.viewCast": "actions.viewCast";
|
|
147
|
-
"actions.viewProfile": "actions.viewProfile";
|
|
148
|
-
"actions.composeCast": "actions.composeCast";
|
|
149
|
-
"actions.viewToken": "actions.viewToken";
|
|
150
|
-
"actions.sendToken": "actions.sendToken";
|
|
151
|
-
"actions.swapToken": "actions.swapToken";
|
|
152
|
-
"haptics.impactOccurred": "haptics.impactOccurred";
|
|
153
|
-
"haptics.notificationOccurred": "haptics.notificationOccurred";
|
|
154
|
-
"haptics.selectionChanged": "haptics.selectionChanged";
|
|
155
|
-
back: "back";
|
|
156
|
-
}>>, z.ZodTransform<("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[], ("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[]>>>;
|
|
157
|
-
castShareUrl: z.ZodOptional<z.ZodString>;
|
|
158
|
-
canonicalDomain: z.ZodOptional<z.ZodString>;
|
|
159
|
-
}, z.core.$strip>>;
|
|
160
|
-
}, z.core.$strip>;
|
package/esm/schemas/manifest.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { miniAppHostCapabilityList } from "../types.js";
|
|
3
|
-
import { buttonTitleSchema, createSimpleStringSchema, domainSchema, encodedJsonFarcasterSignatureSchema, frameNameSchema, hexColorSchema, secureUrlSchema, } from "./shared.js";
|
|
4
|
-
const primaryCategorySchema = z.enum([
|
|
5
|
-
'games',
|
|
6
|
-
'social',
|
|
7
|
-
'finance',
|
|
8
|
-
'utility',
|
|
9
|
-
'productivity',
|
|
10
|
-
'health-fitness',
|
|
11
|
-
'news-media',
|
|
12
|
-
'music',
|
|
13
|
-
'shopping',
|
|
14
|
-
'education',
|
|
15
|
-
'developer-tools',
|
|
16
|
-
'entertainment',
|
|
17
|
-
'art-creativity',
|
|
18
|
-
]);
|
|
19
|
-
const chainList = [
|
|
20
|
-
'eip155:1', // Ethereum mainnet
|
|
21
|
-
'eip155:8453', // Base mainnet
|
|
22
|
-
'eip155:42161', // Arbitrum One
|
|
23
|
-
'eip155:421614', // Arbitrum Sepolia
|
|
24
|
-
'eip155:84532', // Base Sepolia
|
|
25
|
-
'eip155:666666666', // Degen
|
|
26
|
-
'eip155:100', // Gnosis
|
|
27
|
-
'eip155:10', // Optimism
|
|
28
|
-
'eip155:11155420', // Optimism Sepolia
|
|
29
|
-
'eip155:137', // Polygon
|
|
30
|
-
'eip155:11155111', // Ethereum Sepolia
|
|
31
|
-
'eip155:7777777', // Zora
|
|
32
|
-
'eip155:130', // Unichain
|
|
33
|
-
'eip155:10143', // Monad testnet
|
|
34
|
-
'eip155:42220', // Celo
|
|
35
|
-
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', // Solana
|
|
36
|
-
];
|
|
37
|
-
function removeArrayDuplicates(arr) {
|
|
38
|
-
const set = new Set(arr);
|
|
39
|
-
return Array.from(set);
|
|
40
|
-
}
|
|
41
|
-
export const domainFrameConfigSchema = z
|
|
42
|
-
.object({
|
|
43
|
-
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for
|
|
44
|
-
// backwards compatibility. next should always resolve to the most recent
|
|
45
|
-
// schema version.
|
|
46
|
-
version: z.union([
|
|
47
|
-
z.literal('0.0.0'),
|
|
48
|
-
z.literal('0.0.1'),
|
|
49
|
-
z.literal('1'),
|
|
50
|
-
z.literal('next'),
|
|
51
|
-
]),
|
|
52
|
-
name: frameNameSchema,
|
|
53
|
-
iconUrl: secureUrlSchema,
|
|
54
|
-
homeUrl: secureUrlSchema,
|
|
55
|
-
/** deprecated, set ogImageUrl instead */
|
|
56
|
-
imageUrl: secureUrlSchema.optional(),
|
|
57
|
-
/** deprecated, will rely on fc:frame meta tag */
|
|
58
|
-
buttonTitle: buttonTitleSchema.optional(),
|
|
59
|
-
splashImageUrl: secureUrlSchema.optional(),
|
|
60
|
-
splashBackgroundColor: hexColorSchema.optional(),
|
|
61
|
-
webhookUrl: secureUrlSchema.optional(),
|
|
62
|
-
/** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
|
|
63
|
-
subtitle: createSimpleStringSchema({ max: 30 }).optional(),
|
|
64
|
-
description: createSimpleStringSchema({ max: 170 }).optional(),
|
|
65
|
-
screenshotUrls: z.array(secureUrlSchema).max(3).optional(),
|
|
66
|
-
primaryCategory: primaryCategorySchema.optional(),
|
|
67
|
-
tags: z
|
|
68
|
-
.array(createSimpleStringSchema({ max: 20, noSpaces: true }))
|
|
69
|
-
.max(5)
|
|
70
|
-
.optional(),
|
|
71
|
-
heroImageUrl: secureUrlSchema.optional(),
|
|
72
|
-
tagline: createSimpleStringSchema({ max: 30 }).optional(),
|
|
73
|
-
ogTitle: createSimpleStringSchema({ max: 30 }).optional(),
|
|
74
|
-
ogDescription: createSimpleStringSchema({ max: 100 }).optional(),
|
|
75
|
-
ogImageUrl: secureUrlSchema.optional(),
|
|
76
|
-
/** see: https://github.com/farcasterxyz/miniapps/discussions/204 */
|
|
77
|
-
noindex: z.boolean().optional(),
|
|
78
|
-
/** see https://github.com/farcasterxyz/miniapps/discussions/256 */
|
|
79
|
-
requiredChains: z
|
|
80
|
-
.array(z.enum(chainList))
|
|
81
|
-
.transform(removeArrayDuplicates)
|
|
82
|
-
.optional(),
|
|
83
|
-
requiredCapabilities: z
|
|
84
|
-
.array(z.enum(miniAppHostCapabilityList))
|
|
85
|
-
.transform(removeArrayDuplicates)
|
|
86
|
-
.optional(),
|
|
87
|
-
/** see https://github.com/farcasterxyz/miniapps/discussions/158 */
|
|
88
|
-
/** Documentation will be added once this feature is finalized. */
|
|
89
|
-
castShareUrl: secureUrlSchema.optional(),
|
|
90
|
-
/** Canonical domain for the frame application */
|
|
91
|
-
canonicalDomain: domainSchema.optional(),
|
|
92
|
-
})
|
|
93
|
-
.refine((data) => {
|
|
94
|
-
if (data.castShareUrl === undefined)
|
|
95
|
-
return true;
|
|
96
|
-
try {
|
|
97
|
-
const homeUrlDomain = new URL(data.homeUrl).hostname;
|
|
98
|
-
const castShareUrlDomain = new URL(data.castShareUrl).hostname;
|
|
99
|
-
return homeUrlDomain === castShareUrlDomain;
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
}, {
|
|
105
|
-
message: 'castShareUrl must have the same domain as homeUrl',
|
|
106
|
-
path: ['castShareUrl'],
|
|
107
|
-
});
|
|
108
|
-
export const domainManifestSchema = z.object({
|
|
109
|
-
accountAssociation: encodedJsonFarcasterSignatureSchema,
|
|
110
|
-
frame: domainFrameConfigSchema.optional(),
|
|
111
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
export declare const notificationDetailsSchema: z.ZodObject<{
|
|
3
|
-
url: z.ZodString;
|
|
4
|
-
token: z.ZodString;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
export type FrameNotificationDetails = z.infer<typeof notificationDetailsSchema>;
|
|
7
|
-
export declare const sendNotificationRequestSchema: z.ZodObject<{
|
|
8
|
-
notificationId: z.ZodString;
|
|
9
|
-
title: z.ZodString;
|
|
10
|
-
body: z.ZodString;
|
|
11
|
-
targetUrl: z.ZodString;
|
|
12
|
-
tokens: z.ZodArray<z.ZodString>;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
export type SendNotificationRequest = z.infer<typeof sendNotificationRequestSchema>;
|
|
15
|
-
export declare const sendNotificationResponseSchema: z.ZodObject<{
|
|
16
|
-
result: z.ZodObject<{
|
|
17
|
-
successfulTokens: z.ZodArray<z.ZodString>;
|
|
18
|
-
invalidTokens: z.ZodArray<z.ZodString>;
|
|
19
|
-
rateLimitedTokens: z.ZodArray<z.ZodString>;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
export type SendNotificationResponse = z.infer<typeof sendNotificationResponseSchema>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { secureUrlSchema } from "./shared.js";
|
|
3
|
-
export const notificationDetailsSchema = z.object({
|
|
4
|
-
url: z.string(),
|
|
5
|
-
token: z.string(),
|
|
6
|
-
});
|
|
7
|
-
export const sendNotificationRequestSchema = z.object({
|
|
8
|
-
notificationId: z.string().max(128),
|
|
9
|
-
title: z.string().max(32),
|
|
10
|
-
body: z.string().max(128),
|
|
11
|
-
targetUrl: secureUrlSchema,
|
|
12
|
-
tokens: z.string().array().max(100),
|
|
13
|
-
});
|
|
14
|
-
export const sendNotificationResponseSchema = z.object({
|
|
15
|
-
result: z.object({
|
|
16
|
-
successfulTokens: z.array(z.string()),
|
|
17
|
-
invalidTokens: z.array(z.string()),
|
|
18
|
-
rateLimitedTokens: z.array(z.string()),
|
|
19
|
-
}),
|
|
20
|
-
});
|
package/esm/schemas/shared.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
export declare const createSimpleStringSchema: ({ max, noSpaces, }?: {
|
|
3
|
-
max?: number;
|
|
4
|
-
noSpaces?: boolean;
|
|
5
|
-
}) => z.ZodString;
|
|
6
|
-
export declare const secureUrlSchema: z.ZodString;
|
|
7
|
-
export declare const frameNameSchema: z.ZodString;
|
|
8
|
-
export declare const buttonTitleSchema: z.ZodString;
|
|
9
|
-
export declare const caip19TokenSchema: z.ZodString;
|
|
10
|
-
export declare const hexColorSchema: z.ZodString;
|
|
11
|
-
export declare const domainSchema: z.ZodString;
|
|
12
|
-
export declare const aspectRatioSchema: z.ZodUnion<readonly [z.ZodLiteral<"1:1">, z.ZodLiteral<"3:2">]>;
|
|
13
|
-
export declare const encodedJsonFarcasterSignatureSchema: z.ZodObject<{
|
|
14
|
-
header: z.ZodString;
|
|
15
|
-
payload: z.ZodString;
|
|
16
|
-
signature: z.ZodString;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
export type EncodedJsonFarcasterSignatureSchema = z.infer<typeof encodedJsonFarcasterSignatureSchema>;
|
|
19
|
-
export declare const jsonFarcasterSignatureHeaderSchema: z.ZodObject<{
|
|
20
|
-
fid: z.ZodNumber;
|
|
21
|
-
type: z.ZodLiteral<"app_key">;
|
|
22
|
-
key: z.ZodString;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
export type JsonFarcasterSignatureHeaderSchema = z.infer<typeof jsonFarcasterSignatureHeaderSchema>;
|
package/esm/schemas/shared.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
const SPECIAL_CHARS_PATTERN = /[@#$%^&*+=\/\\|~«»]/;
|
|
3
|
-
const REPEATED_PUNCTUATION_PATTERN = /(!{2,}|\?{2,}|-{2,})/;
|
|
4
|
-
// Unicode ranges for emoji detection:
|
|
5
|
-
// \u{1F300}-\u{1F9FF} - Miscellaneous Symbols, Pictographs, Emoticons, Transport, Map, and Supplemental
|
|
6
|
-
// \u{2702}-\u{27B0} - Dingbats
|
|
7
|
-
// \u{2600}-\u{26FF} - Miscellaneous Symbols
|
|
8
|
-
// \u{2B00}-\u{2BFF} - Miscellaneous Symbols and Arrows
|
|
9
|
-
const EMOJI_PATTERN = /[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u;
|
|
10
|
-
export const createSimpleStringSchema = ({ max, noSpaces, } = {}) => {
|
|
11
|
-
const stringValidations = noSpaces
|
|
12
|
-
? z
|
|
13
|
-
.string()
|
|
14
|
-
.max(max ?? Number.POSITIVE_INFINITY)
|
|
15
|
-
.regex(/^\S*$/, 'Spaces are not allowed')
|
|
16
|
-
: z.string().max(max ?? Number.POSITIVE_INFINITY);
|
|
17
|
-
return stringValidations
|
|
18
|
-
.refine((value) => !EMOJI_PATTERN.test(value), {
|
|
19
|
-
message: 'Emojis and symbols are not allowed',
|
|
20
|
-
})
|
|
21
|
-
.refine((value) => !SPECIAL_CHARS_PATTERN.test(value), {
|
|
22
|
-
message: 'Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed',
|
|
23
|
-
})
|
|
24
|
-
.refine((value) => !REPEATED_PUNCTUATION_PATTERN.test(value), {
|
|
25
|
-
message: 'Repeated punctuations (!!, ??, --) are not allowed',
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
export const secureUrlSchema = z
|
|
29
|
-
.string()
|
|
30
|
-
.url()
|
|
31
|
-
.startsWith('https://', { message: 'Must be an https url' })
|
|
32
|
-
.max(1024)
|
|
33
|
-
.refine((url) => !url.includes(' '), {
|
|
34
|
-
message: 'URL must not contain spaces',
|
|
35
|
-
})
|
|
36
|
-
.refine((url) => {
|
|
37
|
-
try {
|
|
38
|
-
const hostname = new URL(url).hostname;
|
|
39
|
-
// Check for localhost
|
|
40
|
-
if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
// Check for IPv4 addresses
|
|
44
|
-
const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
|
|
45
|
-
if (ipv4Regex.test(hostname)) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
// Check for IPv6 addresses (including brackets)
|
|
49
|
-
if (hostname.startsWith('[') && hostname.endsWith(']')) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
|
-
message: 'URL must not use IP addresses or localhost',
|
|
59
|
-
});
|
|
60
|
-
export const frameNameSchema = z.string().max(32);
|
|
61
|
-
export const buttonTitleSchema = z.string().max(32);
|
|
62
|
-
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)$/;
|
|
63
|
-
export const caip19TokenSchema = z
|
|
64
|
-
.string()
|
|
65
|
-
.regex(CAIP_19_REGEX, { message: 'Invalid CAIP-19 asset ID' });
|
|
66
|
-
export const hexColorSchema = z
|
|
67
|
-
.string()
|
|
68
|
-
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
|
|
69
|
-
message: 'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
|
|
70
|
-
});
|
|
71
|
-
// Domain validation regex:
|
|
72
|
-
// - Each label (part between dots) must start and end with alphanumeric
|
|
73
|
-
// - Labels can contain hyphens in the middle
|
|
74
|
-
// - Cannot have consecutive dots
|
|
75
|
-
// - Must have at least one dot (TLD required)
|
|
76
|
-
// - TLD must be at least 2 characters and only letters
|
|
77
|
-
const DOMAIN_REGEX = /^(?!.*\.\.)([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
78
|
-
export const domainSchema = z
|
|
79
|
-
.string()
|
|
80
|
-
.max(1024)
|
|
81
|
-
.regex(DOMAIN_REGEX, {
|
|
82
|
-
message: 'Must be a valid domain name (e.g., example.com, sub.example.com)',
|
|
83
|
-
})
|
|
84
|
-
.refine((value) => !value.includes('://'), {
|
|
85
|
-
message: 'Domain must not include protocol (http://, https://, etc.)',
|
|
86
|
-
})
|
|
87
|
-
.refine((value) => !value.includes('/'), {
|
|
88
|
-
message: 'Domain must not include path separators',
|
|
89
|
-
})
|
|
90
|
-
.refine((value) => !value.includes('@'), {
|
|
91
|
-
message: 'Domain must not include @ symbol',
|
|
92
|
-
})
|
|
93
|
-
.refine((value) => !value.includes(':'), {
|
|
94
|
-
message: 'Domain must not include port numbers',
|
|
95
|
-
});
|
|
96
|
-
export const aspectRatioSchema = z.union([z.literal('1:1'), z.literal('3:2')]);
|
|
97
|
-
export const encodedJsonFarcasterSignatureSchema = z.object({
|
|
98
|
-
header: z.string(),
|
|
99
|
-
payload: z.string(),
|
|
100
|
-
signature: z.string(),
|
|
101
|
-
});
|
|
102
|
-
export const jsonFarcasterSignatureHeaderSchema = z.object({
|
|
103
|
-
fid: z.number(),
|
|
104
|
-
type: z.literal('app_key'),
|
|
105
|
-
key: z.string().startsWith('0x'),
|
|
106
|
-
});
|