fix: 隐藏信息

This commit is contained in:
chaosBreaking
2019-09-08 11:03:37 +08:00
parent cd63a4f5b4
commit 84d832d859
3 changed files with 12 additions and 3 deletions

View File

@@ -4,7 +4,8 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1",
"dev": "node --inspect-brk ./"
}, },
"author": "Nova.xu", "author": "Nova.xu",
"license": "ISC", "license": "ISC",
@@ -26,6 +27,7 @@
"deepmerge": "^4.0.0", "deepmerge": "^4.0.0",
"errorhandler": "^1.5.0", "errorhandler": "^1.5.0",
"ethers": "^4.0.36", "ethers": "^4.0.36",
"etherscan-api": "^10.0.4",
"express": "^4.17.1", "express": "^4.17.1",
"js-sha3": "^0.8.0", "js-sha3": "^0.8.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",

View File

@@ -49,7 +49,7 @@ module.exports = {
}, },
async getGroup (req, res) { async getGroup (req, res) {
const { userId } = res.locals.user; const { userId } = res.locals.user;
User.find({ inviter: userId }).then(data => { return User.find({ inviter: userId }, 'id nickname phone').then(data => {
res.json({ res.json({
code: 0, code: 0,
msg: 'success', msg: 'success',
@@ -137,7 +137,7 @@ module.exports = {
}, },
async getGroupList (req, res) { async getGroupList (req, res) {
const { userId } = res.locals.user; const { userId } = res.locals.user;
const list = await User.find({ inviter: userId }).exec(); const list = await User.find({ inviter: userId }, 'id nickname phone').exec();
return res.json({ return res.json({
code: 0, code: 0,
data: list data: list

View File

@@ -5,6 +5,7 @@
const axios = require('axios'); const axios = require('axios');
const crypto = require('./crypto'); const crypto = require('./crypto');
const ethers = require('ethers'); const ethers = require('ethers');
const ethio = require('etherscan-api').init('E3ZFFAEMNN33KX4HHVUZ4KF8XY1FXMR4BI');
require('setimmediate'); require('setimmediate');
@@ -36,6 +37,12 @@ class ERC20 extends ethers.Wallet {
}; };
return parseInt((await axios.post(ETH_NODE, queryData)).data.result); return parseInt((await axios.post(ETH_NODE, queryData)).data.result);
} }
static async getActions(address, contractAddress) {
let tx = await ethio.account.tokentx(address, contractAddress);
if (tx && tx.message === "OK")
return tx.result;
else return [];
}
static async getBalance(address, contractAddress) { static async getBalance(address, contractAddress) {
if (!address || !contractAddress) throw new Error('Missing params'); if (!address || !contractAddress) throw new Error('Missing params');
let queryAddress = '0x70a08231' + (address.split('x')[1]).padStart(64, '0'); let queryAddress = '0x70a08231' + (address.split('x')[1]).padStart(64, '0');