Skip to content

Commit

Permalink
feat(lens): throw error if apikey is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mmackz committed Jun 27, 2024
1 parent 7e602af commit 39944c4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/lens/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import {
production,
} from '@lens-protocol/client'
import axios from 'axios'
import dotenv from 'dotenv'
import { Address } from 'viem'

dotenv.config()

const lensClient = new LensClient({
environment: production,
})
Expand Down Expand Up @@ -56,7 +53,10 @@ export async function checkAddressMintedCollect(
) {
try {
return await checkMintedUsingBlockspan(actor, collectAddress)
} catch {
} catch (err) {
if (err instanceof Error) {
console.error(err.message)
}
return await checkMintedUsingReservoir(actor, collectAddress)
}
}
Expand All @@ -65,6 +65,11 @@ async function checkMintedUsingBlockspan(
actor: Address,
collectAddress: Address,
) {

if (!process.env.BLOCKSPAN_API_KEY) {
throw new Error('Blockspan API key not found')
}

const baseUrl = 'https://api.blockspan.com/v1/transfers/contract'
const params = new URLSearchParams({
chain: 'poly-main',
Expand Down

0 comments on commit 39944c4

Please sign in to comment.