import type { NextApiRequest , NextApiResponse } from 'next' ; import { getNodeURL } from '@figment-solana/lib' ; import { Connection , PublicKey , SystemProgram , Transaction , sendAndConfirmTransaction , } from '@solana/web3.js' ; export default async function transfer ( req , res ) { try { const { address , secret , recipient , lamports , network } = req . body ; const url = getNodeURL ( network ) ; const connection = new Connection ( url , 'confirmed' ) ; const fromPubkey = new PublicKey ( address ) ; const toPubkey = new PublicKey ( recipient ) ; const secretKey = Uint8Array . from ( JSON . parse ( secret as string ) ) ; const instructions = SystemProgram . transfer ; const signers = undefined ; const transaction = new Transaction ( ) ; const hash = undefined ; res . status ( 200 ) . json ( hash ) ; } catch ( error ) { let errorMessage = error instanceof Error ? error . message : 'Unknown Error' ; res . status ( 500 ) . json ( errorMessage ) ; } }