mirror of https://github.com/BTCPrivate/copay.git
feat: shapeshift terms and some fixes
This commit is contained in:
parent
0929866673
commit
a6ac577fa3
|
@ -91,7 +91,17 @@
|
|||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
Limit
|
||||
Deposit Min
|
||||
<ion-note item-end>
|
||||
<span *ngIf="!limit">...</span>
|
||||
<span *ngIf="limit">
|
||||
{{limit.minimum}} {{fromWallet.coin | uppercase}}
|
||||
</span>
|
||||
</ion-note>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
Deposit Max
|
||||
<ion-note item-end>
|
||||
<span *ngIf="!limit">...</span>
|
||||
<span *ngIf="limit">
|
||||
|
@ -101,20 +111,32 @@
|
|||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
Minimum
|
||||
Miner fee
|
||||
<ion-note item-end>
|
||||
<span *ngIf="!limit">...</span>
|
||||
<span *ngIf="limit">
|
||||
{{limit.min}} {{fromWallet.coin | uppercase}}
|
||||
{{limit.minerFee}} {{fromWallet.coin | uppercase}}
|
||||
</span>
|
||||
</ion-note>
|
||||
</ion-item>
|
||||
|
||||
</ion-list>
|
||||
|
||||
<div class="agree-to-terms">
|
||||
<ion-item color="light" text-wrap>
|
||||
<ion-checkbox class="check" [(ngModel)]="termsAccepted"></ion-checkbox>
|
||||
</ion-item>
|
||||
<div class="terms">
|
||||
<p translate>
|
||||
I agree to the
|
||||
<a (click)="openTerms()"> Terms </a>
|
||||
and certify that I am the beneficial owner of the input assets and the destination address.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="buttons-container">
|
||||
<!-- TODO: noLowFee -->
|
||||
<button ion-button type="button" *ngIf="fromWallets.length > 0 && toWallets.length > 0" [disabled]="!fromWallet || !toWallet"
|
||||
<button ion-button type="button" *ngIf="fromWallets.length > 0 && toWallets.length > 0" [disabled]="!fromWallet || !toWallet || !termsAccepted"
|
||||
(click)="setAmount()">
|
||||
Continue
|
||||
</button>
|
||||
|
|
|
@ -20,4 +20,31 @@ page-shapeshift-shift {
|
|||
display: block;
|
||||
}
|
||||
}
|
||||
.agree-to-terms {
|
||||
position: relative;
|
||||
ion-item {
|
||||
height: 6rem;
|
||||
.check {
|
||||
margin: 9px 15px 9px 4px !important;
|
||||
}
|
||||
}
|
||||
.terms {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 6rem;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 5rem;
|
||||
padding: 0rem;
|
||||
margin: 0rem;
|
||||
p {
|
||||
padding-right: 1rem;
|
||||
font-size: 12px;
|
||||
}
|
||||
a {
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import * as _ from 'lodash';
|
|||
import { AmountPage } from './../../../send/amount/amount';
|
||||
|
||||
// Providers
|
||||
import { ExternalLinkProvider } from '../../../../providers/external-link/external-link';
|
||||
import { PopupProvider } from '../../../../providers/popup/popup';
|
||||
import { ProfileProvider } from '../../../../providers/profile/profile';
|
||||
import { ShapeshiftProvider } from '../../../../providers/shapeshift/shapeshift';
|
||||
|
@ -29,9 +30,11 @@ export class ShapeshiftShiftPage {
|
|||
public network: string;
|
||||
public fromWalletSelectorTitle: string;
|
||||
public toWalletSelectorTitle: string;
|
||||
public termsAccepted: boolean;
|
||||
|
||||
constructor(
|
||||
private events: Events,
|
||||
private externalLinkProvider: ExternalLinkProvider,
|
||||
private logger: Logger,
|
||||
private navCtrl: NavController,
|
||||
private popupProvider: PopupProvider,
|
||||
|
@ -42,6 +45,7 @@ export class ShapeshiftShiftPage {
|
|||
this.walletsBch = [];
|
||||
this.fromWalletSelectorTitle = 'From';
|
||||
this.toWalletSelectorTitle = 'To';
|
||||
this.termsAccepted = false;
|
||||
this.network = this.shapeshiftProvider.getNetwork();
|
||||
|
||||
this.walletsBtc = this.profileProvider.getWallets({
|
||||
|
@ -62,8 +66,9 @@ export class ShapeshiftShiftPage {
|
|||
}
|
||||
|
||||
this.fromWallets = _.filter(this.walletsBtc.concat(this.walletsBch), (w: any) => {
|
||||
// Available balance and 1-signature wallet
|
||||
return w.status.balance.availableAmount > 0 && w.credentials.m == 1;
|
||||
// Available cached funds
|
||||
let hasCachedFunds = w.cachedBalance.match(/0\.00 /gi) ? false : true;
|
||||
return hasCachedFunds;
|
||||
});
|
||||
|
||||
this.onFromWalletSelect(this.fromWallets[0]);
|
||||
|
@ -73,6 +78,11 @@ export class ShapeshiftShiftPage {
|
|||
this.logger.info('ionViewDidLoad ShapeshiftShiftPage');
|
||||
}
|
||||
|
||||
public openTerms() {
|
||||
let url = "https://info.shapeshift.io/sites/default/files/ShapeShift_Terms_Conditions%20v1.1.pdf";
|
||||
this.externalLinkProvider.open(url);
|
||||
}
|
||||
|
||||
private showErrorAndBack(title: string, msg: any): void {
|
||||
title = title ? title : 'Error'; // TODO: gettextCatalog
|
||||
this.logger.error(msg);
|
||||
|
@ -90,7 +100,7 @@ export class ShapeshiftShiftPage {
|
|||
this.shapeshiftProvider.getRate(pair, (err: any, rate: number) => {
|
||||
this.rate = rate;
|
||||
});
|
||||
this.shapeshiftProvider.getLimit(pair, (err: any, limit: any) => {
|
||||
this.shapeshiftProvider.getMarketInfo(pair, (err: any, limit: any) => {
|
||||
this.limit = limit;
|
||||
});
|
||||
}
|
||||
|
@ -105,6 +115,9 @@ export class ShapeshiftShiftPage {
|
|||
}
|
||||
|
||||
public setAmount(): void {
|
||||
if (!this.termsAccepted) {
|
||||
return;
|
||||
}
|
||||
this.navCtrl.push(AmountPage, {
|
||||
nextPage: 'ShapeshiftConfirmPage',
|
||||
fixedUnit: true,
|
||||
|
@ -113,7 +126,7 @@ export class ShapeshiftShiftPage {
|
|||
toWalletId: this.toWallet.id,
|
||||
currency: this.fromWallet.coin.toUpperCase(),
|
||||
shiftMax: this.limit.limit + ' ' + this.fromWallet.coin.toUpperCase(),
|
||||
shiftMin: this.limit.min + ' ' + this.fromWallet.coin.toUpperCase()
|
||||
shiftMin: this.limit.minimum + ' ' + this.fromWallet.coin.toUpperCase()
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,15 @@
|
|||
</div>
|
||||
|
||||
<ion-list class="shift">
|
||||
<button ion-item no-low-fee (click)="goTo('Shift')">
|
||||
<ion-item-divider class="help" color="light">
|
||||
<div>
|
||||
<span>Having problems with a ShapeShift?</span>
|
||||
<a (click)="openExternalLink('https://shapeshift.zendesk.com/hc/en-us/requests/new')">
|
||||
Contact the ShapeShift support team.
|
||||
</a>
|
||||
</div>
|
||||
</ion-item-divider>
|
||||
<button class="shift-btn" ion-item no-low-fee (click)="goTo('Shift')">
|
||||
<img src="assets/img/shapeshift/icon-shapeshift.svg">
|
||||
<span>Shift</span>
|
||||
</button>
|
||||
|
|
|
@ -49,9 +49,17 @@ page-shapeshift {
|
|||
img {
|
||||
width: 30px;
|
||||
}
|
||||
ion-label {
|
||||
&-btn .label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.help .label {
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
font-size: 12px;
|
||||
span {
|
||||
margin-right: 0.6rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<span translate>Amount</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="shiftMin && shiftMax">
|
||||
<div *ngIf="shiftMin && shiftMax" class="shapeshift-values">
|
||||
<div>Min: {{shiftMin}}</div>
|
||||
<div>Max: {{shiftMax}}</div>
|
||||
</div>
|
||||
|
|
|
@ -4,6 +4,9 @@ page-amount {
|
|||
padding: 18px 16px 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
.shapeshift-values {
|
||||
padding: 1.7rem;
|
||||
}
|
||||
.amount-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
|
@ -20,6 +20,7 @@ export class OnGoingProcessProvider {
|
|||
'calculatingFee': 'Calculating fee',
|
||||
'connectingCoinbase': 'Connecting to Coinbase...',
|
||||
'connectingGlidera': 'Connecting to Glidera...',
|
||||
'connectingShapeshift': 'Connecting to Shapeshift...',
|
||||
'creatingTx': 'Creating transaction',
|
||||
'creatingWallet': 'Creating Wallet...',
|
||||
'deletingWallet': 'Deleting Wallet...',
|
||||
|
|
|
@ -134,6 +134,16 @@ export class ShapeshiftProvider {
|
|||
});
|
||||
}
|
||||
|
||||
public getMarketInfo(pair: string, cb) {
|
||||
this.http.get(this.credentials.API_URL + '/marketinfo/' + pair).subscribe((data: any) => {
|
||||
this.logger.info('Shapeshift MARKET INFO: SUCCESS');
|
||||
return cb(null, data);
|
||||
}, (data: any) => {
|
||||
this.logger.error('Shapeshift MARKET INFO ERROR', data.error.message);
|
||||
return cb(data);
|
||||
});
|
||||
}
|
||||
|
||||
public getStatus(addr: string, cb) {
|
||||
this.http.get(this.credentials.API_URL + '/txStat/' + addr).subscribe((data: any) => {
|
||||
this.logger.info('Shapeshift STATUS: SUCCESS');
|
||||
|
|
Loading…
Reference in New Issue