@farcaster/miniapp-core 0.0.0-canary-20250630212339

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/actions/AddMiniApp.d.ts +36 -0
  4. package/dist/actions/AddMiniApp.js +57 -0
  5. package/dist/actions/ComposeCast.d.ts +37 -0
  6. package/dist/actions/ComposeCast.js +2 -0
  7. package/dist/actions/Haptics.d.ts +5 -0
  8. package/dist/actions/Haptics.js +2 -0
  9. package/dist/actions/Ready.d.ts +13 -0
  10. package/dist/actions/Ready.js +6 -0
  11. package/dist/actions/SendToken.d.ts +48 -0
  12. package/dist/actions/SendToken.js +2 -0
  13. package/dist/actions/SignIn.d.ts +55 -0
  14. package/dist/actions/SignIn.js +47 -0
  15. package/dist/actions/SwapToken.d.ts +46 -0
  16. package/dist/actions/SwapToken.js +2 -0
  17. package/dist/actions/ViewCast.d.ts +25 -0
  18. package/dist/actions/ViewCast.js +2 -0
  19. package/dist/actions/ViewProfile.d.ts +4 -0
  20. package/dist/actions/ViewProfile.js +2 -0
  21. package/dist/actions/ViewToken.d.ts +4 -0
  22. package/dist/actions/ViewToken.js +2 -0
  23. package/dist/actions/index.d.ts +10 -0
  24. package/dist/actions/index.js +46 -0
  25. package/dist/back.d.ts +13 -0
  26. package/dist/back.js +6 -0
  27. package/dist/context.d.ts +94 -0
  28. package/dist/context.js +2 -0
  29. package/dist/errors.d.ts +13 -0
  30. package/dist/errors.js +12 -0
  31. package/dist/index.d.ts +10 -0
  32. package/dist/index.js +49 -0
  33. package/dist/internal/types.d.ts +8 -0
  34. package/dist/internal/types.js +2 -0
  35. package/dist/manifest.d.ts +113 -0
  36. package/dist/manifest.js +10 -0
  37. package/dist/schemas/embeds.d.ts +128 -0
  38. package/dist/schemas/embeds.js +43 -0
  39. package/dist/schemas/events.d.ts +63 -0
  40. package/dist/schemas/events.js +35 -0
  41. package/dist/schemas/index.d.ts +5 -0
  42. package/dist/schemas/index.js +21 -0
  43. package/dist/schemas/manifest.d.ts +236 -0
  44. package/dist/schemas/manifest.js +127 -0
  45. package/dist/schemas/notifications.d.ts +22 -0
  46. package/dist/schemas/notifications.js +23 -0
  47. package/dist/schemas/shared.d.ts +24 -0
  48. package/dist/schemas/shared.js +110 -0
  49. package/dist/solana.d.ts +72 -0
  50. package/dist/solana.js +15 -0
  51. package/dist/solanaWire.d.ts +3 -0
  52. package/dist/solanaWire.js +84 -0
  53. package/dist/types.d.ts +91 -0
  54. package/dist/types.js +41 -0
  55. package/dist/wallet/ethereum.d.ts +47 -0
  56. package/dist/wallet/ethereum.js +2 -0
  57. package/dist/wallet/index.d.ts +1 -0
  58. package/dist/wallet/index.js +37 -0
  59. package/esm/actions/AddMiniApp.d.ts +36 -0
  60. package/esm/actions/AddMiniApp.js +19 -0
  61. package/esm/actions/ComposeCast.d.ts +37 -0
  62. package/esm/actions/ComposeCast.js +1 -0
  63. package/esm/actions/Haptics.d.ts +5 -0
  64. package/esm/actions/Haptics.js +1 -0
  65. package/esm/actions/Ready.d.ts +13 -0
  66. package/esm/actions/Ready.js +3 -0
  67. package/esm/actions/SendToken.d.ts +48 -0
  68. package/esm/actions/SendToken.js +1 -0
  69. package/esm/actions/SignIn.d.ts +55 -0
  70. package/esm/actions/SignIn.js +10 -0
  71. package/esm/actions/SwapToken.d.ts +46 -0
  72. package/esm/actions/SwapToken.js +1 -0
  73. package/esm/actions/ViewCast.d.ts +25 -0
  74. package/esm/actions/ViewCast.js +1 -0
  75. package/esm/actions/ViewProfile.d.ts +4 -0
  76. package/esm/actions/ViewProfile.js +1 -0
  77. package/esm/actions/ViewToken.d.ts +4 -0
  78. package/esm/actions/ViewToken.js +1 -0
  79. package/esm/actions/index.d.ts +10 -0
  80. package/esm/actions/index.js +10 -0
  81. package/esm/back.d.ts +13 -0
  82. package/esm/back.js +3 -0
  83. package/esm/context.d.ts +94 -0
  84. package/esm/context.js +1 -0
  85. package/esm/errors.d.ts +13 -0
  86. package/esm/errors.js +8 -0
  87. package/esm/index.d.ts +10 -0
  88. package/esm/index.js +10 -0
  89. package/esm/internal/types.d.ts +8 -0
  90. package/esm/internal/types.js +1 -0
  91. package/esm/manifest.d.ts +113 -0
  92. package/esm/manifest.js +7 -0
  93. package/esm/schemas/embeds.d.ts +128 -0
  94. package/esm/schemas/embeds.js +39 -0
  95. package/esm/schemas/events.d.ts +63 -0
  96. package/esm/schemas/events.js +32 -0
  97. package/esm/schemas/index.d.ts +5 -0
  98. package/esm/schemas/index.js +5 -0
  99. package/esm/schemas/manifest.d.ts +236 -0
  100. package/esm/schemas/manifest.js +124 -0
  101. package/esm/schemas/notifications.d.ts +22 -0
  102. package/esm/schemas/notifications.js +20 -0
  103. package/esm/schemas/shared.d.ts +24 -0
  104. package/esm/schemas/shared.js +106 -0
  105. package/esm/solana.d.ts +72 -0
  106. package/esm/solana.js +11 -0
  107. package/esm/solanaWire.d.ts +3 -0
  108. package/esm/solanaWire.js +80 -0
  109. package/esm/tsconfig.tsbuildinfo +1 -0
  110. package/esm/types.d.ts +91 -0
  111. package/esm/types.js +23 -0
  112. package/esm/wallet/ethereum.d.ts +47 -0
  113. package/esm/wallet/ethereum.js +1 -0
  114. package/esm/wallet/index.d.ts +1 -0
  115. package/esm/wallet/index.js +1 -0
  116. package/package.json +42 -0
  117. package/src/actions/AddMiniApp.ts +51 -0
  118. package/src/actions/ComposeCast.ts +44 -0
  119. package/src/actions/Haptics.ts +9 -0
  120. package/src/actions/Ready.ts +15 -0
  121. package/src/actions/SendToken.ts +57 -0
  122. package/src/actions/SignIn.ts +67 -0
  123. package/src/actions/SwapToken.ts +54 -0
  124. package/src/actions/ViewCast.ts +27 -0
  125. package/src/actions/ViewProfile.ts +5 -0
  126. package/src/actions/ViewToken.ts +5 -0
  127. package/src/actions/index.ts +10 -0
  128. package/src/back.ts +15 -0
  129. package/src/context.ts +117 -0
  130. package/src/errors.ts +21 -0
  131. package/src/index.ts +10 -0
  132. package/src/internal/types.ts +20 -0
  133. package/src/manifest.ts +131 -0
  134. package/src/schemas/embeds.ts +58 -0
  135. package/src/schemas/events.ts +57 -0
  136. package/src/schemas/index.ts +5 -0
  137. package/src/schemas/manifest.ts +142 -0
  138. package/src/schemas/notifications.ts +35 -0
  139. package/src/schemas/shared.ts +138 -0
  140. package/src/solana.ts +108 -0
  141. package/src/solanaWire.ts +120 -0
  142. package/src/types.ts +165 -0
  143. package/src/wallet/ethereum.ts +65 -0
  144. package/src/wallet/index.ts +1 -0
@@ -0,0 +1,236 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const domainMiniAppConfigSchema: z.ZodObject<{
3
+ version: z.ZodUnion<readonly [z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;
4
+ name: z.ZodString;
5
+ iconUrl: z.ZodString;
6
+ homeUrl: z.ZodString;
7
+ imageUrl: z.ZodOptional<z.ZodString>;
8
+ buttonTitle: z.ZodOptional<z.ZodString>;
9
+ splashImageUrl: z.ZodOptional<z.ZodString>;
10
+ splashBackgroundColor: z.ZodOptional<z.ZodString>;
11
+ webhookUrl: z.ZodOptional<z.ZodString>;
12
+ subtitle: z.ZodOptional<z.ZodString>;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ screenshotUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ primaryCategory: z.ZodOptional<z.ZodEnum<{
16
+ games: "games";
17
+ social: "social";
18
+ finance: "finance";
19
+ utility: "utility";
20
+ productivity: "productivity";
21
+ "health-fitness": "health-fitness";
22
+ "news-media": "news-media";
23
+ music: "music";
24
+ shopping: "shopping";
25
+ education: "education";
26
+ "developer-tools": "developer-tools";
27
+ entertainment: "entertainment";
28
+ "art-creativity": "art-creativity";
29
+ }>>;
30
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
31
+ heroImageUrl: z.ZodOptional<z.ZodString>;
32
+ tagline: z.ZodOptional<z.ZodString>;
33
+ ogTitle: z.ZodOptional<z.ZodString>;
34
+ ogDescription: z.ZodOptional<z.ZodString>;
35
+ ogImageUrl: z.ZodOptional<z.ZodString>;
36
+ noindex: z.ZodOptional<z.ZodBoolean>;
37
+ requiredChains: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
38
+ "eip155:1": "eip155:1";
39
+ "eip155:8453": "eip155:8453";
40
+ "eip155:42161": "eip155:42161";
41
+ "eip155:421614": "eip155:421614";
42
+ "eip155:84532": "eip155:84532";
43
+ "eip155:666666666": "eip155:666666666";
44
+ "eip155:100": "eip155:100";
45
+ "eip155:10": "eip155:10";
46
+ "eip155:11155420": "eip155:11155420";
47
+ "eip155:137": "eip155:137";
48
+ "eip155:11155111": "eip155:11155111";
49
+ "eip155:7777777": "eip155:7777777";
50
+ "eip155:130": "eip155:130";
51
+ "eip155:10143": "eip155:10143";
52
+ "eip155:42220": "eip155:42220";
53
+ "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
54
+ }>>, z.ZodTransform<("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[], ("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[]>>>;
55
+ requiredCapabilities: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
56
+ "wallet.getEthereumProvider": "wallet.getEthereumProvider";
57
+ "wallet.getSolanaProvider": "wallet.getSolanaProvider";
58
+ "actions.ready": "actions.ready";
59
+ "actions.openUrl": "actions.openUrl";
60
+ "actions.close": "actions.close";
61
+ "actions.setPrimaryButton": "actions.setPrimaryButton";
62
+ "actions.addMiniApp": "actions.addMiniApp";
63
+ "actions.signIn": "actions.signIn";
64
+ "actions.viewCast": "actions.viewCast";
65
+ "actions.viewProfile": "actions.viewProfile";
66
+ "actions.composeCast": "actions.composeCast";
67
+ "actions.viewToken": "actions.viewToken";
68
+ "actions.sendToken": "actions.sendToken";
69
+ "actions.swapToken": "actions.swapToken";
70
+ "haptics.impactOccurred": "haptics.impactOccurred";
71
+ "haptics.notificationOccurred": "haptics.notificationOccurred";
72
+ "haptics.selectionChanged": "haptics.selectionChanged";
73
+ back: "back";
74
+ }>>, z.ZodTransform<("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[], ("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[]>>>;
75
+ castShareUrl: z.ZodOptional<z.ZodString>;
76
+ canonicalDomain: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$strip>;
78
+ export declare const domainManifestSchema: z.ZodObject<{
79
+ accountAssociation: z.ZodObject<{
80
+ header: z.ZodString;
81
+ payload: z.ZodString;
82
+ signature: z.ZodString;
83
+ }, z.core.$strip>;
84
+ miniapp: z.ZodOptional<z.ZodObject<{
85
+ version: z.ZodUnion<readonly [z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;
86
+ name: z.ZodString;
87
+ iconUrl: z.ZodString;
88
+ homeUrl: z.ZodString;
89
+ imageUrl: z.ZodOptional<z.ZodString>;
90
+ buttonTitle: z.ZodOptional<z.ZodString>;
91
+ splashImageUrl: z.ZodOptional<z.ZodString>;
92
+ splashBackgroundColor: z.ZodOptional<z.ZodString>;
93
+ webhookUrl: z.ZodOptional<z.ZodString>;
94
+ subtitle: z.ZodOptional<z.ZodString>;
95
+ description: z.ZodOptional<z.ZodString>;
96
+ screenshotUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
+ primaryCategory: z.ZodOptional<z.ZodEnum<{
98
+ games: "games";
99
+ social: "social";
100
+ finance: "finance";
101
+ utility: "utility";
102
+ productivity: "productivity";
103
+ "health-fitness": "health-fitness";
104
+ "news-media": "news-media";
105
+ music: "music";
106
+ shopping: "shopping";
107
+ education: "education";
108
+ "developer-tools": "developer-tools";
109
+ entertainment: "entertainment";
110
+ "art-creativity": "art-creativity";
111
+ }>>;
112
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
+ heroImageUrl: z.ZodOptional<z.ZodString>;
114
+ tagline: z.ZodOptional<z.ZodString>;
115
+ ogTitle: z.ZodOptional<z.ZodString>;
116
+ ogDescription: z.ZodOptional<z.ZodString>;
117
+ ogImageUrl: z.ZodOptional<z.ZodString>;
118
+ noindex: z.ZodOptional<z.ZodBoolean>;
119
+ requiredChains: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
120
+ "eip155:1": "eip155:1";
121
+ "eip155:8453": "eip155:8453";
122
+ "eip155:42161": "eip155:42161";
123
+ "eip155:421614": "eip155:421614";
124
+ "eip155:84532": "eip155:84532";
125
+ "eip155:666666666": "eip155:666666666";
126
+ "eip155:100": "eip155:100";
127
+ "eip155:10": "eip155:10";
128
+ "eip155:11155420": "eip155:11155420";
129
+ "eip155:137": "eip155:137";
130
+ "eip155:11155111": "eip155:11155111";
131
+ "eip155:7777777": "eip155:7777777";
132
+ "eip155:130": "eip155:130";
133
+ "eip155:10143": "eip155:10143";
134
+ "eip155:42220": "eip155:42220";
135
+ "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
136
+ }>>, z.ZodTransform<("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[], ("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[]>>>;
137
+ requiredCapabilities: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
138
+ "wallet.getEthereumProvider": "wallet.getEthereumProvider";
139
+ "wallet.getSolanaProvider": "wallet.getSolanaProvider";
140
+ "actions.ready": "actions.ready";
141
+ "actions.openUrl": "actions.openUrl";
142
+ "actions.close": "actions.close";
143
+ "actions.setPrimaryButton": "actions.setPrimaryButton";
144
+ "actions.addMiniApp": "actions.addMiniApp";
145
+ "actions.signIn": "actions.signIn";
146
+ "actions.viewCast": "actions.viewCast";
147
+ "actions.viewProfile": "actions.viewProfile";
148
+ "actions.composeCast": "actions.composeCast";
149
+ "actions.viewToken": "actions.viewToken";
150
+ "actions.sendToken": "actions.sendToken";
151
+ "actions.swapToken": "actions.swapToken";
152
+ "haptics.impactOccurred": "haptics.impactOccurred";
153
+ "haptics.notificationOccurred": "haptics.notificationOccurred";
154
+ "haptics.selectionChanged": "haptics.selectionChanged";
155
+ back: "back";
156
+ }>>, z.ZodTransform<("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[], ("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[]>>>;
157
+ castShareUrl: z.ZodOptional<z.ZodString>;
158
+ canonicalDomain: z.ZodOptional<z.ZodString>;
159
+ }, z.core.$strip>>;
160
+ frame: z.ZodOptional<z.ZodObject<{
161
+ version: z.ZodUnion<readonly [z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;
162
+ name: z.ZodString;
163
+ iconUrl: z.ZodString;
164
+ homeUrl: z.ZodString;
165
+ imageUrl: z.ZodOptional<z.ZodString>;
166
+ buttonTitle: z.ZodOptional<z.ZodString>;
167
+ splashImageUrl: z.ZodOptional<z.ZodString>;
168
+ splashBackgroundColor: z.ZodOptional<z.ZodString>;
169
+ webhookUrl: z.ZodOptional<z.ZodString>;
170
+ subtitle: z.ZodOptional<z.ZodString>;
171
+ description: z.ZodOptional<z.ZodString>;
172
+ screenshotUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
173
+ primaryCategory: z.ZodOptional<z.ZodEnum<{
174
+ games: "games";
175
+ social: "social";
176
+ finance: "finance";
177
+ utility: "utility";
178
+ productivity: "productivity";
179
+ "health-fitness": "health-fitness";
180
+ "news-media": "news-media";
181
+ music: "music";
182
+ shopping: "shopping";
183
+ education: "education";
184
+ "developer-tools": "developer-tools";
185
+ entertainment: "entertainment";
186
+ "art-creativity": "art-creativity";
187
+ }>>;
188
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
189
+ heroImageUrl: z.ZodOptional<z.ZodString>;
190
+ tagline: z.ZodOptional<z.ZodString>;
191
+ ogTitle: z.ZodOptional<z.ZodString>;
192
+ ogDescription: z.ZodOptional<z.ZodString>;
193
+ ogImageUrl: z.ZodOptional<z.ZodString>;
194
+ noindex: z.ZodOptional<z.ZodBoolean>;
195
+ requiredChains: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
196
+ "eip155:1": "eip155:1";
197
+ "eip155:8453": "eip155:8453";
198
+ "eip155:42161": "eip155:42161";
199
+ "eip155:421614": "eip155:421614";
200
+ "eip155:84532": "eip155:84532";
201
+ "eip155:666666666": "eip155:666666666";
202
+ "eip155:100": "eip155:100";
203
+ "eip155:10": "eip155:10";
204
+ "eip155:11155420": "eip155:11155420";
205
+ "eip155:137": "eip155:137";
206
+ "eip155:11155111": "eip155:11155111";
207
+ "eip155:7777777": "eip155:7777777";
208
+ "eip155:130": "eip155:130";
209
+ "eip155:10143": "eip155:10143";
210
+ "eip155:42220": "eip155:42220";
211
+ "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
212
+ }>>, z.ZodTransform<("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[], ("eip155:1" | "eip155:8453" | "eip155:42161" | "eip155:421614" | "eip155:84532" | "eip155:666666666" | "eip155:100" | "eip155:10" | "eip155:11155420" | "eip155:137" | "eip155:11155111" | "eip155:7777777" | "eip155:130" | "eip155:10143" | "eip155:42220" | "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")[]>>>;
213
+ requiredCapabilities: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodEnum<{
214
+ "wallet.getEthereumProvider": "wallet.getEthereumProvider";
215
+ "wallet.getSolanaProvider": "wallet.getSolanaProvider";
216
+ "actions.ready": "actions.ready";
217
+ "actions.openUrl": "actions.openUrl";
218
+ "actions.close": "actions.close";
219
+ "actions.setPrimaryButton": "actions.setPrimaryButton";
220
+ "actions.addMiniApp": "actions.addMiniApp";
221
+ "actions.signIn": "actions.signIn";
222
+ "actions.viewCast": "actions.viewCast";
223
+ "actions.viewProfile": "actions.viewProfile";
224
+ "actions.composeCast": "actions.composeCast";
225
+ "actions.viewToken": "actions.viewToken";
226
+ "actions.sendToken": "actions.sendToken";
227
+ "actions.swapToken": "actions.swapToken";
228
+ "haptics.impactOccurred": "haptics.impactOccurred";
229
+ "haptics.notificationOccurred": "haptics.notificationOccurred";
230
+ "haptics.selectionChanged": "haptics.selectionChanged";
231
+ back: "back";
232
+ }>>, z.ZodTransform<("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[], ("wallet.getEthereumProvider" | "wallet.getSolanaProvider" | "actions.ready" | "actions.openUrl" | "actions.close" | "actions.setPrimaryButton" | "actions.addMiniApp" | "actions.signIn" | "actions.viewCast" | "actions.viewProfile" | "actions.composeCast" | "actions.viewToken" | "actions.sendToken" | "actions.swapToken" | "haptics.impactOccurred" | "haptics.notificationOccurred" | "haptics.selectionChanged" | "back")[]>>>;
233
+ castShareUrl: z.ZodOptional<z.ZodString>;
234
+ canonicalDomain: z.ZodOptional<z.ZodString>;
235
+ }, z.core.$strip>>;
236
+ }, z.core.$strip>;
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod/v4';
2
+ import { miniAppHostCapabilityList } from "../types.js";
3
+ import { buttonTitleSchema, createSimpleStringSchema, domainSchema, encodedJsonFarcasterSignatureSchema, hexColorSchema, miniAppNameSchema, secureUrlSchema, } from "./shared.js";
4
+ const primaryCategorySchema = z.enum([
5
+ 'games',
6
+ 'social',
7
+ 'finance',
8
+ 'utility',
9
+ 'productivity',
10
+ 'health-fitness',
11
+ 'news-media',
12
+ 'music',
13
+ 'shopping',
14
+ 'education',
15
+ 'developer-tools',
16
+ 'entertainment',
17
+ 'art-creativity',
18
+ ]);
19
+ const chainList = [
20
+ 'eip155:1', // Ethereum mainnet
21
+ 'eip155:8453', // Base mainnet
22
+ 'eip155:42161', // Arbitrum One
23
+ 'eip155:421614', // Arbitrum Sepolia
24
+ 'eip155:84532', // Base Sepolia
25
+ 'eip155:666666666', // Degen
26
+ 'eip155:100', // Gnosis
27
+ 'eip155:10', // Optimism
28
+ 'eip155:11155420', // Optimism Sepolia
29
+ 'eip155:137', // Polygon
30
+ 'eip155:11155111', // Ethereum Sepolia
31
+ 'eip155:7777777', // Zora
32
+ 'eip155:130', // Unichain
33
+ 'eip155:10143', // Monad testnet
34
+ 'eip155:42220', // Celo
35
+ 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', // Solana
36
+ ];
37
+ function removeArrayDuplicates(arr) {
38
+ const set = new Set(arr);
39
+ return Array.from(set);
40
+ }
41
+ export const domainMiniAppConfigSchema = z
42
+ .object({
43
+ // 0.0.0 and 0.0.1 are not technically part of the spec but kept for
44
+ // backwards compatibility. next should always resolve to the most recent
45
+ // schema version.
46
+ version: z.union([
47
+ z.literal('0.0.0'),
48
+ z.literal('0.0.1'),
49
+ z.literal('1'),
50
+ z.literal('next'),
51
+ ]),
52
+ name: miniAppNameSchema,
53
+ iconUrl: secureUrlSchema,
54
+ homeUrl: secureUrlSchema,
55
+ /** deprecated, set ogImageUrl instead */
56
+ imageUrl: secureUrlSchema.optional(),
57
+ /** deprecated, will rely on fc:frame/fc:miniapp meta tag */
58
+ buttonTitle: buttonTitleSchema.optional(),
59
+ splashImageUrl: secureUrlSchema.optional(),
60
+ splashBackgroundColor: hexColorSchema.optional(),
61
+ webhookUrl: secureUrlSchema.optional(),
62
+ /** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
63
+ subtitle: createSimpleStringSchema({ max: 30 }).optional(),
64
+ description: createSimpleStringSchema({ max: 170 }).optional(),
65
+ screenshotUrls: z.array(secureUrlSchema).max(3).optional(),
66
+ primaryCategory: primaryCategorySchema.optional(),
67
+ tags: z
68
+ .array(createSimpleStringSchema({ max: 20, noSpaces: true }))
69
+ .max(5)
70
+ .optional(),
71
+ heroImageUrl: secureUrlSchema.optional(),
72
+ tagline: createSimpleStringSchema({ max: 30 }).optional(),
73
+ ogTitle: createSimpleStringSchema({ max: 30 }).optional(),
74
+ ogDescription: createSimpleStringSchema({ max: 100 }).optional(),
75
+ ogImageUrl: secureUrlSchema.optional(),
76
+ /** see: https://github.com/farcasterxyz/miniapps/discussions/204 */
77
+ noindex: z.boolean().optional(),
78
+ /** see https://github.com/farcasterxyz/miniapps/discussions/256 */
79
+ requiredChains: z
80
+ .array(z.enum(chainList))
81
+ .transform(removeArrayDuplicates)
82
+ .optional(),
83
+ requiredCapabilities: z
84
+ .array(z.enum(miniAppHostCapabilityList))
85
+ .transform(removeArrayDuplicates)
86
+ .optional(),
87
+ /** see https://github.com/farcasterxyz/miniapps/discussions/158 */
88
+ /** Documentation will be added once this feature is finalized. */
89
+ castShareUrl: secureUrlSchema.optional(),
90
+ /** Canonical domain for the miniapp application */
91
+ canonicalDomain: domainSchema.optional(),
92
+ })
93
+ .refine((data) => {
94
+ if (data.castShareUrl === undefined)
95
+ return true;
96
+ try {
97
+ const homeUrlDomain = new URL(data.homeUrl).hostname;
98
+ const castShareUrlDomain = new URL(data.castShareUrl).hostname;
99
+ return homeUrlDomain === castShareUrlDomain;
100
+ }
101
+ catch {
102
+ return false;
103
+ }
104
+ }, {
105
+ message: 'castShareUrl must have the same domain as homeUrl',
106
+ path: ['castShareUrl'],
107
+ });
108
+ export const domainManifestSchema = z
109
+ .object({
110
+ accountAssociation: encodedJsonFarcasterSignatureSchema,
111
+ miniapp: domainMiniAppConfigSchema.optional(),
112
+ // Support both 'frame' and 'miniapp' during transition period
113
+ frame: domainMiniAppConfigSchema.optional(),
114
+ })
115
+ .refine((data) => {
116
+ // If both are provided, they must be identical
117
+ if (data.frame && data.miniapp) {
118
+ return JSON.stringify(data.frame) === JSON.stringify(data.miniapp);
119
+ }
120
+ return true;
121
+ }, {
122
+ message: 'If both "frame" and "miniapp" are provided, they must be identical',
123
+ path: ['frame', 'miniapp'],
124
+ });
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const notificationDetailsSchema: z.ZodObject<{
3
+ url: z.ZodString;
4
+ token: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type MiniAppNotificationDetails = z.infer<typeof notificationDetailsSchema>;
7
+ export declare const sendNotificationRequestSchema: z.ZodObject<{
8
+ notificationId: z.ZodString;
9
+ title: z.ZodString;
10
+ body: z.ZodString;
11
+ targetUrl: z.ZodString;
12
+ tokens: z.ZodArray<z.ZodString>;
13
+ }, z.core.$strip>;
14
+ export type SendNotificationRequest = z.infer<typeof sendNotificationRequestSchema>;
15
+ export declare const sendNotificationResponseSchema: z.ZodObject<{
16
+ result: z.ZodObject<{
17
+ successfulTokens: z.ZodArray<z.ZodString>;
18
+ invalidTokens: z.ZodArray<z.ZodString>;
19
+ rateLimitedTokens: z.ZodArray<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ }, z.core.$strip>;
22
+ export type SendNotificationResponse = z.infer<typeof sendNotificationResponseSchema>;
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod/v4';
2
+ import { secureUrlSchema } from "./shared.js";
3
+ export const notificationDetailsSchema = z.object({
4
+ url: z.string(),
5
+ token: z.string(),
6
+ });
7
+ export const sendNotificationRequestSchema = z.object({
8
+ notificationId: z.string().max(128),
9
+ title: z.string().max(32),
10
+ body: z.string().max(128),
11
+ targetUrl: secureUrlSchema,
12
+ tokens: z.string().array().max(100),
13
+ });
14
+ export const sendNotificationResponseSchema = z.object({
15
+ result: z.object({
16
+ successfulTokens: z.array(z.string()),
17
+ invalidTokens: z.array(z.string()),
18
+ rateLimitedTokens: z.array(z.string()),
19
+ }),
20
+ });
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const createSimpleStringSchema: ({ max, noSpaces, }?: {
3
+ max?: number;
4
+ noSpaces?: boolean;
5
+ }) => z.ZodString;
6
+ export declare const secureUrlSchema: z.ZodString;
7
+ export declare const miniAppNameSchema: z.ZodString;
8
+ export declare const buttonTitleSchema: z.ZodString;
9
+ export declare const caip19TokenSchema: z.ZodString;
10
+ export declare const hexColorSchema: z.ZodString;
11
+ export declare const domainSchema: z.ZodString;
12
+ export declare const aspectRatioSchema: z.ZodUnion<readonly [z.ZodLiteral<"1:1">, z.ZodLiteral<"3:2">]>;
13
+ export declare const encodedJsonFarcasterSignatureSchema: z.ZodObject<{
14
+ header: z.ZodString;
15
+ payload: z.ZodString;
16
+ signature: z.ZodString;
17
+ }, z.core.$strip>;
18
+ export type EncodedJsonFarcasterSignatureSchema = z.infer<typeof encodedJsonFarcasterSignatureSchema>;
19
+ export declare const jsonFarcasterSignatureHeaderSchema: z.ZodObject<{
20
+ fid: z.ZodNumber;
21
+ type: z.ZodLiteral<"app_key">;
22
+ key: z.ZodString;
23
+ }, z.core.$strip>;
24
+ export type JsonFarcasterSignatureHeaderSchema = z.infer<typeof jsonFarcasterSignatureHeaderSchema>;
@@ -0,0 +1,106 @@
1
+ import { z } from 'zod/v4';
2
+ const SPECIAL_CHARS_PATTERN = /[@#$%^&*+=\/\\|~«»]/;
3
+ const REPEATED_PUNCTUATION_PATTERN = /(!{2,}|\?{2,}|-{2,})/;
4
+ // Unicode ranges for emoji detection:
5
+ // \u{1F300}-\u{1F9FF} - Miscellaneous Symbols, Pictographs, Emoticons, Transport, Map, and Supplemental
6
+ // \u{2702}-\u{27B0} - Dingbats
7
+ // \u{2600}-\u{26FF} - Miscellaneous Symbols
8
+ // \u{2B00}-\u{2BFF} - Miscellaneous Symbols and Arrows
9
+ const EMOJI_PATTERN = /[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u;
10
+ export const createSimpleStringSchema = ({ max, noSpaces, } = {}) => {
11
+ const stringValidations = noSpaces
12
+ ? z
13
+ .string()
14
+ .max(max ?? Number.POSITIVE_INFINITY)
15
+ .regex(/^\S*$/, 'Spaces are not allowed')
16
+ : z.string().max(max ?? Number.POSITIVE_INFINITY);
17
+ return stringValidations
18
+ .refine((value) => !EMOJI_PATTERN.test(value), {
19
+ message: 'Emojis and symbols are not allowed',
20
+ })
21
+ .refine((value) => !SPECIAL_CHARS_PATTERN.test(value), {
22
+ message: 'Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed',
23
+ })
24
+ .refine((value) => !REPEATED_PUNCTUATION_PATTERN.test(value), {
25
+ message: 'Repeated punctuations (!!, ??, --) are not allowed',
26
+ });
27
+ };
28
+ export const secureUrlSchema = z
29
+ .string()
30
+ .url()
31
+ .startsWith('https://', { message: 'Must be an https url' })
32
+ .max(1024)
33
+ .refine((url) => !url.includes(' '), {
34
+ message: 'URL must not contain spaces',
35
+ })
36
+ .refine((url) => {
37
+ try {
38
+ const hostname = new URL(url).hostname;
39
+ // Check for localhost
40
+ if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
41
+ return false;
42
+ }
43
+ // Check for IPv4 addresses
44
+ const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
45
+ if (ipv4Regex.test(hostname)) {
46
+ return false;
47
+ }
48
+ // Check for IPv6 addresses (including brackets)
49
+ if (hostname.startsWith('[') && hostname.endsWith(']')) {
50
+ return false;
51
+ }
52
+ return true;
53
+ }
54
+ catch {
55
+ return false;
56
+ }
57
+ }, {
58
+ message: 'URL must not use IP addresses or localhost',
59
+ });
60
+ export const miniAppNameSchema = z.string().max(32);
61
+ export const buttonTitleSchema = z.string().max(32);
62
+ const CAIP_19_REGEX = /^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/;
63
+ export const caip19TokenSchema = z
64
+ .string()
65
+ .regex(CAIP_19_REGEX, { message: 'Invalid CAIP-19 asset ID' });
66
+ export const hexColorSchema = z
67
+ .string()
68
+ .regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
69
+ message: 'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
70
+ });
71
+ // Domain validation regex:
72
+ // - Each label (part between dots) must start and end with alphanumeric
73
+ // - Labels can contain hyphens in the middle
74
+ // - Cannot have consecutive dots
75
+ // - Must have at least one dot (TLD required)
76
+ // - TLD must be at least 2 characters and only letters
77
+ const DOMAIN_REGEX = /^(?!.*\.\.)([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
78
+ export const domainSchema = z
79
+ .string()
80
+ .max(1024)
81
+ .regex(DOMAIN_REGEX, {
82
+ message: 'Must be a valid domain name (e.g., example.com, sub.example.com)',
83
+ })
84
+ .refine((value) => !value.includes('://'), {
85
+ message: 'Domain must not include protocol (http://, https://, etc.)',
86
+ })
87
+ .refine((value) => !value.includes('/'), {
88
+ message: 'Domain must not include path separators',
89
+ })
90
+ .refine((value) => !value.includes('@'), {
91
+ message: 'Domain must not include @ symbol',
92
+ })
93
+ .refine((value) => !value.includes(':'), {
94
+ message: 'Domain must not include port numbers',
95
+ });
96
+ export const aspectRatioSchema = z.union([z.literal('1:1'), z.literal('3:2')]);
97
+ export const encodedJsonFarcasterSignatureSchema = z.object({
98
+ header: z.string(),
99
+ payload: z.string(),
100
+ signature: z.string(),
101
+ });
102
+ export const jsonFarcasterSignatureHeaderSchema = z.object({
103
+ fid: z.number(),
104
+ type: z.literal('app_key'),
105
+ key: z.string().startsWith('0x'),
106
+ });
@@ -0,0 +1,72 @@
1
+ import { Connection as SolanaConnection, type SendOptions as SolanaSendOptions, type Transaction as SolanaTransaction, type VersionedTransaction as SolanaVersionedTransaction } from '@solana/web3.js';
2
+ export { SolanaConnection };
3
+ export type { SolanaSendOptions };
4
+ export type SolanaCombinedTransaction = SolanaTransaction | SolanaVersionedTransaction;
5
+ export type SolanaConnectRequestArguments = {
6
+ method: 'connect';
7
+ };
8
+ export type SolanaSignMessageRequestArguments = {
9
+ method: 'signMessage';
10
+ params: {
11
+ message: string;
12
+ };
13
+ };
14
+ export type SolanaSignAndSendTransactionRequestArguments = {
15
+ method: 'signAndSendTransaction';
16
+ params: {
17
+ transaction: SolanaCombinedTransaction;
18
+ options?: SolanaSendOptions;
19
+ };
20
+ };
21
+ export type SolanaSignTransactionRequestArguments<T extends SolanaCombinedTransaction = SolanaTransaction> = {
22
+ method: 'signTransaction';
23
+ params: {
24
+ transaction: T;
25
+ };
26
+ };
27
+ export type SolanaRequestFn = ((request: SolanaConnectRequestArguments) => Promise<{
28
+ publicKey: string;
29
+ }>) & ((request: SolanaSignMessageRequestArguments) => Promise<{
30
+ signature: string;
31
+ }>) & ((request: SolanaSignAndSendTransactionRequestArguments) => Promise<{
32
+ signature: string;
33
+ }>) & (<T extends SolanaCombinedTransaction>(request: SolanaSignTransactionRequestArguments<T>) => Promise<{
34
+ signedTransaction: T;
35
+ }>);
36
+ export interface SolanaWalletProvider {
37
+ request: SolanaRequestFn;
38
+ signMessage(message: string): Promise<{
39
+ signature: string;
40
+ }>;
41
+ signTransaction<T extends SolanaCombinedTransaction>(transaction: T): Promise<{
42
+ signedTransaction: T;
43
+ }>;
44
+ signAndSendTransaction(input: {
45
+ transaction: SolanaCombinedTransaction;
46
+ }): Promise<{
47
+ signature: string;
48
+ }>;
49
+ }
50
+ export declare const createSolanaWalletProvider: (request: SolanaRequestFn) => SolanaWalletProvider;
51
+ export type SolanaWireSignAndSendTransactionRequestArguments = {
52
+ method: 'signAndSendTransaction';
53
+ params: {
54
+ transaction: string;
55
+ options?: SolanaSendOptions;
56
+ };
57
+ };
58
+ export type SolanaWireSignTransactionRequestArguments = {
59
+ method: 'signTransaction';
60
+ params: {
61
+ transaction: string;
62
+ };
63
+ };
64
+ export type SolanaWireRequestFn = ((request: SolanaConnectRequestArguments) => Promise<{
65
+ publicKey: string;
66
+ }>) & ((request: SolanaSignMessageRequestArguments) => Promise<{
67
+ signature: string;
68
+ }>) & ((request: SolanaWireSignAndSendTransactionRequestArguments) => Promise<{
69
+ signature: string;
70
+ }>) & ((request: SolanaWireSignTransactionRequestArguments) => Promise<{
71
+ signedTransaction: string;
72
+ }>);
package/esm/solana.js ADDED
@@ -0,0 +1,11 @@
1
+ import { Connection as SolanaConnection, } from '@solana/web3.js';
2
+ export { SolanaConnection };
3
+ export const createSolanaWalletProvider = (request) => ({
4
+ request,
5
+ signMessage: (msg) => request({ method: 'signMessage', params: { message: msg } }),
6
+ signTransaction: (transaction) => request({ method: 'signTransaction', params: { transaction } }),
7
+ signAndSendTransaction: (input) => request({
8
+ method: 'signAndSendTransaction',
9
+ params: input,
10
+ }),
11
+ });
@@ -0,0 +1,3 @@
1
+ import type { SolanaRequestFn, SolanaWireRequestFn } from './solana.ts';
2
+ export declare function wrapSolanaProviderRequest(requestFn: SolanaRequestFn): SolanaWireRequestFn;
3
+ export declare function unwrapSolanaProviderRequest(wrappedRequestFn: SolanaWireRequestFn): SolanaRequestFn;