Skip to content

Commit

Permalink
replace standard crypto with neynar
Browse files Browse the repository at this point in the history
  • Loading branch information
backmeupplz committed Oct 27, 2024
1 parent 2541b25 commit 0a3a31f
Show file tree
Hide file tree
Showing 5 changed files with 733 additions and 527 deletions.
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"hnw.vscode-auto-open-markdown-preview",
"naumovs.color-highlight",
"oderwat.indent-rainbow"
]
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"prepublishOnly": "yarn lint && yarn build"
},
"dependencies": {
"@standard-crypto/farcaster-js": "^7.4.0",
"axios": "^1.7.7",
"@neynar/nodejs-sdk": "^1.66.0",
"node-persist": "^4.0.3"
},
"devDependencies": {
Expand Down
6 changes: 2 additions & 4 deletions src/helpers/fetchNotifications.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { NeynarAPIClient } from '@standard-crypto/farcaster-js-neynar'
import { NeynarAPIClient } from '@neynar/nodejs-sdk'

export default function (fid: number, cursor: string, apiKey: string) {
const client = new NeynarAPIClient(apiKey)
return client.v1.apis.notifications.mentionsAndReplies({
fid,
return client.fetchMentionAndReplyNotifications(fid, {
cursor,
limit: 10,
})
}
6 changes: 2 additions & 4 deletions src/helpers/startPolling.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CastWithInteractions } from '@neynar/nodejs-sdk/build/neynar-api/v1'
import {
getCurrentNotificationId,
setCurrentNotificationId,
} from './currentNotificationId'
import fetchNotifications from './fetchNotifications'
import { CastWithInteractions } from '../../node_modules/@standard-crypto/farcaster-js-neynar/dist/commonjs/v1/openapi/generated/models/cast-with-interactions'

let polling = false
async function pollNotifications(
Expand All @@ -22,9 +22,7 @@ async function pollNotifications(
const notifications = [] as CastWithInteractions[]
do {
const {
data: {
result: { notifications: newNotifications, next },
},
result: { notifications: newNotifications, next },
} = await fetchNotifications(fid, cursor, apiKey)
if (debug) {
console.log('New notifications:', newNotifications)
Expand Down
Loading

0 comments on commit 0a3a31f

Please sign in to comment.