From e75846c4afd1591a7d72802734011871c06c0309 Mon Sep 17 00:00:00 2001 From: Mykola Date: Wed, 16 Oct 2019 20:43:37 -0700 Subject: [PATCH] Add script get contract assets supported by OpenSea --- script/opesea_contrats.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 script/opesea_contrats.js diff --git a/script/opesea_contrats.js b/script/opesea_contrats.js new file mode 100644 index 000000000..2beb1f738 --- /dev/null +++ b/script/opesea_contrats.js @@ -0,0 +1,26 @@ +var axios = require("axios"); + +const fetchOpnSeaCollectionsAddresses = async () => { + const limit = 300 + let offset = 0 + + while(true) { + const collections = await axios.get(`https://api.opensea.io/api/v1/collections?limit=${limit}&offset=${offset}`) + .then(res => res.data.collections) + .catch(e => console.log(e.message)) + + collections.forEach(c => { + c.primary_asset_contracts.forEach(a => { + console.log(`"${a.address}",`) + }) + }) + + if(collections.length < limit) { + return + } else { + offset += limit + } + } +} + +fetchOpnSeaCollectionsAddresses() \ No newline at end of file