@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.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/actions/AddMiniApp.d.ts +36 -0
- package/dist/actions/AddMiniApp.js +57 -0
- package/dist/actions/ComposeCast.d.ts +37 -0
- package/dist/actions/ComposeCast.js +2 -0
- package/dist/actions/Haptics.d.ts +5 -0
- package/dist/actions/Haptics.js +2 -0
- package/dist/actions/Ready.d.ts +13 -0
- package/dist/actions/Ready.js +6 -0
- package/dist/actions/SendToken.d.ts +48 -0
- package/dist/actions/SendToken.js +2 -0
- package/dist/actions/SignIn.d.ts +55 -0
- package/dist/actions/SignIn.js +47 -0
- package/dist/actions/SwapToken.d.ts +46 -0
- package/dist/actions/SwapToken.js +2 -0
- package/dist/actions/ViewCast.d.ts +25 -0
- package/dist/actions/ViewCast.js +2 -0
- package/dist/actions/ViewProfile.d.ts +4 -0
- package/dist/actions/ViewProfile.js +2 -0
- package/dist/actions/ViewToken.d.ts +4 -0
- package/dist/actions/ViewToken.js +2 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +46 -0
- package/dist/back.d.ts +13 -0
- package/dist/back.js +6 -0
- package/dist/context.d.ts +94 -0
- package/dist/context.js +2 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +12 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +49 -0
- package/dist/internal/types.d.ts +8 -0
- package/dist/internal/types.js +2 -0
- package/dist/manifest.d.ts +113 -0
- package/dist/manifest.js +10 -0
- package/dist/schemas/embeds.d.ts +128 -0
- package/dist/schemas/embeds.js +43 -0
- package/dist/schemas/events.d.ts +63 -0
- package/dist/schemas/events.js +35 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +21 -0
- package/dist/schemas/manifest.d.ts +236 -0
- package/dist/schemas/manifest.js +127 -0
- package/dist/schemas/notifications.d.ts +22 -0
- package/dist/schemas/notifications.js +23 -0
- package/dist/schemas/shared.d.ts +24 -0
- package/dist/schemas/shared.js +110 -0
- package/dist/solana.d.ts +72 -0
- package/dist/solana.js +15 -0
- package/dist/solanaWire.d.ts +3 -0
- package/dist/solanaWire.js +84 -0
- package/dist/types.d.ts +91 -0
- package/dist/types.js +41 -0
- package/dist/wallet/ethereum.d.ts +47 -0
- package/dist/wallet/ethereum.js +2 -0
- package/dist/wallet/index.d.ts +1 -0
- package/dist/wallet/index.js +37 -0
- package/esm/actions/AddMiniApp.d.ts +36 -0
- package/esm/actions/AddMiniApp.js +19 -0
- package/esm/actions/ComposeCast.d.ts +37 -0
- package/esm/actions/ComposeCast.js +1 -0
- package/esm/actions/Haptics.d.ts +5 -0
- package/esm/actions/Haptics.js +1 -0
- package/esm/actions/Ready.d.ts +13 -0
- package/esm/actions/Ready.js +3 -0
- package/esm/actions/SendToken.d.ts +48 -0
- package/esm/actions/SendToken.js +1 -0
- package/esm/actions/SignIn.d.ts +55 -0
- package/esm/actions/SignIn.js +10 -0
- package/esm/actions/SwapToken.d.ts +46 -0
- package/esm/actions/SwapToken.js +1 -0
- package/esm/actions/ViewCast.d.ts +25 -0
- package/esm/actions/ViewCast.js +1 -0
- package/esm/actions/ViewProfile.d.ts +4 -0
- package/esm/actions/ViewProfile.js +1 -0
- package/esm/actions/ViewToken.d.ts +4 -0
- package/esm/actions/ViewToken.js +1 -0
- package/esm/actions/index.d.ts +10 -0
- package/esm/actions/index.js +10 -0
- package/esm/back.d.ts +13 -0
- package/esm/back.js +3 -0
- package/esm/context.d.ts +94 -0
- package/esm/context.js +1 -0
- package/esm/errors.d.ts +13 -0
- package/esm/errors.js +8 -0
- package/esm/index.d.ts +10 -0
- package/esm/index.js +10 -0
- package/esm/internal/types.d.ts +8 -0
- package/esm/internal/types.js +1 -0
- package/esm/manifest.d.ts +113 -0
- package/esm/manifest.js +7 -0
- package/esm/schemas/embeds.d.ts +128 -0
- package/esm/schemas/embeds.js +39 -0
- package/esm/schemas/events.d.ts +63 -0
- package/esm/schemas/events.js +32 -0
- package/esm/schemas/index.d.ts +5 -0
- package/esm/schemas/index.js +5 -0
- package/esm/schemas/manifest.d.ts +236 -0
- package/esm/schemas/manifest.js +124 -0
- package/esm/schemas/notifications.d.ts +22 -0
- package/esm/schemas/notifications.js +20 -0
- package/esm/schemas/shared.d.ts +24 -0
- package/esm/schemas/shared.js +106 -0
- package/esm/solana.d.ts +72 -0
- package/esm/solana.js +11 -0
- package/esm/solanaWire.d.ts +3 -0
- package/esm/solanaWire.js +80 -0
- package/esm/tsconfig.tsbuildinfo +1 -0
- package/esm/types.d.ts +91 -0
- package/esm/types.js +23 -0
- package/esm/wallet/ethereum.d.ts +47 -0
- package/esm/wallet/ethereum.js +1 -0
- package/esm/wallet/index.d.ts +1 -0
- package/esm/wallet/index.js +1 -0
- package/package.json +42 -0
- package/src/actions/AddMiniApp.ts +51 -0
- package/src/actions/ComposeCast.ts +44 -0
- package/src/actions/Haptics.ts +9 -0
- package/src/actions/Ready.ts +15 -0
- package/src/actions/SendToken.ts +57 -0
- package/src/actions/SignIn.ts +67 -0
- package/src/actions/SwapToken.ts +54 -0
- package/src/actions/ViewCast.ts +27 -0
- package/src/actions/ViewProfile.ts +5 -0
- package/src/actions/ViewToken.ts +5 -0
- package/src/actions/index.ts +10 -0
- package/src/back.ts +15 -0
- package/src/context.ts +117 -0
- package/src/errors.ts +21 -0
- package/src/index.ts +10 -0
- package/src/internal/types.ts +20 -0
- package/src/manifest.ts +131 -0
- package/src/schemas/embeds.ts +58 -0
- package/src/schemas/events.ts +57 -0
- package/src/schemas/index.ts +5 -0
- package/src/schemas/manifest.ts +142 -0
- package/src/schemas/notifications.ts +35 -0
- package/src/schemas/shared.ts +138 -0
- package/src/solana.ts +108 -0
- package/src/solanaWire.ts +120 -0
- package/src/types.ts +165 -0
- package/src/wallet/ethereum.ts +65 -0
- 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,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.domainManifestSchema = exports.domainMiniAppConfigSchema = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const types_ts_1 = require("../types.js");
|
|
6
|
+
const shared_ts_1 = require("./shared.js");
|
|
7
|
+
const primaryCategorySchema = v4_1.z.enum([
|
|
8
|
+
'games',
|
|
9
|
+
'social',
|
|
10
|
+
'finance',
|
|
11
|
+
'utility',
|
|
12
|
+
'productivity',
|
|
13
|
+
'health-fitness',
|
|
14
|
+
'news-media',
|
|
15
|
+
'music',
|
|
16
|
+
'shopping',
|
|
17
|
+
'education',
|
|
18
|
+
'developer-tools',
|
|
19
|
+
'entertainment',
|
|
20
|
+
'art-creativity',
|
|
21
|
+
]);
|
|
22
|
+
const chainList = [
|
|
23
|
+
'eip155:1', // Ethereum mainnet
|
|
24
|
+
'eip155:8453', // Base mainnet
|
|
25
|
+
'eip155:42161', // Arbitrum One
|
|
26
|
+
'eip155:421614', // Arbitrum Sepolia
|
|
27
|
+
'eip155:84532', // Base Sepolia
|
|
28
|
+
'eip155:666666666', // Degen
|
|
29
|
+
'eip155:100', // Gnosis
|
|
30
|
+
'eip155:10', // Optimism
|
|
31
|
+
'eip155:11155420', // Optimism Sepolia
|
|
32
|
+
'eip155:137', // Polygon
|
|
33
|
+
'eip155:11155111', // Ethereum Sepolia
|
|
34
|
+
'eip155:7777777', // Zora
|
|
35
|
+
'eip155:130', // Unichain
|
|
36
|
+
'eip155:10143', // Monad testnet
|
|
37
|
+
'eip155:42220', // Celo
|
|
38
|
+
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', // Solana
|
|
39
|
+
];
|
|
40
|
+
function removeArrayDuplicates(arr) {
|
|
41
|
+
const set = new Set(arr);
|
|
42
|
+
return Array.from(set);
|
|
43
|
+
}
|
|
44
|
+
exports.domainMiniAppConfigSchema = v4_1.z
|
|
45
|
+
.object({
|
|
46
|
+
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for
|
|
47
|
+
// backwards compatibility. next should always resolve to the most recent
|
|
48
|
+
// schema version.
|
|
49
|
+
version: v4_1.z.union([
|
|
50
|
+
v4_1.z.literal('0.0.0'),
|
|
51
|
+
v4_1.z.literal('0.0.1'),
|
|
52
|
+
v4_1.z.literal('1'),
|
|
53
|
+
v4_1.z.literal('next'),
|
|
54
|
+
]),
|
|
55
|
+
name: shared_ts_1.miniAppNameSchema,
|
|
56
|
+
iconUrl: shared_ts_1.secureUrlSchema,
|
|
57
|
+
homeUrl: shared_ts_1.secureUrlSchema,
|
|
58
|
+
/** deprecated, set ogImageUrl instead */
|
|
59
|
+
imageUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
60
|
+
/** deprecated, will rely on fc:frame/fc:miniapp meta tag */
|
|
61
|
+
buttonTitle: shared_ts_1.buttonTitleSchema.optional(),
|
|
62
|
+
splashImageUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
63
|
+
splashBackgroundColor: shared_ts_1.hexColorSchema.optional(),
|
|
64
|
+
webhookUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
65
|
+
/** see: https://github.com/farcasterxyz/miniapps/discussions/191 */
|
|
66
|
+
subtitle: (0, shared_ts_1.createSimpleStringSchema)({ max: 30 }).optional(),
|
|
67
|
+
description: (0, shared_ts_1.createSimpleStringSchema)({ max: 170 }).optional(),
|
|
68
|
+
screenshotUrls: v4_1.z.array(shared_ts_1.secureUrlSchema).max(3).optional(),
|
|
69
|
+
primaryCategory: primaryCategorySchema.optional(),
|
|
70
|
+
tags: v4_1.z
|
|
71
|
+
.array((0, shared_ts_1.createSimpleStringSchema)({ max: 20, noSpaces: true }))
|
|
72
|
+
.max(5)
|
|
73
|
+
.optional(),
|
|
74
|
+
heroImageUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
75
|
+
tagline: (0, shared_ts_1.createSimpleStringSchema)({ max: 30 }).optional(),
|
|
76
|
+
ogTitle: (0, shared_ts_1.createSimpleStringSchema)({ max: 30 }).optional(),
|
|
77
|
+
ogDescription: (0, shared_ts_1.createSimpleStringSchema)({ max: 100 }).optional(),
|
|
78
|
+
ogImageUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
79
|
+
/** see: https://github.com/farcasterxyz/miniapps/discussions/204 */
|
|
80
|
+
noindex: v4_1.z.boolean().optional(),
|
|
81
|
+
/** see https://github.com/farcasterxyz/miniapps/discussions/256 */
|
|
82
|
+
requiredChains: v4_1.z
|
|
83
|
+
.array(v4_1.z.enum(chainList))
|
|
84
|
+
.transform(removeArrayDuplicates)
|
|
85
|
+
.optional(),
|
|
86
|
+
requiredCapabilities: v4_1.z
|
|
87
|
+
.array(v4_1.z.enum(types_ts_1.miniAppHostCapabilityList))
|
|
88
|
+
.transform(removeArrayDuplicates)
|
|
89
|
+
.optional(),
|
|
90
|
+
/** see https://github.com/farcasterxyz/miniapps/discussions/158 */
|
|
91
|
+
/** Documentation will be added once this feature is finalized. */
|
|
92
|
+
castShareUrl: shared_ts_1.secureUrlSchema.optional(),
|
|
93
|
+
/** Canonical domain for the miniapp application */
|
|
94
|
+
canonicalDomain: shared_ts_1.domainSchema.optional(),
|
|
95
|
+
})
|
|
96
|
+
.refine((data) => {
|
|
97
|
+
if (data.castShareUrl === undefined)
|
|
98
|
+
return true;
|
|
99
|
+
try {
|
|
100
|
+
const homeUrlDomain = new URL(data.homeUrl).hostname;
|
|
101
|
+
const castShareUrlDomain = new URL(data.castShareUrl).hostname;
|
|
102
|
+
return homeUrlDomain === castShareUrlDomain;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
message: 'castShareUrl must have the same domain as homeUrl',
|
|
109
|
+
path: ['castShareUrl'],
|
|
110
|
+
});
|
|
111
|
+
exports.domainManifestSchema = v4_1.z
|
|
112
|
+
.object({
|
|
113
|
+
accountAssociation: shared_ts_1.encodedJsonFarcasterSignatureSchema,
|
|
114
|
+
miniapp: exports.domainMiniAppConfigSchema.optional(),
|
|
115
|
+
// Support both 'frame' and 'miniapp' during transition period
|
|
116
|
+
frame: exports.domainMiniAppConfigSchema.optional(),
|
|
117
|
+
})
|
|
118
|
+
.refine((data) => {
|
|
119
|
+
// If both are provided, they must be identical
|
|
120
|
+
if (data.frame && data.miniapp) {
|
|
121
|
+
return JSON.stringify(data.frame) === JSON.stringify(data.miniapp);
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}, {
|
|
125
|
+
message: 'If both "frame" and "miniapp" are provided, they must be identical',
|
|
126
|
+
path: ['frame', 'miniapp'],
|
|
127
|
+
});
|
|
@@ -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,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendNotificationResponseSchema = exports.sendNotificationRequestSchema = exports.notificationDetailsSchema = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const shared_ts_1 = require("./shared.js");
|
|
6
|
+
exports.notificationDetailsSchema = v4_1.z.object({
|
|
7
|
+
url: v4_1.z.string(),
|
|
8
|
+
token: v4_1.z.string(),
|
|
9
|
+
});
|
|
10
|
+
exports.sendNotificationRequestSchema = v4_1.z.object({
|
|
11
|
+
notificationId: v4_1.z.string().max(128),
|
|
12
|
+
title: v4_1.z.string().max(32),
|
|
13
|
+
body: v4_1.z.string().max(128),
|
|
14
|
+
targetUrl: shared_ts_1.secureUrlSchema,
|
|
15
|
+
tokens: v4_1.z.string().array().max(100),
|
|
16
|
+
});
|
|
17
|
+
exports.sendNotificationResponseSchema = v4_1.z.object({
|
|
18
|
+
result: v4_1.z.object({
|
|
19
|
+
successfulTokens: v4_1.z.array(v4_1.z.string()),
|
|
20
|
+
invalidTokens: v4_1.z.array(v4_1.z.string()),
|
|
21
|
+
rateLimitedTokens: v4_1.z.array(v4_1.z.string()),
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
@@ -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,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonFarcasterSignatureHeaderSchema = exports.encodedJsonFarcasterSignatureSchema = exports.aspectRatioSchema = exports.domainSchema = exports.hexColorSchema = exports.caip19TokenSchema = exports.buttonTitleSchema = exports.miniAppNameSchema = exports.secureUrlSchema = exports.createSimpleStringSchema = void 0;
|
|
4
|
+
const v4_1 = require("zod/v4");
|
|
5
|
+
const SPECIAL_CHARS_PATTERN = /[@#$%^&*+=\/\\|~«»]/;
|
|
6
|
+
const REPEATED_PUNCTUATION_PATTERN = /(!{2,}|\?{2,}|-{2,})/;
|
|
7
|
+
// Unicode ranges for emoji detection:
|
|
8
|
+
// \u{1F300}-\u{1F9FF} - Miscellaneous Symbols, Pictographs, Emoticons, Transport, Map, and Supplemental
|
|
9
|
+
// \u{2702}-\u{27B0} - Dingbats
|
|
10
|
+
// \u{2600}-\u{26FF} - Miscellaneous Symbols
|
|
11
|
+
// \u{2B00}-\u{2BFF} - Miscellaneous Symbols and Arrows
|
|
12
|
+
const EMOJI_PATTERN = /[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u;
|
|
13
|
+
const createSimpleStringSchema = ({ max, noSpaces, } = {}) => {
|
|
14
|
+
const stringValidations = noSpaces
|
|
15
|
+
? v4_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.max(max ?? Number.POSITIVE_INFINITY)
|
|
18
|
+
.regex(/^\S*$/, 'Spaces are not allowed')
|
|
19
|
+
: v4_1.z.string().max(max ?? Number.POSITIVE_INFINITY);
|
|
20
|
+
return stringValidations
|
|
21
|
+
.refine((value) => !EMOJI_PATTERN.test(value), {
|
|
22
|
+
message: 'Emojis and symbols are not allowed',
|
|
23
|
+
})
|
|
24
|
+
.refine((value) => !SPECIAL_CHARS_PATTERN.test(value), {
|
|
25
|
+
message: 'Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed',
|
|
26
|
+
})
|
|
27
|
+
.refine((value) => !REPEATED_PUNCTUATION_PATTERN.test(value), {
|
|
28
|
+
message: 'Repeated punctuations (!!, ??, --) are not allowed',
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.createSimpleStringSchema = createSimpleStringSchema;
|
|
32
|
+
exports.secureUrlSchema = v4_1.z
|
|
33
|
+
.string()
|
|
34
|
+
.url()
|
|
35
|
+
.startsWith('https://', { message: 'Must be an https url' })
|
|
36
|
+
.max(1024)
|
|
37
|
+
.refine((url) => !url.includes(' '), {
|
|
38
|
+
message: 'URL must not contain spaces',
|
|
39
|
+
})
|
|
40
|
+
.refine((url) => {
|
|
41
|
+
try {
|
|
42
|
+
const hostname = new URL(url).hostname;
|
|
43
|
+
// Check for localhost
|
|
44
|
+
if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
// Check for IPv4 addresses
|
|
48
|
+
const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
|
|
49
|
+
if (ipv4Regex.test(hostname)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
// Check for IPv6 addresses (including brackets)
|
|
53
|
+
if (hostname.startsWith('[') && hostname.endsWith(']')) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
message: 'URL must not use IP addresses or localhost',
|
|
63
|
+
});
|
|
64
|
+
exports.miniAppNameSchema = v4_1.z.string().max(32);
|
|
65
|
+
exports.buttonTitleSchema = v4_1.z.string().max(32);
|
|
66
|
+
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)$/;
|
|
67
|
+
exports.caip19TokenSchema = v4_1.z
|
|
68
|
+
.string()
|
|
69
|
+
.regex(CAIP_19_REGEX, { message: 'Invalid CAIP-19 asset ID' });
|
|
70
|
+
exports.hexColorSchema = v4_1.z
|
|
71
|
+
.string()
|
|
72
|
+
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
|
|
73
|
+
message: 'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
|
|
74
|
+
});
|
|
75
|
+
// Domain validation regex:
|
|
76
|
+
// - Each label (part between dots) must start and end with alphanumeric
|
|
77
|
+
// - Labels can contain hyphens in the middle
|
|
78
|
+
// - Cannot have consecutive dots
|
|
79
|
+
// - Must have at least one dot (TLD required)
|
|
80
|
+
// - TLD must be at least 2 characters and only letters
|
|
81
|
+
const DOMAIN_REGEX = /^(?!.*\.\.)([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
|
|
82
|
+
exports.domainSchema = v4_1.z
|
|
83
|
+
.string()
|
|
84
|
+
.max(1024)
|
|
85
|
+
.regex(DOMAIN_REGEX, {
|
|
86
|
+
message: 'Must be a valid domain name (e.g., example.com, sub.example.com)',
|
|
87
|
+
})
|
|
88
|
+
.refine((value) => !value.includes('://'), {
|
|
89
|
+
message: 'Domain must not include protocol (http://, https://, etc.)',
|
|
90
|
+
})
|
|
91
|
+
.refine((value) => !value.includes('/'), {
|
|
92
|
+
message: 'Domain must not include path separators',
|
|
93
|
+
})
|
|
94
|
+
.refine((value) => !value.includes('@'), {
|
|
95
|
+
message: 'Domain must not include @ symbol',
|
|
96
|
+
})
|
|
97
|
+
.refine((value) => !value.includes(':'), {
|
|
98
|
+
message: 'Domain must not include port numbers',
|
|
99
|
+
});
|
|
100
|
+
exports.aspectRatioSchema = v4_1.z.union([v4_1.z.literal('1:1'), v4_1.z.literal('3:2')]);
|
|
101
|
+
exports.encodedJsonFarcasterSignatureSchema = v4_1.z.object({
|
|
102
|
+
header: v4_1.z.string(),
|
|
103
|
+
payload: v4_1.z.string(),
|
|
104
|
+
signature: v4_1.z.string(),
|
|
105
|
+
});
|
|
106
|
+
exports.jsonFarcasterSignatureHeaderSchema = v4_1.z.object({
|
|
107
|
+
fid: v4_1.z.number(),
|
|
108
|
+
type: v4_1.z.literal('app_key'),
|
|
109
|
+
key: v4_1.z.string().startsWith('0x'),
|
|
110
|
+
});
|
package/dist/solana.d.ts
ADDED
|
@@ -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/dist/solana.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSolanaWalletProvider = exports.SolanaConnection = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
Object.defineProperty(exports, "SolanaConnection", { enumerable: true, get: function () { return web3_js_1.Connection; } });
|
|
6
|
+
const createSolanaWalletProvider = (request) => ({
|
|
7
|
+
request,
|
|
8
|
+
signMessage: (msg) => request({ method: 'signMessage', params: { message: msg } }),
|
|
9
|
+
signTransaction: (transaction) => request({ method: 'signTransaction', params: { transaction } }),
|
|
10
|
+
signAndSendTransaction: (input) => request({
|
|
11
|
+
method: 'signAndSendTransaction',
|
|
12
|
+
params: input,
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
exports.createSolanaWalletProvider = createSolanaWalletProvider;
|
|
@@ -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;
|