@farcaster/frame-core 0.2.0 → 0.3.1

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 (142) hide show
  1. package/dist/index.d.ts +372 -10
  2. package/dist/index.js +18 -33
  3. package/esm/index.d.ts +372 -10
  4. package/esm/index.js +17 -10
  5. package/esm/tsconfig.tsbuildinfo +1 -1
  6. package/package.json +6 -8
  7. package/src/index.ts +50 -10
  8. package/dist/actions/AddMiniApp.d.ts +0 -36
  9. package/dist/actions/AddMiniApp.js +0 -57
  10. package/dist/actions/ComposeCast.d.ts +0 -37
  11. package/dist/actions/ComposeCast.js +0 -2
  12. package/dist/actions/Haptics.d.ts +0 -5
  13. package/dist/actions/Haptics.js +0 -2
  14. package/dist/actions/Ready.d.ts +0 -13
  15. package/dist/actions/Ready.js +0 -6
  16. package/dist/actions/SendToken.d.ts +0 -48
  17. package/dist/actions/SendToken.js +0 -2
  18. package/dist/actions/SignIn.d.ts +0 -55
  19. package/dist/actions/SignIn.js +0 -47
  20. package/dist/actions/SwapToken.d.ts +0 -46
  21. package/dist/actions/SwapToken.js +0 -2
  22. package/dist/actions/ViewCast.d.ts +0 -25
  23. package/dist/actions/ViewCast.js +0 -2
  24. package/dist/actions/ViewProfile.d.ts +0 -4
  25. package/dist/actions/ViewProfile.js +0 -2
  26. package/dist/actions/ViewToken.d.ts +0 -4
  27. package/dist/actions/ViewToken.js +0 -2
  28. package/dist/actions/index.d.ts +0 -10
  29. package/dist/actions/index.js +0 -46
  30. package/dist/back.d.ts +0 -13
  31. package/dist/back.js +0 -6
  32. package/dist/context.d.ts +0 -94
  33. package/dist/context.js +0 -2
  34. package/dist/errors.d.ts +0 -13
  35. package/dist/errors.js +0 -12
  36. package/dist/internal/types.d.ts +0 -8
  37. package/dist/internal/types.js +0 -2
  38. package/dist/manifest.d.ts +0 -107
  39. package/dist/manifest.js +0 -2
  40. package/dist/schemas/embeds.d.ts +0 -243
  41. package/dist/schemas/embeds.js +0 -32
  42. package/dist/schemas/events.d.ts +0 -131
  43. package/dist/schemas/events.js +0 -25
  44. package/dist/schemas/index.d.ts +0 -5
  45. package/dist/schemas/index.js +0 -21
  46. package/dist/schemas/manifest.d.ts +0 -348
  47. package/dist/schemas/manifest.js +0 -114
  48. package/dist/schemas/notifications.d.ts +0 -60
  49. package/dist/schemas/notifications.js +0 -23
  50. package/dist/schemas/shared.d.ts +0 -40
  51. package/dist/schemas/shared.js +0 -83
  52. package/dist/solana.d.ts +0 -72
  53. package/dist/solana.js +0 -15
  54. package/dist/solanaWire.d.ts +0 -3
  55. package/dist/solanaWire.js +0 -84
  56. package/dist/types.d.ts +0 -87
  57. package/dist/types.js +0 -41
  58. package/dist/wallet/ethereum.d.ts +0 -47
  59. package/dist/wallet/ethereum.js +0 -2
  60. package/dist/wallet/index.d.ts +0 -1
  61. package/dist/wallet/index.js +0 -37
  62. package/esm/actions/AddMiniApp.d.ts +0 -36
  63. package/esm/actions/AddMiniApp.js +0 -19
  64. package/esm/actions/ComposeCast.d.ts +0 -37
  65. package/esm/actions/ComposeCast.js +0 -1
  66. package/esm/actions/Haptics.d.ts +0 -5
  67. package/esm/actions/Haptics.js +0 -1
  68. package/esm/actions/Ready.d.ts +0 -13
  69. package/esm/actions/Ready.js +0 -3
  70. package/esm/actions/SendToken.d.ts +0 -48
  71. package/esm/actions/SendToken.js +0 -1
  72. package/esm/actions/SignIn.d.ts +0 -55
  73. package/esm/actions/SignIn.js +0 -10
  74. package/esm/actions/SwapToken.d.ts +0 -46
  75. package/esm/actions/SwapToken.js +0 -1
  76. package/esm/actions/ViewCast.d.ts +0 -25
  77. package/esm/actions/ViewCast.js +0 -1
  78. package/esm/actions/ViewProfile.d.ts +0 -4
  79. package/esm/actions/ViewProfile.js +0 -1
  80. package/esm/actions/ViewToken.d.ts +0 -4
  81. package/esm/actions/ViewToken.js +0 -1
  82. package/esm/actions/index.d.ts +0 -10
  83. package/esm/actions/index.js +0 -10
  84. package/esm/back.d.ts +0 -13
  85. package/esm/back.js +0 -3
  86. package/esm/context.d.ts +0 -94
  87. package/esm/context.js +0 -1
  88. package/esm/errors.d.ts +0 -13
  89. package/esm/errors.js +0 -8
  90. package/esm/internal/types.d.ts +0 -8
  91. package/esm/internal/types.js +0 -1
  92. package/esm/manifest.d.ts +0 -107
  93. package/esm/manifest.js +0 -1
  94. package/esm/schemas/embeds.d.ts +0 -243
  95. package/esm/schemas/embeds.js +0 -28
  96. package/esm/schemas/events.d.ts +0 -131
  97. package/esm/schemas/events.js +0 -22
  98. package/esm/schemas/index.d.ts +0 -5
  99. package/esm/schemas/index.js +0 -5
  100. package/esm/schemas/manifest.d.ts +0 -348
  101. package/esm/schemas/manifest.js +0 -111
  102. package/esm/schemas/notifications.d.ts +0 -60
  103. package/esm/schemas/notifications.js +0 -20
  104. package/esm/schemas/shared.d.ts +0 -40
  105. package/esm/schemas/shared.js +0 -79
  106. package/esm/solana.d.ts +0 -72
  107. package/esm/solana.js +0 -11
  108. package/esm/solanaWire.d.ts +0 -3
  109. package/esm/solanaWire.js +0 -80
  110. package/esm/types.d.ts +0 -87
  111. package/esm/types.js +0 -23
  112. package/esm/wallet/ethereum.d.ts +0 -47
  113. package/esm/wallet/ethereum.js +0 -1
  114. package/esm/wallet/index.d.ts +0 -1
  115. package/esm/wallet/index.js +0 -1
  116. package/src/actions/AddMiniApp.ts +0 -51
  117. package/src/actions/ComposeCast.ts +0 -44
  118. package/src/actions/Haptics.ts +0 -9
  119. package/src/actions/Ready.ts +0 -15
  120. package/src/actions/SendToken.ts +0 -57
  121. package/src/actions/SignIn.ts +0 -67
  122. package/src/actions/SwapToken.ts +0 -54
  123. package/src/actions/ViewCast.ts +0 -27
  124. package/src/actions/ViewProfile.ts +0 -5
  125. package/src/actions/ViewToken.ts +0 -5
  126. package/src/actions/index.ts +0 -10
  127. package/src/back.ts +0 -15
  128. package/src/context.ts +0 -117
  129. package/src/errors.ts +0 -21
  130. package/src/internal/types.ts +0 -20
  131. package/src/manifest.ts +0 -120
  132. package/src/schemas/embeds.ts +0 -44
  133. package/src/schemas/events.ts +0 -41
  134. package/src/schemas/index.ts +0 -5
  135. package/src/schemas/manifest.ts +0 -125
  136. package/src/schemas/notifications.ts +0 -33
  137. package/src/schemas/shared.ts +0 -109
  138. package/src/solana.ts +0 -108
  139. package/src/solanaWire.ts +0 -120
  140. package/src/types.ts +0 -155
  141. package/src/wallet/ethereum.ts +0 -65
  142. package/src/wallet/index.ts +0 -1
@@ -1,243 +0,0 @@
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>;
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
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);
@@ -1,131 +0,0 @@
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>;
@@ -1,22 +0,0 @@
1
- import { z } from 'zod';
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
- ]);
@@ -1,5 +0,0 @@
1
- export * from './embeds.ts';
2
- export * from './events.ts';
3
- export * from './shared.ts';
4
- export * from './manifest.ts';
5
- export * from './notifications.ts';
@@ -1,5 +0,0 @@
1
- export * from "./embeds.js";
2
- export * from "./events.js";
3
- export * from "./shared.js";
4
- export * from "./manifest.js";
5
- export * from "./notifications.js";