refactor: methods for store/delete identity image added

This commit is contained in:
Sale Djenic 2022-02-01 10:51:08 +01:00 committed by saledjenic
parent 749fdd33c4
commit 2585f9418f
1 changed files with 8 additions and 15 deletions

View File

@ -262,18 +262,11 @@ proc verifyAccountPassword*(address: string, password: string, keystoreDir: stri
return false return false
proc generateAccount*(password, name, color: string): RpcResponse[JsonNode] {.raises: [Exception].} = proc storeIdentityImage*(keyUID: string, imagePath: string, aX, aY, bX, bY: int):
let payload = %* [hashPassword(password), name, color] RpcResponse[JsonNode] {.raises: [Exception].} =
return core.callPrivateRPC("accounts_generateAccount", payload) let payload = %* [keyUID, imagePath, aX, aY, bX, bY]
result = core.callPrivateRPC("multiaccounts_storeIdentityImage", payload)
proc addAccountWithMnemonic*(mnemonic, password, name, color: string): RpcResponse[JsonNode] {.raises: [Exception].} = proc deleteIdentityImage*(keyUID: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [mnemonic, hashPassword(password), name, color] let payload = %* [keyUID]
return core.callPrivateRPC("accounts_addAccountWithMnemonic", payload) result = core.callPrivateRPC("multiaccounts_deleteIdentityImage", payload)
proc addAccountWithPrivateKey*(privateKey, password, name, color: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [privateKey, hashPassword(password), name, color]
return core.callPrivateRPC("accounts_addAccountWithPrivateKey", payload)
proc addAccountWatch*(address, name, color: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [address, name, color]
return core.callPrivateRPC("accounts_addAccountWatch", payload)