Fix send amount to address

This commit is contained in:
Jonas Whidden 2016-07-22 10:33:05 -05:00 committed by Alex Liebowitz
parent 31cf170e35
commit a9d95bf76b
2 changed files with 8 additions and 4 deletions

View file

@ -98,9 +98,9 @@ lbry.getBalance = function(callback)
lbry.call("get_balance", {}, callback);
}
lbry.sendToAddress = function(amount, address, callback)
lbry.sendToAddress = function(amount, address, callback, errorCallback)
{
lbry.call("send_to_address", { "amount" : amount, "address": address }, callback);
lbry.call("send_amount_to_address", { "amount" : amount, "address": address }, callback, errorCallback);
}
lbry.search = function(query, callback)

View file

@ -40,6 +40,10 @@ var SendToAddressSection = React.createClass({
results: "Something went wrong: " + results
});
}
}, (error) => {
this.setState({
results: "Something went wrong: " + error.faultString + " " + error.faultCode
})
});
},
getInitialState: function() {
@ -59,7 +63,7 @@ var SendToAddressSection = React.createClass({
},
setAmount: function(event) {
this.setState({
amount: event.target.value,
amount: parseFloat(event.target.value),
})
},
setAddress: function(event) {
@ -72,7 +76,7 @@ var SendToAddressSection = React.createClass({
<div>
<h1>Send To Address:</h1>
<label for="balance">Balance: {this.state.balance}</label><br />
<label for="amount">Amount:</label> <input id="amount" type="number" size="10" onChange={this.setAmount}></input><br />
<label for="amount">Amount:</label> <input id="amount" type="text" size="10" onChange={this.setAmount}></input><br />
<label for="address">Address:</label> <input id="address" type="text" size="60" onChange={this.setAddress}></input><br />
<button type="button" onClick={this.sendToAddress}>Send Amount to Address</button><br /><br />
<h4>Results:</h4>