Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wayki-max",
"version": "2.2.2",
"version": "2.2.3",
"description": "Wicc web wallet for chrome and firefox.",
"author": "coredev@waykichainhk.com",
"license": "MIT",
Expand Down Expand Up @@ -31,7 +31,7 @@
"vue-slider-component": "^2.8.16",
"vue2-toast": "^2.0.2",
"vuex": "^3.1.1",
"wicc-wallet-lib": "^2.0.0"
"wicc-wallet-lib": "^2.1.0"
},
"scripts": {
"lint": "eslint --ext .js,.vue src",
Expand Down Expand Up @@ -86,4 +86,4 @@
"webpack-merge": "^4.1.0",
"ws": "3.3.2"
}
}
}
30 changes: 15 additions & 15 deletions src/backend/wallet/baas-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const handleError = (error) => {
export default class {
constructor(network) {
this.network = network || 'testnet'
if (localStorage.getItem('myselfNetWork')){
if (localStorage.getItem('myselfNetWork')) {
this.host = JSON.parse(localStorage.getItem('myselfNetWork')).url
}else{
} else {
if (this.network === 'mainnet') {
this.host = BAAS_MAINNET
}else if (this.network === 'testnet') {
} else if (this.network === 'testnet') {
this.host = BAAS_TESTNET
}
}
Expand All @@ -39,7 +39,7 @@ export default class {
}

getAccountInfo(address) {
return axios.post(this.host + '/account/getaccountinfo',{'address':address}).then(handleResponse, handleError)
return axios.post(this.host + '/account/getaccountinfo', { 'address': address }).then(handleResponse, handleError)
}

getTxDetail(tx) {
Expand All @@ -52,7 +52,7 @@ export default class {
///查询ERC20代币详情
getTokenInfo(regId, address) {
// alert(this.host + '/contract/getcontractaccountinfo'+address+regId)
return axios.post(this.host + '/contract/getcontractaccountinfo',{
return axios.post(this.host + '/contract/getcontractaccountinfo', {
'address': address,
'contractregid': regId.trim()
})
Expand All @@ -71,23 +71,23 @@ export default class {
///获取wicc,wusd,wgrt交易记录
getTransHistory(info) {
if (!info.address) throw new Error('address is required.')
return axios.post(this.host + '/transaction/gettranscationsbyaddressplus', {
"address": info.address,
"currentpage": info.currentpage,
"pagesize": info.pagesize,
"startheight": 1,
"trandirection": 0,
"txtype": "",
"coinsymbol":info.coinsymbol,
return axios.post(this.host + '/transaction/getwallettranscationsbyaddressplus', {
"address": info.address,
"currentpage": info.currentpage,
"pagesize": info.pagesize,
"startheight": 1,
"trandirection": 0,
"txtype": "",
"coinsymbol": info.coinsymbol,
}).then(handleResponse, handleError)
}
///获取
getDetailInfo(info){
getDetailInfo(info) {
return axios.post(this.host + '/transaction/gettxdetailplus', info).then(handleResponse, handleError)
}

///根据代号查询发型资产详情
getAssetInfo(info){
getAssetInfo(info) {
return axios.post(this.host + '/asset/getasset', info).then(handleResponse, handleError)
}
//获取插件钱包最新版本号
Expand Down
36 changes: 19 additions & 17 deletions src/backend/wallet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const getSignInfo = (network, address) => {
let srcRegId = ""
const localRegid = localStorage.getItem('srcRegID')
srcRegId = localRegid ? localRegid : ""
if (srcRegId!="") {
if (srcRegId != "") {
return baasApi.getblockcount().then((data) => {
const height = data
const privateKey = vaultStorage.getPrivateKey(address)
Expand All @@ -42,7 +42,7 @@ const getSignInfo = (network, address) => {
}
return baasApi.getAccountInfo(address).then((data) => {
srcRegId = data.regid ? data.regid : ""
localStorage.setItem('srcRegID',srcRegId)
localStorage.setItem('srcRegID', srcRegId)
return baasApi.getblockcount()
}).then((data) => {
const height = data
Expand Down Expand Up @@ -341,7 +341,7 @@ export default {
return {
network,
address: activeAddress,
regid:localRegid?localRegid:"",
regid: localRegid ? localRegid : "",
}
},
getTransHistory({
Expand Down Expand Up @@ -762,7 +762,9 @@ export default {
coinType: info.coinType,
assetType: info.assetType
};
console.log('will get dexPriceBuy hex');
let hex = wiccApi.dexPriceBuy(dexBuyLimitTxinfo)
console.log('hex', hex);
return new BaasAPI(localNetWork).submitOfflineTrans(hex)
})
},
Expand Down Expand Up @@ -862,7 +864,7 @@ export default {
throw new Error('INVALID_VALUE')
}
let hex = wiccApi.createVariousCoinsTx(privateKey, height, srcRegId, info.destAddr, info.value, info.fees, info.coinType, info.feeSymbol, localNetWork, info.memo)
return {rawtx:hex}
return { rawtx: hex }
})
},

Expand Down Expand Up @@ -914,13 +916,13 @@ export default {
feesName: info.feesName,

};
if (srcRegId){

if (srcRegId) {
let hex = wiccApi.assetsPub(assestInfo)
return new BaasAPI(localNetWork).submitOfflineTrans(hex)
}else{
} else {
return new Promise((resolve, reject) => {
reject("qianbaoweijihuo")
reject("qianbaoweijihuo")
})
}
})
Expand Down Expand Up @@ -952,12 +954,12 @@ export default {
feesName: info.feesName,

};
if (srcRegId){
if (srcRegId) {
let hex = wiccApi.assetsUpdate(assestInfo)
return new BaasAPI(localNetWork).submitOfflineTrans(hex)
}else{
} else {
return new Promise((resolve, reject) => {
reject("qianbaoweijihuo")
reject("qianbaoweijihuo")
})
}
})
Expand Down Expand Up @@ -991,14 +993,14 @@ export default {
if (isNaN(parseFloat(info.amount))) {
throw new Error('INVALID_VALUE')
}
let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol,info.fees, info.feesName, info.contract, localNetWork, info.memo)
let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol, info.fees, info.feesName, info.contract, localNetWork, info.memo)
return new BaasAPI(localNetWork).submitOfflineTrans(hex)
})
},

/**
* 多币种合约调用(仅仅签名)
*/
/**
* 多币种合约调用(仅仅签名)
*/
variousCoinsContractRaw({ info }) {
const localNetWork = localStorage.getItem('network')
const wiccApi = getWiccApi(localNetWork)
Expand All @@ -1010,8 +1012,8 @@ export default {
if (isNaN(parseFloat(info.amount))) {
throw new Error('INVALID_VALUE')
}
let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol,info.fees, info.feesName, info.contract, localNetWork, info.memo)
return {rawtx:hex}
let hex = wiccApi.uContractInvoke(privateKey, height, srcRegId, info.regId, info.amount, info.coinSymbol, info.fees, info.feesName, info.contract, localNetWork, info.memo)
return { rawtx: hex }
})
},

Expand Down
Loading