|
|
@@ -1,83 +0,0 @@
|
|
|
-import http from 'axios'
|
|
|
-import NumKit from '@/plugins/kit/NumKit'
|
|
|
-
|
|
|
-export default class EthMev {
|
|
|
- static async getEthMevData(block, hash, dataVague, page=1, size=200) {
|
|
|
- const url = '/ethmev/findByHashOrBlockOrDataVague'
|
|
|
- const rst = await http.post(url, {
|
|
|
- block: block,
|
|
|
- hash: hash,
|
|
|
- dataVague: dataVague,
|
|
|
- limit1: (page - 1) * size,
|
|
|
- limit2: size
|
|
|
- })
|
|
|
-
|
|
|
- return rst.data
|
|
|
- }
|
|
|
-
|
|
|
- static async getEthMevPendingData(block, hash, dataVague, page=1, size=200) {
|
|
|
- if (!isNaN(parseInt(block)) && block.charAt(0) !== '-') block = '-' + block
|
|
|
-
|
|
|
- const url = '/ethmev/findByHashOrBlockOrDataVaguePending'
|
|
|
- const rst = await http.post(url, {
|
|
|
- block: block,
|
|
|
- hash: hash,
|
|
|
- dataVague: dataVague,
|
|
|
- limit1: (page - 1) * size,
|
|
|
- limit2: size
|
|
|
- })
|
|
|
-
|
|
|
- return rst.data
|
|
|
- }
|
|
|
-
|
|
|
- static async deleteByHash(hash) {
|
|
|
- const url = '/ethmev/deleteByHash'
|
|
|
- const rst = await http.post(url, {
|
|
|
- hash: hash
|
|
|
- })
|
|
|
-
|
|
|
- return rst.data
|
|
|
- }
|
|
|
-
|
|
|
- static async appendOrUpdate(block, hash, dataVague) {
|
|
|
- const url = '/ethmev/appendOrUpdate'
|
|
|
- const rst = await http.post(url, {
|
|
|
- block: block,
|
|
|
- hash: hash,
|
|
|
- dataVague: dataVague
|
|
|
- })
|
|
|
-
|
|
|
- return rst.data
|
|
|
- }
|
|
|
-
|
|
|
- static generateTableDataByDbData(historyList) {
|
|
|
- historyList.map(function (history) {
|
|
|
- try {
|
|
|
- let dataObj = history.dataObj
|
|
|
-
|
|
|
- history.from = dataObj.fromAdd
|
|
|
- history.to = dataObj.toAdd
|
|
|
- history.gasPrice = NumKit.getSubFloat(parseInt(dataObj.gasPrice) / (1E9), 2)
|
|
|
- history.index = dataObj.index
|
|
|
- history.type = dataObj.type
|
|
|
- history.state = dataObj.status
|
|
|
- history.pending = dataObj.pending
|
|
|
- history.mev = dataObj.mev
|
|
|
- history.tradeInfoList = dataObj.tradeInfo
|
|
|
- history.memo = dataObj.memo
|
|
|
-
|
|
|
- // hash异常处理
|
|
|
- if (history.hash.indexOf('0x') === -1 && history.hash.length === 64) history.hash = '0x' + history.hash
|
|
|
-
|
|
|
- // token处理
|
|
|
- history.tokenMap = {}
|
|
|
- history.tradeInfoList.map(function (tradeInfo) {
|
|
|
- if (!history.tokenMap[tradeInfo.token]) history.tokenMap[tradeInfo.token] = tradeInfo.tokenSymbol
|
|
|
- })
|
|
|
- history.tokenAddressList = Object.keys(history.tokenMap)
|
|
|
- } catch (e) {
|
|
|
- history.tradeInfo = []
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
-}
|