@farcaster/frame-core 0.0.28 → 0.0.31

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.
@@ -1,4 +1,5 @@
1
1
  export * as AddFrame from './AddFrame'
2
+ export * as ComposeCast from './ComposeCast'
2
3
  export * as Ready from './Ready'
3
4
  export * as SignIn from './SignIn'
4
5
  export * as Swap from './Swap'
package/src/errors.ts CHANGED
@@ -1,3 +1,7 @@
1
+ export type GlobalErrorType<name extends string = 'Error'> = Error & {
2
+ name: name
3
+ }
4
+
1
5
  export class BaseError<
2
6
  cause extends Error | undefined = undefined,
3
7
  > extends Error {
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './actions'
2
2
  export * from './wallet'
3
+ export * as Errors from './errors'
3
4
  export * as Context from './context'
5
+ export * as Manifest from './manifest'
4
6
  export * from './types'
5
7
  export * from './schemas'
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Farcaster manifest for a domain hosted at `/.well-known/farcaster.json`
3
+ */
4
+ export type Manifest = {
5
+ accountAssociation: AccountAssociation
6
+ frame: FrameConfig
7
+ }
8
+
9
+ /**
10
+ * Signed domain association linking this frame to a Farcaster account
11
+ *
12
+ * A DomainAssociation can be generated using the {@link https://warpcast.com/~/developers/domains | Warpcast
13
+ * Domains Developer} tool.
14
+ */
15
+ export type AccountAssociation = {
16
+ /**
17
+ * Base64URL encoded JFS signature
18
+ */
19
+ header: string
20
+
21
+ /**
22
+ * Base64URL encoded payload signature
23
+ */
24
+ payload: string
25
+
26
+ /**
27
+ * Base64URL encoded signature
28
+ */
29
+ signature: string
30
+ }
31
+
32
+ /**
33
+ * Frame configuration
34
+ *
35
+ * @example
36
+ * ``ts
37
+ * const frame: FrameConfig = {
38
+ * version: '1',
39
+ * name: 'Yoink!',
40
+ * homeUrl: 'https://yoink.party',
41
+ * iconUrl: 'https://yoink.party/img/icon.png',
42
+ * imageUrl: 'https://yoink.party/framesV2/opengraph-image',
43
+ * buttonTitle: '🚩 Start',
44
+ * splashImageUrl: 'https://yoink.party/img/splash.png',
45
+ * splashImageBackgroundColor: '#eeeee4',
46
+ * webhookUrl: 'https://yoink.party/webhook'
47
+ * };
48
+ * ``
49
+ */
50
+ export type FrameConfig = {
51
+ /**
52
+ * Manifest version
53
+ *
54
+ * Must be the literal '1'.
55
+ */
56
+ version: '1'
57
+
58
+ /**
59
+ * App name that will be displayed to users
60
+ *
61
+ * Max length of 32 characters.
62
+ */
63
+ name: string
64
+
65
+ /**
66
+ * Default launch URL
67
+ *
68
+ * Max length of 1024 characters.
69
+ */
70
+ homeUrl: string
71
+
72
+ /**
73
+ * Icon URL
74
+ *
75
+ * Max length of 1024 characters. Image must be 200x200px and less than 1MB.
76
+ */
77
+ iconUrl: string
78
+
79
+ /**
80
+ * Image URL
81
+ *
82
+ * Max length of 1024 characters. Image must have a 3:2 ratio.
83
+ */
84
+ imageUrl: string
85
+
86
+ /**
87
+ * Default button title to use when frame is rendered.
88
+ *
89
+ * Max length of 32 characters.
90
+ */
91
+ buttonTitle: string
92
+
93
+ /**
94
+ * Splash image URL
95
+ *
96
+ * Max length of 1024 characters. Image must be 200x200px and less than 1MB.
97
+ */
98
+ splashImageUrl?: string
99
+
100
+ /**
101
+ * Splash background color
102
+ *
103
+ * Must be a hex color code.
104
+ */
105
+ splashBackgroundColor?: string
106
+
107
+ /**
108
+ * URL to which clients will POST server events.
109
+ * Max length of 1024 characters.
110
+ * Required if the frame application uses notifications.
111
+ */
112
+ webhookUrl?: string
113
+ }
@@ -4,7 +4,7 @@ export const secureUrlSchema = z
4
4
  .string()
5
5
  .url()
6
6
  .startsWith('https://', { message: 'Must be an https url' })
7
- .max(512)
7
+ .max(1024)
8
8
 
9
9
  export const frameNameSchema = z.string().max(32)
10
10
  export const buttonTitleSchema = z.string().max(32)
package/src/types.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  AddFrame,
3
+ ComposeCast,
3
4
  Ready,
4
5
  SignIn,
5
6
  Swap,
@@ -44,6 +45,9 @@ export type WireFrameHost = {
44
45
  viewProfile: ViewProfile.ViewProfile
45
46
  viewToken: ViewToken.ViewToken
46
47
  swap: Swap.Swap
48
+ composeCast: <close extends boolean | undefined = undefined>(
49
+ options: ComposeCast.Options<close>,
50
+ ) => Promise<ComposeCast.Result<close>>
47
51
  }
48
52
 
49
53
  export type FrameHost = {
@@ -64,6 +68,9 @@ export type FrameHost = {
64
68
  viewProfile: ViewProfile.ViewProfile
65
69
  viewToken: ViewToken.ViewToken
66
70
  swap: Swap.Swap
71
+ composeCast: <close extends boolean | undefined = undefined>(
72
+ options: ComposeCast.Options<close>,
73
+ ) => Promise<ComposeCast.Result<close>>
67
74
  }
68
75
 
69
76
  export type EventFrameAddRejected = {