Created
April 13, 2022 22:24
-
-
Save nathanleclaire/a8d8b53ce33353ccbafa66245f151bae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
console.log('LFG'); | |
const startBlock = 117416695; | |
const blocks = range(startBlock, startBlock + 100000); | |
let fees = 0; | |
for (const i of blocks.values()) { | |
try { | |
const solConn = new sol.Connection( | |
'solapi.com', | |
{ | |
httpHeaders: { | |
Referer: 'redacted', | |
}, | |
} | |
); | |
const blockInfo = await solConn.getBlock(i); | |
const blockFees = blockInfo?.transactions.reduce( | |
(partialSum: number, a) => | |
!a.meta ? partialSum : partialSum + a.meta?.fee, | |
0 | |
); | |
console.log(`BLOCK FEES (${i}): ${blockFees}`); | |
fees += blockFees || 0; | |
if (i % 100 === 0) | |
console.log( | |
`TOTAL FEES: blocks=${i} lamports=${fees} sol=${ | |
fees / sol.LAMPORTS_PER_SOL | |
}` | |
); | |
} catch (e) {} | |
} | |
console.log( | |
`TOTAL FEES: lamports=${fees} sol=${fees / sol.LAMPORTS_PER_SOL}` | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment