Created
August 16, 2022 17:51
-
-
Save mertimus/3cf3026c28f78acb70803415bbec048d to your computer and use it in GitHub Desktop.
Revisions
-
mertimus created this gist
Aug 16, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ const axios = require('axios'); const apiURL = 'https://api.helius.xyz/v0/addresses/'; const address = '8cRrU1NzNpjL3k2BwjW3VixAcX6VFc29KHr4KZg8cs2Y'; const resource = '/transactions'; const options = '?api-key=d63a869e-bb73-4792-ae33-a06f4c72f226&before='; let lastTxn = ''; const allTxns = []; const getAllTxns = async () => { while(true) { console.log("fetching transactions...") const { data } = await axios.get(apiURL + address + resource + options + lastTxn) if(!data.length) { console.log("got all transactions") break } lastTxn = data[data.length - 1].signature allTxns.push(...data); } console.log("Total transactions: ", allTxns.length) } getAllTxns()