Skip to content

Commit

Permalink
SetPublickey witout signer
Browse files Browse the repository at this point in the history
  • Loading branch information
gRoussac committed Oct 30, 2024
1 parent 4cf3419 commit 594ef55
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ <h2 class="title">Dict</h2>
(click)="setAccountHash()"
>↓ account-hash</span
>
<span
*ngIf="activePublicKey"
class="cursor-pointer"
(click)="setAccountBase64()"
<span class="cursor-pointer" (click)="setAccountBase64()"
>↓ account-base64</span
>
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h2 class="title">Config</h2>
#activePublicKeyElt
type="search"
[value]="activePublicKey || ''"
(change)="(true)"
(change)="setActivePublicKey($event)"
(keyup.enter)="getPurseURef()"
placeholder="ex: 0x"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Inject, OnDestroy, Output, ViewChild } from '@angular/core';
import { CommonModule } from '@angular/common';
import { State } from '@casper-api/api-interfaces';
import { State, User } from '@casper-api/api-interfaces';
import { DeployerService } from '@casper-data/data-access-deployer';
import { Subscription } from 'rxjs';
import { ResultService } from '../result/result.service';
Expand All @@ -22,6 +22,7 @@ export class PublicKeyComponent implements AfterViewInit, OnDestroy {

apiUrl?: string;
activePublicKey?: string;
user?: User;

private getStateSubscription!: Subscription;
private getPurseURefSubscription!: Subscription;
Expand Down Expand Up @@ -53,10 +54,23 @@ export class PublicKeyComponent implements AfterViewInit, OnDestroy {
this.activePublicKeyElt.nativeElement.value =
state.user.activePublicKey
);
this.user = state.user;
this.changeDetectorRef.markForCheck();
});
}

setActivePublicKey($event: Event) {
const public_key = ($event.target as HTMLSelectElement).value || '';
if (public_key) {
this.user = {
activePublicKey: public_key
};
this.deployerService.setState({
user: this.user
});
}
}

getPurseURef(): void {
if (!this.isFormValid()) {
return;
Expand Down

0 comments on commit 594ef55

Please sign in to comment.