-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathderivedAddressesTable.js
More file actions
43 lines (40 loc) · 1.02 KB
/
derivedAddressesTable.js
File metadata and controls
43 lines (40 loc) · 1.02 KB
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
37
38
39
40
41
42
43
import React from "react"
import { Table } from "react-bootstrap"
import { maskKey, segment } from "@swan-bitcoin/xpub-lib"
const DerivedAddressesTable = ({ addressList, showCount, extPubKey }) => {
return (
<Table bordered>
<thead>
<tr>
<th>
Addresses for <code>{maskKey(extPubKey)}</code>
</th>
</tr>
</thead>
<tbody>
{addressList.map(({ path, address }, i) => {
return (
i < (showCount || addressList.length) && (
<PathAddressRow key={path} path={path} address={address} />
)
)
})}
<PathAddressRow path="..." address="..." />
</tbody>
</Table>
)
}
const PathAddressRow = ({ path, address }) => {
const segments = segment(address)
return (
<tr>
<td>
<span title={path}>
<strong>{segments[0]}</strong> {segments[1]}{" "}
<strong>{segments[2]}</strong>
</span>
</td>
</tr>
)
}
export { DerivedAddressesTable }