Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit b100015

Browse files
committed
Shapeshift integration with Shifty Button
1 parent a5cbe06 commit b100015

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

js/templates/buyWizard.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ <h3 class="custCol-text padding30"><%= polyglot.t('CheckExchanges') %> </h3>
2323
})
2424
%>
2525
</div>
26-
<div class="txt-center row10">
26+
<div class="txt-center row10 textSize20px custCol-text">
27+
<img class="js-buyWizardShapeshiftURL" src="https://shapeshift.io/images/shifty/xs_dark_altcoins.png" class="ss-button"></a>
28+
</div>
2729
<input type="checkbox" class="textSize11px fieldItem thin" id="BuyWizardQRDetailsInput">
2830
<label for="BuyWizardQRDetailsInput" class="textSize11px custCol-text"> <%= polyglot.t('AdditionalPaymentDataInfo') %></label>
2931
</div>

js/views/buyWizardVw.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ var __ = require('underscore'),
1212
qr = require('qr-encode'),
1313
app = require('../App').getApp(),
1414
clipboard = require('electron').clipboard,
15-
templateHelpers = require('../utils/templateHelpers');
15+
templateHelpers = require('../utils/templateHelpers'),
16+
electron = require('electron'),
17+
BrowserWindow = electron.remote.BrowserWindow;
18+
1619

1720
module.exports = baseModal.extend({
1821

@@ -37,6 +40,7 @@ module.exports = baseModal.extend({
3740
'click .js-buyWizardPurchaseBack': 'backPurchase',
3841
'click .js-buyWizardPayCopy': 'copyPayAddress',
3942
'click .js-accordionNext': 'accNext',
43+
'click .js-buyWizardShapeshiftURL': 'openShapeshiftURL',
4044
'click .js-accordionPrev': 'accPrev',
4145
'click .js-buyWizardCountryWrapper': 'openCountrySelect',
4246
'click .js-buyWizardPayCheck': 'checkPayment',
@@ -597,7 +601,15 @@ module.exports = baseModal.extend({
597601
this.$el.find('.js-buyWizardPayPrice').text();
598602
this.$el.find('.js-buyWizardPayURL').text(data.payment_address);
599603
this.$el.find('.js-buyWizardPayLink').attr('href', payHREF);
600-
this.buyDetailsView.lockForm();
604+
console.log(electron);
605+
},
606+
607+
openShapeshiftURL: function() {
608+
var totalBTCPrice = this.buyDetailsView.model.attributes.totalBTCDisplayPrice;
609+
var paymentAddress = this.buyRequest.responseJSON.payment_address;
610+
var shapeshiftURL = 'https://shapeshift.io/shifty.html?destination='+paymentAddress+'&amp;output=BTC&apiKey=24ad734e196c948de4608e00472ab8a4b956a298c52abc20fda74114d6cebcb632714a9c5a0f38f46cef0bc974dfd41c34488432128d65acc099b3892f92d602&amount='+totalBTCPrice;
611+
var shapeshiftWin = new BrowserWindow({width: 700, height: 500, frame: true});
612+
shapeshiftWin.loadURL(shapeshiftURL);
601613
},
602614

603615
hidePayAddress: function(){

0 commit comments

Comments
 (0)