diff --git a/src/tests/testParseTransactions.ts b/src/tests/testParseTransactions.ts index 64f8c43..d5582b4 100644 --- a/src/tests/testParseTransactions.ts +++ b/src/tests/testParseTransactions.ts @@ -100,3 +100,44 @@ async function consumeTransactions() { } consumeTransactions(); + + +async function getAllSignatures(addressPk: PublicKey, connection: Connection) { + let signatures; + const limit = 1000; + let before = null; + let options; + let allSignaturesInfo: ConfirmedSignatureInfo[] = []; + + while (true) { + if (before === null) { + options = { limit: limit }; + } else { + options = { limit: limit, before: before }; + } + + let signaturesInfo = await connection.getConfirmedSignaturesForAddress2( + addressPk, + options, + ); + signatures = signaturesInfo.map((x) => x['signature']); + + allSignaturesInfo = allSignaturesInfo.concat(signaturesInfo); + + if (signaturesInfo.length !== limit) { + break + } + + before = signatures[signatures.length - 1]; + + console.log( + new Date( + signaturesInfo[signaturesInfo.length - 1].blockTime! * 1000, + ).toISOString(), + ); + + } + + return allSignaturesInfo; +} +