Commit 5a16f934 authored by Allan Juma's avatar Allan Juma

linting resolved

parent ea6e86f3
import os
import sys
print("✅ Fixing PropTypes issues")
dir_path = os.path.dirname(os.path.realpath(__file__))
rnw_filename = dir_path + "/node_modules/react-native-web/dist/index.js"
def append_new_line(file_name, text_to_append):
"""Append given text as a new line at the end of file"""
if text_to_append in open(file_name).read():
print("⏭️ Skipping...")
else:
with open(file_name, "a+") as file_object:
file_object.write("\n")
file_object.write(text_to_append)
file_object.close()
# Fix
append_new_line(rnw_filename, "export const ViewPropTypes = { style: null };")
This diff is collapsed.
......@@ -21,6 +21,7 @@
"electron-only": "electron --no-sandbox .",
"preelectron-pack": "npm run build",
"prettier": "prettier --write --single-quote --trailing-comma es5 \"src/**/*.js\" public/electron.js",
"preinstall": "npx npm-force-resolutions",
"postinstall": "npm install -g @grpc/proto-loader @grpc/grpc-js react-dom faker --runtime=electron && npm run protobuf",
"storybook": "start-storybook -p 9009 -s public",
"build-storybook": "build-storybook -s public",
......@@ -33,6 +34,7 @@
"@capacitor/core": "^3.3.3",
"@grpc/grpc-js": "^1.3.7",
"@grpc/proto-loader": "^0.6.9",
"@react-native-async-storage/async-storage": "latest",
"@solana/web3.js": "latest",
"algosdk": "latest",
"chart.js": "^3.6.2",
......@@ -55,15 +57,15 @@
"react-chartjs-2": "^4.0.0",
"react-dom": "16.8.6",
"react-native-web": "^0.11.2",
"react-scripts": "4.0.3",
"react-scripts": "4.0.1",
"router-dom": "^2.2.9",
"svgs": "4.0.0",
"tinyman-ts-sdk": "^1.0.1",
"@react-native-async-storage/async-storage": "latest",
"tsc": "^2.0.4"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"react-error-overlay": "6.0.9",
"@babel/core": "^7.4.0",
"@babel/plugin-proposal-object-rest-spread": "^7.4.0",
"@babel/plugin-transform-modules-commonjs": "^7.4.0",
......@@ -102,6 +104,9 @@
"wait-on": "^2.1.0",
"webpack": "4.44.2"
},
"resolutions": {
"react-error-overlay": "6.0.9"
},
"browserslist": [
"electron 4.0"
],
......
......@@ -84,6 +84,7 @@ ipcMain.on('logs-ready', () => {
logsReady = true;
});
function createWindow() {
console.log(path.join(__dirname, 'preload.js'));
const options = {
......
......@@ -59,29 +59,27 @@ class DaoAction {
*/
async getDao() {
try {
const uri =
'https://gateway.bitsoko.org/getEnterpriseRoute';
const uri = 'https://gateway.bitsoko.org/getEnterpriseRoute';
const response = checkHttpStatus(await fetch(uri));
const pools = await response.json();
//const pools = (await response.json()).tickers;
//const rate = tickers.find(t => t.ticker.toLowerCase() === fiat).rate;
this._store.pools = pools.map(pool => ({
id: pool.url,
cat: 'micro',
type: 'algorand',
title: pool.title ? pool.title : 'Sample merchant @ https://demo1.bitsoko.org',
desc: pool.desc ? pool.desc : '{name:"demo", desc:"a sample merchant", image:"",banner:"",link:"",url:"https://demo1.bitsoko.org"}',
title: pool.title
? pool.title
: 'Sample merchant @ https://demo1.bitsoko.org',
desc: pool.desc
? pool.desc
: '{name:"demo", desc:"a sample merchant", image:"",banner:"",link:"",url:"https://demo1.bitsoko.org"}',
amount: 0,
fee: 0,
confirmations: 5,
status: pool.active ? 'open' : 'closed',
date: parseDate(1604646525),
}));
} catch (err) {
log.error('Listing transactions failed', err);
}
......
......@@ -24,19 +24,15 @@ class GrpcAction {
* @return {Promise<undefined>}
*/
async initPyface(body) {
log.info('python starting');
try{
var ranID = 'pyFace:'+JSON.stringify(Math.floor(Math.random() * 10000));
body = [ranID].concat(body);
var res = await this._ipc.send('pyFace', ranID, { body });
return res;
}catch(err){
console.log(err);
}
log.info('python starting');
try {
var ranID = 'pyFace:' + JSON.stringify(Math.floor(Math.random() * 10000));
body = [ranID].concat(body);
var res = await this._ipc.send('pyFace', ranID, { body });
return res;
} catch (err) {
console.log(err);
}
}
//
......@@ -50,7 +46,6 @@ class GrpcAction {
* @return {Promise<undefined>}
*/
async initUnlocker() {
await this._sendIpc('unlockInit', 'unlockReady');
log.info('GRPC unlockerReady');
this._store.unlockerReady = true;
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
*/
import * as log from './log';
import { parseDate, toHex } from '../helper';
import { parseDate } from '../helper';
class InvestmentAction {
constructor(store, grpc, nav, notification) {
......@@ -45,9 +45,7 @@ class InvestmentAction {
* @return {Promise<undefined>}
*/
async update() {
await Promise.all([
this.getAlgoTransactions(),
]);
await Promise.all([this.getAlgoTransactions()]);
}
/**
......@@ -55,10 +53,10 @@ class InvestmentAction {
* @return {Promise<undefined>}
*/
async updateLock(TransactionTime) {
let locked=true;
if(TransactionTime < new Date().setDate(new Date().getDate() - 1)){
locked=false;
}
let locked = true;
if (TransactionTime < new Date().setDate(new Date().getDate() - 1)) {
locked = false;
}
return locked;
}
......@@ -68,11 +66,8 @@ class InvestmentAction {
* @return {Promise<undefined>}
*/
async getAlgoTransactions() {
try {
const { transactions } = await this._grpc.sendCommand('listInvoices');
this._store.transactions = transactions.map(transaction => ({
id: transaction.txHash,
type: this.updateLock(transaction.timeStamp) ? 'locked' : 'unlocked',
......@@ -85,10 +80,6 @@ class InvestmentAction {
} catch (err) {
log.error('Listing transactions failed', err);
}
}
/**
......
/**
* @fileOverview a low level action to wrap electron's IPC renderer api.
*/
/*
/*
const _ipcRenderer = require('electron').ipcRenderer;
const filter = event => {
......@@ -27,7 +27,6 @@ window.ipcRenderer = {
*/
class IpcAction {
constructor(ipcRenderer) {
this._ipcRenderer = ipcRenderer;
}
......@@ -40,9 +39,8 @@ class IpcAction {
* @return {Promise<Object>}
*/
send(event, listen, payload) {
return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
this._ipcRenderer.send(event, payload);
if (!listen) return resolve();
this._ipcRenderer.once(listen, (e, arg) => {
if (arg.err) {
......@@ -62,9 +60,8 @@ class IpcAction {
* @return {undefined}
*/
listen(event, callback) {
console.log(event, callback);
this._ipcRenderer.on(event, callback);
console.log(event, callback);
this._ipcRenderer.on(event, callback);
}
}
......
......@@ -160,8 +160,8 @@ class NavAction {
}
goURL(url) {
// this._store.route = 'Transactions';
window.open(url, '_blank');
// this._store.route = 'Transactions';
window.open(url, '_blank');
}
goPromotions() {
......@@ -170,11 +170,11 @@ class NavAction {
goTransactions() {
this._store.route = 'Transactions';
}
}
goInvestments() {
this._store.route = 'Investments';
}
}
goPools() {
this._store.route = 'Pools';
......@@ -198,7 +198,6 @@ class NavAction {
}
goContractSettings(contract) {
this._store.selectedContractSetting = contract;
this._store.route = 'SetContract';
}
......
......@@ -64,7 +64,6 @@ class PaymentAction {
}
this.init();
this.setAddress({ address: url });
}
/**
......@@ -78,7 +77,6 @@ class PaymentAction {
return;
}
this.setAddress({ address: data });
}
/**
......@@ -348,9 +346,9 @@ class PaymentAction {
});
stream.on('error', reject);
stream.write(JSON.stringify({ paymentRequest: invoice }), 'utf8');
this._notification.display({ msg: 'Lightning sent to swap!' });
});
if (failed) return;
this._notification.display({ msg: 'Lightning sent to swap!' });
//if (failed) return;
} catch (err) {
if (failed) return;
//this._nav.goPayLightningConfirm();
......
......@@ -5,14 +5,23 @@
import {
PREFIX_REGEX,
PREFIX_URI,
PAYMENT_TIMEOUT,
POLL_STORE_TIMEOUT,
LOW_TARGET_CONF,
MED_TARGET_CONF,
HIGH_TARGET_CONF,
} from '../config';
import { toSatoshis, toAmount, isLnUri, isAddress, nap, sendToEscrow } from '../helper';
/*
import {
toSatoshis,
toAmount,
isLnUri,
nap,
sendToEscrow,
} from '../helper';
*/
import { toSatoshis, toAmount, isLnUri, nap, sendToEscrow } from '../helper';
import * as log from './log';
class PoolAddAction {
......@@ -65,7 +74,6 @@ class PoolAddAction {
}
this.init();
this.setAddress({ address: url });
}
/**
......@@ -79,7 +87,6 @@ class PoolAddAction {
return;
}
this.setAddress({ address: data });
}
/**
......@@ -116,8 +123,6 @@ class PoolAddAction {
this._nav.goPoolAddLiquid();
}
/**
* Set the address input for the payment view. This can either be
* an on-chain bitcoin addres or an encoded lightning invoice.
......@@ -125,7 +130,6 @@ class PoolAddAction {
*/
async setAddress({ address }) {
this._store.payment.address = address.replace(PREFIX_REGEX, '');
}
/**
......@@ -133,29 +137,37 @@ class PoolAddAction {
* is either in btc or fiat depending on user settings.
* @param {string} options.amount The string formatted number
*/
async setAmount({ amount }) {
this._store.payment.amount = amount;
async setAmount({ amo }) {
this._store.payment.amount = amo;
this._store.payment.sendAll = false;
this.setAddress({ address: '' });
const { settings } = this._store;
var amount = toSatoshis(amount, settings);
//check if contract has enough balance first
console.log(parseFloat(this._store.settings.chains.algo.account.balance)*1000000, (amount*1.01));
if(parseFloat(this._store.settings.chains.algo.account.balance)*1000000 > (amount*1.01)){
console.log('INFO! contract has sufficient balance');
}else{
//get new pool quotation from server
var escrowInvoice = await sendToEscrow(amount, '{"state":"pool", "action":"add", "account":"'+this._store.settings.chains.algo.account.address+'", "pool":"'+this._store.selectedPool.id+'", "type":"float"}');
console.log(escrowInvoice);
this.setAddress({ address: escrowInvoice });
}
const { settings } = this._store;
var amount = toSatoshis(amo, settings);
//check if contract has enough balance first
console.log(
parseFloat(this._store.settings.chains.algo.account.balance) * 1000000,
amount * 1.01
);
if (
parseFloat(this._store.settings.chains.algo.account.balance) * 1000000 >
amount * 1.01
) {
console.log('INFO! contract has sufficient balance');
} else {
//get new pool quotation from server
var escrowInvoice = await sendToEscrow(
amount,
'{"state":"pool", "action":"add", "account":"' +
this._store.settings.chains.algo.account.address +
'", "pool":"' +
this._store.selectedPool.id +
'", "type":"float"}'
);
console.log(escrowInvoice);
this.setAddress({ address: escrowInvoice });
}
}
/**
......@@ -185,13 +197,17 @@ class PoolAddAction {
* @return {Promise<undefined>}
*/
async checkType() {
const { settings } = this._store;
var amount = toSatoshis(this._store.payment.amount, settings);
if(parseFloat(this._store.settings.chains.algo.account.balance)*1000000 > (amount*1.01)){
console.log('INFO! sufficient BTC in contract. skipping lightning swap...');
this._store.payment.address = '';
} else if (!this._store.payment.address) {
const { settings } = this._store;
var amount = toSatoshis(this._store.payment.amount, settings);
if (
parseFloat(this._store.settings.chains.algo.account.balance) * 1000000 >
amount * 1.01
) {
console.log(
'INFO! sufficient BTC in contract. skipping lightning swap...'
);
this._store.payment.address = '';
} else if (!this._store.payment.address) {
return this._notification.display({ msg: 'Enter an invoice or address' });
}
/*
......@@ -209,8 +225,7 @@ class PoolAddAction {
*/
this._nav.goPayPoolConfirm();
this._nav.goPayPoolConfirm();
}
/**
......@@ -331,8 +346,6 @@ class PoolAddAction {
});
}
}
/**
* Send the specified amount as an on-chain transaction to the provided
......
......@@ -22,7 +22,8 @@ class PoolRedeemLiqAction {
*/
init() {
this._store.invoice.amount = '';
this._store.invoice.note = 'POOL:REDEEM:98044b80f029ae6d007a6344b66d850435dace8533fb4aa16848d37031c4d459';
this._store.invoice.note =
'POOL:REDEEM:98044b80f029ae6d007a6344b66d850435dace8533fb4aa16848d37031c4d459';
this._store.invoice.encoded = '';
this._store.invoice.uri = '';
this._nav.goPoolRemoveLiquid();
......
......@@ -3,10 +3,9 @@
* a.k.a invoice that can be sent to another user.
*/
import { PREFIX_URI } from '../config';
//import { PREFIX_URI } from '../config';
import { toSatoshis, addAsaQuote } from '../helper';
class PoolRemoveLiqAction {
constructor(store, grpc, nav, notification, clipboard) {
this._store = store;
......@@ -21,13 +20,14 @@ class PoolRemoveLiqAction {
* and then navigating to the view.
* @return {undefined}
*/
async init() {
async init() {
this._store.invoice.amount = '';
this._store.invoice.note = 'POOL:REMOVE:98044b80f029ae6d007a6344b66d850435dace8533fb4aa16848d37031c4d459';
this._store.invoice.note =
'POOL:REMOVE:98044b80f029ae6d007a6344b66d850435dace8533fb4aa16848d37031c4d459';
this._store.invoice.encoded = '';
this._store.invoice.uri = '';
this._nav.goPoolRemoveLiquid();
this._quote = await addAsaQuote(this._grpc,this._store,75685483, 0);
this._quote = await addAsaQuote(this._grpc, this._store, 75685483, 0);
}
/**
......@@ -37,10 +37,7 @@ class PoolRemoveLiqAction {
*/
setAmount({ amount }) {
this._store.invoice.amount = amount;
console.log('INFO! ASA tokens sold are :', amount/this._quote);
console.log('INFO! ASA tokens sold are :', amount / this._quote);
}
/**
......@@ -65,38 +62,37 @@ class PoolRemoveLiqAction {
* @return {Promise<undefined>}
*/
async confirmRem() {
this._nav.goWait();
var amount = this._store.invoice.amount/this._store.selectedPool.quote;
var res = await this._grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'swap', this._store.selectedPool.assetID , 0, parseInt(amount), this._store.settings.chains.algo.account.address, this._store.settings.chains.algo.account.mnemonic, 'remove' ]);
console.log(res);
if(res.includes('confirmed in round')){
console.log('INFO! swap completed by contract only! skiping lightning swap.');
this._nav.goWait();
var amount = this._store.invoice.amount / this._store.selectedPool.quote;
var res = await this._grpc.initPyface([
'/data/lightning-bits/src/chains/algo/pools.py',
'swap',
this._store.selectedPool.assetID,
0,
parseInt(amount),
this._store.settings.chains.algo.account.address,
this._store.settings.chains.algo.account.mnemonic,
'remove',
]);
console.log(res);
if (res.includes('confirmed in round')) {
console.log(
'INFO! swap completed by contract only! skiping lightning swap.'
);
this._nav.goPayPoolDone();
return true;
}else{
} else {
this._nav.goPaymentFailed();
return false;
}
return res;
return false;
}
}
async generateUri() {
try {
const { invoice, settings } = this._store;
const satAmount = toSatoshis(invoice.amount, settings);
console.log(satAmount);
this._nav.goPoolRemLiqConf();
} catch (err) {
this._notification.display({ msg: 'Creating invoice failed!', err });
}
......
......@@ -4,7 +4,15 @@
*/
import * as log from './log';
import { parseDate, toHex, checkHttpStatus, toAmountLabel, addAsaQuote } from '../helper';
/*
import {
parseDate,
toHex,
checkHttpStatus,
addAsaQuote,
} from '../helper';
*/
import { parseDate, toHex, checkHttpStatus, addAsaQuote } from '../helper';
var hii;
......@@ -24,9 +32,9 @@ class PoolAction {
*/
async init() {
var nav = this._nav;
this.update().then(function(){
console.log('INFO! loaded pools');
//nav.goPools();
this.update().then(function() {
console.log('INFO! loaded pools');
//nav.goPools();
});
nav.goPools();
//nav.goWait();
......@@ -59,40 +67,38 @@ class PoolAction {
//this.getPayments(),
]);
}
async poolsToPool(pool){
var grpc = hii._grpc;
var store = hii._store;
try{
var pDat = await addAsaQuote(grpc,store,pool.poolID.id, 0);
}catch(er){
throw pDat;
}
//TEMORARY HACK!!
pool.active = [true,false].sort(() => Math.random() - Math.random()).slice(0, 1)[0];
var ret = {
id: pool.id,
cat: 'micro',
type: 'algorand',
icon: pool.bannerPath,
quote: pDat.q,
assetID: pool.poolID.id,
banner: pool.bannerPath,
url: 'https://demo1.bitsoko.org',
title: pool.name,
desc: pool.description,
amount: pDat.b/Math.pow(10,6),
fee: 0,
confirmations: 5,
status: pool.active ? 'open' : 'closed',
date: parseDate(1604646525),
};
return ret;
async poolsToPool(pool) {
var grpc = hii._grpc;
var store = hii._store;
try {
var pDat = await addAsaQuote(grpc, store, pool.poolID.id, 0);
} catch (er) {
throw pDat;
}
//TEMORARY HACK!!
pool.active = [true, false]
.sort(() => Math.random() - Math.random())
.slice(0, 1)[0];
var ret = {
id: pool.id,
cat: 'micro',
type: 'algorand',
icon: pool.bannerPath,
quote: pDat.q,
assetID: pool.poolID.id,
banner: pool.bannerPath,
url: 'https://demo1.bitsoko.org',
title: pool.name,
desc: pool.description,
amount: pDat.b / Math.pow(10, 6),
fee: 0,
confirmations: 5,
status: pool.active ? 'open' : 'closed',
date: parseDate(1604646525),
};
return ret;
}
/**
* List the on-chain transactions by calling the respective grpc api and updating
* the transactions array in the global store.
......@@ -100,32 +106,26 @@ var ret = {
*/
async getPools() {
try {
const uri = 'https://dooca.bitsoko.org/getEnterprise/?servEntID=1';
const uri = 'https://dooca.bitsoko.org/getEnterprise/?servEntID=1';
const response = checkHttpStatus(await fetch(uri));
const svs = await response.json();
var pools = svs.services;
//const pools = (await response.json()).tickers;
//const rate = tickers.find(t => t.ticker.toLowerCase() === fiat).rate;
var quote = await this.addQuote;
//var quote = await this.addQuote;
var pooled = await Promise.allSettled(pools.map(this.poolsToPool));
pooled = pooled.filter(function(pl){
return pl.status == 'fulfilled' && pl.value.quote != undefined;
pooled = pooled.filter(function(pl) {
return pl.status == 'fulfilled' && pl.value.quote != undefined;
});
console.log(pooled);
this._store.pools = pooled.map(function(pl){
if(pl.status == 'fulfilled'){
var ret = pl.value;
return ret;
}
this._store.pools = pooled.map(function(pl) {
if (pl.status == 'fulfilled') {
var ret = pl.value;
return ret;
}
});
} catch (err) {
log.error('Listing transactions failed', err);
}
}
......
......@@ -6,7 +6,7 @@
import * as log from './log';
import { parseDate, toHex, checkHttpStatus } from '../helper';
import store from '../store';
//import store from '../store';
class PromotionAction {
constructor(store, grpc, nav, notification) {
......@@ -61,10 +61,7 @@ class PromotionAction {
*/
async getPromotions() {
try {
const uri =
'https://gateway.bitsoko.org/getActivePromos/?';
const uri = 'https://gateway.bitsoko.org/getActivePromos/?';
const response = checkHttpStatus(await fetch(uri));
const promotions = await response.json();
//const pools = (await response.json()).tickers;
......@@ -80,16 +77,14 @@ class PromotionAction {
// CHECK IF NODE ID ID ELIGIBLE FOR THIS PROMOTION
}
*/
if(store.balanceSatoshis > 1000){
var eliG = true;
}else{
var eliG = false;
if (store.balanceSatoshis > 1000) {
var eliG = true;
} else {
var eliG = false;
}
*/
this._store.promotions = [];
this._store.promotions = promotions.map(promo => ({
id: promo.id,
type: promo.type,
......@@ -99,7 +94,6 @@ class PromotionAction {
rewarded: promo.count,
hodl: promo.hodl,
date: parseDate(promo.ends),
}));
} catch (err) {
log.error('Listing transactions failed', err);
......
......@@ -512,7 +512,10 @@ class WalletAction {
this._nav.goNewAddress();
} else {
this._nav.goWait();
when(() => this._store.walletAddress, () => this._nav.goNewAddress());
when(
() => this._store.walletAddress,
() => this._nav.goNewAddress()
);
}
}
......@@ -550,7 +553,6 @@ class WalletAction {
async getExchangeRate() {
try {
const fiat = this._store.settings.fiat;
const uri = 'https://gateway.bitsoko.org/getExchangeRates';
const response = checkHttpStatus(await fetch(uri));
const tickers = (await response.json()).tickers;
......
import React from 'react';
import Svg, { Path } from '../../component/svg';
const Bits = props => (
<Svg viewBox="0 0 512 512" width="1em" height="1em" {...props}><Path d="M252.2 10.2c-.5 1.8-4.4 17.6-8.8 35.1l-7.9 31.8-3-.7c-1.6-.3-20.9-5-42.7-10.5-21.8-5.4-40.1-9.9-40.6-9.9-1 0-12.5 46-11.7 46.8.2.2 8.3 2.4 18 4.8 19.6 4.8 25.1 7.3 29.2 13.5 5.2 7.9 5.7 5.2-20.6 111.4-18.1 72.5-24.7 97.9-26.5 100.6-2.4 3.6-7.8 6.9-11.3 6.9-1.1 0-10-2-19.7-4.4l-17.8-4.4-1.3 3.2c-.7 1.7-5.6 13-10.9 25.1-5.2 12.1-9.4 22-9.3 22.2.1.1 19.4 5 42.7 10.8 23.4 5.8 42.8 10.9 43.2 11.3.4.4-3.3 16.6-8.2 36-5.9 23.9-8.4 35.5-7.6 35.7 2 .8 41.5 10.5 42.3 10.5.5 0 4.7-15.3 9.3-34.1 4.7-18.7 8.8-34.6 9.2-35.2.4-.7 5.8.3 16.3 3.1 8.7 2.2 16 4.3 16.2 4.6.3.3-3.3 16.1-8.1 35.2s-8.5 34.8-8.4 35c.8.7 41.3 10.5 42.6 10.2 1.2-.2 3.8-9.3 10.3-35.1 4.8-19.2 8.8-35 9-35.1.2-.2 6.9.7 14.9 2 18.2 3 46.7 4.2 59.5 2.5 34.9-4.6 56.7-19.4 71.3-48.6 15.1-30.3 17.5-63.2 6.2-84.3-6.5-12.2-18.8-24.5-32-31.9-2.7-1.5-5-3-5-3.4 0-.3 3-1.5 6.8-2.7 28.2-9.1 46.2-37.4 46.4-72.7.1-13.8-1.4-21.2-6.8-32-9.7-19.8-31.5-36.6-64.7-50.1-7.3-3-13.7-5.4-14.3-5.4-.7 0 2.2-13.6 7.7-35.3 4.8-19.3 8.5-35.5 8.1-35.8-.9-.8-43.2-11.3-43.5-10.8-.2.2-4 15.7-8.7 34.4l-8.4 34.1-16.5-3.9c-9.1-2.1-16.7-4-16.8-4.1-.1-.1 3.6-15.2 8.2-33.6 4.7-18.4 8.5-34 8.5-34.6 0-1-38.7-11.4-42.4-11.4-.8 0-1.9 1.5-2.4 3.2zm55.4 189.9c-5.7 26.6-10.4 48.5-10.3 48.6.1 0 14.5 3.2 31.9 7 17.5 3.7 31.8 7.1 31.8 7.5 0 .4-27 25.7-60 56.3-33 30.5-60 54.9-60 54.2 0-.8 4.5-22.2 10-47.7 5.5-25.4 10-46.9 10-47.8 0-1.4-5.4-2.8-30.3-8.1-16.6-3.6-31-6.7-32-7.1-1.5-.5 10.8-12.3 58.3-56.4 33.1-30.6 60.4-55.5 60.6-55.3.3.2-4.3 22.2-10 48.8z" fill="#FFF"/></Svg>
<Svg viewBox="0 0 512 512" width="1em" height="1em" {...props}>
<Path
d="M252.2 10.2c-.5 1.8-4.4 17.6-8.8 35.1l-7.9 31.8-3-.7c-1.6-.3-20.9-5-42.7-10.5-21.8-5.4-40.1-9.9-40.6-9.9-1 0-12.5 46-11.7 46.8.2.2 8.3 2.4 18 4.8 19.6 4.8 25.1 7.3 29.2 13.5 5.2 7.9 5.7 5.2-20.6 111.4-18.1 72.5-24.7 97.9-26.5 100.6-2.4 3.6-7.8 6.9-11.3 6.9-1.1 0-10-2-19.7-4.4l-17.8-4.4-1.3 3.2c-.7 1.7-5.6 13-10.9 25.1-5.2 12.1-9.4 22-9.3 22.2.1.1 19.4 5 42.7 10.8 23.4 5.8 42.8 10.9 43.2 11.3.4.4-3.3 16.6-8.2 36-5.9 23.9-8.4 35.5-7.6 35.7 2 .8 41.5 10.5 42.3 10.5.5 0 4.7-15.3 9.3-34.1 4.7-18.7 8.8-34.6 9.2-35.2.4-.7 5.8.3 16.3 3.1 8.7 2.2 16 4.3 16.2 4.6.3.3-3.3 16.1-8.1 35.2s-8.5 34.8-8.4 35c.8.7 41.3 10.5 42.6 10.2 1.2-.2 3.8-9.3 10.3-35.1 4.8-19.2 8.8-35 9-35.1.2-.2 6.9.7 14.9 2 18.2 3 46.7 4.2 59.5 2.5 34.9-4.6 56.7-19.4 71.3-48.6 15.1-30.3 17.5-63.2 6.2-84.3-6.5-12.2-18.8-24.5-32-31.9-2.7-1.5-5-3-5-3.4 0-.3 3-1.5 6.8-2.7 28.2-9.1 46.2-37.4 46.4-72.7.1-13.8-1.4-21.2-6.8-32-9.7-19.8-31.5-36.6-64.7-50.1-7.3-3-13.7-5.4-14.3-5.4-.7 0 2.2-13.6 7.7-35.3 4.8-19.3 8.5-35.5 8.1-35.8-.9-.8-43.2-11.3-43.5-10.8-.2.2-4 15.7-8.7 34.4l-8.4 34.1-16.5-3.9c-9.1-2.1-16.7-4-16.8-4.1-.1-.1 3.6-15.2 8.2-33.6 4.7-18.4 8.5-34 8.5-34.6 0-1-38.7-11.4-42.4-11.4-.8 0-1.9 1.5-2.4 3.2zm55.4 189.9c-5.7 26.6-10.4 48.5-10.3 48.6.1 0 14.5 3.2 31.9 7 17.5 3.7 31.8 7.1 31.8 7.5 0 .4-27 25.7-60 56.3-33 30.5-60 54.9-60 54.2 0-.8 4.5-22.2 10-47.7 5.5-25.4 10-46.9 10-47.8 0-1.4-5.4-2.8-30.3-8.1-16.6-3.6-31-6.7-32-7.1-1.5-.5 10.8-12.3 58.3-56.4 33.1-30.6 60.4-55.5 60.6-55.3.3.2-4.3 22.2-10 48.8z"
fill="#FFF"
/>
</Svg>
);
export default Bits;
module.exports.algorand = {
api: { key: 'testnet', server: 'Satoshi', port: 80 }
api: { key: 'testnet', server: 'Satoshi', port: 80 },
};
import * as algosdk from "algosdk";
import * as algosdk from 'algosdk';
import * as config from "./algo-config.js";
//import * as config from './algo-config.js';
import store from '../../store';
const Algorand = {
status: {
PENDING: 0,
SUCCESS: 1,
FAILED: 2
FAILED: 2,
},
isValidAddress: address => {
......@@ -17,13 +15,20 @@ const Algorand = {
},
getClient: network => {
console.log(network);
let token = {
"X-Algo-API-Token": store.settings.chains.algo.rpc[store.settings.chains.algo.chain].key
'X-Algo-API-Token':
store.settings.chains.algo.rpc[store.settings.chains.algo.chain].key,
};
if (store.settings.chains.algo.rpc[store.settings.chains.algo.chain].server.search("purestake") >= 0) {
if (
store.settings.chains.algo.rpc[
store.settings.chains.algo.chain
].server.search('purestake') >= 0
) {
token = {
"X-API-Key": store.settings.chains.algo.rpc[store.settings.chains.algo.chain].key
'X-API-Key':
store.settings.chains.algo.rpc[store.settings.chains.algo.chain].key,
};
}
......@@ -36,8 +41,8 @@ const Algorand = {
getClientForTx: network => {
let token = {
"X-API-Key": store.settings.chains.algo.rpc[network].key,
"Content-Type": "application/x-binary"
'X-API-Key': store.settings.chains.algo.rpc[network].key,
'Content-Type': 'application/x-binary',
};
return new algosdk.Algod(
......@@ -58,7 +63,7 @@ const Algorand = {
const key = algosdk.mnemonicToSecretKey(mnemonic);
if (!algosdk.isValidAddress(key.addr)) {
throw new Error("Invalid wallet mnemonic!");
throw new Error('Invalid wallet mnemonic!');
}
return { address: key.addr, mnemonic, sk: key.sk };
......@@ -119,7 +124,7 @@ const Algorand = {
await Algorand.sleep(4500);
} catch (err) {
console.log(err);
console.log("Failed to make an algorand transaction!");
console.log('Failed to make an algorand transaction!');
}
return await Algorand.sendTransaction(network, tx, secretKey);
......@@ -139,20 +144,17 @@ const Algorand = {
}
},
checkPoolStatus: async (network, txId, aID1, aID2, addr) => {
checkPoolStatus: async (network, txId) => {
try {
var poolObject = await Algorand.getClient(network).pendingTransactionInformation(
txId
);
var poolObject = await Algorand.getClient(
network
).pendingTransactionInformation(txId);
console.log(poolObject);
return poolObject;
return poolObject;
} catch (err) {
return await Algorand.checkTxStatus(network, txId);
}
}
},
};
export default Algorand;
......@@ -12,7 +12,10 @@ import { ImageBackground } from './image';
const BackgroundImage = ({ image, ...props }) =>
image ? (
<ImageBackground source={require(`../asset/img/bits-gradient-bg.svg`)} {...props} />
<ImageBackground
source={require(`../asset/img/bits-gradient-bg.svg`)}
{...props}
/>
) : (
<View {...props} />
);
......
......@@ -315,7 +315,6 @@ ChannelButton.propTypes = {
style: ViewPropTypes.style,
};
//
// Cancel Button
//
......
......@@ -53,8 +53,7 @@ export const LoadNetworkSpinner = ({ continuous, percentage, msg, style }) => (
progressWidth={3}
gradient="loadNetworkGrad"
>
<BitsIcon height={38} width={25} />
<BitsIcon height={38} width={25} />
</ResizeableSpinner>
<Text style={loadNetworkStyles.copy}>{msg}</Text>
</View>
......
......@@ -95,8 +95,6 @@ const ComputedChannel = store => {
channelBalanceInactiveSatoshis: inactive,
channelBalancePendingSatoshis: pending,
} = store;
return 'info';
/*
return opened
? 'success'
: inactive
......@@ -104,7 +102,6 @@ const ComputedChannel = store => {
: pending
? 'info'
: 'error';
*/
},
});
};
......
......@@ -3,32 +3,34 @@
*/
import { extendObservable } from 'mobx';
import { toAmountLabel, toAmount, toCaps, parseDate } from '../helper';
import { toAmountLabel, toAmount, toCaps } from '../helper';
const ComputedPool = store => {
extendObservable(store, {
get computedPools() {
const { pools, payments, invoices, settings } = store;
const { pools, settings } = store;
const t = pools ? pools.slice() : [];
//const p = payments ? payments.slice() : [];
//const i = invoices ? invoices.slice() : [];
store.poolBalance = 0;
const all = [].concat(t);
//all.sort((a, b) => b.date.getTime() - a.date.getTime());
all.sort((a, b) => b.amount - a.amount);
all.forEach((t, i) => {
store.poolBalance = store.poolBalance + (parseInt(t.quoteFiat*t.amount));
store.poolBalance =
store.poolBalance + parseInt(t.quoteFiat * t.amount);
t.key = String(i);
t.idName = t.id+':BITS:MSM1 | '+t.title;
t.idName = t.id + ':BITS:MSM1 | ' + t.title;
t.typeLabel = toCaps(t.type);
t.statusLabel = toCaps(t.status);
t.merchantLabel = t.title;
t.quoteFiat = parseFloat(toAmount(parseInt(parseFloat(t.quote)*Math.pow(10,6)), settings));
t.quoteFiat = parseFloat(
toAmount(parseInt(parseFloat(t.quote) * Math.pow(10, 6)), settings)
);
t.dateLabel = t.date.toLocaleDateString();
t.dateTimeLabel = t.date.toLocaleString();
t.quoteLabel = toAmountLabel(parseInt(parseFloat(t.quote)*Math.pow(10,6)), settings);
t.quoteLabel = toAmountLabel(
parseInt(parseFloat(t.quote) * Math.pow(10, 6)),
settings
);
t.raised = toAmountLabel(0, settings);
if (Number.isInteger(t.confirmations)) {
t.confirmationsLabel = t.confirmations.toString();
......
......@@ -8,7 +8,7 @@ import { toAmountLabel, toCaps } from '../helper';
const ComputedPromotion = store => {
extendObservable(store, {
get computedPromotions() {
const { promotions, payments, invoices, settings } = store;
const { promotions, settings } = store;
const o = promotions ? promotions.slice() : [];
//const p = payments ? payments.slice() : [];
//const i = invoices ? invoices.slice() : [];
......@@ -26,14 +26,10 @@ const ComputedPromotion = store => {
if (Number.isInteger(t.rewarded)) {
t.rewardedLabel = t.rewarded.toString();
}
if (t.type === 'BITS') {
t.status = store.balanceSatoshis > t.hodl ? 'ready' : 'waiting'
t.statusLabel = toCaps(t.status);
t.status = store.balanceSatoshis > t.hodl ? 'ready' : 'waiting';
t.statusLabel = toCaps(t.status);
}
});
return all.slice(0, 100);
},
......
......@@ -26,13 +26,15 @@ export const formatNumber = val => {
*/
export const formatFiat = (val, currency) => {
let num = Number(val);
if (isNaN(num)) {
num = 0;
}
const options = { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0,};
const options = {
style: 'currency',
currency,
minimumFractionDigits: 0,
maximumFractionDigits: 0,
};
const intl = new Intl.NumberFormat(undefined, options);
const str = intl.format(parseInt(num));
if (num < 1 && num > 0 && /0[,.]0{2}/.test(str)) {
......@@ -40,7 +42,6 @@ export const formatFiat = (val, currency) => {
} else if (Math.abs(num) < 1 && Math.abs(num) > 0 && /0[,.]0{2}/.test(str)) {
return `< ${intl.format(-0.01)}`;
}
return str;
};
......@@ -140,45 +141,42 @@ export const toAmountLabel = (satoshis, settings) => {
: formatNumber(toAmount(satoshis, settings));
};
export const addAsaQuote = async (grpc, store, aID1, aID2) => {
// var quote = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'addLiq', aID1, aID2 , store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 1]);
//var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'bootstrap', aID1, aID2, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic ]);
//poolStats = poolStats.replace(/'/g, '"').replace(/"{/g, "{").slice(0, -3);
//console.log(poolStats);
// var quote = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'swap', aID1, aID2, 10, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 'remove' ]);
var quote = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'quote', aID1, aID2, store.settings.chains.algo.account.address ]);
try{
if(quote == '{}')throw 'quote:'+quote+' is not a number';
export const addAsaQuote = async (grpc, store, aID1, aID2) => {
// var quote = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'addLiq', aID1, aID2 , store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 1]);
//var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'bootstrap', aID1, aID2, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic ]);
//poolStats = poolStats.replace(/'/g, '"').replace(/"{/g, "{").slice(0, -3);
//console.log(poolStats);
// var quote = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'swap', aID1, aID2, 10, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 'remove' ]);
var quote = await grpc.initPyface([
'/data/lightning-bits/src/chains/algo/pools.py',
'quote',
aID1,
aID2,
store.settings.chains.algo.account.address,
]);
try {
if (quote == '{}') throw 'quote:' + quote + ' is not a number';
var q = parseFloat(quote.split("'")[1].split("'")[0]);
var b = parseInt(quote.split("'")[2].replace(/\D/g,''));
if(b >= 0){
//balance is int ok
}else{
b=0;
var b = parseInt(quote.split("'")[2].replace(/\D/g, ''));
if (b >= 0) {
//balance is int ok
} else {
b = 0;
}
console.log(q,b);
console.log(q, b);
var amt = parseInt(q);
if(Number.isInteger(amt)){
//var ql = toAmount(amt,store.settings);
return {q:q, b:b};
}else if(!Number.isInteger(amt)){
var ql = toAmount(0,store.settings);
return {q:ql, b:b};
if (Number.isInteger(amt)) {
//var ql = toAmount(amt,store.settings);
return { q: q, b: b };
} else if (!Number.isInteger(amt)) {
var ql = toAmount(0, store.settings);
return { q: ql, b: b };
}
}catch(er){
} catch (er) {
console.error(er);
throw er;
}
}
}
};
/**
* Convert a string formatted btc/fiat amount either to fiat or the selected BTC unit.
......@@ -394,19 +392,26 @@ export const generateArc = (x, y, radius, startAngle, endAngle) => {
].join(' ');
};
export const sendToEscrow = async (amount, memo) => {
try {
const uri = 'https://gateway.bitsoko.org/escrowInvoice/?action=escrowInvoice&memo='+memo+'&amount='+amount/Math.pow(10,8);
const response = await fetch(uri,{ headers: {'Content-Type':'application/json'}, mode: 'cors'});
console.log(JSON.stringify(response.body));
var datStrm = await new Response(response.body, {headers: { "Content-Type": "application/json" } }).json();
return datStrm.data.inv.payment_request;
} catch (err) {
console.error('Getting escrow invoice failed', err);
throw err;
}
try {
const uri =
'https://gateway.bitsoko.org/escrowInvoice/?action=escrowInvoice&memo=' +
memo +
'&amount=' +
amount / Math.pow(10, 8);
const response = await fetch(uri, {
headers: { 'Content-Type': 'application/json' },
mode: 'cors',
});
console.log(JSON.stringify(response.body));
var datStrm = await new Response(response.body, {
headers: {
'Content-Type': 'application/json',
},
}).json();
return datStrm.data.inv.payment_request;
} catch (err) {
console.error('Getting escrow invoice failed', err);
throw err;
}
};
......@@ -93,7 +93,8 @@ export class Store {
closedChannels: [],
selectedChannel: null,
channel: {
pubkeyAtHost: '035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735',
pubkeyAtHost:
'035e4ff418fc8b5554c5d9eea66396c227bd429a3251c8cbc711002ba215bfc226@170.75.163.209:9735',
amount: '20000',
},
paymentRequest: null,
......@@ -105,23 +106,30 @@ export class Store {
// Persistent data
settings: {
contracts: ['algo','eth'],
contracts: ['algo', 'eth'],
unit: DEFAULT_UNIT,
fiat: DEFAULT_FIAT,
displayFiat: true,
exchangeRate: {},
restoring: false,
soko: {enabled: false, domain: ''},
soko: { enabled: false, domain: '' },
autopilot: true,
nodeScores: {},
chains: {
algo:{
account:false,
chain: 'testnet',
addresses: [],
rpc:{mainnet: {server:'',port:'',key:''}, testnet: {server:'https://testnet-algorand.api.purestake.io/ps2',port:'',key:'qe3CNhIJ3C5DXrGHlfxAU1aIUt7SrYzNMwHz8gKb'}}
}
}
algo: {
account: false,
chain: 'testnet',
addresses: [],
rpc: {
mainnet: { server: '', port: '', key: '' },
testnet: {
server: 'https://testnet-algorand.api.purestake.io/ps2',
port: '',
key: 'qe3CNhIJ3C5DXrGHlfxAU1aIUt7SrYzNMwHz8gKb',
},
},
},
},
},
});
}
......
......@@ -4,14 +4,14 @@ import { observer } from 'mobx-react';
import PropTypes from 'prop-types';
import Background from '../component/background';
import MainContent from '../component/main-content';
import { InputField } from '../component/field';
import { ListContent, List, ListItem, ListHeader } from '../component/list';
//import { InputField } from '../component/field';
import { ListContent, List, ListItem } from '../component/list';
import { Header, Title } from '../component/header';
import { CancelButton, PillButton, Button } from '../component/button';
import Card from '../component/card';
import { Alert } from '../component/notification';
import Text from '../component/text';
import LightningBoltIcon from '../asset/icon/lightning-bolt';
//import LightningBoltIcon from '../asset/icon/lightning-bolt';
import { FormStretcher, FormText, FormSubText } from '../component/form';
import { color, font } from '../component/style';
......@@ -26,7 +26,7 @@ const styles = StyleSheet.create({
height: 100,
width: 120,
marginLeft: 'calc( 50% - 60 )',
margin: 10,
margin: 10,
marginRight: 0,
},
subText: {
......@@ -37,7 +37,6 @@ const styles = StyleSheet.create({
},
});
const daoStyles = StyleSheet.create({
btnWrapper: {
//width: '100%',
......@@ -67,7 +66,7 @@ const daoStyles = StyleSheet.create({
height: 92,
width: 92,
marginLeft: 'calc( 50% - 46 )',
margin: 10,
margin: 10,
marginRight: 3,
},
listIcon: {
......@@ -110,14 +109,13 @@ const iStyles = StyleSheet.create({
});
const setState = tx => {
return tx.status === 'open' ? 'success' : 'error';
return tx.status === 'open' ? 'success' : 'error';
};
const capType = tx => {
return require('../asset/icon/'+tx.cat+'.svg');
return require('../asset/icon/' + tx.cat + '.svg');
};
/*
const statusType = tx => {
if (tx.type === 'active') {
return tx.status === 'complete' ? 'success' : 'info';
......@@ -125,74 +123,58 @@ const statusType = tx => {
return tx.status === 'confirmed' ? 'success' : 'info';
}
};
*/
const iconType = tx => {
/*
/*
if (tx.type === 'algorand') {
tx.status === 'complete' ? 'success' : 'info';
} else {
tx.status === 'confirmed' ? 'success' : 'info';
}
*/
return require('../asset/icon/'+tx.type+'.png');
*/
return require('../asset/icon/' + tx.type + '.png');
};
const DaoView = ({ store, nav, dao }) => {
const { computedDao: daos,
unitLabel } = store;
const { computedDao: daos, unitLabel } = store;
console.log(daos, unitLabel);
return (
<Background image="purple-gradient-bg">
<Header shadow color={color.white}>
<Button disabled onPress={() => {}} />
<Title title="Governance">
</Title>
<Background image="purple-gradient-bg">
<Header shadow color={color.white}>
<Button disabled onPress={() => {}} />
<Title title="Governance"></Title>
<FormText style={styles.description}>
Use your bits tokens to govern bitsoko
</FormText>
<CancelButton onPress={() => nav.goHome()} />
</Header>
<MainContent>
<Card>
<Icon
image={require('../asset/icon/bitsokoDao.png')}
style={styles.topIcon}
/>
<ListContent>
<List
data={dao}
renderItem={item => (
<DaoListItem
tx={item}
onSelect={() => dao.select({ item })}
<CancelButton onPress={() => nav.goHome()} />
</Header>
<MainContent>
<Card>
<Icon
image={require('../asset/icon/bitsokoDao.png')}
style={styles.topIcon}
/>
<ListContent>
<List
data={dao}
renderItem={item => (
<DaoListItem tx={item} onSelect={() => dao.select({ item })} />
)}
/>
)}
/>
</ListContent>
<FormText style={styles.description}>
Use your bits tokens to govern bitsoko
</FormText>
<FormStretcher>
<FormSubText style={styles.subText}>
Only Lightning Payment Requests or Bitcoin addresses will work at
this time.
</FormSubText>
</FormStretcher>
<PillButton onPress={() => dao.checkType()}>Next</PillButton>
</Card>
</MainContent>
</Background>
);
</ListContent>
<FormText style={styles.description}>
Use your bits tokens to govern bitsoko
</FormText>
<FormStretcher>
<FormSubText style={styles.subText}>
Only Lightning Payment Requests or Bitcoin addresses will work at
this time.
</FormSubText>
</FormStretcher>
<PillButton onPress={() => dao.checkType()}>Next</PillButton>
</Card>
</MainContent>
</Background>
);
};
DaoView.propTypes = {
store: PropTypes.object.isRequired,
......@@ -200,22 +182,11 @@ DaoView.propTypes = {
dao: PropTypes.object.isRequired,
};
const DaoListItem = ({ tx, onSelect }) => (
<ListItem style={iStyles.item} onSelect={onSelect}>
<Icon
image={iconType(tx)}
style={daoStyles.listIcon}
/>
<View style={iStyles.i}>
</View>
<Icon
image={capType(tx)}
style={daoStyles.listIcon}
/>
<Icon image={iconType(tx)} style={daoStyles.listIcon} />
<View style={iStyles.i}></View>
<Icon image={capType(tx)} style={daoStyles.listIcon} />
<View style={[iStyles.m, iStyles.group]}>
<Alert type={setState(tx)} style={iStyles.alert} />
<Text style={iStyles.txt}>{tx.statusLabel}</Text>
......@@ -236,5 +207,4 @@ DaoListItem.propTypes = {
onSelect: PropTypes.func.isRequired,
};
export default observer(DaoView);
......@@ -51,21 +51,18 @@ const styles = StyleSheet.create({
const DepositView = ({ store, nav, invoice }) => (
<SplitBackground image="purple-gradient-bg" bottom={color.blackDark}>
<Header separator>
<Header separator>
<Title title="Deposit Funds" />
</Header>
<MainContent style={styles.content}>
<CopyText style={styles.copyTxt}>
Scan the QR code to send from another wallet.
</CopyText>
<QRCode size={180}>{store.walletAddressUri}</QRCode>
<View style={styles.btnWrapper}>
<CopyText style={styles.copyTxtX}>
or copy address and buy directly from an exchange below.
</CopyText>
<CopyText style={styles.copyTxtX}>
or copy address and buy directly from an exchange below.
</CopyText>
<CopyButton
onPress={() => invoice.toClipboard({ text: store.walletAddress })}
icon={<CopyDarkIcon height={17.5} width={14} />}
......@@ -73,11 +70,18 @@ const DepositView = ({ store, nav, invoice }) => (
>
{store.walletAddress}
</CopyButton>
<CopyButton
onPress={() => nav.goURL('https://localcryptos.com/Bitcoin/Buy?top_rated=1&online=1')}
icon={<Icon image={require('../asset/icon/localcryptos.png')}
style={styles.smlIcon} />}
onPress={() =>
nav.goURL(
'https://localcryptos.com/Bitcoin/Buy?top_rated=1&online=1'
)
}
icon={
<Icon
image={require('../asset/icon/localcryptos.png')}
style={styles.smlIcon}
/>
}
style={styles.copyBtn}
>
LocalCryptos
......
......@@ -10,8 +10,12 @@ import { color } from '../component/style';
import { H4Text } from '../component/text';
import Icon from '../component/icon';
import QrIcon from '../asset/icon/qr';
import LightningBoltOrangeIcon from '../asset/icon/lightning-bolt-orange';
import { BalanceLabel, BalanceLabelNumeral, BalanceLabelNumeralsml } from '../component/label';
//import LightningBoltOrangeIcon from '../asset/icon/lightning-bolt-orange';
import {
BalanceLabel,
BalanceLabelNumeral,
BalanceLabelNumeralsml,
} from '../component/label';
import { Button, GlasButton, DownButton } from '../component/button';
//
......@@ -28,7 +32,7 @@ const styles = StyleSheet.create({
height: 30,
width: 30,
marginLeft: 'calc( 50% - 75 )',
margin: 10,
margin: 10,
},
downBtnLeft: {
margin: 25,
......@@ -36,7 +40,7 @@ const styles = StyleSheet.create({
display: 'inline-block',
position: 'absolute',
bottom: '0px',
textAlign: 'center'
textAlign: 'center',
},
downBtnCenter: {
margin: 25,
......@@ -44,8 +48,8 @@ const styles = StyleSheet.create({
display: 'inline-block',
position: 'absolute',
bottom: '0px',
left : 'calc(50% - 12.5% - 25px)',
textAlign: 'center'
left: 'calc(50% - 12.5% - 25px)',
textAlign: 'center',
},
downBtnRight: {
margin: 25,
......@@ -53,8 +57,8 @@ const styles = StyleSheet.create({
display: 'inline-block',
position: 'absolute',
bottom: '0px',
right : '0px',
textAlign: 'center'
right: '0px',
textAlign: 'center',
},
});
......@@ -103,10 +107,16 @@ const HomeView = ({
<DownButton onPress={() => pool.init()} style={styles.downBtnLeft}>
Investments
</DownButton>
<DownButton onPress={() => transaction.init()} style={styles.downBtnCenter}>
<DownButton
onPress={() => transaction.init()}
style={styles.downBtnCenter}
>
Transactions
</DownButton>
<DownButton onPress={() => promotion.init()} style={styles.downBtnRight}>
<DownButton
onPress={() => promotion.init()}
style={styles.downBtnRight}
>
Promotions
</DownButton>
</MainContent>
......@@ -145,7 +155,6 @@ const balanceStyles = StyleSheet.create({
},
});
const BalanceDisplay = ({
totalBalanceLabel,
unitLabel,
......@@ -157,26 +166,66 @@ const BalanceDisplay = ({
goChannels,
}) => (
<View style={balanceStyles.wrapper}>
{unitLabel ? <Button onPress={toggleDisplayFiat}><BalanceLabelNumeralsml>{unitLabel}</BalanceLabelNumeralsml></Button> : <Button onPress={toggleDisplayFiat}><BalanceLabel>
<BalanceLabelNumeralsml>{totalBalanceLabel.split(/(\s+)/)[0]}</BalanceLabelNumeralsml>
</BalanceLabel></Button>}
{unitLabel ? <Button onPress={toggleDisplayFiat}><BalanceLabel><BalanceLabelNumeral>{totalBalanceLabel}</BalanceLabelNumeral></BalanceLabel></Button> : <Button onPress={toggleDisplayFiat}><BalanceLabel><BalanceLabelNumeral>{totalBalanceLabel.split(/(\s+)/)[2]}</BalanceLabelNumeral></BalanceLabel></Button>}
{unitLabel ? (
<Button onPress={toggleDisplayFiat}>
<BalanceLabelNumeralsml>{unitLabel}</BalanceLabelNumeralsml>
</Button>
) : (
<Button onPress={toggleDisplayFiat}>
<BalanceLabel>
<BalanceLabelNumeralsml>
{totalBalanceLabel.split(/(\s+)/)[0]}
</BalanceLabelNumeralsml>
</BalanceLabel>
</Button>
)}
{unitLabel ? (
<Button onPress={toggleDisplayFiat}>
<BalanceLabel>
<BalanceLabelNumeral>{totalBalanceLabel}</BalanceLabelNumeral>
</BalanceLabel>
</Button>
) : (
<Button onPress={toggleDisplayFiat}>
<BalanceLabel>
<BalanceLabelNumeral>
{totalBalanceLabel.split(/(\s+)/)[2]}
</BalanceLabelNumeral>
</BalanceLabel>
</Button>
)}
<Button onPress={goChannels} style={balanceStyles.percentBtn}>
<View style={{flex:2,flexDirection:"column",justifyContent:"center",width:"100%",padding:10,paddingTop:50,textAlign:"center"}}>
<View style={{flex:1,padding:10,marginTop: "-10px"}}>
<Alert type={channelStatus} style={balanceStyles.alert} />
<H4Text style={{paddingTop: "5px"}}>{channelPercentageLabel}{"\n"}</H4Text>
</View>
<View style={{flex:1,padding:10,marginTop: "-10px"}}>
<Alert type={contractStatus} style={balanceStyles.alert} />
<H4Text style={{paddingTop: "5px"}}>0% on Contracts</H4Text>
</View>
</View>
<View
style={{
flex: 2,
flexDirection: 'column',
justifyContent: 'center',
width: '100%',
padding: '10',
paddingTop: '50',
textAlign: 'center',
}}
>
<View
style={{
flex: 1,
padding: 10,
marginTop: '-10px',
}}
>
<Alert type={channelStatus} style={balanceStyles.alert} />
<H4Text style={{ paddingTop: '5px' }}>
{channelPercentageLabel}
{'\n'}
</H4Text>
</View>
<View style={{ flex: 1, padding: 10, marginTop: '-10px' }}>
<Alert type={contractStatus} style={balanceStyles.alert} />
<H4Text style={{ paddingTop: '5px' }}>
{contractPercentageLabel} on Contracts
</H4Text>
</View>
</View>
</Button>
</View>
);
......@@ -201,7 +250,6 @@ const bigBtnStyles = StyleSheet.create({
alignSelf: 'stretch',
flexDirection: 'row',
marginTop: 80,
},
leftBtn: {
flex: 1,
......@@ -225,7 +273,7 @@ const SendReceiveButton = ({ goPay, goRequest }) => (
Request
</GlasButton>
<View style={bigBtnStyles.boltWrapper}>
<Icon
<Icon
image={require('../asset/icon/bitsIcon.png')}
style={styles.mainIcon}
/>
......@@ -267,14 +315,14 @@ const HomeHeader = ({ isTestnet, goDeposit, goSettings, goGovern }) => (
<Button onPress={goDeposit} style={headerStyles.depositBtn}>
<QrIcon height={40 * 0.6} width={39 * 0.6} />
</Button>
<Button onPress={goGovern}>
<View>
{isTestnet ? (
<Title style={headerStyles.testnet} title="BETA v0.7.8" />
) : null}
<Title title="Bits" />
</View></Button>
<Button onPress={goGovern}>
<View>
{isTestnet ? (
<Title style={headerStyles.testnet} title="BETA v0.7.8" />
) : null}
<Title title="Bits" />
</View>
</Button>
<Button onPress={goSettings} style={headerStyles.settingsBtn}>
<Icon
image={require('../asset/icon/settings.png')}
......@@ -288,6 +336,7 @@ HomeHeader.propTypes = {
isTestnet: PropTypes.bool.isRequired,
goDeposit: PropTypes.func.isRequired,
goSettings: PropTypes.func.isRequired,
goGovern: PropTypes.func.isRequired,
};
export default observer(HomeView);
......@@ -88,7 +88,7 @@ const statusType = tx => {
const InvestmentListItem = ({ tx, onSelect }) => (
<ListItem style={iStyles.item} onSelect={onSelect}>
<View style={iStyles.i}>
{(tx.type === 'unlocked' && tx.status === 'rewarded') ? (
{tx.type === 'unlocked' && tx.status === 'rewarded' ? (
<LightningBoltIcon height={126 * 0.14} width={64 * 0.14} />
) : (
<BitcoinIcon height={170 * 0.08} width={135 * 0.08} />
......
......@@ -43,9 +43,12 @@ const LoaderView = () => (
<Background color={color.blackDark}>
<MainContent style={styles.content}>
<View style={styles.copy}>
<CopyOnboardText>fully non-custodial bitcoin shopping wallet</CopyOnboardText>
<CopyOnboardText>
fully non-custodial bitcoin shopping wallet
</CopyOnboardText>
<CopyOnboardText style={styles.copy2}>
BETA Software! Incase of issue, visit community for help with recovery or setup
BETA Software! Incase of issue, visit community for help with recovery
or setup
</CopyOnboardText>
</View>
</MainContent>
......
......@@ -61,7 +61,7 @@ import {
payment,
invoice,
channel,
investment,
//investment,
transaction,
promotion,
setting,
......@@ -149,19 +149,35 @@ class MainView extends Component {
<SettingFiat store={store} nav={nav} setting={setting} />
)}
{route === 'Notifications' && <Notification store={store} nav={nav} />}
{route === 'SetContract' && <SetContract store={store} nav={nav} invoice={invoice} />}
{route === 'SetContract' && (
<SetContract store={store} nav={nav} invoice={invoice} />
)}
{route === 'CLI' && <CLI store={store} nav={nav} />}
{route === 'Pay' && (
<Payment store={store} payment={payment} nav={nav} />
)}
{route === 'PoolAddLiquid' && (
<PoolAddLiquid grpc={grpc} store={store} pooladdliq={pooladdliq} nav={nav} />
<PoolAddLiquid
grpc={grpc}
store={store}
pooladdliq={pooladdliq}
nav={nav}
/>
)}
{route === 'PoolRemoveLiquid' && (
<PoolRemoveLiquid store={store} poolremoveliq={poolremoveliq} nav={nav} />
<PoolRemoveLiquid
store={store}
poolremoveliq={poolremoveliq}
nav={nav}
/>
)}
{route === 'PayPoolConfirm' && (
<PayPoolConfirm grpc={grpc} store={store} payment={payment} nav={nav} />
<PayPoolConfirm
grpc={grpc}
store={store}
payment={payment}
nav={nav}
/>
)}
{route === 'PayLightningConfirm' && (
<PayLightningConfirm store={store} payment={payment} nav={nav} />
......@@ -191,7 +207,11 @@ class MainView extends Component {
<InvoiceQR store={store} invoice={invoice} nav={nav} />
)}
{route === 'PoolRemLiqConf' && (
<PoolRemLiqConf store={store} poolremoveliq={poolremoveliq} nav={nav} />
<PoolRemLiqConf
store={store}
poolremoveliq={poolremoveliq}
nav={nav}
/>
)}
{route === 'Deposit' && (
<Deposit store={store} invoice={invoice} nav={nav} />
......@@ -221,17 +241,26 @@ class MainView extends Component {
{route === 'Pools' && (
<Pool grpc={grpc} store={store} pool={pool} nav={nav} />
)}
{route === 'Dao' && (
<Dao store={store} dao={dao} nav={nav} />
)}
{route === 'Dao' && <Dao store={store} dao={dao} nav={nav} />}
{route === 'TransactionDetail' && (
<TransactionDetail store={store} nav={nav} />
)}
{route === 'PoolDetail' && (
<PoolDetail store={store} grpc={grpc} nav={nav} invoice={invoice} pooladdliq={pooladdliq} poolremoveliq={poolremoveliq} />
<PoolDetail
store={store}
grpc={grpc}
nav={nav}
invoice={invoice}
pooladdliq={pooladdliq}
poolremoveliq={poolremoveliq}
/>
)}
{route === 'PromotionDetail' && (
<PromotionDetail store={store} nav={nav} poolredeemliq={poolredeemliq} />
<PromotionDetail
store={store}
nav={nav}
poolredeemliq={poolredeemliq}
/>
)}
</Container>
);
......
......@@ -20,60 +20,70 @@ import {
import { color } from '../component/style';
import { toSatoshis, toAmount } from '../helper';
ChartJS.register(ArcElement, Tooltip, Legend);
/**
*send BTC to Pool
*
*
*/
/**
*send BTC to Pool
*
*
*/
async function addToPool(grpc,store,pay,nav) {
nav.goWait();
const { settings } = store;
var amount = toSatoshis(store.payment.amount, settings);
if(parseFloat(store.settings.chains.algo.account.balance)*1000000 > (amount*1.01)){
async function addToPool(grpc, store, pay, nav) {
nav.goWait();
const { settings } = store;
var amount = toSatoshis(store.payment.amount, settings);
if (
parseFloat(store.settings.chains.algo.account.balance) * 1000000 >
amount * 1.01
) {
console.log('INFO! sufficient BTC in contract. skipping lightning swap...');
var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'swap', store.selectedPool.assetID , 0, amount, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 'add' ]);
if(poolStats.includes('confirmed in round')){
console.log('INFO! swap completed by contract only! skiping lightning swap.');
var poolStats = await grpc.initPyface([
'/data/lightning-bits/src/chains/algo/pools.py',
'swap',
store.selectedPool.assetID,
0,
amount,
store.settings.chains.algo.account.address,
store.settings.chains.algo.account.mnemonic,
'add',
]);
if (poolStats.includes('confirmed in round')) {
console.log(
'INFO! swap completed by contract only! skiping lightning swap.'
);
nav.goPayPoolDone();
return true;
}else{
} else {
nav.goPaymentFailed();
return false;
}
} else if ( store.payment.address != '' ) {
//return this._notification.display({ msg: 'INFO! swapping lightning BTC to contract BTC' });
// first test is contract can complete transaction
var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'swap', store.selectedPool.assetID , 0, amount, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 'add' ]);
console.log(poolStats);
if(poolStats.includes('confirmed in round')){
console.log('INFO! swap completed by contract only! skiping lightning swap.');
return false;
}
} else if (store.payment.address != '') {
//return this._notification.display({ msg: 'INFO! swapping lightning BTC to contract BTC' });
// first test is contract can complete transaction
poolStats = await grpc.initPyface([
'/data/lightning-bits/src/chains/algo/pools.py',
'swap',
store.selectedPool.assetID,
0,
amount,
store.settings.chains.algo.account.address,
store.settings.chains.algo.account.mnemonic,
'add',
]);
console.log(poolStats);
if (poolStats.includes('confirmed in round')) {
console.log(
'INFO! swap completed by contract only! skiping lightning swap.'
);
nav.goPayPoolDone();
return true;
}
const { payment, settings } = store;
try{
}
const { payment, settings } = store;
try {
const request = await grpc.sendCommand('decodePayReq', {
payReq: store.payment.address,
});
payment.amount = toAmount(request.numSatoshis, settings);
payment.note = request.description;
/*
......@@ -89,44 +99,44 @@ ChartJS.register(ArcElement, Tooltip, Legend);
}catch(er){console.error(er)}
*/
payment.fee = toAmount(16, settings);
console.log(payment);
var paymentHash = await pay.payLightning();
if(paymentHash == undefined) {
nav.goPaymentFailed();
return false;
}
console.log(payment);
var paymentHash = await pay.payLightning();
if (paymentHash == undefined) {
nav.goPaymentFailed();
return false;
}
console.log(paymentHash);
var pH = btoa(String.fromCharCode.apply(null, paymentHash.paymentHash));
console.log(pH);
/*
console.log(paymentHash);
var pH = btoa(String.fromCharCode.apply(null, paymentHash.paymentHash));
console.log(pH);
/*
const fulfill = await grpc.sendCommand('lookupInvoiceV2', {
payment_hash: pH,
});
console.log(fulfill);
*/
// then add converted contract satoshis to merchant pool
var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'swap', store.selectedPool.assetID , 0, amount, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 'add' ]);
// then add converted contract satoshis to merchant pool
poolStats = await grpc.initPyface([
'/data/lightning-bits/src/chains/algo/pools.py',
'swap',
store.selectedPool.assetID,
0,
amount,
store.settings.chains.algo.account.address,
store.settings.chains.algo.account.mnemonic,
'add',
]);
console.log(poolStats);
//this._notification.display({ msg: 'Swap completed!' });
nav.goPayPoolDone();
return true;
}catch(err){
return true;
} catch (err) {
console.error(err);
nav.goPaymentFailed();
}
}
}
}
}
const shareData = {
labels: ['Locked', 'Allocated', 'Rewards', 'Others'],
datasets: [
......@@ -150,7 +160,6 @@ const shareData = {
],
};
const styles = StyleSheet.create({
balance: {
marginBottom: 10,
......@@ -189,10 +198,9 @@ const PayPoolConfirmView = ({ grpc, store, nav, payment }) => (
</Header>
<MainContent>
<Card>
<View style={styles.shareChart}>
<Pie data={shareData} />
</View>
<View style={styles.shareChart}>
<Pie data={shareData} />
</View>
<FormStretcher>
<BalanceLabel style={styles.balance}>
<BalanceLabelNumeral style={styles.numeral}>
......@@ -202,9 +210,7 @@ const PayPoolConfirmView = ({ grpc, store, nav, payment }) => (
{store.unitLabel}
</BalanceLabelUnit>
</BalanceLabel>
<NamedField name="Slippage">
2%
</NamedField>
<NamedField name="Slippage">2%</NamedField>
<NamedField name="Fee">
{store.paymentFeeLabel} {store.unitLabel}
</NamedField>
......@@ -219,8 +225,8 @@ const PayPoolConfirmView = ({ grpc, store, nav, payment }) => (
</FormStretcher>
<PillButton
style={styles.confirmBtn}
onPress={async function(){
await addToPool(grpc,store,payment,nav);
onPress={async function() {
await addToPool(grpc, store, payment, nav);
}}
>
Confirm
......@@ -231,6 +237,7 @@ const PayPoolConfirmView = ({ grpc, store, nav, payment }) => (
);
PayPoolConfirmView.propTypes = {
grpc: PropTypes.object.isRequired,
store: PropTypes.object.isRequired,
nav: PropTypes.object.isRequired,
payment: PropTypes.object.isRequired,
......
......@@ -8,7 +8,7 @@ import { H1Text } from '../component/text';
import { Circle } from '../component/loader';
import { Button, ButtonText, PillButton } from '../component/button';
import { FormStretcher } from '../component/form';
import LightningBoltIcon from '../asset/icon/lightning-bolt';
//import LightningBoltIcon from '../asset/icon/lightning-bolt';
import BitsIcon from '../../src/asset/icon/bits';
import { color } from '../component/style';
......@@ -30,7 +30,7 @@ const styles = StyleSheet.create({
},
});
const PayPoolDoneView = ({ nav, payment, pool }) => (
const PayPoolDoneView = ({ nav, pool }) => (
<Background image="purple-gradient-bg">
<MainContent>
<FormStretcher>
......@@ -52,6 +52,7 @@ const PayPoolDoneView = ({ nav, payment, pool }) => (
);
PayPoolDoneView.propTypes = {
pool: PropTypes.object.isRequired,
nav: PropTypes.object.isRequired,
payment: PropTypes.object.isRequired,
};
......
......@@ -28,23 +28,21 @@ const styles = StyleSheet.create({
},
});
const PaymentFailedView = ({ channel, nav }) => (
const PaymentFailedView = ({ nav }) => (
<Background color={color.blackDark}>
<MainContent>
<FormStretcher>
<LightningErrorIcon height={115 * 0.8} width={60 * 0.8} />
<H1Text style={styles.h1Txt}>Transaction Failed</H1Text>
<CopyText style={styles.copyTxt}>
{'Check error logs!'}
</CopyText>
<CopyText style={styles.copyTxt}>{'Check error logs!'}</CopyText>
</FormStretcher>
<PillButton style={styles.createBtn} onPress={() => nav.goPayLightningConfirm()}>
<PillButton
style={styles.createBtn}
onPress={() => nav.goPayLightningConfirm()}
>
Try again
</PillButton>
<Button
style={styles.retryBtn}
onPress={() => nav.goHome()}
>
<Button style={styles.retryBtn} onPress={() => nav.goHome()}>
<ButtonText>Cancel</ButtonText>
</Button>
</MainContent>
......
......@@ -42,21 +42,19 @@ const PoolAddLiqView = ({ store, nav, pooladdliq }) => (
<MainContent>
<Card>
<FormText style={styles.description}>
Enter amount to add to merchants liquidity. You will receive pool share propotional to this amount.
Enter amount to add to merchants liquidity. You will receive pool
share propotional to this amount.
</FormText>
<BalanceLabel style={styles.balance}>
<AmountInputField
autoFocus={true}
onChangeText={amount => pooladdliq.setAmount({ amount })}
//onSubmitEditing={() => pooladdliq.checkType()}
/>
<BalanceLabelUnit style={styles.unit}>
{store.unitFiatLabel}
</BalanceLabelUnit>
</BalanceLabel>
<FormStretcher>
<InputField
placeholder="Pool Payment Request"
......@@ -64,10 +62,13 @@ const PoolAddLiqView = ({ store, nav, pooladdliq }) => (
value={store.payment.address}
/>
<FormSubText style={styles.subText}>
Investments will be locked for a minimum lock time as shown on the pool contract. So make sure you are investing in the right merchant.
Investments will be locked for a minimum lock time as shown on the
pool contract. So make sure you are investing in the right merchant.
</FormSubText>
</FormStretcher>
<PillButton onPress={() => pooladdliq.checkType()}>Verify Shares</PillButton>
<PillButton onPress={() => pooladdliq.checkType()}>
Verify Shares
</PillButton>
</Card>
</MainContent>
</Background>
......
import React from 'react';
import { Chart as ChartJS, ArcElement, Tooltip, Legend, CategoryScale, LinearScale, PointElement, LineElement, Title } from 'chart.js';
import {
Chart as ChartJS,
ArcElement,
Tooltip,
Legend,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
} from 'chart.js';
import faker from 'faker';
import { Pie, Line } from 'react-chartjs-2';
import { Line } from 'react-chartjs-2';
import { StyleSheet, View } from 'react-native';
import { observer } from 'mobx-react';
import PropTypes from 'prop-types';
......@@ -10,31 +20,35 @@ import MainContent from '../component/main-content';
import { DetailField } from '../component/field';
import Modal from '../component/modal';
import { color } from '../component/style';
import LightningBoltOrangeIcon from '../asset/icon/lightning-bolt-orange';
import { GlasButton, ChannelButton } from '../component/button';
//import LightningBoltOrangeIcon from '../asset/icon/lightning-bolt-orange';
import { GlasButton } from '../component/button';
import store from '../store';
import { DEFAULT_FIAT } from '../config';
import Algorand from '../chains/algo/algo.js';
import Icon from '../component/icon';
//import { DEFAULT_FIAT } from '../config';
//import Algorand from '../chains/algo/algo.js';
//import Icon from '../component/icon';
//import algosdk from "algosdk";
//import { Asset,TinymanMainnetClient } from 'tinyman-ts-sdk';
ChartJS.register(ArcElement, Tooltip, Legend,
ChartJS.register(
ArcElement,
Tooltip,
Legend,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend);
Legend
);
const labels = ['30', '29', '28', '27', '26', '25', '24', '23', '22', '21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1'];
const days = 30;
const labels = [];
for (let i = 0; i < days; i++) {
labels.push(i);
}
//const labels = ['30', '29', '28', '27', '26', '25', '24', '23', '22', '21', '20', '19', '18', '17', '16', '15', '14', '13', '12', '11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1'];
/*
async function doSwap(mne){
......@@ -74,12 +88,12 @@ await TXNS.submit(client,true);
}
*/
function newPoolSize(day){
var size = (faker.datatype.number({ min: 1000, max: 1500 })/(Math.log(10+parseInt(day))*faker.datatype.number({ min: 0.65, max: 0.95 })));
return size;
function newPoolSize(day) {
var size =
faker.datatype.number({ min: 1000, max: 1500 }) /
(Math.log(10 + parseInt(day)) *
faker.datatype.number({ min: 0.65, max: 0.95 }));
return size;
}
export const perfData = {
......@@ -106,9 +120,6 @@ export const perfData = {
],
};
const styles = StyleSheet.create({
content: {
justifyContent: 'center',
......@@ -136,7 +147,7 @@ const styles = StyleSheet.create({
});
const iconType = t => {
/*
/*
if (tx.type === 'algorand') {
tx.status === 'complete' ? 'success' : 'info';
} else {
......@@ -148,30 +159,28 @@ const iconType = t => {
style={styles.topIcon}
/>
*/
return require('../asset/icon/'+t+'.png');
*/
return require('../asset/icon/' + t + '.png');
};
/*
function getPoolShare(type, aID1, aID2, address) {
Algorand.checkPoolStatus()
}
async function dataGen(store, options, grpc) {
perfData.datasets[0].data = labels.map(() => faker.datatype.number({ min: 400, max: 1000 }));
perfData.datasets[1].data = labels.map(() => faker.datatype.number({ min: 200, max: 500 }));
perfData.datasets[2].data = labels.map(newPoolSize);
options.plugins.title.text = '30d Volume ('+store.settings.fiat.toLowerCase()+')';
/*
*/
async function dataGen(store, options, grpc) {
perfData.datasets[0].data = labels.map(() =>
faker.datatype.number({ min: 400, max: 1000 })
);
perfData.datasets[1].data = labels.map(() =>
faker.datatype.number({ min: 200, max: 500 })
);
perfData.datasets[2].data = labels.map(newPoolSize);
options.plugins.title.text =
'30d Volume (' + store.settings.fiat.toLowerCase() + ')';
/*
var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'bootstrap', 70653745, 0, '289:BITS', 'ALGO', 'TTNTINGI6AKN6JBHCAOXVFZN72BAMDNBTHZ3ZRQC3ILAMWONKN7XRRQ6GM' ]);
//poolStats = poolStats.replace(/'/g, '"').replace(/"{/g, "{").slice(0, -3);
......@@ -206,14 +215,20 @@ var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/poo
var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'swap', 75685483 , 0, 10, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic, 'remove' ]);
console.log(poolStats);
*/
// doSwap(store.settings.chains.algo.account.mnemonic);
var poolStats = await grpc.initPyface(['/data/lightning-bits/src/chains/algo/pools.py', 'pooling', store.selectedPool.assetID , 0, store.settings.chains.algo.account.address, store.settings.chains.algo.account.mnemonic ]);
console.log(poolStats);
}
*/
// doSwap(store.settings.chains.algo.account.mnemonic);
var poolStats = await grpc.initPyface([
'/data/lightning-bits/src/chains/algo/pools.py',
'pooling',
store.selectedPool.assetID,
0,
store.settings.chains.algo.account.address,
store.settings.chains.algo.account.mnemonic,
]);
console.log(poolStats);
}
const options = {
responsive: true,
plugins: {
......@@ -222,53 +237,61 @@ const options = {
},
title: {
display: true,
text: '30d Volume ('+store.settings.fiat.toLowerCase()+')',
text: '30d Volume (' + store.settings.fiat.toLowerCase() + ')',
},
},
};
const PoolDetailView = ({ store, grpc, nav, pooladdliq, poolremoveliq}) => (
const PoolDetailView = ({ store, grpc, nav, pooladdliq, poolremoveliq }) => (
<Background color={color.blackDark}>
<MainContent style={styles.content}>
<Modal title={store.selectedPool.idName} onClose={() => nav.goPools()}>
<Line meta={ dataGen(store, options, grpc) } options={options} data={perfData} />
<Line
meta={dataGen(store, options, grpc)}
options={options}
data={perfData}
/>
<DetailField name={store.selectedPool.title}>
{store.selectedPool.desc}
</DetailField>
<DetailField name="Performance">
VALUATION: {parseInt(store.selectedPool.quoteFiat*1000)+store.settings.fiat} | PRICE: {parseInt(store.selectedPool.quoteFiat)+store.settings.fiat} | SHARE: {parseInt(store.selectedPool.amount*store.selectedPool.quoteFiat)+store.settings.fiat}
VALUATION:
{parseInt(store.selectedPool.quoteFiat * 1000) + store.settings.fiat}
PRICE:
{parseInt(store.selectedPool.quoteFiat) + store.settings.fiat}
SHARE:
{parseInt(store.selectedPool.amount * store.selectedPool.quoteFiat) +
store.settings.fiat}
</DetailField>
{store.selectedPool.memo ? (
<DetailField name="Note">
{store.selectedPool.memo}
</DetailField>
<DetailField name="Note">{store.selectedPool.memo}</DetailField>
) : null}
<DetailField name="Pool">
CAP: 0{store.unitLabel} | FUNDED: 12% | INVESTORS: 11 | ID: {store.selectedPool.id}:BITS
CAP: {store.unitLabel}
FUNDED: 12% INVESTORS: 11 ID: {store.selectedPool.id}:BITS
</DetailField>
<DetailField name="Asset Supply">
TOTAL: 1,000 | OWNED: {store.selectedPool.amount} | CIRCULATING: 30% | ID: {store.selectedPool.assetID}
TOTAL: 1,000 | OWNED: {store.selectedPool.amount} | CIRCULATING: 30%
|ID: {store.selectedPool.assetID}
</DetailField>
{store.selectedPool.confirmationsLabel ? (
<DetailField name="Contract">
POOLERS: {store.selectedPool.confirmationsLabel} | CHAIN: {store.selectedPool.typeLabel} | Lock Time: 30 Days
POOLERS: {store.selectedPool.confirmationsLabel} | CHAIN:
{store.selectedPool.typeLabel} | Lock Time: 30 Days
</DetailField>
) : null}
<SendReceiveButton
goPay={() => pooladdliq.init()}
goRequest={() => poolremoveliq.init()}
store={iconType(store.selectedPool.type)}
/>
</Modal>
</MainContent>
</Background>
);
PoolDetailView.propTypes = {
grpc: PropTypes.object.isRequired,
nav: PropTypes.object.isRequired,
store: PropTypes.object.isRequired,
pooladdliq: PropTypes.object.isRequired,
poolremoveliq: PropTypes.object.isRequired,
......@@ -285,7 +308,6 @@ const bigBtnStyles = StyleSheet.create({
marginTop: 80,
backgroundColor: '#0f5f76',
borderRadius: 21,
},
leftBtn: {
flex: 1,
......@@ -305,14 +327,12 @@ const bigBtnStyles = StyleSheet.create({
},
});
const SendReceiveButton = ({ goRequest, goPay, nav, store }) => (
const SendReceiveButton = ({ goRequest, goPay }) => (
<View style={bigBtnStyles.wrapper}>
<GlasButton onPress={goRequest} style={bigBtnStyles.leftBtn}>
Remove Funds
</GlasButton>
<View style={bigBtnStyles.boltWrapper}>
</View>
<View style={bigBtnStyles.boltWrapper}></View>
<GlasButton onPress={goPay} style={bigBtnStyles.rightBtn}>
Add Funds
</GlasButton>
......
......@@ -10,7 +10,7 @@ import { NamedField } from '../component/field';
import { Header, Title } from '../component/header';
import {
BackButton,
CopyButton,
//CopyButton,
Button,
ButtonText,
} from '../component/button';
......@@ -20,9 +20,9 @@ import {
BalanceLabelUnit,
} from '../component/label';
import Card from '../component/card';
import QRCode from '../component/qrcode';
//import QRCode from '../component/qrcode';
import { CopiedNotification } from '../component/notification';
import CopyPurpleIcon from '../asset/icon/copy-purple';
//import CopyPurpleIcon from '../asset/icon/copy-purple';
import LightningBoltIcon from '../asset/icon/lightning-bolt';
import { color } from '../component/style';
......@@ -51,7 +51,6 @@ const shareData = {
],
};
const styles = StyleSheet.create({
card: {
paddingBottom: 0,
......@@ -99,10 +98,9 @@ const PoolRemLiqConfView = ({ store, nav, poolremoveliq }) => (
</Header>
<MainContent>
<Card style={styles.card}>
<View style={styles.shareChart}>
<Pie data={shareData} />
</View>
<View style={styles.shareChart}>
<Pie data={shareData} />
</View>
<BalanceLabel style={styles.balance}>
<BalanceLabelNumeral style={styles.numeral}>
{store.invoiceAmountLabel}
......@@ -112,12 +110,10 @@ const PoolRemLiqConfView = ({ store, nav, poolremoveliq }) => (
</BalanceLabelUnit>
</BalanceLabel>
<NamedField name="Note">{store.invoice.note}</NamedField>
<Button onPress={() => poolremoveliq.confirmRem()} style={styles.doneBtn}>
<Button
onPress={() => poolremoveliq.confirmRem()}
style={styles.doneBtn}
>
<ButtonText style={styles.doneRemText}>REMOVE</ButtonText>
</Button>
<Button onPress={() => nav.goPoolRemoveLiquid()} style={styles.doneBtn}>
......
......@@ -57,9 +57,12 @@ const PoolRemoveLiqView = ({ store, nav, poolremoveliq }) => (
/>
</FormStretcher>
<FormSubText style={styles.subText}>
Enter amount to withdraw from merchats liquidity pool to your lightning wallet.
Enter amount to withdraw from merchats liquidity pool to your
lightning wallet.
</FormSubText>
<PillButton onPress={() => poolremoveliq.generateUri()}>Next</PillButton>
<PillButton onPress={() => poolremoveliq.generateUri()}>
Next
</PillButton>
</Card>
</MainContent>
</Background>
......
......@@ -9,15 +9,15 @@ import { ListContent, List, ListItem, ListHeader } from '../component/list';
import { Alert } from '../component/notification';
import Text from '../component/text';
import BitcoinIcon from '../../src/asset/icon/bitcoin';
import LightningBoltIcon from '../../src/asset/icon/lightning-bolt';
//import LightningBoltIcon from '../../src/asset/icon/lightning-bolt';
import { color, font } from '../component/style';
import { SmallButton, Button } from '../component/button';
import PlusIcon from '../../src/asset/icon/plus';
import { Button } from '../component/button';
//import PlusIcon from '../../src/asset/icon/plus';
import Icon from '../component/icon';
//import ChartApp from './chart';
//
//
// Pool Summary
//
......@@ -73,17 +73,13 @@ const PoolSummary = ({
</View>
);
*/
const PoolSummary = ({
poolBalanceOpenLabel,
poolBalanceClosingLabel,
unitLabel,
}) => (
const PoolSummary = ({ unitLabel }) => (
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<Alert type="success" style={summaryStyles.alert} />
<Text style={summaryStyles.txt}>Rewards</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
{unitLabel} 0.00
{unitLabel} 0.00
</Text>
</View>
<View style={summaryStyles.box}>
......@@ -96,12 +92,7 @@ const PoolSummary = ({
</View>
);
const PoolBalances = ({
poolBalanceLabel,
balanceLabel,
unitLabel,
}) => (
const PoolBalances = ({ poolBalanceLabel }) => (
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
......@@ -109,7 +100,7 @@ const PoolBalances = ({
</View>
<Text style={summaryStyles.txt}>Balance</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
{poolBalanceLabel}
{poolBalanceLabel}
</Text>
</View>
</View>
......@@ -131,7 +122,6 @@ PoolBalances.propTypes = {
// Pools View
//
const poolStyles = StyleSheet.create({
btnWrapper: {
//width: '100%',
......@@ -161,7 +151,7 @@ const poolStyles = StyleSheet.create({
height: 92,
width: 92,
marginLeft: 'calc( 50% - 46 )',
margin: 10,
margin: 10,
marginRight: 3,
},
listIcon: {
......@@ -173,50 +163,50 @@ const poolStyles = StyleSheet.create({
margin: 10,
},
});
const PoolView = ({ store, nav, pool, grpc, goPoolAdd }) => {
const { computedPools: pools,
const PoolView = ({ store, nav, pool }) => {
const {
computedPools: pools,
poolBalanceLabel,
poolBalanceOpenLabel,
poolBalanceClosingLabel,
balanceLabel,
unitLabel } = store;
unitLabel,
} = store;
return (
<Background color={color.blackDark}>
<Header separator>
<ChannelButton onPress={() => nav.goInvestments()} />
<ChannelButton onPress={() => nav.goInvestments()} />
<Title title="Investment Pools" />
<CancelButton onPress={() => nav.goHome()} />
</Header>
<Button style={poolStyles.topBtn}>
<Icon
image={require('../asset/icon/bits-invest.png')}
style={poolStyles.topIcon}
/>
<PoolBalances style={poolStyles.btnWrapper}
poolBalanceLabel={poolBalanceLabel}
balanceLabel={balanceLabel}
unitLabel={unitLabel}
/>
<PoolSummary style={poolStyles.btnWrapper}
poolBalanceOpenLabel={poolBalanceOpenLabel}
poolBalanceClosingLabel={poolBalanceClosingLabel}
<Icon
image={require('../asset/icon/bits-invest.png')}
style={poolStyles.topIcon}
/>
<PoolBalances
style={poolStyles.btnWrapper}
poolBalanceLabel={poolBalanceLabel}
balanceLabel={balanceLabel}
unitLabel={unitLabel}
/>
<PoolSummary
style={poolStyles.btnWrapper}
poolBalanceOpenLabel={poolBalanceOpenLabel}
poolBalanceClosingLabel={poolBalanceClosingLabel}
/>
</Button>
<View style={poolStyles.btnWrapper}></View>
<Title
style={poolStyles.poolInfo}
title="Select merchants to manage liquidity pool funds"
/>
</Button>
<View style={poolStyles.btnWrapper}>
</View>
<Title style={poolStyles.poolInfo} title="Select merchants to manage liquidity pool funds" />
<ListContent>
<List
data={pools}
renderHeader={PoolListHeader}
renderItem={item => (
<PoolListItem
tx={item}
onSelect={() => pool.select({ item })}
/>
<PoolListItem tx={item} onSelect={() => pool.select({ item })} />
)}
/>
</ListContent>
......@@ -263,17 +253,19 @@ const iStyles = StyleSheet.create({
});
const setState = tx => {
return tx.status === 'open' ? 'success' : 'error';
return tx.status === 'open' ? 'success' : 'error';
};
const capType = tx => {
//tx.cat
var cap = ['micro','small','medium'].sort(() => Math.random() - Math.random()).slice(0, 1)[0];
return require('../asset/icon/'+cap+'.png');
//return require('../asset/icon/soko.png');
//tx.cat
console.log(tx);
var cap = ['micro', 'small', 'medium']
.sort(() => Math.random() - Math.random())
.slice(0, 1)[0];
return require('../asset/icon/' + cap + '.png');
//return require('../asset/icon/soko.png');
};
/*
const statusType = tx => {
if (tx.type === 'active') {
return tx.status === 'complete' ? 'success' : 'info';
......@@ -283,30 +275,24 @@ const statusType = tx => {
};
const iconType = tx => {
/*
if (tx.type === 'algorand') {
tx.status === 'complete' ? 'success' : 'info';
} else {
tx.status === 'confirmed' ? 'success' : 'info';
}
*/
return require('../asset/icon/'+tx.cat+'.png');
};
*/
const PoolListItem = ({ tx, onSelect }) => (
<ListItem style={iStyles.item} onSelect={onSelect}>
<Icon
image={capType(tx)}
style={poolStyles.listIcon}
/>
<View style={iStyles.i}>
</View>
<Icon image={capType(tx)} style={poolStyles.listIcon} />
<View style={iStyles.i}></View>
<View style={[iStyles.m, iStyles.group]}>
<Alert type={setState(tx)} style={iStyles.alert} />
<Text style={iStyles.txt}>{tx.statusLabel}</Text>
</View>
<View style={iStyles.l}>
<Text style={[iStyles.txt, iStyles.wrap]} numberOfLines={1}>
{tx.merchantLabel}
......
......@@ -7,7 +7,7 @@ import MainContent from '../component/main-content';
import { DetailField } from '../component/field';
import Modal from '../component/modal';
import { color } from '../component/style';
import LightningBoltOrangeIcon from '../asset/icon/lightning-bolt-orange';
//import LightningBoltOrangeIcon from '../asset/icon/lightning-bolt-orange';
import { GlasButton } from '../component/button';
import Icon from '../component/icon';
......@@ -21,14 +21,17 @@ const styles = StyleSheet.create({
},
});
const PromotionDetailView = ({ store, nav, poolredeemliq }) => (
const PromotionDetailView = ({ store, nav }) => (
<Background color={color.blackDark}>
<MainContent style={styles.content}>
<Modal title={store.selectedPromotion.title} onClose={() => nav.goPromotions()}>
<Icon
image={require('../asset/icon/channel.svg')}
style={styles.topIcon}
/>
<Modal
title={store.selectedPromotion.title}
onClose={() => nav.goPromotions()}
>
<Icon
image={require('../asset/icon/channel.svg')}
style={styles.topIcon}
/>
<DetailField name="detail">
Join this promotion or redeem loyalty rewards to your bitcoin wallet
</DetailField>
......@@ -42,9 +45,7 @@ const PromotionDetailView = ({ store, nav, poolredeemliq }) => (
{store.selectedPromotion.dateTimeLabel}
</DetailField>
{store.selectedPromotion.memo ? (
<DetailField name="Note">
{store.selectedPromotion.memo}
</DetailField>
<DetailField name="Note">{store.selectedPromotion.memo}</DetailField>
) : null}
<DetailField name="Amount">
{store.selectedPromotion.amountLabel} {store.unitLabel}
......@@ -65,12 +66,7 @@ const PromotionDetailView = ({ store, nav, poolredeemliq }) => (
{store.selectedPromotion.preimage}
</DetailField>
) : null}
<SendReceiveButton
nav={() => nav}
/>
<SendReceiveButton nav={() => nav} />
</Modal>
</MainContent>
</Background>
......@@ -93,7 +89,6 @@ const bigBtnStyles = StyleSheet.create({
marginTop: 80,
backgroundColor: '#0f5f76',
borderRadius: 21,
},
leftBtn: {
flex: 1,
......@@ -118,11 +113,9 @@ const SendReceiveButton = ({ nav }) => (
<GlasButton onPress={nav} style={bigBtnStyles.leftBtn}>
Transfer
</GlasButton>
<View style={bigBtnStyles.boltWrapper}>
</View>
<View style={bigBtnStyles.boltWrapper}></View>
<GlasButton onPress={nav} style={bigBtnStyles.rightBtn}>
Redeem
Redeem
</GlasButton>
</View>
);
......
......@@ -8,8 +8,8 @@ import { CancelButton, ChannelButton } from '../component/button';
import { ListContent, List, ListItem, ListHeader } from '../component/list';
import { Alert } from '../component/notification';
import Text from '../component/text';
import BitcoinIcon from '../../src/asset/icon/bitcoin';
import LightningBoltIcon from '../../src/asset/icon/lightning-bolt';
//import BitcoinIcon from '../../src/asset/icon/bitcoin';
//import LightningBoltIcon from '../../src/asset/icon/lightning-bolt';
import { color, font } from '../component/style';
import { Button } from '../component/button';
......@@ -19,8 +19,6 @@ import Icon from '../component/icon';
//
// Promos View
//
const promotionStyles = StyleSheet.create({
depositBtn: {
marginLeft: 3,
......@@ -55,17 +53,22 @@ const PromotionView = ({ store, nav, promotion }) => {
<Title title="Redeem Promotions" />
<CancelButton onPress={() => nav.goHome()} />
</Header>
<Button style={promotionStyles.topBtn} onPress={() => nav.goHome()}>
<Icon
image={require('../asset/icon/promo.png')}
style={promotionStyles.topIcon}
<Button style={promotionStyles.topBtn} onPress={() => nav.goHome()}>
<Icon
image={require('../asset/icon/promo.png')}
style={promotionStyles.topIcon}
/>
</Button>
<Title
style={promotionStyles.poolInfo}
title="Earn cash-back rewards by joining local promotions"
/>
<Title
style={promotionStyles.poolInfo}
title="Rewards can only be redeemed after promotion ends"
/>
</Button>
<Title style={promotionStyles.poolInfo} title="Earn cash-back rewards by joining local promotions" />
<Title style={promotionStyles.poolInfo} title="Rewards can only be redeemed after promotion ends" />
<ListContent>
<List
<List
data={promotions}
renderHeader={PromotionListHeader}
renderItem={item => (
......@@ -124,25 +127,21 @@ const statusType = tx => {
}
};
const iconType = tx => {
/*
/*
if (tx.type === 'algorand') {
tx.status === 'complete' ? 'success' : 'info';
} else {
tx.status === 'confirmed' ? 'success' : 'info';
}
*/
return require('../asset/icon/'+tx.type.toLowerCase()+'.png');
*/
return require('../asset/icon/' + tx.type.toLowerCase() + '.png');
};
const PromotionListItem = ({ tx, onSelect }) => (
<ListItem style={iStyles.item} onSelect={onSelect}>
<View style={iStyles.i}>
<Icon
image={iconType(tx)}
style={promotionStyles.listIcon}
/>
<Icon image={iconType(tx)} style={promotionStyles.listIcon} />
</View>
<View style={[iStyles.m, iStyles.group]}>
<Alert type={statusType(tx)} style={iStyles.alert} />
......@@ -178,7 +177,6 @@ const hStyles = StyleSheet.create({
},
});
const PromotionListHeader = () => (
<ListHeader style={[iStyles.item, hStyles.header]}>
<View style={iStyles.i} />
......
......@@ -5,7 +5,12 @@ import PropTypes from 'prop-types';
import Background from '../component/background';
import { Header, Title } from '../component/header';
import { CopyText } from '../component/text';
import { CopyButton, Button, BackButton, RadioButton } from '../component/button';
import {
CopyButton,
Button,
BackButton,
RadioButton,
} from '../component/button';
import { SettingContent, SettingList, SettingItem } from '../component/setting';
import { color, font } from '../component/style';
import { CopiedNotification, Alert } from '../component/notification';
......@@ -14,13 +19,11 @@ import LightningBoltIcon from '../../src/asset/icon/lightning-bolt';
import CopyDarkIcon from '../../src/asset/icon/copy-dark';
import BitcoinIcon from '../../src/asset/icon/bitcoin';
import BitsIcon from '../../src/asset/icon/bits';
import Icon from '../component/icon';
//import ChartApp from './chart';
//
//
// Pool Summary
//
......@@ -51,7 +54,7 @@ const summaryStyles = StyleSheet.create({
height: 92,
width: 92,
marginLeft: 'calc( 50% - 46 )',
margin: 10,
margin: 10,
marginRight: 3,
paddingTop: 50,
},
......@@ -91,45 +94,33 @@ const summaryStyles = StyleSheet.create({
},
});
const ContractSummary = ({
poolBalanceOpenLabel,
poolBalanceClosingLabel,
unitLabel,
}) => (
const ContractSummary = ({ unitLabel }) => (
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<Alert type="success" style={summaryStyles.alert} />
<Text style={summaryStyles.txt}>Gas fees</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
0.001 (low)
{unitLabel} (low)
</Text>
</View>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<BitcoinIcon />
<BitcoinIcon />
</View>
<Text style={summaryStyles.txt}>ID</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
1942776
</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>1942776</Text>
</View>
</View>
);
const ContractBalances = ({
balanceLabel,
unitLabel,
}) => (
const ContractBalances = ({ balanceLabel, unitLabel }) => (
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<LightningBoltIcon height={170 * 0.06} width={135 * 0.06} />
</View>
<Text style={summaryStyles.txt}>{balanceLabel}</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
{unitLabel}
</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>{unitLabel}</Text>
</View>
</View>
);
......@@ -157,110 +148,109 @@ const SetContractView = ({ store, nav, setting, invoice }) => {
<Title title="Contract Settings" />
<Button disabled onPress={() => {}} />
</Header>
<Button style={summaryStyles.topBtn}>
<Title style={summaryStyles.poolInfo, summaryStyles.topPad} title="Algorand" />
<Icon
image={require('../asset/icon/algorand.png')}
style={summaryStyles.topIcon}
/>
<Title style={summaryStyles.poolInfo} title="https://algorand.com" />
<CopyText style={summaryStyles.copyTxtX}>
A world where everyone creates and exchanges value efficiently, transparently, and securely.
</CopyText>
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<Alert type="success" style={summaryStyles.alert} />
</View>
<Text style={summaryStyles.txt}> Balance</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
{store.settings.chains.algo.account.balance}
</Text>
</View>
</View>
<ContractSummary style={summaryStyles.btnWrapper}
poolBalanceOpenLabel=""
poolBalanceClosingLabel=""
/>
<Title style={summaryStyles.poolInfo, summaryStyles.topPad} title="Account information" />
<ContractBalances style={summaryStyles.btnWrapper}
balanceLabel="Public"
unitLabel={store.settings.chains.algo.account.address}
/>
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<BitcoinIcon />
</View>
<Text style={summaryStyles.txt}> Balance</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
0.00001
</Text>
</View>
</View>
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<BitsIcon />
</View>
<Text style={summaryStyles.txt}>Assets</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
0
</Text>
</View>
</View>
<CopyText style={summaryStyles.copyTxtX}>
Do not share this information or funds will be compromised
</CopyText>
<CopyButton
onPress={() => invoice.toClipboard({ text: store.settings.chains.algo.account.mnemonic })}
<Title
style={(summaryStyles.poolInfo, summaryStyles.topPad)}
title="Algorand"
/>
<Icon
image={require('../asset/icon/algorand.png')}
style={summaryStyles.topIcon}
/>
<Title style={summaryStyles.poolInfo} title="https://algorand.com" />
<CopyText style={summaryStyles.copyTxtX}>
A world where everyone creates and exchanges value efficiently,
transparently, and securely.
</CopyText>
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<Alert type="success" style={summaryStyles.alert} />
</View>
<Text style={summaryStyles.txt}> Balance</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
{store.settings.chains.algo.account.balance}
</Text>
</View>
</View>
<ContractSummary
style={summaryStyles.btnWrapper}
poolBalanceOpenLabel=""
poolBalanceClosingLabel=""
/>
<Title
style={[summaryStyles.poolInfo, summaryStyles.topPad]}
title="Account information"
/>
<ContractBalances
style={summaryStyles.btnWrapper}
balanceLabel="Public"
unitLabel={store.settings.chains.algo.account.address}
/>
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<BitcoinIcon />
</View>
<Text style={summaryStyles.txt}> Balance</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>
0.00001
</Text>
</View>
</View>
<View style={summaryStyles.wrapper}>
<View style={summaryStyles.box}>
<View style={summaryStyles.alert}>
<BitsIcon />
</View>
<Text style={summaryStyles.txt}>Assets</Text>
<Text style={[summaryStyles.txt, summaryStyles.total]}>0</Text>
</View>
</View>
<CopyText style={summaryStyles.copyTxtX}>
Do not share this information or funds will be compromised
</CopyText>
<CopyButton
onPress={() =>
invoice.toClipboard({
text: store.settings.chains.algo.account.mnemonic,
})
}
icon={<CopyDarkIcon height={17.5} width={14} />}
style={summaryStyles.copyBtn} >
style={summaryStyles.copyBtn}
>
private key
</CopyButton>
</Button>
<SettingContent>
<Title style={summaryStyles.poolInfo} title="How to connect" />
</Button>
<SettingContent>
<Title style={summaryStyles.poolInfo} title="How to connect" />
<SettingList>
<SettingItem
name="Remote"
label={store.settings.chains.algo.rpc[store.settings.chains.algo.chain].server}
onSelect={() => setting.contractConnection({ chain: 'algo', connect: 'remote' })}
label={
store.settings.chains.algo.rpc[store.settings.chains.algo.chain]
.server
}
onSelect={() =>
setting.contractConnection({ chain: 'algo', connect: 'remote' })
}
>
<RadioButton selected={'local' != store.settings.chains.algo.chain} />
<RadioButton
selected={'local' != store.settings.chains.algo.chain}
/>
</SettingItem>
<SettingItem
name="Local"
onSelect={() => setting.contractConnection({ chain: 'algo', connect: 'local' })}
onSelect={() =>
setting.contractConnection({ chain: 'algo', connect: 'local' })
}
>
<RadioButton selected={'local' === store.settings.chains.algo.chain} />
<RadioButton
selected={'local' === store.settings.chains.algo.chain}
/>
</SettingItem>
</SettingList>
</SettingContent>
<CopiedNotification
display={store.displayCopied}
color={color.notifyLight}
......
......@@ -10,7 +10,13 @@ import {
SettingItem,
SettingHeader,
} from '../component/setting';
import { CountBubbleRed, CountBubbleGreen, CountBubbleOrange, CountBubbleGrey } from '../component/notification';
import {
CountBubbleRed,
CountBubbleGreen,
CountBubbleOrange,
CountBubbleGrey,
} from '../component/notification';
import { createStyles, maxWidth } from '../component/media-query';
import { color, breakWidth } from '../component/style';
......@@ -54,7 +60,7 @@ const SettingView = ({ store, nav, wallet, autopilot, auth }) => {
onSelect={() => nav.goNotifications()}
arrow
>
<CountBubbleRed>{store.notificationCountLabel}</CountBubbleRed>
<CountBubbleRed>{store.notificationCountLabel}</CountBubbleRed>
</SettingItem>
<SettingItem
name="Bitcoin Unit"
......@@ -83,7 +89,7 @@ const SettingView = ({ store, nav, wallet, autopilot, auth }) => {
onValueChange={() => autopilot.toggle()}
/>
</SettingItem>
<SettingHeader name="CONTRACTS" style={styles.content}/>
<SettingHeader name="CONTRACTS" style={styles.content} />
<SettingItem
name="Algorand"
onSelect={() => nav.goContractSettings('algo')}
......@@ -91,20 +97,14 @@ const SettingView = ({ store, nav, wallet, autopilot, auth }) => {
>
<CountBubbleOrange>testnet</CountBubbleOrange>
</SettingItem>
<SettingItem
name="Ethereum"
arrow
>
<SettingItem name="Ethereum" arrow>
<CountBubbleGrey>offline</CountBubbleGrey>
<CountBubbleGreen>mainnet</CountBubbleGreen>
</SettingItem>
<SettingItem
name="Solana"
arrow
>
<SettingItem name="Solana" arrow>
<CountBubbleGrey>offline</CountBubbleGrey>
<CountBubbleOrange>testnet</CountBubbleOrange>
</SettingItem>
</SettingItem>
<SettingHeader name="ADVANCED" style={styles.advanced} />
<SettingItem name="Logs" onSelect={() => nav.goCLI()} arrow />
</SettingContent>
......
......@@ -21,7 +21,6 @@ const WaitView = ({ nav }) => (
<Background color={color.blackDark}>
<MainContent style={styles.content}>
<ContinuousLoadNetworkSpinner msg="Loading..." />
<Button onPress={() => nav.goHome()} style={styles.btn}>
<ButtonText>HOME</ButtonText>
</Button>
......@@ -29,10 +28,8 @@ const WaitView = ({ nav }) => (
</Background>
);
WaitView.propTypes = {
nav: PropTypes.object.isRequired,
};
export default WaitView;
import React from 'react';
import { View, StyleSheet } from 'react-native';
import Background from '../component/background';
import BoltIcon from '../asset/icon/lightning-bolt';
//import BoltIcon from '../asset/icon/lightning-bolt';
//import LightningWord from '../asset/icon/lightning-word';
import Text from '../component/text';
import Icon from '../component/icon';
const welcomeStyles = StyleSheet.create({
mainIcon: {
height: 150,
width: 150,
marginLeft: 'calc( 50% - 75 )',
margin: 10,
margin: 10,
},
});
const styles = StyleSheet.create({
......@@ -48,7 +47,6 @@ const WelcomeView = () => (
image={require('../asset/icon/bitsIcon.png')}
style={welcomeStyles.mainIcon}
/>
</View>
<Text style={styles.title}>BITS</Text>
<Text style={styles.subtitle}>shop and redeem loyalty rewards</Text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment