-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display QRCode on publish multi-sig transaction
typo error in create multi-sig wallet
- Loading branch information
Showing
3 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as wasm from 'ergo-lib-wasm-browser'; | ||
import { useEffect, useState } from 'react'; | ||
import StateMessage from '../state-message/StateMessage'; | ||
import { CircularProgress } from '@mui/material'; | ||
import DisplayQRCode from '../display-qrcode/DisplayQRCode'; | ||
import { QrCodeTypeEnum } from '@/types/qrcode'; | ||
|
||
interface DisplaySignedTxPropsType { | ||
tx?: wasm.Transaction; | ||
} | ||
|
||
export const DisplaySignedTx = (props: DisplaySignedTxPropsType) => { | ||
const [loading, setLoading] = useState(false); | ||
const [tx, setTx] = useState(''); | ||
const [txId, setTxId] = useState(''); | ||
useEffect(() => { | ||
if (!loading && props.tx) { | ||
const tx = props.tx; | ||
const id = tx.id().to_str(); | ||
if (id !== txId) { | ||
setLoading(true); | ||
setTx(Buffer.from(tx.sigma_serialize_bytes()).toString('base64')); | ||
setTxId(id); | ||
setLoading(false); | ||
} | ||
} | ||
}, [loading, props.tx, txId]); | ||
if (loading || props.tx === undefined) { | ||
return ( | ||
<StateMessage | ||
title={''} | ||
description="Loading" | ||
icon={<CircularProgress />} | ||
color="default" | ||
/> | ||
); | ||
} | ||
return <DisplayQRCode type={QrCodeTypeEnum.ColdSignTransaction} value={tx} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters