@farcaster/frame-core 0.1.10 → 0.3.0

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 (142) hide show
  1. package/dist/index.d.ts +153 -10
  2. package/dist/index.js +18 -33
  3. package/esm/index.d.ts +153 -10
  4. package/esm/index.js +17 -10
  5. package/esm/tsconfig.tsbuildinfo +1 -1
  6. package/package.json +6 -8
  7. package/src/index.ts +50 -10
  8. package/dist/actions/AddMiniApp.d.ts +0 -36
  9. package/dist/actions/AddMiniApp.js +0 -57
  10. package/dist/actions/ComposeCast.d.ts +0 -37
  11. package/dist/actions/ComposeCast.js +0 -2
  12. package/dist/actions/Haptics.d.ts +0 -5
  13. package/dist/actions/Haptics.js +0 -2
  14. package/dist/actions/Ready.d.ts +0 -13
  15. package/dist/actions/Ready.js +0 -6
  16. package/dist/actions/SendToken.d.ts +0 -48
  17. package/dist/actions/SendToken.js +0 -2
  18. package/dist/actions/SignIn.d.ts +0 -55
  19. package/dist/actions/SignIn.js +0 -47
  20. package/dist/actions/SwapToken.d.ts +0 -46
  21. package/dist/actions/SwapToken.js +0 -2
  22. package/dist/actions/ViewCast.d.ts +0 -25
  23. package/dist/actions/ViewCast.js +0 -2
  24. package/dist/actions/ViewProfile.d.ts +0 -4
  25. package/dist/actions/ViewProfile.js +0 -2
  26. package/dist/actions/ViewToken.d.ts +0 -4
  27. package/dist/actions/ViewToken.js +0 -2
  28. package/dist/actions/index.d.ts +0 -10
  29. package/dist/actions/index.js +0 -46
  30. package/dist/back.d.ts +0 -13
  31. package/dist/back.js +0 -6
  32. package/dist/context.d.ts +0 -94
  33. package/dist/context.js +0 -2
  34. package/dist/errors.d.ts +0 -13
  35. package/dist/errors.js +0 -12
  36. package/dist/internal/types.d.ts +0 -8
  37. package/dist/internal/types.js +0 -2
  38. package/dist/manifest.d.ts +0 -101
  39. package/dist/manifest.js +0 -2
  40. package/dist/schemas/embeds.d.ts +0 -243
  41. package/dist/schemas/embeds.js +0 -32
  42. package/dist/schemas/events.d.ts +0 -131
  43. package/dist/schemas/events.js +0 -25
  44. package/dist/schemas/index.d.ts +0 -5
  45. package/dist/schemas/index.js +0 -21
  46. package/dist/schemas/manifest.d.ts +0 -334
  47. package/dist/schemas/manifest.js +0 -112
  48. package/dist/schemas/notifications.d.ts +0 -60
  49. package/dist/schemas/notifications.js +0 -23
  50. package/dist/schemas/shared.d.ts +0 -39
  51. package/dist/schemas/shared.js +0 -58
  52. package/dist/solana.d.ts +0 -72
  53. package/dist/solana.js +0 -15
  54. package/dist/solanaWire.d.ts +0 -3
  55. package/dist/solanaWire.js +0 -84
  56. package/dist/types.d.ts +0 -87
  57. package/dist/types.js +0 -41
  58. package/dist/wallet/ethereum.d.ts +0 -47
  59. package/dist/wallet/ethereum.js +0 -2
  60. package/dist/wallet/index.d.ts +0 -1
  61. package/dist/wallet/index.js +0 -37
  62. package/esm/actions/AddMiniApp.d.ts +0 -36
  63. package/esm/actions/AddMiniApp.js +0 -19
  64. package/esm/actions/ComposeCast.d.ts +0 -37
  65. package/esm/actions/ComposeCast.js +0 -1
  66. package/esm/actions/Haptics.d.ts +0 -5
  67. package/esm/actions/Haptics.js +0 -1
  68. package/esm/actions/Ready.d.ts +0 -13
  69. package/esm/actions/Ready.js +0 -3
  70. package/esm/actions/SendToken.d.ts +0 -48
  71. package/esm/actions/SendToken.js +0 -1
  72. package/esm/actions/SignIn.d.ts +0 -55
  73. package/esm/actions/SignIn.js +0 -10
  74. package/esm/actions/SwapToken.d.ts +0 -46
  75. package/esm/actions/SwapToken.js +0 -1
  76. package/esm/actions/ViewCast.d.ts +0 -25
  77. package/esm/actions/ViewCast.js +0 -1
  78. package/esm/actions/ViewProfile.d.ts +0 -4
  79. package/esm/actions/ViewProfile.js +0 -1
  80. package/esm/actions/ViewToken.d.ts +0 -4
  81. package/esm/actions/ViewToken.js +0 -1
  82. package/esm/actions/index.d.ts +0 -10
  83. package/esm/actions/index.js +0 -10
  84. package/esm/back.d.ts +0 -13
  85. package/esm/back.js +0 -3
  86. package/esm/context.d.ts +0 -94
  87. package/esm/context.js +0 -1
  88. package/esm/errors.d.ts +0 -13
  89. package/esm/errors.js +0 -8
  90. package/esm/internal/types.d.ts +0 -8
  91. package/esm/internal/types.js +0 -1
  92. package/esm/manifest.d.ts +0 -101
  93. package/esm/manifest.js +0 -1
  94. package/esm/schemas/embeds.d.ts +0 -243
  95. package/esm/schemas/embeds.js +0 -28
  96. package/esm/schemas/events.d.ts +0 -131
  97. package/esm/schemas/events.js +0 -22
  98. package/esm/schemas/index.d.ts +0 -5
  99. package/esm/schemas/index.js +0 -5
  100. package/esm/schemas/manifest.d.ts +0 -334
  101. package/esm/schemas/manifest.js +0 -109
  102. package/esm/schemas/notifications.d.ts +0 -60
  103. package/esm/schemas/notifications.js +0 -20
  104. package/esm/schemas/shared.d.ts +0 -39
  105. package/esm/schemas/shared.js +0 -54
  106. package/esm/solana.d.ts +0 -72
  107. package/esm/solana.js +0 -11
  108. package/esm/solanaWire.d.ts +0 -3
  109. package/esm/solanaWire.js +0 -80
  110. package/esm/types.d.ts +0 -87
  111. package/esm/types.js +0 -23
  112. package/esm/wallet/ethereum.d.ts +0 -47
  113. package/esm/wallet/ethereum.js +0 -1
  114. package/esm/wallet/index.d.ts +0 -1
  115. package/esm/wallet/index.js +0 -1
  116. package/src/actions/AddMiniApp.ts +0 -51
  117. package/src/actions/ComposeCast.ts +0 -44
  118. package/src/actions/Haptics.ts +0 -9
  119. package/src/actions/Ready.ts +0 -15
  120. package/src/actions/SendToken.ts +0 -57
  121. package/src/actions/SignIn.ts +0 -67
  122. package/src/actions/SwapToken.ts +0 -54
  123. package/src/actions/ViewCast.ts +0 -27
  124. package/src/actions/ViewProfile.ts +0 -5
  125. package/src/actions/ViewToken.ts +0 -5
  126. package/src/actions/index.ts +0 -10
  127. package/src/back.ts +0 -15
  128. package/src/context.ts +0 -117
  129. package/src/errors.ts +0 -21
  130. package/src/internal/types.ts +0 -20
  131. package/src/manifest.ts +0 -113
  132. package/src/schemas/embeds.ts +0 -44
  133. package/src/schemas/events.ts +0 -41
  134. package/src/schemas/index.ts +0 -5
  135. package/src/schemas/manifest.ts +0 -122
  136. package/src/schemas/notifications.ts +0 -33
  137. package/src/schemas/shared.ts +0 -81
  138. package/src/solana.ts +0 -108
  139. package/src/solanaWire.ts +0 -120
  140. package/src/types.ts +0 -155
  141. package/src/wallet/ethereum.ts +0 -65
  142. package/src/wallet/index.ts +0 -1
@@ -1,46 +0,0 @@
1
- export type SwapTokenOptions = {
2
- /**
3
- * CAIP-19 asset ID
4
- * For example, Base USDC:
5
- * eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
6
- */
7
- sellToken?: string;
8
- /**
9
- * CAIP-19 token ID. For example, OP ETH:
10
- * eip155:10/native
11
- */
12
- buyToken?: string;
13
- /**
14
- * Sell token amount, as numeric string.
15
- * For example, 1 USDC: 1000000
16
- */
17
- sellAmount?: string;
18
- };
19
- type SwapTokenDetails = {
20
- /**
21
- * Array of tx identifiers in order of execution.
22
- * Some swaps will have both an approval and swap tx.
23
- */
24
- transactions: `0x${string}`[];
25
- };
26
- type SwapTokenErrorDetails = {
27
- /**
28
- * Error code.
29
- */
30
- error: string;
31
- /**
32
- * Error message.
33
- */
34
- message?: string;
35
- };
36
- export type SwapErrorReason = 'rejected_by_user' | 'swap_failed';
37
- export type SwapTokenResult = {
38
- success: true;
39
- swap: SwapTokenDetails;
40
- } | {
41
- success: false;
42
- reason: SwapErrorReason;
43
- error?: SwapTokenErrorDetails;
44
- };
45
- export type SwapToken = (options: SwapTokenOptions) => Promise<SwapTokenResult>;
46
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- export type ViewCastOptions = {
2
- /**
3
- * The hash of the cast to view.
4
- * @example "0x6a112e2d35e2d2008e25dd29811e8769d1edd9ca"
5
- */
6
- hash: string;
7
- /**
8
- * Whether the app should be closed when this action is called.
9
- * If true, the app will be closed after opening the cast view.
10
- */
11
- close?: boolean;
12
- };
13
- /**
14
- * Opens a cast view in the Farcaster client.
15
- *
16
- * @example
17
- * ```ts
18
- * await sdk.actions.viewCast({
19
- * hash: "0x6a112e2d35e2d2008e25dd29811e8769d1edd9ca"
20
- * })
21
- * ```
22
- *
23
- * @see {@link https://miniapps.farcaster.xyz/docs/sdk/actions/view-cast | View Cast Documentation}
24
- */
25
- export type ViewCast = (options: ViewCastOptions) => Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export type ViewProfileOptions = {
2
- fid: number;
3
- };
4
- export type ViewProfile = (options: ViewProfileOptions) => Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export type ViewTokenOptions = {
2
- token: string;
3
- };
4
- export type ViewToken = (options: ViewTokenOptions) => Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export * as AddMiniApp from './AddMiniApp.ts';
2
- export * as ComposeCast from './ComposeCast.ts';
3
- export * as Haptics from './Haptics.ts';
4
- export * as Ready from './Ready.ts';
5
- export * as SignIn from './SignIn.ts';
6
- export * as SendToken from './SendToken.ts';
7
- export * as SwapToken from './SwapToken.ts';
8
- export * as ViewCast from './ViewCast.ts';
9
- export * as ViewProfile from './ViewProfile.ts';
10
- export * as ViewToken from './ViewToken.ts';
@@ -1,10 +0,0 @@
1
- export * as AddMiniApp from "./AddMiniApp.js";
2
- export * as ComposeCast from "./ComposeCast.js";
3
- export * as Haptics from "./Haptics.js";
4
- export * as Ready from "./Ready.js";
5
- export * as SignIn from "./SignIn.js";
6
- export * as SendToken from "./SendToken.js";
7
- export * as SwapToken from "./SwapToken.js";
8
- export * as ViewCast from "./ViewCast.js";
9
- export * as ViewProfile from "./ViewProfile.js";
10
- export * as ViewToken from "./ViewToken.js";
package/esm/back.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export type BackState = {
2
- /**
3
- * Is the back control visible. Note that on mobile devices Farcaster clients
4
- * may support a gesture based control rather than button control.
5
- *
6
- * @default false
7
- */
8
- visible: boolean;
9
- };
10
- export declare const DEFAULT_BACK_STATE: {
11
- visible: false;
12
- };
13
- export type UpdateBackState = (state: BackState) => Promise<void>;
package/esm/back.js DELETED
@@ -1,3 +0,0 @@
1
- export const DEFAULT_BACK_STATE = {
2
- visible: false,
3
- };
package/esm/context.d.ts DELETED
@@ -1,94 +0,0 @@
1
- import type { FrameNotificationDetails } from './schemas/index.ts';
2
- export type MiniappUser = {
3
- fid: number;
4
- username?: string;
5
- displayName?: string;
6
- pfpUrl?: string;
7
- };
8
- export interface MiniappCast {
9
- author: MiniappUser;
10
- hash: string;
11
- parentHash?: string;
12
- parentFid?: number;
13
- timestamp?: number;
14
- mentions?: MiniappUser[];
15
- text: string;
16
- embeds?: string[];
17
- channelKey?: string;
18
- }
19
- export type CastEmbedLocationContext = {
20
- type: 'cast_embed';
21
- embed: string;
22
- cast: MiniappCast;
23
- };
24
- export type CastShareLocationContext = {
25
- type: 'cast_share';
26
- cast: MiniappCast;
27
- };
28
- export type NotificationLocationContext = {
29
- type: 'notification';
30
- notification: {
31
- notificationId: string;
32
- title: string;
33
- body: string;
34
- };
35
- };
36
- export type LauncherLocationContext = {
37
- type: 'launcher';
38
- };
39
- export type ChannelLocationContext = {
40
- type: 'channel';
41
- channel: {
42
- /**
43
- * Channel key identifier
44
- */
45
- key: string;
46
- /**
47
- * Channel name
48
- */
49
- name: string;
50
- /**
51
- * Channel profile image URL
52
- */
53
- imageUrl?: string;
54
- };
55
- };
56
- export type LocationContext = CastEmbedLocationContext | CastShareLocationContext | NotificationLocationContext | LauncherLocationContext | ChannelLocationContext;
57
- export type AccountLocation = {
58
- placeId: string;
59
- /**
60
- * Human-readable string describing the location
61
- */
62
- description: string;
63
- };
64
- export type UserContext = {
65
- fid: number;
66
- username?: string;
67
- displayName?: string;
68
- /**
69
- * Profile image URL
70
- */
71
- pfpUrl?: string;
72
- location?: AccountLocation;
73
- };
74
- export type SafeAreaInsets = {
75
- top: number;
76
- bottom: number;
77
- left: number;
78
- right: number;
79
- };
80
- export type ClientContext = {
81
- clientFid: number;
82
- added: boolean;
83
- notificationDetails?: FrameNotificationDetails;
84
- safeAreaInsets?: SafeAreaInsets;
85
- };
86
- export type ClientFeatures = {
87
- haptics: boolean;
88
- };
89
- export type FrameContext = {
90
- client: ClientContext;
91
- user: UserContext;
92
- location?: LocationContext;
93
- features?: ClientFeatures;
94
- };
package/esm/context.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/esm/errors.d.ts DELETED
@@ -1,13 +0,0 @@
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>);
8
- }
9
- export declare namespace BaseError {
10
- type Options<cause extends Error | undefined = Error | undefined> = {
11
- cause?: cause | undefined;
12
- };
13
- }
package/esm/errors.js DELETED
@@ -1,8 +0,0 @@
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
- }
8
- }
@@ -1,8 +0,0 @@
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<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 +0,0 @@
1
- export {};
package/esm/manifest.d.ts DELETED
@@ -1,101 +0,0 @@
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://farcaster.xyz/~/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
- };
package/esm/manifest.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,243 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const actionLaunchFrameSchema: z.ZodObject<{
3
- type: z.ZodLiteral<"launch_frame">;
4
- name: z.ZodString;
5
- url: z.ZodOptional<z.ZodString>;
6
- splashImageUrl: z.ZodOptional<z.ZodString>;
7
- splashBackgroundColor: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- type: "launch_frame";
10
- name: string;
11
- url?: string | undefined;
12
- splashImageUrl?: string | undefined;
13
- splashBackgroundColor?: string | undefined;
14
- }, {
15
- type: "launch_frame";
16
- name: string;
17
- url?: string | undefined;
18
- splashImageUrl?: string | undefined;
19
- splashBackgroundColor?: string | undefined;
20
- }>;
21
- export declare const actionViewTokenSchema: z.ZodObject<{
22
- type: z.ZodLiteral<"view_token">;
23
- token: z.ZodString;
24
- }, "strip", z.ZodTypeAny, {
25
- type: "view_token";
26
- token: string;
27
- }, {
28
- type: "view_token";
29
- token: string;
30
- }>;
31
- export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
32
- type: z.ZodLiteral<"launch_frame">;
33
- name: z.ZodString;
34
- url: z.ZodOptional<z.ZodString>;
35
- splashImageUrl: z.ZodOptional<z.ZodString>;
36
- splashBackgroundColor: z.ZodOptional<z.ZodString>;
37
- }, "strip", z.ZodTypeAny, {
38
- type: "launch_frame";
39
- name: string;
40
- url?: string | undefined;
41
- splashImageUrl?: string | undefined;
42
- splashBackgroundColor?: string | undefined;
43
- }, {
44
- type: "launch_frame";
45
- name: string;
46
- url?: string | undefined;
47
- splashImageUrl?: string | undefined;
48
- splashBackgroundColor?: string | undefined;
49
- }>, z.ZodObject<{
50
- type: z.ZodLiteral<"view_token">;
51
- token: z.ZodString;
52
- }, "strip", z.ZodTypeAny, {
53
- type: "view_token";
54
- token: string;
55
- }, {
56
- type: "view_token";
57
- token: string;
58
- }>]>;
59
- export declare const buttonSchema: z.ZodObject<{
60
- title: z.ZodString;
61
- action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
62
- type: z.ZodLiteral<"launch_frame">;
63
- name: z.ZodString;
64
- url: z.ZodOptional<z.ZodString>;
65
- splashImageUrl: z.ZodOptional<z.ZodString>;
66
- splashBackgroundColor: z.ZodOptional<z.ZodString>;
67
- }, "strip", z.ZodTypeAny, {
68
- type: "launch_frame";
69
- name: string;
70
- url?: string | undefined;
71
- splashImageUrl?: string | undefined;
72
- splashBackgroundColor?: string | undefined;
73
- }, {
74
- type: "launch_frame";
75
- name: string;
76
- url?: string | undefined;
77
- splashImageUrl?: string | undefined;
78
- splashBackgroundColor?: string | undefined;
79
- }>, z.ZodObject<{
80
- type: z.ZodLiteral<"view_token">;
81
- token: z.ZodString;
82
- }, "strip", z.ZodTypeAny, {
83
- type: "view_token";
84
- token: string;
85
- }, {
86
- type: "view_token";
87
- token: string;
88
- }>]>;
89
- }, "strip", z.ZodTypeAny, {
90
- title: string;
91
- action: {
92
- type: "launch_frame";
93
- name: string;
94
- url?: string | undefined;
95
- splashImageUrl?: string | undefined;
96
- splashBackgroundColor?: string | undefined;
97
- } | {
98
- type: "view_token";
99
- token: string;
100
- };
101
- }, {
102
- title: string;
103
- action: {
104
- type: "launch_frame";
105
- name: string;
106
- url?: string | undefined;
107
- splashImageUrl?: string | undefined;
108
- splashBackgroundColor?: string | undefined;
109
- } | {
110
- type: "view_token";
111
- token: string;
112
- };
113
- }>;
114
- export declare const frameEmbedNextSchema: z.ZodObject<{
115
- version: z.ZodLiteral<"next">;
116
- imageUrl: z.ZodString;
117
- aspectRatio: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"1:1">, z.ZodLiteral<"3:2">]>>;
118
- button: z.ZodObject<{
119
- title: z.ZodString;
120
- action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
121
- type: z.ZodLiteral<"launch_frame">;
122
- name: z.ZodString;
123
- url: z.ZodOptional<z.ZodString>;
124
- splashImageUrl: z.ZodOptional<z.ZodString>;
125
- splashBackgroundColor: z.ZodOptional<z.ZodString>;
126
- }, "strip", z.ZodTypeAny, {
127
- type: "launch_frame";
128
- name: string;
129
- url?: string | undefined;
130
- splashImageUrl?: string | undefined;
131
- splashBackgroundColor?: string | undefined;
132
- }, {
133
- type: "launch_frame";
134
- name: string;
135
- url?: string | undefined;
136
- splashImageUrl?: string | undefined;
137
- splashBackgroundColor?: string | undefined;
138
- }>, z.ZodObject<{
139
- type: z.ZodLiteral<"view_token">;
140
- token: z.ZodString;
141
- }, "strip", z.ZodTypeAny, {
142
- type: "view_token";
143
- token: string;
144
- }, {
145
- type: "view_token";
146
- token: string;
147
- }>]>;
148
- }, "strip", z.ZodTypeAny, {
149
- title: string;
150
- action: {
151
- type: "launch_frame";
152
- name: string;
153
- url?: string | undefined;
154
- splashImageUrl?: string | undefined;
155
- splashBackgroundColor?: string | undefined;
156
- } | {
157
- type: "view_token";
158
- token: string;
159
- };
160
- }, {
161
- title: string;
162
- action: {
163
- type: "launch_frame";
164
- name: string;
165
- url?: string | undefined;
166
- splashImageUrl?: string | undefined;
167
- splashBackgroundColor?: string | undefined;
168
- } | {
169
- type: "view_token";
170
- token: string;
171
- };
172
- }>;
173
- }, "strip", z.ZodTypeAny, {
174
- version: "next";
175
- imageUrl: string;
176
- button: {
177
- title: string;
178
- action: {
179
- type: "launch_frame";
180
- name: string;
181
- url?: string | undefined;
182
- splashImageUrl?: string | undefined;
183
- splashBackgroundColor?: string | undefined;
184
- } | {
185
- type: "view_token";
186
- token: string;
187
- };
188
- };
189
- aspectRatio?: "1:1" | "3:2" | undefined;
190
- }, {
191
- version: "next";
192
- imageUrl: string;
193
- button: {
194
- title: string;
195
- action: {
196
- type: "launch_frame";
197
- name: string;
198
- url?: string | undefined;
199
- splashImageUrl?: string | undefined;
200
- splashBackgroundColor?: string | undefined;
201
- } | {
202
- type: "view_token";
203
- token: string;
204
- };
205
- };
206
- aspectRatio?: "1:1" | "3:2" | undefined;
207
- }>;
208
- export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.SafeParseReturnType<{
209
- version: "next";
210
- imageUrl: string;
211
- button: {
212
- title: string;
213
- action: {
214
- type: "launch_frame";
215
- name: string;
216
- url?: string | undefined;
217
- splashImageUrl?: string | undefined;
218
- splashBackgroundColor?: string | undefined;
219
- } | {
220
- type: "view_token";
221
- token: string;
222
- };
223
- };
224
- aspectRatio?: "1:1" | "3:2" | undefined;
225
- }, {
226
- version: "next";
227
- imageUrl: string;
228
- button: {
229
- title: string;
230
- action: {
231
- type: "launch_frame";
232
- name: string;
233
- url?: string | undefined;
234
- splashImageUrl?: string | undefined;
235
- splashBackgroundColor?: string | undefined;
236
- } | {
237
- type: "view_token";
238
- token: string;
239
- };
240
- };
241
- aspectRatio?: "1:1" | "3:2" | undefined;
242
- }>;
243
- export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>;
@@ -1,28 +0,0 @@
1
- import { z } from 'zod';
2
- import { aspectRatioSchema, buttonTitleSchema, caip19TokenSchema, frameNameSchema, hexColorSchema, secureUrlSchema, } from "./shared.js";
3
- export const actionLaunchFrameSchema = z.object({
4
- type: z.literal('launch_frame'),
5
- name: frameNameSchema,
6
- url: secureUrlSchema.optional(),
7
- splashImageUrl: secureUrlSchema.optional(),
8
- splashBackgroundColor: hexColorSchema.optional(),
9
- });
10
- export const actionViewTokenSchema = z.object({
11
- type: z.literal('view_token'),
12
- token: caip19TokenSchema,
13
- });
14
- export const actionSchema = z.discriminatedUnion('type', [
15
- actionLaunchFrameSchema,
16
- actionViewTokenSchema,
17
- ]);
18
- export const buttonSchema = z.object({
19
- title: buttonTitleSchema,
20
- action: actionSchema,
21
- });
22
- export const frameEmbedNextSchema = z.object({
23
- version: z.literal('next'),
24
- imageUrl: secureUrlSchema,
25
- aspectRatio: aspectRatioSchema.optional(),
26
- button: buttonSchema,
27
- });
28
- export const safeParseFrameEmbed = (rawResponse) => frameEmbedNextSchema.safeParse(rawResponse);