From f9e8f7d3d2b516c9de5378103c756a4dd6201fd9 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Tue, 16 Jan 2018 09:48:28 +0800 Subject: [PATCH 001/265] check memo --- src/api/account.js | 25 +++++++++++++++++++++++++ src/locales/en.json | 1 + src/locales/zh-cn.json | 1 + src/pages/SendAsset.vue | 4 ++++ src/pages/contacts/AddContact.vue | 8 ++++++-- src/pages/contacts/ModifyContact.vue | 6 ++++++ 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/api/account.js b/src/api/account.js index 576ab917..a9ee58f1 100644 --- a/src/api/account.js +++ b/src/api/account.js @@ -213,3 +213,28 @@ export function miniAddress(address){ var end = address.substring(address.length - 4); return start + '...' + end; } + +export function isValidMemo(type, memo) { + let valid = true; + try { + switch (type.toUpperCase()) { + case 'ID': + StellarSdk.Memo.id(memo); + break; + case 'TEXT': + StellarSdk.Memo.text(memo); + break; + case 'HASH': + StellarSdk.Memo.hash(memo); + break; + case 'RETURN': + StellarSdk.Memo.return(memo); + break; + default: + valid = false; + } + } catch (err) { + valid = false; + } + return valid; +}; diff --git a/src/locales/en.json b/src/locales/en.json index db27163b..66e18bad 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -197,6 +197,7 @@ "Error.DestinationIsRequired":"destination is required", "Error.AmountIsRequired":"amount is required", "Error.MemoIsRequired":"memo is required", + "Error.MemoIsInvalid": "memo is invalid", "Error.DeleteTrustError":"delete trust error", "DeleteTrustSuccess":"delete trust success", diff --git a/src/locales/zh-cn.json b/src/locales/zh-cn.json index 7c64a6d2..9fe578ae 100644 --- a/src/locales/zh-cn.json +++ b/src/locales/zh-cn.json @@ -192,6 +192,7 @@ "Error.DestinationIsRequired":"目标地址不能为空", "Error.AmountIsRequired":"数量不能为空", "Error.MemoIsRequired":"备注不能为空", + "Error.MemoIsInvalid": "备注格式不正确", "Error.DeleteTrustError":"删除信任线失败", "DeleteTrustSuccess":"删除信任线成功", diff --git a/src/pages/SendAsset.vue b/src/pages/SendAsset.vue index 84c25d8f..58a06411 100644 --- a/src/pages/SendAsset.vue +++ b/src/pages/SendAsset.vue @@ -353,6 +353,10 @@ export default { this.$toasted.error(this.$t('Error.MemoIsRequired')) return } + if(!accountapi.isValidMemo(this.memotype, this.memo)) { + this.$toasted.error(this.$t('Error.MemoIsInvalid')) + return + } } diff --git a/src/pages/contacts/AddContact.vue b/src/pages/contacts/AddContact.vue index 64d07adb..c43a7dca 100644 --- a/src/pages/contacts/AddContact.vue +++ b/src/pages/contacts/AddContact.vue @@ -95,7 +95,7 @@ import Toolbar from '@/components/Toolbar' import Card from '@/components/Card' import QRScan from '@/components/QRScan' import { mapState, mapActions, mapGetters} from 'vuex' -import {isValidateAddress} from '@/api/account' +import {isValidateAddress, isValidMemo} from '@/api/account' import {importContact} from '@/api/qr.js' let loseCode = function(str) { @@ -179,7 +179,11 @@ export default { } if(this.memoswitch){ if(!this.memotype || !this.memo){ - this.$toasted.error(this.$t('Memo')) + this.$toasted.error(this.$t('Error.MemoIsRequired')) + return + } + if(!isValidMemo(this.memotype, this.memo)) { + this.$toasted.error(this.$t('Error.MemoIsInvalid')) return } } diff --git a/src/pages/contacts/ModifyContact.vue b/src/pages/contacts/ModifyContact.vue index 3d9be516..15866ad6 100644 --- a/src/pages/contacts/ModifyContact.vue +++ b/src/pages/contacts/ModifyContact.vue @@ -68,6 +68,7 @@ import Toolbar from '@/components/Toolbar' import Card from '@/components/Card' import { mapState, mapActions, mapGetters} from 'vuex' +import {isValidMemo} from '@/api/account' let loseCode = function(str) { let hash = 0; @@ -137,6 +138,7 @@ export default { } }, modifyContact() { + //Todo: 这里好像有个 bug,修改账户的时候 memo_type 会被置空 //let length = this.accountData.contacts.length let contact_temp = {name: this.name, address: this.address, memotype: this.memotype_real, memo: this.memo} let hash_temp = loseCode(this.address + this.memotype_real + this.memo) @@ -144,6 +146,10 @@ export default { this.$toasted.error(this.$t('Error.ContactExist')) return } + if(contact_temp.memotype !== '' && contact_temp.memotype != 'None' && !isValidMemo(contact_temp.memotype, contact_temp.memo)) { + this.$toasted.error(this.$t('Error.MemoIsInvalid')) + return + } //console.log(contact_temp) //var index = -1 //for(var i = 0, n = this.contacts.length; i Date: Mon, 15 Jan 2018 15:32:21 +0800 Subject: [PATCH 002/265] deposit sep-0006 --- src/api/deposit.js | 30 ++++++++++++++++ src/api/withdraw.js | 18 +++++++++- src/locales/en.json | 6 ++++ src/locales/zh-cn.json | 7 ++-- src/pages/Funding.vue | 80 ++++++++++++++++++++++++++++++------------ 5 files changed, 115 insertions(+), 26 deletions(-) diff --git a/src/api/deposit.js b/src/api/deposit.js index bfac69d3..de78e72d 100644 --- a/src/api/deposit.js +++ b/src/api/deposit.js @@ -3,6 +3,7 @@ import axios from 'axios' import { getServer} from './server' import { federation } from './federation' +import StellarSdk from 'stellar-sdk' var Promise = require('es6-promise').Promise /** @@ -22,3 +23,32 @@ export function queryDeposit(domain,asset,address){ }) } +/** + * =====sep 0006 标准的充值接口 + * 1. 拿到stellar.toml中的DEPOSIT_SERVER + * 2. 请求DEPOSIT_SERVER,GET请求,参数:asset_code(必填),account(必填),memo_type(可选),memo(可选) + * 3. 拿到结果,JSON格式, + * { + * how: 一般是恒星地址, + * eta: 可选 int , 预估多长时间后充值会生效 + * min_account: 可选,float , 最小充值金额 + * max_account: 可选,float ,最大充值金额 + * fee_fixed: 可选,float, 固定的充值费用 + * fee_percent: 可选,float,充值费率 + * extra_info: 可选,object, + * } + * 4. 根据充值内容给用户提示相应的信息,都是文本内容 + * + */ +export function queryStandardDeposite(homedomain,asset_code,address){ + return StellarSdk.StellarTomlResolver.resolve(homedomain) + .then(data => { + console.log('---query standard---') + console.log(data) + if(data.DEPOSIT_SERVER){ + let url = `${data.DEPOSIT_SERVER}?asset_code=${asset_code}&account=${address}` + return axios.get(url) + } + throw new Error('DW.Error.NoDepositService') + }) +} diff --git a/src/api/withdraw.js b/src/api/withdraw.js index 62fbf09c..4b1d1a8e 100644 --- a/src/api/withdraw.js +++ b/src/api/withdraw.js @@ -83,4 +83,20 @@ export function submitQuote(url,data){ } console.log(`submite withdraw quote url : ${url}`) return axios.get(url) -} \ No newline at end of file +} + +/** + * sep 0006 标准的提现流程 + * 1. 请求stellar.toml,拿到FEDERATION_SERVER + * 2. GET请求FEDERATION_SERVER,参数: + * { + * type: forward + * forward_type: bank_account或crypto + * asset_code: 提现的币种 + * dest: 提现的目标账户 + * dest_extra: 可选,提现备注(如果是抽现到其他网络上) + * + * } + * 3. 根据返回结果构造表单,由用户确认提交 + * + */ diff --git a/src/locales/en.json b/src/locales/en.json index 66e18bad..f12088cc 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -154,6 +154,12 @@ "DW.Error.NoWithdrawServiceDesc":"cannot withdraw this asset,please contact the issuer.", "DW.DepositInfo":"deposit info", "Error.SubmitQuoteFail":"submit quote failed", + "DW.DepositInfo.eta": "the deposit will take {0} seconds to credit", + "DW.DepositInfo.min":"the min of deposit is {0}", + "DW.DepositInfo.max":"the max of deposit is {0}", + "DW.DepositInfo.feefixed":"the deposit fee is {0}", + "DW.DepositInfo.feepercent":"the persent fee for deposit is {0}%", + "Menu.TradeCenter":"Trade Center", diff --git a/src/locales/zh-cn.json b/src/locales/zh-cn.json index 9fe578ae..fa72894e 100644 --- a/src/locales/zh-cn.json +++ b/src/locales/zh-cn.json @@ -148,8 +148,11 @@ "DW.Error.NoWithdrawServiceDesc":"该资产不满足我们的网络提现协议,无法提现。如需提现,请直接联系资产发行方。", "DW.DepositInfo":"充值地址", "Error.SubmitQuoteFail":"提交失败", - - + "DW.DepositInfo.eta": "充值需要{0}秒到账", + "DW.DepositInfo.min":"最小充值金额为{0}", + "DW.DepositInfo.max":"最大充值金额为{0}", + "DW.DepositInfo.feefixed":"充值收费金额为{0}", + "DW.DepositInfo.feepercent":"充值收费比例为{0}%", "Menu.TradeCenter":"交易中心", "Trade.SelfSelection":"自选交易", diff --git a/src/pages/Funding.vue b/src/pages/Funding.vue index acc30cdc..1348d6b0 100644 --- a/src/pages/Funding.vue +++ b/src/pages/Funding.vue @@ -47,10 +47,27 @@ {{$t('DW.Error.NoDepositServiceDesc')}}
-
{{$t('DW.DepositInfo')}}
-
{{depositData.deposit_info}}
-
{{depositData.extra_info}}
-
{{depositData.extra_info_cn}}
+ +
+
{{$t('DW.DepositInfo')}}
+
{{standardDepositData.how}}
+
{{$t('DW.DepositInfo.eta',[standardDepositData.eta])}}
+
{{$t('DW.DepositInfo.min', [standDepositData.min_amount])}}
+
{{$t('DW.DepositInfo.max', [standDepositData.max_amount])}}
+
{{$t('DW.DepositInfo.feefixed', [standDepositData.fee_fixed])}}
+
{{$t('DW.DepositInfo.feepercent', [standDepositData.fee_percent * 100])}}
+
+
{{value}}
+
+
+ +
+
{{$t('DW.DepositInfo')}}
+
{{depositData.deposit_info}}
+
{{depositData.extra_info}}
+
{{depositData.extra_info_cn}}
+
+
@@ -112,7 +129,7 @@ import Toolbar from '../components/Toolbar' import Card from '../components/Card' import BottomNotice from '@/components/BottomNotice' import { mapState, mapActions, mapGetters} from 'vuex' -import { queryDeposit } from '../api/deposit' +import { queryDeposit,queryStandardDeposite } from '../api/deposit' import { getAssetWithdrawUrl,submitQuote } from '../api/withdraw' import { resolveByFedAddress, federation, resolveByFedDomain} from '../api/federation' import { send } from '../api/account' @@ -126,6 +143,7 @@ export default { selectedasset:{}, assetChoseReturnObject: true, depositData:{},//充值 + standardDepositData:undefined,//标准的充值协议数据 withdrawData:{},//提现 error:null, withdrawErr: false,//true或false @@ -198,10 +216,11 @@ export default { }, changeAsset(item){ - this.working = true - this.error = null - this.depositData ={} - this.withdrawData = {} + this.working = true; + this.error = null; + this.depositData ={}; + this.standardDepositData = undefined; + this.withdrawData = {}; let info = this.assetAccounts[item.issuer] //根据home_dome查询数据 if(info){ @@ -231,24 +250,39 @@ export default { }, getDeposit(home_domain,asset){ - queryDeposit(home_domain,asset,this.account.address) + console.log('------asset ---') + console.log(asset) + //先按照标准协议去查询,然后再按照自定义的协议去查询 + queryStandardDeposite(home_domain, asset.code, this.account.address) .then(response=>{ - console.log('-------------query deposit data------') let data = response.data - if(data){ - this.depositData = data - }else{ - this.error = this.$t('DW.Error.NoDepositService') - this.$toasted.error(this.$t('DW.Error.NoDepositService')) + if(data.error){ + throw new Error(data.error) } - this.working = false - }) - .catch(err=>{ - console.error(err) - this.error = err - this.$toasted.error(this.$t('DW.Error.NoDepositService')) - this.working = false + this.standardDepositData = data; + this.working = false; + }).catch(err=>{ + console.log('not standard deposit service'); + queryDeposit(home_domain,asset,this.account.address) + .then(response=>{ + console.log('-------------query deposit data------') + let data = response.data + if(data){ + this.depositData = data + }else{ + this.error = this.$t('DW.Error.NoDepositService') + this.$toasted.error(this.$t('DW.Error.NoDepositService')) + } + this.working = false + }) + .catch(err=>{ + console.error(err) + this.error = err + this.$toasted.error(this.$t('DW.Error.NoDepositService')) + this.working = false + }) }) + }, getWithdraw(home_domain,asset){ console.log(`---------get withdraw info ------`) From 0dd00eef8ca3fb5d92fad75fe50ef9c5efa1c8c9 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Tue, 16 Jan 2018 11:30:40 +0800 Subject: [PATCH 003/265] vuex hot update --- build/webpack.dev.conf.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 5470402d..715c1831 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -17,6 +17,9 @@ module.exports = merge(baseWebpackConfig, { }, // cheap-module-eval-source-map is faster for development devtool: '#cheap-module-eval-source-map', + devServer: { + hot: true + }, plugins: [ new webpack.DefinePlugin({ 'process.env': config.dev.env @@ -30,6 +33,8 @@ module.exports = merge(baseWebpackConfig, { template: 'index.html', inject: true }), - new FriendlyErrorsPlugin() + new FriendlyErrorsPlugin(), + new webpack.NamedModulesPlugin(), + new webpack.HotModuleReplacementPlugin() ] }) From 54429fb2fd15ee15434ae2ee119a52648c937b73 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Tue, 16 Jan 2018 11:31:18 +0800 Subject: [PATCH 004/265] vuex persitence --- src/store/index.js | 52 ++++++++++++++++++++++++++++++-- src/store/plugins/persistence.js | 27 ++++++++++++++--- 2 files changed, 71 insertions(+), 8 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 38a29a1c..f8a3b644 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -113,7 +113,31 @@ const mutations = { } } -export default new Vuex.Store({ +const blocks = { + keys:[ + 'error', + 'seed', + 'seedExtData', + 'accountname', + 'accountpassword', + 'memo', + 'accounts.error', + 'accounts.data', + 'account.accountData', + + ], + data:{ + accounts:{ + data:[], + accountData: { seed: null } + } + } +} + + + + +const store = new Vuex.Store({ state, getters, actions, @@ -130,7 +154,8 @@ export default new Vuex.Store({ serialize, deserialize, // never expire - expires: 0 + expires: 0, + blocks })] }) @@ -154,4 +179,25 @@ export const HIDEN_LOADING = 'HIDEN_LOADING' export const CLEAN_GLOBAL_STATE = 'CLEAN_GLOBAL_STATE' export const CHANGE_IOSSTATUSBAR_COLOR = 'CHANGE_IOSSTATUSBAR_COLOR' export const ON_PAUSE = 'ON_PAUSE' -export const ON_RESUME = 'ON_RESUME' \ No newline at end of file +export const ON_RESUME = 'ON_RESUME' + +console.log(module.hot + '----module----') +console.log(module.hot) + +if (module.hot) { + module.hot.accept([ + './modules/AccountsStore', + './modules/AccountStore', + './modules/AppSettingStore', + './modules/AssetStore' + ], () => { + store.hotUpdate({ + app: require('./modules/AppSettingStore'), + account: require('./modules/AccountStore'), + accounts: require('./modules/AccountsStore'), + asset: require('./modules/AssetStore') + }) + }) +} + +export default store diff --git a/src/store/plugins/persistence.js b/src/store/plugins/persistence.js index 36429598..82fdcb47 100644 --- a/src/store/plugins/persistence.js +++ b/src/store/plugins/persistence.js @@ -1,5 +1,8 @@ -/** +/* + * vuex state 复制保存插件 * 代码复制来自于 https://github.com/crossjs/vuex-localstorage + * @Author: mazhaoyong + * @Date: 2018-01-16 09:59:52 */ import shvl from 'shvl' @@ -101,6 +104,7 @@ export function createStorage ({ * @param {function} [param.reducer] 用于数据过滤的方法 * @param {string[]} [param.paths = []] 需要持久化的数据的路径,state 的 keys。 * 如需处理更多层级,可以配合自定义 reducer 实现 + * @param {string[]} [param.blocks = {} ] 不需要保存的数据 * @return {function(store: object)} 插件函数 * @example * const plugin = createPersist() @@ -118,7 +122,8 @@ export default function createPersist ({ expires, merge = defaultMerge, reducer = defaultReducer, - paths = [] + paths = [], + blocks = {} } = {}) { return store => { const storage = createStorage({ @@ -131,12 +136,14 @@ export default function createPersist ({ expires }) + console.log('-------replace store---------') store.replaceState( merge(store.state, storage.get()) ) store.subscribe((mutation, state) => { - storage.set(reducer(state, paths)) + console.log('------store state------') + storage.set(reducer(state, paths, blocks)) }) } } @@ -145,8 +152,8 @@ function defaultMerge (...args) { return Object.assign({}, ...args) } -function defaultReducer (state, paths) { - return paths.length === 0 +function defaultReducer (state, paths, blocks) { + let newstate = paths.length === 0 ? state : paths.reduce((substate, path) => { if (state.hasOwnProperty(path)) { @@ -154,4 +161,14 @@ function defaultReducer (state, paths) { } return substate }, {}) + //去掉不需要保存的数据 + if(blocks && blocks.keys && blocks.keys.length > 0 ){ + for(var i=0,n=blocks.keys.length; i Date: Tue, 16 Jan 2018 11:31:38 +0800 Subject: [PATCH 005/265] amount display bug --- src/api/payments.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/api/payments.js b/src/api/payments.js index 913a8082..45b14581 100644 --- a/src/api/payments.js +++ b/src/api/payments.js @@ -24,13 +24,13 @@ export function convertRecords(address,rows){ t.isInbound = r.to === address; t.counterparty = t.isInbound ? r.from : r.to; t.asset = r.asset_type == "native" ? {code: "XLM"} : {code:r.asset_code, issuer: r.asset_issuer}; - t.amount = parseFloat(r.amount); + t.amount = r.amount; break; case 'create_account': t.isInbound = r.account === address; t.counterparty = t.isInbound ? r.source_account : r.account; t.asset = {code: "XLM"}; - t.amount = parseFloat(r.starting_balance); + t.amount = r.starting_balance; break; default: @@ -45,7 +45,9 @@ let _payment_stream = undefined export function listenPaymentStream(address,handler){ closePaymentStream(); - _payment_stream = getServer().payments().forAccount(address).stream({ + _payment_stream = getServer().payments().forAccount(address) + //.order("desc").limit(20) + .stream({ onmessage: res => { handler(res); } From d65341ca5046e0e3589a2338b8f9efc2c9809cdf Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Tue, 16 Jan 2018 11:32:05 +0800 Subject: [PATCH 006/265] load vuex state from cache on startup --- src/App.vue | 2 +- src/pages/Main.vue | 2 +- src/store/modules/AccountStore.js | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index e7f5c544..0e413976 100644 --- a/src/App.vue +++ b/src/App.vue @@ -94,7 +94,7 @@ //尝试加载当前账户信息 try{ if(this.address){ - this.getAccountInfo(this.address) + //this.getAccountInfo(this.address) closeStreams() initStreams(this.address) this.getAllAssetHosts() diff --git a/src/pages/Main.vue b/src/pages/Main.vue index 61d6218c..3e2653e9 100644 --- a/src/pages/Main.vue +++ b/src/pages/Main.vue @@ -220,7 +220,7 @@ export default { } }, load(){ - this.cleanAccount() + //this.cleanAccount() let address = this.account.address // let process = [this.getAccountInfo(address),this.getPayments(address)] //console.log(process) diff --git a/src/store/modules/AccountStore.js b/src/store/modules/AccountStore.js index c72246f7..9ffb6d8c 100644 --- a/src/store/modules/AccountStore.js +++ b/src/store/modules/AccountStore.js @@ -60,14 +60,15 @@ const mutations = { CLEAN_ACCOUNT(state){ state.data = {balances:[]} state.transations = { records:[] } - //state.payments = { records:[] } state.selectedPayment = null }, CLEAN_PAYMENTS(state){ state.payments = { records: [] } }, ACCOUNT_INFO_SUCCESS(state,info){ - state.data = info + state.transations = { records:[] }; + state.selectedPayment = null; + state.data = info; }, GET_TRANSACTIONS_SUCCESS(state,data){ state.transactions = data From ae84fa44ea2057e6ffc2f411294506816fe8b024 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Tue, 16 Jan 2018 11:45:09 +0800 Subject: [PATCH 007/265] v1.2.6 --- config.xml | 2 +- package.json | 2 +- src/api/gateways.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.xml b/config.xml index a0c8afea..d1cb74db 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + firefly stellar wallet diff --git a/package.json b/package.json index 0684ac19..f3637d60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "firefly", - "version": "1.2.5", + "version": "1.2.6", "description": "stellar mobile wallet", "author": "", "private": true, diff --git a/src/api/gateways.js b/src/api/gateways.js index 9e9bc400..d35063e2 100644 --- a/src/api/gateways.js +++ b/src/api/gateways.js @@ -3,7 +3,7 @@ import axios from 'axios' export const APP_NAME = 'firefly' //app版本号 -export const APP_VERSION = '1.2.5' +export const APP_VERSION = '1.2.6' export const APP_GITHUB = 'https://github.com/stellarcn/firefly' From 7c9fbc4e60d6ec2b65f87f79fc6a7f1b5ca10e4b Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Tue, 16 Jan 2018 11:59:41 +0800 Subject: [PATCH 008/265] vuex persistence bug fixed --- src/store/index.js | 5 ----- src/store/modules/AccountsStore.js | 2 -- src/store/plugins/persistence.js | 3 --- 3 files changed, 10 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index f8a3b644..a809216f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -122,13 +122,11 @@ const blocks = { 'accountpassword', 'memo', 'accounts.error', - 'accounts.data', 'account.accountData', ], data:{ accounts:{ - data:[], accountData: { seed: null } } } @@ -181,9 +179,6 @@ export const CHANGE_IOSSTATUSBAR_COLOR = 'CHANGE_IOSSTATUSBAR_COLOR' export const ON_PAUSE = 'ON_PAUSE' export const ON_RESUME = 'ON_RESUME' -console.log(module.hot + '----module----') -console.log(module.hot) - if (module.hot) { module.hot.accept([ './modules/AccountsStore', diff --git a/src/store/modules/AccountsStore.js b/src/store/modules/AccountsStore.js index 00b2f891..9abed033 100644 --- a/src/store/modules/AccountsStore.js +++ b/src/store/modules/AccountsStore.js @@ -229,8 +229,6 @@ const mutations = { state.accountData = Object.assign({},BLANK_ACCOUNT) }, CHANGE_ACCOUNT(state, {index, address, password, accountdata}){ - console.log('---mutation CHANGE_ACCOUNT') - // 当前选择的账户信息要调整 state.selected = index state.password = password diff --git a/src/store/plugins/persistence.js b/src/store/plugins/persistence.js index 82fdcb47..b527e613 100644 --- a/src/store/plugins/persistence.js +++ b/src/store/plugins/persistence.js @@ -135,14 +135,11 @@ export default function createPersist ({ merge, expires }) - - console.log('-------replace store---------') store.replaceState( merge(store.state, storage.get()) ) store.subscribe((mutation, state) => { - console.log('------store state------') storage.set(reducer(state, paths, blocks)) }) } From b897fc563466d1524088733b918c1602d24b95a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Wed, 17 Jan 2018 19:17:50 +0800 Subject: [PATCH 009/265] webpack hot error --- build/webpack.dev.conf.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 715c1831..edd2f683 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -34,7 +34,6 @@ module.exports = merge(baseWebpackConfig, { inject: true }), new FriendlyErrorsPlugin(), - new webpack.NamedModulesPlugin(), - new webpack.HotModuleReplacementPlugin() + new webpack.NamedModulesPlugin() ] }) From 99148c272e557b013d20de3d7901990ad387ceb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Wed, 17 Jan 2018 19:18:09 +0800 Subject: [PATCH 010/265] add echarts and stellar-hd-wallet --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index f3637d60..21ad5041 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "cordova-plugin-swift-support": "^3.1.1", "cordova-plugin-whitelist": "1", "cordova-sqlite-storage": "^2.1.2", - "echarts": "^3.8.5", + "echarts": "^4.0.1", "ed25519": "0.0.4", "hammerjs": "^2.0.8", "lodash": "^4.17.4", @@ -46,6 +46,7 @@ "nprogress": "^0.2.0", "raf.js": "^0.0.4", "shvl": "^1.2.0", + "stellar-hd-wallet": "^0.0.4", "swiper": "^4.0.7", "uuid": "^3.1.0", "vue": "^2.5.4", From 4713509b155be8bfb80d5e3a54c286193b518d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Wed, 17 Jan 2018 19:18:40 +0800 Subject: [PATCH 011/265] account info page performance and reset password --- src/components/QRCode.vue | 2 +- src/locales/en.json | 13 ++ src/locales/zh-cn.json | 14 +- src/pages/account/Info.vue | 215 +++++++++++++++++++++++++++-- src/store/modules/AccountsStore.js | 17 ++- 5 files changed, 247 insertions(+), 14 deletions(-) diff --git a/src/components/QRCode.vue b/src/components/QRCode.vue index 9b166676..0eccf679 100644 --- a/src/components/QRCode.vue +++ b/src/components/QRCode.vue @@ -25,7 +25,7 @@ export default { }, size:{ type:Number, - default: 240 + default: 200 }, callback: { type: Function diff --git a/src/locales/en.json b/src/locales/en.json index f12088cc..a8342f9b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -11,6 +11,7 @@ "setPinCodeError": "Pin code mismatch", "ImportAccount":"Import", "CreateAccount":"Create", + "ResetPassword":"reset", "TermsOfServiceTitle":"Terms Of Service", "TermsOfService":"This is a binding Agreement between Muyu Network Technology Co.,Ltd. (\"Muyu\" or \"We\") and the person, persons, or entity (\"You\" or \"Your\") using the service, Software, or application (\"Software\").

RIGHTS AND OBLIGATIONS

Muyu provides the Software solely on the terms and conditions set forth in this Agreement and on the condition that You accept and comply with them. By using the Software You (a) accept this Agreement and agree that You are legally bound by its terms; and (b) represent and warrant that: (i) You are of legal age to enter into a binding agreement; and (ii) if You are a corporation, governmental organization or other legal entity, You have the right, power and authority to enter into this Agreement on behalf of the corporation, governmental organization or other legal entity and bind them to these terms.

This Software functions as a free, open source, and multi-signature digital wallet. The Software does not constitute an account where We or other third parties serve as financial intermediaries or custodians of Your Cryptocurrencies.

While the Software has undergone beta testing and continues to be improved by feedback from the open-source user and developer community, We cannot guarantee there will not be bugs in the Software. You acknowledge that Your use of this Software is at Your own discretion and in compliance with all applicable laws. You are responsible for safekeeping Your passwords, private key pairs, PINs, and any other codes You use to access the Software.

IF YOU LOSE ACCESS TO YOUR WALLET OR YOUR ENCRYPTED PRIVATE KEYS AND YOU HAVE NOT SEPARATELY STORED A BACKUP OF YOUR WALLET AND CORRESPONDING PASSWORD, YOU ACKNOWLEDGE AND AGREE THAT ANY CRYPTOCURRENCY YOU HAVE ASSOCIATED WITH THAT WALLET WILL BECOME INACCESSIBLE. All transaction requests are irreversible. The authors of the Software, employees and affiliates of Muyu, copyright holders, and Muyu, Ltd. cannot retrieve Your private keys or passwords if You lose or forget them and cannot guarantee transaction confirmation as they do not have control over the Cryptocurrency network system.

DISCLAIMER

THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OF THE SOFTWARE, EMPLOYEES AND AFFILIATES OF MUYU, COPYRIGHT HOLDERS, OR MUYU, LTD. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

IN NO EVENT WILL MUYU OR ITS AFFILIATES, OR ANY OF ITS OR THEIR RESPECTIVE SERVICE PROVIDERS, BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY USE, INTERRUPTION, DELAY OR INABILITY TO USE THE SOFTWARE, LOST REVENUES OR PROFITS, DELAYS, INTERRUPTION OR LOSS OF SERVICES, BUSINESS OR GOODWILL, LOSS OR CORRUPTION OF DATA, LOSS RESULTING FROM SYSTEM OR SYSTEM SERVICE FAILURE, MALFUNCTION OR SHUTDOWN, FAILURE TO ACCURATELY TRANSFER, READ OR TRANSMIT INFORMATION, FAILURE TO UPDATE OR PROVIDE CORRECT INFORMATION, SYSTEM INCOMPATIBILITY OR PROVISION OF INCORRECT COMPATIBILITY INFORMATION OR BREACHES IN SYSTEM SECURITY, OR FOR ANY CONSEQUENTIAL, INCIDENTAL, INDIRECT, EXEMPLARY, SPECIAL OR PUNITIVE DAMAGES, WHETHER ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT, BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE, REGARDLESS OF WHETHER SUCH DAMAGES WERE FORESEEABLE AND WHETHER OR NOT WE WERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

INTELLECTUAL PROPERTY

We retain all right, title, and interest in and to the Content and all of Muyu’s brands, logos, and trademarks, including, but not limited to, Muyu, Ltd., Muyu, Firefly Wallet – One Wallet For All Coins, Firefly Wallet, Firefly App, Firefly Wallet App, and variations of the wording of the aforementioned brands, logos, and trademarks.

CHOICE OF LAW

This Agreement, and its application and interpretation, shall be governed exclusively by the laws of The People's Republic of China, without regard to its conflict of law rules. You consent to the exclusive jurisdiction of the courts located in or near Shanghai, China for any dispute arising under this Agreement.

SEVERABILITY

In the event any court shall declare any section or sections of this Agreement invalid or void, such declaration shall not invalidate the entire Agreement and all other paragraphs of the Agreement shall remain in full force and effect.

BINDING AGREEMENT

The terms and provisions of this Agreement are binding upon Your heirs, successors, assigns, and other representatives. This Agreement may be executed in counterparts, each of which shall be considered to be an original, but both of which constitute the same Agreement.

You assume any and all risks associated with the use of the Software. We reserve the right to modify this Agreement from time to time.

", @@ -140,6 +141,14 @@ "Account.NameCard":"name card", "Account.WhetherCoverAccount": "whether cover the account", "Account.NetworkError":"network error", + "Account.OriginPassword":"original password", + "Account.NewPassword":"new password", + "Account.RePassword":"retype new password", + "Account.PasswordNotNull":"password is empty", + "Account.PasswordNotSame":"two passwords is not the same", + "Account.PasswordResetSuccess":"reset password successed", + "Account.PasswordResetFail":"reset password failed", + "Error.NotEnoughAssetToFundAccount":"send more than 20 XLM to fund the target", "Error.NotEnoughAsset":"asset funding insufficient", @@ -253,6 +262,10 @@ "App.ClickOneMoreTimeExit":"click one more time to exit!", + + "Q.DeleteAccount":"will delete the account, please confirm ?", + "Q.ResetPassword":"will reset the password, please confirm ?", + "op_success":"operation success", "op_malformed":"opernation incorrect", diff --git a/src/locales/zh-cn.json b/src/locales/zh-cn.json index fa72894e..74eafc46 100644 --- a/src/locales/zh-cn.json +++ b/src/locales/zh-cn.json @@ -11,6 +11,7 @@ "setPinCodeError": "两次Pin码不相同", "ImportAccount":"导入账户", "CreateAccount":"创建账户", + "ResetPassword":"重置密码", "TermsOfServiceTitle":"服务条款", @@ -45,6 +46,7 @@ "Account.CreateAccountReadyHint":"以上为账户重要信息,遗失后无法找回并造成钱包内资产遗失。请勿与他人分享,妥善保管并备份!", "Account.CreateAccountSuccess":"账户创建成功!", "Account.CreateAccountError":"账户创建失败!", + "Account.AccountAddress":"账户地址", @@ -135,6 +137,15 @@ "Account.NameCard":"名片", "Account.WhetherCoverAccount": "是否覆盖账户", "Account.NetworkError":"网络错误", + "Account.OriginPassword":"原密码", + "Account.NewPassword":"新密码", + "Account.RePassword":"再输一次新密码", + "Account.PasswordNotNull":"密码不能为空!", + "Account.PasswordNotSame":"两次密码不相同!", + "Account.PasswordResetSuccess":"密码重置成功!", + "Account.PasswordResetFail":"密码重置失败!", + + "Error.NotEnoughAssetToFundAccount":"发送XLM必须大于20才可以激活账户", "Error.NotEnoughAsset":"资产不足", @@ -244,7 +255,8 @@ "App.ClickOneMoreTimeExit":"再点击一次退出!", - + "Q.DeleteAccount":"您确认删除该账户么?", + "Q.ResetPassword":"您确认重置密码么?", "op_success":"操作成功", "op_malformed":"操作格式不正确", diff --git a/src/pages/account/Info.vue b/src/pages/account/Info.vue index 3e0f7fed..4508be12 100644 --- a/src/pages/account/Info.vue +++ b/src/pages/account/Info.vue @@ -32,12 +32,14 @@ visibility_off -
{{$t('FederationAddress')}}
-
{{showaccount.federationAddress}} 
-
{{$t('InflationAddress')}}
-
{{showaccount.inflationAddress}} 
+
{{$t('FederationAddress')}}
+
{{showaccount.federationAddress}} 
+
{{$t('InflationAddress')}}
+
+ {{inflationPoolSite}} +
-
+
@@ -47,17 +49,21 @@ - @@ -91,6 +159,12 @@ import QRCode from '../../components/QRCode' import Card from '../../components/Card' import { exportNameCard,exportAccount } from '../../api/qr' import {readAccountData} from '@/api/storage' +import { INFLATION_POOL } from '@/api/gateways' + +const ACTION_DEL = 'delete'; +const ACTION_RESET_PASSWORD = 'resetpassword'; +const QUESTION_DELETE_ACCOUNT = 'Q.DeleteAccount'; +const QUESTION_RESET_PASSWORD = 'Q.ResetPassword'; export default { data(){ @@ -107,6 +181,20 @@ export default { inpassword:null, pwdvisible:false, seed:null, + + + action: null, + dlgshow: false, + dlgtitle:"", + + showResetPwdSheet: false,//显示重置密码窗口 + inpassword1: null, + pwd1visible: false, + inpassword2: null, + pwd2visible: false, + inpassword3: null, + pwd3visible: false, + } }, computed:{ @@ -141,6 +229,16 @@ export default { return '********' }, + inflationPoolSite(){ + let address = this.showaccount.inflationAddress + if(!address)return ''; + for(var i=0,n=INFLATION_POOL.length; i{ + this.$toasted.show(this.$t('Account.PasswordResetSuccess')); + this.showResetPwdSheet = false; + this.inpassword1 = null; + this.inpassword2 = null; + this.inpassword3 = null; + }) + .catch(error=>{ + console.log(error) + this.$toasted.error(this.$t('Account.PasswordResetFail')); + }) + + }, canclePwdInput(){ this.showPwdSheet = false this.inpassword = null @@ -248,6 +418,14 @@ export default { }, + cancleResetPwdInput(){ + this.showResetPwdSheet = false + }, + + okResetPwdInput(){ + this.doResetPwd() + }, + }, components: { Toolbar, @@ -264,6 +442,8 @@ export default { background: $primarycolor.gray .content padding: 10px 10px + height: 100% + overflow-y:auto .card-content .label @@ -273,7 +453,7 @@ export default { padding-bottom: 2px .value display: block - font-size: 16px + font-size: 14px color: $primarycolor.font width: 100% white-space:normal @@ -296,10 +476,13 @@ export default { background: $primarycolor.gray height:36px line-height:36px - font-size:16px + font-size:14px margin-top: 10px text-align:center - color:$primarycolor.green + &.active + color:$primarycolor.green + &.unactive + color: $secondarycolor.font .btn-available color:$primarycolor.green .btn-unavailable @@ -337,6 +520,8 @@ export default { bottom: 0 right: 0 left: 0 + &.rePwdSheetWrapper + height: 320px .sheet-content padding: 10px 10px .sheet-btns @@ -347,6 +532,14 @@ export default { .sheet-btn flex: 1 text-align: center +.dlg-content + font-size: 14px +.stitle + text-align: center + font-size: 16px + height: 32px + line-height: 32px + padding-top: 10px diff --git a/src/store/modules/AccountsStore.js b/src/store/modules/AccountsStore.js index 9abed033..3964b9f5 100644 --- a/src/store/modules/AccountsStore.js +++ b/src/store/modules/AccountsStore.js @@ -126,6 +126,15 @@ const actions = { commit(LOAD_ACCOUNTS, accounts) // dispatch('cleanAccount') }, + /** + * 重置账户密码 + */ + async resetAccountPwd({dispatch, commit, state}, {index, account, password, newpassword}){ + let address = account.address + let data = await readAccountData(address,password) + await saveAccountData(address,data,newpassword) + commit(RESET_PASSWORD, {index, newpassword}) + }, // 删除账户 async deleteAccount({dispatch, commit, state}, {index, account}){ let statedata = [...state.data] @@ -285,6 +294,11 @@ const mutations = { console.log('-------------------------state ORDERBOOK_STREAM_HANDLER') console.log(data) }, + RESET_PASSWORD(state,{index,newpassword}){ + if(index === state.selected){ + state.password = newpassword; + } + }, } @@ -305,4 +319,5 @@ export const SELECT_TRADE_PAIR = 'SELECT_TRADE_PAIR' export const QUERY_ORDERBOOK = 'QUERY_ORDERBOOK' export const QUERY_MY_OFFERS = 'QUERY_MY_OFFERS' export const ORDERBOOK_STREAM_HANDLER = 'ORDERBOOK_STREAM_HANDLER' -export const CONTACT_ID_INCREMENT = 'CONTACT_ID_INCREMENT' \ No newline at end of file +export const CONTACT_ID_INCREMENT = 'CONTACT_ID_INCREMENT' +export const RESET_PASSWORD = 'RESET_PASSWORD' \ No newline at end of file From 6daa3b1a66b07cb92682941f862ffccf04ade962 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Thu, 18 Jan 2018 01:04:39 +0800 Subject: [PATCH 012/265] fix a bug: memo_type set to blank after modifying the contact --- src/pages/contacts/ModifyContact.vue | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pages/contacts/ModifyContact.vue b/src/pages/contacts/ModifyContact.vue index 15866ad6..fc41386c 100644 --- a/src/pages/contacts/ModifyContact.vue +++ b/src/pages/contacts/ModifyContact.vue @@ -95,8 +95,7 @@ export default { address: '', memotype: '', memo: '', - memorequired: false, - memotype_real: '' + memorequired: false } }, computed:{ @@ -129,24 +128,21 @@ export default { }, onMemoTypeInput () { if(this.memotype === 'None'){ - this.memotype_real = '' this.memo = '' this.memorequired = false }else{ - this.memotype_real = this.memotype this.memorequired = true } }, modifyContact() { - //Todo: 这里好像有个 bug,修改账户的时候 memo_type 会被置空 //let length = this.accountData.contacts.length - let contact_temp = {name: this.name, address: this.address, memotype: this.memotype_real, memo: this.memo} - let hash_temp = loseCode(this.address + this.memotype_real + this.memo) + let contact_temp = {name: this.name, address: this.address, memotype: this.memotype, memo: this.memo} + let hash_temp = loseCode(this.name + this.address + this.memotype + this.memo) if (hash_temp === this.contact.hash) { this.$toasted.error(this.$t('Error.ContactExist')) return } - if(contact_temp.memotype !== '' && contact_temp.memotype != 'None' && !isValidMemo(contact_temp.memotype, contact_temp.memo)) { + if(contact_temp.memotype !== 'None' && !isValidMemo(contact_temp.memotype, contact_temp.memo)) { this.$toasted.error(this.$t('Error.MemoIsInvalid')) return } @@ -192,4 +188,3 @@ export default { .modify background-color #21ce90 !important - From 8927da15ac1c8191274659efc73e5385e6cef68a Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Tue, 16 Jan 2018 12:14:42 +0800 Subject: [PATCH 013/265] readme --- README-CN.md | 5 ++++- README.md | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README-CN.md b/README-CN.md index b87da895..1db16c58 100644 --- a/README-CN.md +++ b/README-CN.md @@ -2,10 +2,13 @@ 萤火钱包是[恒星网络](https://stellar.org)的手机钱包,支持安卓和IOS平台 + +## [English Document](README.md) + ## [帮助文档](https://wallet.fchain.io/manual/#0) -## [路线图](https://github.com/StellarCN/firefly/blob/master/docs/ROADMAP_CN.MD) +## [路线图](docs/ROADMAP_CN.MD) ## 主要功能: * 多账户 diff --git a/README.md b/README.md index 02137029..983c8c2b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ # firefly wallet [![Build Status](https://travis-ci.org/StellarCN/firefly.svg)](https://travis-ci.org/StellarCN/firefly) + firefly is a mobile wallet for [Stellar](https://stellar.org) network. It supports android and ios platforms + +## [中文文档](README-CN.md) + ## [Help Document](https://wallet.fchain.io/manual/#0) -## [RoadMap](https://github.com/StellarCN/firefly/blob/master/docs/ROADMAP.MD) +## [RoadMap](docs/ROADMAP.MD) ## Main features: * Accounts From cf99ef41f1d8e2c77136cc8c8f3fac8aa380b319 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Thu, 18 Jan 2018 10:43:46 +0800 Subject: [PATCH 014/265] yarn lock config file --- yarn.lock | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/yarn.lock b/yarn.lock index a40483a7..d5515697 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1022,6 +1022,16 @@ bindings@^1.2.1: version "1.3.0" resolved "http://registry.npm.taobao.org/bindings/download/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7" +bip39@^2.4.0, bip39@^2.5.0: + version "2.5.0" + resolved "http://registry.npm.taobao.org/bip39/download/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235" + dependencies: + create-hash "^1.1.0" + pbkdf2 "^3.0.9" + randombytes "^2.0.1" + safe-buffer "^5.0.1" + unorm "^1.3.3" + bl@~0.9.0: version "0.9.5" resolved "http://registry.npm.taobao.org/bl/download/bl-0.9.5.tgz#c06b797af085ea00bc527afc8efcf11de2232054" @@ -2079,7 +2089,7 @@ create-hash@^1.1.0, create-hash@^1.1.2: ripemd160 "^2.0.0" sha.js "^2.4.0" -create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: +create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4, create-hmac@^1.1.6: version "1.1.6" resolved "http://registry.npm.taobao.org/create-hmac/download/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06" dependencies: @@ -2481,11 +2491,19 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -echarts@^3.8.5: - version "3.8.5" - resolved "http://registry.npm.taobao.org/echarts/download/echarts-3.8.5.tgz#58e4a51d2743c6fb75257b0dc0a9cf9f5378ac0e" +echarts@^4.0.1: + version "4.0.1" + resolved "http://registry.npm.taobao.org/echarts/download/echarts-4.0.1.tgz#59dbf1099acd299c1d221208eb9d41ae25f755f8" + dependencies: + zrender "4.0.0" + +ed25519-hd-key@^0.5.0: + version "0.5.0" + resolved "http://registry.npm.taobao.org/ed25519-hd-key/download/ed25519-hd-key-0.5.0.tgz#24893bb29c96351538eccce7f36347891025193d" dependencies: - zrender "3.7.4" + bip39 "^2.4.0" + create-hmac "^1.1.6" + js-nacl "^1.2.2" ed25519@0.0.4: version "0.0.4" @@ -3886,6 +3904,10 @@ js-base64@^2.1.9, js-base64@^2.3.2: version "2.4.0" resolved "http://registry.npm.taobao.org/js-base64/download/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa" +js-nacl@^1.2.2: + version "1.2.2" + resolved "http://registry.npm.taobao.org/js-nacl/download/js-nacl-1.2.2.tgz#c4633dbfa67dc62f6b73033e5118e564e5abb987" + js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "http://registry.npm.taobao.org/js-tokens/download/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" @@ -5305,7 +5327,7 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" -pbkdf2@^3.0.3: +pbkdf2@^3.0.3, pbkdf2@^3.0.9: version "3.0.14" resolved "http://registry.npm.taobao.org/pbkdf2/download/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade" dependencies: @@ -6748,6 +6770,14 @@ stellar-base@^0.7.6: optionalDependencies: ed25519 "0.0.4" +stellar-hd-wallet@^0.0.4: + version "0.0.4" + resolved "http://registry.npm.taobao.org/stellar-hd-wallet/download/stellar-hd-wallet-0.0.4.tgz#e4f251031ec2a6caa81d45eb520b3349a027ca77" + dependencies: + bip39 "^2.5.0" + ed25519-hd-key "^0.5.0" + stellar-base "^0.7.6" + stellar-sdk@^0.8.0: version "0.8.0" resolved "http://registry.npm.taobao.org/stellar-sdk/download/stellar-sdk-0.8.0.tgz#8a9f251896bb9bf435b50893323d2294a47d0023" @@ -7777,6 +7807,6 @@ yargs@~3.10.0: decamelize "^1.0.0" window-size "0.1.0" -zrender@3.7.4: - version "3.7.4" - resolved "http://registry.npm.taobao.org/zrender/download/zrender-3.7.4.tgz#f847d53948481ef6d42906d1ea9aeec7acbefdf2" +zrender@4.0.0: + version "4.0.0" + resolved "http://registry.npm.taobao.org/zrender/download/zrender-4.0.0.tgz#908935151329fa95145a333d186edd4011cf86c5" From 7b62d5cd6167da7131c76a34511c6c29093ca1a4 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Thu, 18 Jan 2018 10:44:11 +0800 Subject: [PATCH 015/265] vuex store persitence bug --- src/store/plugins/persistence.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/store/plugins/persistence.js b/src/store/plugins/persistence.js index b527e613..3c13ab5d 100644 --- a/src/store/plugins/persistence.js +++ b/src/store/plugins/persistence.js @@ -135,6 +135,7 @@ export default function createPersist ({ merge, expires }) + console.log(`------ --replace------- `) store.replaceState( merge(store.state, storage.get()) ) @@ -158,14 +159,15 @@ function defaultReducer (state, paths, blocks) { } return substate }, {}) + let prostate = Object.assign({} , newstate) //去掉不需要保存的数据 if(blocks && blocks.keys && blocks.keys.length > 0 ){ for(var i=0,n=blocks.keys.length; i Date: Thu, 18 Jan 2018 11:43:41 +0800 Subject: [PATCH 016/265] svg height missing bug --- src/pages/CreateAccountReady.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pages/CreateAccountReady.vue b/src/pages/CreateAccountReady.vue index 9560dc81..2b891b3a 100644 --- a/src/pages/CreateAccountReady.vue +++ b/src/pages/CreateAccountReady.vue @@ -47,7 +47,7 @@ - +

{{$t("Attention")}}

@@ -60,7 +60,7 @@
- +

{{$t("Attention")}}

@@ -72,9 +72,9 @@
- + - +

{{$t("Congrats")}}

@@ -305,9 +305,13 @@ export default { .stepper-content display flex flex-direction column +.guide-img-wrapper + height: 150px + width: 100% .guide-img - height 150px - max-width 320px + height:150px + max-width:320px + min-height: 150px .guide-header box-shadow 0 0 0 0 From 8ee2fa493c3d2be8e487dde4712e4ac1c99005b3 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Thu, 18 Jan 2018 18:10:31 +0800 Subject: [PATCH 017/265] remove stellar-hd-wallet --- package.json | 1 - yarn.lock | 34 ++-------------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 21ad5041..f6b5d73d 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ "nprogress": "^0.2.0", "raf.js": "^0.0.4", "shvl": "^1.2.0", - "stellar-hd-wallet": "^0.0.4", "swiper": "^4.0.7", "uuid": "^3.1.0", "vue": "^2.5.4", diff --git a/yarn.lock b/yarn.lock index d5515697..73cd494f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1022,16 +1022,6 @@ bindings@^1.2.1: version "1.3.0" resolved "http://registry.npm.taobao.org/bindings/download/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7" -bip39@^2.4.0, bip39@^2.5.0: - version "2.5.0" - resolved "http://registry.npm.taobao.org/bip39/download/bip39-2.5.0.tgz#51cbd5179460504a63ea3c000db3f787ca051235" - dependencies: - create-hash "^1.1.0" - pbkdf2 "^3.0.9" - randombytes "^2.0.1" - safe-buffer "^5.0.1" - unorm "^1.3.3" - bl@~0.9.0: version "0.9.5" resolved "http://registry.npm.taobao.org/bl/download/bl-0.9.5.tgz#c06b797af085ea00bc527afc8efcf11de2232054" @@ -2089,7 +2079,7 @@ create-hash@^1.1.0, create-hash@^1.1.2: ripemd160 "^2.0.0" sha.js "^2.4.0" -create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4, create-hmac@^1.1.6: +create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: version "1.1.6" resolved "http://registry.npm.taobao.org/create-hmac/download/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06" dependencies: @@ -2497,14 +2487,6 @@ echarts@^4.0.1: dependencies: zrender "4.0.0" -ed25519-hd-key@^0.5.0: - version "0.5.0" - resolved "http://registry.npm.taobao.org/ed25519-hd-key/download/ed25519-hd-key-0.5.0.tgz#24893bb29c96351538eccce7f36347891025193d" - dependencies: - bip39 "^2.4.0" - create-hmac "^1.1.6" - js-nacl "^1.2.2" - ed25519@0.0.4: version "0.0.4" resolved "http://registry.npm.taobao.org/ed25519/download/ed25519-0.0.4.tgz#e56218ace2fc903d259593aef0b2a9639f475beb" @@ -3904,10 +3886,6 @@ js-base64@^2.1.9, js-base64@^2.3.2: version "2.4.0" resolved "http://registry.npm.taobao.org/js-base64/download/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa" -js-nacl@^1.2.2: - version "1.2.2" - resolved "http://registry.npm.taobao.org/js-nacl/download/js-nacl-1.2.2.tgz#c4633dbfa67dc62f6b73033e5118e564e5abb987" - js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "http://registry.npm.taobao.org/js-tokens/download/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" @@ -5327,7 +5305,7 @@ path-type@^3.0.0: dependencies: pify "^3.0.0" -pbkdf2@^3.0.3, pbkdf2@^3.0.9: +pbkdf2@^3.0.3: version "3.0.14" resolved "http://registry.npm.taobao.org/pbkdf2/download/pbkdf2-3.0.14.tgz#a35e13c64799b06ce15320f459c230e68e73bade" dependencies: @@ -6770,14 +6748,6 @@ stellar-base@^0.7.6: optionalDependencies: ed25519 "0.0.4" -stellar-hd-wallet@^0.0.4: - version "0.0.4" - resolved "http://registry.npm.taobao.org/stellar-hd-wallet/download/stellar-hd-wallet-0.0.4.tgz#e4f251031ec2a6caa81d45eb520b3349a027ca77" - dependencies: - bip39 "^2.5.0" - ed25519-hd-key "^0.5.0" - stellar-base "^0.7.6" - stellar-sdk@^0.8.0: version "0.8.0" resolved "http://registry.npm.taobao.org/stellar-sdk/download/stellar-sdk-0.8.0.tgz#8a9f251896bb9bf435b50893323d2294a47d0023" From a4e895f4d8af2b8acfd42e175c87faff3ecb8a00 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Thu, 18 Jan 2018 18:10:57 +0800 Subject: [PATCH 018/265] payments stream --- src/api/payments.js | 15 ++++++++++++--- src/streams/index.js | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/api/payments.js b/src/api/payments.js index 45b14581..a55fafec 100644 --- a/src/api/payments.js +++ b/src/api/payments.js @@ -15,7 +15,7 @@ export function convertRecords(address,rows){ var data = []; for(var i=0,n=rows.length;i { handler(res); + }, + onerror: err => { + if(errfn){ + errfn(err) + } } }); diff --git a/src/streams/index.js b/src/streams/index.js index bd714814..081d7acb 100644 --- a/src/streams/index.js +++ b/src/streams/index.js @@ -30,10 +30,18 @@ export function initStreams(address){ export function initPaymentStream(){ closePaymentStream() - _data.store.commit('CLEAN_PAYMENTS') + //_data.store.commit('CLEAN_PAYMENTS') + let paymentsdata = _data.store.state.account.payments.records + let token = null + if(paymentsdata && paymentsdata.length > 0 ){ + token = paymentsdata[0].paging_token + } listenPaymentStream(_data.address, (data)=>{ _data.store.dispatch('paymentSteamData',[data]) - }) + },err => { + console.log(`----payments err -- `) + console.log(err) + }, { token }) } export function closeStreams(){ From 9336a1397ab026e987a124633cd02d221c38d30f Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Thu, 18 Jan 2018 18:11:53 +0800 Subject: [PATCH 019/265] trade error code --- src/pages/trade/Trade.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pages/trade/Trade.vue b/src/pages/trade/Trade.vue index a7e1a72a..937777f3 100644 --- a/src/pages/trade/Trade.vue +++ b/src/pages/trade/Trade.vue @@ -162,6 +162,7 @@ import { myofferConvert } from '@/api/offer' import { offer as doOffer } from '@/api/offer' import OrderBook from '@/components/OrderBook' import { DEFAULT_INTERVAL } from '@/api/gateways' +import { getXdrResultCode } from '@/api/xdr' export default { data(){ return { @@ -583,6 +584,7 @@ export default { this.$toasted.error(this.$t('Error.NoPassword')) return } + if(this.working)return this.working = true this.submitting = true @@ -606,11 +608,15 @@ export default { }) .catch(err=>{ console.log(err) - this.submitting = false - this.submitFail = true - this.clean() - this.hideLoading() - this.$toasted.error(this.$t('Error.OfferFailed')) + this.submitting = false; + this.submitFail = true; + this.clean(); + this.hideLoading(); + this.$toasted.error(this.$t('Error.OfferFailed')); + let errcode = getXdrResultCode(err); + if(errcode){ + this.$toasted.error(this.$t(errcode)); + } }) }, From 717b44ce3950ec05d127e611ea96c1b0c06e5c09 Mon Sep 17 00:00:00 2001 From: mazhaoyong Date: Thu, 18 Jan 2018 18:12:24 +0800 Subject: [PATCH 020/265] orderbook number format bigger than 100000 --- src/components/OrderBook.vue | 20 ++++++++++---------- src/filters/index.js | 8 ++++++++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/OrderBook.vue b/src/components/OrderBook.vue index bd6fa691..f33a01f9 100644 --- a/src/components/OrderBook.vue +++ b/src/components/OrderBook.vue @@ -32,9 +32,9 @@ @click.stop="chooseItem('buy',item)" >
{{item.price}}
-
{{item.amount}}
-
{{item.num}}
-
{{item.depth}}
+
{{item.amount | KNumber }}
+
{{item.num | KNumber}}
+
{{item.depth | KNumber}}
@@ -51,9 +51,9 @@ @click.stop="chooseItem('sell',item)" >
{{item.price}}
-
{{item.amount}}
-
{{item.num}}
-
{{item.depth}}
+
{{item.amount | KNumber}}
+
{{item.num | KNumber}}
+
{{item.depth | KNumber}}
@@ -66,10 +66,10 @@
{{Number(item.price.toFixed(4))}}
-
+{{Number(item.base.toFixed(4))}}
-
-{{Number(item.amount.toFixed(4))}}
-
-{{Number(item.amount.toFixed(4))}}
-
+{{Number(item.base.toFixed(4))}}
+
+{{Number(item.base.toFixed(4)) | KNumber}}
+
-{{Number(item.amount.toFixed(4)) | KNumber}}
+
-{{Number(item.amount.toFixed(4)) | KNumber}}
+
+{{Number(item.base.toFixed(4)) | KNumber}}
{{$t('Trade.Cancel')}} diff --git a/src/filters/index.js b/src/filters/index.js index 780511c5..d11a6604 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -5,3 +5,11 @@ Vue.filter('shortaddress', shortAddress) Vue.filter('miniaddress', miniAddress) +//数字如果超过100000,则显示为100K +Vue.filter('KNumber', function(value){ + let val = Number(value) + if(val > 100000){ + return (val / 1000).toFixed(0) + 'K'; + } + return value; +}) \ No newline at end of file From 61b65649f1d0c8589493dc781ff6c35a4744fc62 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Fri, 19 Jan 2018 07:12:20 +0800 Subject: [PATCH 021/265] show the name of the contact and hidden `Add Contact` button if the contact exists --- src/locales/en.json | 2 ++ src/locales/zh-cn.json | 2 ++ src/pages/Transaction.vue | 27 ++++++++++++++------------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index a8342f9b..936723e1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -237,6 +237,8 @@ "MyAddress.DuplicateAddress":"address is not unique", "MyAddress.DeleteSuccess":"delete success", "MyAddress.DeleteFail":"delete failed", + + "Transaction.ContactName": "Name", "ContactBook.Title": "Contact Book", diff --git a/src/locales/zh-cn.json b/src/locales/zh-cn.json index 74eafc46..0715be7a 100644 --- a/src/locales/zh-cn.json +++ b/src/locales/zh-cn.json @@ -232,6 +232,8 @@ "MyAddress.DeleteSuccess":"地址删除成功", "MyAddress.DeleteFail":"地址删除失败", + "Transaction.ContactName": "名称", + "ContactBook.Title": "通讯录", diff --git a/src/pages/Transaction.vue b/src/pages/Transaction.vue index 1fc1d10f..870db59c 100644 --- a/src/pages/Transaction.vue +++ b/src/pages/Transaction.vue @@ -1,8 +1,8 @@ //交易记录 diff --git a/src/components/HistoryTrade.vue b/src/components/HistoryTrade.vue new file mode 100644 index 00000000..b7b78449 --- /dev/null +++ b/src/components/HistoryTrade.vue @@ -0,0 +1,7 @@ +/** +* 历史页面 +* 交易记录 +*/ + diff --git a/src/components/HistoryTransaction.vue b/src/components/HistoryTransaction.vue new file mode 100644 index 00000000..208888b5 --- /dev/null +++ b/src/components/HistoryTransaction.vue @@ -0,0 +1,199 @@ + + + + + + diff --git a/src/components/Toolbar.vue b/src/components/Toolbar.vue index 0bf81e8b..70d45add 100644 --- a/src/components/Toolbar.vue +++ b/src/components/Toolbar.vue @@ -3,11 +3,11 @@ */ @@ -37,7 +37,11 @@ address: state => state.accounts.selectedAccount.address, iosstatusbarcolor: state => state.iosstatusbarcolor, accounts: state => state.accounts.data, - }) + }), + showTabBar: function () { + let hidePathName = ['Index', 'Wallet', 'TermsOfService', 'ImportAccount', 'CreateAccount', 'CreateAccountReady'] + return !hidePathName.includes(this.$route.name) + } }, beforeMount(){ Vue.cordova.on('deviceready', () => { @@ -91,7 +95,7 @@ console.log('read accounts') console.log(data) navigator.splashscreen.hide(); - + //尝试加载当前账户信息 try{ if(this.address){ @@ -119,7 +123,7 @@ // 跳转到错误界面 //this.$toasted.error(err._message) navigator.splashscreen.hide() - + initStorage().then(()=>{ console.log('---init storage ok---') this.saveAppSetting({locale: this.devicelang}) @@ -129,13 +133,13 @@ this.saveAppSetting({locale: this.devicelang}) }) //保存默认的设置数据 - + this.$router.push('/wallet') }); - - + + }) From 35346e6dc606cf90bf6fb65413b63ff7cd25bade Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Tue, 23 Jan 2018 19:36:28 +0800 Subject: [PATCH 035/265] number format bug --- src/api/offer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/offer.js b/src/api/offer.js index 830b207e..812555d3 100644 --- a/src/api/offer.js +++ b/src/api/offer.js @@ -125,7 +125,7 @@ export function myofferConvert(_sellasset,_buyasset,my){ obj = Object.assign({}, ele, {type: 'sell'}) obj.amount = Number(obj.amount) obj.price = Number(obj.price) - obj.base = NP.round(Number((obj.amount * obj.price), 7)) + obj.base = NP.round(Number(obj.amount * obj.price), 7) data.push(obj) }else if( codeandissuer_sb === codeandissuer_bs_target && codeandissuer_bs === codeandissuer_sb_target @@ -135,7 +135,7 @@ export function myofferConvert(_sellasset,_buyasset,my){ obj = Object.assign({}, ele, {type: 'buy'}) obj.amount = Number(obj.amount) obj.price = Number(obj.price) - obj.base = NP.round(Number((obj.amount * obj.price_r.n / obj.price_r.d), 7)) + obj.base = NP.round(Number(obj.amount * obj.price_r.n / obj.price_r.d), 7) obj.price = Number(NP.round((1 / obj.price), 4)) data.push(obj) } From d801149f9721abf83cd3d326f7151eb2388460b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Tue, 23 Jan 2018 19:41:28 +0800 Subject: [PATCH 036/265] show contact name on send asset page --- src/pages/asset/SendAsset.vue | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/pages/asset/SendAsset.vue b/src/pages/asset/SendAsset.vue index 95930d79..e6cd39cf 100644 --- a/src/pages/asset/SendAsset.vue +++ b/src/pages/asset/SendAsset.vue @@ -58,7 +58,7 @@ :suffix="selectedasset.code" required type="text" - :placeholder="(selectedasset.code === 'XLM'? selectedasset.balance - reserve - 0.00001: selectedasset.balance )|| '0'" + :placeholder="(selectedasset.code === 'XLM'? (''+(selectedasset.balance - reserve - 0.00001)): (''+selectedasset.balance) )|| '0'" @input="amountInput" > @@ -88,6 +88,16 @@ {{$t('Working')}} {{realDestination}}
+ + {{$t('Memo')}} @@ -185,6 +195,9 @@ export default { numStep: Number(0.0000001), + iscontact: false, + contactname: null, + } }, computed:{ @@ -326,6 +339,8 @@ export default { if(contact.memo){ this.memo = contact.memo } + this.iscontact = true + this.contactname = contact.name }, selectmemo(type,data){ @@ -434,8 +449,9 @@ export default { }, destinationInput: _.debounce(function(val) {//必须是普通function,不能是箭头函数 - console.log(val+'-----------2---') - console.log(this.destination) + if(this.iscontact){ + this.iscontact = false + } //根据当前用户的输入内容,请求联邦地址,获取对应的实际address,从而获取对应的实际账户地址(暂时不支持提现部分协议) if(val && val.indexOf('*') > 0){ this.fedSearching = true From dcc48d12973b479811b7d92f1e63480ce9762446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Tue, 23 Jan 2018 19:41:55 +0800 Subject: [PATCH 037/265] webpack include ed25519-hk-key --- build/webpack.base.conf.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index 1d1935dc..cb89e19d 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -40,7 +40,9 @@ module.exports = { { test: /\.js$/, loader: 'babel-loader', - exclude: /node_modules\/(?!(ed25519-hd-key)\/).*/, + // exclude: /node_modules\/(?!(ed25519-hd-key)\/).*/, + include: [ path.resolve(__dirname, "node_modules", "ed25519-hd-key")], + exclude: [ path.resolve(__dirname, "node_modules")], }, { test: /\.json$/, From 60702af308a6e467098249352c47a51363ab4fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Tue, 23 Jan 2018 19:42:03 +0800 Subject: [PATCH 038/265] my page --- src/components/TabBar.vue | 2 +- src/pages/CreateAccountReady.vue | 2 +- src/pages/settings/My.vue | 145 +++++++++++++++++++++++++++++++ src/router/index.js | 8 +- src/stylus/app.styl | 28 +++++- 5 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 src/pages/settings/My.vue diff --git a/src/components/TabBar.vue b/src/components/TabBar.vue index 696038f7..4ad75f61 100644 --- a/src/components/TabBar.vue +++ b/src/components/TabBar.vue @@ -17,7 +17,7 @@ export default { { title:'Menu.MyAssets', name: 'MyAsset', path: '/myassets', icon: 'account_balance_wallet' }, { title:'Menu.TradeCenter', name: 'TradeCenter', path: '/tradecenter', icon: 'trending_up' }, { title:'Menu.Funding', name: 'Funding', path: '/funding', icon: 'import_export' }, - { title:'Menu.My', name: 'My', path: '/mysettings', icon: 'account_box' }, + { title:'Menu.My', name: 'My', path: '/my', icon: 'account_box' }, ], active: 0 } diff --git a/src/pages/CreateAccountReady.vue b/src/pages/CreateAccountReady.vue index a46f972e..bf5bb15c 100644 --- a/src/pages/CreateAccountReady.vue +++ b/src/pages/CreateAccountReady.vue @@ -20,7 +20,7 @@
{{$t('SecretKey')}}
{{seed}}
- +
{{$t('Account.CreateAccountReadyHint')}}
diff --git a/src/pages/settings/My.vue b/src/pages/settings/My.vue new file mode 100644 index 00000000..d4d5cd97 --- /dev/null +++ b/src/pages/settings/My.vue @@ -0,0 +1,145 @@ +/* + * 我的,显示界面,即:个人中心 + * @Author: mazhaoyong@gmail.com + * @Date: 2018-01-23 11:14:24 + * @Last Modified by: mazhaoyong@gmail.com + * @Last Modified time: 2018-01-23 19:32:39 + * @License: MIT + */ + + + + + diff --git a/src/router/index.js b/src/router/index.js index f1df1258..b3522044 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -51,8 +51,13 @@ const router = new Router({ path:'/mysettings', name: 'MySettings', component: resolve => require(['../pages/settings/SettingParent.vue'], resolve), - redirect: { name: 'Settings' }, + redirect: { name: 'My' }, children: [ + { + path: '/my', + name: 'My', + component: resolve => require(['../pages/settings/My.vue'], resolve) + }, { path: '/settings', name: 'Settings', @@ -96,6 +101,7 @@ const router = new Router({ component: resolve => require(['../pages/asset/AssetParent.vue'], resolve), redirect: { name: 'MyAssets' }, children: [ + { path: '/myassets', name: 'MyAssets', diff --git a/src/stylus/app.styl b/src/stylus/app.styl index 31246f33..ec18459f 100644 --- a/src/stylus/app.styl +++ b/src/stylus/app.styl @@ -9,4 +9,30 @@ padding-bottom: 60px .right .material-icons - font-size: 24px \ No newline at end of file + font-size: 24px +.flex-row + display: flex + .flex1 + flex: 1 + .flex2 + flex: 2 + .flex3 + flex:3 + .flex4 + flex: 4 + .flex5 + flex: 5 + .flex6 + flex: 6 + .flex7 + flex: 7 + .flex8 + flex: 8 + .flex9 + flex: 9 +.textcenter + text-align: center +.textleft + text-align: left +.textright + text-align: right \ No newline at end of file From 8e62dba9de161b326fca89a0d614bc7d88ec47af Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Wed, 24 Jan 2018 10:49:47 +0800 Subject: [PATCH 039/265] some history page improvements --- src/components/HistoryOffer.vue | 2 +- src/components/HistoryTransaction.vue | 5 ++--- src/components/Toolbar.vue | 3 +-- src/pages/History.vue | 32 +++++++++++++++++---------- src/store/modules/AccountsStore.js | 9 +++++++- 5 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/components/HistoryOffer.vue b/src/components/HistoryOffer.vue index 272577ce..51fce89e 100644 --- a/src/components/HistoryOffer.vue +++ b/src/components/HistoryOffer.vue @@ -79,6 +79,7 @@ ...mapGetters([]), offersData() { let data = [] + if (!this.my) return for (let i = 0; i < this.tradepairs.length; i++) { let aPairData = myofferConvert(this.tradepairs[i].from, this.tradepairs[i].to, this.my) // console.log(aPairData); @@ -98,7 +99,6 @@ clearInterval(this.timeInterval) } }, - mounted() { this.setup() }, diff --git a/src/components/HistoryTransaction.vue b/src/components/HistoryTransaction.vue index 208888b5..4207073e 100644 --- a/src/components/HistoryTransaction.vue +++ b/src/components/HistoryTransaction.vue @@ -4,9 +4,8 @@
- - - + +
{{$t(item.flag)}}
diff --git a/src/components/Toolbar.vue b/src/components/Toolbar.vue index 70d45add..bd0ba11c 100644 --- a/src/components/Toolbar.vue +++ b/src/components/Toolbar.vue @@ -142,8 +142,7 @@ export default { { title: 'Menu.MyAssets', path:{name:'MyAssets'}, icon: "account_balance_wallet" }, { title: 'Menu.TradeCenter', path:{name:'TradeCenter'}, icon: "trending_up" }, { title: 'Menu.Funding', path:{name:'Funding'}, icon: "import_export" }, - // TODO: 图标待定 - { title: 'Menu.History', path:{name:'History'}, icon: "bookmark" }, + { title: 'Menu.History', path:{name:'History'}, icon: "history" }, ], WalletSettings: [ { title: 'Menu.MyAddress', path:{name:'MyAddress'}, icon: "bookmark" }, diff --git a/src/pages/History.vue b/src/pages/History.vue index 05a5ff7c..e9f2f5f6 100644 --- a/src/pages/History.vue +++ b/src/pages/History.vue @@ -27,6 +27,8 @@ - From df2f8ec5fc721cb030f1c70ca05425bf13c6816a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Thu, 25 Jan 2018 22:00:13 +0800 Subject: [PATCH 043/265] get asset bug --- src/api/assets.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/api/assets.js b/src/api/assets.js index 3a37e277..6fa80b4b 100644 --- a/src/api/assets.js +++ b/src/api/assets.js @@ -7,7 +7,14 @@ export function getAsset(code, issuer) { issuer = code.issuer; code = code.code; } - return code == 'XLM' ? new StellarSdk.Asset.native() : new StellarSdk.Asset(code, issuer); + console.log(`---code=${code},issuer:${issuer}`) + console.log(!issuer || issuer === 'stellar.org') + console.log(code === 'XLM') + if(!issuer || issuer === 'stellar.org'){ + if(code === 'XLM')return new StellarSdk.Asset.native(); + }else{ + return new StellarSdk.Asset(code, issuer); + } } export const ALL_HOSTS_URL = 'https://api.fchain.io/asset_host' From 01660e8ea859b74c4567c89d7be024a878ef0cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=85=86=E6=B0=B8?= Date: Thu, 25 Jan 2018 22:00:32 +0800 Subject: [PATCH 044/265] trade kgraph --- src/api/tradeAggregation.js | 45 +++-- src/components/K.vue | 319 +++++++++++++++++++++++++++++++ src/pages/settings/My.vue | 7 +- src/store/index.js | 4 +- src/store/modules/tradesStore.js | 33 ++++ 5 files changed, 393 insertions(+), 15 deletions(-) create mode 100644 src/components/K.vue create mode 100644 src/store/modules/tradesStore.js diff --git a/src/api/tradeAggregation.js b/src/api/tradeAggregation.js index 748e511c..8af71e41 100644 --- a/src/api/tradeAggregation.js +++ b/src/api/tradeAggregation.js @@ -1,16 +1,30 @@ import StellarSdk from 'stellar-sdk' import {getServer} from './server' +/** + * 获取交易的集合数据 + * @param {Object} base asset + * @param {Object} counter asset + * @param {long} start_time 起始时间 + * @param {long} end_time 截止时间 + * @param {long} resolution 时间间隔 + */ export function getTradeAggregation(base,counter,start_time,end_time,resolution){ return getServer().tradeAggregation(base,counter,start_time,end_time,resolution).call(); } - +/** + * 获取时间区间内每5分钟的成交数据 + * @param {*} base + * @param {*} counter + * @param {*} start_time + * @param {*} end_time + */ export function getTradeAggregation5min(base,counter,start_time,end_time){ return getServer().tradeAggregation(base,counter,start_time,end_time,RESOLUTION_5MIN).call(); } export function getTradeAggregation15min(base,counter,start_time,end_time){ - return getServer().tradeAggregation(base,counter,start_time,end_time,RESOLUTION_5MIN).call(); + return getServer().tradeAggregation(base,counter,start_time,end_time,RESOLUTION_15MIN).call(); } export function getTradeAggregation1hour(base,counter,start_time,end_time){ @@ -28,10 +42,10 @@ export function getTradeAggregation1week(base,counter,start_time,end_time){ //5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000) -export const RESOLUTION_5MIN = 300000 -export const RESOLUTION_15MIN = 900000 -export const RESOLUTION_1HOUR = 3600000 -export const RESOLUTION_1DAY = 86400000 +export const RESOLUTION_5MIN = 300000 +export const RESOLUTION_15MIN = 900000 +export const RESOLUTION_1HOUR = 3600000 +export const RESOLUTION_1DAY = 86400000 export const RESOLUTION_1WEEK = 604800000 // == stream == @@ -41,14 +55,19 @@ var _stream = undefined; // listen on orderbook stream // @param buyAsset: buying asset export function listenTradeAggregationStream(options,handler){ + console.log(`---------list trade aggregation`) + let opt = Object.assign({ resolution: RESOLUTION_5MIN}, options) + console.log(opt) closeTradeAggregationStream(); - _stream = getServer().tradeAggregation( - options.base, - options.counter, - options.start_time, - options.end_time, - options.resolution || RESOLUTION_5MIN - ).stream({ + let builder = getServer().tradeAggregation( + opt.base, + opt.counter, + opt.start_time, + opt.end_time, + opt.resolution + ); + builder.order('asc') + _stream = builder.stream({ onmessage:res=>{ handler(res) } diff --git a/src/components/K.vue b/src/components/K.vue new file mode 100644 index 00000000..62b7c043 --- /dev/null +++ b/src/components/K.vue @@ -0,0 +1,319 @@ +/** + * K线图 + * @Author: mazhaoyong@gmail.com + * @Date: 2018-01-25 11:53:34 + * @Last Modified by: mazhaoyong@gmail.com + * @Last Modified time: 2018-01-25 21:56:07 + * @License: MIT + */ + + + + + diff --git a/src/pages/settings/My.vue b/src/pages/settings/My.vue index d4d5cd97..c87b1788 100644 --- a/src/pages/settings/My.vue +++ b/src/pages/settings/My.vue @@ -3,7 +3,7 @@ * @Author: mazhaoyong@gmail.com * @Date: 2018-01-23 11:14:24 * @Last Modified by: mazhaoyong@gmail.com - * @Last Modified time: 2018-01-23 19:32:39 + * @Last Modified time: 2018-01-25 21:42:15 * @License: MIT */