Simplify multisigAddress use
This commit is contained in:
@@ -29,14 +29,14 @@ const Multipage = () => {
|
||||
|
||||
const [txType, setTxType] = useState<TxType | null>(null);
|
||||
const [holdings, setHoldings] = useState<readonly Coin[]>([]);
|
||||
const [multisigAddress, setMultisigAddress] = useState("");
|
||||
const [accountOnChain, setAccountOnChain] = useState<Account | null>(null);
|
||||
const [pubkey, setPubkey] = useState<MultisigThresholdPubkey>();
|
||||
const [accountError, setAccountError] = useState(null);
|
||||
|
||||
const multisigAddress = router.query.address?.toString();
|
||||
const explorerHref = explorerLinkAccount(
|
||||
process.env.NEXT_PUBLIC_EXPLORER_LINK_ACCOUNT || "",
|
||||
multisigAddress,
|
||||
multisigAddress || "",
|
||||
);
|
||||
|
||||
const closeForm = () => {
|
||||
@@ -70,12 +70,10 @@ const Multipage = () => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const address = router.query.address?.toString();
|
||||
if (address) {
|
||||
setMultisigAddress(address);
|
||||
fetchMultisig(address);
|
||||
if (multisigAddress) {
|
||||
fetchMultisig(multisigAddress);
|
||||
}
|
||||
}, [fetchMultisig, router.query.address]);
|
||||
}, [fetchMultisig, multisigAddress]);
|
||||
|
||||
return (
|
||||
<Page>
|
||||
@@ -107,7 +105,7 @@ const Multipage = () => {
|
||||
</div>
|
||||
</StackableContainer>
|
||||
) : null}
|
||||
{!!txType && !!accountOnChain ? (
|
||||
{txType && multisigAddress && accountOnChain ? (
|
||||
<CreateTxForm
|
||||
txType={txType}
|
||||
senderAddress={multisigAddress}
|
||||
|
||||
@@ -55,13 +55,11 @@ export const getServerSideProps: GetServerSideProps = async (context): Promise<P
|
||||
};
|
||||
|
||||
const TransactionPage = ({
|
||||
multisigAddress,
|
||||
transactionJSON,
|
||||
transactionID,
|
||||
signatures,
|
||||
txHash,
|
||||
}: {
|
||||
multisigAddress: string;
|
||||
transactionJSON: string;
|
||||
transactionID: string;
|
||||
signatures: DbSignature[];
|
||||
@@ -77,6 +75,7 @@ const TransactionPage = ({
|
||||
const [accountError, setAccountError] = useState(null);
|
||||
const txInfo: DbTransaction = transactionJSON ? JSON.parse(transactionJSON) : null;
|
||||
const router = useRouter();
|
||||
const multisigAddress = router.query.address?.toString();
|
||||
|
||||
const addSignature = (signature: DbSignature) => {
|
||||
setCurrentSignatures((prevState: DbSignature[]) => [...prevState, signature]);
|
||||
@@ -101,11 +100,10 @@ const TransactionPage = ({
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const address = router.query.address?.toString();
|
||||
if (address) {
|
||||
fetchMultisig(address);
|
||||
if (multisigAddress) {
|
||||
fetchMultisig(multisigAddress);
|
||||
}
|
||||
}, [fetchMultisig, router.query.address]);
|
||||
}, [fetchMultisig, multisigAddress]);
|
||||
|
||||
const broadcastTx = async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user