mirror of
https://github.com/status-im/status-lib.git
synced 2025-01-31 06:36:19 +00:00
b9e1c230ca
* added new backend for refactoring purpose, contacts added * initial chat class added * initial community class added * initial accounts class added * login method added * Refactor/wallet 1 (#89) * refactor: add custom token new backend * refactor: add transactions new backend * refactor: add collectible new backend * refactor: add accounts backend * refactor: add settings backend * refactor: Add eth call to fetch balance * refactor: add call to get eth block * refactor: remove bookmarks (#90) * refactor: dapp permissions (#92) * Refactor/wallet part 2 (#91) * refactor: add save account * refactor: add account generation * refactor: save settings * refactor: add update account in new be * add getTransfersByAddress (#93) Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com> * initial messages class added * fix: transaction request loading contracts (#96) * add/remove reactions added * - pin/unpin message added - fetch message's details by message id added - fetch reactions for message with id added * bump status-go Co-authored-by: Anthony Laibe <anthony@laibe.cc> Co-authored-by: Richard Ramos <info@richardramos.me> Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com> Co-authored-by: Iuri Matias <iuri.matias@gmail.com>
41 lines
1.3 KiB
Nim
41 lines
1.3 KiB
Nim
import json, strmisc
|
|
import core, utils
|
|
import response_type
|
|
|
|
export response_type
|
|
|
|
proc getContacts*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
let payload = %* []
|
|
result = callPrivateRPC("contacts".prefix, payload)
|
|
|
|
proc getContactById*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
let payload = %* [id]
|
|
result = callPrivateRPC("getContactByID".prefix, payload)
|
|
|
|
proc saveContact*(id: string, ensVerified: bool, ensName: string, alias: string,
|
|
identicon: string, thumbnail: string, largeImage: string, added: bool,
|
|
blocked: bool, hasAddedUs: bool, localNickname: string)
|
|
{.raises: [Exception].} =
|
|
let payload = %* [{
|
|
"id": id,
|
|
"name": ensName,
|
|
"ensVerified": ensVerified,
|
|
"alias": alias,
|
|
"identicon": identicon,
|
|
"images": {
|
|
"thumbnail": {"Payload": thumbnail.partition(",")[2]},
|
|
"large": {"Payload": largeImage.partition(",")[2]}
|
|
},
|
|
"added": added,
|
|
"blocked": blocked,
|
|
"hasAddedUs": hasAddedUs,
|
|
"localNickname": localNickname
|
|
}]
|
|
|
|
discard callPrivateRPC("saveContact".prefix, payload)
|
|
|
|
proc sendContactUpdate*(publicKey, ensName, thumbnail: string)
|
|
{.raises: [Exception].} =
|
|
let payload = %* [publicKey, ensName, thumbnail]
|
|
discard callPrivateRPC("sendContactUpdate".prefix, payload)
|
|
|