Merge pull request #13 from webmaster128/serializable-props
Make getServerSideProps return props serializable
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user