@farcaster/frame-core 0.0.28 → 0.0.29
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/LICENSE +21 -0
- package/esm/actions/AddFrame.d.ts +27 -23
- package/esm/actions/AddFrame.js +9 -9
- package/esm/actions/Ready.d.ts +11 -11
- package/esm/actions/Ready.js +2 -2
- package/esm/actions/SignIn.d.ts +35 -33
- package/esm/actions/SignIn.js +5 -5
- package/esm/actions/Swap.d.ts +44 -43
- 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 +6 -6
- package/esm/actions/index.js +6 -6
- package/esm/context.d.ts +65 -61
- package/esm/context.js +1 -1
- package/esm/errors.d.ts +9 -7
- package/esm/errors.js +6 -6
- package/esm/index.d.ts +5 -5
- package/esm/index.js +5 -5
- package/esm/internal/types.d.ts +18 -7
- package/esm/internal/types.js +1 -1
- package/esm/schemas/embeds.d.ts +346 -239
- package/esm/schemas/embeds.js +31 -23
- package/esm/schemas/events.d.ts +225 -129
- 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 +154 -110
- package/esm/schemas/manifest.js +29 -23
- package/esm/schemas/notifications.d.ts +86 -58
- package/esm/schemas/notifications.js +17 -17
- package/esm/schemas/shared.d.ts +53 -35
- package/esm/schemas/shared.js +25 -23
- package/esm/types.d.ts +70 -51
- package/esm/types.js +2 -2
- package/esm/wallet/ethereum.d.ts +50 -35
- 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 +7 -1
|
@@ -1,112 +1,156 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
export declare const domainFrameConfigSchema: z.ZodObject<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
splashImageUrl
|
|
18
|
-
splashBackgroundColor
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
1
|
+
import type { z } from 'zod'
|
|
2
|
+
export declare const domainFrameConfigSchema: z.ZodObject<
|
|
3
|
+
{
|
|
4
|
+
version: z.ZodUnion<
|
|
5
|
+
[
|
|
6
|
+
z.ZodLiteral<'0.0.0'>,
|
|
7
|
+
z.ZodLiteral<'0.0.1'>,
|
|
8
|
+
z.ZodLiteral<'1'>,
|
|
9
|
+
z.ZodLiteral<'next'>,
|
|
10
|
+
]
|
|
11
|
+
>
|
|
12
|
+
name: z.ZodString
|
|
13
|
+
iconUrl: z.ZodString
|
|
14
|
+
homeUrl: z.ZodString
|
|
15
|
+
imageUrl: z.ZodOptional<z.ZodString>
|
|
16
|
+
buttonTitle: z.ZodOptional<z.ZodString>
|
|
17
|
+
splashImageUrl: z.ZodOptional<z.ZodString>
|
|
18
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>
|
|
19
|
+
webhookUrl: z.ZodOptional<z.ZodString>
|
|
20
|
+
},
|
|
21
|
+
'strip',
|
|
22
|
+
z.ZodTypeAny,
|
|
23
|
+
{
|
|
24
|
+
name: string
|
|
25
|
+
version: 'next' | '0.0.0' | '0.0.1' | '1'
|
|
26
|
+
iconUrl: string
|
|
27
|
+
homeUrl: string
|
|
28
|
+
splashImageUrl?: string | undefined
|
|
29
|
+
splashBackgroundColor?: string | undefined
|
|
30
|
+
imageUrl?: string | undefined
|
|
31
|
+
buttonTitle?: string | undefined
|
|
32
|
+
webhookUrl?: string | undefined
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: string
|
|
36
|
+
version: 'next' | '0.0.0' | '0.0.1' | '1'
|
|
37
|
+
iconUrl: string
|
|
38
|
+
homeUrl: string
|
|
39
|
+
splashImageUrl?: string | undefined
|
|
40
|
+
splashBackgroundColor?: string | undefined
|
|
41
|
+
imageUrl?: string | undefined
|
|
42
|
+
buttonTitle?: string | undefined
|
|
43
|
+
webhookUrl?: string | undefined
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
export declare const domainManifestSchema: z.ZodObject<
|
|
47
|
+
{
|
|
48
|
+
accountAssociation: z.ZodObject<
|
|
49
|
+
{
|
|
50
|
+
header: z.ZodString
|
|
51
|
+
payload: z.ZodString
|
|
52
|
+
signature: z.ZodString
|
|
53
|
+
},
|
|
54
|
+
'strip',
|
|
55
|
+
z.ZodTypeAny,
|
|
56
|
+
{
|
|
57
|
+
header: string
|
|
58
|
+
payload: string
|
|
59
|
+
signature: string
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
header: string
|
|
63
|
+
payload: string
|
|
64
|
+
signature: string
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
frame: z.ZodOptional<
|
|
68
|
+
z.ZodObject<
|
|
69
|
+
{
|
|
70
|
+
version: z.ZodUnion<
|
|
71
|
+
[
|
|
72
|
+
z.ZodLiteral<'0.0.0'>,
|
|
73
|
+
z.ZodLiteral<'0.0.1'>,
|
|
74
|
+
z.ZodLiteral<'1'>,
|
|
75
|
+
z.ZodLiteral<'next'>,
|
|
76
|
+
]
|
|
77
|
+
>
|
|
78
|
+
name: z.ZodString
|
|
79
|
+
iconUrl: z.ZodString
|
|
80
|
+
homeUrl: z.ZodString
|
|
81
|
+
imageUrl: z.ZodOptional<z.ZodString>
|
|
82
|
+
buttonTitle: z.ZodOptional<z.ZodString>
|
|
83
|
+
splashImageUrl: z.ZodOptional<z.ZodString>
|
|
84
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>
|
|
85
|
+
webhookUrl: z.ZodOptional<z.ZodString>
|
|
86
|
+
},
|
|
87
|
+
'strip',
|
|
88
|
+
z.ZodTypeAny,
|
|
89
|
+
{
|
|
90
|
+
name: string
|
|
91
|
+
version: 'next' | '0.0.0' | '0.0.1' | '1'
|
|
92
|
+
iconUrl: string
|
|
93
|
+
homeUrl: string
|
|
94
|
+
splashImageUrl?: string | undefined
|
|
95
|
+
splashBackgroundColor?: string | undefined
|
|
96
|
+
imageUrl?: string | undefined
|
|
97
|
+
buttonTitle?: string | undefined
|
|
98
|
+
webhookUrl?: string | undefined
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: string
|
|
102
|
+
version: 'next' | '0.0.0' | '0.0.1' | '1'
|
|
103
|
+
iconUrl: string
|
|
104
|
+
homeUrl: string
|
|
105
|
+
splashImageUrl?: string | undefined
|
|
106
|
+
splashBackgroundColor?: string | undefined
|
|
107
|
+
imageUrl?: string | undefined
|
|
108
|
+
buttonTitle?: string | undefined
|
|
109
|
+
webhookUrl?: string | undefined
|
|
110
|
+
}
|
|
111
|
+
>
|
|
112
|
+
>
|
|
113
|
+
},
|
|
114
|
+
'strip',
|
|
115
|
+
z.ZodTypeAny,
|
|
116
|
+
{
|
|
79
117
|
accountAssociation: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
frame?:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
118
|
+
header: string
|
|
119
|
+
payload: string
|
|
120
|
+
signature: string
|
|
121
|
+
}
|
|
122
|
+
frame?:
|
|
123
|
+
| {
|
|
124
|
+
name: string
|
|
125
|
+
version: 'next' | '0.0.0' | '0.0.1' | '1'
|
|
126
|
+
iconUrl: string
|
|
127
|
+
homeUrl: string
|
|
128
|
+
splashImageUrl?: string | undefined
|
|
129
|
+
splashBackgroundColor?: string | undefined
|
|
130
|
+
imageUrl?: string | undefined
|
|
131
|
+
buttonTitle?: string | undefined
|
|
132
|
+
webhookUrl?: string | undefined
|
|
133
|
+
}
|
|
134
|
+
| undefined
|
|
135
|
+
},
|
|
136
|
+
{
|
|
96
137
|
accountAssociation: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
frame?:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
138
|
+
header: string
|
|
139
|
+
payload: string
|
|
140
|
+
signature: string
|
|
141
|
+
}
|
|
142
|
+
frame?:
|
|
143
|
+
| {
|
|
144
|
+
name: string
|
|
145
|
+
version: 'next' | '0.0.0' | '0.0.1' | '1'
|
|
146
|
+
iconUrl: string
|
|
147
|
+
homeUrl: string
|
|
148
|
+
splashImageUrl?: string | undefined
|
|
149
|
+
splashBackgroundColor?: string | undefined
|
|
150
|
+
imageUrl?: string | undefined
|
|
151
|
+
buttonTitle?: string | undefined
|
|
152
|
+
webhookUrl?: string | undefined
|
|
153
|
+
}
|
|
154
|
+
| undefined
|
|
155
|
+
}
|
|
156
|
+
>
|
package/esm/schemas/manifest.js
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import {
|
|
3
|
+
buttonTitleSchema,
|
|
4
|
+
encodedJsonFarcasterSignatureSchema,
|
|
5
|
+
frameNameSchema,
|
|
6
|
+
hexColorSchema,
|
|
7
|
+
secureUrlSchema,
|
|
8
|
+
} from './shared'
|
|
3
9
|
export const domainFrameConfigSchema = z.object({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
10
|
+
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for
|
|
11
|
+
// backwards compatibilty. next should always resolve to the most recent
|
|
12
|
+
// schema version.
|
|
13
|
+
version: z.union([
|
|
14
|
+
z.literal('0.0.0'),
|
|
15
|
+
z.literal('0.0.1'),
|
|
16
|
+
z.literal('1'),
|
|
17
|
+
z.literal('next'),
|
|
18
|
+
]),
|
|
19
|
+
name: frameNameSchema,
|
|
20
|
+
iconUrl: secureUrlSchema,
|
|
21
|
+
homeUrl: secureUrlSchema,
|
|
22
|
+
imageUrl: secureUrlSchema.optional(),
|
|
23
|
+
buttonTitle: buttonTitleSchema.optional(),
|
|
24
|
+
splashImageUrl: secureUrlSchema.optional(),
|
|
25
|
+
splashBackgroundColor: hexColorSchema.optional(),
|
|
26
|
+
webhookUrl: secureUrlSchema.optional(),
|
|
27
|
+
})
|
|
22
28
|
export const domainManifestSchema = z.object({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
29
|
+
accountAssociation: encodedJsonFarcasterSignatureSchema,
|
|
30
|
+
frame: domainFrameConfigSchema.optional(),
|
|
31
|
+
})
|
|
@@ -1,60 +1,88 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
export declare const notificationDetailsSchema: z.ZodObject<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
notificationId:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import type { z } from 'zod'
|
|
2
|
+
export declare const notificationDetailsSchema: z.ZodObject<
|
|
3
|
+
{
|
|
4
|
+
url: z.ZodString
|
|
5
|
+
token: z.ZodString
|
|
6
|
+
},
|
|
7
|
+
'strip',
|
|
8
|
+
z.ZodTypeAny,
|
|
9
|
+
{
|
|
10
|
+
url: string
|
|
11
|
+
token: string
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
url: string
|
|
15
|
+
token: string
|
|
16
|
+
}
|
|
17
|
+
>
|
|
18
|
+
export type FrameNotificationDetails = z.infer<typeof notificationDetailsSchema>
|
|
19
|
+
export declare const sendNotificationRequestSchema: z.ZodObject<
|
|
20
|
+
{
|
|
21
|
+
notificationId: z.ZodString
|
|
22
|
+
title: z.ZodString
|
|
23
|
+
body: z.ZodString
|
|
24
|
+
targetUrl: z.ZodString
|
|
25
|
+
tokens: z.ZodArray<z.ZodString, 'many'>
|
|
26
|
+
},
|
|
27
|
+
'strip',
|
|
28
|
+
z.ZodTypeAny,
|
|
29
|
+
{
|
|
30
|
+
title: string
|
|
31
|
+
notificationId: string
|
|
32
|
+
body: string
|
|
33
|
+
targetUrl: string
|
|
34
|
+
tokens: string[]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: string
|
|
38
|
+
notificationId: string
|
|
39
|
+
body: string
|
|
40
|
+
targetUrl: string
|
|
41
|
+
tokens: string[]
|
|
42
|
+
}
|
|
43
|
+
>
|
|
44
|
+
export type SendNotificationRequest = z.infer<
|
|
45
|
+
typeof sendNotificationRequestSchema
|
|
46
|
+
>
|
|
47
|
+
export declare const sendNotificationResponseSchema: z.ZodObject<
|
|
48
|
+
{
|
|
49
|
+
result: z.ZodObject<
|
|
50
|
+
{
|
|
51
|
+
successfulTokens: z.ZodArray<z.ZodString, 'many'>
|
|
52
|
+
invalidTokens: z.ZodArray<z.ZodString, 'many'>
|
|
53
|
+
rateLimitedTokens: z.ZodArray<z.ZodString, 'many'>
|
|
54
|
+
},
|
|
55
|
+
'strip',
|
|
56
|
+
z.ZodTypeAny,
|
|
57
|
+
{
|
|
58
|
+
successfulTokens: string[]
|
|
59
|
+
invalidTokens: string[]
|
|
60
|
+
rateLimitedTokens: string[]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
successfulTokens: string[]
|
|
64
|
+
invalidTokens: string[]
|
|
65
|
+
rateLimitedTokens: string[]
|
|
66
|
+
}
|
|
67
|
+
>
|
|
68
|
+
},
|
|
69
|
+
'strip',
|
|
70
|
+
z.ZodTypeAny,
|
|
71
|
+
{
|
|
48
72
|
result: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
},
|
|
73
|
+
successfulTokens: string[]
|
|
74
|
+
invalidTokens: string[]
|
|
75
|
+
rateLimitedTokens: string[]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
54
79
|
result: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
80
|
+
successfulTokens: string[]
|
|
81
|
+
invalidTokens: string[]
|
|
82
|
+
rateLimitedTokens: string[]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
export type SendNotificationResponse = z.infer<
|
|
87
|
+
typeof sendNotificationResponseSchema
|
|
88
|
+
>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { secureUrlSchema } from './shared'
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { secureUrlSchema } from './shared'
|
|
3
3
|
export const notificationDetailsSchema = z.object({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
})
|
|
4
|
+
url: z.string(),
|
|
5
|
+
token: z.string(),
|
|
6
|
+
})
|
|
7
7
|
export const sendNotificationRequestSchema = z.object({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
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
14
|
export const sendNotificationResponseSchema = z.object({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
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
CHANGED
|
@@ -1,35 +1,53 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
export declare const secureUrlSchema: z.ZodString
|
|
3
|
-
export declare const frameNameSchema: z.ZodString
|
|
4
|
-
export declare const buttonTitleSchema: z.ZodString
|
|
5
|
-
export declare const caip19TokenSchema: z.ZodString
|
|
6
|
-
export declare const hexColorSchema: z.ZodString
|
|
7
|
-
export declare const aspectRatioSchema: z.ZodUnion<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
1
|
+
import type { z } from 'zod'
|
|
2
|
+
export declare const secureUrlSchema: z.ZodString
|
|
3
|
+
export declare const frameNameSchema: z.ZodString
|
|
4
|
+
export declare const buttonTitleSchema: z.ZodString
|
|
5
|
+
export declare const caip19TokenSchema: z.ZodString
|
|
6
|
+
export declare const hexColorSchema: z.ZodString
|
|
7
|
+
export declare const aspectRatioSchema: z.ZodUnion<
|
|
8
|
+
[z.ZodLiteral<'1:1'>, z.ZodLiteral<'3:2'>]
|
|
9
|
+
>
|
|
10
|
+
export declare const encodedJsonFarcasterSignatureSchema: z.ZodObject<
|
|
11
|
+
{
|
|
12
|
+
header: z.ZodString
|
|
13
|
+
payload: z.ZodString
|
|
14
|
+
signature: z.ZodString
|
|
15
|
+
},
|
|
16
|
+
'strip',
|
|
17
|
+
z.ZodTypeAny,
|
|
18
|
+
{
|
|
19
|
+
header: string
|
|
20
|
+
payload: string
|
|
21
|
+
signature: string
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
header: string
|
|
25
|
+
payload: string
|
|
26
|
+
signature: string
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
export type EncodedJsonFarcasterSignatureSchema = z.infer<
|
|
30
|
+
typeof encodedJsonFarcasterSignatureSchema
|
|
31
|
+
>
|
|
32
|
+
export declare const jsonFarcasterSignatureHeaderSchema: z.ZodObject<
|
|
33
|
+
{
|
|
34
|
+
fid: z.ZodNumber
|
|
35
|
+
type: z.ZodLiteral<'app_key'>
|
|
36
|
+
key: z.ZodString
|
|
37
|
+
},
|
|
38
|
+
'strip',
|
|
39
|
+
z.ZodTypeAny,
|
|
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
|
+
>
|
package/esm/schemas/shared.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
1
|
+
import { z } from 'zod'
|
|
2
2
|
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 =
|
|
3
|
+
.string()
|
|
4
|
+
.url()
|
|
5
|
+
.startsWith('https://', { message: 'Must be an https url' })
|
|
6
|
+
.max(512)
|
|
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)$/
|
|
10
11
|
export const caip19TokenSchema = z
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
.string()
|
|
13
|
+
.regex(CAIP_19_REGEX, { message: 'Invalid CAIP-19 asset ID' })
|
|
13
14
|
export const hexColorSchema = z
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
message:
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
.string()
|
|
16
|
+
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
|
|
17
|
+
message:
|
|
18
|
+
'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
|
|
19
|
+
})
|
|
20
|
+
export const aspectRatioSchema = z.union([z.literal('1:1'), z.literal('3:2')])
|
|
19
21
|
export const encodedJsonFarcasterSignatureSchema = z.object({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
22
|
+
header: z.string(),
|
|
23
|
+
payload: z.string(),
|
|
24
|
+
signature: z.string(),
|
|
25
|
+
})
|
|
24
26
|
export const jsonFarcasterSignatureHeaderSchema = z.object({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
27
|
+
fid: z.number(),
|
|
28
|
+
type: z.literal('app_key'),
|
|
29
|
+
key: z.string().startsWith('0x'),
|
|
30
|
+
})
|