mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
Add script get contract assets supported by OpenSea
This commit is contained in:
parent
c7d170d4e9
commit
e75846c4af
26
script/opesea_contrats.js
Normal file
26
script/opesea_contrats.js
Normal file
|
@ -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()
|
Loading…
Reference in New Issue
Block a user