New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@farcaster/frame-core

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@farcaster/frame-core - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

227

dist/types.d.ts
import type { Provider, RpcSchema } from "ox";
import { z } from "zod";
export type SetPrimaryButton = (options: {

@@ -27,2 +28,21 @@ text: string;

};
export declare const notificationDetailsSchema: z.ZodObject<{
url: z.ZodString;
token: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
token: string;
}, {
url: string;
token: string;
}>;
export type FrameNotificationDetails = z.infer<typeof notificationDetailsSchema>;
export type AddFrameResult = {
added: true;
notificationDetails?: FrameNotificationDetails;
} | {
added: false;
reason: "invalid-domain-manifest" | "rejected-by-user";
};
export type AddFrame = () => Promise<AddFrameResult>;
export type FrameHost = {

@@ -35,2 +55,209 @@ context: FrameContext;

ethProviderRequest: EthProviderRequest;
addFrame: AddFrame;
};
export declare const eventSchema: z.ZodObject<{
header: z.ZodString;
payload: z.ZodString;
signature: z.ZodString;
}, "strip", z.ZodTypeAny, {
header: string;
payload: string;
signature: string;
}, {
header: string;
payload: string;
signature: string;
}>;
export type EventSchema = z.infer<typeof eventSchema>;
export declare const eventHeaderSchema: z.ZodObject<{
fid: z.ZodNumber;
type: z.ZodLiteral<"app_key">;
key: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "app_key";
fid: number;
key: string;
}, {
type: "app_key";
fid: number;
key: string;
}>;
export type EventHeader = z.infer<typeof eventHeaderSchema>;
export declare const eventFrameAddedPayloadSchema: z.ZodObject<{
event: z.ZodLiteral<"frame-added">;
notificationDetails: z.ZodOptional<z.ZodObject<{
url: z.ZodString;
token: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
token: string;
}, {
url: string;
token: string;
}>>;
}, "strip", z.ZodTypeAny, {
event: "frame-added";
notificationDetails?: {
url: string;
token: string;
} | undefined;
}, {
event: "frame-added";
notificationDetails?: {
url: string;
token: string;
} | undefined;
}>;
export type EventFrameAddedPayload = z.infer<typeof eventFrameAddedPayloadSchema>;
export declare const eventFrameRemovedPayloadSchema: z.ZodObject<{
event: z.ZodLiteral<"frame-removed">;
}, "strip", z.ZodTypeAny, {
event: "frame-removed";
}, {
event: "frame-removed";
}>;
export type EventFrameRemovedPayload = z.infer<typeof eventFrameRemovedPayloadSchema>;
export declare const eventNotificationsEnabledPayloadSchema: z.ZodObject<{
event: z.ZodLiteral<"notifications-enabled">;
notificationDetails: z.ZodObject<{
url: z.ZodString;
token: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
token: string;
}, {
url: string;
token: string;
}>;
}, "strip", z.ZodTypeAny, {
event: "notifications-enabled";
notificationDetails: {
url: string;
token: string;
};
}, {
event: "notifications-enabled";
notificationDetails: {
url: string;
token: string;
};
}>;
export type EventNotificationsEnabledPayload = z.infer<typeof eventNotificationsEnabledPayloadSchema>;
export declare const notificationsDisabledPayloadSchema: z.ZodObject<{
event: z.ZodLiteral<"notifications-disabled">;
}, "strip", z.ZodTypeAny, {
event: "notifications-disabled";
}, {
event: "notifications-disabled";
}>;
export type EventNotificationsDisabledPayload = z.infer<typeof notificationsDisabledPayloadSchema>;
export declare const eventPayloadSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
event: z.ZodLiteral<"frame-added">;
notificationDetails: z.ZodOptional<z.ZodObject<{
url: z.ZodString;
token: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
token: string;
}, {
url: string;
token: string;
}>>;
}, "strip", z.ZodTypeAny, {
event: "frame-added";
notificationDetails?: {
url: string;
token: string;
} | undefined;
}, {
event: "frame-added";
notificationDetails?: {
url: string;
token: string;
} | undefined;
}>, z.ZodObject<{
event: z.ZodLiteral<"frame-removed">;
}, "strip", z.ZodTypeAny, {
event: "frame-removed";
}, {
event: "frame-removed";
}>, z.ZodObject<{
event: z.ZodLiteral<"notifications-enabled">;
notificationDetails: z.ZodObject<{
url: z.ZodString;
token: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
token: string;
}, {
url: string;
token: string;
}>;
}, "strip", z.ZodTypeAny, {
event: "notifications-enabled";
notificationDetails: {
url: string;
token: string;
};
}, {
event: "notifications-enabled";
notificationDetails: {
url: string;
token: string;
};
}>, z.ZodObject<{
event: z.ZodLiteral<"notifications-disabled">;
}, "strip", z.ZodTypeAny, {
event: "notifications-disabled";
}, {
event: "notifications-disabled";
}>]>;
export type FrameEvent = z.infer<typeof eventPayloadSchema>;
export declare const sendNotificationRequestSchema: z.ZodObject<{
notificationId: z.ZodString;
title: z.ZodString;
body: z.ZodString;
targetUrl: z.ZodString;
tokens: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
notificationId: string;
title: string;
body: string;
targetUrl: string;
tokens: string[];
}, {
notificationId: string;
title: string;
body: string;
targetUrl: string;
tokens: string[];
}>;
export type SendNotificationRequest = z.infer<typeof sendNotificationRequestSchema>;
export declare const sendNotificationResponseSchema: z.ZodObject<{
result: z.ZodObject<{
successfulTokens: z.ZodArray<z.ZodString, "many">;
invalidTokens: z.ZodArray<z.ZodString, "many">;
rateLimitedTokens: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
successfulTokens: string[];
invalidTokens: string[];
rateLimitedTokens: string[];
}, {
successfulTokens: string[];
invalidTokens: string[];
rateLimitedTokens: string[];
}>;
}, "strip", z.ZodTypeAny, {
result: {
successfulTokens: string[];
invalidTokens: string[];
rateLimitedTokens: string[];
};
}, {
result: {
successfulTokens: string[];
invalidTokens: string[];
rateLimitedTokens: string[];
};
}>;
export type SendNotificationResponse = z.infer<typeof sendNotificationResponseSchema>;

54

dist/types.js

@@ -1,1 +0,53 @@

export {};
import { z } from "zod";
export const notificationDetailsSchema = z.object({
url: z.string(),
token: z.string(),
});
// Webhook event format (= JSON Farcaster Signature)
export const eventSchema = z.object({
header: z.string(),
payload: z.string(),
signature: z.string(),
});
// JSON Farcaster Signature header after decoding
export const eventHeaderSchema = z.object({
fid: z.number(),
type: z.literal("app_key"),
key: z.string().startsWith("0x"),
});
// Webhook event payload after decoding
export const eventFrameAddedPayloadSchema = z.object({
event: z.literal("frame-added"),
notificationDetails: notificationDetailsSchema.optional(),
});
export const eventFrameRemovedPayloadSchema = z.object({
event: z.literal("frame-removed"),
});
export const eventNotificationsEnabledPayloadSchema = z.object({
event: z.literal("notifications-enabled"),
notificationDetails: notificationDetailsSchema.required(),
});
export const notificationsDisabledPayloadSchema = z.object({
event: z.literal("notifications-disabled"),
});
export const eventPayloadSchema = z.discriminatedUnion("event", [
eventFrameAddedPayloadSchema,
eventFrameRemovedPayloadSchema,
eventNotificationsEnabledPayloadSchema,
notificationsDisabledPayloadSchema,
]);
// Notifications API request and response formats
export const sendNotificationRequestSchema = z.object({
notificationId: z.string().uuid(),
title: z.string().max(32),
body: z.string().max(128),
targetUrl: z.string().max(256),
tokens: z.string().array().max(100),
});
export const sendNotificationResponseSchema = z.object({
result: z.object({
successfulTokens: z.array(z.string()),
invalidTokens: z.array(z.string()),
rateLimitedTokens: z.array(z.string()),
}),
});

5

package.json
{
"name": "@farcaster/frame-core",
"version": "0.0.4",
"version": "0.0.5",
"main": "dist/index.js",

@@ -20,3 +20,4 @@ "scripts": {

"dependencies": {
"ox": "^0.1.6"
"ox": "^0.1.6",
"zod": "^3.23.8"
},

@@ -23,0 +24,0 @@ "publishConfig": {

import type { Provider, RpcSchema } from "ox";
import { z } from "zod";

@@ -29,5 +30,25 @@ export type SetPrimaryButton = (options: {

pfpUrl?: string;
}
};
};
export const notificationDetailsSchema = z.object({
url: z.string(),
token: z.string(),
});
export type FrameNotificationDetails = z.infer<
typeof notificationDetailsSchema
>;
export type AddFrameResult =
| {
added: true;
notificationDetails?: FrameNotificationDetails;
}
| {
added: false;
reason: "invalid-domain-manifest" | "rejected-by-user";
};
export type AddFrame = () => Promise<AddFrameResult>;
export type FrameHost = {

@@ -40,2 +61,85 @@ context: FrameContext;

ethProviderRequest: EthProviderRequest;
addFrame: AddFrame;
};
// Webhook event format (= JSON Farcaster Signature)
export const eventSchema = z.object({
header: z.string(),
payload: z.string(),
signature: z.string(),
});
export type EventSchema = z.infer<typeof eventSchema>;
// JSON Farcaster Signature header after decoding
export const eventHeaderSchema = z.object({
fid: z.number(),
type: z.literal("app_key"),
key: z.string().startsWith("0x"),
});
export type EventHeader = z.infer<typeof eventHeaderSchema>;
// Webhook event payload after decoding
export const eventFrameAddedPayloadSchema = z.object({
event: z.literal("frame-added"),
notificationDetails: notificationDetailsSchema.optional(),
});
export type EventFrameAddedPayload = z.infer<
typeof eventFrameAddedPayloadSchema
>;
export const eventFrameRemovedPayloadSchema = z.object({
event: z.literal("frame-removed"),
});
export type EventFrameRemovedPayload = z.infer<
typeof eventFrameRemovedPayloadSchema
>;
export const eventNotificationsEnabledPayloadSchema = z.object({
event: z.literal("notifications-enabled"),
notificationDetails: notificationDetailsSchema.required(),
});
export type EventNotificationsEnabledPayload = z.infer<
typeof eventNotificationsEnabledPayloadSchema
>;
export const notificationsDisabledPayloadSchema = z.object({
event: z.literal("notifications-disabled"),
});
export type EventNotificationsDisabledPayload = z.infer<
typeof notificationsDisabledPayloadSchema
>;
export const eventPayloadSchema = z.discriminatedUnion("event", [
eventFrameAddedPayloadSchema,
eventFrameRemovedPayloadSchema,
eventNotificationsEnabledPayloadSchema,
notificationsDisabledPayloadSchema,
]);
export type FrameEvent = z.infer<typeof eventPayloadSchema>;
// Notifications API request and response formats
export const sendNotificationRequestSchema = z.object({
notificationId: z.string().uuid(),
title: z.string().max(32),
body: z.string().max(128),
targetUrl: z.string().max(256),
tokens: z.string().array().max(100),
});
export type SendNotificationRequest = z.infer<
typeof sendNotificationRequestSchema
>;
export const sendNotificationResponseSchema = z.object({
result: z.object({
successfulTokens: z.array(z.string()),
invalidTokens: z.array(z.string()),
rateLimitedTokens: z.array(z.string()),
}),
});
export type SendNotificationResponse = z.infer<
typeof sendNotificationResponseSchema
>;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc