Skip to content

Commit

Permalink
Merge pull request #21 from provenance-io/totoro/wallet-signer-constr…
Browse files Browse the repository at this point in the history
…uctor

allow more precise handling of wallet signer prefix/path
  • Loading branch information
leeduan authored Feb 10, 2022
2 parents ca12afc + 885da8d commit 9e011b3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/kotlin/io/provenance/client/wallet/WalletSigner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ enum class NetworkType(
MAINNET("pb", "m/505'/1'/0'/0/0")
}

class WalletSigner(networkType: NetworkType, mnemonic: String, passphrase: String = "") : Signer {
class WalletSigner(prefix: String, path: String, mnemonic: String, passphrase: String = "") : Signer {

val wallet = Wallet.fromMnemonic(networkType.prefix, passphrase.toCharArray(), MnemonicWords.of(mnemonic))
constructor(networkType: NetworkType, mnemonic: String, passphrase: String = "") :
this(networkType.prefix, networkType.path, mnemonic, passphrase)

val account: Account = wallet[networkType.path]
val wallet = Wallet.fromMnemonic(prefix, passphrase.toCharArray(), MnemonicWords.of(mnemonic))

val account: Account = wallet[path]

override fun address(): String = account.address.value

Expand Down

0 comments on commit 9e011b3

Please sign in to comment.