mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex-taker-v2.git
synced 2026-09-21 16:52:01 -07:00
fix(sweep): Added button to sweep DEX offers
This commit is contained in:
@@ -101,6 +101,32 @@ const SweepWif = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleCancelCounterOffers = async () => {
|
||||||
|
try {
|
||||||
|
console.log(`Executing handleCancelCounterOffers()`)
|
||||||
|
|
||||||
|
// Set modal initial state
|
||||||
|
// setShowModal(true)
|
||||||
|
// setHideSpinner(false)
|
||||||
|
// setStatusMsg('')
|
||||||
|
|
||||||
|
// Get the keypair that holds Counter Offer UTXOs.
|
||||||
|
const bchDexLib = appData.dexLib
|
||||||
|
const keyPair = await bchDexLib.take.util.getKeyPair(1)
|
||||||
|
const wif = keyPair.wif
|
||||||
|
// console.log(`WIF: ${wif}`)
|
||||||
|
|
||||||
|
// Sweep the private key holding the Counter Offer UTXOs.
|
||||||
|
setWifToSweep(wif)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
await handleSweep()
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error in handleCancelCounterOffers(): ', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Modal component
|
// Modal component
|
||||||
const getModal = () => (
|
const getModal = () => (
|
||||||
<Modal show={showModal} size='lg' onHide={() => setShowModal(false)}>
|
<Modal show={showModal} size='lg' onHide={() => setShowModal(false)}>
|
||||||
@@ -178,6 +204,29 @@ const SweepWif = (props) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<Row>
|
||||||
|
<Col>
|
||||||
|
<p>
|
||||||
|
When a Buy order is created, the coins (UTXO) to pay for it are
|
||||||
|
moved to a secondary address. Clicking the button below will
|
||||||
|
sweep those funds back into this main wallet. This will also
|
||||||
|
cancel/invalidate all open Counter Offers that you've created.
|
||||||
|
</p>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
|
<Row style={{ textAlign: 'center' }}>
|
||||||
|
<Col>
|
||||||
|
<Button onClick={handleCancelCounterOffers}>
|
||||||
|
Sweep DEX Trading Wallet
|
||||||
|
</Button>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
{showModal && getModal()}
|
{showModal && getModal()}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user