@farcaster/frame-core 0.0.0-canary-20250430150627
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/README.md +13 -0
- package/dist/actions/AddFrame.d.ts +36 -0
- package/dist/actions/AddFrame.js +57 -0
- package/dist/actions/ComposeCast.d.ts +32 -0
- package/dist/actions/ComposeCast.js +2 -0
- package/dist/actions/Ready.d.ts +13 -0
- package/dist/actions/Ready.js +6 -0
- package/dist/actions/SendToken.d.ts +48 -0
- package/dist/actions/SendToken.js +2 -0
- package/dist/actions/SignIn.d.ts +41 -0
- package/dist/actions/SignIn.js +47 -0
- package/dist/actions/SwapToken.d.ts +46 -0
- package/dist/actions/SwapToken.js +2 -0
- package/dist/actions/ViewProfile.d.ts +4 -0
- package/dist/actions/ViewProfile.js +2 -0
- package/dist/actions/ViewToken.d.ts +4 -0
- package/dist/actions/ViewToken.js +2 -0
- package/dist/actions/index.d.ts +8 -0
- package/dist/actions/index.js +44 -0
- package/dist/context.d.ts +72 -0
- package/dist/context.js +2 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +46 -0
- package/dist/internal/types.d.ts +8 -0
- package/dist/internal/types.js +2 -0
- package/dist/manifest.d.ts +101 -0
- package/dist/manifest.js +2 -0
- package/dist/schemas/embeds.d.ts +243 -0
- package/dist/schemas/embeds.js +32 -0
- package/dist/schemas/events.d.ts +131 -0
- package/dist/schemas/events.js +25 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +21 -0
- package/dist/schemas/manifest.d.ts +208 -0
- package/dist/schemas/manifest.js +61 -0
- package/dist/schemas/notifications.d.ts +60 -0
- package/dist/schemas/notifications.js +23 -0
- package/dist/schemas/shared.d.ts +39 -0
- package/dist/schemas/shared.js +58 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.js +21 -0
- package/dist/wallet/ethereum.d.ts +47 -0
- package/dist/wallet/ethereum.js +2 -0
- package/dist/wallet/index.d.ts +1 -0
- package/dist/wallet/index.js +37 -0
- package/esm/actions/AddFrame.d.ts +36 -0
- package/esm/actions/AddFrame.js +19 -0
- package/esm/actions/ComposeCast.d.ts +32 -0
- package/esm/actions/ComposeCast.js +1 -0
- package/esm/actions/Ready.d.ts +13 -0
- package/esm/actions/Ready.js +3 -0
- package/esm/actions/SendToken.d.ts +48 -0
- package/esm/actions/SendToken.js +1 -0
- package/esm/actions/SignIn.d.ts +41 -0
- package/esm/actions/SignIn.js +10 -0
- package/esm/actions/SwapToken.d.ts +46 -0
- package/esm/actions/SwapToken.js +1 -0
- package/esm/actions/ViewProfile.d.ts +4 -0
- package/esm/actions/ViewProfile.js +1 -0
- package/esm/actions/ViewToken.d.ts +4 -0
- package/esm/actions/ViewToken.js +1 -0
- package/esm/actions/index.d.ts +8 -0
- package/esm/actions/index.js +8 -0
- package/esm/context.d.ts +72 -0
- package/esm/context.js +1 -0
- package/esm/errors.d.ts +13 -0
- package/esm/errors.js +8 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +7 -0
- package/esm/internal/types.d.ts +8 -0
- package/esm/internal/types.js +1 -0
- package/esm/manifest.d.ts +101 -0
- package/esm/manifest.js +1 -0
- package/esm/schemas/embeds.d.ts +243 -0
- package/esm/schemas/embeds.js +28 -0
- package/esm/schemas/events.d.ts +131 -0
- package/esm/schemas/events.js +22 -0
- package/esm/schemas/index.d.ts +5 -0
- package/esm/schemas/index.js +5 -0
- package/esm/schemas/manifest.d.ts +208 -0
- package/esm/schemas/manifest.js +58 -0
- package/esm/schemas/notifications.d.ts +60 -0
- package/esm/schemas/notifications.js +20 -0
- package/esm/schemas/shared.d.ts +39 -0
- package/esm/schemas/shared.js +54 -0
- package/esm/tsconfig.tsbuildinfo +1 -0
- package/esm/types.d.ts +60 -0
- package/esm/types.js +3 -0
- package/esm/wallet/ethereum.d.ts +47 -0
- package/esm/wallet/ethereum.js +1 -0
- package/esm/wallet/index.d.ts +1 -0
- package/esm/wallet/index.js +1 -0
- package/package.json +41 -0
- package/src/actions/AddFrame.ts +51 -0
- package/src/actions/ComposeCast.ts +36 -0
- package/src/actions/Ready.ts +15 -0
- package/src/actions/SendToken.ts +57 -0
- package/src/actions/SignIn.ts +51 -0
- package/src/actions/SwapToken.ts +54 -0
- package/src/actions/ViewProfile.ts +5 -0
- package/src/actions/ViewToken.ts +5 -0
- package/src/actions/index.ts +8 -0
- package/src/context.ts +90 -0
- package/src/errors.ts +21 -0
- package/src/index.ts +7 -0
- package/src/internal/types.ts +20 -0
- package/src/manifest.ts +113 -0
- package/src/schemas/embeds.ts +44 -0
- package/src/schemas/events.ts +41 -0
- package/src/schemas/index.ts +5 -0
- package/src/schemas/manifest.ts +68 -0
- package/src/schemas/notifications.ts +33 -0
- package/src/schemas/shared.ts +81 -0
- package/src/types.ts +95 -0
- package/src/wallet/ethereum.ts +65 -0
- package/src/wallet/index.ts +1 -0
|
@@ -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
|
+
};
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
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
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
type: "launch_frame";
|
|
10
|
+
name: string;
|
|
11
|
+
url?: string | undefined;
|
|
12
|
+
splashImageUrl?: string | undefined;
|
|
13
|
+
splashBackgroundColor?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
type: "launch_frame";
|
|
16
|
+
name: string;
|
|
17
|
+
url?: string | undefined;
|
|
18
|
+
splashImageUrl?: string | undefined;
|
|
19
|
+
splashBackgroundColor?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const actionViewTokenSchema: z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"view_token">;
|
|
23
|
+
token: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
type: "view_token";
|
|
26
|
+
token: string;
|
|
27
|
+
}, {
|
|
28
|
+
type: "view_token";
|
|
29
|
+
token: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"launch_frame">;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
url: z.ZodOptional<z.ZodString>;
|
|
35
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
36
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
type: "launch_frame";
|
|
39
|
+
name: string;
|
|
40
|
+
url?: string | undefined;
|
|
41
|
+
splashImageUrl?: string | undefined;
|
|
42
|
+
splashBackgroundColor?: string | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
type: "launch_frame";
|
|
45
|
+
name: string;
|
|
46
|
+
url?: string | undefined;
|
|
47
|
+
splashImageUrl?: string | undefined;
|
|
48
|
+
splashBackgroundColor?: string | undefined;
|
|
49
|
+
}>, z.ZodObject<{
|
|
50
|
+
type: z.ZodLiteral<"view_token">;
|
|
51
|
+
token: z.ZodString;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
type: "view_token";
|
|
54
|
+
token: string;
|
|
55
|
+
}, {
|
|
56
|
+
type: "view_token";
|
|
57
|
+
token: string;
|
|
58
|
+
}>]>;
|
|
59
|
+
export declare const buttonSchema: z.ZodObject<{
|
|
60
|
+
title: z.ZodString;
|
|
61
|
+
action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"launch_frame">;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
url: z.ZodOptional<z.ZodString>;
|
|
65
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
66
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
type: "launch_frame";
|
|
69
|
+
name: string;
|
|
70
|
+
url?: string | undefined;
|
|
71
|
+
splashImageUrl?: string | undefined;
|
|
72
|
+
splashBackgroundColor?: string | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
type: "launch_frame";
|
|
75
|
+
name: string;
|
|
76
|
+
url?: string | undefined;
|
|
77
|
+
splashImageUrl?: string | undefined;
|
|
78
|
+
splashBackgroundColor?: string | undefined;
|
|
79
|
+
}>, z.ZodObject<{
|
|
80
|
+
type: z.ZodLiteral<"view_token">;
|
|
81
|
+
token: z.ZodString;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
type: "view_token";
|
|
84
|
+
token: string;
|
|
85
|
+
}, {
|
|
86
|
+
type: "view_token";
|
|
87
|
+
token: string;
|
|
88
|
+
}>]>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
title: string;
|
|
91
|
+
action: {
|
|
92
|
+
type: "launch_frame";
|
|
93
|
+
name: string;
|
|
94
|
+
url?: string | undefined;
|
|
95
|
+
splashImageUrl?: string | undefined;
|
|
96
|
+
splashBackgroundColor?: string | undefined;
|
|
97
|
+
} | {
|
|
98
|
+
type: "view_token";
|
|
99
|
+
token: string;
|
|
100
|
+
};
|
|
101
|
+
}, {
|
|
102
|
+
title: string;
|
|
103
|
+
action: {
|
|
104
|
+
type: "launch_frame";
|
|
105
|
+
name: string;
|
|
106
|
+
url?: string | undefined;
|
|
107
|
+
splashImageUrl?: string | undefined;
|
|
108
|
+
splashBackgroundColor?: string | undefined;
|
|
109
|
+
} | {
|
|
110
|
+
type: "view_token";
|
|
111
|
+
token: string;
|
|
112
|
+
};
|
|
113
|
+
}>;
|
|
114
|
+
export declare const frameEmbedNextSchema: z.ZodObject<{
|
|
115
|
+
version: z.ZodLiteral<"next">;
|
|
116
|
+
imageUrl: z.ZodString;
|
|
117
|
+
aspectRatio: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"1:1">, z.ZodLiteral<"3:2">]>>;
|
|
118
|
+
button: z.ZodObject<{
|
|
119
|
+
title: z.ZodString;
|
|
120
|
+
action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
121
|
+
type: z.ZodLiteral<"launch_frame">;
|
|
122
|
+
name: z.ZodString;
|
|
123
|
+
url: z.ZodOptional<z.ZodString>;
|
|
124
|
+
splashImageUrl: z.ZodOptional<z.ZodString>;
|
|
125
|
+
splashBackgroundColor: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
type: "launch_frame";
|
|
128
|
+
name: string;
|
|
129
|
+
url?: string | undefined;
|
|
130
|
+
splashImageUrl?: string | undefined;
|
|
131
|
+
splashBackgroundColor?: string | undefined;
|
|
132
|
+
}, {
|
|
133
|
+
type: "launch_frame";
|
|
134
|
+
name: string;
|
|
135
|
+
url?: string | undefined;
|
|
136
|
+
splashImageUrl?: string | undefined;
|
|
137
|
+
splashBackgroundColor?: string | undefined;
|
|
138
|
+
}>, z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"view_token">;
|
|
140
|
+
token: z.ZodString;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
type: "view_token";
|
|
143
|
+
token: string;
|
|
144
|
+
}, {
|
|
145
|
+
type: "view_token";
|
|
146
|
+
token: string;
|
|
147
|
+
}>]>;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
title: string;
|
|
150
|
+
action: {
|
|
151
|
+
type: "launch_frame";
|
|
152
|
+
name: string;
|
|
153
|
+
url?: string | undefined;
|
|
154
|
+
splashImageUrl?: string | undefined;
|
|
155
|
+
splashBackgroundColor?: string | undefined;
|
|
156
|
+
} | {
|
|
157
|
+
type: "view_token";
|
|
158
|
+
token: string;
|
|
159
|
+
};
|
|
160
|
+
}, {
|
|
161
|
+
title: string;
|
|
162
|
+
action: {
|
|
163
|
+
type: "launch_frame";
|
|
164
|
+
name: string;
|
|
165
|
+
url?: string | undefined;
|
|
166
|
+
splashImageUrl?: string | undefined;
|
|
167
|
+
splashBackgroundColor?: string | undefined;
|
|
168
|
+
} | {
|
|
169
|
+
type: "view_token";
|
|
170
|
+
token: string;
|
|
171
|
+
};
|
|
172
|
+
}>;
|
|
173
|
+
}, "strip", z.ZodTypeAny, {
|
|
174
|
+
version: "next";
|
|
175
|
+
imageUrl: string;
|
|
176
|
+
button: {
|
|
177
|
+
title: string;
|
|
178
|
+
action: {
|
|
179
|
+
type: "launch_frame";
|
|
180
|
+
name: string;
|
|
181
|
+
url?: string | undefined;
|
|
182
|
+
splashImageUrl?: string | undefined;
|
|
183
|
+
splashBackgroundColor?: string | undefined;
|
|
184
|
+
} | {
|
|
185
|
+
type: "view_token";
|
|
186
|
+
token: string;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
aspectRatio?: "1:1" | "3:2" | undefined;
|
|
190
|
+
}, {
|
|
191
|
+
version: "next";
|
|
192
|
+
imageUrl: string;
|
|
193
|
+
button: {
|
|
194
|
+
title: string;
|
|
195
|
+
action: {
|
|
196
|
+
type: "launch_frame";
|
|
197
|
+
name: string;
|
|
198
|
+
url?: string | undefined;
|
|
199
|
+
splashImageUrl?: string | undefined;
|
|
200
|
+
splashBackgroundColor?: string | undefined;
|
|
201
|
+
} | {
|
|
202
|
+
type: "view_token";
|
|
203
|
+
token: string;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
aspectRatio?: "1:1" | "3:2" | undefined;
|
|
207
|
+
}>;
|
|
208
|
+
export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.SafeParseReturnType<{
|
|
209
|
+
version: "next";
|
|
210
|
+
imageUrl: string;
|
|
211
|
+
button: {
|
|
212
|
+
title: string;
|
|
213
|
+
action: {
|
|
214
|
+
type: "launch_frame";
|
|
215
|
+
name: string;
|
|
216
|
+
url?: string | undefined;
|
|
217
|
+
splashImageUrl?: string | undefined;
|
|
218
|
+
splashBackgroundColor?: string | undefined;
|
|
219
|
+
} | {
|
|
220
|
+
type: "view_token";
|
|
221
|
+
token: string;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
aspectRatio?: "1:1" | "3:2" | undefined;
|
|
225
|
+
}, {
|
|
226
|
+
version: "next";
|
|
227
|
+
imageUrl: string;
|
|
228
|
+
button: {
|
|
229
|
+
title: string;
|
|
230
|
+
action: {
|
|
231
|
+
type: "launch_frame";
|
|
232
|
+
name: string;
|
|
233
|
+
url?: string | undefined;
|
|
234
|
+
splashImageUrl?: string | undefined;
|
|
235
|
+
splashBackgroundColor?: string | undefined;
|
|
236
|
+
} | {
|
|
237
|
+
type: "view_token";
|
|
238
|
+
token: string;
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
aspectRatio?: "1:1" | "3:2" | undefined;
|
|
242
|
+
}>;
|
|
243
|
+
export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeParseFrameEmbed = exports.frameEmbedNextSchema = exports.buttonSchema = exports.actionSchema = exports.actionViewTokenSchema = exports.actionLaunchFrameSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
exports.actionLaunchFrameSchema = zod_1.z.object({
|
|
7
|
+
type: zod_1.z.literal('launch_frame'),
|
|
8
|
+
name: shared_1.frameNameSchema,
|
|
9
|
+
url: shared_1.secureUrlSchema.optional(),
|
|
10
|
+
splashImageUrl: shared_1.secureUrlSchema.optional(),
|
|
11
|
+
splashBackgroundColor: shared_1.hexColorSchema.optional(),
|
|
12
|
+
});
|
|
13
|
+
exports.actionViewTokenSchema = zod_1.z.object({
|
|
14
|
+
type: zod_1.z.literal('view_token'),
|
|
15
|
+
token: shared_1.caip19TokenSchema,
|
|
16
|
+
});
|
|
17
|
+
exports.actionSchema = zod_1.z.discriminatedUnion('type', [
|
|
18
|
+
exports.actionLaunchFrameSchema,
|
|
19
|
+
exports.actionViewTokenSchema,
|
|
20
|
+
]);
|
|
21
|
+
exports.buttonSchema = zod_1.z.object({
|
|
22
|
+
title: shared_1.buttonTitleSchema,
|
|
23
|
+
action: exports.actionSchema,
|
|
24
|
+
});
|
|
25
|
+
exports.frameEmbedNextSchema = zod_1.z.object({
|
|
26
|
+
version: zod_1.z.literal('next'),
|
|
27
|
+
imageUrl: shared_1.secureUrlSchema,
|
|
28
|
+
aspectRatio: shared_1.aspectRatioSchema.optional(),
|
|
29
|
+
button: exports.buttonSchema,
|
|
30
|
+
});
|
|
31
|
+
const safeParseFrameEmbed = (rawResponse) => exports.frameEmbedNextSchema.safeParse(rawResponse);
|
|
32
|
+
exports.safeParseFrameEmbed = safeParseFrameEmbed;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
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
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
url: string;
|
|
9
|
+
token: string;
|
|
10
|
+
}, {
|
|
11
|
+
url: string;
|
|
12
|
+
token: string;
|
|
13
|
+
}>>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
event: "frame_added";
|
|
16
|
+
notificationDetails?: {
|
|
17
|
+
url: string;
|
|
18
|
+
token: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
event: "frame_added";
|
|
22
|
+
notificationDetails?: {
|
|
23
|
+
url: string;
|
|
24
|
+
token: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
|
|
28
|
+
export declare const eventFrameRemovedSchema: z.ZodObject<{
|
|
29
|
+
event: z.ZodLiteral<"frame_removed">;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
event: "frame_removed";
|
|
32
|
+
}, {
|
|
33
|
+
event: "frame_removed";
|
|
34
|
+
}>;
|
|
35
|
+
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
|
|
36
|
+
export declare const eventNotificationsEnabledSchema: z.ZodObject<{
|
|
37
|
+
event: z.ZodLiteral<"notifications_enabled">;
|
|
38
|
+
notificationDetails: z.ZodObject<{
|
|
39
|
+
url: z.ZodString;
|
|
40
|
+
token: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
url: string;
|
|
43
|
+
token: string;
|
|
44
|
+
}, {
|
|
45
|
+
url: string;
|
|
46
|
+
token: string;
|
|
47
|
+
}>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
event: "notifications_enabled";
|
|
50
|
+
notificationDetails: {
|
|
51
|
+
url: string;
|
|
52
|
+
token: string;
|
|
53
|
+
};
|
|
54
|
+
}, {
|
|
55
|
+
event: "notifications_enabled";
|
|
56
|
+
notificationDetails: {
|
|
57
|
+
url: string;
|
|
58
|
+
token: string;
|
|
59
|
+
};
|
|
60
|
+
}>;
|
|
61
|
+
export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>;
|
|
62
|
+
export declare const notificationsDisabledSchema: z.ZodObject<{
|
|
63
|
+
event: z.ZodLiteral<"notifications_disabled">;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
event: "notifications_disabled";
|
|
66
|
+
}, {
|
|
67
|
+
event: "notifications_disabled";
|
|
68
|
+
}>;
|
|
69
|
+
export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>;
|
|
70
|
+
export declare const serverEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
|
|
71
|
+
event: z.ZodLiteral<"frame_added">;
|
|
72
|
+
notificationDetails: z.ZodOptional<z.ZodObject<{
|
|
73
|
+
url: z.ZodString;
|
|
74
|
+
token: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
url: string;
|
|
77
|
+
token: string;
|
|
78
|
+
}, {
|
|
79
|
+
url: string;
|
|
80
|
+
token: string;
|
|
81
|
+
}>>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
event: "frame_added";
|
|
84
|
+
notificationDetails?: {
|
|
85
|
+
url: string;
|
|
86
|
+
token: string;
|
|
87
|
+
} | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
event: "frame_added";
|
|
90
|
+
notificationDetails?: {
|
|
91
|
+
url: string;
|
|
92
|
+
token: string;
|
|
93
|
+
} | undefined;
|
|
94
|
+
}>, z.ZodObject<{
|
|
95
|
+
event: z.ZodLiteral<"frame_removed">;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
event: "frame_removed";
|
|
98
|
+
}, {
|
|
99
|
+
event: "frame_removed";
|
|
100
|
+
}>, z.ZodObject<{
|
|
101
|
+
event: z.ZodLiteral<"notifications_enabled">;
|
|
102
|
+
notificationDetails: z.ZodObject<{
|
|
103
|
+
url: z.ZodString;
|
|
104
|
+
token: z.ZodString;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
url: string;
|
|
107
|
+
token: string;
|
|
108
|
+
}, {
|
|
109
|
+
url: string;
|
|
110
|
+
token: string;
|
|
111
|
+
}>;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
event: "notifications_enabled";
|
|
114
|
+
notificationDetails: {
|
|
115
|
+
url: string;
|
|
116
|
+
token: string;
|
|
117
|
+
};
|
|
118
|
+
}, {
|
|
119
|
+
event: "notifications_enabled";
|
|
120
|
+
notificationDetails: {
|
|
121
|
+
url: string;
|
|
122
|
+
token: string;
|
|
123
|
+
};
|
|
124
|
+
}>, z.ZodObject<{
|
|
125
|
+
event: z.ZodLiteral<"notifications_disabled">;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
event: "notifications_disabled";
|
|
128
|
+
}, {
|
|
129
|
+
event: "notifications_disabled";
|
|
130
|
+
}>]>;
|
|
131
|
+
export type FrameServerEvent = z.infer<typeof serverEventSchema>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serverEventSchema = exports.notificationsDisabledSchema = exports.eventNotificationsEnabledSchema = exports.eventFrameRemovedSchema = exports.eventFrameAddedSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const notifications_1 = require("./notifications");
|
|
6
|
+
exports.eventFrameAddedSchema = zod_1.z.object({
|
|
7
|
+
event: zod_1.z.literal('frame_added'),
|
|
8
|
+
notificationDetails: notifications_1.notificationDetailsSchema.optional(),
|
|
9
|
+
});
|
|
10
|
+
exports.eventFrameRemovedSchema = zod_1.z.object({
|
|
11
|
+
event: zod_1.z.literal('frame_removed'),
|
|
12
|
+
});
|
|
13
|
+
exports.eventNotificationsEnabledSchema = zod_1.z.object({
|
|
14
|
+
event: zod_1.z.literal('notifications_enabled'),
|
|
15
|
+
notificationDetails: notifications_1.notificationDetailsSchema.required(),
|
|
16
|
+
});
|
|
17
|
+
exports.notificationsDisabledSchema = zod_1.z.object({
|
|
18
|
+
event: zod_1.z.literal('notifications_disabled'),
|
|
19
|
+
});
|
|
20
|
+
exports.serverEventSchema = zod_1.z.discriminatedUnion('event', [
|
|
21
|
+
exports.eventFrameAddedSchema,
|
|
22
|
+
exports.eventFrameRemovedSchema,
|
|
23
|
+
exports.eventNotificationsEnabledSchema,
|
|
24
|
+
exports.notificationsDisabledSchema,
|
|
25
|
+
]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./embeds"), exports);
|
|
18
|
+
__exportStar(require("./events"), exports);
|
|
19
|
+
__exportStar(require("./shared"), exports);
|
|
20
|
+
__exportStar(require("./manifest"), exports);
|
|
21
|
+
__exportStar(require("./notifications"), exports);
|