Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app: Fix registration flow forms #2750

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions client/webserver/site/src/js/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ export class ConfirmRegistrationForm {
let form: any
let url: string

if (xc.viewOnly || !app().exchanges[xc.host]) {
if (!app().exchanges[xc.host] || app().exchanges[xc.host].viewOnly) {
form = {
addr: dexAddr,
cert: certFile,
Expand Down Expand Up @@ -1264,7 +1264,7 @@ export class WalletWaitForm {
page: Record<string, PageElement>
assetID: number
parentID?: number
host: string
xc: Exchange
bondAsset: BondAsset
progressCache: ProgressPoint[]
progressed: boolean
Expand Down Expand Up @@ -1295,7 +1295,7 @@ export class WalletWaitForm {

/* setExchange sets the exchange for which the fee is being paid. */
setExchange (xc: Exchange) {
this.host = xc.host
this.xc = xc
}

/* setWallet must be called before showing the WalletWaitForm. */
Expand All @@ -1308,10 +1308,9 @@ export class WalletWaitForm {
this.parentAssetSynced = false
const page = this.page
const asset = app().assets[assetID]
const xc = app().exchanges[this.host]
const { symbol, unitInfo: ui, wallet: { balance: bal, address, synced, syncProgress }, token } = asset
this.parentID = token?.parentID
const bondAsset = this.bondAsset = xc.bondAssets[symbol]
const bondAsset = this.bondAsset = this.xc.bondAssets[symbol]

const symbolize = (el: PageElement, asset: SupportedAsset) => {
Doc.empty(el)
Expand Down
9 changes: 4 additions & 5 deletions client/webserver/site/src/js/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class RegistrationPage extends BasePage {
body: HTMLElement
data: RegistrationPageData
pwCache: PasswordCache
host: string
xc: Exchange
page: Record<string, PageElement>
loginForm: LoginForm
appPassResetForm: AppPassResetForm
Expand Down Expand Up @@ -110,7 +110,7 @@ export default class RegistrationPage extends BasePage {
const asset = app().assets[assetID]
const wallet = asset.wallet
if (wallet) {
const bondAsset = this.regAssetForm.xc.bondAssets[asset.symbol]
const bondAsset = this.xc.bondAssets[asset.symbol]
const bondsFeeBuffer = await this.getBondsFeeBuffer(assetID, page.regAssetForm)
this.confirmRegisterForm.setAsset(assetID, tier, bondsFeeBuffer)
if (wallet.synced && wallet.balance.available >= 2 * bondAsset.amount + bondsFeeBuffer) {
Expand Down Expand Up @@ -171,7 +171,7 @@ export default class RegistrationPage extends BasePage {
}

async requestFeepayment (oldForm: HTMLElement, xc: Exchange, certFile: string) {
this.host = xc.host
this.xc = xc
this.confirmRegisterForm.setExchange(xc, certFile)
this.walletWaitForm.setExchange(xc)
this.regAssetForm.setExchange(xc, certFile)
Expand Down Expand Up @@ -225,9 +225,8 @@ export default class RegistrationPage extends BasePage {
if (!user) return
const page = this.page
const asset = user.assets[assetID]
const xc = app().exchanges[this.host]
const wallet = asset.wallet
const bondAmt = xc.bondAssets[asset.symbol].amount
const bondAmt = this.xc.bondAssets[asset.symbol].amount

const bondsFeeBuffer = await this.getBondsFeeBuffer(assetID, page.newWalletForm)
this.walletWaitForm.setWallet(assetID, bondsFeeBuffer, tier)
Expand Down