Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Reserved

node v10.24.1
version: 7.0.0
endpointsharetweet
const Client = require('rippled-ws-client') // const account = 'rPyFs5kpbiiawSdP9JGdaYM33zfUUah1TY' const account = 'rPdvC6ccq8hCdPKSPJkPmyZ4Mi1oG2FFkT' const c = new Client('wss://xrpl.link').then(Connection => { Connection.send({ command: 'account_tx', account: account }).then(txs => { console.log('Got', txs.transactions.length) if (typeof txs.transactions !== 'undefined' && txs.transactions && txs.transactions.length > 0) { const incomingTxs = txs.transactions.filter(tx => { return tx.tx.Destination === account }) const incomingTxCountWithTag = incomingTxs.filter(tx => { return typeof tx.tx.TransactionType === 'string' && typeof tx.tx.DestinationTag !== 'undefined' }).length const senders = txs.transactions.map(tx => { return tx.tx.Account || '' }) const uniqueSenders = senders.filter((elem, pos) => { return senders.indexOf(elem) === pos }).length const percentageTag = incomingTxCountWithTag / incomingTxs.length * 100 console.log('Unique senders: ' + uniqueSenders) console.log('With tag: ' + incomingTxCountWithTag) console.log('Percentage: ' + percentageTag) if (uniqueSenders >= 10 && percentageTag > 50) { console.log('This is most likely an exchange or custodian, tag required') } else { console.log('Tag is probably not required...') } } Connection.close() }).catch(e => console.log(e.message)) })
Loading…

no comments

    sign in to comment