Remove money stuff (bloat--)

master
Skylar Ittner 5 months ago
parent 25c27cb405
commit 4c68c14293

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,523 +0,0 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var walletPubKeyRegex = /^(bc1|[13]|D)[a-zA-HJ-NP-Z0-9]{25,}$/;
var paymentRequestRegex = /^(?:bitcoin|dogecoin):([a-zA-Z0-9]{20,40})(?:\?(.*))?$/;
var walletPrivateKeyRegex = /^[0-9A-Za-z]+$/;
/**
* Parse a crypto URI and extract the info in it.
* Copyright (c) 2019 Robin Linus, MIT license, https://github.com/coins/bitcoin-uri-js
* @param {type} uri
* @returns {parsePaymentURI.parsed}
*/
function parsePaymentURI(uri) {
const legalKeys = ['address', 'amount', 'value', 'message', 'send', 'tx'];
const match = paymentRequestRegex.exec(uri);
if (!match) {
return null;
}
const parsed = {uri: uri}
if (match[2]) {
const queries = match[2].split('&');
for (let i = 0; i < queries.length; i++) {
const query = queries[i].split('=');
const key = query[0];
if (query.length === 2 && legalKeys.includes(key)) {
parsed[key] = decodeURIComponent(query[1].replace(/\+/g, '%20'));
}
}
}
parsed.address = match[1];
return parsed;
}
function openWalletPage(walletaddress) {
var navuri = '/crypto/' + walletaddress;
if (typeof router.currentRoute.query.paymenturi != 'undefined') {
var parsed = parsePaymentURI(router.currentRoute.query.paymenturi);
if (parsed != null) {
navuri += '/' + parsed.address;
if (typeof parsed['amount'] != 'undefined') {
navuri += '/' + parsed.amount;
}
}
}
router.navigate(navuri);
}
function scanWalletQrCode(callback) {
scanBarcode(function (result) {
if (walletPubKeyRegex.test(result)) {
callback(result);
} else {
app.dialog.alert("That doesn't look like a valid wallet address.", "Error");
return;
}
}, function () {
app.dialog.alert("Something went wrong and we can't scan right now.", "Error");
});
}
function scanPrivateKeyQrCode(callback) {
scanBarcode(function (result) {
if (walletPrivateKeyRegex.test(result)) {
callback(result);
} else {
app.dialog.alert("That doesn't look like a valid wallet address.", "Error");
return;
}
}, function () {
app.dialog.alert("Something went wrong and we can't scan right now.", "Error");
});
}
/**
* Create and sign a crypto transaction.
*
* @param {type} bitcoreLib Bitcore, Litecore, Dogecore, etc.
* @param {type} privateKeyString Private key from wallet QR code
* @param {type} sourceAddress Sender's wallet address
* @param {type} destinationAddress Recipient's wallet address
* @param {Array} utxos Unspent transaction inputs, as array. See createUtxo()
* @param {type} outputSatoshis Amount to send to recipient's wallet
* @returns {string} Hex of serialized transaction, suitable for broadcast via Bitcoin Core or an API.
*/
function createSignedTransaction(bitcoreLib, privateKeyString, sourceAddress, destinationAddress, utxos, outputSatoshis, feePerByte) {
if (typeof feePerByte == "undefined") {
feePerByte = -1;
}
try {
var privateKey = new bitcoreLib.PrivateKey(privateKeyString);
var transaction = new bitcoreLib.Transaction()
.from(utxos)
.to(destinationAddress, outputSatoshis)
.change(sourceAddress);
var size = transaction._estimateSize();
var fee = size * feePerByte;
if (feePerByte > -1) {
// use our fee
transaction = transaction.fee(fee);
} else {
// use lib's fee
fee = transaction.getFee();
}
transaction = transaction.sign(privateKey);
var inputTotal = transaction._getInputAmount();
var outputTotal = fee + outputSatoshis;
} catch (ex) {
throw new Error("There was an internal error while creating the transaction. Details: " + ex.message);
}
console.log(inputTotal, outputTotal);
if (outputTotal > inputTotal) {
throw new Error("You have insufficient funds to cover the payment and transaction fees.");
}
try {
return {serialized: transaction.serialize(), fee: fee, sendamount: outputSatoshis, totalspent: outputTotal};
} catch (ex) {
throw new Error("Couldn't create the transaction. It's likely you typed something wrong. Check that you have enough funds.");
}
}
/**
* Create a UTXO.
*
* @param {type} sourceAddress Sender's wallet address
* @param {type} txHash From UTXO (unspent output)
* @param {type} txOutputIndex From UTXO (unspent output)
* @param {type} script From UTXO (unspent output)
* @param {type} inputSatoshis From UTXO (unspent output)
* @returns {createUtxo.utxo}
*/
function createUtxo(sourceAddress, txHash, txOutputIndex, script, inputSatoshis) {
var utxo = {
"txId": txHash,
"outputIndex": txOutputIndex,
"address": sourceAddress,
"script": script,
"satoshis": inputSatoshis
};
return utxo;
}
/**
* Get unspent outputs for a wallet address.
* @param {string} walletaddress
* @param {function} successCallback Passes object with {utxos: [{txHash,txOutputIndex,script,value}], currency: "DOGE", label: "Dogecoin"}
* @param {function} errorCallback Passes string error message suitable for display
* @returns {undefined}
*/
function getUTXOData(walletaddress, successCallback, errorCallback) {
apirequest(SETTINGS.apis.getutxo, {
walletaddress: walletaddress
}, function (resp) {
if (resp.status == "OK") {
successCallback({
utxos: resp.unspent_outputs,
currency: resp.currency,
label: resp.label
});
} else {
errorCallback(resp.msg);
}
}, function (errorData) {
try {
var error = $.parseJSON(errorData.responseText);
if (error && typeof error.msg != 'undefined') {
errorCallback(resp.msg);
sendErrorReport("Crypto", "Couldn't get UTXO data", error.msg);
} else {
errorCallback("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.");
sendErrorReport("Crypto", "Couldn't get UTXO data", "Server/network problem: " + errorData.status + ": " + errorData.statusText);
}
} catch (ex) {
errorCallback("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.");
sendErrorReport("Crypto", "Couldn't get UTXO data", "Server/network problem: " + errorData.status + ": " + errorData.statusText);
}
});
}
function sendCoins(privatekey, fromaddress, toaddress, amount) {
var progressdialog = app.dialog.progress("Querying blockchain...", 20);
getUTXOData(fromaddress, function (success) {
progressdialog.setProgress(40);
progressdialog.setText("Creating transaction...");
if (success.utxos.length == 0) {
app.dialog.close();
app.dialog.alert("Your wallet has no available funds (ZERO_LENGTH_UTXO).", "Error");
return;
}
var utxos = [];
for (var i = 0; i < success.utxos.length; i++) {
utxos.push(createUtxo(fromaddress, success.utxos[i].txHash, success.utxos[i].txOutputIndex, success.utxos[i].script, success.utxos[i].value));
}
var bitcore = null;
var satoshis = parseInt((amount * 100000000).toFixed(0)); // Make sure it's an int and not something like 10.0000000001 or 9.532999999999
switch (success.currency) {
case "DOGE":
bitcore = require("bitcore-lib-doge");
break;
case "BTC":
bitcore = require("bitcore-lib");
break;
default:
app.dialog.close();
app.dialog.alert("This app version doesn't support " + success.currency + ".", "Error");
return;
}
progressdialog.setProgress(60);
progressdialog.setText("Calculating fees...");
apirequest(SETTINGS.apis.cryptofees, {
currency: success.currency
}, function (resp) {
if (resp.status == "OK") {
try {
var txdata = createSignedTransaction(bitcore, privatekey, fromaddress, toaddress, utxos, satoshis, resp.feePerByte);
} catch (ex) {
console.error(ex);
app.dialog.close();
app.dialog.alert(ex.message, "Error");
return;
}
progressdialog.close();
app.dialog.confirm("Sending " + (txdata.sendamount / 100000000) + " " + success.currency
+ " with a fee of " + (txdata.fee / 100000000) + " " + success.currency
+ " for a total spend of " + (txdata.totalspent / 100000000) + " " + success.currency + ".",
"Confirm Transaction",
function (ok) {
progressdialog = app.dialog.progress("Sending payment...", 80);
apirequest(SETTINGS.apis.broadcasttransaction, {
transactiondata: txdata.serialized,
currency: success.currency
}, function (resp) {
if (resp.status == "OK") {
app.dialog.close();
app.dialog.alert("Sent " + amount + " " + success.currency + " to " + toaddress.substring(0, 5) + "..." + toaddress.substring(toaddress.length - 5, 999), "Success!");
$('#walletPrivateKey').val(""); // clear private key input box
app.popup.close();
return;
} else {
app.dialog.close();
app.dialog.alert(resp.msg, "Error");
}
}, function (errorData) {
app.dialog.close();
try {
var error = $.parseJSON(errorData.responseText);
if (error && typeof error.msg != 'undefined') {
app.dialog.alert(error.msg, "Error");
sendErrorReport("Crypto", "Couldn't broadcast transaction", error.msg);
} else {
app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.", "Error");
sendErrorReport("Crypto", "Couldn't broadcast transaction", "Server/network problem: " + errorData.status + ": " + errorData.statusText);
}
} catch (ex) {
app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.", "Error");
sendErrorReport("Crypto", "Couldn't broadcast transaction", "Server/network problem: " + errorData.status + ": " + errorData.statusText);
}
});
});
} else {
app.dialog.close();
app.dialog.alert(resp.msg, "Error");
}
}, function (errorData) {
app.dialog.close();
try {
var error = $.parseJSON(errorData.responseText);
if (error && typeof error.msg != 'undefined') {
app.dialog.alert(error.msg, "Error");
sendErrorReport("Crypto", "Couldn't get transaction fees", error.msg);
} else {
app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.", "Error");
sendErrorReport("Crypto", "Couldn't get transaction fees", "Server/network problem: " + errorData.status + ": " + errorData.statusText);
}
} catch (ex) {
app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.", "Error");
sendErrorReport("Crypto", "Couldn't get transaction fees", "Server/network problem: " + errorData.status + ": " + errorData.statusText);
}
});
}, function (error) {
app.dialog.close();
app.dialog.alert(error, "Error");
});
}
function walletGUISendCoins() {
if (!walletPubKeyRegex.test($('#walletAddress').text())) {
app.dialog.alert("Your wallet address doesn't look right. Check it and try again.", "Error");
return;
}
if (isNaN($('#transactionAmount').val()) || $('#transactionAmount').val() < 0.00000001) {
app.dialog.alert("The amount to send doesn't look right. Check it and try again.", "Error");
return;
}
// Remove payment request URL stuff
if ($('#walletToAddress').val().startsWith("bitcoin:")) {
$('#walletToAddress').val($('#walletToAddress').val().replace("bitcoin:", ""));
}
if ($('#walletToAddress').val().startsWith("dogecoin:")) {
$('#walletToAddress').val($('#walletToAddress').val().replace("dogecoin:", ""));
}
if (!walletPubKeyRegex.test($('#walletToAddress').val())) {
app.dialog.alert("The recipient's wallet address doesn't look right. Check it and try again.", "Error");
return;
}
sendCoins($('#walletPrivateKey').val(), $('#walletAddress').text(), $('#walletToAddress').val(), parseFloat($('#transactionAmount').val()));
}
function openWalletBalancePage( {to, resolve, reject}) {
var address = to.params.walletaddress;
if (!walletPubKeyRegex.test(address)) {
app.dialog.alert("That doesn't look like a valid wallet address.", "Error");
reject();
return;
}
app.dialog.preloader("Loading...");
apirequest(SETTINGS.apis.walletbalance, {
walletaddress: address
}, function (resp) {
app.dialog.close();
if (resp.status == "OK") {
var context = {
balance: resp.balance,
currencyunit: resp.currency,
fiatvalue: resp.usdvalue,
currencyname: resp.label,
attribution: resp.attribution,
exchangerate: resp.exchangerates.usd,
logo: "./assets/images/crypto/" + resp.currency + ".svg",
walletaddress: to.params.walletaddress,
sendtoaddress: (typeof to.params.toaddress != "undefined" ? to.params.toaddress : ""),
sendtoamount: (typeof to.params.amount != "undefined" ? to.params.amount : "")
};
resolve({
content: compiledPages.crypto_wallet(context)
});
} else {
reject();
app.dialog.alert(resp.msg, "Error");
}
}, function (error) {
reject();
app.dialog.close();
try {
var error = $.parseJSON(error.responseText);
if (error && typeof error.msg != 'undefined') {
app.dialog.alert(error.msg, "Error");
sendErrorReport("Crypto", "Couldn't get wallet balance", error.msg);
} else {
app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.", "Error");
sendErrorReport("Crypto", "Couldn't get wallet balance", "Server/network problem: " + error.status + ": " + error.statusText);
}
} catch (ex) {
app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later. Your funds are safe.", "Error");
sendErrorReport("Crypto", "Couldn't get wallet balance", "Server/network problem: " + error.status + ": " + error.statusText);
}
});
}
/**
* Setup an input for specifying amount to send in USD, with conversion to crypto.
* @param {string} walletAddress Detects cryptocurrency from wallet address
* @returns {undefined}
*/
function setupFiatConversion(walletAddress) {
apirequest(SETTINGS.apis.walletbalance, {
walletaddress: walletAddress
}, function (resp) {
if (resp.status != "OK") {
return;
}
if (resp.exchangerates.usd == -1) {
return;
}
$("#cryptoFiatInputItem").css("display", "");
$("#cryptoAmountSendCurrencyLabel").text(resp.currency);
$("#cryptoAmountSendFiatLabel").text("$");
$("#transactionAmountFiat").data("exchange-rate", resp.exchangerates.usd);
$("#transactionAmountFiat").data("cryptocurrency", resp.currency);
$("#transactionAmount").off("input change paste keyup");
$("#transactionAmountFiat").off("input change paste keyup");
$("#transactionAmount").on("input change paste keyup", function () {
if ($("#cryptoFiatInputItem").css("display") == "none") {
return;
}
var amount = parseFloat($("#transactionAmount").val());
var exchangerate = parseFloat($("#transactionAmountFiat").data("exchange-rate"));
$("#transactionAmountFiat").val((amount * exchangerate).toFixed(2));
//$("#transactionAmount").val(amount.toFixed(8));
});
$("#transactionAmountFiat").on("input change paste keyup", function () {
if ($("#cryptoFiatInputItem").css("display") == "none") {
return;
}
var fiatamount = parseFloat($("#transactionAmountFiat").val());
var exchangerate = parseFloat($("#transactionAmountFiat").data("exchange-rate"));
$("#transactionAmount").val((fiatamount / exchangerate).toFixed(8));
});
if ($("#transactionAmount").val() != "") {
// Update the fiat conversion calculation if there's an amount prefilled
$("#transactionAmount").trigger("input");
}
});
}
function setupReceiveFiatConversion() {
var exchangerate = $("#receiveAmountFiat").data("exchangerate");
var fiatlabel = $("#receiveAmountFiat").data("currencylabel");
if (exchangerate == -1) {
return;
}
$("#cryptoAmountReceiveFiatLI").css("display", "");
$("#cryptoAmountReceiveFiatLabel").text(fiatlabel);
$("#receiveAmount").off("input change paste keyup");
$("#receiveAmountFiat").off("input change paste keyup");
$("#receiveAmount").on("input change paste keyup", function () {
if ($("#cryptoAmountReceiveFiatLI").css("display") == "none") {
return;
}
var amount = parseFloat($("#receiveAmount").val());
var exchangerate = parseFloat($("#receiveAmountFiat").data("exchangerate"));
$("#receiveAmountFiat").val((amount * exchangerate).toFixed(2));
});
$("#receiveAmountFiat").on("input change paste keyup", function () {
var fiatamount = parseFloat($("#receiveAmountFiat").val());
var exchangerate = parseFloat($("#receiveAmountFiat").data("exchangerate"));
$("#receiveAmount").val((fiatamount / exchangerate).toFixed(8));
});
if ($("#receiveAmount").val() != "") {
// Update the fiat conversion calculation if there's an amount prefilled
$("#receiveAmount").trigger("input");
}
}
/**
* Hides the fiat conversion input box.
* @returns {undefined}
*/
function unsetupFiatConversion() {
$("#cryptoFiatInputItem").css("display", "none");
$("#cryptoAmountSendCurrencyLabel").text("");
$("#transactionAmountFiat").removeData("exchange-rate");
$("#transactionAmountFiat").removeData("cryptocurrency");
$("#transactionAmount").off("input change paste keyup");
$("#transactionAmountFiat").off("input change paste keyup");
}
function showPaymentRequestQRCode() {
var paymenturi = "";
switch ($("#receiveAmount").data("currency")) {
case "DOGE":
paymenturi = "dogecoin:";
break;
case "BTC":
paymenturi = "bitcoin:";
break;
}
paymenturi += $('#walletAddress').text();
if ($("#receiveAmount").val() > 0) {
paymenturi += "?amount=" + $("#receiveAmount").val();
}
$("#paymentRequestQRCodeContainer").html("");
new QRCode(document.getElementById("paymentRequestQRCodeContainer"), paymenturi);
}
$("#app").on("click", "#sendCryptoOpenPopupBtn", function () {
if (platform_type == "cordova") {
if (cordova.platformId == "ios") {
app.dialog.create({
title: "Switch to Web Version",
text: "Apple doesn't allow this feature on the App Store. Tap Continue to launch the web version of this app instead, which is allowed to send crypto. We're sorry for the inconvenience.",
verticalButtons: true,
buttons: [
{
text: "Continue",
bold: true,
keyCodes: [13],
onClick: function () {
openExternalBrowser("https://app.helena.express/?startpage=crypto");
}
},
{
text: "Cancel",
color: "red"
}
]
}).open();
return;
}
}
app.popup.open("#sendCryptoPopup");
if (walletPubKeyRegex.test($("#walletAddress").text())) {
setupFiatConversion($("#walletAddress").text());
} else {
unsetupFiatConversion();
}
});

@ -1,36 +0,0 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
$("#app").on("submit", "#moneyorderForm", function (e) {
e.preventDefault();
verifyMoneyOrder($('#moneyorderserial').val());
return false;
});
function verifyMoneyOrder(serial) {
if (typeof serial != "string" || serial == "" || /^[0-9]{3,8}$/.test(serial) == false) {
app.dialog.alert("Enter a valid Helena Express money order serial number.", "Whoops!");
return;
}
app.dialog.preloader("Working...");
apirequest(SETTINGS.apis.moneyorderverify, {
serial: serial
}, function (resp) {
app.dialog.close();
if (resp.status == "OK") {
app.dialog.alert("Amount: $" + resp.amount
+ "<br>Issued: " + resp.issued_date + " UTC"
+ (resp.mo_status == "" ? "" : "<br>Status: " + resp.mo_status),
"Money Order #" + resp.serial);
} else {
app.dialog.alert(resp.msg, "Error");
}
}, function (error) {
app.dialog.close();
app.dialog.alert("Connection or server error. Try again later.", "Whoops!");
sendErrorReport("Money Order", "Verification");
});
}

@ -46,8 +46,6 @@
<script src="node_modules/maplibre-gl/dist/maplibre-gl.js"></script>
<script src="node_modules/bwip-js/dist/bwip-js-min.js"></script>
<script src="assets/js/qrcode.min.js"></script>
<script src="assets/js/bitcore-lib.min.js"></script>
<script src="assets/js/bitcore-lib-doge.min.js"></script>
<script src="settings.js"></script>
@ -68,13 +66,9 @@
<script src="assets/js/account.js"></script>
<script src="assets/js/shop.js"></script>
<script src="assets/js/home.js"></script>
<script src="assets/js/crypto.js"></script>
<script src="assets/js/serviceareamap.js"></script>
<script src="assets/js/locationmap.js"></script>
<script src="assets/js/moneyorder.js"></script>
<script src="assets/js/quicksend.js"></script>
<script src="assets/js/addressbook.js"></script>
<!-- <script src="assets/js/labelmaker.js"></script> -->
<script src="routes.js"></script>
<script src="assets/js/main.js"></script>

@ -1,67 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<div class="page" data-name="crypto">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link back" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Crypto Wallet</div>
</div>
</div>
<div class="page-content">
<div class="row justify-content-center">
<div class="col-100 medium-60 large-70">
<div class="swiper margin-top" id="crypto-intro-swiper">
<div class="swiper-wrapper">
{{#each slideshow}}
<div class="swiper-slide display-flex justify-contenty-center align-items-center flex-direction-column">
<img src="{{image}}" style="max-height: 40vh; max-width: 90%; height: 50rem;"/>
<p class="text-align-center margin padding">{{text}}</p>
</div>
{{/each}}
</div>
<div id="crypto-intro-swiper-pagination" class="swiper-pagination"></div>
</div>
</div>
<div class="col-100 medium-40 large-30">
<div class="block text-align-center">
<div class="button hapticbtn button-fill" onclick="scanWalletQrCode(openWalletPage);"><i class="fa-solid fa-qrcode"></i> Scan Wallet</div>
</div>
<div class="block text-align-center">
<a href="#" onclick="$('#wallet-address-manual-entry').removeClass('display-none');$('a[name=wallet-address-manual-entry-anchor]').get(0).scrollIntoView();">Can't scan? <span class="taptext">Tap</span><span class="clicktext">Click</span> here.</a>
</div>
<div class="block">
<div class="list margin-bottom-half display-none" id="wallet-address-manual-entry">
<ul class="padding">
<li class="item-content">
Type your wallet's public address below, then press the open wallet button.
</li>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-input-wrap">
<input type="text" id="walletPubKeyManualEntry" placeholder="1X68a3n1..." />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content">
<div class="button button-outline hapticbtn" onclick="openWalletPage($('#walletPubKeyManualEntry').val());">Open Wallet</div>
</li>
</ul>
</div>
<a name="wallet-address-manual-entry-anchor" href="#wallet-address-manual-entry-anchor"></a>
</div>
</div>
</div>
</div>
</div>

@ -1,209 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<div class="page" data-name="crypto_wallet">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link back" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Crypto Wallet</div>
</div>
</div>
<div class="page-content">
<div class="card-content-padding text-align-center">
<img id="walletBalanceLogo" style="max-height: 25vh; max-width: 25vw; height: 5em;" src="{{logo}}" />
<p>This <span id="walletCurrency">{{currencyname}}</span> wallet contains</p>
<h2><span id="walletBalanceAmount">{{balance}} {{currencyunit}}</span></h2>
<p>currently worth</p>
<h2><span id="walletFiatAmount">{{fiatvalue}}</span></h2>
</div>
<div class="row justify-content-center">
<div class="col-100 medium-50 large-30">
<div class="block">
<div class="button hapticbtn button-fill popup-open" id="sendCryptoOpenPopupBtn"><i class="fa-solid fa-inbox-out"></i> Send</div>
</div>
<div class="block">
<div class="button hapticbtn button-fill popup-open" data-popup="#receiveCryptoPopup" id="receiveCryptoOpenPopupBtn"><i class="fa-solid fa-inbox-in"></i> Receive</div>
</div>
</div>
</div>
<div class="card-content-padding text-color-gray text-align-center" id="walletAddress">{{walletaddress}}</div>
<div class="card-content-padding text-color-gray text-align-center" id="walletBalanceAttribution">
{{attribution}}
</div>
</div>
<div class="popup" id="sendCryptoPopup">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link popup-close" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Close</span>
</a>
</div>
<div class="title">Send Crypto</div>
</div>
</div>
<div class="list margin-bottom-half">
<ul>
<li class="item-divider">Step 1</li>
<li class="item-content">
<div class="item-inner">
Scan your private key. The private key unlocks your wallet and authorizes the transfer.
</div>
</li>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-input-wrap">
<input type="text" id="walletPrivateKey" placeholder="6JJRxyW..." />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content">
<div class="button hapticbtn button-fill" onclick="scanPrivateKeyQrCode(function (d) {
$('#walletPrivateKey').val(d);
});"><i class="fa-solid fa-key"></i> Scan Private Key
</div>
</li>
<li class="item-divider">Step 2</li>
<li class="item-content">
<div class="item-inner">
Scan or paste the recipient's wallet address.
The money will be sent here. Important: the recipient must be expecting the
same cryptocurrency your wallet uses. Otherwise the money will
be lost forever.
</div>
</li>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-input-wrap">
<input type="text" id="walletToAddress" placeholder="1X68a3n1..." value="{{sendtoaddress}}" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content">
<div class="button hapticbtn button-fill" onclick="scanWalletQrCode(function (d) {
var parsed = parsePaymentURI(d);
if (parsed == null) {
$('#walletToAddress').val(d);
} else {
$('#walletToAddress').val(parsed.address);
if (typeof parsed['amount'] != 'undefined') {
$('#transactionAmount').val(parsed.amount);
}
}
});"><i class="fa-solid fa-inbox-in"></i> Scan Recipient's Wallet
</div>
</li>
<li class="item-divider">Step 3</li>
<li class="item-content">
<div class="item-inner">
Enter the amount to send.
</div>
</li>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-title item-label" id="cryptoAmountSendCurrencyLabel"></div>
<div class="item-input-wrap">
<input type="number" id="transactionAmount" step="0.00000001" min="0.00000001" max="999999.99999999" value="{{sendtoamount}}"/>
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content item-input" id="cryptoFiatInputItem" style="display: none;">
<div class="item-inner">
<div class="item-title item-label" id="cryptoAmountSendFiatLabel"></div>
<div class="item-input-wrap">
<input type="number" id="transactionAmountFiat" step="0.01" min="0.01" max="9999.99"/>
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-divider">Step 4</li>
<li class="item-content">
<div class="item-inner">
<div><span class="taptext">Tap</span><span class="clicktext">Click</span> the button to send the transaction.</div>
</div>
</li>
<li class="item-content">
<div class="button hapticbtn button-fill" onclick="walletGUISendCoins()">
<i class="fa-solid fa-paper-plane"></i> Send Transaction
</div>
</li>
<li class="item-content">
<div class="button hapticbtn popup-close" onclick="$('#walletPrivateKey').val('');" >
<i class="fa-solid fa-xmark"></i> Cancel
</div>
</li>
</ul>
</div>
</div>
<div class="popup" id="receiveCryptoPopup">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link popup-close" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Close</span>
</a>
</div>
<div class="title">Request Crypto</div>
</div>
</div>
<div class="margin">
Enter the amount to request.
</div>
<div class="list margin-bottom-half margin-top-half">
<ul>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-title item-label" id="cryptoAmountReceiveCurrencyLabel">{{currencyunit}}</div>
<div class="item-input-wrap">
<input type="number" id="receiveAmount" step="0.00000001" min="0.00000001" max="999999.99999999" data-currency="{{currencyunit}}" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content item-input" id="cryptoAmountReceiveFiatLI" style="display: none;">
<div class="item-inner">
<div class="item-title item-label" id="cryptoAmountReceiveFiatLabel"></div>
<div class="item-input-wrap">
<input type="number" id="receiveAmountFiat" step="0.01" min="0.01" max="9999.99" data-exchangerate="{{exchangerate}}" data-currencylabel="$"/>
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="item-content">
<div class="button hapticbtn button-fill" onclick="showPaymentRequestQRCode()">
<i class="fa-solid fa-qrcode"></i> Show Payment Request Code
</div>
</li>
</ul>
</div>
<div id="paymentRequestQRCodeContainer" class="block display-flex justify-content-center"></div>
</div>
</div>

@ -1,42 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<div class="page" data-name="money">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link back hapticbtn" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Money</div>
</div>
</div>
<div class="page-content noselect">
<div class="row justify-content-center margin-top">
<div class="col-100 medium-90 xlarge-75 margin-horizontal">
<div class="row justify-content-center">
{{#each pages}}
<div class="col-100 small-50 large-33 no-margin-vertical">
<div class="card hapticbtn pointercursor" onclick="router.navigate('{{href}}');">
<div class="card-content text-align-center padding">
<h1 class="no-margin"><i class="{{icon}}"></i></h1>
<br />
<span style="font-weight: 700;">{{title}}</span>
<br />
<span>{{text}}</span>
</div>
</div>
</div>
{{/each}}
</div>
</div>
</div>
</div>
</div>

@ -1,70 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<div class="page" data-name="moneyorder">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a class="link back" href="#">
<i class="icon icon-back"></i>
<span class="if-not-md">Back</span>
</a>
</div>
<div class="title">Money Orders</div>
</div>
</div>
<div class="page-content">
<div class="row justify-content-center">
<div class="col-100 small-50 xlarge-40">
<div class="card margin">
<div class="card-content padding-vertical" id="moneyorder-dyncontent">
<dl>
<dt>How do I purchase a money order?</dt>
<dd>You can buy a money order during any notary or shipping appointment. You can also call us to schedule a visit. Were available where you are and on your schedule.</dd>
<dt>How can I pay for my money order?</dt>
<dd>We only accept cash payment for money orders at this time.</dd>
<dt>How much does a money order cost?</dt>
<dd>You can send money orders up to $500 with Helena Express for a $3 fee ($6 if by appointment).</dd>
<dt>How can a recipient cash a Helena Express money order?</dt>
<dd>Our money orders can be cashed like a check. Just bring it to your bank or any business offering check cashing services.</dd>
</div>
</div>
</div>
<div class="col-100 small-50 xlarge-40">
<div class="card margin">
<div class="card-header">Verify Money Order</div>
<form class="card-content padding-vertical" id="moneyorderForm">
<div class="block">
Enter the serial number from the top-right corner of the money order.
</div>
<div class="list media-list">
<ul>
<li class="item-content item-input item-input-outline">
<div class="item-inner">
<div class="item-title item-floating-label">Serial Number</div>
<div class="item-input-wrap">
<input type="text" id="moneyorderserial" placeholder="12345" inputmode="numeric" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<li class="padding">
<div class="button hapticbtn button-fill" onclick="verifyMoneyOrder($('#moneyorderserial').val())"><i class="fa-solid fa-magnifying-glass-dollar"></i> Verify</div>
</li>
</ul>
</div>
</form>
</div>
</div>
</div>
</div>
</div>

@ -7,8 +7,7 @@
var dynamicPages = [
"notary",
"telegram",
"trailer",
"moneyorder"
"trailer"
];
var compiledPages = {};
var pagesToCompile = [
@ -23,16 +22,12 @@ var pagesToCompile = [
"shop",
"shoppingcart_fragment",
"rateresult",
"crypto",
"crypto_wallet",
"account",
"trackresult",
"settings",
"receipts",
"trailer",
"kiosk",
"money",
"moneyorder",
"locations",
"quicksend"
];
@ -57,82 +52,6 @@ var routes = [
}
}
},
{
path: '/crypto',
name: 'crypto',
async: function ( {resolve, reject}) {
resolve({
content: compiledPages.crypto({
slideshow: [
{
image: "assets/images/crypto/slides/intro.svg",
text: "Bitcoin and cryptocurrency can be complicated. We've made it simple. Swipe left for more."
},
{
image: "assets/images/crypto/slides/vault.svg",
text: "With your Helena Express paper wallet, you can save..."
},
{
image: "assets/images/crypto/slides/spend.svg",
text: "...or spend, without worrying about hackers..."
},
{
image: "assets/images/crypto/slides/secure.svg",
text: "...because paper can't be hacked."
},
{
image: "assets/images/crypto/slides/scantostart.svg",
text: "Scan your paper wallet to get started, or order one in the shop."
}
]
})
}, {});
},
on: {
pageAfterIn: function () {
app.swiper.destroy("#crypto-intro-swiper");
app.swiper.create("#crypto-intro-swiper", {
pagination: {
el: "#crypto-intro-swiper-pagination",
type: "bullets",
clickable: true
}
});
}
}
},
{
path: '/crypto/:walletaddress/:toaddress',
async: openWalletBalancePage,
name: 'crypto_wallet',
on: {
pageAfterIn: function () {
$("#sendCryptoOpenPopupBtn").click();
setupReceiveFiatConversion();
}
}
},
{
path: '/crypto/:walletaddress/:toaddress/:amount',
async: openWalletBalancePage,
name: 'crypto_wallet',
on: {
pageAfterIn: function () {
$("#sendCryptoOpenPopupBtn").click();
setupReceiveFiatConversion();
}
}
},
{
path: '/crypto/:walletaddress',
async: openWalletBalancePage,
name: 'crypto_wallet',
on: {
pageAfterIn: function () {
setupReceiveFiatConversion();
}
}
},
{
path: '/home',
name: 'home',
@ -242,43 +161,6 @@ var routes = [
}, {});
}
},
{
path: '/money',
name: 'money',
async: function ( { resolve, reject }) {
resolve({
content: compiledPages.money({
pages: [
{
title: "Money Orders",
href: "/moneyorder",
icon: "fa-duotone fa-money-check-dollar",
text: "Check and verify a Helena Express money order."
},
{
title: "Crypto Wallet",
href: "/crypto",
icon: "fa-duotone fa-wallet",
text: "Check your crypto wallet balance and pay people with cryptocurrency."
}
]
})
}, {});
}
},
{
path: '/moneyorder',
content: compiledPages.moneyorder(),
name: 'moneyorder',
on: {
pageBeforeIn: function () {
dyncontent = getDynamicPageContent("moneyorder");
if (dyncontent != null) {
$("#moneyorder-dyncontent").html(dyncontent);
}
}
}
},
{
path: '/notary',
content: compiledPages.notary(),
@ -632,25 +514,6 @@ var routes = [
}
}
},
// {
// path: '/labelmaker',
// url: './pages/labelmaker.html',
// name: 'labelmaker',
// on: {
// pageBeforeIn: function () {
// checkIfAccountGoodWithPaymentMethod(function (ok) {
// if (!ok) {
// $("#addPaymentMethodNag").css("display", "");
// }
// }, function (error) {
// $("#addPaymentMethodNag").css("display", "");
// });
// },
// pageAfterIn: function () {
// initLabelMakerForm();
// }
// }
// },
{
path: '/account',
name: 'account',

@ -42,17 +42,11 @@ var SETTINGS = {
// Get receipts linked with account
getreceipts: "https://apis.helena.express/v1/account/getreceipts/",
getreceipt: "https://apis.helena.express/v1/account/getreceipt/",
// Crypto: check balance and send transactions
walletbalance: "https://apis.helena.express/v1/crypto/walletbalance/",
getutxo: "https://apis.helena.express/v1/crypto/getutxo/",
broadcasttransaction: "https://apis.helena.express/v1/crypto/broadcasttransaction/",
cryptofees: "https://apis.helena.express/v1/crypto/fees/",
// Service area map
servicearea: "https://apis.helena.express/v1/servicearea/",
// Trailer schedule/dates/times/locations
trailerschedule: "https://helena.express/mobile/schedule.json",
// Money order verification
moneyorderverify: "https://apis.helena.express/v1/moneyorder/verify/",
// Physical locations
locations: "https://apis.helena.express/v1/locations/"
},
stripe_pubkey: "pk_test_51J6qFXCa1Fboir5UzPO3LCiMsVNiFP2lq4wR0dEcjJJVzAaJ3uRggDekZPB3qeYpMD3ayIYHKyD5sSn0IFLlEXMW001LqrvGSH",

Loading…
Cancel
Save