From 4684ebdfaadf2afa871ed2e6e4a9addc7dca92f2 Mon Sep 17 00:00:00 2001 From: Kostas Tzoumpas Date: Thu, 12 Oct 2023 14:28:51 +0300 Subject: [PATCH] query update --- src/views/Home/hooks/hooks.ts | 24 +----------------------- src/views/Home/services/queries.ts | 9 +++------ 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/views/Home/hooks/hooks.ts b/src/views/Home/hooks/hooks.ts index 92d9269..9972151 100644 --- a/src/views/Home/hooks/hooks.ts +++ b/src/views/Home/hooks/hooks.ts @@ -3,8 +3,6 @@ import { AddressValue, BigUIntValue } from "@multiversx/sdk-core/out"; -// import { useAppSelector } from "../../../components/utils/hooks/redux"; -// import { selectUserAddress } from "../../../redux/slices/userAccount/account-slice"; import useSwr from "swr"; import { ApiNetworkProvider, ProxyNetworkProvider } from "@multiversx/sdk-network-providers"; import { ChainId, network } from "../../../api/net.config"; @@ -23,7 +21,6 @@ export const useGetUserInfo = (email: string, platform: string) => { }, { fallbackData: { - username: "", address: "", secretWords: [""] }, @@ -35,23 +32,4 @@ export const useGetUserInfo = (email: string, platform: string) => { isLoadingUserInfo: isLoading, errorUserInfo: error, }; -}; - - - -// if (!relayerAddressFromEnv || !relayerPemFromEnv) { -// return null; -// } - -// const relayerAddress = new Address(relayerAddressFromEnv); -// const relayerAccount = new Account(relayerAddress); -// const relayerOnNetwork = await apiNetworkProvider.getAccount(relayerAddress); -// relayerAccount.update(relayerOnNetwork); - -// const relayed_tx = new RelayedTransactionV2Builder() -// .setInnerTransaction(inner_tx) -// .setInnerTransactionGasLimit(gasLimit) -// .setRelayerAddress(relayerAddress) -// .setRelayerNonce(relayerAccount.nonce) -// .setNetworkConfig(networkConfig) -// .build(); \ No newline at end of file +}; \ No newline at end of file diff --git a/src/views/Home/services/queries.ts b/src/views/Home/services/queries.ts index af1449f..462fc6f 100644 --- a/src/views/Home/services/queries.ts +++ b/src/views/Home/services/queries.ts @@ -11,25 +11,22 @@ import BigNumber from "bignumber.js"; export const fetchUserInfo = async (email: string, platform: string): Promise => { let scRes: any = await scQuery("xloginWsp", "getUserInfo", [ - BytesValue.fromUTF8(email), - BytesValue.fromUTF8(platform) + BytesValue.fromUTF8(email) ]); let data = scRes?.firstValue; let finalData: IScUserInfo = { - username: "", address: "", secretWords: [] }; - finalData.username = data.items[0].valueOf().toString(); - const address = new Address(data.items[1].valueOf()); + const address = new Address(data.items[0].valueOf()); finalData.address = address.bech32(); finalData.secretWords = []; - for (let i = 2; i < data.items.length; i++) { + for (let i = 1; i < data.items.length; i++) { finalData.secretWords.push(data.items[i].valueOf().toString()); }