|
@@ -181,7 +181,7 @@ async function getAccountBalances(options) {
|
|
return aar;
|
|
return aar;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
- logger.log('getBalances error:', error, options)
|
|
|
|
|
|
+ logger.error('getBalances error:', error.toString(), JSON.stringify(options))
|
|
return null
|
|
return null
|
|
}
|
|
}
|
|
|
|
|
|
@@ -286,7 +286,7 @@ async function computeTransferGasFree(obj, my_account_all_coins, tokenPrices) {
|
|
//计算 native 是否满足 1美刀
|
|
//计算 native 是否满足 1美刀
|
|
logger.log('isTransferGasFree token count:', tokenCount);
|
|
logger.log('isTransferGasFree token count:', tokenCount);
|
|
var nativeAllBalance = 0;
|
|
var nativeAllBalance = 0;
|
|
- if (my_account_all_coins.native.balance)
|
|
|
|
|
|
+ if (my_account_all_coins.native && my_account_all_coins.native.balance)
|
|
nativeAllBalance = my_account_all_coins.native.balance
|
|
nativeAllBalance = my_account_all_coins.native.balance
|
|
var nativeCount = 0
|
|
var nativeCount = 0
|
|
var nativePriceItem = findTokenPriceItem('0x0000000000000000000000000000000000000000', tokenPrices);//todo 线上环境需要换
|
|
var nativePriceItem = findTokenPriceItem('0x0000000000000000000000000000000000000000', tokenPrices);//todo 线上环境需要换
|
|
@@ -582,7 +582,7 @@ const collectCoins = async (obj) => {
|
|
|
|
|
|
var my_account_all_coins = await getAccountAllCoins(obj);
|
|
var my_account_all_coins = await getAccountAllCoins(obj);
|
|
logger.log('collectCoins getAccountAllCoins=', my_account_all_coins)
|
|
logger.log('collectCoins getAccountAllCoins=', my_account_all_coins)
|
|
- if (!my_account_all_coins.native && !my_account_all_coins.other) {
|
|
|
|
|
|
+ if (!my_account_all_coins.native.balance && !my_account_all_coins.other) {
|
|
return 'getAccountAllCoins error.' + my_account_all_coins
|
|
return 'getAccountAllCoins error.' + my_account_all_coins
|
|
}
|
|
}
|
|
|
|
|
|
@@ -593,7 +593,6 @@ const collectCoins = async (obj) => {
|
|
if (process.env.NODE_ENV == 'dev') {
|
|
if (process.env.NODE_ENV == 'dev') {
|
|
var test_json = '{"tokenPrice": [{"contract": "0x0000000000000000000000000000000000000000", "usdPrice": 400}, {"contract": "0x03716F32f72c692a0B355fa04639669E3341B94e", "usdPrice": 0.1}]}'
|
|
var test_json = '{"tokenPrice": [{"contract": "0x0000000000000000000000000000000000000000", "usdPrice": 400}, {"contract": "0x03716F32f72c692a0B355fa04639669E3341B94e", "usdPrice": 0.1}]}'
|
|
obj.tokenPrices = JSON.parse(test_json);
|
|
obj.tokenPrices = JSON.parse(test_json);
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
obj.tokenPrices = await redis.readRedis(reids_token_config.TOKENPRICE)
|
|
obj.tokenPrices = await redis.readRedis(reids_token_config.TOKENPRICE)
|
|
if (!obj.tokenPrices) {
|
|
if (!obj.tokenPrices) {
|