From fd570ed308aeb9ea9e4002d954c1db380e52328e Mon Sep 17 00:00:00 2001 From: Tom Meagher Date: Mon, 18 Mar 2024 16:08:52 -0400 Subject: [PATCH] refactor: remove buffer --- src/dev/utils/fetchFrame.ts | 11 ++++++----- templates/next/package.json | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/dev/utils/fetchFrame.ts b/src/dev/utils/fetchFrame.ts index 42e24e78..f2006124 100644 --- a/src/dev/utils/fetchFrame.ts +++ b/src/dev/utils/fetchFrame.ts @@ -1,6 +1,7 @@ import { bytesToHex, hexToBytes } from '@noble/curves/abstract/utils' import { ed25519 } from '@noble/curves/ed25519' import { blake3 } from '@noble/hashes/blake3' +import { toBytes } from '@noble/hashes/utils' import { FarcasterNetwork, @@ -48,11 +49,11 @@ export async function fetchFrame(parameters: FetchFrameParameters) { buttonIndex, castId: { fid: BigInt(castId.fid), - hash: Buffer.from(hexToBytes(castId.hash.slice(2))), + hash: hexToBytes(castId.hash.slice(2)), }, - inputText: inputText ? Buffer.from(inputText) : undefined, - state: state ? Buffer.from(state) : undefined, - url: Buffer.from(url), + inputText: inputText ? toBytes(inputText) : undefined, + state: state ? toBytes(state) : undefined, + url: toBytes(url), // TODO: Add transactionId }) @@ -77,7 +78,7 @@ export async function fetchFrame(parameters: FetchFrameParameters) { signatureScheme: SignatureScheme.ED25519, signer: ed25519.getPublicKey(privateKeyBytes), }) - const messageBytes = Buffer.from(message.toBinary()).toString('hex') + const messageBytes = bytesToHex(message.toBinary()) const t0 = performance.now() let response: Response | undefined diff --git a/templates/next/package.json b/templates/next/package.json index e93658c4..6e440ec6 100644 --- a/templates/next/package.json +++ b/templates/next/package.json @@ -4,6 +4,7 @@ "type": "module", "scripts": { "dev": "next dev", + "deploy": "vercel", "build": "next build", "start": "next start", "lint": "next lint" @@ -19,6 +20,7 @@ "typescript": "^5", "@types/node": "^20", "@types/react": "^18", - "@types/react-dom": "^18" + "@types/react-dom": "^18", + "vercel": "^32.4.1" } }