@farcaster/frame-core 0.0.31 → 0.0.32
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/schemas/embeds.d.ts +20 -20
- package/dist/schemas/embeds.js +1 -1
- package/dist/schemas/manifest.d.ts +92 -6
- package/dist/schemas/manifest.js +31 -0
- package/dist/schemas/shared.d.ts +4 -0
- package/dist/schemas/shared.js +28 -1
- package/dist/wallet/ethereum.d.ts +5 -1
- package/esm/schemas/embeds.d.ts +20 -20
- package/esm/schemas/embeds.js +1 -1
- package/esm/schemas/manifest.d.ts +92 -6
- package/esm/schemas/manifest.js +32 -1
- package/esm/schemas/shared.d.ts +4 -0
- package/esm/schemas/shared.js +26 -0
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/wallet/ethereum.d.ts +5 -1
- package/package.json +1 -1
- package/src/schemas/embeds.ts +1 -1
- package/src/schemas/manifest.ts +33 -0
- package/src/schemas/shared.ts +35 -0
- package/src/wallet/ethereum.ts +5 -1
package/src/schemas/shared.ts
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
|
+
const SPECIAL_CHARS_PATTERN = /[@#$%^&*+=\/\\|~«»]/
|
|
4
|
+
const REPEATED_PUNCTUATION_PATTERN = /(!{2,}|\?{2,}|-{2,})/
|
|
5
|
+
|
|
6
|
+
// Unicode ranges for emoji detection:
|
|
7
|
+
// \u{1F300}-\u{1F9FF} - Miscellaneous Symbols, Pictographs, Emoticons, Transport, Map, and Supplemental
|
|
8
|
+
// \u{2702}-\u{27B0} - Dingbats
|
|
9
|
+
// \u{2600}-\u{26FF} - Miscellaneous Symbols
|
|
10
|
+
// \u{2B00}-\u{2BFF} - Miscellaneous Symbols and Arrows
|
|
11
|
+
const EMOJI_PATTERN =
|
|
12
|
+
/[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u
|
|
13
|
+
|
|
14
|
+
export const createSimpleStringSchema = ({
|
|
15
|
+
max,
|
|
16
|
+
noSpaces,
|
|
17
|
+
}: { max?: number; noSpaces?: boolean } = {}) => {
|
|
18
|
+
const stringValidations = noSpaces
|
|
19
|
+
? z
|
|
20
|
+
.string()
|
|
21
|
+
.max(max ?? Number.POSITIVE_INFINITY)
|
|
22
|
+
.regex(/^\S*$/, 'Spaces are not allowed')
|
|
23
|
+
: z.string().max(max ?? Number.POSITIVE_INFINITY)
|
|
24
|
+
|
|
25
|
+
return stringValidations
|
|
26
|
+
.refine((value) => !EMOJI_PATTERN.test(value), {
|
|
27
|
+
message: 'Emojis and symbols are not allowed',
|
|
28
|
+
})
|
|
29
|
+
.refine((value) => !SPECIAL_CHARS_PATTERN.test(value), {
|
|
30
|
+
message:
|
|
31
|
+
'Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed',
|
|
32
|
+
})
|
|
33
|
+
.refine((value) => !REPEATED_PUNCTUATION_PATTERN.test(value), {
|
|
34
|
+
message: 'Repeated punctuations (!!, ??, --) are not allowed',
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
3
38
|
export const secureUrlSchema = z
|
|
4
39
|
.string()
|
|
5
40
|
.url()
|
package/src/wallet/ethereum.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as Address from 'ox/Address'
|
|
2
|
+
import type * as Provider from 'ox/Provider'
|
|
3
|
+
import type * as RpcRequest from 'ox/RpcRequest'
|
|
4
|
+
import type * as RpcResponse from 'ox/RpcResponse'
|
|
5
|
+
import type * as RpcSchema from 'ox/RpcSchema'
|
|
2
6
|
|
|
3
7
|
export type EthProvideRequest<
|
|
4
8
|
schema extends RpcSchema.Generic = RpcSchema.Default,
|