import type { NextApiRequest , NextApiResponse } from 'next' ; import { getAvalancheClient } from '@figment-avalanche/lib' ; import { BinTools , BN } from 'avalanche' ; export default async function transfer ( req , res ) { try { const { secret , navax , recipient , address , network } = req . body ; const client = getAvalancheClient ( network ) ; const chain = client . XChain ( ) ; const keychain = chain . keyChain ( ) ; undefined ; const { utxos } = undefined ; const binTools = BinTools . getInstance ( ) ; const assetInfo = await chain . getAssetDescription ( 'AVAX' ) ; const assetID = binTools . cb58Encode ( assetInfo . assetID ) ; const transaction = await chain . buildBaseTx ( undefined ) ; undefined ; undefined ; res . status ( 200 ) . json ( hash ) ; } catch ( error ) { let errorMessage = error instanceof Error ? error . message : 'Unknown Error' ; res . status ( 500 ) . json ( errorMessage ) ; } }