mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-19 04:31:35 +00:00
Add usage of API fetched limits everywhere on MakerPage
This commit is contained in:
parent
c00709e6a9
commit
c09e81a037
@ -29,15 +29,18 @@ class MakerPage extends Component {
|
|||||||
defaultCurrencyCode = 'USD';
|
defaultCurrencyCode = 'USD';
|
||||||
defaultPaymentMethod = "not specified";
|
defaultPaymentMethod = "not specified";
|
||||||
defaultPremium = 0;
|
defaultPremium = 0;
|
||||||
minTradeSats = 20000;
|
defaultMinTradeSats = 20000;
|
||||||
maxTradeSats = 1200000;
|
defaultMaxTradeSats = 1200000;
|
||||||
maxBondlessSats = 50000;
|
defaultMaxBondlessSats = 50000;
|
||||||
maxRangeAmountMultiple = 4.8;
|
maxRangeAmountMultiple = 4.8;
|
||||||
minRangeAmountMultiple = 1.6;
|
minRangeAmountMultiple = 1.6;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
|
minTradeSats: this.defaultMinTradeSats,
|
||||||
|
maxTradeSats: this.defaultMaxTradeSats,
|
||||||
|
maxBondlessSats: this.defaultMaxBondlessSats,
|
||||||
is_explicit: false,
|
is_explicit: false,
|
||||||
type: 0,
|
type: 0,
|
||||||
currency: this.defaultCurrency,
|
currency: this.defaultCurrency,
|
||||||
@ -69,6 +72,9 @@ class MakerPage extends Component {
|
|||||||
loadingLimits:false,
|
loadingLimits:false,
|
||||||
minAmount: this.state.amount ? parseFloat((this.state.amount/2).toPrecision(2)) : parseFloat(Number(data[this.state.currency]['max_amount']*0.25).toPrecision(2)),
|
minAmount: this.state.amount ? parseFloat((this.state.amount/2).toPrecision(2)) : parseFloat(Number(data[this.state.currency]['max_amount']*0.25).toPrecision(2)),
|
||||||
maxAmount: this.state.amount ? this.state.amount : parseFloat(Number(data[this.state.currency]['max_amount']*0.75).toPrecision(2)),
|
maxAmount: this.state.amount ? this.state.amount : parseFloat(Number(data[this.state.currency]['max_amount']*0.75).toPrecision(2)),
|
||||||
|
minTradeSats: data["1000"]['min_amount']*100000000,
|
||||||
|
maxTradeSats: data["1000"]['max_amount']*100000000,
|
||||||
|
maxBondlessSats: data["1000"]['max_bondless_amount']*100000000,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,11 +185,11 @@ class MakerPage extends Component {
|
|||||||
|
|
||||||
handleSatoshisChange=(e)=>{
|
handleSatoshisChange=(e)=>{
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
if(e.target.value > this.maxTradeSats){
|
if(e.target.value > this.state.maxTradeSats){
|
||||||
var bad_sats = t("Must be less than {{maxSats}",{maxSats: pn(this.maxTradeSats)})
|
var bad_sats = t("Must be less than {{maxSats}",{maxSats: pn(this.state.maxTradeSats)})
|
||||||
}
|
}
|
||||||
if(e.target.value < this.minTradeSats){
|
if(e.target.value < this.state.minTradeSats){
|
||||||
var bad_sats = t("Must be more than {{minSats}}",{minSats: pn(this.minTradeSats)})
|
var bad_sats = t("Must be more than {{minSats}}",{minSats: pn(this.state.minTradeSats)})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -293,8 +299,9 @@ class MakerPage extends Component {
|
|||||||
<TextField
|
<TextField
|
||||||
disabled = {this.state.enableAmountRange}
|
disabled = {this.state.enableAmountRange}
|
||||||
variant = {this.state.enableAmountRange ? 'filled' : 'outlined'}
|
variant = {this.state.enableAmountRange ? 'filled' : 'outlined'}
|
||||||
error={this.state.amount <= 0 & this.state.amount != "" }
|
error={(this.state.amount <= this.getMinAmount() || this.state.amount >= this.getMaxAmount()) & this.state.amount != "" }
|
||||||
helperText={this.state.amount <= 0 & this.state.amount != "" ? t("Invalid") : null}
|
helperText={this.state.amount <= this.getMinAmount() & this.state.amount != "" ? t("Too low")
|
||||||
|
: (this.state.amount >= this.getMaxAmount() & this.state.amount != "" ? t("Too high") : null)}
|
||||||
label={t("Amount")}
|
label={t("Amount")}
|
||||||
type="number"
|
type="number"
|
||||||
required="true"
|
required="true"
|
||||||
@ -380,8 +387,8 @@ class MakerPage extends Component {
|
|||||||
required="true"
|
required="true"
|
||||||
value={this.state.satoshis}
|
value={this.state.satoshis}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
min:this.minTradeSats ,
|
min:this.state.minTradeSats ,
|
||||||
max:this.maxTradeSats ,
|
max:this.state.maxTradeSats ,
|
||||||
style: {textAlign:"center"}
|
style: {textAlign:"center"}
|
||||||
}}
|
}}
|
||||||
onChange={this.handleSatoshisChange}
|
onChange={this.handleSatoshisChange}
|
||||||
@ -678,7 +685,7 @@ class MakerPage extends Component {
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} align="center" spacing={1}>
|
<Grid item xs={12} align="center" spacing={1}>
|
||||||
<Tooltip enterTouchDelay="0" title={t("COMING SOON - High risk! Limited to {{limitSats}}K Sats",{ limitSats: this.maxBondlessSats/1000})}>
|
<Tooltip enterTouchDelay="0" title={t("COMING SOON - High risk! Limited to {{limitSats}}K Sats",{ limitSats: this.state.maxBondlessSats/1000})}>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
label={t("Allow bondless takers")}
|
label={t("Allow bondless takers")}
|
||||||
control={
|
control={
|
||||||
|
Loading…
Reference in New Issue
Block a user