Skip to content

Commit

Permalink
drop outdated torusLookup results
Browse files Browse the repository at this point in the history
  • Loading branch information
klassare committed Jan 22, 2024
1 parent 93f79a5 commit ea143ba
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/app/components/modals/send/prepare/prepare-send.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,12 @@ export class PrepareSendComponent extends ModalComponent implements OnInit, OnCh
// resimulate?
}
async torusLookup(): Promise<any> {
const lookupInput = `${this.torusVerifier}:${this.toPkh}`;
let formInvalid = '';
if (!this.torusService.verifierMapKeys.includes(this.torusVerifier) && this.torusVerifier !== 'domain') {
this.formInvalid = 'Invalid verifier';
formInvalid = 'Invalid verifier';
} else if (this.invalidTorusAccount()) {
this.formInvalid = this.invalidTorusAccount();
formInvalid = this.invalidTorusAccount();
} else if (this.toPkh) {
this.torusPendingLookup = true;
this.torusLookupId = this.toPkh;
Expand All @@ -562,21 +564,25 @@ export class PrepareSendComponent extends ModalComponent implements OnInit, OnCh
.getAddressFromDomain(this.toPkh)
.then((ans) => {
if (ans?.pkh === '') {
this.formInvalid = 'Could not find the domain';
formInvalid = 'Could not find the domain';
}
return ans;
})
.catch((e) => {
console.error(e);
this.formInvalid = e;
formInvalid = e;
return '';
})
: await this.torusService.lookupPkh(this.torusVerifier, this.toPkh).catch((e) => {
console.error(e);
this.formInvalid = e;
formInvalid = e;
return '';
});

if (lookupInput !== `${this.torusVerifier}:${this.toPkh}`) {
// Lookup input values have changed. So we can ignore this response from lookupPkh().
return;
}
this.formInvalid = formInvalid;
this.torusPendingLookup = false;
if (pkh) {
this.torusLookupAddress = pkh;
Expand Down

0 comments on commit ea143ba

Please sign in to comment.