Skip to content

Commit

Permalink
add opensea api token (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
rssnyder authored Nov 24, 2021
1 parent 8165cdc commit 145fd79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion checkSales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ async function main() {
params.append('asset_contract_address', process.env.CONTRACT_ADDRESS!)
}

let openSeaFetch = {}
if (process.env.OPENSEA_TOKEN) {
openSeaFetch['headers'] = {'X-API-KEY': process.env.OPENSEA_TOKEN}
}

const openSeaResponse = await fetch(
"https://api.opensea.io/api/v1/events?" + params).then((resp) => resp.json());
"https://api.opensea.io/api/v1/events?" + params, openSeaFetch).then((resp) => resp.json());

return await Promise.all(
openSeaResponse?.asset_events?.reverse().map(async (sale: any) => {
Expand Down

0 comments on commit 145fd79

Please sign in to comment.