-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
36 lines (27 loc) · 1.12 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { loadHopTransfers } from './src'
async function bootstrap() {
const transfers = await loadHopTransfers()
// first one
console.info('first one: ', transfers[0])
// middle one
console.info('middle one: ', transfers[Math.floor((transfers.length - 1) / 2)])
// last one
console.info('first one: ', transfers[transfers.length - 1])
// filter transfer with a destinationTransaction
const transfersWithDestinationTransaction = transfers.filter(
(item) => item.destinationTransaction.transactionHash !== 'n/a',
)
// first one with a destinationTransaction
console.info('first one with a destinationTransaction: ', transfersWithDestinationTransaction[0])
// middle one with a destinationTransaction
console.info(
'middle one with a destinationTransaction: ',
transfersWithDestinationTransaction[Math.floor((transfersWithDestinationTransaction.length - 1) / 2)],
)
// last one with a destinationTransaction
console.info(
'first one with a destinationTransaction: ',
transfersWithDestinationTransaction[transfersWithDestinationTransaction.length - 1],
)
}
bootstrap().catch(console.error)