Merge pull request #13 from webmaster128/serializable-props

Make getServerSideProps return props serializable
This commit is contained in:
samepant
2022-01-11 08:50:45 -05:00
committed by GitHub
2 changed files with 5 additions and 5 deletions
+2
View File
@@ -25,6 +25,8 @@ const thinSpace = "\u202F";
// A leading "u" is interpreted as µ (micro) and uxyz will be converted to XYZ
// for displaying.
const printableCoin = (coin) => {
if (!coin) return "";
if (coin.denom?.startsWith("u")) {
const ticker = coin.denom.slice(1).toUpperCase();
return Decimal.fromAtomics(coin.amount ?? "0", 6).toString() + thinSpace + ticker;
+3 -5
View File
@@ -13,25 +13,23 @@ import TransactionForm from "../../../components/forms/TransactionForm";
import TransactionList from "../../../components/dataViews/TransactionList";
export async function getServerSideProps(context) {
let holdings;
try {
const client = await StargateClient.connect(
process.env.NEXT_PUBLIC_NODE_ADDRESS
);
const multisigAddress = context.params.address;
holdings = await client.getBalance(
const holdings = await client.getBalance(
multisigAddress,
process.env.NEXT_PUBLIC_DENOM
);
const accountOnChain = await getMultisigAccount(multisigAddress, client);
return {
props: { accountOnChain, holdings: holdings },
props: { accountOnChain, holdings },
};
} catch (error) {
console.log(error);
return {
props: { error: error.message, holdings: holdings },
props: { error: error.message },
};
}
}