Skip to content

Commit

Permalink
refactor: remove frog hub
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed May 15, 2024
1 parent d60c8ed commit 2aac5d5
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 35 deletions.
16 changes: 16 additions & 0 deletions .changeset/fifty-kiwis-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"frog": minor
---

Removed `frog` hub. Use `neynar` along with the `'NEYNAR_FROG_FM'` dev API key instead.

```diff
import { Frog } from 'frog'
- import { frog } from 'frog/hubs'
+ import { neynar } from 'frog/hubs'

export const app = new Frog({
- hub: frog(),
+ hub: neynar({ apiKey: 'NEYNAR_FROG_FM' }),
})
```
4 changes: 2 additions & 2 deletions playground/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { serveStatic } from '@hono/node-server/serve-static'
import { Button, Frog, TextInput } from 'frog'
import { devtools } from 'frog/dev'
import * as hubs from 'frog/hubs'
import { neynar } from 'frog/hubs'
import { Box, Heading, vars } from './ui.js'

import { app as castActionApp } from './castAction.js'
Expand All @@ -15,7 +15,7 @@ import { app as transactionApp } from './transaction.js'
import { app as uiSystemApp } from './ui-system.js'

export const app = new Frog({
hub: hubs.frog(),
hub: neynar({ apiKey: 'NEYNAR_FROG_FM' }),
ui: { vars },
verify: 'silent',
})
Expand Down
8 changes: 4 additions & 4 deletions site/pages/platforms/bun.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ app.frame('/', (c) => {
})
```

:::warning
Feel free to use our public Hub API URL for [frame verification](https://docs.farcaster.xyz/reference/frames/spec#securing-frames:~:text=Unsigned%20messages%20can%20be%20spoofed%20and%20should%20usually%20be%20ignored.%20It%20is%20only%20safe%20to%20use%20them%20if%20you%20are%20performing%20an%20unauthenticated%20request.): `https://api.hub.wevm.dev`.
:::tip
Feel free to use the `neynar` hub aling with our Neynar API Key: `"NEYNAR_FROG_FM"`.

However, please note that this URL is not guaranteed to be stable.
It is recommended to use your own Hub API URL in production.
However, please note that this API Key is for development purposes only – it is prone to rate-limiting.
It is recommended to use your own API Key in production. [See more](https://neynar.com/#get-started).
:::

### Add Bun Server
Expand Down
8 changes: 4 additions & 4 deletions site/pages/platforms/cloudflare-workers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ app.frame('/', (c) => {
})
```

:::warning
Feel free to use our public Hub API URL for [frame verification](https://docs.farcaster.xyz/reference/frames/spec#securing-frames:~:text=Unsigned%20messages%20can%20be%20spoofed%20and%20should%20usually%20be%20ignored.%20It%20is%20only%20safe%20to%20use%20them%20if%20you%20are%20performing%20an%20unauthenticated%20request.): `https://api.hub.wevm.dev`.
:::tip
Feel free to use the `neynar` hub aling with our Neynar API Key: `"NEYNAR_FROG_FM"`.

However, please note that this URL is not guaranteed to be stable.
It is recommended to use your own Hub API URL in production.
However, please note that this API Key is for development purposes only – it is prone to rate-limiting.
It is recommended to use your own API Key in production. [See more](https://neynar.com/#get-started).
:::

### Export Default
Expand Down
8 changes: 4 additions & 4 deletions site/pages/platforms/next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ app.frame('/', (c) => {
})
```

:::warning
Feel free to use our public Hub API URL for [frame verification](https://docs.farcaster.xyz/reference/frames/spec#securing-frames:~:text=Unsigned%20messages%20can%20be%20spoofed%20and%20should%20usually%20be%20ignored.%20It%20is%20only%20safe%20to%20use%20them%20if%20you%20are%20performing%20an%20unauthenticated%20request.): `https://api.hub.wevm.dev`.
:::tip
Feel free to use the `neynar` hub aling with our Neynar API Key: `"NEYNAR_FROG_FM"`.

However, please note that this URL is not guaranteed to be stable.
It is recommended to use your own Hub API URL in production.
However, please note that this API Key is for development purposes only – it is prone to rate-limiting.
It is recommended to use your own API Key in production. [See more](https://neynar.com/#get-started).
:::

### Add Handlers
Expand Down
8 changes: 4 additions & 4 deletions site/pages/platforms/node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ app.frame('/', (c) => {
})
```

:::warning
Feel free to use our public Hub API URL for [frame verification](https://docs.farcaster.xyz/reference/frames/spec#securing-frames:~:text=Unsigned%20messages%20can%20be%20spoofed%20and%20should%20usually%20be%20ignored.%20It%20is%20only%20safe%20to%20use%20them%20if%20you%20are%20performing%20an%20unauthenticated%20request.): `https://api.hub.wevm.dev`.
:::tip
Feel free to use the `neynar` hub aling with our Neynar API Key: `"NEYNAR_FROG_FM"`.

However, please note that this URL is not guaranteed to be stable.
It is recommended to use your own Hub API URL in production.
However, please note that this API Key is for development purposes only – it is prone to rate-limiting.
It is recommended to use your own API Key in production. [See more](https://neynar.com/#get-started).
:::

### Add Node Server
Expand Down
8 changes: 4 additions & 4 deletions site/pages/platforms/vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ app.frame('/', (c) => {
})
```

:::warning
Feel free to use our public Hub API URL for [frame verification](https://docs.farcaster.xyz/reference/frames/spec#securing-frames:~:text=Unsigned%20messages%20can%20be%20spoofed%20and%20should%20usually%20be%20ignored.%20It%20is%20only%20safe%20to%20use%20them%20if%20you%20are%20performing%20an%20unauthenticated%20request.): `https://api.hub.wevm.dev`.
:::tip
Feel free to use the `neynar` hub aling with our Neynar API Key: `"NEYNAR_FROG_FM"`.

However, please note that this URL is not guaranteed to be stable.
It is recommended to use your own Hub API URL in production.
However, please note that this API Key is for development purposes only – it is prone to rate-limiting.
It is recommended to use your own API Key in production. [See more](https://neynar.com/#get-started).
:::

### Add Vercel Handlers
Expand Down
7 changes: 0 additions & 7 deletions src/hubs/frog.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/hubs/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { frog } from './frog.js'
export { neynar } from './neynar.js'
export { pinata } from './pinata.js'
9 changes: 4 additions & 5 deletions src/utils/verifyFrame.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect, test } from 'vitest'
import { frog } from '../hubs/frog.js'
import { neynar } from '../hubs/neynar.js'
import { verifyFrame } from './verifyFrame.js'

Expand All @@ -8,7 +7,7 @@ test('valid', async () => {
'0a4f080d10ff2f18c1a6802f20018201400a2168747470733a2f2f746573742d66617263362e76657263656c2e6170702f61706910011a1908ff2f1214000000000000000000000000000000000000000112141de03010b0ce4f39ba4b8ff29851d0d610dc5ddd180122404aab47af096150fe7193713722bcdd6ddcd6cd35c1e84cc42e7713624916a97568fa8232e2ffd70ce5eeafb0391c7bbcdf6c5ba15a9a02834102b016058e7d0128013220daa3f0a5335900f542a266e4b837309aeac52d736f4cf9b2eff0d4c4f4c7e58f'
await verifyFrame({
frameUrl: 'https://test-farc6.vercel.app/api/foo',
hub: frog(),
hub: neynar({ apiKey: 'NEYNAR_FROG_FM' }),
trustedData: { messageBytes },
url: 'https://test-farc6.vercel.app/api',
})
Expand All @@ -20,12 +19,12 @@ test('invalid hash', async () => {
await expect(() =>
verifyFrame({
frameUrl: 'https://test-farc6.vercel.app/api',
hub: frog(),
hub: neynar({ apiKey: 'NEYNAR_FROG_FM' }),
trustedData: { messageBytes },
url: 'https://test-farc6.vercel.app/api',
}),
).rejects.toMatchInlineSnapshot(
'[Error: message is invalid. invalid hash. Expected=29,224,48,16,176,206,79,57,186,75,143,242,152,81,208,214,16,220,93,221, computed=8,220,37,101,87,167,118,64,111,118,46,240,175,199,186,11,191,124,144,0]',
'[Error: message is invalid. No data in message.]',
)
})

Expand All @@ -35,7 +34,7 @@ test('invalid url', async () => {
await expect(() =>
verifyFrame({
frameUrl: 'https://test-farc7.vercel.app/api',
hub: frog(),
hub: neynar({ apiKey: 'NEYNAR_FROG_FM' }),
trustedData: { messageBytes },
url: 'https://test-farc6.vercel.app/foo',
}),
Expand Down

0 comments on commit 2aac5d5

Please sign in to comment.