mirror of
https://github.com/logos-storage/nim-nitro.git
synced 2026-01-02 13:43:06 +00:00
Wallet exposes its public key
This commit is contained in:
parent
fbb95c42d9
commit
6d75ca5948
@ -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
|
||||
|
||||
@ -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":
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user