Fix explicit sats frontend. Fix float max sats routing fee

This commit is contained in:
Reckless_Satoshi 2022-01-27 09:43:17 -08:00
parent 6ab8f86b97
commit 753e80c589
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 11 additions and 11 deletions

View File

@ -186,7 +186,7 @@ class LNNode():
def pay_invoice(cls, invoice, num_satoshis): def pay_invoice(cls, invoice, num_satoshis):
'''Sends sats to buyer''' '''Sends sats to buyer'''
fee_limit_sat = max(num_satoshis * 0.0002, 10) # 200 ppm or 10 sats fee_limit_sat = int(max(num_satoshis * 0.0002, 10)) # 200 ppm or 10 sats
request = routerrpc.SendPaymentRequest( request = routerrpc.SendPaymentRequest(
payment_request=invoice, payment_request=invoice,
fee_limit_sat=fee_limit_sat, fee_limit_sat=fee_limit_sat,

View File

@ -82,7 +82,7 @@ export default class InfoDialog extends Component {
<p> To be totally clear. Trust requirements are minimized. However, there is still <p> To be totally clear. Trust requirements are minimized. However, there is still
one way <i>RoboSats </i> could run away with your satoshis: by not releasing one way <i>RoboSats </i> could run away with your satoshis: by not releasing
the satoshis to the buyer. It could be argued that such move is not in <i>RoboSats' </i> the satoshis to the buyer. It could be argued that such move is not in <i>RoboSats' </i>
as it would damage the reputation for a small payout. interest as it would damage the reputation for a small payout.
However, you should hesitate and only trade small quantities at a However, you should hesitate and only trade small quantities at a
time. For large amounts use an onchain escrow service such as <i>Bisq</i> time. For large amounts use an onchain escrow service such as <i>Bisq</i>
</p> </p>

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Paper, Alert, AlertTitle, Button , Grid, Typography, TextField, Select, FormHelperText, MenuItem, FormControl, Radio, FormControlLabel, RadioGroup, Menu} from "@mui/material" import { Paper, Button , Grid, Typography, TextField, Select, FormHelperText, MenuItem, FormControl, Radio, FormControlLabel, RadioGroup} from "@mui/material"
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import getFlags from './getFlags' import getFlags from './getFlags'
@ -37,7 +37,7 @@ export default class MakerPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state={ this.state={
isExplicit: false, is_explicit: false,
type: 0, type: 0,
currency: this.defaultCurrency, currency: this.defaultCurrency,
currencyCode: this.defaultCurrencyCode, currencyCode: this.defaultCurrencyCode,
@ -89,14 +89,14 @@ export default class MakerPage extends Component {
} }
handleClickRelative=(e)=>{ handleClickRelative=(e)=>{
this.setState({ this.setState({
isExplicit: false, is_explicit: false,
satoshis: null, satoshis: null,
premium: 0, premium: 0,
}); });
} }
handleClickExplicit=(e)=>{ handleClickExplicit=(e)=>{
this.setState({ this.setState({
isExplicit: true, is_explicit: true,
premium: null, premium: null,
}); });
} }
@ -113,7 +113,7 @@ export default class MakerPage extends Component {
currency: this.state.currency, currency: this.state.currency,
amount: this.state.amount, amount: this.state.amount,
payment_method: this.state.payment_method, payment_method: this.state.payment_method,
is_explicit: this.state.isExplicit, is_explicit: this.state.is_explicit,
premium: this.state.premium, premium: this.state.premium,
satoshis: this.state.satoshis, satoshis: this.state.satoshis,
}), }),
@ -241,7 +241,7 @@ export default class MakerPage extends Component {
</FormControl> </FormControl>
</Grid> </Grid>
{/* conditional shows either Premium % field or Satoshis field based on pricing method */} {/* conditional shows either Premium % field or Satoshis field based on pricing method */}
{ this.state.isExplicit { this.state.is_explicit
? <Grid item xs={12} align="center"> ? <Grid item xs={12} align="center">
<TextField <TextField
label="Satoshis" label="Satoshis"
@ -287,7 +287,7 @@ export default class MakerPage extends Component {
<Typography component="subtitle2" variant="subtitle2"> <Typography component="subtitle2" variant="subtitle2">
<div align='center'> <div align='center'>
Create a BTC {this.state.type==0 ? "buy":"sell"} order for {this.state.amount} {this.state.currencyCode} Create a BTC {this.state.type==0 ? "buy":"sell"} order for {this.state.amount} {this.state.currencyCode}
{this.state.isExplicit ? " of " + this.state.satoshis + " Satoshis" : {this.state.is_explicit ? " of " + this.state.satoshis + " Satoshis" :
(this.state.premium == 0 ? " at market price" : (this.state.premium == 0 ? " at market price" :
(this.state.premium > 0 ? " at a " + this.state.premium + "% premium":" at a " + -this.state.premium + "% discount") (this.state.premium > 0 ? " at a " + this.state.premium + "% premium":" at a " + -this.state.premium + "% discount")
) )

View File

@ -37,7 +37,7 @@ export default class OrderPage extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
isExplicit: false, is_explicit: false,
delay: 60000, // Refresh every 60 seconds by default delay: 60000, // Refresh every 60 seconds by default
currencies_dict: {"1":"USD"}, currencies_dict: {"1":"USD"},
total_secs_exp: 300, total_secs_exp: 300,
@ -412,7 +412,7 @@ export default class OrderPage extends Component {
{this.state.price_now? {this.state.price_now?
<ListItemText primary={pn(this.state.price_now)+" "+this.state.currencyCode+"/BTC - Premium: "+this.state.premium_now+"%"} secondary="Price and Premium"/> <ListItemText primary={pn(this.state.price_now)+" "+this.state.currencyCode+"/BTC - Premium: "+this.state.premium_now+"%"} secondary="Price and Premium"/>
: :
(this.state.isExplicit ? (this.state.is_explicit ?
<ListItemText primary={pn(this.state.satoshis)} secondary="Amount of Satoshis"/> <ListItemText primary={pn(this.state.satoshis)} secondary="Amount of Satoshis"/>
: :
<ListItemText primary={parseFloat(parseFloat(this.state.premium).toFixed(2))+"%"} secondary="Premium over market price"/> <ListItemText primary={parseFloat(parseFloat(this.state.premium).toFixed(2))+"%"} secondary="Premium over market price"/>