mirror of https://github.com/status-im/nim-abc.git
Wallet signs acks
This commit is contained in:
parent
34254152b3
commit
84645a1208
|
@ -1,8 +1,10 @@
|
|||
import ./keys
|
||||
import ./transactions
|
||||
import ./acks
|
||||
|
||||
export keys
|
||||
export transactions
|
||||
export acks
|
||||
|
||||
type
|
||||
Wallet* = object
|
||||
|
@ -16,3 +18,6 @@ func id*(wallet: Wallet): PublicKey =
|
|||
|
||||
func sign*(wallet: Wallet, transaction: var Transaction) =
|
||||
wallet.key.sign(transaction)
|
||||
|
||||
func sign*(wallet: Wallet, ack: var Ack) =
|
||||
wallet.key.sign(ack)
|
||||
|
|
|
@ -16,3 +16,9 @@ suite "Wallets":
|
|||
check transaction.signature == Signature.default
|
||||
wallet.sign(transaction)
|
||||
check transaction.signature == key.sign(transaction.hash.toBytes)
|
||||
|
||||
test "wallet can sign acknowledgment":
|
||||
var ack = Ack.example
|
||||
check ack.signature.isNone
|
||||
wallet.sign(ack)
|
||||
check ack.signature == key.sign(ack.hash.toBytes).some
|
||||
|
|
Loading…
Reference in New Issue