const ADDRESS = '' // address to watch for gaps async function resetStartingPoint() { // using the api_request function defined in earlier examples const resp = await api_request({ "command": "account_info", "account": ADDRESS }) if (resp.status === "success") { return resp.result.account_data.PreviousTxnID } else { console.error("Couldn't get account_info for address "+address+" because of error: "+JSON.stringify(resp)) } } let knownPreviousTxnID = undefined // Using the socket from earlier examples socket.addEventListener('open', (event) => { knownPreviousTxnID = resetStartingPoint() }) function hasGaps(affected_nodes) { if (typeof knownPreviousTxnID === "undefined") { console.warn("Can't detect gaps without a known PreviousTxnID...") return undefined } for (let i=0; i