@farcaster/miniapp-core 0.0.0-canary-20250705153407 → 0.0.0-canary-20250713234517
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/OpenMiniApp.d.ts +4 -0
- package/dist/actions/OpenMiniApp.js +2 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +2 -1
- package/dist/context.d.ts +7 -1
- 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/OpenMiniApp.d.ts +4 -0
- package/esm/actions/OpenMiniApp.js +1 -0
- package/esm/actions/index.d.ts +1 -0
- package/esm/actions/index.js +1 -0
- package/esm/context.d.ts +7 -1
- 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/OpenMiniApp.ts +5 -0
- package/src/actions/index.ts +1 -0
- package/src/context.ts +9 -0
- package/src/schemas/manifest.ts +52 -27
- package/src/types.ts +4 -0
package/src/context.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { MiniAppNotificationDetails } from './schemas/index.ts'
|
|
2
2
|
|
|
3
|
+
export type MiniAppPlatformType = 'web' | 'mobile'
|
|
4
|
+
|
|
3
5
|
export type MiniAppUser = {
|
|
4
6
|
fid: number
|
|
5
7
|
username?: string
|
|
@@ -63,12 +65,18 @@ export type ChannelLocationContext = {
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
export type OpenMiniAppLocationContext = {
|
|
69
|
+
type: 'open_miniapp'
|
|
70
|
+
referrerDomain: string
|
|
71
|
+
}
|
|
72
|
+
|
|
66
73
|
export type LocationContext =
|
|
67
74
|
| CastEmbedLocationContext
|
|
68
75
|
| CastShareLocationContext
|
|
69
76
|
| NotificationLocationContext
|
|
70
77
|
| LauncherLocationContext
|
|
71
78
|
| ChannelLocationContext
|
|
79
|
+
| OpenMiniAppLocationContext
|
|
72
80
|
|
|
73
81
|
export type AccountLocation = {
|
|
74
82
|
placeId: string
|
|
@@ -99,6 +107,7 @@ export type SafeAreaInsets = {
|
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
export type ClientContext = {
|
|
110
|
+
platformType?: MiniAppPlatformType
|
|
102
111
|
clientFid: number
|
|
103
112
|
added: boolean
|
|
104
113
|
notificationDetails?: MiniAppNotificationDetails
|
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
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
import type {
|
|
7
7
|
AddMiniApp,
|
|
8
8
|
ComposeCast,
|
|
9
|
+
OpenMiniApp,
|
|
9
10
|
Ready,
|
|
10
11
|
SendToken,
|
|
11
12
|
SignIn,
|
|
@@ -60,6 +61,7 @@ export const miniAppHostCapabilityList = [
|
|
|
60
61
|
'actions.viewToken',
|
|
61
62
|
'actions.sendToken',
|
|
62
63
|
'actions.swapToken',
|
|
64
|
+
'actions.openMiniApp',
|
|
63
65
|
'haptics.impactOccurred',
|
|
64
66
|
'haptics.notificationOccurred',
|
|
65
67
|
'haptics.selectionChanged',
|
|
@@ -91,6 +93,7 @@ export type WireMiniAppHost = {
|
|
|
91
93
|
viewToken: ViewToken.ViewToken
|
|
92
94
|
sendToken: SendToken.SendToken
|
|
93
95
|
swapToken: SwapToken.SwapToken
|
|
96
|
+
openMiniApp: OpenMiniApp.OpenMiniApp
|
|
94
97
|
composeCast: <close extends boolean | undefined = undefined>(
|
|
95
98
|
options: ComposeCast.Options<close>,
|
|
96
99
|
) => Promise<ComposeCast.Result<close>>
|
|
@@ -124,6 +127,7 @@ export type MiniAppHost = {
|
|
|
124
127
|
viewToken: ViewToken.ViewToken
|
|
125
128
|
sendToken: SendToken.SendToken
|
|
126
129
|
swapToken: SwapToken.SwapToken
|
|
130
|
+
openMiniApp: OpenMiniApp.OpenMiniApp
|
|
127
131
|
composeCast: <close extends boolean | undefined = undefined>(
|
|
128
132
|
options: ComposeCast.Options<close>,
|
|
129
133
|
) => Promise<ComposeCast.Result<close>>
|