mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 12:11:35 +00:00
Remodel usergen form. Add fee limit hparams.
This commit is contained in:
parent
c21e230c76
commit
64115a8bb5
@ -43,5 +43,10 @@ INVOICE_AND_ESCROW_DURATION = 30
|
|||||||
# Time to confim chat and confirm fiat (time to Fiat Sent confirmation) HOURS
|
# Time to confim chat and confirm fiat (time to Fiat Sent confirmation) HOURS
|
||||||
FIAT_EXCHANGE_DURATION = 4
|
FIAT_EXCHANGE_DURATION = 4
|
||||||
|
|
||||||
|
# Proportional routing fee limit (fraction of total payout: % / 100)
|
||||||
|
PROPORTIONAL_ROUTING_FEE_LIMIT = 0.0002
|
||||||
|
# Base flat limit fee for routing in Sats (used only when proportional is lower than this)
|
||||||
|
MIN_FLAT_ROUTING_FEE_LIMIT = 10
|
||||||
|
|
||||||
# Username for HTLCs escrows
|
# Username for HTLCs escrows
|
||||||
ESCROW_USERNAME = 'admin'
|
ESCROW_USERNAME = 'admin'
|
@ -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 = int(max(num_satoshis * 0.0002, 10)) # 200 ppm or 10 sats
|
fee_limit_sat = int(max(num_satoshis * float(config('PROPORTIONAL_ROUTING_FEE_LIMIT')), float(config('MIN_FLAT_ROUTING_FEE_LIMIT')))) # 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,
|
||||||
|
@ -24,8 +24,7 @@ export default class BookPage extends Component {
|
|||||||
getOrderDetails(type, currency) {
|
getOrderDetails(type, currency) {
|
||||||
fetch('/api/book' + '?currency=' + currency + "&type=" + type)
|
fetch('/api/book' + '?currency=' + currency + "&type=" + type)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => console.log(data) &
|
.then((data) => this.setState({
|
||||||
this.setState({
|
|
||||||
orders: data,
|
orders: data,
|
||||||
not_found: data.not_found,
|
not_found: data.not_found,
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -33,7 +32,6 @@ export default class BookPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleRowClick=(e)=>{
|
handleRowClick=(e)=>{
|
||||||
console.log(e)
|
|
||||||
this.props.history.push('/order/' + e);
|
this.props.history.push('/order/' + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,9 @@ export default class BottomBar extends Component {
|
|||||||
// TODO Link to router and do this.props.history.push
|
// TODO Link to router and do this.props.history.push
|
||||||
<ListItemButton component="a" href={window.location.origin +'/order/'+this.state.active_order_id}>
|
<ListItemButton component="a" href={window.location.origin +'/order/'+this.state.active_order_id}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<NumbersIcon color="primary"/>
|
<Badge badgeContent="" color="primary">
|
||||||
|
<NumbersIcon color="primary"/>
|
||||||
|
</Badge>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={'One active order #'+this.state.active_order_id} secondary="Your current order"/>
|
<ListItemText primary={'One active order #'+this.state.active_order_id} secondary="Your current order"/>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
@ -255,7 +257,7 @@ bottomBarDesktop =()=>{
|
|||||||
<Grid item xs={2}>
|
<Grid item xs={2}>
|
||||||
<ListItemButton onClick={this.handleClickOpenProfile} >
|
<ListItemButton onClick={this.handleClickOpenProfile} >
|
||||||
<ListItemAvatar sx={{ width: 30, height: 30 }} >
|
<ListItemAvatar sx={{ width: 30, height: 30 }} >
|
||||||
<Badge badgeContent={(this.state.active_order_id > 0 & !this.state.profileShown) ? "1": null} color="primary">
|
<Badge badgeContent={(this.state.active_order_id > 0 & !this.state.profileShown) ? "": null} color="primary">
|
||||||
<Avatar className='rotatedAvatar' sx={{margin: 0, top: -13}}
|
<Avatar className='rotatedAvatar' sx={{margin: 0, top: -13}}
|
||||||
alt={this.props.nickname}
|
alt={this.props.nickname}
|
||||||
src={this.props.nickname ? window.location.origin +'/static/assets/avatars/' + this.props.nickname + '.png' : null}
|
src={this.props.nickname ? window.location.origin +'/static/assets/avatars/' + this.props.nickname + '.png' : null}
|
||||||
|
@ -103,7 +103,6 @@ export default class MakerPage extends Component {
|
|||||||
handleCreateOfferButtonPressed=()=>{
|
handleCreateOfferButtonPressed=()=>{
|
||||||
this.state.amount == null ? this.setState({amount: 0}) : null;
|
this.state.amount == null ? this.setState({amount: 0}) : null;
|
||||||
|
|
||||||
console.log(this.state)
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken')},
|
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken')},
|
||||||
|
@ -184,7 +184,6 @@ export default class OrderPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleClickTakeOrderButton=()=>{
|
handleClickTakeOrderButton=()=>{
|
||||||
console.log(this.state)
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
|
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
|
||||||
@ -216,7 +215,6 @@ export default class OrderPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleClickConfirmCancelButton=()=>{
|
handleClickConfirmCancelButton=()=>{
|
||||||
console.log(this.state)
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
|
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
|
||||||
@ -226,7 +224,7 @@ export default class OrderPage extends Component {
|
|||||||
};
|
};
|
||||||
fetch('/api/order/' + '?order_id=' + this.orderId, requestOptions)
|
fetch('/api/order/' + '?order_id=' + this.orderId, requestOptions)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => (console.log(data) & this.getOrderDetails(data.id)));
|
.then((data) => this.getOrderDetails(data.id));
|
||||||
this.handleClickCloseConfirmCancelDialog();
|
this.handleClickCloseConfirmCancelDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +260,6 @@ export default class OrderPage extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleClickConfirmCollaborativeCancelButton=()=>{
|
handleClickConfirmCollaborativeCancelButton=()=>{
|
||||||
console.log(this.state)
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
|
headers: {'Content-Type':'application/json', 'X-CSRFToken': getCookie('csrftoken'),},
|
||||||
@ -272,7 +269,7 @@ export default class OrderPage extends Component {
|
|||||||
};
|
};
|
||||||
fetch('/api/order/' + '?order_id=' + this.orderId, requestOptions)
|
fetch('/api/order/' + '?order_id=' + this.orderId, requestOptions)
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => (console.log(data) & this.getOrderDetails(data.id)));
|
.then((data) => this.getOrderDetails(data.id));
|
||||||
this.handleClickCloseCollaborativeCancelDialog();
|
this.handleClickCloseCollaborativeCancelDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,6 @@ export default class TradeBox extends Component {
|
|||||||
|
|
||||||
// Asks the user for a dispute statement.
|
// Asks the user for a dispute statement.
|
||||||
showInDisputeStatement=()=>{
|
showInDisputeStatement=()=>{
|
||||||
console.log(this.props.data.statement_submitted)
|
|
||||||
if(this.props.data.statement_submitted){
|
if(this.props.data.statement_submitted){
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={1}>
|
<Grid container spacing={1}>
|
||||||
|
@ -3,7 +3,8 @@ import { Button , Dialog, Grid, Typography, TextField, ButtonGroup, CircularProg
|
|||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import Image from 'material-ui-image'
|
import Image from 'material-ui-image'
|
||||||
import InfoDialog from './InfoDialog'
|
import InfoDialog from './InfoDialog'
|
||||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
import PublishIcon from '@mui/icons-material/Publish';
|
||||||
|
import CasinoIcon from '@mui/icons-material/Casino';
|
||||||
import ContentCopy from "@mui/icons-material/ContentCopy";
|
import ContentCopy from "@mui/icons-material/ContentCopy";
|
||||||
|
|
||||||
function getCookie(name) {
|
function getCookie(name) {
|
||||||
@ -29,7 +30,8 @@ export default class UserGenPage extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
token: this.genBase62Token(34),
|
token: this.genBase62Token(34),
|
||||||
openInfo: false,
|
openInfo: false,
|
||||||
showRobosat: true,
|
loadingRobot: true,
|
||||||
|
tokenHasChanged: false,
|
||||||
};
|
};
|
||||||
this.getGeneratedUser(this.state.token);
|
this.getGeneratedUser(this.state.token);
|
||||||
}
|
}
|
||||||
@ -56,7 +58,7 @@ export default class UserGenPage extends Component {
|
|||||||
shannon_entropy: data.token_shannon_entropy,
|
shannon_entropy: data.token_shannon_entropy,
|
||||||
bad_request: data.bad_request,
|
bad_request: data.bad_request,
|
||||||
found: data.found,
|
found: data.found,
|
||||||
showRobosat:true,
|
loadingRobot:false,
|
||||||
})
|
})
|
||||||
&
|
&
|
||||||
// Add nick and token to App state (token only if not a bad request)
|
// Add nick and token to App state (token only if not a bad request)
|
||||||
@ -81,23 +83,24 @@ export default class UserGenPage extends Component {
|
|||||||
.then((data) => console.log(data));
|
.then((data) => console.log(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleAnotherButtonPressed=(e)=>{
|
handleClickNewRandomToken=()=>{
|
||||||
this.delGeneratedUser()
|
this.setState({
|
||||||
// this.setState({
|
token: this.genBase62Token(34),
|
||||||
// showRobosat: false,
|
tokenHasChanged: true,
|
||||||
// token: this.genBase62Token(34),
|
});
|
||||||
// });
|
|
||||||
// this.getGeneratedUser(this.state.token);
|
|
||||||
window.location.reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChangeToken=(e)=>{
|
handleChangeToken=(e)=>{
|
||||||
this.delGeneratedUser()
|
|
||||||
this.setState({
|
this.setState({
|
||||||
token: e.target.value,
|
token: e.target.value,
|
||||||
|
tokenHasChanged: true,
|
||||||
})
|
})
|
||||||
this.getGeneratedUser(e.target.value);
|
}
|
||||||
this.setState({showRobosat: false})
|
|
||||||
|
handleClickSubmitToken=()=>{
|
||||||
|
this.delGeneratedUser()
|
||||||
|
this.getGeneratedUser(this.state.token);
|
||||||
|
this.setState({loadingRobot: true, tokenHasChanged: false})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClickOpenInfo = () => {
|
handleClickOpenInfo = () => {
|
||||||
@ -125,8 +128,8 @@ export default class UserGenPage extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={1}>
|
<Grid container spacing={1}>
|
||||||
<Grid item xs={12} align="center" sx={{width:370}}>
|
<Grid item xs={12} align="center" sx={{width:370, height:260}}>
|
||||||
{this.state.showRobosat ?
|
{!this.state.loadingRobot ?
|
||||||
<div>
|
<div>
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
<Typography component="h5" variant="h5">
|
<Typography component="h5" variant="h5">
|
||||||
@ -144,7 +147,7 @@ export default class UserGenPage extends Component {
|
|||||||
</div><br/>
|
</div><br/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
: <CircularProgress />}
|
: <CircularProgress sx={{position: 'relative', top: 100, }}/>}
|
||||||
</Grid>
|
</Grid>
|
||||||
{
|
{
|
||||||
this.state.found ?
|
this.state.found ?
|
||||||
@ -158,8 +161,8 @@ export default class UserGenPage extends Component {
|
|||||||
}
|
}
|
||||||
<Grid container align="center">
|
<Grid container align="center">
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
<IconButton onClick= {()=>navigator.clipboard.writeText(this.state.token)}>
|
<IconButton sx={{top:6}} onClick= {()=>navigator.clipboard.writeText(this.state.token)}>
|
||||||
<ContentCopy/>
|
<ContentCopy sx={{width:18, height:18}} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<TextField
|
<TextField
|
||||||
//sx={{ input: { color: 'purple' } }}
|
//sx={{ input: { color: 'purple' } }}
|
||||||
@ -175,15 +178,26 @@ export default class UserGenPage extends Component {
|
|||||||
size='small'
|
size='small'
|
||||||
// multiline = {true}
|
// multiline = {true}
|
||||||
onChange={this.handleChangeToken}
|
onChange={this.handleChangeToken}
|
||||||
|
onKeyPress={(e) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
this.handleClickSubmitToken();
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
<IconButton sx={{top:8}} onClick={this.handleClickNewRandomToken}>
|
||||||
|
<CasinoIcon />
|
||||||
|
</IconButton>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
<Button size='small' onClick={this.handleAnotherButtonPressed}>Generate Another Robosat</Button>
|
<Button disabled={!this.state.tokenHasChanged} type="submit" size='small' onClick= {this.handleClickSubmitToken}>
|
||||||
|
<PublishIcon />
|
||||||
|
<span> Generate Robot</span>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} align="center">
|
<Grid item xs={12} align="center">
|
||||||
<ButtonGroup variant="contained" aria-label="outlined primary button group">
|
<ButtonGroup variant="contained" aria-label="outlined primary button group">
|
||||||
<Button color='primary' to='/make/' component={Link}>Make Order</Button>
|
<Button disabled={this.state.loadingRobot} color='primary' to='/make/' component={Link}>Make Order</Button>
|
||||||
<Button color='inherit' onClick={this.handleClickOpenInfo}>Info</Button>
|
<Button color='inherit' onClick={this.handleClickOpenInfo}>Info</Button>
|
||||||
<this.InfoDialog/>
|
<this.InfoDialog/>
|
||||||
<Button color='secondary' to='/book/' component={Link}>View Book</Button>
|
<Button color='secondary' to='/book/' component={Link}>View Book</Button>
|
||||||
|
Loading…
Reference in New Issue
Block a user