diff --git a/src/backend/about.nim b/src/backend/about.nim index 8e2f09fd77..206dece635 100644 --- a/src/backend/about.nim +++ b/src/backend/about.nim @@ -4,6 +4,6 @@ import response_type export response_type -proc checkForUpdates*(chainId: int, ensAddress: string, currVersion: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc checkForUpdates*(chainId: int, ensAddress: string, currVersion: string): RpcResponse[JsonNode] = let payload = %* [chainId, ensAddress, currVersion] result = callPrivateRPC("updates_check", payload) diff --git a/src/backend/accounts.nim b/src/backend/accounts.nim index 4c75ab26d0..f5e4943614 100644 --- a/src/backend/accounts.nim +++ b/src/backend/accounts.nim @@ -19,30 +19,30 @@ const SEED* = "seed" const KEY* = "key" const WATCH* = "watch" -proc getAccounts*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getAccounts*(): RpcResponse[JsonNode] = return core.callPrivateRPC("accounts_getAccounts") -proc getWatchOnlyAccounts*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getWatchOnlyAccounts*(): RpcResponse[JsonNode] = return core.callPrivateRPC("accounts_getWatchOnlyAccounts") -proc getKeypairs*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getKeypairs*(): RpcResponse[JsonNode] = return core.callPrivateRPC("accounts_getKeypairs") -proc getKeypairByKeyUid*(keyUid: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getKeypairByKeyUid*(keyUid: string): RpcResponse[JsonNode] = let payload = %* [keyUid] return core.callPrivateRPC("accounts_getKeypairByKeyUID", payload) -proc deleteAccount*(address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deleteAccount*(address: string): RpcResponse[JsonNode] = let payload = %* [address] return core.callPrivateRPC("accounts_deleteAccount", payload) -proc deleteKeypair*(keyUid: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deleteKeypair*(keyUid: string): RpcResponse[JsonNode] = let payload = %* [keyUid] return core.callPrivateRPC("accounts_deleteKeypair", payload) ## Adds a new account and creates a Keystore file if password is provided, otherwise it only creates a new account. Notifies paired devices. proc addAccount*(password, name, address, path, publicKey, keyUid, accountType, colorId, emoji: string, hideFromTotalBalance: bool): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [ password, { @@ -65,7 +65,7 @@ proc addAccount*(password, name, address, path, publicKey, keyUid, accountType, ## Adds a new keypair and creates a Keystore file if password is provided, otherwise it only creates a new keypair. Notifies paired devices. proc addKeypair*(password, keyUid, keypairName, keypairType, rootWalletMasterKey: string, accounts: seq[WalletAccountDto]): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = var kpJson = %* { "key-uid": keyUid, "name": keypairName, @@ -101,13 +101,13 @@ proc addKeypair*(password, keyUid, keypairName, keypairType, rootWalletMasterKey ## Adds a new account without creating a Keystore file and notifies paired devices proc addAccountWithoutKeystoreFileCreation*(name, address, path, publicKey, keyUid, accountType, colorId, emoji: string, hideFromTotalBalance: bool): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = return addAccount(password = "", name, address, path, publicKey, keyUid, accountType, colorId, emoji, hideFromTotalBalance) ## Updates either regular or keycard account, without interaction to a Keystore file and notifies paired devices proc updateAccount*(name, address, path: string, publicKey, keyUid, accountType, colorId, emoji: string, walletDefaultAccount: bool, chatDefaultAccount: bool, prodPreferredChainIds, testPreferredChainIds: string, hideFromTotalBalance: bool): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [ { "address": address, @@ -129,7 +129,7 @@ proc updateAccount*(name, address, path: string, publicKey, keyUid, accountType, ] return core.callPrivateRPC("accounts_saveAccount", payload) -proc generateAddresses*(paths: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc generateAddresses*(paths: seq[string]): RpcResponse[JsonNode] = let payload = %* { "n": NUMBER_OF_ADDRESSES_TO_GENERATE, "mnemonicPhraseLength": MNEMONIC_PHRASE_LENGTH, @@ -200,7 +200,7 @@ proc compressPk*(publicKey: string): RpcResponse[string] = except JsonParsingError as e: result.result = response -proc generateAlias*(publicKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc generateAlias*(publicKey: string): RpcResponse[JsonNode] = try: let response = status_go.generateAlias(publicKey) result.result = %* response @@ -214,11 +214,11 @@ proc isAlias*(value: string): bool = let r = Json.decode(response, JsonNode) return r["result"].getBool() -proc getRandomMnemonic*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getRandomMnemonic*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("accounts_getRandomMnemonic", payload) -proc multiAccountImportMnemonic*(mnemonic: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc multiAccountImportMnemonic*(mnemonic: string): RpcResponse[JsonNode] = let payload = %* { "mnemonicPhrase": mnemonic, "Bip39Passphrase": "" @@ -234,26 +234,26 @@ proc multiAccountImportMnemonic*(mnemonic: string): RpcResponse[JsonNode] {.rais ## Imports a new mnemonic and creates local keystore file. proc importMnemonic*(mnemonic, password: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [mnemonic, password] return core.callPrivateRPC("accounts_importMnemonic", payload) proc makeSeedPhraseKeypairFullyOperable*(mnemonic, password: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [mnemonic, password] return core.callPrivateRPC("accounts_makeSeedPhraseKeypairFullyOperable", payload) proc makePartiallyOperableAccoutsFullyOperable*(password: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [password] return core.callPrivateRPC("accounts_makePartiallyOperableAccoutsFullyOperable", payload) proc migrateNonProfileKeycardKeypairToApp*(mnemonic: string, password: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [mnemonic, password] return core.callPrivateRPC("accounts_migrateNonProfileKeycardKeypairToApp", payload) -proc createAccountFromMnemonicAndDeriveAccountsForPaths*(mnemonic: string, paths: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createAccountFromMnemonicAndDeriveAccountsForPaths*(mnemonic: string, paths: seq[string]): RpcResponse[JsonNode] = let payload = %* { "mnemonicPhrase": mnemonic, "paths": paths, @@ -269,16 +269,16 @@ proc createAccountFromMnemonicAndDeriveAccountsForPaths*(mnemonic: string, paths ## Imports a new private key and creates local keystore file. proc importPrivateKey*(privateKey, password: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [privateKey, password] return core.callPrivateRPC("accounts_importPrivateKey", payload) proc makePrivateKeyKeypairFullyOperable*(privateKey, password: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [privateKey, password] return core.callPrivateRPC("accounts_makePrivateKeyKeypairFullyOperable", payload) -proc createAccountFromPrivateKey*(privateKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createAccountFromPrivateKey*(privateKey: string): RpcResponse[JsonNode] = let payload = %* {"privateKey": privateKey} try: let response = status_go.createAccountFromPrivateKey($payload) @@ -287,7 +287,7 @@ proc createAccountFromPrivateKey*(privateKey: string): RpcResponse[JsonNode] {.r error "error doing rpc request", methodName = "createAccountFromPrivateKey", exception=e.msg raise newException(RpcException, e.msg) -proc deriveAccounts*(accountId: string, paths: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deriveAccounts*(accountId: string, paths: seq[string]): RpcResponse[JsonNode] = let payload = %* { "accountID": accountId, "paths": paths @@ -301,7 +301,7 @@ proc deriveAccounts*(accountId: string, paths: seq[string]): RpcResponse[JsonNod error "error doing rpc request", methodName = "deriveAccounts", exception=e.msg raise newException(RpcException, e.msg) -proc openedAccounts*(path: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc openedAccounts*(path: string): RpcResponse[JsonNode] = try: let response = status_go.openAccounts(path) result.result = Json.decode(response, JsonNode) @@ -311,7 +311,7 @@ proc openedAccounts*(path: string): RpcResponse[JsonNode] {.raises: [Exception]. raise newException(RpcException, e.msg) proc storeDerivedAccounts*(id, hashedPassword: string, paths: seq[string]): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* { "accountID": id, "paths": paths, @@ -326,7 +326,7 @@ proc storeDerivedAccounts*(id, hashedPassword: string, paths: seq[string]): error "error doing rpc request", methodName = "storeDerivedAccounts", exception=e.msg raise newException(RpcException, e.msg) -proc storeAccounts*(id, hashedPassword: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc storeAccounts*(id, hashedPassword: string): RpcResponse[JsonNode] = let payload = %* { "accountID": id, "password": hashedPassword @@ -340,7 +340,7 @@ proc storeAccounts*(id, hashedPassword: string): RpcResponse[JsonNode] {.raises: error "error doing rpc request", methodName = "storeAccounts", exception=e.msg raise newException(RpcException, e.msg) -proc addPeer*(peer: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addPeer*(peer: string): RpcResponse[JsonNode] = try: let response = status_go.addPeer(peer) result.result = %* response @@ -350,7 +350,7 @@ proc addPeer*(peer: string): RpcResponse[JsonNode] {.raises: [Exception].} = raise newException(RpcException, e.msg) proc saveAccountAndLogin*(hashedPassword: string, account, subaccounts, settings, - config: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = + config: JsonNode): RpcResponse[JsonNode] = try: let response = status_go.saveAccountAndLogin($account, hashedPassword, $settings, $config, $subaccounts) @@ -361,7 +361,7 @@ proc saveAccountAndLogin*(hashedPassword: string, account, subaccounts, settings raise newException(RpcException, e.msg) proc saveAccountAndLoginWithKeycard*(chatKey, password: string, account, subaccounts, settings, config: JsonNode): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = try: let response = status_go.saveAccountAndLoginWithKeycard($account, password, $settings, $config, $subaccounts, chatKey) result.result = Json.decode(response, JsonNode) @@ -371,7 +371,7 @@ proc saveAccountAndLoginWithKeycard*(chatKey, password: string, account, subacco raise newException(RpcException, e.msg) proc convertRegularProfileKeypairToKeycard*(account: JsonNode, settings: JsonNode, keycardUid: string, password: string, newPassword: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = try: let response = status_go.convertToKeycardAccount($account, $settings, keycardUid, password, newPassword) result.result = Json.decode(response, JsonNode) @@ -380,7 +380,7 @@ proc convertRegularProfileKeypairToKeycard*(account: JsonNode, settings: JsonNod raise newException(RpcException, e.msg) proc convertKeycardProfileKeypairToRegular*(mnemonic: string, currPassword: string, newPassword: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = try: let response = status_go.convertToRegularAccount(mnemonic, currPassword, newPassword) result.result = Json.decode(response, JsonNode) @@ -390,7 +390,7 @@ proc convertKeycardProfileKeypairToRegular*(mnemonic: string, currPassword: stri proc login*(name, keyUid: string, kdfIterations: int, hashedPassword, thumbnail, large: string, nodeCfgObj: string): RpcResponse[JsonNode] - {.raises: [Exception].} = + = try: var payload = %* { "name": name, @@ -409,7 +409,7 @@ proc login*(name, keyUid: string, kdfIterations: int, hashedPassword, thumbnail, error "error doing rpc request", methodName = "login", exception=e.msg raise newException(RpcException, e.msg) -proc loginWithKeycard*(chatKey, password: string, account, confNode: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = +proc loginWithKeycard*(chatKey, password: string, account, confNode: JsonNode): RpcResponse[JsonNode] = try: let response = status_go.loginWithKeycard($account, password, chatKey, $confNode) result.result = Json.decode(response, JsonNode) @@ -418,7 +418,7 @@ proc loginWithKeycard*(chatKey, password: string, account, confNode: JsonNode): raise newException(RpcException, e.msg) proc verifyAccountPassword*(address: string, hashedPassword: string, keystoreDir: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = try: let response = status_go.verifyAccountPassword(keystoreDir, address, hashedPassword) result.result = Json.decode(response, JsonNode) @@ -428,7 +428,7 @@ proc verifyAccountPassword*(address: string, hashedPassword: string, keystoreDir raise newException(RpcException, e.msg) proc verifyDatabasePassword*(keyuid: string, hashedPassword: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = try: let response = status_go.verifyDatabasePassword(keyuid, hashedPassword) result.result = Json.decode(response, JsonNode) @@ -438,64 +438,64 @@ proc verifyDatabasePassword*(keyuid: string, hashedPassword: string): raise newException(RpcException, e.msg) proc storeIdentityImage*(keyUID: string, imagePath: string, aX, aY, bX, bY: int): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [keyUID, imagePath, aX, aY, bX, bY] result = core.callPrivateRPC("multiaccounts_storeIdentityImage", payload) -proc deleteIdentityImage*(keyUID: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deleteIdentityImage*(keyUID: string): RpcResponse[JsonNode] = let payload = %* [keyUID] result = core.callPrivateRPC("multiaccounts_deleteIdentityImage", payload) -proc setDisplayName*(displayName: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setDisplayName*(displayName: string): RpcResponse[JsonNode] = let payload = %* [displayName] result = core.callPrivateRPC("setDisplayName".prefix, payload) -proc getDerivedAddresses*(password: string, derivedFrom: string, paths: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getDerivedAddresses*(password: string, derivedFrom: string, paths: seq[string]): RpcResponse[JsonNode] = let payload = %* [password, derivedFrom, paths] result = core.callPrivateRPC("wallet_getDerivedAddresses", payload) -proc getDerivedAddressesForMnemonic*(mnemonic: string, paths: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getDerivedAddressesForMnemonic*(mnemonic: string, paths: seq[string]): RpcResponse[JsonNode] = let payload = %* [mnemonic, paths] result = core.callPrivateRPC("wallet_getDerivedAddressesForMnemonic", payload) -proc getAddressDetails*(chainId: int, address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getAddressDetails*(chainId: int, address: string): RpcResponse[JsonNode] = let payload = %* [chainId, address] result = core.callPrivateRPC("wallet_getAddressDetails", payload) -proc addressExists*(address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addressExists*(address: string): RpcResponse[JsonNode] = let payload = %* [address] result = core.callPrivateRPC("wallet_addressExists", payload) -proc verifyPassword*(password: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc verifyPassword*(password: string): RpcResponse[JsonNode] = let payload = %* [password] return core.callPrivateRPC("accounts_verifyPassword", payload) -proc verifyKeystoreFileForAccount*(address, password: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc verifyKeystoreFileForAccount*(address, password: string): RpcResponse[JsonNode] = let payload = %* [address, password] return core.callPrivateRPC("accounts_verifyKeystoreFileForAccount", payload) -proc getProfileShowcaseForContact*(contactId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getProfileShowcaseForContact*(contactId: string): RpcResponse[JsonNode] = let payload = %* [contactId] result = callPrivateRPC("getProfileShowcaseForContact".prefix, payload) -proc getProfileShowcaseAccountsByAddress*(address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getProfileShowcaseAccountsByAddress*(address: string): RpcResponse[JsonNode] = let payload = %* [address] result = callPrivateRPC("getProfileShowcaseAccountsByAddress".prefix, payload) -proc getProfileShowcasePreferences*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getProfileShowcasePreferences*(): RpcResponse[JsonNode] = result = callPrivateRPC("getProfileShowcasePreferences".prefix, %*[]) -proc setProfileShowcasePreferences*(preferences: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setProfileShowcasePreferences*(preferences: JsonNode): RpcResponse[JsonNode] = result = callPrivateRPC("setProfileShowcasePreferences".prefix, preferences) -proc getProfileShowcaseSocialLinksLimit*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getProfileShowcaseSocialLinksLimit*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("getProfileShowcaseSocialLinksLimit".prefix, payload) -proc getProfileShowcaseEntriesLimit*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getProfileShowcaseEntriesLimit*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("getProfileShowcaseEntriesLimit".prefix, payload) -proc addressWasShown*(address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addressWasShown*(address: string): RpcResponse[JsonNode] = let payload = %* [address] return core.callPrivateRPC("accounts_addressWasShown", payload) \ No newline at end of file diff --git a/src/backend/browser.nim b/src/backend/browser.nim index ad64a711ea..8d1ee55d7d 100644 --- a/src/backend/browser.nim +++ b/src/backend/browser.nim @@ -6,7 +6,7 @@ import ./backend export response_type -proc addBookmark*(bookmark: backend.Bookmark): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addBookmark*(bookmark: backend.Bookmark): RpcResponse[JsonNode] = result = callPrivateRPC("addBookmark".prefix, %*[{ "url": bookmark.url, "name": bookmark.name, @@ -15,10 +15,10 @@ proc addBookmark*(bookmark: backend.Bookmark): RpcResponse[JsonNode] {.raises: [ "deletedAt": bookmark.deletedAt }]) -proc removeBookmark*(url: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeBookmark*(url: string): RpcResponse[JsonNode] = result = callPrivateRPC("removeBookmark".prefix, %*[url]) -proc updateBookmark*(oldUrl: string, bookmark: backend.Bookmark): RpcResponse[JsonNode] {.raises: [Exception].} = +proc updateBookmark*(oldUrl: string, bookmark: backend.Bookmark): RpcResponse[JsonNode] = result = callPrivateRPC("updateBookmark".prefix, %*[oldUrl, { "url": bookmark.url, "name": bookmark.name, diff --git a/src/backend/chat.nim b/src/backend/chat.nim index e6586d228f..a61a94b5b7 100644 --- a/src/backend/chat.nim +++ b/src/backend/chat.nim @@ -16,7 +16,7 @@ proc saveChat*( ensName: string = "", profile: string = "", joined: int64 = 0 - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = # TODO: ideally status-go/stimbus should handle some of these fields instead of having the client # send them: lastMessage, unviewedMEssagesCount, timestamp, lastClockValue, name? return callPrivateRPC("saveChat".prefix, %* [ @@ -35,26 +35,26 @@ proc saveChat*( } ]) -proc getChannelGroups*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getChannelGroups*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("chat_getChannelGroups", payload) -proc getChannelGroupById*(channelGroupId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getChannelGroupById*(channelGroupId: string): RpcResponse[JsonNode] = let payload = %* [channelGroupId] result = callPrivateRPC("chat_getChannelGroupByID", payload) -proc createOneToOneChat*(chatId: string, ensName: string = ""): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createOneToOneChat*(chatId: string, ensName: string = ""): RpcResponse[JsonNode] = let communityId = "" let payload = %* [communityId, chatId, ensName] result = callPrivateRPC("chat_createOneToOneChat", payload) -proc leaveGroupChat*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc leaveGroupChat*(chatId: string): RpcResponse[JsonNode] = result = callPrivateRPC("leaveGroupChat".prefix, %* [nil, chatId, true]) -proc deactivateChat*(chatId: string, preserveHistory: bool = false): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deactivateChat*(chatId: string, preserveHistory: bool = false): RpcResponse[JsonNode] = callPrivateRPC("deactivateChat".prefix, %* [{ "ID": chatId, "preserveHistory": preserveHistory }]) -proc clearChatHistory*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc clearChatHistory*(chatId: string): RpcResponse[JsonNode] = callPrivateRPC("clearHistory".prefix, %* [{ "id": chatId }]) proc sendChatMessage*( @@ -67,7 +67,7 @@ proc sendChatMessage*( communityId: string = "", stickerHash: string = "", stickerPack: string = "0", - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = let (standardLinkPreviews, statusLinkPreviews) = extractLinkPreviewsLists(linkPreviews) result = callPrivateRPC("sendChatMessage".prefix, %* [ { @@ -92,7 +92,7 @@ proc sendImages*(chatId: string, replyTo: string, preferredUsername: string, linkPreviews: seq[LinkPreview], - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = let imagesJson = %* images.map(image => %* { "chatId": chatId, @@ -106,7 +106,7 @@ proc sendImages*(chatId: string, ) callPrivateRPC("sendChatMessages".prefix, %* [imagesJson]) -proc muteChat*(chatId: string, interval: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc muteChat*(chatId: string, interval: int): RpcResponse[JsonNode] = result = callPrivateRPC("muteChatV2".prefix, %* [ { "chatId": chatId, @@ -114,42 +114,42 @@ proc muteChat*(chatId: string, interval: int): RpcResponse[JsonNode] {.raises: [ } ]) -proc unmuteChat*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc unmuteChat*(chatId: string): RpcResponse[JsonNode] = let payload = %* [chatId] result = callPrivateRPC("unmuteChat".prefix, payload) -proc deleteMessagesByChatId*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deleteMessagesByChatId*(chatId: string): RpcResponse[JsonNode] = let payload = %* [chatId] result = callPrivateRPC("deleteMessagesByChatID".prefix, payload) -proc addGroupMembers*(communityID: string, chatId: string, pubKeys: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addGroupMembers*(communityID: string, chatId: string, pubKeys: seq[string]): RpcResponse[JsonNode] = let payload = %* [nil, communityID, chatId, pubKeys] result = callPrivateRPC("addMembersToGroupChat".prefix, payload) -proc removeMemberFromGroupChat*(communityID: string, chatId: string, pubKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeMemberFromGroupChat*(communityID: string, chatId: string, pubKey: string): RpcResponse[JsonNode] = let payload = %* [nil, communityID, chatId, pubKey] result = callPrivateRPC("removeMemberFromGroupChat".prefix, payload) -proc renameGroupChat*(communityID: string, chatId: string, newName: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc renameGroupChat*(communityID: string, chatId: string, newName: string): RpcResponse[JsonNode] = let payload = %* [nil, communityID, chatId, newName] result = callPrivateRPC("changeGroupChatName".prefix, payload) -proc makeAdmin*(communityID: string, chatId: string, pubKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc makeAdmin*(communityID: string, chatId: string, pubKey: string): RpcResponse[JsonNode] = let payload = %* [nil, communityID, chatId, [pubKey]] result = callPrivateRPC("addAdminsToGroupChat".prefix, payload) -proc createGroupChat*(communityID: string, groupName: string, pubKeys: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createGroupChat*(communityID: string, groupName: string, pubKeys: seq[string]): RpcResponse[JsonNode] = let payload = %* [nil, communityID, groupName, pubKeys] result = callPrivateRPC("createGroupChatWithMembers".prefix, payload) -proc createGroupChatFromInvitation*(groupName: string, chatId: string, adminPK: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createGroupChatFromInvitation*(groupName: string, chatId: string, adminPK: string): RpcResponse[JsonNode] = let payload = %* [groupName, chatId, adminPK] result = callPrivateRPC("createGroupChatFromInvitation".prefix, payload) -proc getMembers*(communityId, chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getMembers*(communityId, chatId: string): RpcResponse[JsonNode] = result = callPrivateRPC("chat_getMembers", %* [communityId, chatId]) -proc editChat*(communityID: string, chatID: string, name: string, color: string, imageJson: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc editChat*(communityID: string, chatID: string, name: string, color: string, imageJson: string): RpcResponse[JsonNode] = let croppedImage = newCroppedImage(imageJson) let payload = %* [communityID, chatID, name, color, croppedImage] return core.callPrivateRPC("chat_editChat", payload) diff --git a/src/backend/chatCommands.nim b/src/backend/chatCommands.nim index 56b3de2b25..23366dea1e 100644 --- a/src/backend/chatCommands.nim +++ b/src/backend/chatCommands.nim @@ -2,20 +2,20 @@ import json import core, ../app_service/common/utils import response_type -proc acceptRequestAddressForTransaction*(messageId: string, address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc acceptRequestAddressForTransaction*(messageId: string, address: string): RpcResponse[JsonNode] = callPrivateRPC("acceptRequestAddressForTransaction".prefix, %* [messageId, address]) -proc declineRequestAddressForTransaction*(messageId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc declineRequestAddressForTransaction*(messageId: string): RpcResponse[JsonNode] = callPrivateRPC("declineRequestAddressForTransaction".prefix, %* [messageId]) -proc declineRequestTransaction*(messageId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc declineRequestTransaction*(messageId: string): RpcResponse[JsonNode] = callPrivateRPC("declineRequestTransaction".prefix, %* [messageId]) -proc requestAddressForTransaction*(chatId: string, fromAddress: string, amount: string, tokenAddress: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestAddressForTransaction*(chatId: string, fromAddress: string, amount: string, tokenAddress: string): RpcResponse[JsonNode] = callPrivateRPC("requestAddressForTransaction".prefix, %* [chatId, fromAddress, amount, tokenAddress]) -proc requestTransaction*(chatId: string, fromAddress: string, amount: string, tokenAddress: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestTransaction*(chatId: string, fromAddress: string, amount: string, tokenAddress: string): RpcResponse[JsonNode] = callPrivateRPC("requestTransaction".prefix, %* [chatId, amount, tokenAddress, fromAddress]) -proc acceptRequestTransaction*(transactionHash: string, messageId: string, signature: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc acceptRequestTransaction*(transactionHash: string, messageId: string, signature: string): RpcResponse[JsonNode] = callPrivateRPC("acceptRequestTransaction".prefix, %* [transactionHash, messageId, signature]) diff --git a/src/backend/communities.nim b/src/backend/communities.nim index 042e3b2d2d..3368c6214b 100644 --- a/src/backend/communities.nim +++ b/src/backend/communities.nim @@ -7,10 +7,10 @@ import interpret/cropped_image export response_type -proc getCommunityTags*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getCommunityTags*(): RpcResponse[JsonNode] = result = callPrivateRPC("communityTags".prefix) -proc muteCategory*(communityId: string, categoryId: string, interval: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc muteCategory*(communityId: string, categoryId: string, interval: int): RpcResponse[JsonNode] = result = callPrivateRPC("muteCommunityCategory".prefix, %* [ { "communityId": communityId, @@ -19,27 +19,27 @@ proc muteCategory*(communityId: string, categoryId: string, interval: int): RpcR } ]) -proc unmuteCategory*(communityId: string, categoryId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc unmuteCategory*(communityId: string, categoryId: string): RpcResponse[JsonNode] = result = callPrivateRPC("unmuteCommunityCategory".prefix, %* [communityId, categoryId]) -proc getCuratedCommunities*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getCuratedCommunities*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("curatedCommunities".prefix, payload) -proc getAllCommunities*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getAllCommunities*(): RpcResponse[JsonNode] = result = callPrivateRPC("communities".prefix) -proc isDisplayNameDupeOfCommunityMember*(displayName: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc isDisplayNameDupeOfCommunityMember*(displayName: string): RpcResponse[JsonNode] = result = callPrivateRPC("isDisplayNameDupeOfCommunityMember".prefix, %* [displayName]) -proc spectateCommunity*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc spectateCommunity*(communityId: string): RpcResponse[JsonNode] = result = callPrivateRPC("spectateCommunity".prefix, %*[communityId]) proc generateJoiningCommunityRequestsForSigning*( memberPubKey: string, communityId: string, addressesToReveal: seq[string] - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = let payload = %*[memberPubKey, communityId, addressesToReveal] result = callPrivateRPC("generateJoiningCommunityRequestsForSigning".prefix, payload) @@ -47,12 +47,12 @@ proc generateEditCommunityRequestsForSigning*( memberPubKey: string, communityId: string, addressesToReveal: seq[string] - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = let payload = %*[memberPubKey, communityId, addressesToReveal] result = callPrivateRPC("generateEditCommunityRequestsForSigning".prefix, payload) ## `signParams` represents a json array of SignParamsDto. -proc signData*(signParams: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = +proc signData*(signParams: JsonNode): RpcResponse[JsonNode] = if signParams.kind != JArray: raise newException(Exception, "signParams must be an array") let payload = %*[signParams] @@ -64,7 +64,7 @@ proc requestToJoinCommunity*( addressesToShare: seq[string], signatures: seq[string], airdropAddress: string, - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("requestToJoinCommunity".prefix, %*[{ "communityId": communityId, "ensName": ensName, @@ -78,7 +78,7 @@ proc editSharedAddresses*( addressesToShare: seq[string], signatures: seq[string], airdropAddress: string, - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("editSharedAddressesForCommunity".prefix, %*[{ "communityId": communityId, "addressesToReveal": addressesToShare, @@ -89,15 +89,15 @@ proc editSharedAddresses*( proc getRevealedAccountsForMember*( communityId: string, memberPubkey: string, - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("getRevealedAccounts".prefix, %*[communityId, memberPubkey]) proc getRevealedAccountsForAllMembers*( communityId: string, - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("getRevealedAccountsForAllMembers".prefix, %*[communityId]) -proc checkPermissionsToJoinCommunity*(communityId: string, addresses: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc checkPermissionsToJoinCommunity*(communityId: string, addresses: seq[string]): RpcResponse[JsonNode] = result = callPrivateRPC("checkPermissionsToJoinCommunity".prefix, %*[{ "communityId": communityId, "addresses": addresses @@ -105,32 +105,32 @@ proc checkPermissionsToJoinCommunity*(communityId: string, addresses: seq[string proc reevaluateCommunityMembersPermissions*( communityId: string, - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("reevaluateCommunityMembersPermissions".prefix, %*[{ "communityId": communityId }]) -proc checkCommunityChannelPermissions*(communityId: string, chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc checkCommunityChannelPermissions*(communityId: string, chatId: string): RpcResponse[JsonNode] = result = callPrivateRPC("checkCommunityChannelPermissions".prefix, %*[{ "communityId": communityId, "chatId": chatId }]) -proc checkAllCommunityChannelsPermissions*(communityId: string, addresses: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc checkAllCommunityChannelsPermissions*(communityId: string, addresses: seq[string]): RpcResponse[JsonNode] = result = callPrivateRPC("checkAllCommunityChannelsPermissions".prefix, %*[{ "communityId": communityId, "addresses": addresses, }]) -proc allNonApprovedCommunitiesRequestsToJoin*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc allNonApprovedCommunitiesRequestsToJoin*(): RpcResponse[JsonNode] = result = callPrivateRPC("allNonApprovedCommunitiesRequestsToJoin".prefix) -proc cancelRequestToJoinCommunity*(requestId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc cancelRequestToJoinCommunity*(requestId: string): RpcResponse[JsonNode] = result = callPrivateRPC("cancelRequestToJoinCommunity".prefix, %*[{ "id": requestId }]) -proc leaveCommunity*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc leaveCommunity*(communityId: string): RpcResponse[JsonNode] = result = callPrivateRPC("leaveCommunity".prefix, %*[communityId]) proc createCommunity*( @@ -146,7 +146,7 @@ proc createCommunity*( historyArchiveSupportEnabled: bool, pinMessageAllMembersEnabled: bool, bannerJsonStr: string - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = let bannerImage = newCroppedImage(bannerJsonStr) result = callPrivateRPC("createCommunity".prefix, %*[{ # TODO this will need to be renamed membership (small m) @@ -185,7 +185,7 @@ proc editCommunity*( bannerJsonStr: string, historyArchiveSupportEnabled: bool, pinMessageAllMembersEnabled: bool - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = let bannerImage = newCroppedImage(bannerJsonStr) result = callPrivateRPC("editCommunity".prefix, %*[{ "CommunityID": communityId, @@ -221,7 +221,7 @@ proc requestImportDiscordCommunity*( pinMessageAllMembersEnabled: bool, filesToImport: seq[string], fromTimestamp: int, - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("requestImportDiscordCommunity".prefix, %*[{ # TODO this will need to be renamed membership (small m) "Membership": access, @@ -252,7 +252,7 @@ proc requestImportDiscordChannel*( emoji: string, filesToImport: seq[string], fromTimestamp: int, - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("requestImportDiscordChannel".prefix, %*[{ "name": name, "discordChannelId": discordChannelId, @@ -264,7 +264,7 @@ proc requestImportDiscordChannel*( "from": fromTimestamp }]) -proc createCommunityTokenPermission*(communityId: string, permissionType: int, tokenCriteria: string, chatIDs: seq[string], isPrivate: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createCommunityTokenPermission*(communityId: string, permissionType: int, tokenCriteria: string, chatIDs: seq[string], isPrivate: bool): RpcResponse[JsonNode] = result = callPrivateRPC("createCommunityTokenPermission".prefix, %*[{ "communityId": communityId, "type": permissionType, @@ -273,7 +273,7 @@ proc createCommunityTokenPermission*(communityId: string, permissionType: int, t "isPrivate": isPrivate }]) -proc editCommunityTokenPermission*(communityId: string, permissionId: string, permissionType: int, tokenCriteria: string, chatIDs: seq[string], isPrivate: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc editCommunityTokenPermission*(communityId: string, permissionId: string, permissionType: int, tokenCriteria: string, chatIDs: seq[string], isPrivate: bool): RpcResponse[JsonNode] = result = callPrivateRPC("editCommunityTokenPermission".prefix, %*[{ "communityId": communityId, "permissionId": permissionId, @@ -283,16 +283,16 @@ proc editCommunityTokenPermission*(communityId: string, permissionId: string, pe "isPrivate": isPrivate }]) -proc deleteCommunityTokenPermission*(communityId: string, permissionId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deleteCommunityTokenPermission*(communityId: string, permissionId: string): RpcResponse[JsonNode] = result = callPrivateRPC("deleteCommunityTokenPermission".prefix, %*[{ "communityId": communityId, "permissionId": permissionId }]) -proc requestCancelDiscordCommunityImport*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestCancelDiscordCommunityImport*(communityId: string): RpcResponse[JsonNode] = result = callPrivateRPC("requestCancelDiscordCommunityImport".prefix, %*[communityId]) -proc requestCancelDiscordChannelImport*(discordChannelId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestCancelDiscordChannelImport*(discordChannelId: string): RpcResponse[JsonNode] = result = callPrivateRPC("requestCancelDiscordChannelImport".prefix, %*[discordChannelId]) @@ -303,7 +303,7 @@ proc createCommunityChannel*( emoji: string, color: string, categoryId: string - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("createCommunityChat".prefix, %*[ communityId, { @@ -328,7 +328,7 @@ proc editCommunityChannel*( color: string, categoryId: string, position: int - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("editCommunityChat".prefix, %*[ communityId, channelId.replace(communityId, ""), @@ -346,7 +346,7 @@ proc editCommunityChannel*( "position": position }]) -proc reorderCommunityCategories*(communityId: string, categoryId: string, position: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc reorderCommunityCategories*(communityId: string, categoryId: string, position: int): RpcResponse[JsonNode] = result = callPrivateRPC("reorderCommunityCategories".prefix, %*[ { "communityId": communityId, @@ -359,7 +359,7 @@ proc reorderCommunityChat*( categoryId: string, chatId: string, position: int - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("reorderCommunityChat".prefix, %*[ { "communityId": communityId, @@ -371,14 +371,14 @@ proc reorderCommunityChat*( proc deleteCommunityChat*( communityId: string, chatId: string - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("deleteCommunityChat".prefix, %*[communityId, chatId]) proc createCommunityCategory*( communityId: string, name: string, channels: seq[string] - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("createCommunityCategory".prefix, %*[ { "communityId": communityId, @@ -391,7 +391,7 @@ proc editCommunityCategory*( categoryId: string, name: string, channels: seq[string] - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("editCommunityCategory".prefix, %*[ { "communityId": communityId, @@ -403,7 +403,7 @@ proc editCommunityCategory*( proc deleteCommunityCategory*( communityId: string, categoryId: string - ): RpcResponse[JsonNode] {.raises: [Exception].} = + ): RpcResponse[JsonNode] = result = callPrivateRPC("deleteCommunityCategory".prefix, %*[ { "communityId": communityId, @@ -411,7 +411,7 @@ proc deleteCommunityCategory*( }]) proc collectCommunityMetrics*(communityId: string, metricsType: int, intervals: JsonNode - ):RpcResponse[JsonNode] {.raises: [Exception].} = + ):RpcResponse[JsonNode] = result = callPrivateRPC("collectCommunityMetrics".prefix, %*[ { "communityId": communityId, @@ -419,7 +419,7 @@ proc collectCommunityMetrics*(communityId: string, metricsType: int, intervals: "intervals": intervals }]) -proc requestCommunityInfo*(communityId: string, tryDatabase: bool, shardCluster: int, shardIndex: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestCommunityInfo*(communityId: string, tryDatabase: bool, shardCluster: int, shardIndex: int): RpcResponse[JsonNode] = if shardCluster != -1 and shardIndex != -1: result = callPrivateRPC("fetchCommunity".prefix,%*[{ "communityKey": communityId, @@ -438,95 +438,95 @@ proc requestCommunityInfo*(communityId: string, tryDatabase: bool, shardCluster: "waitForResponse": true }]) -proc importCommunity*(communityKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc importCommunity*(communityKey: string): RpcResponse[JsonNode] = result = callPrivateRPC("importCommunity".prefix, %*[communityKey]) -proc exportCommunity*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc exportCommunity*(communityId: string): RpcResponse[JsonNode] = result = callPrivateRPC("exportCommunity".prefix, %*[communityId]) -proc speedupArchivesImport*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc speedupArchivesImport*(): RpcResponse[JsonNode] = result = callPrivateRPC("speedupArchivesImport".prefix) -proc slowdownArchivesImport*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc slowdownArchivesImport*(): RpcResponse[JsonNode] = result = callPrivateRPC("slowdownArchivesImport".prefix) -proc removeUserFromCommunity*(communityId: string, pubKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeUserFromCommunity*(communityId: string, pubKey: string): RpcResponse[JsonNode] = result = callPrivateRPC("removeUserFromCommunity".prefix, %*[communityId, pubKey]) -proc acceptRequestToJoinCommunity*(requestId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc acceptRequestToJoinCommunity*(requestId: string): RpcResponse[JsonNode] = return callPrivateRPC("acceptRequestToJoinCommunity".prefix, %*[{ "id": requestId }]) -proc declineRequestToJoinCommunity*(requestId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc declineRequestToJoinCommunity*(requestId: string): RpcResponse[JsonNode] = return callPrivateRPC("declineRequestToJoinCommunity".prefix, %*[{ "id": requestId }]) -proc banUserFromCommunity*(communityId: string, pubKey: string, deleteAllMessages: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc banUserFromCommunity*(communityId: string, pubKey: string, deleteAllMessages: bool): RpcResponse[JsonNode] = return callPrivateRPC("banUserFromCommunity".prefix, %*[{ "communityId": communityId, "user": pubKey, "deleteAllMessages": deleteAllMessages, }]) -proc unbanUserFromCommunity*(communityId: string, pubKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc unbanUserFromCommunity*(communityId: string, pubKey: string): RpcResponse[JsonNode] = return callPrivateRPC("unbanUserFromCommunity".prefix, %*[{ "communityId": communityId, "user": pubKey }]) -proc setCommunityMuted*(communityId: string, mutedType: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setCommunityMuted*(communityId: string, mutedType: int): RpcResponse[JsonNode] = return callPrivateRPC("setCommunityMuted".prefix, %*[{ "communityId": communityId, "mutedType": mutedType }]) -proc shareCommunityToUsers*(communityId: string, pubKeys: seq[string], inviteMessage: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareCommunityToUsers*(communityId: string, pubKeys: seq[string], inviteMessage: string): RpcResponse[JsonNode] = return callPrivateRPC("shareCommunity".prefix, %*[{ "communityId": communityId, "users": pubKeys, "inviteMessage": inviteMessage }]) -proc shareCommunityUrlWithChatKey*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareCommunityUrlWithChatKey*(communityId: string): RpcResponse[JsonNode] = return callPrivateRPC("shareCommunityURLWithChatKey".prefix, %*[communityId]) -proc shareCommunityUrlWithData*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareCommunityUrlWithData*(communityId: string): RpcResponse[JsonNode] = return callPrivateRPC("shareCommunityURLWithData".prefix, %*[communityId]) -proc shareCommunityChannelUrlWithChatKey*(communityId: string, channelId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareCommunityChannelUrlWithChatKey*(communityId: string, channelId: string): RpcResponse[JsonNode] = return callPrivateRPC("shareCommunityChannelURLWithChatKey".prefix, %*[{ "communityId": communityId, "channelId": channelId }]) -proc shareCommunityChannelUrlWithData*(communityId: string, channelId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareCommunityChannelUrlWithData*(communityId: string, channelId: string): RpcResponse[JsonNode] = return callPrivateRPC("shareCommunityChannelURLWithData".prefix, %*[{ "communityId": communityId, "channelId": channelId }]) -proc getCommunitiesSettings*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getCommunitiesSettings*(): RpcResponse[JsonNode] = return callPrivateRPC("getCommunitiesSettings".prefix, %*[]) -proc requestExtractDiscordChannelsAndCategories*(filesToImport: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestExtractDiscordChannelsAndCategories*(filesToImport: seq[string]): RpcResponse[JsonNode] = return callPrivateRPC("requestExtractDiscordChannelsAndCategories".prefix, %*[filesToImport]) -proc getCheckChannelPermissionResponses*(communityId: string,): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getCheckChannelPermissionResponses*(communityId: string,): RpcResponse[JsonNode] = return callPrivateRPC("getCheckChannelPermissionResponses".prefix, %*[communityId]) -proc getCommunityPublicKeyFromPrivateKey*(communityPrivateKey: string,): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getCommunityPublicKeyFromPrivateKey*(communityPrivateKey: string,): RpcResponse[JsonNode] = return callPrivateRPC("getCommunityPublicKeyFromPrivateKey".prefix, %*[communityPrivateKey]) -proc getCommunityMembersForWalletAddresses*(communityId: string, chainId: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getCommunityMembersForWalletAddresses*(communityId: string, chainId: int): RpcResponse[JsonNode] = return callPrivateRPC("getCommunityMembersForWalletAddresses".prefix, %* [communityId, chainId]) -proc promoteSelfToControlNode*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc promoteSelfToControlNode*(communityId: string): RpcResponse[JsonNode] = let payload = %*[communityId] return core.callPrivateRPC("wakuext_promoteSelfToControlNode", payload) -proc setCommunityShard*(communityId: string, index: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setCommunityShard*(communityId: string, index: int): RpcResponse[JsonNode] = if index != -1: result = callPrivateRPC("setCommunityShard".prefix, %*[ { diff --git a/src/backend/community_tokens.nim b/src/backend/community_tokens.nim index 9bbecec295..c1ac41d8a9 100644 --- a/src/backend/community_tokens.nim +++ b/src/backend/community_tokens.nim @@ -11,136 +11,136 @@ from ./gen import rpc # Mirrors the transfer event from status-go, services/wallet/transfer/commands.go const eventCommunityTokenReceived*: string = "wallet-community-token-received" -proc deployCollectibles*(chainId: int, deploymentParams: JsonNode, txData: JsonNode, hashedPassword: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deployCollectibles*(chainId: int, deploymentParams: JsonNode, txData: JsonNode, hashedPassword: string): RpcResponse[JsonNode] = let payload = %* [chainId, deploymentParams, txData, hashedPassword] return core.callPrivateRPC("communitytokens_deployCollectibles", payload) -proc deployAssets*(chainId: int, deploymentParams: JsonNode, txData: JsonNode, hashedPassword: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deployAssets*(chainId: int, deploymentParams: JsonNode, txData: JsonNode, hashedPassword: string): RpcResponse[JsonNode] = let payload = %* [chainId, deploymentParams, txData, hashedPassword] return core.callPrivateRPC("communitytokens_deployAssets", payload) -proc removeCommunityToken*(chainId: int, address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeCommunityToken*(chainId: int, address: string): RpcResponse[JsonNode] = let payload = %* [chainId, address] return core.callPrivateRPC("wakuext_removeCommunityToken", payload) -proc getCommunityTokens*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getCommunityTokens*(communityId: string): RpcResponse[JsonNode] = let payload = %* [communityId] return core.callPrivateRPC("wakuext_getCommunityTokens", payload) -proc getAllCommunityTokens*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getAllCommunityTokens*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("wakuext_getAllCommunityTokens", payload) -proc saveCommunityToken*(token: CommunityTokenDto, croppedImageJson: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc saveCommunityToken*(token: CommunityTokenDto, croppedImageJson: string): RpcResponse[JsonNode] = let croppedImage = if len(croppedImageJson) > 0: newCroppedImage(croppedImageJson) else: nil let payload = %* [token.toJsonNode(), croppedImage] return core.callPrivateRPC("wakuext_saveCommunityToken", payload) -proc addCommunityToken*(communityId: string, chainId: int, address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addCommunityToken*(communityId: string, chainId: int, address: string): RpcResponse[JsonNode] = let payload = %* [communityId, chainId, address] return core.callPrivateRPC("wakuext_addCommunityToken", payload) -proc updateCommunityTokenState*(chainId: int, contractAddress: string, deployState: DeployState): RpcResponse[JsonNode] {.raises: [Exception].} = +proc updateCommunityTokenState*(chainId: int, contractAddress: string, deployState: DeployState): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, deployState.int] return core.callPrivateRPC("wakuext_updateCommunityTokenState", payload) -proc updateCommunityTokenAddress*(chainId: int, oldContractAddress: string, newContractAddress: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc updateCommunityTokenAddress*(chainId: int, oldContractAddress: string, newContractAddress: string): RpcResponse[JsonNode] = let payload = %* [chainId, oldContractAddress, newContractAddress] return core.callPrivateRPC("wakuext_updateCommunityTokenAddress", payload) -proc updateCommunityTokenSupply*(chainId: int, contractAddress: string, supply: Uint256): RpcResponse[JsonNode] {.raises: [Exception].} = +proc updateCommunityTokenSupply*(chainId: int, contractAddress: string, supply: Uint256): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, supply.toString(10)] return core.callPrivateRPC("wakuext_updateCommunityTokenSupply", payload) -proc mintTokens*(chainId: int, contractAddress: string, txData: JsonNode, hashedPasword: string, walletAddresses: seq[string], amount: Uint256): RpcResponse[JsonNode] {.raises: [Exception].} = +proc mintTokens*(chainId: int, contractAddress: string, txData: JsonNode, hashedPasword: string, walletAddresses: seq[string], amount: Uint256): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, txData, hashedPasword, walletAddresses, amount.toString(10)] return core.callPrivateRPC("communitytokens_mintTokens", payload) -proc estimateMintTokens*(chainId: int, contractAddress: string, fromAddress: string, walletAddresses: seq[string], amount: Uint256): RpcResponse[JsonNode] {.raises: [Exception].} = +proc estimateMintTokens*(chainId: int, contractAddress: string, fromAddress: string, walletAddresses: seq[string], amount: Uint256): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, fromAddress, walletAddresses, amount.toString(10)] return core.callPrivateRPC("communitytokens_estimateMintTokens", payload) -proc remoteBurn*(chainId: int, contractAddress: string, txData: JsonNode, hashedPassword: string, tokenIds: seq[UInt256]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc remoteBurn*(chainId: int, contractAddress: string, txData: JsonNode, hashedPassword: string, tokenIds: seq[UInt256]): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, txData, hashedPassword, tokenIds.map(x => x.toString(10))] return core.callPrivateRPC("communitytokens_remoteBurn", payload) -proc estimateRemoteBurn*(chainId: int, contractAddress: string, fromAddress: string, tokenIds: seq[UInt256]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc estimateRemoteBurn*(chainId: int, contractAddress: string, fromAddress: string, tokenIds: seq[UInt256]): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, fromAddress, tokenIds.map(x => x.toString(10))] return core.callPrivateRPC("communitytokens_estimateRemoteBurn", payload) -proc burn*(chainId: int, contractAddress: string, txData: JsonNode, hashedPassword: string, amount: Uint256): RpcResponse[JsonNode] {.raises: [Exception].} = +proc burn*(chainId: int, contractAddress: string, txData: JsonNode, hashedPassword: string, amount: Uint256): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, txData, hashedPassword, amount.toString(10)] return core.callPrivateRPC("communitytokens_burn", payload) -proc estimateBurn*(chainId: int, contractAddress: string, fromAddress: string, amount: Uint256): RpcResponse[JsonNode] {.raises: [Exception].} = +proc estimateBurn*(chainId: int, contractAddress: string, fromAddress: string, amount: Uint256): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, fromAddress, amount.toString(10)] return core.callPrivateRPC("communitytokens_estimateBurn", payload) -proc estimateSetSignerPubKey*(chainId: int, contractAddress: string, fromAddress: string, newSignerPubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc estimateSetSignerPubKey*(chainId: int, contractAddress: string, fromAddress: string, newSignerPubkey: string): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, fromAddress, newSignerPubkey] return core.callPrivateRPC("communitytokens_estimateSetSignerPubKey", payload) -proc remainingSupply*(chainId: int, contractAddress: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc remainingSupply*(chainId: int, contractAddress: string): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress] return core.callPrivateRPC("communitytokens_remainingSupply", payload) -proc deployCollectiblesEstimate*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deployCollectiblesEstimate*(): RpcResponse[JsonNode] = let payload = %*[] return core.callPrivateRPC("communitytokens_deployCollectiblesEstimate", payload) -proc deployAssetsEstimate*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deployAssetsEstimate*(): RpcResponse[JsonNode] = let payload = %*[] return core.callPrivateRPC("communitytokens_deployAssetsEstimate", payload) -proc remoteDestructedAmount*(chainId: int, contractAddress: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc remoteDestructedAmount*(chainId: int, contractAddress: string): RpcResponse[JsonNode] = let payload = %*[chainId, contractAddress] return core.callPrivateRPC("communitytokens_remoteDestructedAmount", payload) -proc deployOwnerTokenEstimate*(chainId: int, addressFrom: string, ownerParams: JsonNode, masterParams: JsonNode, signature: string, communityId: string, signerPubKey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deployOwnerTokenEstimate*(chainId: int, addressFrom: string, ownerParams: JsonNode, masterParams: JsonNode, signature: string, communityId: string, signerPubKey: string): RpcResponse[JsonNode] = let payload = %*[chainId, addressFrom, ownerParams, masterParams, signature, communityId, signerPubKey] return core.callPrivateRPC("communitytokens_deployOwnerTokenEstimate", payload) -proc deployOwnerToken*(chainId: int, ownerParams: JsonNode, masterParams: JsonNode, signature: string, communityId: string, signerPubKey: string, txData: JsonNode, hashedPassword: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deployOwnerToken*(chainId: int, ownerParams: JsonNode, masterParams: JsonNode, signature: string, communityId: string, signerPubKey: string, txData: JsonNode, hashedPassword: string): RpcResponse[JsonNode] = let payload = %*[chainId, ownerParams, masterParams, signature, communityId, signerPubKey, txData, hashedPassword] return core.callPrivateRPC("communitytokens_deployOwnerToken", payload) -proc getMasterTokenContractAddressFromHash*(chainId: int, transactionHash: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getMasterTokenContractAddressFromHash*(chainId: int, transactionHash: string): RpcResponse[JsonNode] = let payload = %*[chainId, transactionHash] return core.callPrivateRPC("communitytokens_getMasterTokenContractAddressFromHash", payload) -proc getOwnerTokenContractAddressFromHash*(chainId: int, transactionHash: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getOwnerTokenContractAddressFromHash*(chainId: int, transactionHash: string): RpcResponse[JsonNode] = let payload = %*[chainId, transactionHash] return core.callPrivateRPC("communitytokens_getOwnerTokenContractAddressFromHash", payload) -proc createCommunityTokenDeploymentSignature*(chainId: int, addressFrom: string, signerAddress: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createCommunityTokenDeploymentSignature*(chainId: int, addressFrom: string, signerAddress: string): RpcResponse[JsonNode] = let payload = %*[chainId, addressFrom, signerAddress] return core.callPrivateRPC("wakuext_createCommunityTokenDeploymentSignature", payload) -proc setSignerPubKey*(chainId: int, contractAddress: string, txData: JsonNode, newSignerPubKey: string, hashedPassword: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setSignerPubKey*(chainId: int, contractAddress: string, txData: JsonNode, newSignerPubKey: string, hashedPassword: string): RpcResponse[JsonNode] = let payload = %* [chainId, contractAddress, txData, hashedPassword, newSignerPubKey] return core.callPrivateRPC("communitytokens_setSignerPubKey", payload) -proc registerOwnerTokenReceivedNotification*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc registerOwnerTokenReceivedNotification*(communityId: string): RpcResponse[JsonNode] = let payload = %*[communityId] return core.callPrivateRPC("wakuext_registerOwnerTokenReceivedNotification", payload) -proc registerReceivedOwnershipNotification*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc registerReceivedOwnershipNotification*(communityId: string): RpcResponse[JsonNode] = let payload = %*[communityId] return core.callPrivateRPC("wakuext_registerReceivedOwnershipNotification", payload) -proc registerSetSignerFailedNotification*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc registerSetSignerFailedNotification*(communityId: string): RpcResponse[JsonNode] = let payload = %*[communityId] return core.callPrivateRPC("wakuext_registerSetSignerFailedNotification", payload) -proc registerSetSignerDeclinedNotification*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc registerSetSignerDeclinedNotification*(communityId: string): RpcResponse[JsonNode] = let payload = %*[communityId] return core.callPrivateRPC("wakuext_registerSetSignerDeclinedNotification", payload) -proc registerLostOwnershipNotification*(communityId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc registerLostOwnershipNotification*(communityId: string): RpcResponse[JsonNode] = let payload = %*[communityId] return core.callPrivateRPC("wakuext_registerLostOwnershipNotification", payload) -proc getOwnerTokenOwnerAddress*(chainId: int, contractAddress: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getOwnerTokenOwnerAddress*(chainId: int, contractAddress: string): RpcResponse[JsonNode] = let payload = %*[chainId, contractAddress] return core.callPrivateRPC("communitytokens_ownerTokenOwnerAddress", payload) diff --git a/src/backend/contacts.nim b/src/backend/contacts.nim index f5e020bde9..95daffe8f6 100644 --- a/src/backend/contacts.nim +++ b/src/backend/contacts.nim @@ -4,143 +4,143 @@ import response_type export response_type -proc getContacts*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getContacts*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("contacts".prefix, payload) -proc getContactById*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getContactById*(id: string): RpcResponse[JsonNode] = let payload = %* [id] result = callPrivateRPC("getContactByID".prefix, payload) -proc blockContact*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc blockContact*(id: string): RpcResponse[JsonNode] = result = callPrivateRPC("blockContactDesktop".prefix, %* [id]) -proc unblockContact*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc unblockContact*(id: string): RpcResponse[JsonNode] = result = callPrivateRPC("unblockContact".prefix, %* [id]) -proc removeContact*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeContact*(id: string): RpcResponse[JsonNode] = result = callPrivateRPC("removeContact".prefix, %* [id]) -proc setContactLocalNickname*(id: string, name: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setContactLocalNickname*(id: string, name: string): RpcResponse[JsonNode] = let payload = %* [{ "id": id, "nickname": name }] result = callPrivateRPC("setContactLocalNickname".prefix, payload) -proc sendContactRequest*(id: string, message: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc sendContactRequest*(id: string, message: string): RpcResponse[JsonNode] = let payload = %* [{ "id": id, "message": message }] result = callPrivateRPC("sendContactRequest".prefix, payload) -proc acceptLatestContactRequestForContact*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc acceptLatestContactRequestForContact*(id: string): RpcResponse[JsonNode] = let payload = %* [{ "id": id }] result = callPrivateRPC("acceptLatestContactRequestForContact".prefix, payload) -proc acceptContactRequest*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc acceptContactRequest*(id: string): RpcResponse[JsonNode] = let payload = %* [{ "id": id }] result = callPrivateRPC("acceptContactRequest".prefix, payload) -proc dismissLatestContactRequestForContact*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc dismissLatestContactRequestForContact*(id: string): RpcResponse[JsonNode] = let payload = %*[{ "id": id }] result = callPrivateRPC("dismissLatestContactRequestForContact".prefix, payload) -proc declineContactRequest*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc declineContactRequest*(id: string): RpcResponse[JsonNode] = let payload = %*[{ "id": id }] result = callPrivateRPC("declineContactRequest".prefix, payload) -proc getLatestContactRequestForContact*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getLatestContactRequestForContact*(id: string): RpcResponse[JsonNode] = let payload = %* [id] result = callPrivateRPC("getLatestContactRequestForContact".prefix, payload) -proc sendContactUpdate*(publicKey, ensName, thumbnail: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc sendContactUpdate*(publicKey, ensName, thumbnail: string): RpcResponse[JsonNode] = let payload = %* [publicKey, ensName, thumbnail] result = callPrivateRPC("sendContactUpdate".prefix, payload) -proc getImageServerURL*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getImageServerURL*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("imageServerURL".prefix, payload) -proc markAsTrusted*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc markAsTrusted*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("markAsTrusted".prefix, payload) -proc markUntrustworthy*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc markUntrustworthy*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("markAsUntrustworthy".prefix, payload) -proc verifiedTrusted*(requestId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc verifiedTrusted*(requestId: string): RpcResponse[JsonNode] = let payload = %*[{ "id": requestId }] result = callPrivateRPC("verifiedTrusted".prefix, payload) -proc verifiedUntrustworthy*(requestId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc verifiedUntrustworthy*(requestId: string): RpcResponse[JsonNode] = let payload = %*[{ "id": requestId }] result = callPrivateRPC("verifiedUntrustworthy".prefix, payload) -proc removeTrustStatus*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeTrustStatus*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("removeTrustStatus".prefix, payload) -proc getTrustStatus*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getTrustStatus*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("getTrustStatus".prefix, payload) -proc sendVerificationRequest*(pubkey: string, challenge: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc sendVerificationRequest*(pubkey: string, challenge: string): RpcResponse[JsonNode] = let payload = %* [pubkey, challenge] result = callPrivateRPC("sendContactVerificationRequest".prefix, payload) -proc acceptVerificationRequest*(requestId: string, response: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc acceptVerificationRequest*(requestId: string, response: string): RpcResponse[JsonNode] = let payload = %* [requestId, response] result = callPrivateRPC("acceptContactVerificationRequest".prefix, payload) -proc declineVerificationRequest*(requestId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc declineVerificationRequest*(requestId: string): RpcResponse[JsonNode] = let payload = %* [requestId] result = callPrivateRPC("declineContactVerificationRequest".prefix, payload) -proc getVerificationRequestSentTo*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getVerificationRequestSentTo*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("getVerificationRequestSentTo".prefix, payload) -proc getVerificationRequestFrom*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getVerificationRequestFrom*(pubkey: string): RpcResponse[JsonNode] = let payload = %* [pubkey] result = callPrivateRPC("getLatestVerificationRequestFrom".prefix, payload) -proc getReceivedVerificationRequests*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getReceivedVerificationRequests*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("getReceivedVerificationRequests".prefix, payload) -proc cancelVerificationRequest*(requestId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc cancelVerificationRequest*(requestId: string): RpcResponse[JsonNode] = let payload = %* [requestId] result = callPrivateRPC("cancelVerificationRequest".prefix, payload) -proc retractContactRequest*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc retractContactRequest*(pubkey: string): RpcResponse[JsonNode] = let payload = %*[{ "id": pubkey }] result = callPrivateRPC("retractContactRequest".prefix, payload) -proc requestContactInfo*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestContactInfo*(pubkey: string): RpcResponse[JsonNode] = result = callPrivateRPC("requestContactInfoFromMailserver".prefix, %*[pubkey]) -proc shareUserUrlWithData*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareUserUrlWithData*(pubkey: string): RpcResponse[JsonNode] = result = callPrivateRPC("shareUserURLWithData".prefix, %*[pubkey]) -proc shareUserUrlWithChatKey*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareUserUrlWithChatKey*(pubkey: string): RpcResponse[JsonNode] = result = callPrivateRPC("shareUserURLWithChatKey".prefix, %*[pubkey]) -proc shareUserUrlWithENS*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc shareUserUrlWithENS*(pubkey: string): RpcResponse[JsonNode] = result = callPrivateRPC("shareUserURLWithENS".prefix, %*[pubkey]) \ No newline at end of file diff --git a/src/backend/ens.nim b/src/backend/ens.nim index 08791be24f..2af1599907 100644 --- a/src/backend/ens.nim +++ b/src/backend/ens.nim @@ -2,81 +2,81 @@ import json import ./core, ./response_type export response_type -proc getEnsUsernames*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getEnsUsernames*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("ens_getEnsUsernames", payload) -proc add*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc add*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_add", payload) -proc remove*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc remove*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_remove", payload) -proc getRegistrarAddress*(chainId: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getRegistrarAddress*(chainId: int): RpcResponse[JsonNode] = let payload = %* [chainId] return core.callPrivateRPC("ens_getRegistrarAddress", payload) -proc resolver*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc resolver*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_resolver", payload) -proc ownerOf*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc ownerOf*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_ownerOf", payload) -proc contentHash*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc contentHash*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_contentHash", payload) -proc publicKeyOf*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc publicKeyOf*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_publicKeyOf", payload) -proc addressOf*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addressOf*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_addressOf", payload) -proc expireAt*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc expireAt*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_expireAt", payload) -proc price*(chainId: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc price*(chainId: int): RpcResponse[JsonNode] = let payload = %* [chainId] return core.callPrivateRPC("ens_price", payload) -proc resourceURL*(chainId: int, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc resourceURL*(chainId: int, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, username] return core.callPrivateRPC("ens_resourceURL", payload) -proc prepareTxForRegisterEnsUsername*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc prepareTxForRegisterEnsUsername*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] = let payload = %* [chainId, txData, username, pubkey] return core.callPrivateRPC("ens_registerPrepareTx", payload) -proc registerEstimate*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc registerEstimate*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] = let payload = %* [chainId, txData, username, pubkey] return core.callPrivateRPC("ens_registerEstimate", payload) -proc prepareTxForReleaseEnsUsername*(chainId: int, txData: JsonNode, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc prepareTxForReleaseEnsUsername*(chainId: int, txData: JsonNode, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, txData, username] return core.callPrivateRPC("ens_releasePrepareTx", payload) -proc releaseEstimate*(chainId: int, txData: JsonNode, username: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc releaseEstimate*(chainId: int, txData: JsonNode, username: string): RpcResponse[JsonNode] = let payload = %* [chainId, txData, username] return core.callPrivateRPC("ens_releaseEstimate", payload) -proc prepareTxForSetPubKey*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc prepareTxForSetPubKey*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] = let payload = %* [chainId, txData, username, pubkey] return core.callPrivateRPC("ens_setPubKeyPrepareTx", payload) -proc setPubKeyEstimate*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setPubKeyEstimate*(chainId: int, txData: JsonNode, username: string, pubkey: string): RpcResponse[JsonNode] = let payload = %* [chainId, txData, username, pubkey] return core.callPrivateRPC("ens_setPubKeyEstimate", payload) \ No newline at end of file diff --git a/src/backend/eth.nim b/src/backend/eth.nim index bf32e8c130..7c1ff973bf 100644 --- a/src/backend/eth.nim +++ b/src/backend/eth.nim @@ -4,30 +4,30 @@ from ./gen import rpc export response_type -proc getAccounts*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getAccounts*(): RpcResponse[JsonNode] = return core.callPrivateRPC("eth_accounts") -proc getBlockByNumber*(chainId: int, blockNumber: string, fullTransactionObject = false): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getBlockByNumber*(chainId: int, blockNumber: string, fullTransactionObject = false): RpcResponse[JsonNode] = let payload = %* [blockNumber, fullTransactionObject] return core.callPrivateRPCWithChainId("eth_getBlockByNumber", chainId, payload) -proc getNativeChainBalance*(chainId: int, address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getNativeChainBalance*(chainId: int, address: string): RpcResponse[JsonNode] = let payload = %* [address, "latest"] return core.callPrivateRPCWithChainId("eth_getBalance", chainId, payload) # This is the replacement of the `call` function -proc doEthCall*(payload = %* []): RpcResponse[JsonNode] {.raises: [Exception].} = +proc doEthCall*(payload = %* []): RpcResponse[JsonNode] = core.callPrivateRPC("eth_call", payload) -proc estimateGas*(chainId: int, payload = %* []): RpcResponse[JsonNode] {.raises: [Exception].} = +proc estimateGas*(chainId: int, payload = %* []): RpcResponse[JsonNode] = core.callPrivateRPCWithChainId("eth_estimateGas", chainId, payload) -proc suggestedFees*(chainId: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc suggestedFees*(chainId: int): RpcResponse[JsonNode] = let payload = %* [chainId] return core.callPrivateRPC("wallet_getSuggestedFees", payload) proc suggestedRoutes*(accountFrom: string, accountTo: string, amount: string, token: string, disabledFromChainIDs, - disabledToChainIDs, preferredChainIDs: seq[int], sendType: int, lockedInAmounts: var Table[string, string]): RpcResponse[JsonNode] {.raises: [Exception].} = + disabledToChainIDs, preferredChainIDs: seq[int], sendType: int, lockedInAmounts: var Table[string, string]): RpcResponse[JsonNode] = let payload = %* [sendType, accountFrom, accountTo, amount, token, disabledFromChainIDs, disabledToChainIDs, preferredChainIDs, 1, lockedInAmounts] return core.callPrivateRPC("wallet_getSuggestedRoutes", payload) diff --git a/src/backend/general.nim b/src/backend/general.nim index 9006b8b426..824fe2a3f3 100644 --- a/src/backend/general.nim +++ b/src/backend/general.nim @@ -9,7 +9,7 @@ export response_type logScope: topics = "rpc-general" -proc validateMnemonic*(mnemonic: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc validateMnemonic*(mnemonic: string): RpcResponse[JsonNode] = try: let response = status_go.validateMnemonic(mnemonic.strip()) result.result = Json.decode(response, JsonNode) @@ -18,11 +18,11 @@ proc validateMnemonic*(mnemonic: string): RpcResponse[JsonNode] {.raises: [Excep error "error doing rpc request", methodName = "validateMnemonic", exception=e.msg raise newException(RpcException, e.msg) -proc startMessenger*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc startMessenger*(): RpcResponse[JsonNode] = let payload = %* [] result = core.callPrivateRPC("startMessenger".prefix, payload) -proc logout*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc logout*(): RpcResponse[JsonNode] = try: let response = status_go.logout() result.result = Json.decode(response, JsonNode) @@ -30,31 +30,31 @@ proc logout*(): RpcResponse[JsonNode] {.raises: [Exception].} = error "error logging out", methodName = "logout", exception=e.msg raise newException(RpcException, e.msg) -proc generateSymKeyFromPassword*(password: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc generateSymKeyFromPassword*(password: string): RpcResponse[JsonNode] = let payload = %* [password] result = core.callPrivateRPC("waku_generateSymKeyFromPassword", payload) -proc adminPeers*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc adminPeers*(): RpcResponse[JsonNode] = let payload = %* [] result = core.callPrivateRPC("admin_peers", payload) -proc wakuV2Peers*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc wakuV2Peers*(): RpcResponse[JsonNode] = let payload = %* [] result = core.callPrivateRPC("peers".prefix, payload) -proc dialPeer*(address: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc dialPeer*(address: string): RpcResponse[JsonNode] = let payload = %* [address] result = core.callPrivateRPC("dialPeer".prefix, payload) -proc dropPeerByID*(peer: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc dropPeerByID*(peer: string): RpcResponse[JsonNode] = let payload = %* [peer] result = core.callPrivateRPC("dropPeer".prefix, payload) -proc removePeer*(peer: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removePeer*(peer: string): RpcResponse[JsonNode] = let payload = %* [peer] result = core.callPrivateRPC("admin_removePeer", payload) -proc getPasswordStrengthScore*(password: string, userInputs: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getPasswordStrengthScore*(password: string, userInputs: seq[string]): RpcResponse[JsonNode] = let params = %* {"password": password, "userInputs": userInputs} try: let response = status_go.getPasswordStrengthScore($(params)) @@ -63,7 +63,7 @@ proc getPasswordStrengthScore*(password: string, userInputs: seq[string]): RpcRe error "error", methodName = "getPasswordStrengthScore", exception=e.msg raise newException(RpcException, e.msg) -proc generateImages*(imagePath: string, aX, aY, bX, bY: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc generateImages*(imagePath: string, aX, aY, bX, bY: int): RpcResponse[JsonNode] = try: let response = status_go.generateImages(imagePath, aX, aY, bX, bY) result.result = Json.decode(response, JsonNode) @@ -71,7 +71,7 @@ proc generateImages*(imagePath: string, aX, aY, bX, bY: int): RpcResponse[JsonNo error "error", methodName = "generateImages", exception=e.msg raise newException(RpcException, e.msg) -proc initKeystore*(keystoreDir: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc initKeystore*(keystoreDir: string): RpcResponse[JsonNode] = try: let response = status_go.initKeystore(keystoreDir) result.result = Json.decode(response, JsonNode) @@ -79,9 +79,9 @@ proc initKeystore*(keystoreDir: string): RpcResponse[JsonNode] {.raises: [Except error "error", methodName = "initKeystore", exception=e.msg raise newException(RpcException, e.msg) -proc backupData*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc backupData*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("backupData".prefix, payload) -proc parseSharedUrl*(url: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc parseSharedUrl*(url: string): RpcResponse[JsonNode] = result = callPrivateRPC("parseSharedURL".prefix, %*[url]) \ No newline at end of file diff --git a/src/backend/gifs.nim b/src/backend/gifs.nim index 90e5345be9..ff70a873aa 100644 --- a/src/backend/gifs.nim +++ b/src/backend/gifs.nim @@ -4,10 +4,10 @@ import response_type export response_type -proc getRecentGifs*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getRecentGifs*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("gif_getRecentGifs", payload) -proc getFavoriteGifs*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getFavoriteGifs*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("gif_getFavoriteGifs", payload) diff --git a/src/backend/group_chat.nim b/src/backend/group_chat.nim index 61ed23af29..dc83a31e6e 100644 --- a/src/backend/group_chat.nim +++ b/src/backend/group_chat.nim @@ -4,62 +4,62 @@ import response_type export response_type -proc createOneToOneChat*(communityID: string, id: string, ensName: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createOneToOneChat*(communityID: string, id: string, ensName: string): RpcResponse[JsonNode] = let payload = %* [communityID, id, ensName] return core.callPrivateRPC("chat_createOneToOneChat", payload) -proc createGroupChat*(communityID: string, name: string, members: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createGroupChat*(communityID: string, name: string, members: seq[string]): RpcResponse[JsonNode] = let payload = %* [communityID, name, members] return core.callPrivateRPC("chat_createGroupChat", payload) -proc createGroupChatFromInvitation*(name: string, chatID: string, adminPK: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createGroupChatFromInvitation*(name: string, chatID: string, adminPK: string): RpcResponse[JsonNode] = let payload = %* [name, chatID, adminPK] return core.callPrivateRPC("chat_createGroupChatFromInvitation", payload) -proc leaveChat*(communityID: string, chatID: string, remove: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc leaveChat*(communityID: string, chatID: string, remove: bool): RpcResponse[JsonNode] = let payload = %* [communityID, chatID, remove] return core.callPrivateRPC("chat_leaveChat", payload) -proc addMembers*(communityID: string, chatID: string, members: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addMembers*(communityID: string, chatID: string, members: seq[string]): RpcResponse[JsonNode] = let payload = %* [communityID, chatID, members] return core.callPrivateRPC("chat_addMembers", payload) -proc removeMember*(communityID: string, chatID: string, member: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeMember*(communityID: string, chatID: string, member: string): RpcResponse[JsonNode] = let payload = %* [communityID, chatID, member] return core.callPrivateRPC("chat_removeMember", payload) -proc makeAdmin*(communityID: string, chatID: string, member: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc makeAdmin*(communityID: string, chatID: string, member: string): RpcResponse[JsonNode] = let payload = %* [communityID, chatID, member] return core.callPrivateRPC("chat_makeAdmin", payload) -proc renameChat*(communityID: string, chatID: string, name: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc renameChat*(communityID: string, chatID: string, name: string): RpcResponse[JsonNode] = let payload = %* [communityID, chatID, name] return core.callPrivateRPC("chat_renameChat", payload) -proc sendGroupChatInvitationRequest*(communityID: string, chatID: string, adminPK: string, message: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc sendGroupChatInvitationRequest*(communityID: string, chatID: string, adminPK: string, message: string): RpcResponse[JsonNode] = let payload = %* [communityID, chatID, adminPK, message] return core.callPrivateRPC("chat_sendGroupChatInvitationRequest", payload) -proc getGroupChatInvitations*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getGroupChatInvitations*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("chat_getGroupChatInvitations", payload) -proc sendGroupChatInvitationRejection*(invitationRequestID: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc sendGroupChatInvitationRejection*(invitationRequestID: string): RpcResponse[JsonNode] = let payload = %* [invitationRequestID] return core.callPrivateRPC("chat_sendGroupChatInvitationRejection", payload) -proc startGroupChat*(communityID: string, name: string, members: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc startGroupChat*(communityID: string, name: string, members: seq[string]): RpcResponse[JsonNode] = let payload = %* [communityID, name, members] return core.callPrivateRPC("chat_startGroupChat", payload) diff --git a/src/backend/installations.nim b/src/backend/installations.nim index 2aa465bc21..a473f6ac4e 100644 --- a/src/backend/installations.nim +++ b/src/backend/installations.nim @@ -5,7 +5,7 @@ import response_type export response_type proc setInstallationMetadata*(installationId: string, deviceName: string, deviceType: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [installationId, { "name": deviceName, "deviceType": deviceType @@ -13,25 +13,25 @@ proc setInstallationMetadata*(installationId: string, deviceName: string, device result = callPrivateRPC("setInstallationMetadata".prefix, payload) proc setInstallationName*(installationId: string, name: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [installationId, name] result = callPrivateRPC("setInstallationName".prefix, payload) -proc getOurInstallations*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getOurInstallations*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("getOurInstallations".prefix, payload) -proc syncDevices*(preferredName: string, photoPath: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc syncDevices*(preferredName: string, photoPath: string): RpcResponse[JsonNode] = let payload = %* [preferredName, photoPath] result = callPrivateRPC("syncDevices".prefix, payload) -proc sendPairInstallation*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc sendPairInstallation*(): RpcResponse[JsonNode] = result = callPrivateRPC("sendPairInstallation".prefix) -proc enableInstallation*(installationId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc enableInstallation*(installationId: string): RpcResponse[JsonNode] = let payload = %* [installationId] result = callPrivateRPC("enableInstallation".prefix, payload) -proc disableInstallation*(installationId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc disableInstallation*(installationId: string): RpcResponse[JsonNode] = let payload = %* [installationId] result = callPrivateRPC("disableInstallation".prefix, payload) diff --git a/src/backend/mailservers.nim b/src/backend/mailservers.nim index c9dabc25fa..697328e5e3 100644 --- a/src/backend/mailservers.nim +++ b/src/backend/mailservers.nim @@ -8,7 +8,7 @@ logScope: topics = "mailserver" proc saveMailserver*(id: string, name: string, enode: string, fleet: string): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [{ "id": id, "name": name, @@ -17,24 +17,24 @@ proc saveMailserver*(id: string, name: string, enode: string, fleet: string): }] result = core.callPrivateRPC("mailservers_addMailserver", payload) -proc getMailservers*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getMailservers*(): RpcResponse[JsonNode] = result = core.callPrivateRPC("mailservers_getMailservers") -proc syncChatFromSyncedFrom*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc syncChatFromSyncedFrom*(chatId: string): RpcResponse[JsonNode] = let payload = %*[chatId] result = core.callPrivateRPC("syncChatFromSyncedFrom".prefix, payload) info "syncChatFromSyncedFrom", topics="mailserver-interaction", rpc_method="wakuext_syncChatFromSyncedFrom", chatId, result -proc fillGaps*(chatId: string, messageIds: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc fillGaps*(chatId: string, messageIds: seq[string]): RpcResponse[JsonNode] = let payload = %*[chatId, messageIds] result = core.callPrivateRPC("fillGaps".prefix, payload) info "fillGaps", topics="mailserver-interaction", rpc_method="wakuext_fillGaps", chatId, messageIds, result -proc requestAllHistoricMessagesWithRetries*(forceFetchingBackup: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestAllHistoricMessagesWithRetries*(forceFetchingBackup: bool): RpcResponse[JsonNode] = let payload = %*[forceFetchingBackup] result = core.callPrivateRPC("requestAllHistoricMessagesWithRetries".prefix, payload) -proc requestMoreMessages*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc requestMoreMessages*(chatId: string): RpcResponse[JsonNode] = let payload = %*[{ "id": chatId }] diff --git a/src/backend/messages.nim b/src/backend/messages.nim index 1cf3f6e263..c8f0a90f9a 100644 --- a/src/backend/messages.nim +++ b/src/backend/messages.nim @@ -4,27 +4,27 @@ import response_type export response_type -proc fetchMessages*(chatId: string, cursorVal: string, limit: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc fetchMessages*(chatId: string, cursorVal: string, limit: int): RpcResponse[JsonNode] = let payload = %* [chatId, cursorVal, limit] result = callPrivateRPC("chatMessages".prefix, payload) -proc fetchPinnedMessages*(chatId: string, cursorVal: string, limit: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc fetchPinnedMessages*(chatId: string, cursorVal: string, limit: int): RpcResponse[JsonNode] = let payload = %* [chatId, cursorVal, limit] result = callPrivateRPC("chatPinnedMessages".prefix, payload) -proc fetchReactions*(chatId: string, cursorVal: string, limit: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc fetchReactions*(chatId: string, cursorVal: string, limit: int): RpcResponse[JsonNode] = let payload = %* [chatId, cursorVal, limit] result = callPrivateRPC("emojiReactionsByChatID".prefix, payload) -proc addReaction*(chatId: string, messageId: string, emojiId: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addReaction*(chatId: string, messageId: string, emojiId: int): RpcResponse[JsonNode] = let payload = %* [chatId, messageId, emojiId] result = callPrivateRPC("sendEmojiReaction".prefix, payload) -proc removeReaction*(reactionId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removeReaction*(reactionId: string): RpcResponse[JsonNode] = let payload = %* [reactionId] result = callPrivateRPC("sendEmojiReactionRetraction".prefix, payload) -proc pinUnpinMessage*(chatId: string, messageId: string, pin: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc pinUnpinMessage*(chatId: string, messageId: string, pin: bool): RpcResponse[JsonNode] = let payload = %*[{ "message_id": messageId, "pinned": pin, @@ -32,58 +32,58 @@ proc pinUnpinMessage*(chatId: string, messageId: string, pin: bool): RpcResponse }] result = callPrivateRPC("sendPinMessage".prefix, payload) -proc markMessageAsUnread*(chatId: string, messageId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc markMessageAsUnread*(chatId: string, messageId: string): RpcResponse[JsonNode] = let payload = %*[chatId, messageId] result = callPrivateRPC("markMessageAsUnread".prefix, payload) -proc getMessageByMessageId*(messageId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getMessageByMessageId*(messageId: string): RpcResponse[JsonNode] = let payload = %* [messageId] result = callPrivateRPC("messageByMessageID".prefix, payload) -proc fetchReactionsForMessageWithId*(chatId: string, messageId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc fetchReactionsForMessageWithId*(chatId: string, messageId: string): RpcResponse[JsonNode] = let payload = %* [chatId, messageId] result = callPrivateRPC("emojiReactionsByChatIDMessageID".prefix, payload) proc fetchAllMessagesFromChatWhichMatchTerm*(chatId: string, searchTerm: string, caseSensitive: bool): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [chatId, searchTerm, caseSensitive] result = callPrivateRPC("allMessagesFromChatWhichMatchTerm".prefix, payload) proc fetchAllMessagesFromChatsAndCommunitiesWhichMatchTerm*(communityIds: seq[string], chatIds: seq[string], - searchTerm: string, caseSensitive: bool): RpcResponse[JsonNode] {.raises: [Exception].} = + searchTerm: string, caseSensitive: bool): RpcResponse[JsonNode] = let payload = %* [communityIds, chatIds, searchTerm, caseSensitive] result = callPrivateRPC("allMessagesFromChatsAndCommunitiesWhichMatchTerm".prefix, payload) -proc markAllMessagesFromChatWithIdAsRead*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc markAllMessagesFromChatWithIdAsRead*(chatId: string): RpcResponse[JsonNode] = let payload = %* [chatId] result = callPrivateRPC("markAllRead".prefix, payload) proc markCertainMessagesFromChatWithIdAsRead*(chatId: string, messageIds: seq[string]): - RpcResponse[JsonNode] {.raises: [Exception].} = + RpcResponse[JsonNode] = let payload = %* [chatId, messageIds] result = callPrivateRPC("markMessagesRead".prefix, payload) -proc deleteMessageAndSend*(messageID: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deleteMessageAndSend*(messageID: string): RpcResponse[JsonNode] = result = callPrivateRPC("deleteMessageAndSend".prefix, %* [messageID]) -proc editMessage*(messageId: string, contentType: int, msg: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc editMessage*(messageId: string, contentType: int, msg: string): RpcResponse[JsonNode] = result = callPrivateRPC("editMessage".prefix, %* [{"id": messageId, "text": msg, "content-type": contentType}]) -proc resendChatMessage*(messageId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc resendChatMessage*(messageId: string): RpcResponse[JsonNode] = result = callPrivateRPC("reSendChatMessage".prefix, %* [messageId]) -proc firstUnseenMessageID*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc firstUnseenMessageID*(chatId: string): RpcResponse[JsonNode] = let payload = %* [chatId] result = callPrivateRPC("firstUnseenMessageID".prefix, payload) -proc getTextUrls*(text: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getTextUrls*(text: string): RpcResponse[JsonNode] = let payload = %*[text] result = callPrivateRPC("getTextURLs".prefix, payload) -proc getTextURLsToUnfurl*(text: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getTextURLsToUnfurl*(text: string): RpcResponse[JsonNode] = let payload = %*[text] result = callPrivateRPC("getTextURLsToUnfurl".prefix, payload) -proc unfurlUrls*(urls: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc unfurlUrls*(urls: seq[string]): RpcResponse[JsonNode] = let payload = %*[urls] result = callPrivateRPC("unfurlURLs".prefix, payload) diff --git a/src/backend/node.nim b/src/backend/node.nim index 70bf271bab..ebf90b8324 100644 --- a/src/backend/node.nim +++ b/src/backend/node.nim @@ -4,19 +4,19 @@ import response_type export response_type -proc adminPeers*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc adminPeers*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("admin_peers", payload) -proc wakuV2Peers*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc wakuV2Peers*(): RpcResponse[JsonNode] = let payload = %* [] result = callPrivateRPC("peers".prefix, payload) -proc sendRPCMessageRaw*(inputJSON: string): string {.raises: [Exception].} = +proc sendRPCMessageRaw*(inputJSON: string): string = result = callPrivateRPCRaw(inputJSON) -proc getRpcStats*(): string {.raises: [Exception].} = +proc getRpcStats*(): string = result = callPrivateRPCNoDecode("rpcstats_getStats") -proc resetRpcStats*() {.raises: [Exception].} = +proc resetRpcStats*() = discard callPrivateRPCNoDecode("rpcstats_reset") diff --git a/src/backend/node_config.nim b/src/backend/node_config.nim index 1c36103886..90a0cd08a2 100644 --- a/src/backend/node_config.nim +++ b/src/backend/node_config.nim @@ -10,7 +10,7 @@ export response_type logScope: topics = "rpc-node-config" -proc getNodeConfig*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getNodeConfig*(): RpcResponse[JsonNode] = try: let response = status_go.getNodeConfig() result.result = response.parseJSON() @@ -19,7 +19,7 @@ proc getNodeConfig*(): RpcResponse[JsonNode] {.raises: [Exception].} = error "error doing rpc request", methodName = "getNodeConfig", exception=e.msg raise newException(RpcException, e.msg) -proc switchFleet*(fleet: string, nodeConfig: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = +proc switchFleet*(fleet: string, nodeConfig: JsonNode): RpcResponse[JsonNode] = try: info "switching fleet", fleet let response = status_go.switchFleet(fleet, $nodeConfig) @@ -28,7 +28,7 @@ proc switchFleet*(fleet: string, nodeConfig: JsonNode): RpcResponse[JsonNode] {. error "error doing rpc request", methodName = "switchFleet", exception=e.msg raise newException(RpcException, e.msg) -proc enableCommunityHistoryArchiveSupport*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc enableCommunityHistoryArchiveSupport*(): RpcResponse[JsonNode] = try: result = core.callPrivateRPC("enableCommunityHistoryArchiveProtocol".prefix) except RpcException as e: diff --git a/src/backend/privacy.nim b/src/backend/privacy.nim index 5de14953e9..3640ac2f19 100644 --- a/src/backend/privacy.nim +++ b/src/backend/privacy.nim @@ -9,7 +9,7 @@ logScope: topics = "rpc-privacy" proc changeDatabasePassword*(keyUID: string, oldHashedPassword: string, newHashedPassword: string): RpcResponse[JsonNode] - {.raises: [Exception].} = + = try: let response = status_go.changeDatabasePassword(keyUID, oldHashedPassword, newHashedPassword) result.result = Json.decode(response, JsonNode) diff --git a/src/backend/settings.nim b/src/backend/settings.nim index 91e7f83824..0b8db4bee7 100644 --- a/src/backend/settings.nim +++ b/src/backend/settings.nim @@ -3,104 +3,104 @@ import ./core, ./response_type export response_type -proc getSettings*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getSettings*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_getSettings") -proc saveSettings*(key: string, value: string | JsonNode | bool | int | int64): RpcResponse[JsonNode] {.raises: [Exception].} = +proc saveSettings*(key: string, value: string | JsonNode | bool | int | int64): RpcResponse[JsonNode] = let payload = %* [key, value] result = core.callPrivateRPC("settings_saveSetting", payload) -proc getAllowNotifications*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getAllowNotifications*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetAllowNotifications") -proc setAllowNotifications*(value: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setAllowNotifications*(value: bool): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetAllowNotifications", %* [value]) -proc getOneToOneChats*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getOneToOneChats*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetOneToOneChats") -proc setOneToOneChats*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setOneToOneChats*(value: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetOneToOneChats", %* [value]) -proc getGroupChats*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getGroupChats*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetGroupChats") -proc setGroupChats*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setGroupChats*(value: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetGroupChats", %* [value]) -proc getPersonalMentions*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getPersonalMentions*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetPersonalMentions") -proc setPersonalMentions*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setPersonalMentions*(value: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetPersonalMentions", %* [value]) -proc getGlobalMentions*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getGlobalMentions*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetGlobalMentions") -proc setGlobalMentions*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setGlobalMentions*(value: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetGlobalMentions", %* [value]) -proc getAllMessages*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getAllMessages*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetAllMessages") -proc setAllMessages*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setAllMessages*(value: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetAllMessages", %* [value]) -proc getContactRequests*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getContactRequests*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetContactRequests") -proc setContactRequests*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setContactRequests*(value: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetContactRequests", %* [value]) -proc getIdentityVerificationRequests*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getIdentityVerificationRequests*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetIdentityVerificationRequests") -proc setIdentityVerificationRequests*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setIdentityVerificationRequests*(value: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetIdentityVerificationRequests", %* [value]) -proc getSoundEnabled*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getSoundEnabled*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetSoundEnabled") -proc setSoundEnabled*(value: bool): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setSoundEnabled*(value: bool): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetSoundEnabled", %* [value]) -proc getVolume*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getVolume*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetVolume") -proc setVolume*(value: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setVolume*(value: int): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetVolume", %* [value]) -proc getMessagePreview*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getMessagePreview*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetMessagePreview") -proc setMessagePreview*(value: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setMessagePreview*(value: int): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsSetMessagePreview", %* [value]) -proc getExemptionMuteAllMessages*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getExemptionMuteAllMessages*(id: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetExMuteAllMessages", %* [id]) -proc getExemptionPersonalMentions*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getExemptionPersonalMentions*(id: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetExPersonalMentions", %* [id]) -proc getExemptionGlobalMentions*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getExemptionGlobalMentions*(id: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetExGlobalMentions", %* [id]) -proc getExemptionOtherMessages*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getExemptionOtherMessages*(id: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_notificationsGetExOtherMessages", %* [id]) proc setExemptions*(id: string, muteAllMessages: bool, personalMentions: string, globalMentions: string, - otherMessages: string): RpcResponse[JsonNode] {.raises: [Exception].} = + otherMessages: string): RpcResponse[JsonNode] = let payload = %* [id, muteAllMessages, personalMentions, globalMentions, otherMessages] return core.callPrivateRPC("settings_notificationsSetExemptions", payload) -proc deleteExemptions*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc deleteExemptions*(id: string): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_deleteExemptions", %* [id]) -proc addOrReplaceSocialLinks*(value: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addOrReplaceSocialLinks*(value: JsonNode): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_addOrReplaceSocialLinks", %* [value]) -proc getSocialLinks*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getSocialLinks*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_getSocialLinks") -proc mnemonicWasShown*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc mnemonicWasShown*(): RpcResponse[JsonNode] = return core.callPrivateRPC("settings_mnemonicWasShown") diff --git a/src/backend/status_update.nim b/src/backend/status_update.nim index 6d8d21eb24..3fd6cdc1d6 100644 --- a/src/backend/status_update.nim +++ b/src/backend/status_update.nim @@ -3,6 +3,6 @@ import ./core, ./response_type export response_type -proc setUserStatus*(newStatus: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc setUserStatus*(newStatus: int): RpcResponse[JsonNode] = let payload = %* [newStatus, ""] result = core.callPrivateRPC("wakuext_setUserStatus", payload) diff --git a/src/backend/stickers.nim b/src/backend/stickers.nim index 04aecd3f97..33e23de419 100644 --- a/src/backend/stickers.nim +++ b/src/backend/stickers.nim @@ -3,58 +3,58 @@ import ./eth import ./core, ./response_type import web3/[ethtypes, conversions] -proc market*(chainId: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc market*(chainId: int): RpcResponse[JsonNode] = let payload = %* [chainId] return core.callPrivateRPC("stickers_market", payload) -proc pending*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc pending*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("stickers_pending", payload) -proc addPending*(chainId: int, packId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addPending*(chainId: int, packId: string): RpcResponse[JsonNode] = let payload = %* [chainId, packId] result = core.callPrivateRPC("stickers_addPending", payload) -proc installed*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc installed*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("stickers_installed", payload) -proc install*(chainId: int, packId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc install*(chainId: int, packId: string): RpcResponse[JsonNode] = let payload = %* [chainId, packId] return core.callPrivateRPC("stickers_install", payload) -proc uninstall*(packId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc uninstall*(packId: string): RpcResponse[JsonNode] = let payload = %* [packId] return core.callPrivateRPC("stickers_uninstall", payload) -proc recent*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc recent*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("stickers_recent", payload) -proc addRecent*(packId: string, hash: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc addRecent*(packId: string, hash: string): RpcResponse[JsonNode] = let payload = %* [packId, hash] return core.callPrivateRPC("stickers_addRecent", payload) -proc stickerMarketAddress*(chainId: int): RpcResponse[JsonNode] {.raises: [Exception].} = +proc stickerMarketAddress*(chainId: int): RpcResponse[JsonNode] = let payload = %* [chainId] return core.callPrivateRPC("stickers_stickerMarketAddress", payload) -proc buyEstimate*(chainId: int, fromAccount: Address, packId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc buyEstimate*(chainId: int, fromAccount: Address, packId: string): RpcResponse[JsonNode] = let payload = %* [chainId, $fromAccount, packId] return core.callPrivateRPC("stickers_buyEstimate", payload) -proc buy*(chainId: int, txData: JsonNode, packId: string, hashedPassword: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc buy*(chainId: int, txData: JsonNode, packId: string, hashedPassword: string): RpcResponse[JsonNode] = let payload = %* [chainId, txData, packID, hashedPassword] return core.callPrivateRPC("stickers_buy", payload) -proc clearRecentStickers*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc clearRecentStickers*(): RpcResponse[JsonNode] = let payload = %* [] return core.callPrivateRPC("stickers_clearRecent", payload) -proc removePending*(packId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc removePending*(packId: string): RpcResponse[JsonNode] = let payload = %* [packId] return core.callPrivateRPC("stickers_removePending", payload) -proc prepareTxForBuyingStickers*(chainId: int, address: string, packId: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc prepareTxForBuyingStickers*(chainId: int, address: string, packId: string): RpcResponse[JsonNode] = let payload = %* [chainId, address, packId] result = core.callPrivateRPC("stickers_buyPrepareTx", payload) diff --git a/src/backend/transactions.nim b/src/backend/transactions.nim index b8ad07e40d..1210fbf324 100644 --- a/src/backend/transactions.nim +++ b/src/backend/transactions.nim @@ -54,30 +54,30 @@ proc `$`*(self: MultiTransactionDto): string = multiTxType:{self.multiTxType} )""" -proc getTransactionByHash*(chainId: int, hash: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getTransactionByHash*(chainId: int, hash: string): RpcResponse[JsonNode] = core.callPrivateRPCWithChainId("eth_getTransactionByHash", chainId, %* [hash]) -proc checkRecentHistory*(chainIds: seq[int], addresses: seq[string]) {.raises: [Exception].} = +proc checkRecentHistory*(chainIds: seq[int], addresses: seq[string]) = let payload = %* [chainIds, addresses] discard core.callPrivateRPC("wallet_checkRecentHistoryForChainIDs", payload) proc getTransfersByAddress*(chainId: int, address: string, toBlock: Uint256, limitAsHexWithoutLeadingZeros: string, - loadMore: bool = false): RpcResponse[JsonNode] {.raises: [Exception].} = + loadMore: bool = false): RpcResponse[JsonNode] = let toBlockParsed = if not loadMore: newJNull() else: %("0x" & stint.toHex(toBlock)) core.callPrivateRPC("wallet_getTransfersByAddressAndChainID", %* [chainId, address, toBlockParsed, limitAsHexWithoutLeadingZeros, loadMore]) -proc getTransactionReceipt*(chainId: int, transactionHash: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getTransactionReceipt*(chainId: int, transactionHash: string): RpcResponse[JsonNode] = core.callPrivateRPCWithChainId("eth_getTransactionReceipt", chainId, %* [transactionHash]) -proc fetchCryptoServices*(): RpcResponse[JsonNode] {.raises: [Exception].} = +proc fetchCryptoServices*(): RpcResponse[JsonNode] = result = core.callPrivateRPC("wallet_getCryptoOnRamps", %* []) -proc createMultiTransaction*(multiTransactionCommand: MultiTransactionCommandDto, data: seq[TransactionBridgeDto], password: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc createMultiTransaction*(multiTransactionCommand: MultiTransactionCommandDto, data: seq[TransactionBridgeDto], password: string): RpcResponse[JsonNode] = let payload = %* [multiTransactionCommand, data, password] result = core.callPrivateRPC("wallet_createMultiTransaction", payload) -proc proceedWithTransactionsSignatures*(signatures: TransactionsSignatures): RpcResponse[JsonNode] {.raises: [Exception].} = +proc proceedWithTransactionsSignatures*(signatures: TransactionsSignatures): RpcResponse[JsonNode] = var data = %* {} for key, value in signatures: data[key] = %* { "r": value.r, "s": value.s, "v": value.v } @@ -85,10 +85,10 @@ proc proceedWithTransactionsSignatures*(signatures: TransactionsSignatures): Rpc var payload = %* [data] result = core.callPrivateRPC("wallet_proceedWithTransactionsSignatures", payload) -proc getMultiTransactions*(transactionIDs: seq[int]): RpcResponse[JsonNode] {.raises: [Exception].} = +proc getMultiTransactions*(transactionIDs: seq[int]): RpcResponse[JsonNode] = let payload = %* [transactionIDs] result = core.callPrivateRPC("wallet_getMultiTransactions", payload) -proc watchTransaction*(chainId: int, hash: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc watchTransaction*(chainId: int, hash: string): RpcResponse[JsonNode] = let payload = %* [chainId, hash] core.callPrivateRPC("wallet_watchTransactionByChainID", payload) diff --git a/src/backend/visual_identity.nim b/src/backend/visual_identity.nim index 0f0817176d..cbfe7a238d 100644 --- a/src/backend/visual_identity.nim +++ b/src/backend/visual_identity.nim @@ -5,11 +5,11 @@ import status_go export response_type -proc emojiHashOf*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc emojiHashOf*(pubkey: string): RpcResponse[JsonNode] = result = Json.decode(status_go.emojiHash(pubkey), RpcResponse[JsonNode]) -proc colorHashOf*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc colorHashOf*(pubkey: string): RpcResponse[JsonNode] = result = Json.decode(status_go.colorHash(pubkey), RpcResponse[JsonNode]) -proc colorIdOf*(pubkey: string): RpcResponse[JsonNode] {.raises: [Exception].} = +proc colorIdOf*(pubkey: string): RpcResponse[JsonNode] = result = Json.decode(status_go.colorID(pubkey), RpcResponse[JsonNode]) diff --git a/vendor/nim-keycard-go b/vendor/nim-keycard-go index a1724bad72..aa05fe490b 160000 --- a/vendor/nim-keycard-go +++ b/vendor/nim-keycard-go @@ -1 +1 @@ -Subproject commit a1724bad72e83ca83df2632d83a631cd8d8ff0f6 +Subproject commit aa05fe490b57023028e242567f52bd124ed87d30 diff --git a/vendor/nim-status-go b/vendor/nim-status-go index f75bbc3831..294ee4bf49 160000 --- a/vendor/nim-status-go +++ b/vendor/nim-status-go @@ -1 +1 @@ -Subproject commit f75bbc383157285d8260365e3b95def7b259e340 +Subproject commit 294ee4bf49df10af5c877cfdc4d36a6688c0f0ca