Add memory to textInput premium/satoshis

This commit is contained in:
Reckless_Satoshi 2022-01-31 14:42:43 -08:00
parent 18d5cac16a
commit bd8d2d8512
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 30 additions and 29 deletions

View File

@ -46,7 +46,7 @@ def follow_send_payment(lnpayment):
MACAROON = b64decode(config('LND_MACAROON_BASE64'))
fee_limit_sat = max(lnpayment.num_satoshis * 0.0002, 10) # 200 ppm or 10 sats max
fee_limit_sat = int(max(lnpayment.num_satoshis * float(config('PROPORTIONAL_ROUTING_FEE_LIMIT')), float(config('MIN_FLAT_ROUTING_FEE_LIMIT')))) # 200 ppm or 10 sats
request = LNNode.routerrpc.SendPaymentRequest(
payment_request=lnpayment.invoice,
fee_limit_sat=fee_limit_sat,

View File

@ -89,15 +89,15 @@ export default class MakerPage extends Component {
handleClickRelative=(e)=>{
this.setState({
is_explicit: false,
satoshis: null,
premium: 0,
});
this.handlePremiumChange();
}
handleClickExplicit=(e)=>{
this.setState({
is_explicit: true,
premium: null,
is_explicit: true,
});
this.handleSatoshisChange();
}
handleCreateOfferButtonPressed=()=>{
@ -239,26 +239,27 @@ export default class MakerPage extends Component {
</FormControl>
</Grid>
{/* conditional shows either Premium % field or Satoshis field based on pricing method */}
{ this.state.is_explicit
? <Grid item xs={12} align="center">
<Grid item xs={12} align="center">
<div style={{display: this.state.is_explicit ? '':'none'}}>
<TextField
label="Satoshis"
error={this.state.badSatoshis}
helperText={this.state.badSatoshis}
type="number"
required="true"
value={this.state.satoshis}
inputProps={{
// TODO read these from .env file
min:this.minTradeSats ,
max:this.maxTradeSats ,
style: {textAlign:"center"}
}}
onChange={this.handleSatoshisChange}
// defaultValue={this.defaultSatoshis}
/>
</div>
<div style={{display: this.state.is_explicit ? 'none':''}}>
<TextField
label="Satoshis"
error={this.state.badSatoshis}
helperText={this.state.badSatoshis}
type="number"
required="true"
inputProps={{
// TODO read these from .env file
min:this.minTradeSats ,
max:this.maxTradeSats ,
style: {textAlign:"center"}
}}
onChange={this.handleSatoshisChange}
// defaultValue={this.defaultSatoshis}
/>
</Grid>
: <Grid item xs={12} align="center">
<TextField
label="Premium over Market (%)"
type="number"
// defaultValue={this.defaultPremium}
@ -267,8 +268,8 @@ export default class MakerPage extends Component {
}}
onChange={this.handlePremiumChange}
/>
</Grid>
}
</div>
</Grid>
</Paper>
</Grid>
<Grid item xs={12} align="center">

View File

@ -517,7 +517,7 @@ export default class OrderPage extends Component {
{this.orderBox()}
</Grid>
<Grid item xs={6} align="left">
<TradeBox width={330} data={this.state} completeSetState={this.completeSetState} />
<TradeBox push={this.props.history.push} width={330} data={this.state} completeSetState={this.completeSetState} />
</Grid>
</Grid>
)
@ -553,7 +553,7 @@ export default class OrderPage extends Component {
{this.orderBox()}
</div>
<div style={{display: this.state.showContractBox == 1 ? '':'none'}}>
<TradeBox width={330} data={this.state} completeSetState={this.completeSetState} />
<TradeBox push={this.props.history.push} width={330} data={this.state} completeSetState={this.completeSetState} />
</div>
</Grid>
</Grid>

View File

@ -677,7 +677,7 @@ handleRatingChange=(e)=>{
<Rating name="size-large" defaultValue={2} size="large" onChange={this.handleRatingChange} />
</Grid>
<Grid item xs={12} align="center">
<Button color='primary' href='/' component="a">Start Again</Button>
<Button color='primary' onClick={this.props.push('/')}>Start Again</Button>
</Grid>
</Grid>
)