11import * as process from 'process'
22import { FungibleToken , NonFungibleCollection , NonFungibleToken } from './type'
33import { CoinGecko } from './providers/coingecko'
4- import { initFolder , mergePublicFileToOutput , writeCollectionsToFile , writeTokensToFile } from './utils'
4+ import { initFolder , mergePublicFileToOutput , writeCollectionsToFile , writeTokensToFile , writeDAOToFile } from './utils'
55import { CoinMarketCap } from './providers/coinmarketcap'
66import { NFTScanCollection , NFTScanToken } from './providers/NFTScan'
7+ import { DAO } from './providers/dao'
78
89const coinGeckoAPI = new CoinGecko ( )
910const nftScanTokenAPI = new NFTScanToken ( )
1011const nftScanCollectionAPI = new NFTScanCollection ( )
1112const cmcAPI = new CoinMarketCap ( )
13+ const daoAPI = new DAO ( )
1214
1315const fungibleProviders = [ coinGeckoAPI , cmcAPI ]
1416const nonFungibleTokenProviders = [ nftScanTokenAPI ]
1517const nonFungibleCollectionProviders = [ nftScanCollectionAPI ]
1618
1719async function main ( ) {
1820 await initFolder ( )
19- await initFolder ( )
2021
21- // Fetch fungible token
2222 for ( const p of fungibleProviders ) {
2323 let fungibleTokens : FungibleToken [ ] = [ ]
2424 console . log ( `Fetch the data from ${ p . getProviderName ( ) } ` )
@@ -41,9 +41,6 @@ async function main() {
4141 }
4242 }
4343
44- await mergePublicFileToOutput ( 'fungible-tokens' )
45-
46- // Fetch nonFungible token
4744 for ( const p of nonFungibleTokenProviders ) {
4845 let nonFungibleTokens : NonFungibleToken [ ] = [ ]
4946 console . log ( `Fetch the data from ${ p . getProviderName ( ) } ` )
@@ -61,9 +58,7 @@ async function main() {
6158 await writeTokensToFile ( p . getProviderName ( ) , 'non-fungible-tokens' , nonFungibleTokens )
6259 }
6360 }
64- await mergePublicFileToOutput ( 'non-fungible-tokens' )
6561
66- // Fetch nonFungible Collections
6762 for ( const p of nonFungibleCollectionProviders ) {
6863 let nonFungibleCollections : NonFungibleCollection [ ] = [ ]
6964 console . log ( `Fetch the data from ${ p . getProviderName ( ) } ` )
@@ -81,10 +76,15 @@ async function main() {
8176 await writeCollectionsToFile ( p . getProviderName ( ) , nonFungibleCollections )
8277 }
8378 }
84- await mergePublicFileToOutput ( 'non-fungible-collections' )
8579
86- // merge nft lucky drop file
80+ const spaces = await daoAPI . getSpaces ( )
81+ await writeDAOToFile ( spaces )
82+
83+ await mergePublicFileToOutput ( 'non-fungible-collections' )
84+ await mergePublicFileToOutput ( 'non-fungible-tokens' )
8785 await mergePublicFileToOutput ( 'nft-lucky-drop' )
86+ await mergePublicFileToOutput ( 'fungible-tokens' )
87+ await mergePublicFileToOutput ( 'dao' )
8888
8989 console . log ( 'Generate success!' )
9090 process . exit ( 0 )
0 commit comments