Skip to content

Commit

Permalink
Merge pull request #80 from ultiledger/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ult-yole authored Aug 16, 2019
2 parents 4c963f6 + dac1313 commit dc669f4
Show file tree
Hide file tree
Showing 17 changed files with 210 additions and 57 deletions.
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"loki-cordova-fs-adapter": "^1.0.2",
"lokijs": "^1.5.5",
"ripple-address-codec": "^2.0.1",
"ripple-lib": "^1.1.2",
"xrpl-tagged-address-codec": "^0.2.0",
"ripple-lib": "^1.2.4",
"stellar-sdk": "^0.11.0",
"vant": "^1.4.3",
"vee-validate": "^2.1.0-beta.11",
Expand Down
5 changes: 4 additions & 1 deletion src/core/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const setAccount = async ({commit, state, dispatch}, account) => {
// account.isActivated = activated;
commit(types.SET_ACCOUNT, JSON.parse(JSON.stringify(account)));
Vue.collecitons.setting.updateSetting(setting => {
return setting.defaultAddress = account.type+account.address;
return setting.defaultAddress = account.address;
});
if (setBalance === false) {
return;
Expand Down Expand Up @@ -154,7 +154,10 @@ export const initData = ({commit, state, dispatch}) => {
let setting = Vue.collecitons.setting.findSetting();
if (setting && setting.defaultAddress) {
let updateSetting = JSON.parse(JSON.stringify(setting));
let mytokenApi = state.setting.mytokenApi;
commit(types.SET_SETTING, updateSetting);
// 修复卡住问题
commit(types.SET_MYTOKEN_API, mytokenApi);
doInitScript(updateSetting, dispatch);
let account = Vue.collecitons.account.findByAddress(setting.defaultAddress);
dispatch('setAccount', account);
Expand Down
2 changes: 2 additions & 0 deletions src/core/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const state = {
{value: 'wss://s1.ripple.com', type: 'public'},
{value: 'wss://s-east.ripple.com', type: 'public'},
{value: 'wss://s-west.ripple.com', type: 'public'},
{value: 'wss://s2.ripple.com', type: 'public'},
{value: 'wss://rippled.xrptipbot.com', type: 'public'},
{value: 'wss://s.altnet.rippletest.net:51233', type: 'test'}
],
[AccountType.ethereum]: [
Expand Down
1 change: 0 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ const initApp = () => {
}
});
};

if (process.env.NODE_ENV !== 'production') {
loadData(() => {
initApp();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/assets/asset-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</div>

</div>
<div v-if="item.code === 'XLM' || item.code === 'XRP'">
<div v-if="(item.code === 'XLM' && !item.issuer) || (item.code === 'XRP' && !item.issuer)">
{{$t('assets.frozenNative')}}
<pl-privacy :suffix="$store.state.setting.currencyUnit"
:switchable="false">
Expand Down
4 changes: 2 additions & 2 deletions src/pages/assets/assets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@
},
selectWallet (item) {
this.$store.dispatch('setAccount' ,item);
this.index = this.walletIndexMap[item.type+item.address];
this.index = this.walletIndexMap[item.address];
this.$refs['swipe'].swipeTo(this.index);
this.$refs.viewAccounts.close();
},
setWallets () {
this.wallets = this.$collecitons.account.findAllSoryByType();
this.wallets.forEach((item, index) => {
this.walletIndexMap[item.type+item.address] = index;
this.walletIndexMap[item.address] = index;
});
let setting = this.$collecitons.setting.findSetting();
this.index = this.walletIndexMap[setting.defaultAddress] || 0;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/history/tx-detail-ripple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
</van-col>
</van-row>
</div>
<div class="text-block" v-if="item.data && item.data.specification && item.data.specification.destination && item.data.specification.destination.tag">
<div class="text-block" v-if="item.data && item.toTag">
<van-row>
<van-col span="6">
<p class="text-muted small-font">Tag</p>
</van-col>
<van-col span="18">
<div class="small-font">{{item.data.specification.destination.tag}}</div>
<div class="small-font">{{item.toTag}}</div>
</van-col>
</van-row>
</div>
Expand Down
100 changes: 86 additions & 14 deletions src/pages/history/tx-history-ripple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@leftClick="addAddress(item)" @rightClick="showDetail(item)" @click.native="showDetail(item)"></tx-history-item>
</van-cell-group>
<div class="text-center">
<load-more-btn :loading="nextLoading" @load-more="getRemoteHistory({}, 'down')" :has-next="hasNext"></load-more-btn>
<load-more-btn :loading="nextLoading" @load-more="getRemoteHistory({}, 'down')" :has-next.sync="hasMore"></load-more-btn>
<br>
</div>
</van-tab>
Expand All @@ -17,7 +17,7 @@
@leftClick="addAddress(item)" @rightClick="showDetail(item)" @click.native="showDetail(item)"></tx-history-item>
</van-cell-group>
<div class="text-center">
<load-more-btn :loading="nextLoading" @load-more="getRemoteHistory({}, 'down')" :has-next="hasNext"></load-more-btn>
<load-more-btn :loading="nextLoading" @load-more="getRemoteHistory({}, 'down')" :has-next.sync="hasMore && outHistory.length > 0"></load-more-btn>
<br>
</div>
</van-tab>
Expand All @@ -27,7 +27,7 @@
@leftClick="addAddress(item)" @rightClick="showDetail(item)" @click.native="showDetail(item)"></tx-history-item>
</van-cell-group>
<div class="text-center">
<load-more-btn :loading="nextLoading" @load-more="getRemoteHistory({}, 'down')" :has-next="hasNext"></load-more-btn>
<load-more-btn :loading="nextLoading" @load-more="getRemoteHistory({}, 'down')" :has-next.sync="hasMore && inHistory.length > 0"></load-more-btn>
<br>
</div>
</van-tab>
Expand All @@ -39,7 +39,17 @@
import history from './mixns/history';
export default{
mixins: [history],
data () {
return {
hasMore: false,
rps: null
};
},
methods: {
clearHistory () {
this.tempHistory = [];
this.normalHistory = [];
},
setRegion () {
let tempAllHistorys = this.$collecitons.history.findHistory(this.$store.state.account.type, this.$store.state.account.address);
if (tempAllHistorys && tempAllHistorys.length > 0) {
Expand All @@ -66,9 +76,58 @@
}
return option;
},
async toHistory (data) {
let toAddress = data.specification.destination.address;
let deliveredAmount = data.outcome.deliveredAmount || {};
getHistory () {
this.getRemoteHistory();
},
getRemoteHistory (param, direction = 'up') {
if (direction !== 'up') {
this.nextLoading = true;
}
if (direction === 'up') {
this.hasMore = false;
this.clearHistory();
}
let option = {};
if (this.hasMore) {
option = {hasMore: true, historys: this.rsp};
}
this.$wallet.getTransactions(this.$store.state.account.address, option)
.then(ret => {
this.hasMore = ret.hashMore;
if (this.hasMore) {
this.rsp = ret.data;
}
ret.data.transactions.forEach(item => {
if (item.tx && item.tx.TransactionType === 'Payment') {
let history = this.toHistory(item.tx);
if (history) {
this.normalHistory.push(history);
}
}
});
this.filterHistory();
this.nextLoading = false;
}).catch(err => {
this.nextLoading = false;
console.info(err);
});
},
filterHistory () {
if (this.normalHistory && this.normalHistory.length > 0) {
let address = this.$store.state.account.address;
let acctType = this.$store.state.account.type;
this.normalHistory = this.normalHistory.filter(item => {
if (this.asset.issuer) {
return item.assetCode === this.asset.code && item.assetIssuer === this.asset.issuer && item.address === address && item.acctType === acctType;
} else {
return item.assetCode === this.asset.code && item.address === address && item.acctType === acctType;
}
});
}
},
toHistory (data) {
let toAddress = data.Destination;
/* let deliveredAmount = data.outcome.deliveredAmount || {};
let assetIssuer = deliveredAmount.counterparty;
if (deliveredAmount.currency && deliveredAmount.currency !== 'XRP') {
let balanceChanges = data.outcome.balanceChanges[this.$store.state.account.address];
Expand All @@ -78,23 +137,36 @@
break;
}
}
} */
let assetCode = '';
let assetIssuer = '';
let amount = null;
let fromAddress = data.Account;
if (data.Amount.issuer && data.Amount.currency) {
assetIssuer = data.Amount.issuer;
assetCode = data.Amount.currency;
amount = data.Amount.value;
fromAddress = data.Amount.issuer;
} else {
assetCode = this.asset.code;
amount = data.Amount / 1000000;
}
let history = {
address: this.$store.state.account.address,
acctType: this.$store.state.account.type,
assetCode: deliveredAmount.currency,
assetCode: assetCode,
assetIssuer: assetIssuer,
txHash: data.id,
amount: deliveredAmount.value || '',
blockNumber: data.outcome.ledgerVersion,
txHash: data.hash,
amount: amount,
blockNumber: data.inLedger,
to: toAddress,
from: data.specification.source.address,
txTime: moment(data.outcome.timestamp).format('YYYYMMDD HH:mm:ss'),
fee: data.outcome.fee,
toTag: data.DestinationTag,
from: fromAddress,
txTime: moment((data.date + 0x386D4380) * 1000).format('YYYYMMDD HH:mm:ss'),
fee: data.Fee / 1000000,
txType: toAddress.toLowerCase() === this.$store.state.account.address.toLowerCase() ? '1' : '0',
data: data
};
return history;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/trade/components/market-dept.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
if (!this.marketTimer) {
this.marketTimer = window.setInterval(() => {
this.getBooks();
}, 1000 * 15 * 0.5);
}, 1000 * 6 * 1);
}
},
getBooks () {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/trade/components/my-offers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
if (!this.offerTimer) {
this.offerTimer = window.setInterval(() => {
this.getOffers();
}, 1000 * 60 * 1);
}, 1000 * 6 * 1);
}
},
shortType () {
Expand Down
Loading

0 comments on commit dc669f4

Please sign in to comment.