diff --git a/frontend/src/components/TradeBox.js b/frontend/src/components/TradeBox.js
index 2a0572e1..64ba4cd7 100644
--- a/frontend/src/components/TradeBox.js
+++ b/frontend/src/components/TradeBox.js
@@ -36,7 +36,10 @@ class TradeBox extends Component {
openConfirmDispute: false,
openEnableTelegram: false,
receiveTab: 0,
+ address: '',
+ miningFee: 1.05,
badInvoice: false,
+ badAddress: false,
badStatement: false,
qrscanner: false,
}
@@ -543,6 +546,42 @@ class TradeBox extends Component {
& this.props.completeSetState(data));
}
+ handleInputAddressChanged=(e)=>{
+ this.setState({
+ address: e.target.value,
+ badAddress: false,
+ });
+ }
+
+ handleMiningFeeChanged=(e)=>{
+ var fee = e.target.value
+ if (fee > 50){
+ fee = 50
+ }
+
+ this.setState({
+ miningFee: fee,
+ });
+ }
+
+ handleClickSubmitAddressButton=()=>{
+ this.setState({badInvoice:false});
+
+ const requestOptions = {
+ method: 'POST',
+ headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
+ body: JSON.stringify({
+ 'action':'update_address',
+ 'address': this.state.address,
+ 'mining_fee_rate': Math.max(1, this.state.miningFee),
+ }),
+ };
+ fetch('/api/order/' + '?order_id=' + this.props.data.id, requestOptions)
+ .then((response) => response.json())
+ .then((data) => this.setState({badAddress:data_address})
+ & this.props.completeSetState(data));
+}
+
handleInputDisputeChanged=(e)=>{
this.setState({
statement: e.target.value,
@@ -608,7 +647,6 @@ class TradeBox extends Component {
-
{t("The taker is committed! Before letting you send {{amountFiat}} {{currencyCode}}, we want to make sure you are able to receive the BTC.",
@@ -616,15 +654,17 @@ class TradeBox extends Component {
currencyCode: this.props.data.currencyCode})}
-
+
-
+
Lightning} onClick={() => this.setState({receiveTab:0})}/>
- Onchain} disabled={!this.props.data.swap_allowed} onClick={() => this.setState({receiveTab:1})} />
+ Onchain} disabled={!this.props.data.swap_allowed} onClick={() => this.setState({receiveTab:1, miningFee: this.props.data.suggested_mining_fee_rate})} />
-
+
+
+
{/* LIGHTNING PAYOUT TAB */}
@@ -674,59 +714,73 @@ class TradeBox extends Component {
- {/* ONCHAIN PAYOUT TAB */}
-
-
-
-
-
- {t("RoboSats will perform an on-the-fly reverse submarine swap and send to an onchain address for a fee. Submit onchain address. Preliminary {{amountSats}} Sats, swap allowed {{swapAllowed}}, swap fee {{swapFee}}%, mining fee suggested {{suggestedMiningFee}} Sats/vbyte",
- {amountSats: this.props.data.invoice_amount,
- swapAllowed: this.props.data.swap_allowed,
- swapFee: this.props.data.swap_fee_rate ,
- suggestedMiningFee: this.props.data.suggested_mining_fee_rate}
- )
- }
-
-
-
-
- {t("Swap fee: {{swapFeeSats}}Sats ({{swapFeeRate}}%)",
- {swapFeeSats: this.props.data.invoice_amount * this.state.swap_fee_rate/100,
- swapFeeRate: this.state.swap_fee_rate})
- }
-
-
- {t("Mining fee: {{miningFee}}Sats ({{swapFeeRate}}%)",
- {miningFee: this.props.data.suggestedMiningFee * 141})}
-
-
- {t("You receive: {{onchainAmount}}Sats)",
- {onchainAmount: pn(parseInt(this.props.data.invoice_amount - (this.props.data.suggestedMiningFee * 141) - (this.props.data.invoice_amount * this.state.swap_fee_rate/100)))})}
-
-
-
-
-
+ {/* ONCHAIN PAYOUT TAB */}
+
+
+
+
+ {t("RoboSats will do a swap and send the Sats to your onchain address for a fee.")}
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ {pn(parseInt(this.props.data.invoice_amount - (Math.max(1, this.state.miningFee) * 141) - (this.props.data.invoice_amount * this.props.data.swap_fee_rate/100)))+ " Sats"}}
+ secondary={t("Final amount you will receive")}/>
+
+
+
+
50}
+ helperText={this.state.miningFee < 1 || this.state.miningFee > 50 ? "Invalid" : ''}
+ label={t("Mining Fee")}
+ required
+ sx={{width:110}}
+ value={this.state.miningFee}
+ type="number"
+ inputProps={{
+ max:50,
+ min:1,
+ style: {textAlign:"center"},
+ }}
+ onChange={this.handleMiningFeeChanged}
+ />
+
+
+
+
-
-
+
+