I need to know if I can get the balance of a certain token (not all) directly with api.
My other doubts are on the line comment!
import React from “react”;
import useAxios from “use-axios-client”;
import tokenContractAbi from “…/…/app/abi”;
const InfoContract = ({ MoralisAPI }) => {
const dataABI = JSON.stringify(tokenContractAbi);
const config = {
ssrData: MoralisAPI,
method: "post",
url: `url..url...MoralisServer`,
headers: {
accept: "application/json",
"X-API-Key": "APIkeyMoralis",
"Content-Type": "application/json",
},
data: dataABI,
};
//I need to multiply the value of one request with another and render this value already multiplied in the element being exported
const { data, error} = useAxios(config);
return (
<div>
{error && <div></div>}
{data && (
<pre>{JSON.parse(data /**I need the data here from a second request, and to know if that would work too.*/ / 10 ** 36, undefined, 2).toFixed(2)} CAKE</pre>
)}
</div>
);
};
const dividendsPerShare = ({ MoralisAPI }) => (
<>
<InfoContract MoralisAPI={MoralisAPI} />
</>
);
// this element is already being rendered in the app but I need the response from another request to multiply by this value.
export default dividendsPerShare;Preformatted text