@farcaster/frame-core 0.0.29 → 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.
Files changed (65) hide show
  1. package/README.md +13 -0
  2. package/dist/actions/ComposeCast.d.ts +32 -0
  3. package/dist/actions/ComposeCast.js +2 -0
  4. package/dist/actions/index.d.ts +1 -0
  5. package/dist/actions/index.js +2 -1
  6. package/dist/errors.d.ts +3 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +3 -1
  9. package/dist/manifest.d.ts +101 -0
  10. package/dist/manifest.js +2 -0
  11. package/dist/schemas/shared.js +1 -1
  12. package/dist/types.d.ts +3 -1
  13. package/esm/actions/AddFrame.d.ts +23 -27
  14. package/esm/actions/AddFrame.js +9 -9
  15. package/esm/actions/ComposeCast.d.ts +32 -0
  16. package/esm/actions/ComposeCast.js +1 -0
  17. package/esm/actions/Ready.d.ts +11 -11
  18. package/esm/actions/Ready.js +2 -2
  19. package/esm/actions/SignIn.d.ts +33 -35
  20. package/esm/actions/SignIn.js +5 -5
  21. package/esm/actions/Swap.d.ts +43 -44
  22. package/esm/actions/Swap.js +1 -1
  23. package/esm/actions/ViewProfile.d.ts +3 -3
  24. package/esm/actions/ViewProfile.js +1 -1
  25. package/esm/actions/ViewToken.d.ts +3 -3
  26. package/esm/actions/ViewToken.js +1 -1
  27. package/esm/actions/index.d.ts +7 -6
  28. package/esm/actions/index.js +7 -6
  29. package/esm/context.d.ts +61 -65
  30. package/esm/context.js +1 -1
  31. package/esm/errors.d.ts +10 -9
  32. package/esm/errors.js +6 -6
  33. package/esm/index.d.ts +7 -5
  34. package/esm/index.js +7 -5
  35. package/esm/internal/types.d.ts +7 -18
  36. package/esm/internal/types.js +1 -1
  37. package/esm/manifest.d.ts +101 -0
  38. package/esm/manifest.js +1 -0
  39. package/esm/schemas/embeds.d.ts +239 -346
  40. package/esm/schemas/embeds.js +23 -31
  41. package/esm/schemas/events.d.ts +129 -225
  42. package/esm/schemas/events.js +17 -17
  43. package/esm/schemas/index.d.ts +5 -5
  44. package/esm/schemas/index.js +5 -5
  45. package/esm/schemas/manifest.d.ts +110 -154
  46. package/esm/schemas/manifest.js +23 -29
  47. package/esm/schemas/notifications.d.ts +58 -86
  48. package/esm/schemas/notifications.js +17 -17
  49. package/esm/schemas/shared.d.ts +35 -53
  50. package/esm/schemas/shared.js +23 -25
  51. package/esm/tsconfig.tsbuildinfo +1 -1
  52. package/esm/types.d.ts +53 -70
  53. package/esm/types.js +2 -2
  54. package/esm/wallet/ethereum.d.ts +35 -50
  55. package/esm/wallet/ethereum.js +1 -1
  56. package/esm/wallet/index.d.ts +1 -1
  57. package/esm/wallet/index.js +1 -1
  58. package/package.json +1 -1
  59. package/src/actions/ComposeCast.ts +36 -0
  60. package/src/actions/index.ts +1 -0
  61. package/src/errors.ts +4 -0
  62. package/src/index.ts +2 -0
  63. package/src/manifest.ts +113 -0
  64. package/src/schemas/shared.ts +1 -1
  65. package/src/types.ts +7 -0
package/esm/context.d.ts CHANGED
@@ -1,76 +1,72 @@
1
- import type { FrameNotificationDetails } from './schemas'
1
+ import type { FrameNotificationDetails } from './schemas';
2
2
  export type CastEmbedLocationContext = {
3
- type: 'cast_embed'
4
- embed: string
5
- cast: {
6
- fid: number
7
- hash: string
8
- }
9
- }
3
+ type: 'cast_embed';
4
+ embed: string;
5
+ cast: {
6
+ fid: number;
7
+ hash: string;
8
+ };
9
+ };
10
10
  export type NotificationLocationContext = {
11
- type: 'notification'
12
- notification: {
13
- notificationId: string
14
- title: string
15
- body: string
16
- }
17
- }
11
+ type: 'notification';
12
+ notification: {
13
+ notificationId: string;
14
+ title: string;
15
+ body: string;
16
+ };
17
+ };
18
18
  export type LauncherLocationContext = {
19
- type: 'launcher'
20
- }
19
+ type: 'launcher';
20
+ };
21
21
  export type ChannelLocationContext = {
22
- type: 'channel'
23
- channel: {
24
- /**
25
- * Channel key identifier
26
- */
27
- key: string
22
+ type: 'channel';
23
+ channel: {
24
+ /**
25
+ * Channel key identifier
26
+ */
27
+ key: string;
28
+ /**
29
+ * Channel name
30
+ */
31
+ name: string;
32
+ /**
33
+ * Channel profile image URL
34
+ */
35
+ imageUrl?: string;
36
+ };
37
+ };
38
+ export type LocationContext = CastEmbedLocationContext | NotificationLocationContext | LauncherLocationContext | ChannelLocationContext;
39
+ export type AccountLocation = {
40
+ placeId: string;
28
41
  /**
29
- * Channel name
42
+ * Human-readable string describing the location
30
43
  */
31
- name: string
44
+ description: string;
45
+ };
46
+ export type UserContext = {
47
+ fid: number;
48
+ username?: string;
49
+ displayName?: string;
32
50
  /**
33
- * Channel profile image URL
51
+ * Profile image URL
34
52
  */
35
- imageUrl?: string
36
- }
37
- }
38
- export type LocationContext =
39
- | CastEmbedLocationContext
40
- | NotificationLocationContext
41
- | LauncherLocationContext
42
- | ChannelLocationContext
43
- export type AccountLocation = {
44
- placeId: string
45
- /**
46
- * Human-readable string describing the location
47
- */
48
- description: string
49
- }
50
- export type UserContext = {
51
- fid: number
52
- username?: string
53
- displayName?: string
54
- /**
55
- * Profile image URL
56
- */
57
- pfpUrl?: string
58
- location?: AccountLocation
59
- }
53
+ pfpUrl?: string;
54
+ location?: AccountLocation;
55
+ };
60
56
  export type SafeAreaInsets = {
61
- top: number
62
- bottom: number
63
- left: number
64
- right: number
65
- }
57
+ top: number;
58
+ bottom: number;
59
+ left: number;
60
+ right: number;
61
+ };
66
62
  export type ClientContext = {
67
- clientFid: number
68
- added: boolean
69
- notificationDetails?: FrameNotificationDetails
70
- safeAreaInsets?: SafeAreaInsets
71
- }
63
+ clientFid: number;
64
+ added: boolean;
65
+ notificationDetails?: FrameNotificationDetails;
66
+ safeAreaInsets?: SafeAreaInsets;
67
+ };
72
68
  export type FrameContext = {
73
- client: ClientContext
74
- user: UserContext
75
- location?: LocationContext
76
- }
69
+ client: ClientContext;
70
+ user: UserContext;
71
+ location?: LocationContext;
72
+ };
package/esm/context.js CHANGED
@@ -1 +1 @@
1
- export {}
1
+ export {};
package/esm/errors.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- export declare class BaseError<
2
- cause extends Error | undefined = undefined,
3
- > extends Error {
4
- name: string
5
- cause: cause
6
- constructor(message: string, options?: BaseError.Options<cause>)
1
+ export type GlobalErrorType<name extends string = 'Error'> = Error & {
2
+ name: name;
3
+ };
4
+ export declare class BaseError<cause extends Error | undefined = undefined> extends Error {
5
+ name: string;
6
+ cause: cause;
7
+ constructor(message: string, options?: BaseError.Options<cause>);
7
8
  }
8
9
  export declare namespace BaseError {
9
- type Options<cause extends Error | undefined = Error | undefined> = {
10
- cause?: cause | undefined
11
- }
10
+ type Options<cause extends Error | undefined = Error | undefined> = {
11
+ cause?: cause | undefined;
12
+ };
12
13
  }
package/esm/errors.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export class BaseError extends Error {
2
- name = 'BaseError'
3
- cause
4
- constructor(message, options = {}) {
5
- super(message, options.cause ? { cause: options.cause } : undefined)
6
- this.cause = options.cause
7
- }
2
+ name = 'BaseError';
3
+ cause;
4
+ constructor(message, options = {}) {
5
+ super(message, options.cause ? { cause: options.cause } : undefined);
6
+ this.cause = options.cause;
7
+ }
8
8
  }
package/esm/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- export * from './actions'
2
- export * from './wallet'
3
- export * as Context from './context'
4
- export * from './types'
5
- export * from './schemas'
1
+ export * from './actions';
2
+ export * from './wallet';
3
+ export * as Errors from './errors';
4
+ export * as Context from './context';
5
+ export * as Manifest from './manifest';
6
+ export * from './types';
7
+ export * from './schemas';
package/esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
- export * from './actions'
2
- export * from './wallet'
3
- export * as Context from './context'
4
- export * from './types'
5
- export * from './schemas'
1
+ export * from './actions';
2
+ export * from './wallet';
3
+ export * as Errors from './errors';
4
+ export * as Context from './context';
5
+ export * as Manifest from './manifest';
6
+ export * from './types';
7
+ export * from './schemas';
@@ -1,19 +1,8 @@
1
1
  type Compute<type> = {
2
- [key in keyof type]: type[key]
3
- } & unknown
4
- type KeyofUnion<type> = type extends type ? keyof type : never
5
- export type OneOf<
6
- union extends object,
7
- fallback extends object | undefined = undefined,
8
- keys extends KeyofUnion<union> = KeyofUnion<union>,
9
- > = union extends infer item
10
- ? Compute<
11
- item & {
12
- [key in Exclude<keys, keyof item>]?: fallback extends object
13
- ? key extends keyof fallback
14
- ? fallback[key]
15
- : undefined
16
- : undefined
17
- }
18
- >
19
- : never
2
+ [key in keyof type]: type[key];
3
+ } & unknown;
4
+ type KeyofUnion<type> = type extends type ? keyof type : never;
5
+ export type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Compute<item & {
6
+ [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;
7
+ }> : never;
8
+ export {};
@@ -1 +1 @@
1
- export {}
1
+ export {};
@@ -0,0 +1,101 @@
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
+ * Signed domain association linking this frame to a Farcaster account
10
+ *
11
+ * A DomainAssociation can be generated using the {@link https://warpcast.com/~/developers/domains | Warpcast
12
+ * Domains Developer} tool.
13
+ */
14
+ export type AccountAssociation = {
15
+ /**
16
+ * Base64URL encoded JFS signature
17
+ */
18
+ header: string;
19
+ /**
20
+ * Base64URL encoded payload signature
21
+ */
22
+ payload: string;
23
+ /**
24
+ * Base64URL encoded signature
25
+ */
26
+ signature: string;
27
+ };
28
+ /**
29
+ * Frame configuration
30
+ *
31
+ * @example
32
+ * ``ts
33
+ * const frame: FrameConfig = {
34
+ * version: '1',
35
+ * name: 'Yoink!',
36
+ * homeUrl: 'https://yoink.party',
37
+ * iconUrl: 'https://yoink.party/img/icon.png',
38
+ * imageUrl: 'https://yoink.party/framesV2/opengraph-image',
39
+ * buttonTitle: '🚩 Start',
40
+ * splashImageUrl: 'https://yoink.party/img/splash.png',
41
+ * splashImageBackgroundColor: '#eeeee4',
42
+ * webhookUrl: 'https://yoink.party/webhook'
43
+ * };
44
+ * ``
45
+ */
46
+ export type FrameConfig = {
47
+ /**
48
+ * Manifest version
49
+ *
50
+ * Must be the literal '1'.
51
+ */
52
+ version: '1';
53
+ /**
54
+ * App name that will be displayed to users
55
+ *
56
+ * Max length of 32 characters.
57
+ */
58
+ name: string;
59
+ /**
60
+ * Default launch URL
61
+ *
62
+ * Max length of 1024 characters.
63
+ */
64
+ homeUrl: string;
65
+ /**
66
+ * Icon URL
67
+ *
68
+ * Max length of 1024 characters. Image must be 200x200px and less than 1MB.
69
+ */
70
+ iconUrl: string;
71
+ /**
72
+ * Image URL
73
+ *
74
+ * Max length of 1024 characters. Image must have a 3:2 ratio.
75
+ */
76
+ imageUrl: string;
77
+ /**
78
+ * Default button title to use when frame is rendered.
79
+ *
80
+ * Max length of 32 characters.
81
+ */
82
+ buttonTitle: string;
83
+ /**
84
+ * Splash image URL
85
+ *
86
+ * Max length of 1024 characters. Image must be 200x200px and less than 1MB.
87
+ */
88
+ splashImageUrl?: string;
89
+ /**
90
+ * Splash background color
91
+ *
92
+ * Must be a hex color code.
93
+ */
94
+ splashBackgroundColor?: string;
95
+ /**
96
+ * URL to which clients will POST server events.
97
+ * Max length of 1024 characters.
98
+ * Required if the frame application uses notifications.
99
+ */
100
+ webhookUrl?: string;
101
+ };
@@ -0,0 +1 @@
1
+ export {};