@@ -32,6 +32,7 @@ import com.blockstream.gdk.params.SubAccountParams
3232import com.blockstream.gdk.params.SubAccountsParams
3333import com.blockstream.gdk.params.TransactionParams
3434import com.blockstream.gdk.params.UpdateSubAccountParams
35+ import com.blockstream.gdk.params.ValidateAddresseesParams
3536import com.blockstream.libgreenaddress.GAAuthHandler
3637import com.blockstream.libgreenaddress.GASession
3738import com.blockstream.libgreenaddress.GDK
@@ -60,9 +61,6 @@ class GdkBridge constructor(
6061 isDevelopment : Boolean ,
6162 extraLogger : Logger ? = null
6263) {
63-
64- private val bip39WordList by lazy { wally.bip39Wordlist(BIP39_WORD_LIST_LANG ) }
65-
6664 val networks by lazy {
6765 val jsonElement = gdk.getNetworks() as JsonElement
6866 Networks .fromJsonElement(JsonDeserializer , jsonElement)
@@ -91,6 +89,8 @@ class GdkBridge constructor(
9189 }
9290 }
9391
92+ val breezSdkWorkingDir by lazy { File (dataDir, " breezSdk" ) }
93+
9494 private fun randomBytes (len : Int ): ByteArray {
9595 return ByteArray (len).also {
9696 SecureRandom ().nextBytes(it)
@@ -174,6 +174,11 @@ class GdkBridge constructor(
174174 params : JsonElement
175175 ) = gdk.validate(session, params)
176176
177+ fun validate (
178+ session : GASession ,
179+ params : ValidateAddresseesParams
180+ ) = gdk.validate(session, params)
181+
177182 fun encryptWithPin (
178183 session : GASession ,
179184 encryptWithPinParams : EncryptWithPinParams
@@ -321,16 +326,15 @@ class GdkBridge constructor(
321326
322327 fun getMnemonicWordList (): List <String > {
323328 val wordList = mutableListOf<String >()
324- val enWords = bip39WordList
325329 for (i in 0 until wally.BIP39_WORDLIST_LEN ) {
326- wordList + = wally.bip39Word(enWords, i)
330+ wordList + = wally.bip39Word(i)
327331 }
328332
329333 return wordList
330334 }
331335
332336 fun isMnemonicValid (mnemonic : String ): Boolean {
333- return wally.bip39MnemonicValidate(bip39WordList, mnemonic)
337+ return wally.bip39MnemonicValidate(mnemonic)
334338 }
335339
336340 fun isXpubValid (xpub : String ): Boolean {
@@ -352,6 +356,10 @@ class GdkBridge constructor(
352356 }
353357 }
354358
359+ fun bip85FromMnemonic (mnemonic : String , passphrase : String? , index : Long = 0, isTestnet : Boolean = false): String {
360+ return wally.bip85FromMnemonic(mnemonic = mnemonic, passphrase = passphrase, isTestnet = isTestnet, index = index)
361+ }
362+
355363 fun hasGdkCache (loginData : LoginData ): Boolean {
356364 return File (dataDir, " state/${loginData.networkHashId} " ).exists()
357365 }
@@ -373,8 +381,6 @@ class GdkBridge constructor(
373381 isLenient = true
374382 }
375383
376- const val BIP39_WORD_LIST_LANG = " en"
377-
378384 const val KEY_CUSTOM_NETWORK = " custom_network"
379385
380386 // val FeeBlockTarget = listOf(3, 12, 24) // Old calculations
0 commit comments