diff --git a/nitro/wallet/wallet.nim b/nitro/wallet/wallet.nim index 9830b6b..7d24e22 100644 --- a/nitro/wallet/wallet.nim +++ b/nitro/wallet/wallet.nim @@ -25,8 +25,11 @@ type func init*(_: type Wallet, key: PrivateKey): Wallet = result.key = key +func publicKey*(wallet: Wallet): PublicKey = + wallet.key.toPublicKey + func address*(wallet: Wallet): EthAddress = - wallet.key.toPublicKey.toAddress + wallet.publicKey.toAddress func destination*(wallet: Wallet): Destination = wallet.address.toDestination diff --git a/tests/nitro/testWallet.nim b/tests/nitro/testWallet.nim index 55669ff..610facf 100644 --- a/tests/nitro/testWallet.nim +++ b/tests/nitro/testWallet.nim @@ -5,7 +5,9 @@ suite "wallet": test "wallet is created from private key": let key = PrivateKey.random() let wallet = Wallet.init(key) + check wallet.publicKey == key.toPublicKey check wallet.address == key.toPublicKey.toAddress + check wallet.destination == key.toPublicKey.toAddress.toDestination suite "wallet: opening ledger channel":