@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.
- package/README.md +13 -0
- package/dist/actions/ComposeCast.d.ts +32 -0
- package/dist/actions/ComposeCast.js +2 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +2 -1
- package/dist/errors.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/manifest.d.ts +101 -0
- package/dist/manifest.js +2 -0
- package/dist/schemas/embeds.d.ts +20 -20
- package/dist/schemas/embeds.js +1 -1
- package/dist/schemas/manifest.d.ts +92 -6
- package/dist/schemas/manifest.js +31 -0
- package/dist/schemas/shared.d.ts +4 -0
- package/dist/schemas/shared.js +29 -2
- package/dist/types.d.ts +3 -1
- package/dist/wallet/ethereum.d.ts +5 -1
- package/esm/actions/AddFrame.d.ts +23 -27
- package/esm/actions/AddFrame.js +9 -9
- package/esm/actions/ComposeCast.d.ts +32 -0
- package/esm/actions/ComposeCast.js +1 -0
- package/esm/actions/Ready.d.ts +11 -11
- package/esm/actions/Ready.js +2 -2
- package/esm/actions/SignIn.d.ts +33 -35
- package/esm/actions/SignIn.js +5 -5
- package/esm/actions/Swap.d.ts +43 -44
- package/esm/actions/Swap.js +1 -1
- package/esm/actions/ViewProfile.d.ts +3 -3
- package/esm/actions/ViewProfile.js +1 -1
- package/esm/actions/ViewToken.d.ts +3 -3
- package/esm/actions/ViewToken.js +1 -1
- package/esm/actions/index.d.ts +7 -6
- package/esm/actions/index.js +7 -6
- package/esm/context.d.ts +61 -65
- package/esm/context.js +1 -1
- package/esm/errors.d.ts +10 -9
- package/esm/errors.js +6 -6
- package/esm/index.d.ts +7 -5
- package/esm/index.js +7 -5
- package/esm/internal/types.d.ts +7 -18
- package/esm/internal/types.js +1 -1
- package/esm/manifest.d.ts +101 -0
- package/esm/manifest.js +1 -0
- package/esm/schemas/embeds.d.ts +239 -346
- package/esm/schemas/embeds.js +23 -31
- package/esm/schemas/events.d.ts +129 -225
- package/esm/schemas/events.js +17 -17
- package/esm/schemas/index.d.ts +5 -5
- package/esm/schemas/index.js +5 -5
- package/esm/schemas/manifest.d.ts +196 -154
- package/esm/schemas/manifest.js +54 -29
- package/esm/schemas/notifications.d.ts +58 -86
- package/esm/schemas/notifications.js +17 -17
- package/esm/schemas/shared.d.ts +39 -53
- package/esm/schemas/shared.js +49 -25
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +53 -70
- package/esm/types.js +2 -2
- package/esm/wallet/ethereum.d.ts +39 -50
- package/esm/wallet/ethereum.js +1 -1
- package/esm/wallet/index.d.ts +1 -1
- package/esm/wallet/index.js +1 -1
- package/package.json +1 -1
- package/src/actions/ComposeCast.ts +36 -0
- package/src/actions/index.ts +1 -0
- package/src/errors.ts +4 -0
- package/src/index.ts +2 -0
- package/src/manifest.ts +113 -0
- package/src/schemas/embeds.ts +1 -1
- package/src/schemas/manifest.ts +33 -0
- package/src/schemas/shared.ts +36 -1
- package/src/types.ts +7 -0
- package/src/wallet/ethereum.ts +5 -1
package/esm/schemas/shared.d.ts
CHANGED
|
@@ -1,53 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
type:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
type: 'app_key'
|
|
42
|
-
fid: number
|
|
43
|
-
key: string
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
type: 'app_key'
|
|
47
|
-
fid: number
|
|
48
|
-
key: string
|
|
49
|
-
}
|
|
50
|
-
>
|
|
51
|
-
export type JsonFarcasterSignatureHeaderSchema = z.infer<
|
|
52
|
-
typeof jsonFarcasterSignatureHeaderSchema
|
|
53
|
-
>
|
|
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>;
|
|
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 aspectRatioSchema: z.ZodUnion<[z.ZodLiteral<"1:1">, z.ZodLiteral<"3:2">]>;
|
|
12
|
+
export declare const encodedJsonFarcasterSignatureSchema: z.ZodObject<{
|
|
13
|
+
header: z.ZodString;
|
|
14
|
+
payload: z.ZodString;
|
|
15
|
+
signature: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
header: string;
|
|
18
|
+
payload: string;
|
|
19
|
+
signature: string;
|
|
20
|
+
}, {
|
|
21
|
+
header: string;
|
|
22
|
+
payload: string;
|
|
23
|
+
signature: string;
|
|
24
|
+
}>;
|
|
25
|
+
export type EncodedJsonFarcasterSignatureSchema = z.infer<typeof encodedJsonFarcasterSignatureSchema>;
|
|
26
|
+
export declare const jsonFarcasterSignatureHeaderSchema: z.ZodObject<{
|
|
27
|
+
fid: z.ZodNumber;
|
|
28
|
+
type: z.ZodLiteral<"app_key">;
|
|
29
|
+
key: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
type: "app_key";
|
|
32
|
+
fid: number;
|
|
33
|
+
key: string;
|
|
34
|
+
}, {
|
|
35
|
+
type: "app_key";
|
|
36
|
+
fid: number;
|
|
37
|
+
key: string;
|
|
38
|
+
}>;
|
|
39
|
+
export type JsonFarcasterSignatureHeaderSchema = z.infer<typeof jsonFarcasterSignatureHeaderSchema>;
|
package/esm/schemas/shared.js
CHANGED
|
@@ -1,30 +1,54 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
1
|
+
import { z } from 'zod';
|
|
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
|
+
};
|
|
2
28
|
export const secureUrlSchema = z
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const frameNameSchema = z.string().max(32)
|
|
8
|
-
export const buttonTitleSchema = z.string().max(32)
|
|
9
|
-
const CAIP_19_REGEX =
|
|
10
|
-
/^[-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)$/
|
|
29
|
+
.string()
|
|
30
|
+
.url()
|
|
31
|
+
.startsWith('https://', { message: 'Must be an https url' })
|
|
32
|
+
.max(1024);
|
|
33
|
+
export const frameNameSchema = z.string().max(32);
|
|
34
|
+
export const buttonTitleSchema = z.string().max(32);
|
|
35
|
+
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)$/;
|
|
11
36
|
export const caip19TokenSchema = z
|
|
12
|
-
|
|
13
|
-
|
|
37
|
+
.string()
|
|
38
|
+
.regex(CAIP_19_REGEX, { message: 'Invalid CAIP-19 asset ID' });
|
|
14
39
|
export const hexColorSchema = z
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
message:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export const aspectRatioSchema = z.union([z.literal('1:1'), z.literal('3:2')])
|
|
40
|
+
.string()
|
|
41
|
+
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
|
|
42
|
+
message: 'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
|
|
43
|
+
});
|
|
44
|
+
export const aspectRatioSchema = z.union([z.literal('1:1'), z.literal('3:2')]);
|
|
21
45
|
export const encodedJsonFarcasterSignatureSchema = z.object({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
46
|
+
header: z.string(),
|
|
47
|
+
payload: z.string(),
|
|
48
|
+
signature: z.string(),
|
|
49
|
+
});
|
|
26
50
|
export const jsonFarcasterSignatureHeaderSchema = z.object({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
51
|
+
fid: z.number(),
|
|
52
|
+
type: z.literal('app_key'),
|
|
53
|
+
key: z.string().startsWith('0x'),
|
|
54
|
+
});
|