@@ -16,9 +16,7 @@ const fungibleProviders = [coinGeckoAPI, cmcAPI]
1616const nonFungibleTokenProviders = [ nftScanTokenAPI ]
1717const nonFungibleCollectionProviders = [ nftScanCollectionAPI ]
1818
19- async function main ( ) {
20- await initFolder ( )
21-
19+ async function getFungibleTokens ( ) {
2220 for ( const p of fungibleProviders ) {
2321 let fungibleTokens : FungibleToken [ ] = [ ]
2422 console . log ( `Fetch the data from ${ p . getProviderName ( ) } ` )
@@ -40,7 +38,9 @@ async function main() {
4038 )
4139 }
4240 }
41+ }
4342
43+ async function getNonFungibleTokens ( ) {
4444 for ( const p of nonFungibleTokenProviders ) {
4545 let nonFungibleTokens : NonFungibleToken [ ] = [ ]
4646 console . log ( `Fetch the data from ${ p . getProviderName ( ) } ` )
@@ -58,7 +58,9 @@ async function main() {
5858 await writeTokensToFile ( p . getProviderName ( ) , 'non-fungible-tokens' , nonFungibleTokens )
5959 }
6060 }
61+ }
6162
63+ async function getNonfungibleCollections ( ) {
6264 for ( const p of nonFungibleCollectionProviders ) {
6365 let nonFungibleCollections : NonFungibleCollection [ ] = [ ]
6466 console . log ( `Fetch the data from ${ p . getProviderName ( ) } ` )
@@ -76,15 +78,25 @@ async function main() {
7678 await writeCollectionsToFile ( p . getProviderName ( ) , nonFungibleCollections )
7779 }
7880 }
81+ }
7982
83+ async function getDaos ( ) {
8084 const spaces = await daoAPI . getSpaces ( )
8185 await writeDAOToFile ( spaces )
86+ }
87+
88+ async function main ( ) {
89+ await initFolder ( )
90+
91+ await Promise . allSettled ( [ getFungibleTokens ( ) , getNonFungibleTokens ( ) , getNonfungibleCollections ( ) , getDaos ( ) ] )
8292
83- await mergePublicFileToOutput ( 'non-fungible-collections' )
84- await mergePublicFileToOutput ( 'non-fungible-tokens' )
85- await mergePublicFileToOutput ( 'nft-lucky-drop' )
86- await mergePublicFileToOutput ( 'fungible-tokens' )
87- await mergePublicFileToOutput ( 'dao' )
93+ await Promise . all ( [
94+ mergePublicFileToOutput ( 'non-fungible-collections' ) ,
95+ mergePublicFileToOutput ( 'non-fungible-tokens' ) ,
96+ mergePublicFileToOutput ( 'nft-lucky-drop' ) ,
97+ mergePublicFileToOutput ( 'fungible-tokens' ) ,
98+ mergePublicFileToOutput ( 'dao' ) ,
99+ ] )
88100
89101 console . log ( 'Generate success!' )
90102 process . exit ( 0 )
0 commit comments