Skip to content

Commit

Permalink
Known Adresses | Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
15Dkatz committed Sep 29, 2022
1 parent 3581f48 commit 4a9ef45
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
22 changes: 20 additions & 2 deletions client/dist/src.e31bb0bc.js
Expand Up @@ -46883,7 +46883,8 @@ var ConductTransaction = /*#__PURE__*/function (_Component) {

_defineProperty(_assertThisInitialized(_this), "state", {
recipient: '',
amount: 0
amount: 0,
knownAddresses: []
});

_defineProperty(_assertThisInitialized(_this), "updateRecipient", function (event) {
Expand Down Expand Up @@ -46924,13 +46925,30 @@ var ConductTransaction = /*#__PURE__*/function (_Component) {
}

_createClass(ConductTransaction, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;

fetch("".concat(document.location.origin, "/api/known-addresses")).then(function (response) {
return response.json();
}).then(function (json) {
return _this2.setState({
knownAddresses: json
});
});
}
}, {
key: "render",
value: function render() {
return /*#__PURE__*/_react.default.createElement("div", {
className: "ConductTransaction"
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Link, {
to: "/"
}, "Home"), /*#__PURE__*/_react.default.createElement("h3", null, "Conduct a Transaction"), /*#__PURE__*/_react.default.createElement(_reactBootstrap.FormGroup, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.FormControl, {
}, "Home"), /*#__PURE__*/_react.default.createElement("h3", null, "Conduct a Transaction"), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("h4", null, "Known Addresses"), this.state.knownAddresses.map(function (knownAddress) {
return /*#__PURE__*/_react.default.createElement("div", {
key: knownAddress
}, /*#__PURE__*/_react.default.createElement("div", null, knownAddress), /*#__PURE__*/_react.default.createElement("br", null));
}), /*#__PURE__*/_react.default.createElement(_reactBootstrap.FormGroup, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.FormControl, {
input: "text",
placeholder: "recipient",
value: this.state.recipient,
Expand Down
2 changes: 1 addition & 1 deletion client/dist/src.e31bb0bc.js.map

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion client/src/components/ConductTransaction.js
Expand Up @@ -4,7 +4,13 @@ import { Link } from 'react-router-dom';
import history from '../history';

class ConductTransaction extends Component {
state = { recipient: '', amount: 0 };
state = { recipient: '', amount: 0, knownAddresses: [] };

componentDidMount() {
fetch(`${document.location.origin}/api/known-addresses`)
.then(response => response.json())
.then(json => this.setState({ knownAddresses: json }));
}

updateRecipient = event => {
this.setState({ recipient: event.target.value });
Expand Down Expand Up @@ -33,6 +39,18 @@ class ConductTransaction extends Component {
<div className='ConductTransaction'>
<Link to='/'>Home</Link>
<h3>Conduct a Transaction</h3>
<br />
<h4>Known Addresses</h4>
{
this.state.knownAddresses.map(knownAddress => {
return (
<div key={knownAddress}>
<div>{knownAddress}</div>
<br />
</div>
)
})
}
<FormGroup>
<FormControl
input='text'
Expand Down

0 comments on commit 4a9ef45

Please sign in to comment.