File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1- import { verifyMessage } from "viem" ;
1+ import { createPublicClient , http } from "viem" ;
22import { createClient } from "@supabase/supabase-js" ;
3+ import { arbitrumGoerli } from "viem/chains" ;
4+
5+ const publicClient = createPublicClient ( {
6+ chain : arbitrumGoerli ,
7+ transport : http ( ) ,
8+ } ) ;
39
410const SUPABASE_KEY = process . env . SUPABASE_CLIENT_API_KEY ;
511const SUPABASE_URL = process . env . SUPABASE_URL ;
612const supabase = createClient ( SUPABASE_URL ! , SUPABASE_KEY ! ) ;
13+
714export const uploadSettingsToSupabase = async function ( event : any , context : any ) {
815 try {
916 const { message, address, signature } = JSON . parse ( event . body ) ;
1017 const email = message . split ( "Email:" ) . pop ( ) . split ( ",Nonce:" ) [ 0 ] . trim ( ) ;
1118 const nonce = message . split ( "Nonce:" ) . pop ( ) . trim ( ) ;
12- const isValid = await verifyMessage ( { address, message : message , signature } ) ;
19+ const isValid = await publicClient . verifyMessage ( { address, message : message , signature } ) ;
1320 // If the recovered address does not match the provided address, return an error
1421 if ( ! isValid ) {
1522 throw new Error ( "Signature verification failed" ) ;
You can’t perform that action at this time.
0 commit comments