Add datetime picker for public order expiration

This commit is contained in:
Reckless_Satoshi 2022-03-15 13:40:54 -07:00
parent a3b19d871f
commit 5c5e7918e8
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
6 changed files with 874 additions and 3 deletions

View File

@ -69,6 +69,7 @@ MAX_PUBLIC_ORDERS = 100
# Trade limits in satoshis
MIN_TRADE = 20000
MAX_TRADE = 800000
MAX_TRADE_BONDLESS_TAKER = 50000
# Expiration (CLTV_expiry) time for HODL invoices in HOURS // 7 min/block assumed
BOND_EXPIRY = 54
@ -79,7 +80,10 @@ EXP_MAKER_BOND_INVOICE = 300
EXP_TAKER_BOND_INVOICE = 200
# Time a order is public in the book HOURS
PUBLIC_ORDER_DURATION = 6
DEFAULT_PUBLIC_ORDER_DURATION = 24
MAX_PUBLIC_ORDER_DURATION = 24
MIN_PUBLIC_ORDER_DURATION = 0.25
# Time to provide a valid invoice and the trade escrow MINUTES
INVOICE_AND_ESCROW_DURATION = 30
# Time to confim chat and confirm fiat (time to Fiat Sent confirmation) HOURS

View File

@ -1286,6 +1286,43 @@
"minimist": "^1.2.0"
}
},
"@date-io/core": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/@date-io/core/-/core-2.13.1.tgz",
"integrity": "sha512-pVI9nfkf2qClb2Cxdq0Q4zJhdawMG4ybWZUVGifT78FDwzRMX2SwXBb55s5NRJk0HcIicDuxktmCtemZqMH1Zg=="
},
"@date-io/date-fns": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/@date-io/date-fns/-/date-fns-2.13.1.tgz",
"integrity": "sha512-8fmfwjiLMpFLD+t4NBwDx0eblWnNcgt4NgfT/uiiQTGI81fnPu9tpBMYdAcuWxaV7LLpXgzLBx1SYWAMDVUDQQ==",
"requires": {
"@date-io/core": "^2.13.1"
}
},
"@date-io/dayjs": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/@date-io/dayjs/-/dayjs-2.13.1.tgz",
"integrity": "sha512-5bL4WWWmlI4uGZVScANhHJV7Mjp93ec2gNeUHDqqLaMZhp51S0NgD25oqj/k0LqBn1cdU2MvzNpk/ObMmVv5cQ==",
"requires": {
"@date-io/core": "^2.13.1"
}
},
"@date-io/luxon": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/@date-io/luxon/-/luxon-2.13.1.tgz",
"integrity": "sha512-yG+uM7lXfwLyKKEwjvP8oZ7qblpmfl9gxQYae55ifbwiTs0CoCTkYkxEaQHGkYtTqGTzLqcb0O9Pzx6vgWg+yg==",
"requires": {
"@date-io/core": "^2.13.1"
}
},
"@date-io/moment": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/@date-io/moment/-/moment-2.13.1.tgz",
"integrity": "sha512-XX1X/Tlvl3TdqQy2j0ZUtEJV6Rl8tOyc5WOS3ki52He28Uzme4Ro/JuPWTMBDH63weSWIZDlbR7zBgp3ZA2y1A==",
"requires": {
"@date-io/core": "^2.13.1"
}
},
"@discoveryjs/json-ext": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz",
@ -1589,6 +1626,120 @@
"@babel/runtime": "^7.16.3"
}
},
"@mui/lab": {
"version": "5.0.0-alpha.73",
"resolved": "https://registry.npmjs.org/@mui/lab/-/lab-5.0.0-alpha.73.tgz",
"integrity": "sha512-10Uj0Atc7gBTXKX4VV38P6RdqTQrJZxcl3HeEcytIO1S3NAGfc7gZ3Hdpnhtj5U8kcRJZZPH9LtrBbMZzxU/1A==",
"requires": {
"@babel/runtime": "^7.17.2",
"@date-io/date-fns": "^2.13.1",
"@date-io/dayjs": "^2.13.1",
"@date-io/luxon": "^2.13.1",
"@date-io/moment": "^2.13.1",
"@mui/base": "5.0.0-alpha.72",
"@mui/system": "^5.5.1",
"@mui/utils": "^5.4.4",
"clsx": "^1.1.1",
"prop-types": "^15.7.2",
"react-is": "^17.0.2",
"react-transition-group": "^4.4.2",
"rifm": "^0.12.1"
},
"dependencies": {
"@babel/runtime": {
"version": "7.17.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.7.tgz",
"integrity": "sha512-L6rvG9GDxaLgFjg41K+5Yv9OMrU98sWe+Ykmc6FDJW/+vYZMhdOMKkISgzptMaERHvS2Y2lw9MDRm2gHhlQQoA==",
"requires": {
"regenerator-runtime": "^0.13.4"
}
},
"@emotion/is-prop-valid": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.2.tgz",
"integrity": "sha512-3QnhqeL+WW88YjYbQL5gUIkthuMw7a0NGbZ7wfFVk2kg/CK5w8w5FFa0RzWjyY1+sujN0NWbtSHH6OJmWHtJpQ==",
"requires": {
"@emotion/memoize": "^0.7.4"
}
},
"@mui/base": {
"version": "5.0.0-alpha.72",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.72.tgz",
"integrity": "sha512-WCAooa9eqbsC68LhyKtDBRumH4hV1eRZ0A3SDKFHSwYG9fCOdsFv/H1dIYRJM0rwD45bMnuDiG3Qmx7YsTiptw==",
"requires": {
"@babel/runtime": "^7.17.2",
"@emotion/is-prop-valid": "^1.1.2",
"@mui/utils": "^5.4.4",
"@popperjs/core": "^2.11.3",
"clsx": "^1.1.1",
"prop-types": "^15.7.2",
"react-is": "^17.0.2"
}
},
"@mui/private-theming": {
"version": "5.4.4",
"resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.4.4.tgz",
"integrity": "sha512-V/gxttr6736yJoU9q+4xxXsa0K/w9Hn9pg99zsOHt7i/O904w2CX5NHh5WqDXtoUzVcayLF0RB17yr6l79CE+A==",
"requires": {
"@babel/runtime": "^7.17.2",
"@mui/utils": "^5.4.4",
"prop-types": "^15.7.2"
}
},
"@mui/styled-engine": {
"version": "5.4.4",
"resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.4.4.tgz",
"integrity": "sha512-AKx3rSgB6dmt5f7iP4K18mLFlE5/9EfJe/5EH9Pyqez8J/CPkTgYhJ/Va6qtlrcunzpui+uG/vfuf04yAZekSg==",
"requires": {
"@babel/runtime": "^7.17.2",
"@emotion/cache": "^11.7.1",
"prop-types": "^15.7.2"
}
},
"@mui/system": {
"version": "5.5.1",
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.5.1.tgz",
"integrity": "sha512-2hynI4hN8304hOCT8sc4knJviwUUYJ7XK3mXwQ0nagVGOPnWSOad/nYADm7K0vdlCeUXLIbDbe7oNN3Kaiu2kA==",
"requires": {
"@babel/runtime": "^7.17.2",
"@mui/private-theming": "^5.4.4",
"@mui/styled-engine": "^5.4.4",
"@mui/types": "^7.1.3",
"@mui/utils": "^5.4.4",
"clsx": "^1.1.1",
"csstype": "^3.0.11",
"prop-types": "^15.7.2"
}
},
"@mui/types": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@mui/types/-/types-7.1.3.tgz",
"integrity": "sha512-DDF0UhMBo4Uezlk+6QxrlDbchF79XG6Zs0zIewlR4c0Dt6GKVFfUtzPtHCH1tTbcSlq/L2bGEdiaoHBJ9Y1gSA=="
},
"@mui/utils": {
"version": "5.4.4",
"resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.4.4.tgz",
"integrity": "sha512-hfYIXEuhc2mXMGN5nUPis8beH6uE/zl3uMWJcyHX0/LN/+QxO9zhYuV6l8AsAaphHFyS/fBv0SW3Nid7jw5hKQ==",
"requires": {
"@babel/runtime": "^7.17.2",
"@types/prop-types": "^15.7.4",
"@types/react-is": "^16.7.1 || ^17.0.0",
"prop-types": "^15.7.2",
"react-is": "^17.0.2"
}
},
"@popperjs/core": {
"version": "2.11.4",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.4.tgz",
"integrity": "sha512-q/ytXxO5NKvyT37pmisQAItCFqA7FD/vNb8dgaJy3/630Fsc+Mz9/9f2SziBoIZ30TJooXyTwZmhi1zjXmObYg=="
},
"csstype": {
"version": "3.0.11",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.11.tgz",
"integrity": "sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw=="
}
}
},
"@mui/material": {
"version": "5.2.7",
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.2.7.tgz",
@ -3306,6 +3457,11 @@
"type": "^1.0.1"
}
},
"date-fns": {
"version": "2.28.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz",
"integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw=="
},
"dayjs": {
"version": "1.10.7",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
@ -6749,6 +6905,11 @@
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg=="
},
"rifm": {
"version": "0.12.1",
"resolved": "https://registry.npmjs.org/rifm/-/rifm-0.12.1.tgz",
"integrity": "sha512-OGA1Bitg/dSJtI/c4dh90svzaUPt228kzFsUkJbtA2c964IqEAwWXeL9ZJi86xWv3j5SMqRvGULl7bA6cK0Bvg=="
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",

View File

@ -27,9 +27,11 @@
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@mui/icons-material": "^5.2.5",
"@mui/lab": "^5.0.0-alpha.73",
"@mui/material": "^5.2.7",
"@mui/system": "^5.2.6",
"@mui/x-data-grid": "^5.2.2",
"date-fns": "^2.28.0",
"material-ui-image": "^3.3.2",
"react-countdown": "^2.3.2",
"react-native": "^0.66.4",

View File

@ -1,5 +1,7 @@
import React, { Component } from 'react';
import { Checkbox, Switch, Tooltip, Paper, Button , Grid, Typography, TextField, Select, FormHelperText, MenuItem, FormControl, Radio, FormControlLabel, RadioGroup} from "@mui/material"
import { AdapterDateFns, LocalizationProvider, DateTimePicker} from '@mui/lab';
import DateFnsUtils from "@date-io/date-fns";
import { Link } from 'react-router-dom'
import getFlags from './getFlags'
@ -37,7 +39,7 @@ export default class MakerPage extends Component {
defaultPremium = 0;
minTradeSats = 20000;
maxTradeSats = 800000;
constructor(props) {
super(props);
this.state={
@ -51,6 +53,7 @@ export default class MakerPage extends Component {
currencies_dict: {"1":"USD"},
showAdvanced: false,
allowBondless: false,
publicExpiryTime: Date.now() + 86400000,
}
this.getCurrencyDict()
}
@ -304,6 +307,18 @@ export default class MakerPage extends Component {
AdvancedMakerOptions = () => {
return(
<Paper elevation={12} style={{ padding: 8, width:300, align:'center'}}>
<Grid item xs={12} align="center" spacing={1}>
<LocalizationProvider dateAdapter={DateFnsUtils}>
<DateTimePicker
renderInput={(props) => <TextField {...props} />}
label="Public Order Expiry Time"
value={this.state.publicExpiryTime}
onChange={(newValue) => {this.setState({publicExpiryTime: newValue})}}
/>
</LocalizationProvider>
</Grid>
<Grid item xs={12} align="center" spacing={1}>
<Tooltip enterTouchDelay="0" title="Takers will not have to lock a bond. High risk! Only small stakes allowed!">
<FormControlLabel
@ -319,6 +334,7 @@ export default class MakerPage extends Component {
/>
</Tooltip>
</Grid>
</Paper>
)
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff