@farcaster/frame-core
Advanced tools
Comparing version 0.0.18 to 0.0.19
import { z } from "zod"; | ||
export declare const eventFrameAddedPayloadSchema: z.ZodObject<{ | ||
export declare const eventFrameAddedSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"frame_added">; | ||
@@ -27,4 +27,4 @@ notificationDetails: z.ZodOptional<z.ZodObject<{ | ||
}>; | ||
export type EventFrameAddedPayload = z.infer<typeof eventFrameAddedPayloadSchema>; | ||
export declare const eventFrameRemovedPayloadSchema: z.ZodObject<{ | ||
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>; | ||
export declare const eventFrameRemovedSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"frame_removed">; | ||
@@ -36,4 +36,4 @@ }, "strip", z.ZodTypeAny, { | ||
}>; | ||
export type EventFrameRemovedPayload = z.infer<typeof eventFrameRemovedPayloadSchema>; | ||
export declare const eventNotificationsEnabledPayloadSchema: z.ZodObject<{ | ||
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>; | ||
export declare const eventNotificationsEnabledSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"notifications_enabled">; | ||
@@ -63,4 +63,4 @@ notificationDetails: z.ZodObject<{ | ||
}>; | ||
export type EventNotificationsEnabledPayload = z.infer<typeof eventNotificationsEnabledPayloadSchema>; | ||
export declare const notificationsDisabledPayloadSchema: z.ZodObject<{ | ||
export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>; | ||
export declare const notificationsDisabledSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"notifications_disabled">; | ||
@@ -72,4 +72,4 @@ }, "strip", z.ZodTypeAny, { | ||
}>; | ||
export type EventNotificationsDisabledPayload = z.infer<typeof notificationsDisabledPayloadSchema>; | ||
export declare const eventPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{ | ||
export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>; | ||
export declare const serverEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{ | ||
event: z.ZodLiteral<"frame_added">; | ||
@@ -135,2 +135,2 @@ notificationDetails: z.ZodOptional<z.ZodObject<{ | ||
}>]>; | ||
export type FrameEvent = z.infer<typeof eventPayloadSchema>; | ||
export type FrameServerEvent = z.infer<typeof serverEventSchema>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.eventPayloadSchema = exports.notificationsDisabledPayloadSchema = exports.eventNotificationsEnabledPayloadSchema = exports.eventFrameRemovedPayloadSchema = exports.eventFrameAddedPayloadSchema = void 0; | ||
exports.serverEventSchema = exports.notificationsDisabledSchema = exports.eventNotificationsEnabledSchema = exports.eventFrameRemovedSchema = exports.eventFrameAddedSchema = void 0; | ||
const zod_1 = require("zod"); | ||
const notifications_1 = require("./notifications"); | ||
exports.eventFrameAddedPayloadSchema = zod_1.z.object({ | ||
exports.eventFrameAddedSchema = zod_1.z.object({ | ||
event: zod_1.z.literal("frame_added"), | ||
notificationDetails: notifications_1.notificationDetailsSchema.optional(), | ||
}); | ||
exports.eventFrameRemovedPayloadSchema = zod_1.z.object({ | ||
exports.eventFrameRemovedSchema = zod_1.z.object({ | ||
event: zod_1.z.literal("frame_removed"), | ||
}); | ||
exports.eventNotificationsEnabledPayloadSchema = zod_1.z.object({ | ||
exports.eventNotificationsEnabledSchema = zod_1.z.object({ | ||
event: zod_1.z.literal("notifications_enabled"), | ||
notificationDetails: notifications_1.notificationDetailsSchema.required(), | ||
}); | ||
exports.notificationsDisabledPayloadSchema = zod_1.z.object({ | ||
exports.notificationsDisabledSchema = zod_1.z.object({ | ||
event: zod_1.z.literal("notifications_disabled"), | ||
}); | ||
exports.eventPayloadSchema = zod_1.z.discriminatedUnion("event", [ | ||
exports.eventFrameAddedPayloadSchema, | ||
exports.eventFrameRemovedPayloadSchema, | ||
exports.eventNotificationsEnabledPayloadSchema, | ||
exports.notificationsDisabledPayloadSchema, | ||
exports.serverEventSchema = zod_1.z.discriminatedUnion("event", [ | ||
exports.eventFrameAddedSchema, | ||
exports.eventFrameRemovedSchema, | ||
exports.eventNotificationsEnabledSchema, | ||
exports.notificationsDisabledSchema, | ||
]); |
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from "ox"; | ||
import { FrameNotificationDetails } from "./schemas"; | ||
import { FrameNotificationDetails, EventFrameAdded, EventFrameRemoved, EventNotificationsEnabled, EventNotificationsDisabled } from "./schemas"; | ||
import * as SignIn from "./actions/signIn"; | ||
@@ -46,2 +46,3 @@ export type SetPrimaryButton = (options: { | ||
pfpUrl?: string; | ||
location?: AccountLocation; | ||
}; | ||
@@ -55,2 +56,3 @@ location?: FrameLocationContext; | ||
}; | ||
export type AddFrameRejectedReason = "invalid_domain_manifest" | "rejected_by_user"; | ||
export type AddFrameResult = { | ||
@@ -61,3 +63,3 @@ added: true; | ||
added: false; | ||
reason: "invalid_domain_manifest" | "rejected_by_user"; | ||
reason: AddFrameRejectedReason; | ||
}; | ||
@@ -141,1 +143,9 @@ export type AddFrame = () => Promise<AddFrameResult>; | ||
}>["params"]) => void; | ||
export type EventFrameAddRejected = { | ||
event: "frame_add_rejected"; | ||
reason: AddFrameRejectedReason; | ||
}; | ||
export type EventPrimaryButtonClicked = { | ||
event: "primary_button_clicked"; | ||
}; | ||
export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked; |
import { z } from "zod"; | ||
export declare const eventFrameAddedPayloadSchema: z.ZodObject<{ | ||
export declare const eventFrameAddedSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"frame_added">; | ||
@@ -27,4 +27,4 @@ notificationDetails: z.ZodOptional<z.ZodObject<{ | ||
}>; | ||
export type EventFrameAddedPayload = z.infer<typeof eventFrameAddedPayloadSchema>; | ||
export declare const eventFrameRemovedPayloadSchema: z.ZodObject<{ | ||
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>; | ||
export declare const eventFrameRemovedSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"frame_removed">; | ||
@@ -36,4 +36,4 @@ }, "strip", z.ZodTypeAny, { | ||
}>; | ||
export type EventFrameRemovedPayload = z.infer<typeof eventFrameRemovedPayloadSchema>; | ||
export declare const eventNotificationsEnabledPayloadSchema: z.ZodObject<{ | ||
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>; | ||
export declare const eventNotificationsEnabledSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"notifications_enabled">; | ||
@@ -63,4 +63,4 @@ notificationDetails: z.ZodObject<{ | ||
}>; | ||
export type EventNotificationsEnabledPayload = z.infer<typeof eventNotificationsEnabledPayloadSchema>; | ||
export declare const notificationsDisabledPayloadSchema: z.ZodObject<{ | ||
export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>; | ||
export declare const notificationsDisabledSchema: z.ZodObject<{ | ||
event: z.ZodLiteral<"notifications_disabled">; | ||
@@ -72,4 +72,4 @@ }, "strip", z.ZodTypeAny, { | ||
}>; | ||
export type EventNotificationsDisabledPayload = z.infer<typeof notificationsDisabledPayloadSchema>; | ||
export declare const eventPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{ | ||
export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>; | ||
export declare const serverEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{ | ||
event: z.ZodLiteral<"frame_added">; | ||
@@ -135,2 +135,2 @@ notificationDetails: z.ZodOptional<z.ZodObject<{ | ||
}>]>; | ||
export type FrameEvent = z.infer<typeof eventPayloadSchema>; | ||
export type FrameServerEvent = z.infer<typeof serverEventSchema>; |
import { z } from "zod"; | ||
import { notificationDetailsSchema } from "./notifications"; | ||
export const eventFrameAddedPayloadSchema = z.object({ | ||
export const eventFrameAddedSchema = z.object({ | ||
event: z.literal("frame_added"), | ||
notificationDetails: notificationDetailsSchema.optional(), | ||
}); | ||
export const eventFrameRemovedPayloadSchema = z.object({ | ||
export const eventFrameRemovedSchema = z.object({ | ||
event: z.literal("frame_removed"), | ||
}); | ||
export const eventNotificationsEnabledPayloadSchema = z.object({ | ||
export const eventNotificationsEnabledSchema = z.object({ | ||
event: z.literal("notifications_enabled"), | ||
notificationDetails: notificationDetailsSchema.required(), | ||
}); | ||
export const notificationsDisabledPayloadSchema = z.object({ | ||
export const notificationsDisabledSchema = z.object({ | ||
event: z.literal("notifications_disabled"), | ||
}); | ||
export const eventPayloadSchema = z.discriminatedUnion("event", [ | ||
eventFrameAddedPayloadSchema, | ||
eventFrameRemovedPayloadSchema, | ||
eventNotificationsEnabledPayloadSchema, | ||
notificationsDisabledPayloadSchema, | ||
export const serverEventSchema = z.discriminatedUnion("event", [ | ||
eventFrameAddedSchema, | ||
eventFrameRemovedSchema, | ||
eventNotificationsEnabledSchema, | ||
notificationsDisabledSchema, | ||
]); |
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from "ox"; | ||
import { FrameNotificationDetails } from "./schemas"; | ||
import { FrameNotificationDetails, EventFrameAdded, EventFrameRemoved, EventNotificationsEnabled, EventNotificationsDisabled } from "./schemas"; | ||
import * as SignIn from "./actions/signIn"; | ||
@@ -46,2 +46,3 @@ export type SetPrimaryButton = (options: { | ||
pfpUrl?: string; | ||
location?: AccountLocation; | ||
}; | ||
@@ -55,2 +56,3 @@ location?: FrameLocationContext; | ||
}; | ||
export type AddFrameRejectedReason = "invalid_domain_manifest" | "rejected_by_user"; | ||
export type AddFrameResult = { | ||
@@ -61,3 +63,3 @@ added: true; | ||
added: false; | ||
reason: "invalid_domain_manifest" | "rejected_by_user"; | ||
reason: AddFrameRejectedReason; | ||
}; | ||
@@ -141,1 +143,9 @@ export type AddFrame = () => Promise<AddFrameResult>; | ||
}>["params"]) => void; | ||
export type EventFrameAddRejected = { | ||
event: "frame_add_rejected"; | ||
reason: AddFrameRejectedReason; | ||
}; | ||
export type EventPrimaryButtonClicked = { | ||
event: "primary_button_clicked"; | ||
}; | ||
export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked; |
{ | ||
"name": "@farcaster/frame-core", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "esm/index.js", |
import { z } from "zod"; | ||
import { notificationDetailsSchema } from "./notifications"; | ||
export const eventFrameAddedPayloadSchema = z.object({ | ||
export const eventFrameAddedSchema = z.object({ | ||
event: z.literal("frame_added"), | ||
@@ -9,15 +9,11 @@ notificationDetails: notificationDetailsSchema.optional(), | ||
export type EventFrameAddedPayload = z.infer< | ||
typeof eventFrameAddedPayloadSchema | ||
>; | ||
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>; | ||
export const eventFrameRemovedPayloadSchema = z.object({ | ||
export const eventFrameRemovedSchema = z.object({ | ||
event: z.literal("frame_removed"), | ||
}); | ||
export type EventFrameRemovedPayload = z.infer< | ||
typeof eventFrameRemovedPayloadSchema | ||
>; | ||
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>; | ||
export const eventNotificationsEnabledPayloadSchema = z.object({ | ||
export const eventNotificationsEnabledSchema = z.object({ | ||
event: z.literal("notifications_enabled"), | ||
@@ -27,21 +23,21 @@ notificationDetails: notificationDetailsSchema.required(), | ||
export type EventNotificationsEnabledPayload = z.infer< | ||
typeof eventNotificationsEnabledPayloadSchema | ||
export type EventNotificationsEnabled = z.infer< | ||
typeof eventNotificationsEnabledSchema | ||
>; | ||
export const notificationsDisabledPayloadSchema = z.object({ | ||
export const notificationsDisabledSchema = z.object({ | ||
event: z.literal("notifications_disabled"), | ||
}); | ||
export type EventNotificationsDisabledPayload = z.infer< | ||
typeof notificationsDisabledPayloadSchema | ||
export type EventNotificationsDisabled = z.infer< | ||
typeof notificationsDisabledSchema | ||
>; | ||
export const eventPayloadSchema = z.discriminatedUnion("event", [ | ||
eventFrameAddedPayloadSchema, | ||
eventFrameRemovedPayloadSchema, | ||
eventNotificationsEnabledPayloadSchema, | ||
notificationsDisabledPayloadSchema, | ||
export const serverEventSchema = z.discriminatedUnion("event", [ | ||
eventFrameAddedSchema, | ||
eventFrameRemovedSchema, | ||
eventNotificationsEnabledSchema, | ||
notificationsDisabledSchema, | ||
]); | ||
export type FrameEvent = z.infer<typeof eventPayloadSchema>; | ||
export type FrameServerEvent = z.infer<typeof serverEventSchema>; |
@@ -1,3 +0,15 @@ | ||
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema, Siwe } from "ox"; | ||
import { FrameNotificationDetails } from "./schemas"; | ||
import type { | ||
Address, | ||
Provider, | ||
RpcRequest, | ||
RpcResponse, | ||
RpcSchema, | ||
} from "ox"; | ||
import { | ||
FrameNotificationDetails, | ||
EventFrameAdded, | ||
EventFrameRemoved, | ||
EventNotificationsEnabled, | ||
EventNotificationsDisabled, | ||
} from "./schemas"; | ||
import * as SignIn from "./actions/signIn"; | ||
@@ -57,2 +69,3 @@ | ||
pfpUrl?: string; | ||
location?: AccountLocation; | ||
}; | ||
@@ -67,2 +80,6 @@ location?: FrameLocationContext; | ||
export type AddFrameRejectedReason = | ||
| "invalid_domain_manifest" | ||
| "rejected_by_user"; | ||
export type AddFrameResult = | ||
@@ -75,3 +92,3 @@ | { | ||
added: false; | ||
reason: "invalid_domain_manifest" | "rejected_by_user"; | ||
reason: AddFrameRejectedReason; | ||
}; | ||
@@ -95,17 +112,17 @@ | ||
export type SignInOptions = { | ||
/** | ||
* A random string used to prevent replay attacks. | ||
*/ | ||
export type SignInOptions = { | ||
/** | ||
* A random string used to prevent replay attacks. | ||
*/ | ||
nonce: string; | ||
/** | ||
* Start time at which the signature becomes valid. | ||
* ISO 8601 datetime. | ||
*/ | ||
/** | ||
* Start time at which the signature becomes valid. | ||
* ISO 8601 datetime. | ||
*/ | ||
notBefore?: string; | ||
/** | ||
* Expiration time at which the signature is no longer valid. | ||
* ISO 8601 datetime. | ||
* Expiration time at which the signature is no longer valid. | ||
* ISO 8601 datetime. | ||
*/ | ||
@@ -179,1 +196,18 @@ expirationTime?: string; | ||
) => void; | ||
export type EventFrameAddRejected = { | ||
event: "frame_add_rejected"; | ||
reason: AddFrameRejectedReason; | ||
}; | ||
export type EventPrimaryButtonClicked = { | ||
event: "primary_button_clicked"; | ||
}; | ||
export type FrameClientEvent = | ||
| EventFrameAdded | ||
| EventFrameAddRejected | ||
| EventFrameRemoved | ||
| EventNotificationsEnabled | ||
| EventNotificationsDisabled | ||
| EventPrimaryButtonClicked; |
Sorry, the diff of this file is not supported yet
137072
2262