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

User identity in withdraw overlay + check against not activated tickers #2581

Merged
merged 1 commit into from
Aug 26, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/saito/ui/saito-crypto/overlays/withdraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Withdraw {
this.address = '';
this.balance = 0.0;
this.fee = null;
this.identicon = null;

this.callbacks = {};
this.autofill = false;
Expand All @@ -33,6 +34,9 @@ class Withdraw {
}
if (typeof obj.address != 'undefined') {
this.address = obj.address;

this.identicon = this.app.keychain.returnIdenticon(this.address);
console.log("identicon: ", this.identicon);
}

this.autofill = (obj?.autofill == true) ? true : false;
Expand All @@ -45,6 +49,10 @@ class Withdraw {
}

async render() {
if (this.autofill == false) {
this.identicon = null;
}

this.overlay.show(WithdrawTemplate(this.app, this.mod, this));

// add qrscanner icon
Expand Down Expand Up @@ -197,6 +205,7 @@ class Withdraw {
await this_withdraw.loadCryptos(element.value);
document.querySelector('#withdraw-input-address').value = '';
document.querySelector('#withdraw-input-amount').value = '';
document.querySelector('#withdraw-input-address').classList.remove('disabled');

this_withdraw.resetErrors();

Expand All @@ -209,10 +218,15 @@ class Withdraw {
if (res != null) {
if (Object.keys(res).length > 0){
document.querySelector('#withdraw-input-address').value = res[preferred_crypto.ticker];

document.querySelector('#withdraw-address-error').innerHTML = ``;
document.querySelector('#withdraw-address-error').style.display = 'none';
await this_withdraw.fetchWithdrawFee(preferred_crypto);
await this_withdraw.validateAmountInput();
}
} else {
document.querySelector('#withdraw-address-error').innerHTML = `This user hasn't activated TRX address`;
document.querySelector('#withdraw-address-error').style.display = 'block';
document.querySelector('#withdraw-input-address').classList.add('disabled');
}

});
Expand Down
13 changes: 11 additions & 2 deletions lib/saito/ui/saito-crypto/overlays/withdraw.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,17 @@ module.exports = WithdrawTemplate = (app, mod, obj) => {

<div class="saito-overlay-form-input">
<div class="withdraw-address-cont" id="withdraw-address-cont">
<input type="text" class="input-elem withdraw_address" value="${obj.address}"
id="withdraw-input-address" required="" placeholder="receiving address">
<div class="withdraw-identicon-container">
`;

if (obj.identicon != null) {
html += `<img class="saito-identicon" src="${obj.identicon}" data-id="${obj.address}">`;
}

html += `
<input type="text" class="input-elem withdraw_address" value="${obj.address}"
id="withdraw-input-address" required="" placeholder="receiving address">
</div>
</div>
</div>

Expand Down
10 changes: 10 additions & 0 deletions web/saito/css-imports/saito-wallet.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@
color: #333;
}

.withdraw-identicon-container {
display: flex;
gap: 1rem;
align-items: center;
}

#saito-withdraw-overlay {
min-width: 32vw;
padding: 2rem;
Expand Down Expand Up @@ -658,6 +664,10 @@
color: var(--font-color-primary);
}

#withdraw-step-one .input-elem.disabled {
cursor: not-allowed;
}

.saito-history-msg {
color: var(--saito-font-color);
}
Expand Down