Skip to content

Commit

Permalink
UIA Register - Reached bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Apr 10, 2024
1 parent 92cbc23 commit 2a260ef
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@
"too_low_orders": "Too low orders in ",
"unknown_error": " - error in ",
"too_low_amount_to_register": "Too low amount to register.",
"no_assets_available": "No UIA assets available now."
"no_assets_available": "No UIA assets available now.",
"reached_desc": "You can pass to account creation.",
"reached_desc2": "And your Golos Power deposit will be processed in the nearest future...",
"reached_btn": "Register account"
},
"invites_jsx": {
"claim_wrong_secret": "Wrong secret",
Expand Down
5 changes: 4 additions & 1 deletion src/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@
"too_low_orders": "Слишком мало ордеров по направлению ",
"unknown_error": " - ошибка по направлению ",
"too_low_amount_to_register": "Слишком малая сумма для регистрации.",
"no_assets_available": "Регистрация через криптовалюту сейчас не работает."
"no_assets_available": "Регистрация через криптовалюту сейчас не работает.",
"reached_desc": "Вы можете перейти к созданию аккаунта.",
"reached_desc2": "Сумма пополнения Силы Голоса будет обработана в ближайшее время...",
"reached_btn": "Создать аккаунт"
},
"invites_jsx": {
"claim_wrong_secret": "Неверно указан ключ",
Expand Down
4 changes: 4 additions & 0 deletions src/modules/register/TransferWaiter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class TransferWaiter extends React.Component {
if (seconds === 0) {
console.log('Countdown reached, stop.')
this.stop()
const { onReached } = this.props
if (onReached) {
onReached()
}
return
}
this.setState({
Expand Down
33 changes: 29 additions & 4 deletions src/modules/register/UIARegister.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ class UIARegister extends React.Component {
try {
cmc = await golos.libs.dex.apidexGetPrices({ sym })
if (!cmc.price_usd) {
console.error('Cannot obtain price_usd', cmc)
throw Error('Cannot obtain price_usd')
if (sym === 'SUPERCOIN') {
cmc.price_usd = 1.0000437327709328
} else {
console.error('Cannot obtain price_usd', cmc)
throw Error('Cannot obtain price_usd')
}
}
const priceUsd = parseFloat(cmc.price_usd)
let minFloat = 1 / priceUsd
Expand Down Expand Up @@ -426,13 +430,19 @@ class UIARegister extends React.Component {
}
}
}
const onReached = () => {
this.setState({
reached: true
})
}
return <div>
<div style={{ fontSize: '90%', marginTop: '0.5rem', marginBottom: '0.25rem' }}>
{tt('uia_register_jsx.enter_amount')}<span style={{ fontSize: '130%' }}><b>{waitAmount.floatString}</b></span>
</div>
<TransferWaiter
username={registrar.name}
amount={waitAmount} title={''} onTransfer={onTransfer} />
amount={waitAmount} title={''} onTransfer={onTransfer}
onReached={onReached} />
</div>
}

Expand Down Expand Up @@ -503,6 +513,11 @@ class UIARegister extends React.Component {
})
}

reachedBtnClick = (e) => {
e.preventDefault()

}

_renderForm = () => {
const { initialForm, amountSubmitError, receive } = this.state
return <Formik
Expand Down Expand Up @@ -577,7 +592,7 @@ class UIARegister extends React.Component {
if (error) {
form = <div className='error'>{error}</div>
} else if (sym) {
const { deposited, depositedToSym } = this.state
const { deposited, depositedToSym, reached } = this.state
if (deposited) {
form = <div>
<center>
Expand All @@ -590,6 +605,16 @@ class UIARegister extends React.Component {
<LoadingIndicator type='circle' />
</center>
</div>
} else if (reached) {
form = <div>
<center>
<b>{tt('uia_register_jsx.reached_desc')}</b>
<br />
{tt('uia_register_jsx.reached_desc2')}
<br />
<div style={{marginTop: '0.5rem'}} className='button' onClick={this.reachedBtnClick}>{tt('uia_register_jsx.reached_btn')}</div>
</center>
</div>
} else {
const { rules, registrar, } = this.state
const { to, to_type, to_fixed, details, } = rules
Expand Down
1 change: 1 addition & 0 deletions src/pages/api/reg/[...all].js
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ let handler = nextConnect({ attachParams: true, })
error = tt('uia_register_jsx.cannot_check_orders') + exAmount.symbol + '/' + sym2
}
if (error) break
console.log(exAmount.toString(), sym2, JSON.stringify(resEx))
if (resEx.remain) {
error = tt('uia_register_jsx.too_low_orders') + exAmount.symbol + '/' + sym2 + tt('uia_register_jsx.cannot_register_with_it')
break
Expand Down
1 change: 1 addition & 0 deletions src/server/getUIAAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default async function getUIAAddress(accName, symbol, okResp, errResp) {

let resp
try {
console.log('apiURL', apiURL)
resp = await fetchEx(apiURL, { timeout: 10000 })
} catch (err) {
return errResp('cannot_connect_gateway', [meta.deposit, err])
Expand Down

0 comments on commit 2a260ef

Please sign in to comment.