Skip to content

Commit

Permalink
Merge pull request #77 from Tuditi/feat/add-bloom-deeplink
Browse files Browse the repository at this point in the history
Feat: add bloom deeplink
  • Loading branch information
adamunchained authored Nov 6, 2023
2 parents db43962 + 14a2d64 commit f9fd207
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/app/components/wallet-deeplink/wallet-deeplink.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<div class="flex flex-col items-center justify-center w-full lg:flex-row lg:w-auto">
<a
nz-button
*ngIf="bloomDeepLink"
[href]="bloomDeepLink"
class="deep-link"
nzSize="large"
>
<div class="flex items-center">
<img src="/assets/logos/bloom.png" alt="Bloom logo" class="w-32" />
</div>
</a>
<a
nz-button
*ngIf="fireflyDeepLink"
[href]="fireflyDeepLink"
[disabled]="!fireflyDeepLink"
class="deep-link"
nzSize="large"
>
<div class="flex items-center">
<img src="/assets/logos/firefly.svg" alt="Firefly logo" class="mr-2" />
Expand All @@ -14,10 +25,10 @@
<a
nz-button
*ngIf="showTanglePay"
nzSize="large"
[disabled]="!tanglePayDeepLink"
[href]="tanglePayDeepLink"
class="deep-link"
nzSize="large"
>
<div class="flex items-center">
<img src="/assets/logos/tanglepay.png" alt="Tanglepay logo" class="w-32" />
Expand Down
31 changes: 30 additions & 1 deletion src/app/components/wallet-deeplink/wallet-deeplink.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export class WalletDeeplinkComponent {
}

@Input() public showTanglePay = true;


public bloomDeepLink?: SafeUrl;
public fireflyDeepLink?: SafeUrl;
public tanglePayDeepLink?: SafeUrl;
private _targetAddress?: string;
Expand All @@ -83,10 +84,38 @@ export class WalletDeeplinkComponent {
constructor(private sanitizer: DomSanitizer, private cd: ChangeDetectorRef) {}

private setLinks(): void {
this.bloomDeepLink = this.getBloomDeepLink();
this.fireflyDeepLink = this.getFireflyDeepLink();
this.tanglePayDeepLink = this.getTanglePayDeepLink();
}

private getBloomDeepLink(): SafeUrl {
if (!this._network || this._network === Network.IOTA || this._network === Network.ATOI) {
// TODO: IOTA network support in Bloom
return '';
} else {
// Shimmer Network
const parameters = {
address: this.targetAddress,
baseCoinAmount: this.tokenId && this.surplus ? Number(this.targetAmount).toFixed(0): undefined,
tokenId: this.tokenId,
tokenAmount: this.tokenId ? this.tokenAmount : undefined,
tag: WEN_NAME.toLowerCase(),
giftStorageDeposit: true,
disableToggleGift: true,
disableChangeExpiration: true,
disableChangeTimelock: true
};
const searchParametersArray: (string | undefined)[] = Object.entries(parameters).map(([key, value]) => { return value ? `${key}=${value}` : undefined});
const searchParametersString = searchParametersArray.filter(x => x !== undefined).flat().join('&');

return this.sanitizer.bypassSecurityTrustUrl(
`bloom://wallet/sendTransaction?${searchParametersString}`
)

}
}

private getFireflyDeepLink(): SafeUrl {
if (!this.targetAddress || !this.targetAmount) {
return '';
Expand Down
Binary file added src/assets/logos/bloom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f9fd207

Please sign in to comment.