Skip to content

wait for txns in get free deso flows #309

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

Merged
merged 3 commits into from
Jan 22, 2025
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
7 changes: 7 additions & 0 deletions src/app/get-deso/get-deso.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ <h3 class="text--neutral-white">Get starter $DESO</h3>
(error)="onCaptchaError($event)"
>
</ng-hcaptcha>
<div
*ngIf="captchaFlowSpinner"
class="padding-top--medium display--flex flex--column items--center"
>
<div>Waiting for your $DESO to arrive.</div>
<div class="spinner-border" style="width: 6rem; height: 6rem"></div>
</div>
<div *ngIf="captchaFailed" class="warning--error margin-top--small">
There was an issue verifying your captcha. Please
<a (click)="resetCaptcha()">reset the captcha</a> and try again, or
Expand Down
31 changes: 20 additions & 11 deletions src/app/get-deso/get-deso.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export class GetDesoComponent implements OnInit {
captchaFailed = false;
// Whether the backend is offering rewards for solving captchas.
captchaAvailable = true;
// Loader shown while waiting for DESO to arrive.
captchaFlowSpinner = false;

publicKeyCopied = false;

Expand Down Expand Up @@ -160,19 +162,26 @@ export class GetDesoComponent implements OnInit {
}

onCaptchaVerify(token: string): void {
this.backendAPIService.VerifyHCaptcha(token, this.publicKeyAdded).subscribe(
(res) => {
if (res.Success) {
this.isFinishFlowDisabled = false;
this.finishFlow();
} else {
this.captchaFlowSpinner = true;
this.backendAPIService
.VerifyHCaptcha(token, this.publicKeyAdded)
.subscribe(
async (res) => {
if (res.Success) {
await this.backendAPIService
.GetTxn(res.TxnHashHex, 'InMempool')
.toPromise();
this.isFinishFlowDisabled = false;
this.finishFlow();
} else {
this.captchaFailed = true;
}
},
(err) => {
this.captchaFailed = true;
}
},
(err) => {
this.captchaFailed = true;
}
);
)
.add(() => (this.captchaFlowSpinner = false));
}

onCaptchaExpired(event: any): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,21 @@ <h3 class="text--neutral-white">Confirm your authentication code</h3>
</div>
</div>
<div class="margin-top--medium">
<div
*ngIf="submittingPhoneNumberVerificationCode"
class="padding-top--medium display--flex flex--column items--center"
>
<div>Waiting for your $DESO to arrive.</div>
<div class="spinner-border" style="width: 6rem; height: 6rem"></div>
</div>
<button
data-control-name="get-starter-deso-confirm-code-button"
(click)="submitVerificationCode()"
[ngClass]="{
disabled: !verificationCodeForm.valid,
'btn-loading': submittingPhoneNumberVerificationCode
}"
[disabled]="submittingPhoneNumberVerificationCode"
class="button--primary button--medium margin-bottom--medium"
>
Confirm
Expand All @@ -300,6 +308,7 @@ <h3 class="text--neutral-white">Confirm your authentication code</h3>
data-control-name="get-starter-deso-back-button"
*ngIf="displayForSignupFlow"
(click)="backButtonClickedOnSubmitVerificationScreen()"
[disabled]="submittingPhoneNumberVerificationCode"
class="button--primary--outline button--medium"
>
Back
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ export class SignUpGetStarterDESOComponent implements OnInit {
this.verificationCodeForm.value.verificationCode
)
.subscribe(
(res) => {
async (res) => {
await this.backendApi.GetTxn(res.TxnHashHex, 'InMempool').toPromise();
this.screenToShow =
SignUpGetStarterDESOComponent.COMPLETED_PHONE_NUMBER_VERIFICATION_SCREEN;
this.phoneNumberVerified.emit();
Expand Down