@farcaster/miniapp-core 0.0.0-canary-20250707200948 → 0.0.0-canary-20250726165352
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/actions/RequestCameraAndMicrophoneAccess.d.ts +19 -0
- package/dist/actions/RequestCameraAndMicrophoneAccess.js +2 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +2 -1
- package/dist/context.d.ts +1 -0
- package/dist/schemas/manifest.d.ts +43 -27
- package/dist/schemas/manifest.js +38 -29
- package/dist/types.d.ts +4 -2
- package/dist/types.js +1 -0
- package/esm/actions/RequestCameraAndMicrophoneAccess.d.ts +19 -0
- package/esm/actions/RequestCameraAndMicrophoneAccess.js +1 -0
- package/esm/actions/index.d.ts +1 -0
- package/esm/actions/index.js +1 -0
- package/esm/context.d.ts +1 -0
- package/esm/schemas/manifest.d.ts +43 -27
- package/esm/schemas/manifest.js +36 -27
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +4 -2
- package/esm/types.js +1 -0
- package/package.json +1 -1
- package/src/actions/RequestCameraAndMicrophoneAccess.ts +19 -0
- package/src/actions/index.ts +1 -0
- package/src/context.ts +1 -0
- package/src/schemas/manifest.ts +52 -27
- package/src/types.ts +4 -0
package/src/context.ts
CHANGED
package/src/schemas/manifest.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
secureUrlSchema,
|
|
11
11
|
} from './shared.ts'
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
export const primaryCategories = [
|
|
14
14
|
'games',
|
|
15
15
|
'social',
|
|
16
16
|
'finance',
|
|
@@ -24,9 +24,38 @@ const primaryCategorySchema = z.enum([
|
|
|
24
24
|
'developer-tools',
|
|
25
25
|
'entertainment',
|
|
26
26
|
'art-creativity',
|
|
27
|
+
] as const
|
|
28
|
+
|
|
29
|
+
export type PrimaryCategory = (typeof primaryCategories)[number]
|
|
30
|
+
|
|
31
|
+
export const primaryCategorySchema = z.enum(primaryCategories)
|
|
32
|
+
|
|
33
|
+
export const versionSchema = z.union([
|
|
34
|
+
z.literal('0.0.0'),
|
|
35
|
+
z.literal('0.0.1'),
|
|
36
|
+
z.literal('1'),
|
|
37
|
+
z.literal('next'),
|
|
27
38
|
])
|
|
28
39
|
|
|
29
|
-
const
|
|
40
|
+
export const subtitleSchema = createSimpleStringSchema({ max: 30 })
|
|
41
|
+
|
|
42
|
+
export const descriptionSchema = createSimpleStringSchema({ max: 170 })
|
|
43
|
+
|
|
44
|
+
export const screenshotUrlsSchema = z.array(secureUrlSchema).max(3)
|
|
45
|
+
|
|
46
|
+
export const tagsSchema = z
|
|
47
|
+
.array(createSimpleStringSchema({ max: 20, noSpaces: true }))
|
|
48
|
+
.max(5)
|
|
49
|
+
|
|
50
|
+
export const taglineSchema = createSimpleStringSchema({ max: 30 })
|
|
51
|
+
|
|
52
|
+
export const ogTitleSchema = createSimpleStringSchema({ max: 30 })
|
|
53
|
+
|
|
54
|
+
export const ogDescriptionSchema = createSimpleStringSchema({ max: 100 })
|
|
55
|
+
|
|
56
|
+
export const noindexSchema = z.boolean()
|
|
57
|
+
|
|
58
|
+
export const chains = [
|
|
30
59
|
'eip155:1', // Ethereum mainnet
|
|
31
60
|
'eip155:8453', // Base mainnet
|
|
32
61
|
'eip155:42161', // Arbitrum One
|
|
@@ -45,22 +74,27 @@ const chainList = [
|
|
|
45
74
|
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', // Solana
|
|
46
75
|
] as const
|
|
47
76
|
|
|
77
|
+
export type Chains = (typeof chains)[number]
|
|
78
|
+
|
|
48
79
|
function removeArrayDuplicates<T>(arr: T[]) {
|
|
49
80
|
const set = new Set(arr)
|
|
50
81
|
return Array.from(set)
|
|
51
82
|
}
|
|
52
83
|
|
|
84
|
+
export const requiredChainsSchema = z
|
|
85
|
+
.array(z.enum(chains))
|
|
86
|
+
.transform(removeArrayDuplicates)
|
|
87
|
+
|
|
88
|
+
export const requiredCapabilitiesSchema = z
|
|
89
|
+
.array(z.enum(miniAppHostCapabilityList))
|
|
90
|
+
.transform(removeArrayDuplicates)
|
|
91
|
+
|
|
53
92
|
export const domainMiniAppConfigSchema = z
|
|
54
93
|
.object({
|
|
55
94
|
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for
|
|
56
95
|
// backwards compatibility. next should always resolve to the most recent
|
|
57
96
|
// schema version.
|
|
58
|
-
version:
|
|
59
|
-
z.literal('0.0.0'),
|
|
60
|
-
z.literal('0.0.1'),
|
|
61
|
-
z.literal('1'),
|
|
62
|
-
z.literal('next'),
|
|
63
|
-
]),
|
|
97
|
+
version: versionSchema,
|
|
64
98
|
name: miniAppNameSchema,
|
|
65
99
|
iconUrl: secureUrlSchema,
|
|
66
100
|
homeUrl: secureUrlSchema,
|
|
@@ -72,30 +106,21 @@ export const domainMiniAppConfigSchema = z
|
|
|
72
106
|
splashBackgroundColor: hexColorSchema.optional(),
|
|
73
107
|
webhookUrl: secureUrlSchema.optional(),
|
|
74
108
|
/** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
|
|
75
|
-
subtitle:
|
|
76
|
-
description:
|
|
77
|
-
screenshotUrls:
|
|
109
|
+
subtitle: subtitleSchema.optional(),
|
|
110
|
+
description: descriptionSchema.optional(),
|
|
111
|
+
screenshotUrls: screenshotUrlsSchema.optional(),
|
|
78
112
|
primaryCategory: primaryCategorySchema.optional(),
|
|
79
|
-
tags:
|
|
80
|
-
.array(createSimpleStringSchema({ max: 20, noSpaces: true }))
|
|
81
|
-
.max(5)
|
|
82
|
-
.optional(),
|
|
113
|
+
tags: tagsSchema.optional(),
|
|
83
114
|
heroImageUrl: secureUrlSchema.optional(),
|
|
84
|
-
tagline:
|
|
85
|
-
ogTitle:
|
|
86
|
-
ogDescription:
|
|
115
|
+
tagline: taglineSchema.optional(),
|
|
116
|
+
ogTitle: ogTitleSchema.optional(),
|
|
117
|
+
ogDescription: ogDescriptionSchema.optional(),
|
|
87
118
|
ogImageUrl: secureUrlSchema.optional(),
|
|
88
119
|
/** see: https://github.com/farcasterxyz/miniapps/discussions/204 */
|
|
89
|
-
noindex:
|
|
120
|
+
noindex: noindexSchema.optional(),
|
|
90
121
|
/** see https://github.com/farcasterxyz/miniapps/discussions/256 */
|
|
91
|
-
requiredChains:
|
|
92
|
-
|
|
93
|
-
.transform(removeArrayDuplicates)
|
|
94
|
-
.optional(),
|
|
95
|
-
requiredCapabilities: z
|
|
96
|
-
.array(z.enum(miniAppHostCapabilityList))
|
|
97
|
-
.transform(removeArrayDuplicates)
|
|
98
|
-
.optional(),
|
|
122
|
+
requiredChains: requiredChainsSchema.optional(),
|
|
123
|
+
requiredCapabilities: requiredCapabilitiesSchema.optional(),
|
|
99
124
|
/** see https://github.com/farcasterxyz/miniapps/discussions/158 */
|
|
100
125
|
/** Documentation will be added once this feature is finalized. */
|
|
101
126
|
castShareUrl: secureUrlSchema.optional(),
|
package/src/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
ComposeCast,
|
|
9
9
|
OpenMiniApp,
|
|
10
10
|
Ready,
|
|
11
|
+
RequestCameraAndMicrophoneAccess,
|
|
11
12
|
SendToken,
|
|
12
13
|
SignIn,
|
|
13
14
|
SwapToken,
|
|
@@ -62,6 +63,7 @@ export const miniAppHostCapabilityList = [
|
|
|
62
63
|
'actions.sendToken',
|
|
63
64
|
'actions.swapToken',
|
|
64
65
|
'actions.openMiniApp',
|
|
66
|
+
'actions.requestCameraAndMicrophoneAccess',
|
|
65
67
|
'haptics.impactOccurred',
|
|
66
68
|
'haptics.notificationOccurred',
|
|
67
69
|
'haptics.selectionChanged',
|
|
@@ -97,6 +99,7 @@ export type WireMiniAppHost = {
|
|
|
97
99
|
composeCast: <close extends boolean | undefined = undefined>(
|
|
98
100
|
options: ComposeCast.Options<close>,
|
|
99
101
|
) => Promise<ComposeCast.Result<close>>
|
|
102
|
+
requestCameraAndMicrophoneAccess: RequestCameraAndMicrophoneAccess.RequestCameraAndMicrophoneAccess
|
|
100
103
|
impactOccurred: ImpactOccurred
|
|
101
104
|
notificationOccurred: NotificationOccurred
|
|
102
105
|
selectionChanged: SelectionChanged
|
|
@@ -131,6 +134,7 @@ export type MiniAppHost = {
|
|
|
131
134
|
composeCast: <close extends boolean | undefined = undefined>(
|
|
132
135
|
options: ComposeCast.Options<close>,
|
|
133
136
|
) => Promise<ComposeCast.Result<close>>
|
|
137
|
+
requestCameraAndMicrophoneAccess: RequestCameraAndMicrophoneAccess.RequestCameraAndMicrophoneAccess
|
|
134
138
|
impactOccurred: ImpactOccurred
|
|
135
139
|
notificationOccurred: NotificationOccurred
|
|
136
140
|
selectionChanged: SelectionChanged
|