Skip to content

Commit

Permalink
query update
Browse files Browse the repository at this point in the history
  • Loading branch information
0xk0stas committed Oct 12, 2023
1 parent cb08440 commit 4684ebd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 29 deletions.
24 changes: 1 addition & 23 deletions src/views/Home/hooks/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -23,7 +21,6 @@ export const useGetUserInfo = (email: string, platform: string) => {
},
{
fallbackData: {
username: "",
address: "",
secretWords: [""]
},
Expand All @@ -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();
};
9 changes: 3 additions & 6 deletions src/views/Home/services/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,22 @@ import BigNumber from "bignumber.js";
export const fetchUserInfo = async (email: string, platform: string): Promise<IScUserInfo> => {

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());
}

Expand Down

0 comments on commit 4684ebd

Please sign in to comment.