Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request papers/airgap/airgap-wallet!740
  • Loading branch information
godenzim committed Feb 28, 2024
2 parents 975b9b0 + 1931114 commit 0d94d18
Show file tree
Hide file tree
Showing 20 changed files with 2,256 additions and 590 deletions.
2,387 changes: 1,851 additions & 536 deletions package-lock.json

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,28 @@
}
},
"dependencies": {
"@airgap/aeternity": "0.13.23",
"@airgap/angular-core": "0.0.43",
"@airgap/angular-ngrx": "0.0.43",
"@airgap/astar": "0.13.23",
"@airgap/aeternity": "0.13.25",
"@airgap/angular-core": "0.0.44",
"@airgap/angular-ngrx": "0.0.44",
"@airgap/astar": "0.13.25",
"@airgap/beacon-sdk": "3.1.5-beta.0",
"@airgap/bitcoin": "0.13.23",
"@airgap/coinlib-core": "0.13.23",
"@airgap/coreum": "0.13.23",
"@airgap/cosmos": "0.13.23",
"@airgap/cosmos-core": "0.13.23",
"@airgap/crypto": "0.13.23",
"@airgap/ethereum": "0.13.23",
"@airgap/groestlcoin": "0.13.23",
"@airgap/icp": "0.13.23",
"@airgap/module-kit": "0.13.23",
"@airgap/moonbeam": "0.13.23",
"@airgap/optimism": "0.13.23",
"@airgap/polkadot": "0.13.23",
"@airgap/bitcoin": "0.13.25",
"@airgap/coinlib-core": "0.13.25",
"@airgap/coreum": "0.13.25",
"@airgap/cosmos": "0.13.25",
"@airgap/cosmos-core": "0.13.25",
"@airgap/crypto": "0.13.25",
"@airgap/ethereum": "0.13.25",
"@airgap/groestlcoin": "0.13.25",
"@airgap/icp": "0.13.25",
"@airgap/module-kit": "0.13.25",
"@airgap/moonbeam": "0.13.25",
"@airgap/optimism": "0.13.25",
"@airgap/polkadot": "0.13.25",
"@airgap/sapling-wasm": "0.0.7",
"@airgap/serializer": "0.13.23",
"@airgap/substrate": "0.13.23",
"@airgap/tezos": "0.13.23",
"@airgap/serializer": "0.13.25",
"@airgap/substrate": "0.13.25",
"@airgap/tezos": "0.13.25",
"@airgap-community/iso-rootstock": "1.0.0",
"@angular/animations": "^16.1.1",
"@angular/common": "^16.1.1",
Expand Down Expand Up @@ -131,9 +131,9 @@
"@types/ledgerhq__hw-transport-u2f": "^4.21.1",
"@types/ledgerhq__hw-transport-webusb": "^4.70.0",
"@walletconnect/client": "^1.4.1",
"@walletconnect/core": "^2.8.0",
"@walletconnect/utils": "^2.8.0",
"@walletconnect/web3wallet": "^1.8.0",
"@walletconnect/core": "^2.11.0",
"@walletconnect/utils": "^2.11.0",
"@walletconnect/web3wallet": "^1.10.0",
"@zondax/ledger-polkadot": "^0.13.6",
"@zondax/ledger-substrate": "^0.17.3",
"@zxing/browser": "0.1.4",
Expand Down
4 changes: 4 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ const routes: Routes = [
(m) => m.InteractionSelectionSettingsPageModule
)
},
{
path: 'trading-settings',
loadChildren: () => import('./pages/trading-settings/trading-settings.module').then((m) => m.TradingSettingsPageModule)
},
{
path: 'collectibles-list/:id/:publicKey/:protocolID/:addressIndex',
resolve: {
Expand Down
14 changes: 14 additions & 0 deletions src/app/pages/account-add/account-add.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,21 @@
></currency-item>
</ion-list>
</ion-grid>

<ion-card class="ion-padding" color="secondary">
<ion-row>
<ion-col>
<ion-icon style="zoom: 4;" src="assets/img/shapes.svg"></ion-icon>
</ion-col>
<ion-col size="9">
<ion-label class="ion-text-wrap">
<h2 style="color: white;">{{ "account-add.isolated-module" | translate }}</h2>
</ion-label>
</ion-col>
</ion-row>
</ion-card>
</ion-content>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button id="add-more-coins-button" color="secondary" (click)="navigateToScan()">
<ion-icon name="barcode-outline"></ion-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,34 @@
<ion-fab vertical="bottom" slot="fixed">
<ion-row>
<ion-col>
<ion-button
*ngIf="isMtPerelinActive"
class="mt-perelin-button"
expand="full"
size="default"
color="white"
(click)="buyMtPerelin()"
shape="round"
>
{{ 'account-transaction-list.mtpelerin.buy_label' | translate }}
</ion-button>
<ion-button id="receive" expand="full" size="default" color="primary" (click)="openReceivePage()" shape="round">
<ion-icon slot="start" src="./assets/custom-ion-icons/md-call_received.svg"></ion-icon>
{{ 'account-transaction-list.receive_label' | translate }}
</ion-button>
</ion-col>
<ion-col>
<ion-button
*ngIf="isMtPerelinActive"
class="mt-perelin-button"
expand="full"
size="default"
color="white"
(click)="sellMtPerelin()"
shape="round"
>
{{ 'account-transaction-list.mtpelerin.cash-out_label' | translate }}
</ion-button>
<ion-button
id="send"
expand="full"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ ion-fab {
svg {
stroke: none;
}

.mt-perelin-button {
border: 1px solid gray;
border-radius: 100px;

div {
display: flex;
align-items: center;
gap: 8px;
margin-left: auto;
font-size: 12px;
color: rgb(83, 83, 83);

img {
height: 18px;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { createV0TezosKtProtocol, ICoinSubProtocolAdapter, ProtocolService } from '@airgap/angular-core'
import {
createV0TezosKtProtocol,
ICoinSubProtocolAdapter,
InternalStorageKey,
InternalStorageService,
ProtocolService
} from '@airgap/angular-core'
import { AirGapMarketWallet, IAirGapTransaction, MainProtocolSymbols, SubProtocolSymbols } from '@airgap/coinlib-core'
import { Action } from '@airgap/coinlib-core/actions/Action'
import { IAirGapAddressResult } from '@airgap/coinlib-core/interfaces/IAirGapAddress'
Expand Down Expand Up @@ -116,6 +122,7 @@ export class AccountTransactionListPage {
private readonly pushBackendProvider: PushBackendProvider,
private readonly extensionsService: ExtensionsService,
private readonly browserService: BrowserService,
private readonly storageService: InternalStorageService,
private readonly modalController: ModalController
) {
this.isDesktop = this.platform.is('desktop')
Expand Down Expand Up @@ -159,6 +166,18 @@ export class AccountTransactionListPage {
this.actionGroup.getActions().then((actions) => {
this.actions = actions
})

// Mt Perelin
this.storageService.get(InternalStorageKey.SETTINGS_TRADING_USE_MTPELERIN).then((active) => {
if (active) {
this.storageProvider.getCache('mtperelin-currencies').then((savedCurrencies) => {
this.wallet.protocol.getSymbol().then((symbol) => {
const validCurrency = Object.values(savedCurrencies).find((currency) => currency.symbol === symbol)
this.isMtPerelinActive = !!active && !!validCurrency
})
})
}
})
}

public showNoTransactionScreen(): boolean {
Expand Down Expand Up @@ -416,4 +435,20 @@ export class AccountTransactionListPage {
})
})
}

public async buyMtPerelin() {
this.wallet.protocol.getSymbol().then(async (symbol) => {
const url = `https://buy.mtpelerin.com/?type=direct-link&bdc=${symbol}&rfr=bcH4RmHm&_ctkn=954139b2-ef3e-4914-82ea-33192d3f43d3`
await this.openModal(url)
// window.open(`https://buy.mtpelerin.com/?type=direct-link&bdc=${symbol}&rfr=bcH4RmHm`, '_blank')
})
}

public async sellMtPerelin() {
this.wallet.protocol.getSymbol().then(async (symbol) => {
const url = `https://sell.mtpelerin.com/?type=direct-link&tab=sell&ssc=${symbol}&rfr=bcH4RmHm&_ctkn=954139b2-ef3e-4914-82ea-33192d3f43d3`
await this.openModal(url)
// window.open(`https://sell.mtpelerin.com/?type=direct-link&tab=sell&ssc=${symbol}&rfr=bcH4RmHm`, '_blank')
})
}
}
10 changes: 10 additions & 0 deletions src/app/pages/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@
</ion-item>
</ion-list>

<ion-list lines="none">
<ion-list-header class="ion-no-margin" lines="none">
<ion-label>{{ 'settings.trading_settings.label' | translate }}</ion-label>
</ion-list-header>
<ion-item (click)="goToTradingSettings()" detail="true">
<ion-icon name="repeat-outline" slot="start"></ion-icon>
{{ 'settings.trading_settings.text' | translate }}
</ion-item>
</ion-list>

<ion-list lines="none">
<ion-list-header class="ion-no-margin" lines="none">
<ion-label>{{ 'settings.add-ons_settings.label' | translate }}</ion-label>
Expand Down
23 changes: 23 additions & 0 deletions src/app/pages/trading-settings/trading-settings.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { FormsModule } from '@angular/forms'

import { IonicModule } from '@ionic/angular'

import { TranslateModule } from '@ngx-translate/core'
import { ComponentsModule } from '@airgap/angular-core'
import { RouterModule } from '@angular/router'
import { TradingSettingsPage } from './trading-settings.page'

@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ComponentsModule,
TranslateModule,
RouterModule.forChild([{ path: '', component: TradingSettingsPage }])
],
declarations: [TradingSettingsPage]
})
export class TradingSettingsPageModule {}
65 changes: 65 additions & 0 deletions src/app/pages/trading-settings/trading-settings.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<ion-header class="ion-no-border">
<ion-grid class="ion-no-padding">
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button defaultHref="/tabs/settings"></ion-back-button>
</ion-buttons>
<ion-title>{{ 'settings.trading_settings.text' | translate }}</ion-title>
</ion-toolbar>
</ion-grid>
</ion-header>
<ion-content>
<ion-item>
<ion-toggle [checked]="useMtPerelin" (ionChange)="toggleUseMtPerelin($event)" slot="end">{{ 'settings.trading_settings.mtpelerin' | translate }}</ion-toggle>
</ion-item>

<div class="mtpelerin-wrapper">
<img src="https://www.mtpelerin.com/images/logo.svg" />
<h3>{{ 'mtpelerin.header1' | translate }}</h3>
<p>
{{ 'mtpelerin.paragraph1' | translate }}
</p>
<h3>{{ 'mtpelerin.header2' | translate }}</h3>
<ul>
<li>{{ 'mtpelerin.lineItem1' | translate }}</li>
<li>{{ 'mtpelerin.lineItem2' | translate }}</li>
<li>{{ 'mtpelerin.lineItem3' | translate }}</li>
</ul>

<ion-row>
<ion-col>
<ion-button
class="mt-perelin-button"
expand="full"
size="small"
color="white"
shape="round"
(click)="navigate('https://www.mtpelerin.com/buy-crypto')"
>
{{ 'mtpelerin.button1' | translate }}
</ion-button>
</ion-col>
</ion-row>
<ion-row>
<ion-col>
<ion-button
class="mt-perelin-button"
expand="full"
size="small"
color="white"
shape="round"
(click)="navigate('https://www.mtpelerin.com/sell-crypto')"
>
{{ 'mtpelerin.button2' | translate }}
</ion-button>
</ion-col>
</ion-row>

<span>
{{ 'mtpelerin.note' | translate }}
</span>
<span>
<a (click)="navigate('https://developers.mtpelerin.com/service-information/supported-countries')">{{ 'mtpelerin.noteLink1' | translate }}</a>, <a (click)="navigate('https://www.mtpelerin.com/terms-conditions')">{{ 'mtpelerin.noteLink2' | translate }}</a>
</span>
</div>
</ion-content>
45 changes: 45 additions & 0 deletions src/app/pages/trading-settings/trading-settings.page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.mtpelerin-wrapper {
display: flex;
flex-direction: column;
padding: 24px;

.buttons-wrapper {
display: flex;
flex-direction: column;
}

img {
height: 48px;
width: fit-content;
}

h3 {
color: white;
margin-top: 32px;
margin-bottom: 0px;
font-size: 18px;
font-weight: bold;
}

p {
margin-top: 12px;
margin-bottom: 0px;
font-size: 14px;
font-weight: 400;
}

ul {
margin-top: 12px;
margin-bottom: 32px;
font-size: 14px;
font-weight: 400;
}

span {
margin-top: 12px;
margin-bottom: 0px;
font-size: 12px;
font-weight: 400;
color: gray;
}
}
26 changes: 26 additions & 0 deletions src/app/pages/trading-settings/trading-settings.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { InternalStorageKey, InternalStorageService } from '@airgap/angular-core'
import { Component } from '@angular/core'

@Component({
selector: 'app-trading-settings',
templateUrl: './trading-settings.page.html',
styleUrls: ['./trading-settings.page.scss']
})
export class TradingSettingsPage {
public useMtPerelin: boolean = false

public constructor(private readonly storageService: InternalStorageService) {
this.storageService.get(InternalStorageKey.SETTINGS_TRADING_USE_MTPELERIN).then((value) => {
this.useMtPerelin = value
})
}

public async toggleUseMtPerelin(event: any) {
const value = event.detail.checked
await this.storageService.set(InternalStorageKey.SETTINGS_TRADING_USE_MTPELERIN, value)
}

public navigate(path: string) {
window.open(path, '_blank')
}
}

0 comments on commit 0d94d18

Please sign in to comment.