@farcaster/frame-node 0.0.18 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/util.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare function bytesToHex(bytes: Uint8Array): string
2
- export declare function hexToBytes(hex: string): Uint8Array
1
+ export declare function bytesToHex(bytes: Uint8Array): string;
2
+ export declare function hexToBytes(hex: string): Uint8Array;
package/esm/util.js CHANGED
@@ -1,8 +1,6 @@
1
1
  export function bytesToHex(bytes) {
2
- return `0x${Buffer.from(bytes).toString('hex')}`
2
+ return `0x${Buffer.from(bytes).toString('hex')}`;
3
3
  }
4
4
  export function hexToBytes(hex) {
5
- return Uint8Array.from(
6
- Buffer.from(hex.startsWith('0x') ? hex.slice(2) : hex, 'hex'),
7
- )
5
+ return Uint8Array.from(Buffer.from(hex.startsWith('0x') ? hex.slice(2) : hex, 'hex'));
8
6
  }
package/esm/webhook.d.ts CHANGED
@@ -1,20 +1,9 @@
1
- import type { VerifyJsonFarcasterSignature } from './jfs'
2
- import {
3
- BaseError,
4
- type ParseWebhookEventResult,
5
- type VerifyAppKey,
6
- } from './types'
1
+ import { type VerifyJsonFarcasterSignature } from './jfs';
2
+ import { BaseError, type ParseWebhookEventResult, type VerifyAppKey } from './types';
7
3
  export declare namespace ParseWebhookEvent {
8
- type ErrorType =
9
- | VerifyJsonFarcasterSignature.ErrorType
10
- | InvalidEventDataError
4
+ type ErrorType = VerifyJsonFarcasterSignature.ErrorType | InvalidEventDataError;
11
5
  }
12
- export declare class InvalidEventDataError<
13
- C extends Error | undefined = undefined,
14
- > extends BaseError<C> {
15
- readonly name = 'VerifyJsonFarcasterSignature.InvalidEventDataError'
6
+ export declare class InvalidEventDataError<C extends Error | undefined = undefined> extends BaseError<C> {
7
+ readonly name = "VerifyJsonFarcasterSignature.InvalidEventDataError";
16
8
  }
17
- export declare function parseWebhookEvent(
18
- rawData: unknown,
19
- verifyAppKey: VerifyAppKey,
20
- ): Promise<ParseWebhookEventResult>
9
+ export declare function parseWebhookEvent(rawData: unknown, verifyAppKey: VerifyAppKey): Promise<ParseWebhookEventResult>;
package/esm/webhook.js CHANGED
@@ -1,27 +1,22 @@
1
- import { serverEventSchema } from '@farcaster/frame-core'
2
- import { verifyJsonFarcasterSignature } from './jfs'
3
- import { BaseError } from './types'
1
+ import { serverEventSchema } from '@farcaster/frame-core';
2
+ import { verifyJsonFarcasterSignature, } from './jfs';
3
+ import { BaseError, } from './types';
4
4
  export class InvalidEventDataError extends BaseError {
5
- name = 'VerifyJsonFarcasterSignature.InvalidEventDataError'
5
+ name = 'VerifyJsonFarcasterSignature.InvalidEventDataError';
6
6
  }
7
7
  export async function parseWebhookEvent(rawData, verifyAppKey) {
8
- const { fid, appFid, payload } = await verifyJsonFarcasterSignature(
9
- rawData,
10
- verifyAppKey,
11
- )
12
- // Pase and validate event payload
13
- let payloadJson
14
- try {
15
- payloadJson = JSON.parse(Buffer.from(payload).toString('utf-8'))
16
- } catch (error) {
17
- throw new InvalidEventDataError(
18
- 'Error decoding and parsing payload',
19
- error instanceof Error ? error : undefined,
20
- )
21
- }
22
- const event = serverEventSchema.safeParse(payloadJson)
23
- if (event.success === false) {
24
- throw new InvalidEventDataError('Invalid event payload', event.error)
25
- }
26
- return { fid, appFid, event: event.data }
8
+ const { fid, appFid, payload } = await verifyJsonFarcasterSignature(rawData, verifyAppKey);
9
+ // Pase and validate event payload
10
+ let payloadJson;
11
+ try {
12
+ payloadJson = JSON.parse(Buffer.from(payload).toString('utf-8'));
13
+ }
14
+ catch (error) {
15
+ throw new InvalidEventDataError('Error decoding and parsing payload', error instanceof Error ? error : undefined);
16
+ }
17
+ const event = serverEventSchema.safeParse(payloadJson);
18
+ if (event.success === false) {
19
+ throw new InvalidEventDataError('Invalid event payload', event.error);
20
+ }
21
+ return { fid, appFid, event: event.data };
27
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/frame-node",
3
- "version": "0.0.18",
3
+ "version": "0.0.21",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "@noble/curves": "^1.7.0",
26
26
  "ox": "^0.4.4",
27
27
  "zod": "^3.24.1",
28
- "@farcaster/frame-core": "0.0.29"
28
+ "@farcaster/frame-core": "0.0.32"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
package/src/farcaster.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AbiParameters } from 'ox'
1
+ import * as AbiParameters from 'ox/AbiParameters'
2
2
  import { z } from 'zod'
3
3
  import { BaseError, type VerifyAppKey, type VerifyAppKeyResult } from './types'
4
4