Add a command for locking account

parent 2b5cda9d
......@@ -13,6 +13,7 @@ Use one of the following commands:
```sh
./wallet get_account <address>
./walet extend_account <from_address> <to_address> <valid_until>
./wallet lock_account <address> <locked_until>
./wallet gen_keypair
./wallet current_height
./wallet send <from_address> <to_address> <amount> <message>
......
......@@ -50,6 +50,12 @@ handle_command("extend_account", [FromHex, ToHex, ValidUntilString]) ->
ToSign = <<1, ValidUntil:4/unit:8, From/binary, To/binary>>,
TxHex = binary_to_hex(sign(ToSign, From)),
submit_tx(TxHex);
handle_command("lock_account", [FromHex, LockedUntilString]) ->
From = hex_to_binary(FromHex),
LockedUntil = list_to_integer(LockedUntilString),
ToSign = <<2, LockedUntil:4/unit:8, From/binary>>,
TxHex = binary_to_hex(sign(ToSign, From)),
submit_tx(TxHex);
handle_command("gen_keypair", []) ->
{PK, SK} = libsodium_crypto_sign_ed25519:keypair(),
[binary_to_hex(PK), $ , binary_to_hex(SK)];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment