@farcaster/frame-core 0.1.4 → 0.1.6
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/back.d.ts +13 -0
- package/dist/back.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/schemas/manifest.d.ts +110 -2
- package/dist/schemas/manifest.js +20 -1
- package/dist/types.d.ts +8 -2
- package/dist/types.js +1 -0
- package/esm/back.d.ts +13 -0
- package/esm/back.js +3 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/schemas/manifest.d.ts +110 -2
- package/esm/schemas/manifest.js +20 -1
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +8 -2
- package/esm/types.js +1 -0
- package/package.json +1 -1
- package/src/back.ts +15 -0
- package/src/index.ts +1 -0
- package/src/schemas/manifest.ts +63 -43
- package/src/types.ts +10 -0
package/src/schemas/manifest.ts
CHANGED
|
@@ -44,49 +44,69 @@ const chainList: [string, ...string[]] = [
|
|
|
44
44
|
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', // Solana
|
|
45
45
|
]
|
|
46
46
|
|
|
47
|
-
export const domainFrameConfigSchema = z
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
z.
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
47
|
+
export const domainFrameConfigSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for
|
|
50
|
+
// backwards compatibility. next should always resolve to the most recent
|
|
51
|
+
// schema version.
|
|
52
|
+
version: z.union([
|
|
53
|
+
z.literal('0.0.0'),
|
|
54
|
+
z.literal('0.0.1'),
|
|
55
|
+
z.literal('1'),
|
|
56
|
+
z.literal('next'),
|
|
57
|
+
]),
|
|
58
|
+
name: frameNameSchema,
|
|
59
|
+
iconUrl: secureUrlSchema,
|
|
60
|
+
homeUrl: secureUrlSchema,
|
|
61
|
+
/** deprecated, set ogImageUrl instead */
|
|
62
|
+
imageUrl: secureUrlSchema.optional(),
|
|
63
|
+
/** deprecated, will rely on fc:frame meta tag */
|
|
64
|
+
buttonTitle: buttonTitleSchema.optional(),
|
|
65
|
+
splashImageUrl: secureUrlSchema.optional(),
|
|
66
|
+
splashBackgroundColor: hexColorSchema.optional(),
|
|
67
|
+
webhookUrl: secureUrlSchema.optional(),
|
|
68
|
+
/** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
|
|
69
|
+
subtitle: createSimpleStringSchema({ max: 30 }).optional(),
|
|
70
|
+
description: createSimpleStringSchema({ max: 170 }).optional(),
|
|
71
|
+
screenshotUrls: z.array(secureUrlSchema).max(3).optional(),
|
|
72
|
+
primaryCategory: primaryCategorySchema.optional(),
|
|
73
|
+
tags: z
|
|
74
|
+
.array(createSimpleStringSchema({ max: 20, noSpaces: true }))
|
|
75
|
+
.max(5)
|
|
76
|
+
.optional(),
|
|
77
|
+
heroImageUrl: secureUrlSchema.optional(),
|
|
78
|
+
tagline: createSimpleStringSchema({ max: 30 }).optional(),
|
|
79
|
+
ogTitle: createSimpleStringSchema({ max: 30 }).optional(),
|
|
80
|
+
ogDescription: createSimpleStringSchema({ max: 100 }).optional(),
|
|
81
|
+
ogImageUrl: secureUrlSchema.optional(),
|
|
82
|
+
/** see: https://github.com/farcasterxyz/miniapps/discussions/204 */
|
|
83
|
+
noindex: z.boolean().optional(),
|
|
84
|
+
/** see https://github.com/farcasterxyz/miniapps/discussions/256 */
|
|
85
|
+
requiredChains: z.array(z.enum(chainList)).max(chainList.length).optional(),
|
|
86
|
+
requiredCapabilities: z
|
|
87
|
+
.array(z.enum(miniAppHostCapabilityList))
|
|
88
|
+
.max(miniAppHostCapabilityList.length)
|
|
89
|
+
.optional(),
|
|
90
|
+
/** see https://github.com/farcasterxyz/miniapps/discussions/158 */
|
|
91
|
+
/** Documentation will be added once this feature is finalized. */
|
|
92
|
+
castShareUrl: secureUrlSchema.optional(),
|
|
93
|
+
})
|
|
94
|
+
.refine(
|
|
95
|
+
(data) => {
|
|
96
|
+
if (data.castShareUrl === undefined) return true
|
|
97
|
+
try {
|
|
98
|
+
const homeUrlDomain = new URL(data.homeUrl).hostname
|
|
99
|
+
const castShareUrlDomain = new URL(data.castShareUrl).hostname
|
|
100
|
+
return homeUrlDomain === castShareUrlDomain
|
|
101
|
+
} catch {
|
|
102
|
+
return false
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
message: 'castShareUrl must have the same domain as homeUrl',
|
|
107
|
+
path: ['castShareUrl'],
|
|
108
|
+
},
|
|
109
|
+
)
|
|
90
110
|
|
|
91
111
|
export const domainManifestSchema = z.object({
|
|
92
112
|
accountAssociation: encodedJsonFarcasterSignatureSchema,
|
package/src/types.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
ViewProfile,
|
|
15
15
|
ViewToken,
|
|
16
16
|
} from './actions/index.ts'
|
|
17
|
+
import type { UpdateBackState } from './back.ts'
|
|
17
18
|
import type { FrameContext } from './context.ts'
|
|
18
19
|
import type {
|
|
19
20
|
EventFrameAdded,
|
|
@@ -60,6 +61,7 @@ export const miniAppHostCapabilityList: [string, ...string[]] = [
|
|
|
60
61
|
'haptics.impactOccurred',
|
|
61
62
|
'haptics.notificationOccurred',
|
|
62
63
|
'haptics.selectionChanged',
|
|
64
|
+
'back',
|
|
63
65
|
]
|
|
64
66
|
|
|
65
67
|
export type MiniAppHostCapability =
|
|
@@ -80,6 +82,7 @@ export type MiniAppHostCapability =
|
|
|
80
82
|
| 'haptics.impactOccurred'
|
|
81
83
|
| 'haptics.notificationOccurred'
|
|
82
84
|
| 'haptics.selectionChanged'
|
|
85
|
+
| 'back'
|
|
83
86
|
|
|
84
87
|
export type GetCapabilities = () => Promise<MiniAppHostCapability[]>
|
|
85
88
|
|
|
@@ -111,6 +114,7 @@ export type WireFrameHost = {
|
|
|
111
114
|
selectionChanged: SelectionChanged
|
|
112
115
|
getCapabilities: GetCapabilities
|
|
113
116
|
getChains: GetChains
|
|
117
|
+
updateBackState: UpdateBackState
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
export type FrameHost = {
|
|
@@ -142,6 +146,7 @@ export type FrameHost = {
|
|
|
142
146
|
selectionChanged: SelectionChanged
|
|
143
147
|
getCapabilities: GetCapabilities
|
|
144
148
|
getChains: GetChains
|
|
149
|
+
updateBackState: UpdateBackState
|
|
145
150
|
}
|
|
146
151
|
|
|
147
152
|
export type EventFrameAddRejected = {
|
|
@@ -153,6 +158,10 @@ export type EventPrimaryButtonClicked = {
|
|
|
153
158
|
event: 'primary_button_clicked'
|
|
154
159
|
}
|
|
155
160
|
|
|
161
|
+
export type EventBackNavigationTriggered = {
|
|
162
|
+
event: 'back_navigation_triggered'
|
|
163
|
+
}
|
|
164
|
+
|
|
156
165
|
export type FrameClientEvent =
|
|
157
166
|
| EventFrameAdded
|
|
158
167
|
| EventFrameAddRejected
|
|
@@ -160,4 +169,5 @@ export type FrameClientEvent =
|
|
|
160
169
|
| EventNotificationsEnabled
|
|
161
170
|
| EventNotificationsDisabled
|
|
162
171
|
| EventPrimaryButtonClicked
|
|
172
|
+
| EventBackNavigationTriggered
|
|
163
173
|
| Ethereum.EventEip6963AnnounceProvider
|