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.21 to 0.0.22

dist/actions/AddFrame.d.ts

2

dist/errors.js

@@ -5,3 +5,3 @@ "use strict";

class BaseError extends Error {
name = "BaseError";
name = 'BaseError';
cause;

@@ -8,0 +8,0 @@ constructor(message, options = {}) {

@@ -1,3 +0,3 @@

export * as SignIn from "./actions/signIn";
export * from "./types";
export * from "./schemas";
export * from './actions';
export * from './schemas';
export * from './types';

@@ -13,24 +13,2 @@ "use strict";

}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __exportStar = (this && this.__exportStar) || function(m, exports) {

@@ -40,5 +18,4 @@ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);

Object.defineProperty(exports, "__esModule", { value: true });
exports.SignIn = void 0;
exports.SignIn = __importStar(require("./actions/signIn"));
__exportStar(require("./actions"), exports);
__exportStar(require("./schemas"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./schemas"), exports);

@@ -1,7 +0,8 @@

export type Compute<type> = {
type Compute<type> = {
[key in keyof type]: type[key];
} & unknown;
type KeyofUnion<type> = type extends type ? keyof type : never;
export type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Compute<item & {
[key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;
}> : never;
export type KeyofUnion<type> = type extends type ? keyof type : never;
export {};

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from 'zod';
export declare const actionLaunchFrameSchema: z.ZodObject<{

@@ -3,0 +3,0 @@ type: z.ZodLiteral<"launch_frame">;

@@ -7,3 +7,3 @@ "use strict";

exports.actionLaunchFrameSchema = zod_1.z.object({
type: zod_1.z.literal("launch_frame"),
type: zod_1.z.literal('launch_frame'),
name: shared_1.frameNameSchema,

@@ -14,3 +14,3 @@ url: shared_1.secureUrlSchema,

});
exports.actionSchema = zod_1.z.discriminatedUnion("type", [
exports.actionSchema = zod_1.z.discriminatedUnion('type', [
exports.actionLaunchFrameSchema,

@@ -23,3 +23,3 @@ ]);

exports.frameEmbedNextSchema = zod_1.z.object({
version: zod_1.z.literal("next"),
version: zod_1.z.literal('next'),
imageUrl: shared_1.secureUrlSchema,

@@ -26,0 +26,0 @@ button: exports.buttonSchema,

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from 'zod';
export declare const eventFrameAddedSchema: z.ZodObject<{

@@ -3,0 +3,0 @@ event: z.ZodLiteral<"frame_added">;

@@ -7,16 +7,16 @@ "use strict";

exports.eventFrameAddedSchema = zod_1.z.object({
event: zod_1.z.literal("frame_added"),
event: zod_1.z.literal('frame_added'),
notificationDetails: notifications_1.notificationDetailsSchema.optional(),
});
exports.eventFrameRemovedSchema = zod_1.z.object({
event: zod_1.z.literal("frame_removed"),
event: zod_1.z.literal('frame_removed'),
});
exports.eventNotificationsEnabledSchema = zod_1.z.object({
event: zod_1.z.literal("notifications_enabled"),
event: zod_1.z.literal('notifications_enabled'),
notificationDetails: notifications_1.notificationDetailsSchema.required(),
});
exports.notificationsDisabledSchema = zod_1.z.object({
event: zod_1.z.literal("notifications_disabled"),
event: zod_1.z.literal('notifications_disabled'),
});
exports.serverEventSchema = zod_1.z.discriminatedUnion("event", [
exports.serverEventSchema = zod_1.z.discriminatedUnion('event', [
exports.eventFrameAddedSchema,

@@ -23,0 +23,0 @@ exports.eventFrameRemovedSchema,

@@ -1,5 +0,5 @@

export * from "./embeds";
export * from "./events";
export * from "./shared";
export * from "./manifest";
export * from "./notifications";
export * from './embeds';
export * from './events';
export * from './shared';
export * from './manifest';
export * from './notifications';

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from 'zod';
export declare const domainFrameConfigSchema: z.ZodObject<{

@@ -3,0 +3,0 @@ version: z.ZodUnion<[z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;

@@ -11,6 +11,6 @@ "use strict";

version: zod_1.z.union([
zod_1.z.literal("0.0.0"),
zod_1.z.literal("0.0.1"),
zod_1.z.literal("1"),
zod_1.z.literal('next')
zod_1.z.literal('0.0.0'),
zod_1.z.literal('0.0.1'),
zod_1.z.literal('1'),
zod_1.z.literal('next'),
]),

@@ -17,0 +17,0 @@ name: shared_1.frameNameSchema,

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from 'zod';
export declare const notificationDetailsSchema: z.ZodObject<{

@@ -3,0 +3,0 @@ url: z.ZodString;

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from 'zod';
export declare const secureUrlSchema: z.ZodString;

@@ -3,0 +3,0 @@ export declare const frameNameSchema: z.ZodString;

@@ -8,3 +8,3 @@ "use strict";

.url()
.startsWith("https://", { message: "Must be an https url" })
.startsWith('https://', { message: 'Must be an https url' })
.max(512);

@@ -16,3 +16,3 @@ exports.frameNameSchema = zod_1.z.string().max(32);

.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
message: "Invalid hex color code. It should be in the format #RRGGBB or #RGB.",
message: 'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
});

@@ -26,4 +26,4 @@ exports.encodedJsonFarcasterSignatureSchema = zod_1.z.object({

fid: zod_1.z.number(),
type: zod_1.z.literal("app_key"),
key: zod_1.z.string().startsWith("0x"),
type: zod_1.z.literal('app_key'),
key: zod_1.z.string().startsWith('0x'),
});

@@ -1,5 +0,5 @@

import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from "ox";
import { FrameNotificationDetails, EventFrameAdded, EventFrameRemoved, EventNotificationsEnabled, EventNotificationsDisabled } from "./schemas";
import * as SignIn from "./actions/signIn";
export type SetPrimaryButton = (options: {
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox';
import type { AddFrame, SignIn } from './actions';
import type { EventFrameAdded, EventFrameRemoved, EventNotificationsDisabled, EventNotificationsEnabled, FrameNotificationDetails } from './schemas';
export type SetPrimaryButtonOptions = {
text: string;

@@ -9,3 +9,4 @@ loading?: boolean;

hidden?: boolean;
}) => void;
};
export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void;
export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>;

@@ -20,3 +21,3 @@ export type AccountLocation = {

export type FrameLocationContextCastEmbed = {
type: "cast_embed";
type: 'cast_embed';
embed: string;

@@ -29,3 +30,3 @@ cast: {

export type FrameLocationContextNotification = {
type: "notification";
type: 'notification';
notification: {

@@ -38,3 +39,3 @@ notificationId: string;

export type FrameLocationContextLauncher = {
type: "launcher";
type: 'launcher';
};

@@ -67,11 +68,2 @@ export type FrameLocationContext = FrameLocationContextCastEmbed | FrameLocationContextNotification | FrameLocationContextLauncher;

};
export type AddFrameRejectedReason = "invalid_domain_manifest" | "rejected_by_user";
export type AddFrameResult = {
added: true;
notificationDetails?: FrameNotificationDetails;
} | {
added: false;
reason: AddFrameRejectedReason;
};
export type AddFrame = () => Promise<AddFrameResult>;
export type ReadyOptions = {

@@ -112,3 +104,4 @@ /**

ethProviderRequestV2: RpcTransport;
addFrame: AddFrame;
eip6963RequestProvider: () => void;
addFrame: AddFrame.WireAddFrame;
};

@@ -124,6 +117,11 @@ export type FrameHost = {

ethProviderRequestV2: RpcTransport;
addFrame: AddFrame;
/**
* Receive forwarded eip6963:requestProvider events from the frame document.
* Hosts must emit an EventEip6963AnnounceProvider in response.
*/
eip6963RequestProvider: () => void;
addFrame: AddFrame.AddFrame;
};
export type FrameEthProviderEventData = {
type: "frame_eth_provider_event";
type: 'frame_eth_provider_event';
} & EthProviderWireEvent;

@@ -137,27 +135,40 @@ export type RpcTransport = (request: RpcRequest.RpcRequest) => Promise<RpcResponse.RpcResponse>;

export type EthProviderWireEvent = {
event: "accountsChanged";
event: 'accountsChanged';
params: [readonly Address.Address[]];
} | {
event: "chainChanged";
event: 'chainChanged';
params: [string];
} | {
event: "connect";
event: 'connect';
params: [Provider.ConnectInfo];
} | {
event: "disconnect";
event: 'disconnect';
params: [ProviderRpcError];
} | {
event: "message";
event: 'message';
params: [Provider.Message];
};
export type EmitEthProvider = <event extends EthProviderWireEvent["event"]>(event: event, params: Extract<EthProviderWireEvent, {
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(event: event, params: Extract<EthProviderWireEvent, {
event: event;
}>["params"]) => void;
}>['params']) => void;
export type EventFrameAddRejected = {
event: "frame_add_rejected";
reason: AddFrameRejectedReason;
event: 'frame_add_rejected';
reason: AddFrame.AddFrameRejectedReason;
};
export type EventPrimaryButtonClicked = {
event: "primary_button_clicked";
event: 'primary_button_clicked';
};
export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked;
/**
* Metadata of the EIP-1193 Provider.
*/
export interface EIP6963ProviderInfo {
icon: `data:image/${string}`;
name: string;
rdns: string;
uuid: string;
}
export type EventEip6963AnnounceProvider = {
event: 'eip6963:announceProvider';
info: EIP6963ProviderInfo;
};
export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked | EventEip6963AnnounceProvider;

@@ -1,10 +0,12 @@

export declare class BaseError<cause extends Error | undefined = undefined> extends Error {
name: string;
cause: cause;
constructor(message: string, options?: BaseError.Options<cause>);
export declare class BaseError<
cause extends Error | undefined = undefined,
> extends Error {
name: string
cause: cause
constructor(message: string, options?: BaseError.Options<cause>)
}
export declare namespace BaseError {
type Options<cause extends Error | undefined = Error | undefined> = {
cause?: cause | undefined;
};
type Options<cause extends Error | undefined = Error | undefined> = {
cause?: cause | undefined
}
}
export class BaseError extends Error {
name = "BaseError";
cause;
constructor(message, options = {}) {
super(message, options.cause ? { cause: options.cause } : undefined);
this.cause = options.cause;
}
name = 'BaseError'
cause
constructor(message, options = {}) {
super(message, options.cause ? { cause: options.cause } : undefined)
this.cause = options.cause
}
}

@@ -1,3 +0,3 @@

export * as SignIn from "./actions/signIn";
export * from "./types";
export * from "./schemas";
export * from './actions'
export * from './schemas'
export * from './types'

@@ -1,3 +0,3 @@

export * as SignIn from "./actions/signIn";
export * from "./types";
export * from "./schemas";
export * from './actions'
export * from './schemas'
export * from './types'

@@ -1,7 +0,19 @@

export type Compute<type> = {
[key in keyof type]: type[key];
} & unknown;
export type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Compute<item & {
[key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;
}> : never;
export type KeyofUnion<type> = type extends type ? keyof type : never;
type Compute<type> = {
[key in keyof type]: type[key]
} & unknown
type KeyofUnion<type> = type extends type ? keyof type : never
export type OneOf<
union extends object,
fallback extends object | undefined = undefined,
keys extends KeyofUnion<union> = KeyofUnion<union>,
> = union extends infer item
? Compute<
item & {
[key in Exclude<keys, keyof item>]?: fallback extends object
? key extends keyof fallback
? fallback[key]
: undefined
: undefined
}
>
: never

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

export {};
export {}

@@ -1,177 +0,239 @@

import { z } from "zod";
export declare const actionLaunchFrameSchema: z.ZodObject<{
type: z.ZodLiteral<"launch_frame">;
name: z.ZodString;
url: z.ZodString;
splashImageUrl: z.ZodOptional<z.ZodString>;
splashBackgroundColor: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}>;
export declare const actionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"launch_frame">;
name: z.ZodString;
url: z.ZodString;
splashImageUrl: z.ZodOptional<z.ZodString>;
splashBackgroundColor: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}>]>;
export declare const buttonSchema: z.ZodObject<{
title: z.ZodString;
action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"launch_frame">;
name: z.ZodString;
url: z.ZodString;
splashImageUrl: z.ZodOptional<z.ZodString>;
splashBackgroundColor: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}>]>;
}, "strip", z.ZodTypeAny, {
title: string;
import type { z } from 'zod'
export declare const actionLaunchFrameSchema: z.ZodObject<
{
type: z.ZodLiteral<'launch_frame'>
name: z.ZodString
url: z.ZodString
splashImageUrl: z.ZodOptional<z.ZodString>
splashBackgroundColor: z.ZodOptional<z.ZodString>
},
'strip',
z.ZodTypeAny,
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
},
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
>
export declare const actionSchema: z.ZodDiscriminatedUnion<
'type',
[
z.ZodObject<
{
type: z.ZodLiteral<'launch_frame'>
name: z.ZodString
url: z.ZodString
splashImageUrl: z.ZodOptional<z.ZodString>
splashBackgroundColor: z.ZodOptional<z.ZodString>
},
'strip',
z.ZodTypeAny,
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
},
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
>,
]
>
export declare const buttonSchema: z.ZodObject<
{
title: z.ZodString
action: z.ZodDiscriminatedUnion<
'type',
[
z.ZodObject<
{
type: z.ZodLiteral<'launch_frame'>
name: z.ZodString
url: z.ZodString
splashImageUrl: z.ZodOptional<z.ZodString>
splashBackgroundColor: z.ZodOptional<z.ZodString>
},
'strip',
z.ZodTypeAny,
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
},
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
>,
]
>
},
'strip',
z.ZodTypeAny,
{
title: string
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
}, {
title: string;
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
},
{
title: string
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
}>;
export declare const frameEmbedNextSchema: z.ZodObject<{
version: z.ZodLiteral<"next">;
imageUrl: z.ZodString;
button: z.ZodObject<{
title: z.ZodString;
action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"launch_frame">;
name: z.ZodString;
url: z.ZodString;
splashImageUrl: z.ZodOptional<z.ZodString>;
splashBackgroundColor: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}, {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
}>]>;
}, "strip", z.ZodTypeAny, {
title: string;
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
}
>
export declare const frameEmbedNextSchema: z.ZodObject<
{
version: z.ZodLiteral<'next'>
imageUrl: z.ZodString
button: z.ZodObject<
{
title: z.ZodString
action: z.ZodDiscriminatedUnion<
'type',
[
z.ZodObject<
{
type: z.ZodLiteral<'launch_frame'>
name: z.ZodString
url: z.ZodString
splashImageUrl: z.ZodOptional<z.ZodString>
splashBackgroundColor: z.ZodOptional<z.ZodString>
},
'strip',
z.ZodTypeAny,
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
},
{
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
>,
]
>
},
'strip',
z.ZodTypeAny,
{
title: string
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
}, {
title: string;
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
},
{
title: string
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
}>;
}, "strip", z.ZodTypeAny, {
version: "next";
imageUrl: string;
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
}
>
},
'strip',
z.ZodTypeAny,
{
version: 'next'
imageUrl: string
button: {
title: string;
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
};
}, {
version: "next";
imageUrl: string;
title: string
action: {
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
}
},
{
version: 'next'
imageUrl: string
button: {
title: string;
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
};
}>;
export declare const safeParseFrameEmbed: (rawResponse: unknown) => z.SafeParseReturnType<{
version: "next";
imageUrl: string;
title: string
action: {
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
}
}
>
export declare const safeParseFrameEmbed: (
rawResponse: unknown,
) => z.SafeParseReturnType<
{
version: 'next'
imageUrl: string
button: {
title: string;
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
};
}, {
version: "next";
imageUrl: string;
title: string
action: {
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
}
},
{
version: 'next'
imageUrl: string
button: {
title: string;
action: {
type: "launch_frame";
name: string;
url: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
};
};
}>;
export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>;
title: string
action: {
type: 'launch_frame'
name: string
url: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
}
}
}
>
export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>

@@ -1,22 +0,28 @@

import { z } from "zod";
import { hexColorSchema, frameNameSchema, secureUrlSchema, buttonTitleSchema, } from "./shared";
import { z } from 'zod'
import {
buttonTitleSchema,
frameNameSchema,
hexColorSchema,
secureUrlSchema,
} from './shared'
export const actionLaunchFrameSchema = z.object({
type: z.literal("launch_frame"),
name: frameNameSchema,
url: secureUrlSchema,
splashImageUrl: secureUrlSchema.optional(),
splashBackgroundColor: hexColorSchema.optional(),
});
export const actionSchema = z.discriminatedUnion("type", [
actionLaunchFrameSchema,
]);
type: z.literal('launch_frame'),
name: frameNameSchema,
url: secureUrlSchema,
splashImageUrl: secureUrlSchema.optional(),
splashBackgroundColor: hexColorSchema.optional(),
})
export const actionSchema = z.discriminatedUnion('type', [
actionLaunchFrameSchema,
])
export const buttonSchema = z.object({
title: buttonTitleSchema,
action: actionSchema,
});
title: buttonTitleSchema,
action: actionSchema,
})
export const frameEmbedNextSchema = z.object({
version: z.literal("next"),
imageUrl: secureUrlSchema,
button: buttonSchema,
});
export const safeParseFrameEmbed = (rawResponse) => frameEmbedNextSchema.safeParse(rawResponse);
version: z.literal('next'),
imageUrl: secureUrlSchema,
button: buttonSchema,
})
export const safeParseFrameEmbed = (rawResponse) =>
frameEmbedNextSchema.safeParse(rawResponse)

@@ -1,131 +0,227 @@

import { z } from "zod";
export declare const eventFrameAddedSchema: 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 EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
export declare const eventFrameRemovedSchema: z.ZodObject<{
event: z.ZodLiteral<"frame_removed">;
}, "strip", z.ZodTypeAny, {
event: "frame_removed";
}, {
event: "frame_removed";
}>;
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
export declare const eventNotificationsEnabledSchema: 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";
import type { z } from 'zod'
export declare const eventFrameAddedSchema: 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 EventFrameAdded = z.infer<typeof eventFrameAddedSchema>
export declare const eventFrameRemovedSchema: z.ZodObject<
{
event: z.ZodLiteral<'frame_removed'>
},
'strip',
z.ZodTypeAny,
{
event: 'frame_removed'
},
{
event: 'frame_removed'
}
>
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>
export declare const eventNotificationsEnabledSchema: 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";
url: string
token: string
}
},
{
event: 'notifications_enabled'
notificationDetails: {
url: string;
token: string;
};
}>;
export type EventNotificationsEnabled = z.infer<typeof eventNotificationsEnabledSchema>;
export declare const notificationsDisabledSchema: z.ZodObject<{
event: z.ZodLiteral<"notifications_disabled">;
}, "strip", z.ZodTypeAny, {
event: "notifications_disabled";
}, {
event: "notifications_disabled";
}>;
export type EventNotificationsDisabled = z.infer<typeof notificationsDisabledSchema>;
export declare const serverEventSchema: 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 FrameServerEvent = z.infer<typeof serverEventSchema>;
url: string
token: string
}
}
>
export type EventNotificationsEnabled = z.infer<
typeof eventNotificationsEnabledSchema
>
export declare const notificationsDisabledSchema: z.ZodObject<
{
event: z.ZodLiteral<'notifications_disabled'>
},
'strip',
z.ZodTypeAny,
{
event: 'notifications_disabled'
},
{
event: 'notifications_disabled'
}
>
export type EventNotificationsDisabled = z.infer<
typeof notificationsDisabledSchema
>
export declare const serverEventSchema: 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 FrameServerEvent = z.infer<typeof serverEventSchema>

@@ -1,22 +0,22 @@

import { z } from "zod";
import { notificationDetailsSchema } from "./notifications";
import { z } from 'zod'
import { notificationDetailsSchema } from './notifications'
export const eventFrameAddedSchema = z.object({
event: z.literal("frame_added"),
notificationDetails: notificationDetailsSchema.optional(),
});
event: z.literal('frame_added'),
notificationDetails: notificationDetailsSchema.optional(),
})
export const eventFrameRemovedSchema = z.object({
event: z.literal("frame_removed"),
});
event: z.literal('frame_removed'),
})
export const eventNotificationsEnabledSchema = z.object({
event: z.literal("notifications_enabled"),
notificationDetails: notificationDetailsSchema.required(),
});
event: z.literal('notifications_enabled'),
notificationDetails: notificationDetailsSchema.required(),
})
export const notificationsDisabledSchema = z.object({
event: z.literal("notifications_disabled"),
});
export const serverEventSchema = z.discriminatedUnion("event", [
eventFrameAddedSchema,
eventFrameRemovedSchema,
eventNotificationsEnabledSchema,
notificationsDisabledSchema,
]);
event: z.literal('notifications_disabled'),
})
export const serverEventSchema = z.discriminatedUnion('event', [
eventFrameAddedSchema,
eventFrameRemovedSchema,
eventNotificationsEnabledSchema,
notificationsDisabledSchema,
])

@@ -1,5 +0,5 @@

export * from "./embeds";
export * from "./events";
export * from "./shared";
export * from "./manifest";
export * from "./notifications";
export * from './embeds'
export * from './events'
export * from './shared'
export * from './manifest'
export * from './notifications'

@@ -1,5 +0,5 @@

export * from "./embeds";
export * from "./events";
export * from "./shared";
export * from "./manifest";
export * from "./notifications";
export * from './embeds'
export * from './events'
export * from './shared'
export * from './manifest'
export * from './notifications'

@@ -1,112 +0,156 @@

import { z } from "zod";
export declare const domainFrameConfigSchema: z.ZodObject<{
version: z.ZodUnion<[z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;
name: z.ZodString;
iconUrl: z.ZodString;
homeUrl: z.ZodString;
imageUrl: z.ZodOptional<z.ZodString>;
buttonTitle: z.ZodOptional<z.ZodString>;
splashImageUrl: z.ZodOptional<z.ZodString>;
splashBackgroundColor: z.ZodOptional<z.ZodString>;
webhookUrl: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
name: string;
version: "next" | "0.0.0" | "0.0.1" | "1";
iconUrl: string;
homeUrl: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
imageUrl?: string | undefined;
buttonTitle?: string | undefined;
webhookUrl?: string | undefined;
}, {
name: string;
version: "next" | "0.0.0" | "0.0.1" | "1";
iconUrl: string;
homeUrl: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
imageUrl?: string | undefined;
buttonTitle?: string | undefined;
webhookUrl?: string | undefined;
}>;
export declare const domainManifestSchema: z.ZodObject<{
accountAssociation: 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;
}>;
frame: z.ZodOptional<z.ZodObject<{
version: z.ZodUnion<[z.ZodLiteral<"0.0.0">, z.ZodLiteral<"0.0.1">, z.ZodLiteral<"1">, z.ZodLiteral<"next">]>;
name: z.ZodString;
iconUrl: z.ZodString;
homeUrl: z.ZodString;
imageUrl: z.ZodOptional<z.ZodString>;
buttonTitle: z.ZodOptional<z.ZodString>;
splashImageUrl: z.ZodOptional<z.ZodString>;
splashBackgroundColor: z.ZodOptional<z.ZodString>;
webhookUrl: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
name: string;
version: "next" | "0.0.0" | "0.0.1" | "1";
iconUrl: string;
homeUrl: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
imageUrl?: string | undefined;
buttonTitle?: string | undefined;
webhookUrl?: string | undefined;
}, {
name: string;
version: "next" | "0.0.0" | "0.0.1" | "1";
iconUrl: string;
homeUrl: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
imageUrl?: string | undefined;
buttonTitle?: string | undefined;
webhookUrl?: string | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
import type { z } from 'zod'
export declare const domainFrameConfigSchema: z.ZodObject<
{
version: z.ZodUnion<
[
z.ZodLiteral<'0.0.0'>,
z.ZodLiteral<'0.0.1'>,
z.ZodLiteral<'1'>,
z.ZodLiteral<'next'>,
]
>
name: z.ZodString
iconUrl: z.ZodString
homeUrl: z.ZodString
imageUrl: z.ZodOptional<z.ZodString>
buttonTitle: z.ZodOptional<z.ZodString>
splashImageUrl: z.ZodOptional<z.ZodString>
splashBackgroundColor: z.ZodOptional<z.ZodString>
webhookUrl: z.ZodOptional<z.ZodString>
},
'strip',
z.ZodTypeAny,
{
name: string
version: 'next' | '0.0.0' | '0.0.1' | '1'
iconUrl: string
homeUrl: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
imageUrl?: string | undefined
buttonTitle?: string | undefined
webhookUrl?: string | undefined
},
{
name: string
version: 'next' | '0.0.0' | '0.0.1' | '1'
iconUrl: string
homeUrl: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
imageUrl?: string | undefined
buttonTitle?: string | undefined
webhookUrl?: string | undefined
}
>
export declare const domainManifestSchema: z.ZodObject<
{
accountAssociation: 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
}
>
frame: z.ZodOptional<
z.ZodObject<
{
version: z.ZodUnion<
[
z.ZodLiteral<'0.0.0'>,
z.ZodLiteral<'0.0.1'>,
z.ZodLiteral<'1'>,
z.ZodLiteral<'next'>,
]
>
name: z.ZodString
iconUrl: z.ZodString
homeUrl: z.ZodString
imageUrl: z.ZodOptional<z.ZodString>
buttonTitle: z.ZodOptional<z.ZodString>
splashImageUrl: z.ZodOptional<z.ZodString>
splashBackgroundColor: z.ZodOptional<z.ZodString>
webhookUrl: z.ZodOptional<z.ZodString>
},
'strip',
z.ZodTypeAny,
{
name: string
version: 'next' | '0.0.0' | '0.0.1' | '1'
iconUrl: string
homeUrl: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
imageUrl?: string | undefined
buttonTitle?: string | undefined
webhookUrl?: string | undefined
},
{
name: string
version: 'next' | '0.0.0' | '0.0.1' | '1'
iconUrl: string
homeUrl: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
imageUrl?: string | undefined
buttonTitle?: string | undefined
webhookUrl?: string | undefined
}
>
>
},
'strip',
z.ZodTypeAny,
{
accountAssociation: {
header: string;
payload: string;
signature: string;
};
frame?: {
name: string;
version: "next" | "0.0.0" | "0.0.1" | "1";
iconUrl: string;
homeUrl: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
imageUrl?: string | undefined;
buttonTitle?: string | undefined;
webhookUrl?: string | undefined;
} | undefined;
}, {
header: string
payload: string
signature: string
}
frame?:
| {
name: string
version: 'next' | '0.0.0' | '0.0.1' | '1'
iconUrl: string
homeUrl: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
imageUrl?: string | undefined
buttonTitle?: string | undefined
webhookUrl?: string | undefined
}
| undefined
},
{
accountAssociation: {
header: string;
payload: string;
signature: string;
};
frame?: {
name: string;
version: "next" | "0.0.0" | "0.0.1" | "1";
iconUrl: string;
homeUrl: string;
splashImageUrl?: string | undefined;
splashBackgroundColor?: string | undefined;
imageUrl?: string | undefined;
buttonTitle?: string | undefined;
webhookUrl?: string | undefined;
} | undefined;
}>;
header: string
payload: string
signature: string
}
frame?:
| {
name: string
version: 'next' | '0.0.0' | '0.0.1' | '1'
iconUrl: string
homeUrl: string
splashImageUrl?: string | undefined
splashBackgroundColor?: string | undefined
imageUrl?: string | undefined
buttonTitle?: string | undefined
webhookUrl?: string | undefined
}
| undefined
}
>

@@ -1,25 +0,31 @@

import { z } from "zod";
import { secureUrlSchema, frameNameSchema, hexColorSchema, encodedJsonFarcasterSignatureSchema, buttonTitleSchema, } from "./shared";
import { z } from 'zod'
import {
buttonTitleSchema,
encodedJsonFarcasterSignatureSchema,
frameNameSchema,
hexColorSchema,
secureUrlSchema,
} from './shared'
export const domainFrameConfigSchema = z.object({
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for
// backwards compatibilty. next should always resolve to the most recent
// schema version.
version: z.union([
z.literal("0.0.0"),
z.literal("0.0.1"),
z.literal("1"),
z.literal('next')
]),
name: frameNameSchema,
iconUrl: secureUrlSchema,
homeUrl: secureUrlSchema,
imageUrl: secureUrlSchema.optional(),
buttonTitle: buttonTitleSchema.optional(),
splashImageUrl: secureUrlSchema.optional(),
splashBackgroundColor: hexColorSchema.optional(),
webhookUrl: secureUrlSchema.optional(),
});
// 0.0.0 and 0.0.1 are not technically part of the spec but kept for
// backwards compatibilty. next should always resolve to the most recent
// schema version.
version: z.union([
z.literal('0.0.0'),
z.literal('0.0.1'),
z.literal('1'),
z.literal('next'),
]),
name: frameNameSchema,
iconUrl: secureUrlSchema,
homeUrl: secureUrlSchema,
imageUrl: secureUrlSchema.optional(),
buttonTitle: buttonTitleSchema.optional(),
splashImageUrl: secureUrlSchema.optional(),
splashBackgroundColor: hexColorSchema.optional(),
webhookUrl: secureUrlSchema.optional(),
})
export const domainManifestSchema = z.object({
accountAssociation: encodedJsonFarcasterSignatureSchema,
frame: domainFrameConfigSchema.optional(),
});
accountAssociation: encodedJsonFarcasterSignatureSchema,
frame: domainFrameConfigSchema.optional(),
})

@@ -1,60 +0,88 @@

import { z } from "zod";
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 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, {
title: string;
notificationId: string;
body: string;
targetUrl: string;
tokens: string[];
}, {
title: string;
notificationId: 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, {
import type { z } from 'zod'
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 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,
{
title: string
notificationId: string
body: string
targetUrl: string
tokens: string[]
},
{
title: string
notificationId: 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[];
};
}, {
successfulTokens: string[]
invalidTokens: string[]
rateLimitedTokens: string[]
}
},
{
result: {
successfulTokens: string[];
invalidTokens: string[];
rateLimitedTokens: string[];
};
}>;
export type SendNotificationResponse = z.infer<typeof sendNotificationResponseSchema>;
successfulTokens: string[]
invalidTokens: string[]
rateLimitedTokens: string[]
}
}
>
export type SendNotificationResponse = z.infer<
typeof sendNotificationResponseSchema
>

@@ -1,20 +0,20 @@

import { z } from "zod";
import { secureUrlSchema } from "./shared";
import { z } from 'zod'
import { secureUrlSchema } from './shared'
export const notificationDetailsSchema = z.object({
url: z.string(),
token: z.string(),
});
url: z.string(),
token: z.string(),
})
export const sendNotificationRequestSchema = z.object({
notificationId: z.string().max(128),
title: z.string().max(32),
body: z.string().max(128),
targetUrl: secureUrlSchema,
tokens: z.string().array().max(100),
});
notificationId: z.string().max(128),
title: z.string().max(32),
body: z.string().max(128),
targetUrl: secureUrlSchema,
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()),
}),
});
result: z.object({
successfulTokens: z.array(z.string()),
invalidTokens: z.array(z.string()),
rateLimitedTokens: z.array(z.string()),
}),
})

@@ -1,33 +0,49 @@

import { z } from "zod";
export declare const secureUrlSchema: z.ZodString;
export declare const frameNameSchema: z.ZodString;
export declare const buttonTitleSchema: z.ZodString;
export declare const hexColorSchema: z.ZodString;
export declare const encodedJsonFarcasterSignatureSchema: 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 EncodedJsonFarcasterSignatureSchema = z.infer<typeof encodedJsonFarcasterSignatureSchema>;
export declare const jsonFarcasterSignatureHeaderSchema: 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 JsonFarcasterSignatureHeaderSchema = z.infer<typeof jsonFarcasterSignatureHeaderSchema>;
import type { z } from 'zod'
export declare const secureUrlSchema: z.ZodString
export declare const frameNameSchema: z.ZodString
export declare const buttonTitleSchema: z.ZodString
export declare const hexColorSchema: z.ZodString
export declare const encodedJsonFarcasterSignatureSchema: 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 EncodedJsonFarcasterSignatureSchema = z.infer<
typeof encodedJsonFarcasterSignatureSchema
>
export declare const jsonFarcasterSignatureHeaderSchema: 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 JsonFarcasterSignatureHeaderSchema = z.infer<
typeof jsonFarcasterSignatureHeaderSchema
>

@@ -1,23 +0,24 @@

import { z } from "zod";
import { z } from 'zod'
export const secureUrlSchema = z
.string()
.url()
.startsWith("https://", { message: "Must be an https url" })
.max(512);
export const frameNameSchema = z.string().max(32);
export const buttonTitleSchema = z.string().max(32);
.string()
.url()
.startsWith('https://', { message: 'Must be an https url' })
.max(512)
export const frameNameSchema = z.string().max(32)
export const buttonTitleSchema = z.string().max(32)
export const hexColorSchema = z
.string()
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
message: "Invalid hex color code. It should be in the format #RRGGBB or #RGB.",
});
.string()
.regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i, {
message:
'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
})
export const encodedJsonFarcasterSignatureSchema = z.object({
header: z.string(),
payload: z.string(),
signature: z.string(),
});
header: z.string(),
payload: z.string(),
signature: z.string(),
})
export const jsonFarcasterSignatureHeaderSchema = z.object({
fid: z.number(),
type: z.literal("app_key"),
key: z.string().startsWith("0x"),
});
fid: z.number(),
type: z.literal('app_key'),
key: z.string().startsWith('0x'),
})

@@ -1,155 +0,195 @@

import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from "ox";
import { FrameNotificationDetails, EventFrameAdded, EventFrameRemoved, EventNotificationsEnabled, EventNotificationsDisabled } from "./schemas";
import * as SignIn from "./actions/signIn";
export type SetPrimaryButton = (options: {
text: string;
loading?: boolean;
disabled?: boolean;
hidden?: boolean;
}) => void;
export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>;
import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox'
import type { AddFrame, SignIn } from './actions'
import type {
EventFrameAdded,
EventFrameRemoved,
EventNotificationsDisabled,
EventNotificationsEnabled,
FrameNotificationDetails,
} from './schemas'
export type SetPrimaryButtonOptions = {
text: string
loading?: boolean
disabled?: boolean
hidden?: boolean
}
export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>
export type AccountLocation = {
placeId: string;
/**
* Human-readable string describing the location
*/
description: string;
};
placeId: string
/**
* Human-readable string describing the location
*/
description: string
}
export type FrameLocationContextCastEmbed = {
type: "cast_embed";
embed: string;
cast: {
fid: number;
hash: string;
};
};
type: 'cast_embed'
embed: string
cast: {
fid: number
hash: string
}
}
export type FrameLocationContextNotification = {
type: "notification";
notification: {
notificationId: string;
title: string;
body: string;
};
};
type: 'notification'
notification: {
notificationId: string
title: string
body: string
}
}
export type FrameLocationContextLauncher = {
type: "launcher";
};
export type FrameLocationContext = FrameLocationContextCastEmbed | FrameLocationContextNotification | FrameLocationContextLauncher;
type: 'launcher'
}
export type FrameLocationContext =
| FrameLocationContextCastEmbed
| FrameLocationContextNotification
| FrameLocationContextLauncher
export type SafeAreaInsets = {
top: number;
bottom: number;
left: number;
right: number;
};
top: number
bottom: number
left: number
right: number
}
export type FrameContext = {
user: {
fid: number;
username?: string;
displayName?: string;
/**
* Profile image URL
*/
pfpUrl?: string;
location?: AccountLocation;
};
location?: FrameLocationContext;
client: {
clientFid: number;
added: boolean;
notificationDetails?: FrameNotificationDetails;
safeAreaInsets?: SafeAreaInsets;
};
};
export type AddFrameRejectedReason = "invalid_domain_manifest" | "rejected_by_user";
export type AddFrameResult = {
added: true;
notificationDetails?: FrameNotificationDetails;
} | {
added: false;
reason: AddFrameRejectedReason;
};
export type AddFrame = () => Promise<AddFrameResult>;
export type ReadyOptions = {
user: {
fid: number
username?: string
displayName?: string
/**
* Disable native gestures. Use this option if your frame uses gestures
* that conflict with native gestures.
*
* @defaultValue false
* Profile image URL
*/
disableNativeGestures: boolean;
};
export declare const DEFAULT_READY_OPTIONS: ReadyOptions;
pfpUrl?: string
location?: AccountLocation
}
location?: FrameLocationContext
client: {
clientFid: number
added: boolean
notificationDetails?: FrameNotificationDetails
safeAreaInsets?: SafeAreaInsets
}
}
export type ReadyOptions = {
/**
* Disable native gestures. Use this option if your frame uses gestures
* that conflict with native gestures.
*
* @defaultValue false
*/
disableNativeGestures: boolean
}
export declare const DEFAULT_READY_OPTIONS: ReadyOptions
export type SignInOptions = {
/**
* A random string used to prevent replay attacks.
*/
nonce: string;
/**
* 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.
*/
expirationTime?: string;
};
/**
* A random string used to prevent replay attacks.
*/
nonce: string
/**
* 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.
*/
expirationTime?: string
}
export type WireFrameHost = {
context: FrameContext;
close: () => void;
ready: (options?: Partial<ReadyOptions>) => void;
openUrl: (url: string) => void;
signIn: SignIn.WireSignIn;
setPrimaryButton: SetPrimaryButton;
ethProviderRequest: EthProviderRequest;
ethProviderRequestV2: RpcTransport;
addFrame: AddFrame;
};
context: FrameContext
close: () => void
ready: (options?: Partial<ReadyOptions>) => void
openUrl: (url: string) => void
signIn: SignIn.WireSignIn
setPrimaryButton: SetPrimaryButton
ethProviderRequest: EthProviderRequest
ethProviderRequestV2: RpcTransport
eip6963RequestProvider: () => void
addFrame: AddFrame.WireAddFrame
}
export type FrameHost = {
context: FrameContext;
close: () => void;
ready: (options?: Partial<ReadyOptions>) => void;
openUrl: (url: string) => void;
signIn: SignIn.SignIn;
setPrimaryButton: SetPrimaryButton;
ethProviderRequest: EthProviderRequest;
ethProviderRequestV2: RpcTransport;
addFrame: AddFrame;
};
context: FrameContext
close: () => void
ready: (options?: Partial<ReadyOptions>) => void
openUrl: (url: string) => void
signIn: SignIn.SignIn
setPrimaryButton: SetPrimaryButton
ethProviderRequest: EthProviderRequest
ethProviderRequestV2: RpcTransport
/**
* Receive forwarded eip6963:requestProvider events from the frame document.
* Hosts must emit an EventEip6963AnnounceProvider in response.
*/
eip6963RequestProvider: () => void
addFrame: AddFrame.AddFrame
}
export type FrameEthProviderEventData = {
type: "frame_eth_provider_event";
} & EthProviderWireEvent;
export type RpcTransport = (request: RpcRequest.RpcRequest) => Promise<RpcResponse.RpcResponse>;
type: 'frame_eth_provider_event'
} & EthProviderWireEvent
export type RpcTransport = (
request: RpcRequest.RpcRequest,
) => Promise<RpcResponse.RpcResponse>
export type ProviderRpcError = {
code: number;
details?: string;
message?: string;
};
export type EthProviderWireEvent = {
event: "accountsChanged";
params: [readonly Address.Address[]];
} | {
event: "chainChanged";
params: [string];
} | {
event: "connect";
params: [Provider.ConnectInfo];
} | {
event: "disconnect";
params: [ProviderRpcError];
} | {
event: "message";
params: [Provider.Message];
};
export type EmitEthProvider = <event extends EthProviderWireEvent["event"]>(event: event, params: Extract<EthProviderWireEvent, {
event: event;
}>["params"]) => void;
code: number
details?: string
message?: string
}
export type EthProviderWireEvent =
| {
event: 'accountsChanged'
params: [readonly Address.Address[]]
}
| {
event: 'chainChanged'
params: [string]
}
| {
event: 'connect'
params: [Provider.ConnectInfo]
}
| {
event: 'disconnect'
params: [ProviderRpcError]
}
| {
event: 'message'
params: [Provider.Message]
}
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
event: event,
params: Extract<
EthProviderWireEvent,
{
event: event
}
>['params'],
) => void
export type EventFrameAddRejected = {
event: "frame_add_rejected";
reason: AddFrameRejectedReason;
};
event: 'frame_add_rejected'
reason: AddFrame.AddFrameRejectedReason
}
export type EventPrimaryButtonClicked = {
event: "primary_button_clicked";
};
export type FrameClientEvent = EventFrameAdded | EventFrameAddRejected | EventFrameRemoved | EventNotificationsEnabled | EventNotificationsDisabled | EventPrimaryButtonClicked;
event: 'primary_button_clicked'
}
/**
* Metadata of the EIP-1193 Provider.
*/
export interface EIP6963ProviderInfo {
icon: `data:image/${string}`
name: string
rdns: string
uuid: string
}
export type EventEip6963AnnounceProvider = {
event: 'eip6963:announceProvider'
info: EIP6963ProviderInfo
}
export type FrameClientEvent =
| EventFrameAdded
| EventFrameAddRejected
| EventFrameRemoved
| EventNotificationsEnabled
| EventNotificationsDisabled
| EventPrimaryButtonClicked
| EventEip6963AnnounceProvider
export const DEFAULT_READY_OPTIONS = {
disableNativeGestures: false,
};
disableNativeGestures: false,
}
{
"name": "@farcaster/frame-core",
"version": "0.0.21",
"version": "0.0.22",
"main": "dist/index.js",

@@ -12,9 +12,8 @@ "module": "esm/index.js",

"devDependencies": {
"tsup": "^8.3.5",
"typescript": "^5.6.3",
"typescript": "^5.7.2",
"@farcaster/tsconfig": "0.0.2"
},
"dependencies": {
"ox": "^0.4.0",
"zod": "^3.23.8"
"ox": "^0.4.4",
"zod": "^3.24.1"
},

@@ -21,0 +20,0 @@ "publishConfig": {

export class BaseError<
cause extends Error | undefined = undefined
cause extends Error | undefined = undefined,
> extends Error {
override name = "BaseError";
cause: cause;
override name = 'BaseError'
cause: cause
constructor(message: string, options: BaseError.Options<cause> = {}) {
super(message, options.cause ? { cause: options.cause } : undefined)
this.cause = options.cause as any;
this.cause = options.cause as any
}

@@ -11,0 +11,0 @@ }

@@ -1,3 +0,3 @@

export * as SignIn from "./actions/signIn";
export * from "./types";
export * from "./schemas";
export * from './actions'
export * from './schemas'
export * from './types'

@@ -1,3 +0,5 @@

export type Compute<type> = { [key in keyof type]: type[key] } & unknown
type Compute<type> = { [key in keyof type]: type[key] } & unknown
type KeyofUnion<type> = type extends type ? keyof type : never
export type OneOf<

@@ -19,4 +21,1 @@ union extends object,

: never
export type KeyofUnion<type> = type extends type ? keyof type : never

@@ -1,11 +0,11 @@

import { z } from "zod";
import { z } from 'zod'
import {
buttonTitleSchema,
frameNameSchema,
hexColorSchema,
frameNameSchema,
secureUrlSchema,
buttonTitleSchema,
} from "./shared";
} from './shared'
export const actionLaunchFrameSchema = z.object({
type: z.literal("launch_frame"),
type: z.literal('launch_frame'),
name: frameNameSchema,

@@ -15,7 +15,7 @@ url: secureUrlSchema,

splashBackgroundColor: hexColorSchema.optional(),
});
})
export const actionSchema = z.discriminatedUnion("type", [
export const actionSchema = z.discriminatedUnion('type', [
actionLaunchFrameSchema,
]);
])

@@ -25,13 +25,13 @@ export const buttonSchema = z.object({

action: actionSchema,
});
})
export const frameEmbedNextSchema = z.object({
version: z.literal("next"),
version: z.literal('next'),
imageUrl: secureUrlSchema,
button: buttonSchema,
});
})
export const safeParseFrameEmbed = (rawResponse: unknown) =>
frameEmbedNextSchema.safeParse(rawResponse);
frameEmbedNextSchema.safeParse(rawResponse)
export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>;
export type FrameEmbedNext = z.infer<typeof frameEmbedNextSchema>

@@ -1,35 +0,35 @@

import { z } from "zod";
import { notificationDetailsSchema } from "./notifications";
import { z } from 'zod'
import { notificationDetailsSchema } from './notifications'
export const eventFrameAddedSchema = z.object({
event: z.literal("frame_added"),
event: z.literal('frame_added'),
notificationDetails: notificationDetailsSchema.optional(),
});
})
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>;
export type EventFrameAdded = z.infer<typeof eventFrameAddedSchema>
export const eventFrameRemovedSchema = z.object({
event: z.literal("frame_removed"),
});
event: z.literal('frame_removed'),
})
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>;
export type EventFrameRemoved = z.infer<typeof eventFrameRemovedSchema>
export const eventNotificationsEnabledSchema = z.object({
event: z.literal("notifications_enabled"),
event: z.literal('notifications_enabled'),
notificationDetails: notificationDetailsSchema.required(),
});
})
export type EventNotificationsEnabled = z.infer<
typeof eventNotificationsEnabledSchema
>;
>
export const notificationsDisabledSchema = z.object({
event: z.literal("notifications_disabled"),
});
event: z.literal('notifications_disabled'),
})
export type EventNotificationsDisabled = z.infer<
typeof notificationsDisabledSchema
>;
>
export const serverEventSchema = z.discriminatedUnion("event", [
export const serverEventSchema = z.discriminatedUnion('event', [
eventFrameAddedSchema,

@@ -39,4 +39,4 @@ eventFrameRemovedSchema,

notificationsDisabledSchema,
]);
])
export type FrameServerEvent = z.infer<typeof serverEventSchema>;
export type FrameServerEvent = z.infer<typeof serverEventSchema>

@@ -1,5 +0,5 @@

export * from "./embeds";
export * from "./events";
export * from "./shared";
export * from "./manifest";
export * from "./notifications";
export * from './embeds'
export * from './events'
export * from './shared'
export * from './manifest'
export * from './notifications'

@@ -1,9 +0,9 @@

import { z } from "zod";
import { z } from 'zod'
import {
secureUrlSchema,
buttonTitleSchema,
encodedJsonFarcasterSignatureSchema,
frameNameSchema,
hexColorSchema,
encodedJsonFarcasterSignatureSchema,
buttonTitleSchema,
} from "./shared";
secureUrlSchema,
} from './shared'

@@ -15,6 +15,6 @@ export const domainFrameConfigSchema = z.object({

version: z.union([
z.literal("0.0.0"),
z.literal("0.0.1"),
z.literal("1"),
z.literal('next')
z.literal('0.0.0'),
z.literal('0.0.1'),
z.literal('1'),
z.literal('next'),
]),

@@ -29,3 +29,3 @@ name: frameNameSchema,

webhookUrl: secureUrlSchema.optional(),
});
})

@@ -35,2 +35,2 @@ export const domainManifestSchema = z.object({

frame: domainFrameConfigSchema.optional(),
});
})

@@ -1,3 +0,3 @@

import { z } from "zod";
import { secureUrlSchema } from "./shared";
import { z } from 'zod'
import { secureUrlSchema } from './shared'

@@ -7,7 +7,5 @@ export const notificationDetailsSchema = z.object({

token: z.string(),
});
})
export type FrameNotificationDetails = z.infer<
typeof notificationDetailsSchema
>;
export type FrameNotificationDetails = z.infer<typeof notificationDetailsSchema>

@@ -20,7 +18,7 @@ export const sendNotificationRequestSchema = z.object({

tokens: z.string().array().max(100),
});
})
export type SendNotificationRequest = z.infer<
typeof sendNotificationRequestSchema
>;
>

@@ -33,6 +31,6 @@ export const sendNotificationResponseSchema = z.object({

}),
});
})
export type SendNotificationResponse = z.infer<
typeof sendNotificationResponseSchema
>;
>

@@ -1,2 +0,2 @@

import { z } from "zod";
import { z } from 'zod'

@@ -6,7 +6,7 @@ export const secureUrlSchema = z

.url()
.startsWith("https://", { message: "Must be an https url" })
.max(512);
.startsWith('https://', { message: 'Must be an https url' })
.max(512)
export const frameNameSchema = z.string().max(32);
export const buttonTitleSchema = z.string().max(32);
export const frameNameSchema = z.string().max(32)
export const buttonTitleSchema = z.string().max(32)

@@ -17,4 +17,4 @@ export const hexColorSchema = z

message:
"Invalid hex color code. It should be in the format #RRGGBB or #RGB.",
});
'Invalid hex color code. It should be in the format #RRGGBB or #RGB.',
})

@@ -25,16 +25,16 @@ export const encodedJsonFarcasterSignatureSchema = z.object({

signature: z.string(),
});
})
export type EncodedJsonFarcasterSignatureSchema = z.infer<
typeof encodedJsonFarcasterSignatureSchema
>;
>
export const jsonFarcasterSignatureHeaderSchema = z.object({
fid: z.number(),
type: z.literal("app_key"),
key: z.string().startsWith("0x"),
});
type: z.literal('app_key'),
key: z.string().startsWith('0x'),
})
export type JsonFarcasterSignatureHeaderSchema = z.infer<
typeof jsonFarcasterSignatureHeaderSchema
>;
>

@@ -0,55 +1,51 @@

import type { Address, Provider, RpcRequest, RpcResponse, RpcSchema } from 'ox'
import type { AddFrame, SignIn } from './actions'
import type {
Address,
Provider,
RpcRequest,
RpcResponse,
RpcSchema,
} from "ox";
import {
FrameNotificationDetails,
EventFrameAdded,
EventFrameRemoved,
EventNotificationsDisabled,
EventNotificationsEnabled,
EventNotificationsDisabled,
} from "./schemas";
import * as SignIn from "./actions/signIn";
FrameNotificationDetails,
} from './schemas'
export type SetPrimaryButton = (options: {
text: string;
loading?: boolean;
disabled?: boolean;
hidden?: boolean;
}) => void;
export type SetPrimaryButtonOptions = {
text: string
loading?: boolean
disabled?: boolean
hidden?: boolean
}
export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>;
export type SetPrimaryButton = (options: SetPrimaryButtonOptions) => void
export type EthProviderRequest = Provider.RequestFn<RpcSchema.Default>
export type AccountLocation = {
placeId: string;
placeId: string
/**
* Human-readable string describing the location
*/
description: string;
};
description: string
}
export type FrameLocationContextCastEmbed = {
type: "cast_embed";
embed: string;
type: 'cast_embed'
embed: string
cast: {
fid: number;
hash: string;
};
};
fid: number
hash: string
}
}
export type FrameLocationContextNotification = {
type: "notification";
type: 'notification'
notification: {
notificationId: string;
title: string;
body: string;
};
};
notificationId: string
title: string
body: string
}
}
export type FrameLocationContextLauncher = {
type: "launcher";
};
type: 'launcher'
}

@@ -59,10 +55,9 @@ export type FrameLocationContext =

| FrameLocationContextNotification
| FrameLocationContextLauncher;
| FrameLocationContextLauncher
export type SafeAreaInsets = {
top: number;
bottom: number;
left: number;
right: number;
top: number
bottom: number
left: number
right: number
}

@@ -72,36 +67,20 @@

user: {
fid: number;
username?: string;
displayName?: string;
fid: number
username?: string
displayName?: string
/**
* Profile image URL
*/
pfpUrl?: string;
location?: AccountLocation;
};
location?: FrameLocationContext;
pfpUrl?: string
location?: AccountLocation
}
location?: FrameLocationContext
client: {
clientFid: number;
added: boolean;
notificationDetails?: FrameNotificationDetails;
safeAreaInsets?: SafeAreaInsets;
};
};
clientFid: number
added: boolean
notificationDetails?: FrameNotificationDetails
safeAreaInsets?: SafeAreaInsets
}
}
export type AddFrameRejectedReason =
| "invalid_domain_manifest"
| "rejected_by_user";
export type AddFrameResult =
| {
added: true;
notificationDetails?: FrameNotificationDetails;
}
| {
added: false;
reason: AddFrameRejectedReason;
};
export type AddFrame = () => Promise<AddFrameResult>;
export type ReadyOptions = {

@@ -114,8 +93,8 @@ /**

*/
disableNativeGestures: boolean;
};
disableNativeGestures: boolean
}
export const DEFAULT_READY_OPTIONS: ReadyOptions = {
disableNativeGestures: false,
};
}

@@ -126,3 +105,3 @@ export type SignInOptions = {

*/
nonce: string;
nonce: string

@@ -133,3 +112,3 @@ /**

*/
notBefore?: string;
notBefore?: string

@@ -140,79 +119,100 @@ /**

*/
expirationTime?: string;
};
expirationTime?: string
}
export type WireFrameHost = {
context: FrameContext;
close: () => void;
ready: (options?: Partial<ReadyOptions>) => void;
openUrl: (url: string) => void;
signIn: SignIn.WireSignIn;
setPrimaryButton: SetPrimaryButton;
ethProviderRequest: EthProviderRequest;
ethProviderRequestV2: RpcTransport;
addFrame: AddFrame;
};
context: FrameContext
close: () => void
ready: (options?: Partial<ReadyOptions>) => void
openUrl: (url: string) => void
signIn: SignIn.WireSignIn
setPrimaryButton: SetPrimaryButton
ethProviderRequest: EthProviderRequest
ethProviderRequestV2: RpcTransport
eip6963RequestProvider: () => void
addFrame: AddFrame.WireAddFrame
}
export type FrameHost = {
context: FrameContext;
close: () => void;
ready: (options?: Partial<ReadyOptions>) => void;
openUrl: (url: string) => void;
signIn: SignIn.SignIn;
setPrimaryButton: SetPrimaryButton;
ethProviderRequest: EthProviderRequest;
ethProviderRequestV2: RpcTransport;
addFrame: AddFrame;
};
context: FrameContext
close: () => void
ready: (options?: Partial<ReadyOptions>) => void
openUrl: (url: string) => void
signIn: SignIn.SignIn
setPrimaryButton: SetPrimaryButton
ethProviderRequest: EthProviderRequest
ethProviderRequestV2: RpcTransport
/**
* Receive forwarded eip6963:requestProvider events from the frame document.
* Hosts must emit an EventEip6963AnnounceProvider in response.
*/
eip6963RequestProvider: () => void
addFrame: AddFrame.AddFrame
}
export type FrameEthProviderEventData = {
type: "frame_eth_provider_event";
} & EthProviderWireEvent;
type: 'frame_eth_provider_event'
} & EthProviderWireEvent
export type RpcTransport = (
request: RpcRequest.RpcRequest,
) => Promise<RpcResponse.RpcResponse>;
) => Promise<RpcResponse.RpcResponse>
export type ProviderRpcError = {
code: number;
details?: string;
message?: string;
};
code: number
details?: string
message?: string
}
export type EthProviderWireEvent =
| {
event: "accountsChanged";
params: [readonly Address.Address[]];
event: 'accountsChanged'
params: [readonly Address.Address[]]
}
| {
event: "chainChanged";
params: [string];
event: 'chainChanged'
params: [string]
}
| {
event: "connect";
params: [Provider.ConnectInfo];
event: 'connect'
params: [Provider.ConnectInfo]
}
| {
event: "disconnect";
params: [ProviderRpcError];
event: 'disconnect'
params: [ProviderRpcError]
}
| {
event: "message";
params: [Provider.Message];
};
event: 'message'
params: [Provider.Message]
}
export type EmitEthProvider = <event extends EthProviderWireEvent["event"]>(
export type EmitEthProvider = <event extends EthProviderWireEvent['event']>(
event: event,
params: Extract<EthProviderWireEvent, { event: event }>["params"],
) => void;
params: Extract<EthProviderWireEvent, { event: event }>['params'],
) => void
export type EventFrameAddRejected = {
event: "frame_add_rejected";
reason: AddFrameRejectedReason;
};
event: 'frame_add_rejected'
reason: AddFrame.AddFrameRejectedReason
}
export type EventPrimaryButtonClicked = {
event: "primary_button_clicked";
};
event: 'primary_button_clicked'
}
/**
* Metadata of the EIP-1193 Provider.
*/
export interface EIP6963ProviderInfo {
icon: `data:image/${string}` // RFC-2397
name: string
rdns: string
uuid: string
}
export type EventEip6963AnnounceProvider = {
event: 'eip6963:announceProvider'
info: EIP6963ProviderInfo
}
export type FrameClientEvent =

@@ -224,2 +224,3 @@ | EventFrameAdded

| EventNotificationsDisabled
| EventPrimaryButtonClicked;
| EventPrimaryButtonClicked
| EventEip6963AnnounceProvider

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