mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 09:52:09 +01:00
Add toAddress on HDChain
This commit is contained in:
parent
4435d942d9
commit
75bf52a431
@ -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…
Reference in New Issue
Block a user