mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-13 11:35:40 +01:00
Add toAddress on HDChain
This commit is contained in:
parent
4435d942d9
commit
75bf52a431
2 changed files with 12 additions and 0 deletions
|
@ -29,6 +29,15 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
}
|
||||
}
|
||||
|
||||
behavior of "HDChain"
|
||||
|
||||
it must "be convertable to an address" in {
|
||||
forAll(HDGenerators.hdChain, NumberGenerator.positiveInts) { (chain, i) =>
|
||||
val addr = chain.toAddress(i)
|
||||
assert(addr.chain == chain)
|
||||
}
|
||||
}
|
||||
|
||||
behavior of "HDAddress"
|
||||
|
||||
it must "fail to make addresses with neagtives indices" in {
|
||||
|
|
|
@ -20,6 +20,9 @@ sealed abstract class HDChain extends BIP32Path {
|
|||
|
||||
def toInt: Int = chainType.index
|
||||
|
||||
/** Given a index, creates a HD address */
|
||||
def toAddress(index: Int): HDAddress = HDAddress(this, index = index)
|
||||
|
||||
}
|
||||
|
||||
object HDChain {
|
||||
|
|
Loading…
Add table
Reference in a new issue