Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import type {
- NextApiRequest,
- NextApiResponse
- } from 'next'
- const axios = require('axios')
- // Wallet address
- const address = '0x345e92122c1c0ac81d3147d4cc7f6345a6f16926'
- // Alchemy URL
- const baseURL = `https://polygon-mumbai.g.alchemy.com/v2/s6uKR0ijFvK1srMLj2wyWR5zmAFBUo0s`;
- const url = `${baseURL}/getNFTs/?owner=${address}`;
- const config = {
- method: 'get',
- url: url,
- };
- // Make the request and print the formatted response:
- export default async function handleNFT(
- req: NextApiRequest,
- res: NextApiResponse
- ) {
- const {
- } = req;
- let data: any;
- await axios(config)
- .then((response: { [x: string]: any; }) => {
- data = response['data']
- console.log(response['data'])
- })
- .catch((error: any) => console.log('error', error));
- res.statusCode = 200;
- res.setHeader('Content-Type', 'application/json');
- res.end(
- JSON.stringify(
- data
- )
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement