提交 0d98ef96 authored 作者: zhanglian's avatar zhanglian

转账后刷新余额

上级 cf900c99
...@@ -12,7 +12,6 @@ export async function connectWallet(){ ...@@ -12,7 +12,6 @@ export async function connectWallet(){
store.commit('network/SET_CHAIN_ID', '') store.commit('network/SET_CHAIN_ID', '')
const { address } = await init(); const { address } = await init();
const chainId = await getChainId(); const chainId = await getChainId();
console.log('----chainId-typeof' , typeof chainId);
if (chainId && address) { if (chainId && address) {
// let signature,expireTime; // let signature,expireTime;
// if (interfaceSignature.signatureHasExpired(chainId, address)) { // if (interfaceSignature.signatureHasExpired(chainId, address)) {
......
export const skillList = [
{
name: '打破不可能三角神话',
imgUrl: require('@/assets/images/home/skill1.png')
},
{
name: '复杂合约高并发',
imgUrl: require('@/assets/images/home/skill2.png')
},
{
name: '公链的公链解决方案',
imgUrl: require('@/assets/images/home/skill3.png')
},
{
name: '分层多级链万能架构',
imgUrl: require('@/assets/images/home/skill4.png')
},
{
name: '公链与联盟链可信融合',
imgUrl: require('@/assets/images/home/skill5.png')
}
]
export const becomeDevpolerList = [
{
name: '核心开发者',
imgUrl: require('@/assets/images/develoader/develoaderIcon1.png')
},
{
name: '工具开发者',
imgUrl: require('@/assets/images/develoader/develoaderIcon2.png')
},
{
name: 'DAPP开发者',
imgUrl: require('@/assets/images/develoader/develoaderIcon3.png')
},
{
name: '更多想法',
imgUrl: require('@/assets/images/develoader/develoaderIcon4.png')
},
]
const tokenListLocal = [
]
const tokenListDev = [{
name: 'TKM',
index: 1,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'main',
contractAddress: '',
},
{
name: 'TUSDT',
index: 2,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x630dDb5C384F4cB489E43d74a6722B26635b65bE',
},
{
name: 'BTKM',
index: 1,
chainName: 'bsc',
chainId: 97,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x0806c5b183F8a622fE62c7344B04e6e6A7C82c2e',
},
{
name: 'BUSDT',
index: 2,
chainName: 'bsc',
chainId: 97,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x3b319043334f483a931ad6555b17fc4a55f3c64a',
},
{
name: 'TKM3',
index: 3,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'main',
contractAddress: '',
},
{
name: 'TUSDT3',
index: 4,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x630dDb5C384F4cB489E43d74a6722B26635b65bE',
},
{
name: 'BTKM3',
index: 3,
chainName: 'bsc',
chainId: 1337,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x0806c5b183F8a622fE62c7344B04e6e6A7C82c2e',
},
{
name: 'BUSDT3',
index: 4,
chainName: 'bsc',
chainId: 1337,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x3b319043334f483a931ad6555b17fc4a55f3c64a',
},
]
const tokenListPro = [
]
export function getTokenList(currentChainId){
currentChainId -= 0;
// if([60001, 97, 1337].includes(currentChainId)){
// return tokenListDev;
// }else{
// return tokenListPro;
// }
return tokenListDev;
}
\ No newline at end of file
...@@ -65,6 +65,7 @@ import { BigNumber } from 'bignumber.js' ...@@ -65,6 +65,7 @@ import { BigNumber } from 'bignumber.js'
import * as metaMask from '@/api/demoMETAMASK'; import * as metaMask from '@/api/demoMETAMASK';
import EDialog from '@/components/EDialog.vue'; import EDialog from '@/components/EDialog.vue';
import { createNamespacedHelpers } from 'vuex'; import { createNamespacedHelpers } from 'vuex';
import { getTokenList } from '@/utils/data/tokenList'
const { mapState: mapStateWallet } = createNamespacedHelpers('wallet'); const { mapState: mapStateWallet } = createNamespacedHelpers('wallet');
const { mapState: mapStateNetwork } = createNamespacedHelpers('network'); const { mapState: mapStateNetwork } = createNamespacedHelpers('network');
...@@ -80,87 +81,7 @@ export default { ...@@ -80,87 +81,7 @@ export default {
dialogVisible: false, dialogVisible: false,
pageLoading: false, pageLoading: false,
tokenList: [], tokenList: [],
tokenListOrigin: [{ tokenListOrigin: [],
name: 'TKM',
index: 1,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'main',
contractAddress: '',
},
{
name: 'TUSDT',
index: 2,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x630dDb5C384F4cB489E43d74a6722B26635b65bE',
},
{
name: 'TKM3',
index: 3,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'main',
contractAddress: '',
},
{
name: 'TUSDT3',
index: 4,
chainName: 'tkm',
chainId: 60001,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x630dDb5C384F4cB489E43d74a6722B26635b65bE',
},
{
name: 'BTKM',
index: 1,
chainName: 'bsc',
chainId: 97,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x0806c5b183F8a622fE62c7344B04e6e6A7C82c2e',
},
{
name: 'BUSDT',
index: 2,
chainName: 'bsc',
chainId: 97,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x3b319043334f483a931ad6555b17fc4a55f3c64a',
},
{
name: 'BTKM3',
index: 3,
chainName: 'bsc',
chainId: 1337,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x0806c5b183F8a622fE62c7344B04e6e6A7C82c2e',
},
{
name: 'BUSDT3',
index: 4,
chainName: 'bsc',
chainId: 1337,
url: '',
balance: '0',
type: 'erc20',
contractAddress: '0x3b319043334f483a931ad6555b17fc4a55f3c64a',
},
],
tokenListTKM: [], tokenListTKM: [],
tokenListBSC: [], tokenListBSC: [],
selectIndex: '', selectIndex: '',
...@@ -176,6 +97,7 @@ export default { ...@@ -176,6 +97,7 @@ export default {
}, },
changeItem: '', changeItem: '',
inputValue: '', inputValue: '',
rbalance: 1,
} }
}, },
computed: { computed: {
...@@ -194,15 +116,16 @@ export default { ...@@ -194,15 +116,16 @@ export default {
asyncComputed: { asyncComputed: {
balance: { balance: {
get() { get() {
console.log('--this.holdItem', this.holdItem);
const { coinData } = this.holdItem; const { coinData } = this.holdItem;
console.log(coinData.chainId, this.chainId);
if (!this.walletConnected) { if (!this.walletConnected) {
return 0; return 0;
} }
if (coinData.chainId != this.chainId) { if (coinData.chainId != this.chainId) {
this.networkAlert(); this.networkAlert();
return 0; return 0;
}
if(!this.rbalance){
} }
if (coinData.type == 'main') { if (coinData.type == 'main') {
return this.getAccountBalance().then(res => res); return this.getAccountBalance().then(res => res);
...@@ -228,6 +151,7 @@ export default { ...@@ -228,6 +151,7 @@ export default {
} }
bridge = new window.web3.eth.Contract(bridgeAbi, bridgeContractAddress, overrides); bridge = new window.web3.eth.Contract(bridgeAbi, bridgeContractAddress, overrides);
this.tokenListOrigin = getTokenList(this.chainId);
this.tokenListTKM = this.getTokensByChainName('tkm') || []; this.tokenListTKM = this.getTokensByChainName('tkm') || [];
this.tokenListBSC = this.getTokensByChainName('bsc') || []; this.tokenListBSC = this.getTokensByChainName('bsc') || [];
...@@ -253,8 +177,12 @@ export default { ...@@ -253,8 +177,12 @@ export default {
if (!token) { if (!token) {
token = this.getTokensByChainName(this.holdItem.chainName)[0] token = this.getTokensByChainName(this.holdItem.chainName)[0]
} }
console.log('----123', token);
this.changeSelect(0, token) this.changeSelect(0, token)
}, },
refreshBalance(){
this.rbalance++
},
formateChainName(chainId) { formateChainName(chainId) {
let tkmChainIds = this.tokenListTKM.map(item => item.chainId); let tkmChainIds = this.tokenListTKM.map(item => item.chainId);
let bscChainIds = this.tokenListBSC.map(item => item.chainId); let bscChainIds = this.tokenListBSC.map(item => item.chainId);
...@@ -362,6 +290,7 @@ export default { ...@@ -362,6 +290,7 @@ export default {
}); });
} }
this.$notify({ type: 'success', message: '转账成功' }); this.$notify({ type: 'success', message: '转账成功' });
this.refreshBalance();
} catch (err) { } catch (err) {
this.$notify({ type: 'warning', message: '转账失败' }); this.$notify({ type: 'warning', message: '转账失败' });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论