This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Split Merge in the playground into a new file - Check that the destination is funded
- Loading branch information
Morley Zhi
authored
May 5, 2020
1 parent
35cb12b
commit 50bbd4d
Showing
3 changed files
with
75 additions
and
24 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
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,52 @@ | ||
import React, { Component } from "react"; | ||
import { StrKey } from "stellar-sdk"; | ||
|
||
import TransactionViewer from "components/TransactionViewer"; | ||
|
||
const STORAGE_KEY = "merge-transaction-destination"; | ||
|
||
class MergeTransaction extends Component { | ||
state = { | ||
destination: localStorage.getItem(STORAGE_KEY), | ||
tx: null, | ||
}; | ||
|
||
render() { | ||
const { destination, tx } = this.state; | ||
|
||
const handleDestination = (ev) => { | ||
const dest = ev.target.value; | ||
if (StrKey.isValidEd25519PublicKey(dest)) { | ||
localStorage.setItem(STORAGE_KEY, dest); | ||
} | ||
this.setState({ destination: dest }); | ||
}; | ||
|
||
const handleGetTransaction = async () => { | ||
try { | ||
const trans = await this.props.dataProvider.getStripAndMergeAccountTransaction( | ||
destination, | ||
); | ||
this.setState({ tx: trans }); | ||
} catch (e) { | ||
debugger; | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h3>Merge into another account</h3> | ||
|
||
<input type="text" value={destination} onChange={handleDestination} /> | ||
|
||
{destination && ( | ||
<button onClick={handleGetTransaction}>Run merge command</button> | ||
)} | ||
|
||
{tx && <TransactionViewer transaction={tx} />} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default MergeTransaction; |
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