Skip to content

Commit

Permalink
feat(gtk): support create Ed25519 in gtk (#1489)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad authored Sep 4, 2024
1 parent 5752032 commit 1dc4092
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmd/gtk/dialog_wallet_create_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package main

import (
_ "embed"
"fmt"

"github.com/gotk3/gotk3/gtk"
"github.com/pactus-project/pactus/wallet"
Expand All @@ -21,7 +20,8 @@ func createAddress(ww *widgetWallet) {
addressLabel := getEntryObj(builder, "id_entry_account_label")

addressTypeCombo := getComboBoxTextObj(builder, "id_combo_address_type")
addressTypeCombo.Append(wallet.AddressTypeBLSAccount, "Account")
addressTypeCombo.Append(wallet.AddressTypeEd25519Account, "ED25519 Account")
addressTypeCombo.Append(wallet.AddressTypeBLSAccount, "BLS Account")
addressTypeCombo.Append(wallet.AddressTypeValidator, "Validator")

addressTypeCombo.SetActive(0)
Expand All @@ -36,12 +36,18 @@ func createAddress(ww *widgetWallet) {
walletAddressType := addressTypeCombo.GetActiveID()
fatalErrorCheck(err)

if walletAddressType == wallet.AddressTypeBLSAccount {
switch walletAddressType {
case wallet.AddressTypeEd25519Account:
password, ok := getWalletPassword(ww.model.wallet)
if !ok {
return
}

_, err = ww.model.wallet.NewEd25519AccountAddress(walletAddressLabel, password)
case wallet.AddressTypeBLSAccount:
_, err = ww.model.wallet.NewBLSAccountAddress(walletAddressLabel)
} else if walletAddressType == wallet.AddressTypeValidator {
case wallet.AddressTypeValidator:
_, err = ww.model.wallet.NewValidatorAddress(walletAddressLabel)
} else {
err = fmt.Errorf("invalid address type '%s'", walletAddressType)
}

errorCheck(err)
Expand Down

0 comments on commit 1dc4092

Please sign in to comment.