diff --git a/common/index.mjs b/common/index.mjs index 95b35ebe..c08e64d0 100644 --- a/common/index.mjs +++ b/common/index.mjs @@ -9,6 +9,7 @@ import request from './request.mjs' export * as cloudflare from './cloudflare.mjs' export { request } export { default as convertToCSV } from './convert-to-csv.mjs' +export { default as read_csv } from './read-csv.mjs' const POST = (data) => ({ method: 'POST', diff --git a/common/read-csv.mjs b/common/read-csv.mjs new file mode 100644 index 00000000..73b8386f --- /dev/null +++ b/common/read-csv.mjs @@ -0,0 +1,14 @@ +import fs from 'fs' +import csv from 'csv-parser' + +const read_csv = (filepath, options = {}) => + new Promise((resolve, reject) => { + const results = [] + fs.createReadStream(filepath) + .pipe(csv(options)) + .on('data', (data) => results.push(data)) + .on('error', (error) => resolve(error)) + .on('end', () => resolve(results)) + }) + +export default read_csv diff --git a/data/nano-reps.csv b/data/nano-reps.csv index d8298e64..30fa2722 100644 --- a/data/nano-reps.csv +++ b/data/nano-reps.csv @@ -1,59 +1,139 @@ -alias,account,discord,reddit,twitter,website,email -❤️❤️ Nanolove ❤️❤️,nano_34amtofxstsfyqcgphp8piij9u33widykq9wbz6ysjpxhbgmqu8btu1eexer,,Roconda,,, -🔐 IronClad 🔐 ➡ Reliable node built to last,nano_11pb5aa6uirs9hoqsg4swnzyehoiqowj94kdpthwkhwufmtd6a11xx35iron,aristorn,,,, -1NANO Community,nano_16d45ow3tsj1y3z9n4satwzxgj6qiue1ggxbwbrj3b33qr58bzchkpsffpx4,dsiganos,,,, -AnarkNode,nano_3kc8wwut3u8g1kwa6x4drkzu346bdbyqzsn14tmabrpeobn8igksfqkzajbb,anarkrypto,,,, -ARaiNode,nano_3kqdiqmqiojr1aqqj51aq8bzz5jtwnkmhb38qwf3ppngo8uhhzkdkn7up7rp,arzarif,,,, -Binance,nano_3jwrszth46rk1mu7rmb4rhm54us8yg1gw3ipodftqtikf5yqdyr7471nsg1k,,,,, -FEES? OMEGALUL – shrynode.me,nano_1nk9zdf1otddxhxfqimjdkmbtq17yzf3z6giz1as7x1huyug8er1ukeqpqpe,shryder,,,shrynode.me, -Flying Amigos 🇮🇳,nano_1xckpezrhg56nuokqh6t1stjca67h37jmrp9qnejjkfgimx1msm9ehuaieuq,flying_amigos,,flying_amigos,, -gr0vity,nano_3msc38fyn67pgio16dj586pdrceahtn75qgnx7fy19wscixrc8dbb3abhbw6,gr0vity,,,, -humblenano.africa 🇿🇦,nano_3tta9pdxr4djdcm6r3c7969syoirj3dunrtynmmi8n1qtxzk9iksoz1gxdrh,krux0r,,HumbleNano,humblenano.africa, me@humblenano.io -humblenano.io 🔥,nano_3n7ky76t4g57o9skjawm8pprooz1bminkbeegsyt694xn6d31c6s744fjzzz,krux0r,,HumbleNano,humblenano.io, me@humblenano.io -Kappture,nano_3ktybzzy14zxgb6osbhcc155pwk7osbmf5gbh5fo73bsfu9wuiz54t1uozi1,,,,, -Kedrin,nano_15nt4cis8ac184q9mj7bedww9ay9zh5jk5k7sj9ypmz44twjcpz3cn6oijir,kedrin,,,, -Madora,nano_3g6ue89jij6bxaz3hodne1c7gzgw77xawpdz4p38siu145u3u17c46or4jeu,madora_io,,,, -MajorChump's Node,nano_1gemini56efw4qrfzfcc71cky1wj7a6673fu5ue5afyyz55zb1cxkj8rkr1n,majorchump,,,, -Marvel Nano Node,nano_3caprkc56ebsaakn4j4n7g9p8h358mycfjcyzkrfw1nai6prbyk8ihc5yjjk,marvel63,--Marvel--,,, -Moonstruck.dev 🌙,nano_1ota8bpwwawmc8ksdz4ezzrb3afbdeipk1n7rbeguhm4muy1r649uzw5moon,lun,,,, -My1s Nano Node,nano_1my1snode8rwccjxkckjirj65zdxo6g5nhh16fh6sn7hwewxooyyesdsmii3,my1,My1xT,,, -My Nano Ninja,nano_1ninja7rh37ehfp9utkor5ixmxyg8kme8fnzc4zty145ibch8kf5jwpnzr3r,bitdesert,,,, -Nalli | [Fast 💨 - Dedicated 💻 - Green 🍀],nano_3zapp5z141qpjipsb1jnjdmk49jwqy58i6u6wnyrh6x7woajeyme85shxewt,numsu,numsu,,, -Nanick,nano_3ekb6tp8ixtkibimyygepgkwckzhds9basxd5zfue4efjnxaan77gsnanick,nanick23,,,, -Nano Charts 📊,nano_3chartsi6ja8ay1qq9xg3xegqnbg1qx76nouw6jedyb8wx3r4wu94rxap7hg,frakilk,,NanoCharts,, -Nano Frogs,nano_1frogs8fqpdk17w17dpsdbgtbcdmm4egnty8oinxppkwykjzedrbt3suh4as,leucs.,,,, -Nano Germany 🇩🇪,nano_34zuxqdsucurhjrmpc4aixzbgaa4wjzz6bn5ryn56emc9tmd3pnxjoxfzyb6,_derjan_,Jan-d,,nanonode.de, -NANO ITALIA,nano_1wcxcjbwnnsdpee3d9i365e8bcj1uuyoqg9he5zjpt3r57dnjqe3gdc184ck,ts00397,,,nanoa.nanotaa.com, -Nano Node London,nano_18bpu81x4oyqsjjsyaeb7ek4rag1bw8gerhaiumookzc4t5prrm4d7zg56ww,citrus6994,,,, -NANO Skynode 🏔️,nano_3u7d5iohy14swyhxhgfm9iq4xa9yibhcgnyj697uwhicp14dhx4woik5e9ek,lephleg#0432,,,, -nano-no.de 🌍🚀🌑,nano_1fe17w13stn8rqos3nxmupoez9sne4pc4njmr1fbz9nci6obnng6jatton5q,imp3lor,Imp3r,,nano-no.de, -nano.strnmn.me 🌿,nano_3strnmn7h9b7oghxa6h9ckrpf5r454fsobpicixps6xwiwc5q4hat7wjbpqz,strnmn,strnmn,,nano.strnmn.me, -NanoBank,nano_1ec5optppmndqsb3rxu1qa4hpo39957s7mfqycpbd547jga4768o6xz8gfie,wendersonferreira,,,, -NanoCrawler / meltingice,nano_1x7biz69cem95oo7gxkrw6kzhfywq4x5dupw4z1bdzkb74dk9kpxwzjbdhhs,meltingice8917,,,, -NanoLooker,nano_1ookerz3adg5rxc4zwwoshim5yyyihf6dpogjihwwq6ksjpq7ea4fuam5mmc,runningcoder,,,, -NanOslo 🐯,nano_1jtx5p8141zjtukz4msp1x93st7nh475f74odj8673qqm96xczmtcnanos1o,Kittehcoinoisseurus REKT#2791,,,, -NanoTicker,nano_1iuz18n4g4wfp9gf7p1s8qkygxw7wx9qfjq6a9aq68uyrdnningdcjontgar,ricki2164,,,, -Nanovert,nano_375pi67f4i4ag5rudoziza86z715bepsmp1r6ri4domt7ct6tk67mjsxtebm,maupin,flippycakes,,, -NanoWallet.io,nano_3pczxuorp48td8645bs3m6c3xotxd3idskrenmi65rbrga5zmkemzhwkaznh,Jaimehgb#5768,btcludo,,, -NanoWallets.guide,nano_1zuksmn4e8tjw1ch8m8fbrwy5459bx8645o9euj699rs13qy6ysjhrewioey,pippen,,,, -Nanswap,nano_1banexkcfuieufzxksfrxqf6xy8e57ry1zdtq9yn7jntzhpwu4pg4hajojmq,nanswap,nanswap,,, -Natrium,nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd,bbedward,,,, -Nautilus Node,nano_38713x95zyjsqzx6nm1dsom1jmm668owkeb9913ax6nfgj15az3nu8xkx579,fosse,,,, -NiF's Node – nano.nifni.net,nano_1fnx59bqpx11s1yn7i5hba3ot5no4ypy971zbkp5wtium3yyafpwhhwkq8fc,nifni,,,, -Noli Me Tangere,nano_1isgusmnf1xe45iyjtfxw4qiai36zxdituu7gpni1trtj5ojyujobq13bjah,elevenb2003,,,, -Patrick's Self-Hosted Nano Node,nano_3patrick68y5btibaujyu7zokw7ctu4onikarddphra6qt688xzrszcg4yuo,qwahzi,qwahzi,patrickluberus,, -paypur's node,nano_15zntj4a8r6bkihei788ciy1jgc5wnskan1gpgn8e8jku3r4qhr7rwifitir,pieceofpaypur,,,, -PlayNANO Representative,nano_3pnanopr3d5g7o45zh3nmdkqpaqxhhp3mw14nzr41smjz8xsrfyhtf9xac77,playnano,,,, -PowerNode,nano_3power3gwb43rs7u9ky3rsjp6fojftejceexfkf845sfczyue4q3r1hfpr3o,theonewhonox,,,, -Puddy,nano_3abuqtbaotp9myn6ihb6mg96hf7jnapuddydf6ytgd174t4phg86nnq4cmxj,ryssnortskyltwyn,,,node.puddy.blue, -Redeemfor.me 🛍️🛒 — Luckynano.com 🎰💰,nano_1oenixj4qtpfcembga9kqwggkb87wooicfy5df8nhdywrjrrqxk7or4gz15b,emulord,,,, -RsNano.com - Nano Rust Port,nano_1tk8h3yzkibbsti8upkfa69wqafz6mzfzgu8bu5edaay9k7hidqdunpr4tb6,gschauwecker,SeniorTawny,gschauwecker,rsnano.com, -"ScandiNode 🌐 Green, fast & capable! ",nano_318uu1tsbios3kp4dts5b6zy1y49uyb88jajfjyxwmozht8unaxeb43keork,kevorkc,,,, -SomeNano.com,nano_1buid1zd65fynxnsmzyjgt1yd84cjrf81xa1mn861wtxmer5ss74bd8kbe4a,pwlk.,,,somenano.com, -SupeNode,nano_396sch48s3jmzq1bk31pxxpz64rn7joj38emj4ueypkb9p9mzrym34obze6c,jayycox,,,, -UAI Node,nano_16d3mdshcfqayyx8rd9ioimjiicrma743qpd86ohfs9kdzgejmnba1zifo8m,thiagosfs,,,, -warai,nano_33ad5app7jeo6jfe9ure6zsj8yg7knt6c1zrr5yg79ktfzk5ouhmpn6p5d7p,.warai,,,, -WeNano,nano_1wenanoqm7xbypou7x3nue1isaeddamjdnc3z99tekjbfezdbq8fmb659o7t,robotn,,WeNanoApp,, -XNOPay.com – 1,nano_1xnopay1bfmyx5eit8ut4gg1j488kt8bjukijerbn37jh3wdm81y6mxjg8qj,chirag_a,,,, -Yakamoz Node – nano.trade,nano_3pg8khw8gs94c1qeq9741n99ubrut8sj3n9kpntim1rm35h4wdzirofazmwt,yusufgurdogan,,,nano.trade, -Ӿ Makonode 🦈,nano_37ortkby6k68z8tkk8g63ndbp8wjbmofhn56oyxb4rm6s3x51pkpiwcnpgmq,badsyntax_,,,, +alias,account,discord,reddit,twitter,website,email,github +❤️❤️ Nanolove ❤️❤️,nano_34amtofxstsfyqcgphp8piij9u33widykq9wbz6ysjpxhbgmqu8btu1eexer,,Roconda,,,,Roconda +🌱 Deutscher Nano Knoten,nano_3akecx3appfbtf6xrzb3qu9c1himzze46uajft1k5x3gkr9iu3mw95noss6i,Laserwean#8224,laserwean,,,, +💰nano.bet💰,nano_3z1z144ggdujyypjmrm9dn37a5jimur6g5poshxzz5ryr6jjf8hufjgq16yr,hamiltino#8672,hamiltino,,,, +🔐 IronClad 🔐 ➡ Reliable node built to last,nano_11pb5aa6uirs9hoqsg4swnzyehoiqowj94kdpthwkhwufmtd6a11xx35iron,aristorn,,,,,Gigaion +1. High Performance Server 🚀 - DE,nano_18shbirtzhmkf7166h39nowj9c9zrpufeg75bkbyoobqwf1iu3srfm9eo3pz,Kamir#0001,,,,,amirmnsr +100% Solar Node,nano_1djdhi91kishsbh99wwwdza789y177kion5pckx4gi49i9ht19kdeni3m91u,Meatstick#8008,DaMeatstick,,,, +1NANO Community,nano_16d45ow3tsj1y3z9n4satwzxgj6qiue1ggxbwbrj3b33qr58bzchkpsffpx4,dsiganos,,,,, +3DP Nano Node,nano_1asau6gr8ft5ykynpkauctrq1w37sdasdymuigtxotim6kxoa3rgn3dpenis,Manalope#6969,,,,,Manalope +A Lil NANO,nano_1r98z5i14ztss597ajy3y9no5kpm1bm3uj1gam4gstjhhy3othmus1mamxyz,,pRizzAt,pryszkie,,,pRizz +AnarkNode,nano_3kc8wwut3u8g1kwa6x4drkzu346bdbyqzsn14tmabrpeobn8igksfqkzajbb,anarkrypto,anarkrypto,anarkrypto,,,anarkrypto +Another Nano Node,nano_13q3fmh7gxy3a3poj63846fzwbjfnq8pbpciymscb4c4dhth5hiu5zhqpts6,,mecryptome,,,, +ARaiNode,nano_3kqdiqmqiojr1aqqj51aq8bzz5jtwnkmhb38qwf3ppngo8uhhzkdkn7up7rp,arzarif,,,,, +Art Node,nano_1artnod3zc5e4rrra73ii4698t7pfiqt4c445efd499psaxyjae5bhm9susp,Ash_#8944,,,,, +Atomic Wallet,nano_35btiz1mgfwp95c3ckazmzbp5gepduxtijuijd9xebeau8u1gsbea41smjca,,,,,, +Banano Airdrop,nano_1bananobjcrqugm87e8p3kxkhy7d1bzkty53n889iyunm83cp14rb9fin78p,,,,,, +benk,nano_38hkh5ony8o1m61qzntuxf46twisj4m13yw91wy7xm7md3gpcgggn8jhqdk1,benk#6260,bklink,,,,benk210 +Binance,nano_3jwrszth46rk1mu7rmb4rhm54us8yg1gw3ipodftqtikf5yqdyr7471nsg1k,,,,,, +blankslate,nano_3wyw9zthfxqs1siz4kpgtkpmaf8zgdr1bi57nsrsg6zj6ab8ybojj9ctq1un,enqueued#6583,enqueued,,,, +BrainBlocks,nano_1brainb3zz81wmhxndsbrjb94hx3fhr1fyydmg6iresyk76f3k7y7jiazoji,Ty#0633,appdev980,brain_blocks,,,schenkty +Buckeye Nano Node,nano_3i3dqy5xs98ewtk9ejfpxfwbsscejc6njz9hk5ia1446gdkxpxkjeeia719n,,,,,, +Canoe representative,nano_3rropjiqfxpmrrkooej4qtmm1pueu36f9ghinpho4esfdor8785a455d16nf,gokr#4827,GoranKrampe,,,,gokr +CryptoVision Nano Node,nano_3bsnis6ha3m9cepuaywskn9jykdggxcu8mxsp76yc3oinrt3n7gi77xiggtm,Doctor N.#3685,,,,, +dbachm123,nano_1f56swb9qtpy3yoxiscq9799nerek153w43yjc9atoaeg3e91cc9zfr89ehj,dbachm123#1756,dbachm123,,,,dbachm123 +DERP,nano_1aqkrayihxzdahoxpjrg8o6mxgxfzq46hhcdm1u48w3qexsakx7pzzhjn3fc,DERP#1337,,,,, +Developer Fund,nano_1ipx847tk8o46pwxt5qjdbncjqcbwcc1rrmqnkztrfjy5k7z4imsrata9est,,,,,, +FEES? OMEGALUL – shrynode.me,nano_1nk9zdf1otddxhxfqimjdkmbtq17yzf3z6giz1as7x1huyug8er1ukeqpqpe,shryder,Shryder1337,,shrynode.me,,shryder +Fernseher's Node,nano_3r5ooenxm6r46tcbfpi4rdw69euu9u1tqizjpkoo3a4bckh8asyr99kjugki,,Fernseherr,,,, +Finland Green 💚 (Offline - Switch Rep),nano_3hjo1cehsxrssawmpew98u4ug8bxy4ppht5ch647zpuscdgedfy1xh4yga7z,,,,,, +Flowhub,nano_3f1owhubic8wa8rfmj5x6w9ore9btbtju5eampghs3y9ere6q6u96jraoo5s,kyle#2021,,KyleSherman,,, +Flying Amigos 🇮🇳,nano_1xckpezrhg56nuokqh6t1stjca67h37jmrp9qnejjkfgimx1msm9ehuaieuq,flying_amigos,,flying_amigos,,, +Funky BTC Node,nano_1fuckbtc6p55wt64eo4rz7brq3ubjfd8unhz3it5fbdpta8tww7ywk8p9su7,hanzyfranzy#4890,hanzyfranzy,,,, +gr0vity,nano_3msc38fyn67pgio16dj586pdrceahtn75qgnx7fy19wscixrc8dbb3abhbw6,gr0vity,gr0vity,,,, +Gray,nano_3grayknbwtrjdsbdgsjbx4fzds7eufjqghzu6on57aqxte7fhhh14gxbdz61,Gray#9501,mattthebamf,,,,mattthebamf +humblenano.africa 🇿🇦,nano_3tta9pdxr4djdcm6r3c7969syoirj3dunrtynmmi8n1qtxzk9iksoz1gxdrh,krux0r,,HumbleNano,humblenano.africa, me@humblenano.io,humble-nano +humblenano.io 🔥,nano_3n7ky76t4g57o9skjawm8pprooz1bminkbeegsyt694xn6d31c6s744fjzzz,krux0r,,HumbleNano,humblenano.io, me@humblenano.io,humble-nano +Huobi Representative,nano_1bj5cf9hkgkcspmn15day8cyn3hyaciufbba4rqmbnkmbdpjdmo9pwyatjoi,,,,,, +I bring a sort of feeless vibe to cryptocurrencies that miners don't really like,nano_1ba7uuq9kt68jzzw51a5kt577xtzaq37cnj8otqbhhnkgjyhwu91wtsjacez,EvoSteven#9999,,,,, +jserv 🇹🇼🐧,nano_1bko7zpcow7w6e11az8tnxdnyszgkt61miwuo9i9pom3czdzxqknpiuc7tdb,jserv#1678,,jserv,,,jserv +Kappture,nano_3ktybzzy14zxgb6osbhcc155pwk7osbmf5gbh5fo73bsfu9wuiz54t1uozi1,,,neil_haran,,,neilharan +Kedrin,nano_15nt4cis8ac184q9mj7bedww9ay9zh5jk5k7sj9ypmz44twjcpz3cn6oijir,kedrin,,,,, +Kraken,nano_37imps4zk1dfahkqweqa91xpysacb7scqxf3jqhktepeofcxqnpx531b3mnt,,,krakenfx,,, +KuCoin,nano_1niabkx3gbxit5j5yyqcpas71dkffggbr6zpd3heui8rpoocm5xqbdwq44oh,,,kucoincom,,, +Madora,nano_3g6ue89jij6bxaz3hodne1c7gzgw77xawpdz4p38siu145u3u17c46or4jeu,madora_io,,,,,elcampeador0 +Magnum Wallet,nano_1magnumr5yu6j7btpa4hwzg15n9dfxrernca7cmacj86agfkn1hx4933cpo1,,,,,,magnumwallet +MajorChump's Node,nano_1gemini56efw4qrfzfcc71cky1wj7a6673fu5ue5afyyz55zb1cxkj8rkr1n,majorchump,,,,,MajorChump +Marvel Nano Node,nano_3caprkc56ebsaakn4j4n7g9p8h358mycfjcyzkrfw1nai6prbyk8ihc5yjjk,marvel63,--Marvel--,,,, +mimenode,nano_1mime3jd7dbnshd6zw1gjqax5zit31h6y1x6pczfuz7au33ftacjib5cc1ez,,,aleksander_zien,,, +mimenode-old,nano_139tfuxmn4xne7kac8gy46rzg3tj8dcahyjjrexk9pc8udh3i1cjxs1h5rme,,,aleksander_zien,,, +Moonstruck.dev 🌙,nano_1ota8bpwwawmc8ksdz4ezzrb3afbdeipk1n7rbeguhm4muy1r649uzw5moon,lun,,,,,LunNova +My Nano Ninja,nano_1ninja7rh37ehfp9utkor5ixmxyg8kme8fnzc4zty145ibch8kf5jwpnzr3r,bitdesert,2D3S3RT,BitDesert,,,BitDesert +My1s Nano Node,nano_1my1snode8rwccjxkckjirj65zdxo6g5nhh16fh6sn7hwewxooyyesdsmii3,my1,My1xT,My1xT,,,My1 +Nalli | [Fast 💨 - Dedicated 💻 - Green 🍀],nano_3zapp5z141qpjipsb1jnjdmk49jwqy58i6u6wnyrh6x7woajeyme85shxewt,numsu,numsu,,,,numsu +Nanick,nano_3ekb6tp8ixtkibimyygepgkwckzhds9basxd5zfue4efjnxaan77gsnanick,nanick23,NanoOverBitcoin,The_Nano_Knight,,, +Nano Charts 📊,nano_3chartsi6ja8ay1qq9xg3xegqnbg1qx76nouw6jedyb8wx3r4wu94rxap7hg,frakilk,frakilk,NanoCharts,,,kilkelly +Nano Foundation #1,nano_3arg3asgtigae3xckabaaewkx3bzsh7nwz7jkmjos79ihyaxwphhm6qgjps4,,,nano,,, +Nano Foundation #2,nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou,,,nano,,, +Nano Foundation #3,nano_1q3hqecaw15cjt7thbtxu3pbzr1eihtzzpzxguoc37bj1wc5ffoh7w74gi6p,,,nano,,, +Nano Foundation #4,nano_3dmtrrws3pocycmbqwawk6xs7446qxa36fcncush4s1pejk16ksbmakis78m,,,nano,,, +Nano Foundation #5,nano_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k,,,nano,,, +Nano Foundation #6,nano_1awsn43we17c1oshdru4azeqjz9wii41dy8npubm4rg11so7dx3jtqgoeahy,,,nano,,, +Nano Foundation #7,nano_1anrzcuwe64rwxzcco8dkhpyxpi8kd7zsjc1oeimpc3ppca4mrjtwnqposrs,,,nano,,, +Nano Foundation #8,nano_1hza3f7wiiqa7ig3jczyxj5yo86yegcmqk3criaz838j91sxcckpfhbhhra1,,,nano,,, +Nano Frogs,nano_1frogs8fqpdk17w17dpsdbgtbcdmm4egnty8oinxppkwykjzedrbt3suh4as,leucs.,leucs,,,, +Nano Germany 🇩🇪,nano_34zuxqdsucurhjrmpc4aixzbgaa4wjzz6bn5ryn56emc9tmd3pnxjoxfzyb6,_derjan_,Jan-d,,nanonode.de,, +NANO ITALIA,nano_1wcxcjbwnnsdpee3d9i365e8bcj1uuyoqg9he5zjpt3r57dnjqe3gdc184ck,ts00397,fcdeluxe,,nanoa.nanotaa.com,, +Nano Node London,nano_18bpu81x4oyqsjjsyaeb7ek4rag1bw8gerhaiumookzc4t5prrm4d7zg56ww,citrus6994,,,,, +NANO Skynode 🏔️,nano_3u7d5iohy14swyhxhgfm9iq4xa9yibhcgnyj697uwhicp14dhx4woik5e9ek,lephleg#0432,lephleg,,,,lephleg +NANO TipBot,nano_3o7uzba8b9e1wqu5ziwpruteyrs3scyqr761x7ke6w1xctohxfh5du75qgaj,bbedward#9246,bbedward,,,,bbedward +NANO Voting 🌍 [2018-2023],nano_3uaydiszyup5zwdt93dahp7mri1cwa5ncg9t4657yyn3o4i1pe8sfjbimbas,Bimbas#7923,BimbasVG,,,,BimbasVG +Nano Yo Business,nano_187i9cz1rwm65ufi4i65nczginx4iw15n7jb5iaqjgb5o8qte7weca6rbihn,,shoot_first,,,, +nano-no.de 🌍🚀🌑,nano_1fe17w13stn8rqos3nxmupoez9sne4pc4njmr1fbz9nci6obnng6jatton5q,imp3lor,Imp3r,,nano-no.de,, +Nano-Rep.xyz,nano_3kxxs46k7x581icfxfaxmdsg1gmzonj6m3bjxyqek4jy4mu65r6oifisuf6k,Nano-Rep.xyz#4560,nano-rep_xyz,,,, +nano.lol,nano_31xitw55kb3ko8yaz3439hqaqpibxa9shx76suaa3no786do3hjuz8dy6izw,,,,,,mkral +nano.strnmn.me 🌿,nano_3strnmn7h9b7oghxa6h9ckrpf5r454fsobpicixps6xwiwc5q4hat7wjbpqz,strnmn,strnmn,strnmn,nano.strnmn.me,,moritzsternemann +NanoBank,nano_1ec5optppmndqsb3rxu1qa4hpo39957s7mfqycpbd547jga4768o6xz8gfie,wendersonferreira,,,,,wendersonferreira +NanoBrasil 🇧🇷,nano_1j78msn5omp8jrjge8txwxm4x3smusa1cojg7nuk8fdzoux41fqeeogg5aa1,,,,,,wendersonferreira +nanocafe.cc,nano_1cafe95a81ko3mq3oin4wnubsbw9z3w3tw5a95u47897wxy96r1zj9hxu1wb,,Saizo,,,, +nanocenter,nano_1center16ci77qw5w69ww8sy4i4bfmgfhr81ydzpurm91cauj11jn6y3uc5y,,,,,, +NanoCrawler / meltingice,nano_1x7biz69cem95oo7gxkrw6kzhfywq4x5dupw4z1bdzkb74dk9kpxwzjbdhhs,meltingice8917,meltingice,MeltingIce,,,meltingice +Nanode,nano_1nanode8ngaakzbck8smq6ru9bethqwyehomf79sae1k7xd47dkidjqzffeg,,,rawrmaan,,, +Nanode21,nano_1i9ugg14c5sph67z4st9xk8xatz59xntofqpbagaihctg6ngog1f45mwoa54,standreas#8921,standreas,,,,stefonarch +nanohodlr,nano_1nanoftwk6741wmdznzangwm8prq95spu3zntb5gwpjdk8qd3p8eu5bxoehc,nanohodlr#6432,,,,, +NanoIsByUs,nano_3o5dcp6kjish9xuu51akx1d8bp4pytk4diput3s8dkt7cktnmcg96aoi1cbw,Nec#6937,,,,, +nanoisfast.com,nano_3hrppx3sfxoiycjm9iaqsr3odecgarcxxxhsm41s9pbs75ykambxqhu9ys58,perceptivetek(nanoisfast.com)#6995,perceptivetek,,,, +NanoLooker,nano_1ookerz3adg5rxc4zwwoshim5yyyihf6dpogjihwwq6ksjpq7ea4fuam5mmc,runningcoder,,,,, +NanoMAX,nano_37tuecwghy64eyqcgxmq3fsb9d55frw3yyo8ksubf66b73hz877nmaa5f3mr,,soliejordan,,,, +NanoPea,nano_3ncnueds3ghkjco43d89636ep39ysz6eik4arujf55gu39i7g184t9yq6obd,ryanpea#9228,ryanpea,,,,ryan-froggatt +NanoQuake,nano_1kd4h9nqaxengni43xy9775gcag8ptw8ddjifnm77qes1efuoqikoqy5sjq3,jayycox,jayycox,jamescoxon,,,jamescoxon +NanoSG (Node - Deckard Cain) 🇸🇬,nano_14mp1ua4oi45rxosft3d8qe4g6a1u1srma59jg85ax6s8zuwhi4yzgdnqhz3,Puny#9278,punyyy,nanosgnode,,, +NanOslo 🐯,nano_1jtx5p8141zjtukz4msp1x93st7nh475f74odj8673qqm96xczmtcnanos1o,Kittehcoinoisseurus REKT#2791,KITTEHCOIN_WHALE,,,, +NanoThings,nano_1thingspmippfngcrtk1ofd3uwftffnu4qu9xkauo9zkiuep6iknzci3jxa6,,,Nano_Things,,, +NanoTicker,nano_1iuz18n4g4wfp9gf7p1s8qkygxw7wx9qfjq6a9aq68uyrdnningdcjontgar,ricki2164,,,,, +nanotps.com,nano_3mhrc9czyfzzok7xeoeaknq6w5ok9horo7d4a99m8tbtbyogg8apz491pkzt,,SonderDev,,,, +NanoVault,nano_3rw4un6ys57hrb39sy1qx8qy5wukst1iiponztrz9qiz6qqa55kxzx4491or,,cronoh,NanoVault,,,cronoh +Nanovert,nano_375pi67f4i4ag5rudoziza86z715bepsmp1r6ri4domt7ct6tk67mjsxtebm,maupin,flippycakes,,,,maupin +NanoWallet Bot,nano_16k5pimotz9zehjk795wa4qcx54mtusk8hc5mdsjgy57gnhbj3hj6zaib4ic,,,,,, +NanoWallet.io,nano_3pczxuorp48td8645bs3m6c3xotxd3idskrenmi65rbrga5zmkemzhwkaznh,Jaimehgb#5768,btcludo,nanowallet_io,,, +NanoWallets.guide,nano_1zuksmn4e8tjw1ch8m8fbrwy5459bx8645o9euj699rs13qy6ysjhrewioey,pippen,,nanowallets,,,nanowallets-guide +Nanswap,nano_1banexkcfuieufzxksfrxqf6xy8e57ry1zdtq9yn7jntzhpwu4pg4hajojmq,nanswap,nanswap,Nanswap,,, +Natrium,nano_1natrium1o3z5519ifou7xii8crpxpk8y65qmkih8e8bpsjri651oza8imdd,bbedward,bbedward,,,,bbedward +Nautilus Node,nano_38713x95zyjsqzx6nm1dsom1jmm668owkeb9913ax6nfgj15az3nu8xkx579,fosse,fossephate,fossephate,,,fossephate +NiF's Node – nano.nifni.net,nano_1fnx59bqpx11s1yn7i5hba3ot5no4ypy971zbkp5wtium3yyafpwhhwkq8fc,nifni,NiFNi,nifninif,,,NiFNi +Node will shut down January 2025,nano_3afmp9hx6pp6fdcjq96f9qnoeh1kiqpqyzp7c18byaipf48t3cpzmfnhc1b7,,,,,, +Noli Me Tangere,nano_1isgusmnf1xe45iyjtfxw4qiai36zxdituu7gpni1trtj5ojyujobq13bjah,elevenb2003,ElevenB2002,,,, +Nonna,nano_1just1zdsnke856mu5pmed1qdkzk6adh3d13iiqr3so66sr8pbcnh15bdjda,just_dmitry#5828,just_dmitry,,,,justdmitry +oFLIPSTARo's Node,nano_1qgkdadcbwn65sp95gr144fuc99tm5tn6gx9y8ow9bgaam6r5ixgtx19tw93,,,,,, +Patrick's Self-Hosted Nano Node,nano_3patrick68y5btibaujyu7zokw7ctu4onikarddphra6qt688xzrszcg4yuo,qwahzi,qwahzi,patrickluberus,,,qwahzi +paypur's node,nano_15zntj4a8r6bkihei788ciy1jgc5wnskan1gpgn8e8jku3r4qhr7rwifitir,pieceofpaypur,paypur,,,, +PHD NANO NODE,nano_3hps1wndzrxtybfg77agkrmstb6yzdrr3d55ynw6hfogw8gnux94fdwi8owg,,,phdmdf,,, +PixelStix,nano_1u7anedrbmqx4gr8x44r6k4egg9nhi75yb1qsz63e5ykhz3mx3r3jw463r3t,,,PixelStixApp,,, +PlayNANO Representative,nano_3pnanopr3d5g7o45zh3nmdkqpaqxhhp3mw14nzr41smjz8xsrfyhtf9xac77,playnano,playnano,,,, +Please switch to an active representative,nano_14hww1gr4d56ba5m9o4wukq648hhonu5camofscyr4p3icajy9b7od1u8dfy,,,,,, +PowerNode,nano_3power3gwb43rs7u9ky3rsjp6fojftejceexfkf845sfczyue4q3r1hfpr3o,theonewhonox,whale_machine,,,, +Puddy,nano_3abuqtbaotp9myn6ihb6mg96hf7jnapuddydf6ytgd174t4phg86nnq4cmxj,ryssnortskyltwyn,diab0lus,,node.puddy.blue,, +ranita | NanoHispano,nano_1hispanocq7ow8azrs3mirsccebuh5e3pfk8pkfzfafbyooezpsnwiuizjcu,ISAM#0220,,nano_isam,,, +Redeemfor.me 🛍️🛒 — Luckynano.com 🎰💰,nano_1oenixj4qtpfcembga9kqwggkb87wooicfy5df8nhdywrjrrqxk7or4gz15b,emulord,Emul0rd,,,,Emulord +repnode.org,nano_3rpixaxmgdws7nk7sx6owp8d8becj9ei5nef6qiwokgycsy9ufytjwgj6eg9,,,,,, +RsNano.com - Nano Rust Port,nano_1tk8h3yzkibbsti8upkfa69wqafz6mzfzgu8bu5edaay9k7hidqdunpr4tb6,gschauwecker,SeniorTawny,gschauwecker,rsnano.com,, +"ScandiNode 🌐 Green, fast & capable! ",nano_318uu1tsbios3kp4dts5b6zy1y49uyb88jajfjyxwmozht8unaxeb43keork,kevorkc,kevorkdk,,,, +scoin.cool,nano_3o5oeefdnrha7x7styp1tnmefen7fnrooy4jgnfb1otws54yf7uqfuxmojoy,,,,,,AviGopal +SendNudes 👀,nano_3sendnudez9x8zkaid5k17g474f9dc4fuopggzojwop9sbc5isgwah5gbx9n,user_8804 - Gab Parrot#8804,user_8804,Gab_Parrot,,,gabparrot +SomeNano.com,nano_1buid1zd65fynxnsmzyjgt1yd84cjrf81xa1mn861wtxmer5ss74bd8kbe4a,pwlk.,,,somenano.com,, +SupeNode,nano_396sch48s3jmzq1bk31pxxpz64rn7joj38emj4ueypkb9p9mzrym34obze6c,jayycox,jayycox,jamescoxon,,,jamescoxon +TipNano ⛲,nano_1tipnanogsu7q59pnie3qfc4w378wm43fg4ksqc8wmnnfnizrq1xrpt5geho,Blade#8144,,,,, +TRUSTABLE - NN1,nano_1b9wguhh39at8qtm93oghd6r4f4ubk7zmqc9oi5ape6yyz4s1gamuwn3jjit,dmxdm#2752,465di,,,, +TRUSTABLE - NN2,nano_19qo4gtzpoyqf6zzezbcuazcsxtqtdin5qbtk8jkoz4fdmq4ssagn3u1odhz,dmxdm#2752,465di,,,, +Twitter Nano Tip Bot,nano_17wmwpg65neuh8u84f99e6nxcf48znusb437efwaafta7rtpy4n9h6io79xj,,,,,,mitche50 +UAI Node,nano_16d3mdshcfqayyx8rd9ioimjiicrma743qpd86ohfs9kdzgejmnba1zifo8m,thiagosfs,UaiDev,,,,thsfs +Upstart Hosting,nano_1ebq356ex7n5efth49o1p31r4fmuuoara5tmwduarg7b9jphyxsatr3ja6g8,UpstartHosting#3551,UpstartHosting,UpstartHosting,,, +UrbaNano [NL],nano_1m1afmq54gum53md3dm3o9arctwn8buwqk8kynxszh468qmm3kn7sawmgihz,,,nstrctrd,,, +VINO Community Rep,nano_1sw898hgeexgrsq8x16wdadwdrs3obn418z6x98parb5tymz879mu89qndju,,,,,,Gabrielpatrola +warai,nano_33ad5app7jeo6jfe9ure6zsj8yg7knt6c1zrr5yg79ktfzk5ouhmpn6p5d7p,.warai,warai17,chrismwarner,,,warai17 +WeNano,nano_1wenanoqm7xbypou7x3nue1isaeddamjdnc3z99tekjbfezdbq8fmb659o7t,robotn,,WeNanoApp,,, +Wirex,nano_3ngt59dc7hbsjd1dum1bw9wbb87mbtuj4qkwcruididsb5rhgdt9zb4w7kb9,,,,,, +XNOPay.com – 1,nano_1xnopay1bfmyx5eit8ut4gg1j488kt8bjukijerbn37jh3wdm81y6mxjg8qj,chirag_a,,,,,chirag-xnopay +Yakamoz Node – nano.trade,nano_3pg8khw8gs94c1qeq9741n99ubrut8sj3n9kpntim1rm35h4wdzirofazmwt,yusufgurdogan,,,nano.trade,,yusufgurdogan +yve NANO node,nano_1bbpmnm69yireu5ehmkt1mi43dnkcfhaam6jsbmwqmgqh1q1mftpdd6c68ew,Brayd#4024,thisdudeisvegan,thisdudeisvegan,,,braydofficial +Ӿ Makonode 🦈,nano_37ortkby6k68z8tkk8g63ndbp8wjbmofhn56oyxb4rm6s3x51pkpiwcnpgmq,badsyntax_,,,,, diff --git a/db/schema.sql b/db/schema.sql index 649fe6ba..11869872 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -190,6 +190,8 @@ CREATE TABLE `representatives_meta` ( `twitter` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `discord` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `github` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `website` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `email` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `timestamp` int(11) NOT NULL, UNIQUE KEY `account` (`account`, `timestamp`) @@ -230,6 +232,8 @@ CREATE TABLE `representatives_meta_index` ( `twitter` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `discord` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `github` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `website` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `email` varchar(255) CHARACTER SET utf8 DEFAULT NULL, `timestamp` int(11) NOT NULL, UNIQUE KEY `account` (`account`) diff --git a/package.json b/package.json index 6e6c1910..e82cc63a 100644 --- a/package.json +++ b/package.json @@ -85,9 +85,11 @@ "compression": "^1.7.4", "connected-react-router": "^6.9.3", "cors": "^2.8.5", + "csv-parser": "^3.0.0", "csv-writer": "^1.6.0", "dayjs": "^1.11.9", "debug": "^4.3.4", + "deep-diff": "^1.0.2", "deep-extend": "^0.6.0", "esm": "^3.2.25", "express": "^4.18.2", diff --git a/scripts/generate-nano-reps.mjs b/scripts/generate-nano-reps.mjs new file mode 100644 index 00000000..e1957bcb --- /dev/null +++ b/scripts/generate-nano-reps.mjs @@ -0,0 +1,217 @@ +import debug from 'debug' +// import yargs from 'yargs' +// import { hideBin } from 'yargs/helpers' +import diff from 'deep-diff' +import fetch from 'node-fetch' +import { pipeline } from 'stream' +import { promisify } from 'util' +import os from 'os' +import fs from 'fs' +import { fileURLToPath } from 'url' +import path, { dirname } from 'path' + +/* eslint-disable no-unused-vars */ +import db from '#db' +import { isMain, read_csv, convertToCSV } from '#common' +import { REPRESENTATIVE_TRACKING_MINIMUM_VOTING_WEIGHT } from '#constants' +/* eslint-enable no-unused-vars */ + +// const argv = yargs(hideBin(process.argv)).argv +const log = debug('generate-nano-reps') +debug.enable('generate-nano-reps') + +const generate_nano_reps = async () => { + // Fetch nano representatives data from GitHub and save to temp file + const current_date = new Date().toISOString().split('T')[0] + const filename = `nano-reps-${current_date}.csv` + const csv_download_path = `${os.tmpdir()}/${filename}` + const stream_pipeline = promisify(pipeline) + const nano_reps_resp = await fetch( + 'https://raw.githubusercontent.com/mistakia/nano-community/main/data/nano-reps.csv' + ) + await stream_pipeline( + nano_reps_resp.body, + fs.createWriteStream(`${csv_download_path}`) + ) + // Read the downloaded CSV data + const csv_reps = await read_csv(csv_download_path, { + mapValues: ({ header, index, value }) => { + if (value === '') { + return null + } + + if (header === 'alias') { + return value.replace(/"/g, '') + } + + return value + } + }) + + // Fetch representatives data from the database + const db_reps = await db('representatives_meta_index') + .leftJoin( + 'accounts', + 'representatives_meta_index.account', + 'accounts.account' + ) + .leftJoin( + 'accounts_meta_index', + 'accounts.account', + 'accounts_meta_index.account' + ) + .whereNot( + 'representatives_meta_index.account', + 'nano_1111111111111111111111111111111111111111111111111111hifc8npp' + ) + .select( + 'accounts.alias', + 'accounts_meta_index.weight', + 'representatives_meta_index.account', + 'reddit', + 'discord', + 'twitter', + 'github', + 'website', + 'email' + ) + + const results_index = {} + + // Index database representatives by account + const db_reps_index = db_reps.reduce((acc, cur) => { + acc[cur.account] = cur + return acc + }, {}) + + // Index CSV representatives by account + const csv_reps_index = csv_reps.reduce((acc, cur) => { + acc[cur.account] = cur + return acc + }, {}) + + // Merge csv and database data, skip accounts with conflicts + for (const account in csv_reps_index) { + const nano_rep = csv_reps_index[account] + const db_rep = db_reps_index[account] + const db_rep_without_weight_field = { ...db_rep } + delete db_rep_without_weight_field.weight + const differences = diff(nano_rep, db_rep_without_weight_field) + + // Filter for conflicting edits + const edits = differences.filter((diff) => diff.kind === 'E') + const conflicting_edits = edits.filter( + (edit) => Boolean(edit.lhs) && Boolean(edit.rhs) + ) + + if (conflicting_edits.length) { + log(`conflicting edits for account: ${account}`) + log(conflicting_edits) + continue + } + + // Merge values, preferring truthy values + const merged_rep = {} + for (const key in merged_rep) { + if (merged_rep[key] === null) { + merged_rep[key] = nano_rep[key] || db_rep_without_weight_field[key] + } + } + + results_index[account] = { + alias: nano_rep.alias || db_rep_without_weight_field.alias, + account: nano_rep.account || db_rep_without_weight_field.account, + discord: nano_rep.discord || db_rep_without_weight_field.discord || '', + reddit: nano_rep.reddit || db_rep_without_weight_field.reddit || '', + twitter: nano_rep.twitter || db_rep_without_weight_field.twitter || '', + website: nano_rep.website || db_rep_without_weight_field.website || '', + email: nano_rep.email || db_rep_without_weight_field.email || '', + github: nano_rep.github || db_rep_without_weight_field.github || '' + } + } + + // Add missing representatives with sufficient voting weight (10,000 Nano) and at least one non-null field + for (const account in db_reps_index) { + if ( + !results_index[account] && + db_reps_index[account].weight > + REPRESENTATIVE_TRACKING_MINIMUM_VOTING_WEIGHT + ) { + const { + weight, + account: db_rep_account, + ...db_rep_without_weight_field + } = db_reps_index[account] + const has_non_null_field = Object.values( + db_rep_without_weight_field + ).some((value) => value !== null) + if (has_non_null_field) { + results_index[account] = { + alias: db_rep_without_weight_field.alias, + account: db_rep_account, + discord: db_rep_without_weight_field.discord || '', + reddit: db_rep_without_weight_field.reddit || '', + twitter: db_rep_without_weight_field.twitter || '', + website: db_rep_without_weight_field.website || '', + email: db_rep_without_weight_field.email || '', + github: db_rep_without_weight_field.github || '' + } + } + } + } + + // Sort results by alias + const results = Object.values(results_index).sort((a, b) => { + const alias_a = a.alias || '' + const alias_b = b.alias || '' + return alias_a.localeCompare(alias_b) + }) + + // escape any commas in alias + for (const rep of results) { + // check if alias contains a comma + if (rep.alias.includes(',')) { + rep.alias = `"${rep.alias}"` + } + } + + // Convert results to CSV and save + const csv_headers = {} + for (const field of Object.keys(results[0])) { + csv_headers[field] = field + } + const result_csv_data = [csv_headers, ...results] + const result_csv_string = JSON.stringify(result_csv_data) + const result_csv = convertToCSV(result_csv_string) + const __dirname = dirname(fileURLToPath(import.meta.url)) + const data_path = path.join(__dirname, '../data') + const csv_path = path.join(data_path, 'nano-reps.csv') + await fs.promises.writeFile(csv_path, result_csv) + + log(`wrote ${results.length} reps to ${csv_path}`) +} + +const main = async () => { + let error + try { + await generate_nano_reps() + } catch (err) { + error = err + log(error) + } + + // await db('jobs').insert({ + // type: constants.jobs.EXAMPLE, + // succ: error ? 0 : 1, + // reason: error ? error.message : null, + // timestamp: Math.round(Date.now() / 1000) + // }) + + process.exit() +} + +if (isMain(import.meta.url)) { + main() +} + +export default generate_nano_reps diff --git a/yarn.lock b/yarn.lock index 047a5244..81309f04 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6997,6 +6997,17 @@ __metadata: languageName: node linkType: hard +"csv-parser@npm:^3.0.0": + version: 3.0.0 + resolution: "csv-parser@npm:3.0.0" + dependencies: + minimist: ^1.2.0 + bin: + csv-parser: bin/csv-parser + checksum: adc9d67d9f185249825570778c24d13004625301655330f6b735a052b9fdfbe1a239a014afb1f89939e0626ee573718f71f9f14164db7c17e4bcb2f38d6a162b + languageName: node + linkType: hard + "csv-writer@npm:^1.6.0": version: 1.6.0 resolution: "csv-writer@npm:1.6.0" @@ -7243,6 +7254,13 @@ __metadata: languageName: node linkType: hard +"deep-diff@npm:^1.0.2": + version: 1.0.2 + resolution: "deep-diff@npm:1.0.2" + checksum: 9de8b5eedc1957116e1b47e4c3c4e3dbe23cb741abefc5ec8829a12e77958c689ac46888a3c35320f976cf42fb6de2b016e158facdb24d894ab5b5fdabad9b34 + languageName: node + linkType: hard + "deep-extend@npm:^0.6.0": version: 0.6.0 resolution: "deep-extend@npm:0.6.0" @@ -15687,9 +15705,11 @@ __metadata: cors: ^2.8.5 cross-env: ^7.0.3 css-loader: 6.8.1 + csv-parser: ^3.0.0 csv-writer: ^1.6.0 dayjs: ^1.11.9 debug: ^4.3.4 + deep-diff: ^1.0.2 deep-extend: ^0.6.0 deepmerge: 4.3.1 echarts: ^5.4.3