|
@@ -169,7 +169,7 @@ async function getAccountBalances(options) {
|
|
if (options.chain) {
|
|
if (options.chain) {
|
|
options.chain = utils.getChainName(options.chain)
|
|
options.chain = utils.getChainName(options.chain)
|
|
}
|
|
}
|
|
- logger.log('getAccountBalances :', options)
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
//做 3次 重试,每次间隔 1s+=
|
|
//做 3次 重试,每次间隔 1s+=
|
|
@@ -179,30 +179,34 @@ async function getAccountBalances(options) {
|
|
var delay = 1000
|
|
var delay = 1000
|
|
var interval = 500
|
|
var interval = 500
|
|
var result;
|
|
var result;
|
|
|
|
+ var balance_opts = {
|
|
|
|
+ address:options.address,
|
|
|
|
+ chain:options.chain
|
|
|
|
+ }
|
|
|
|
+ logger.log('getAccountBalances :', options,balance_opts)
|
|
do {
|
|
do {
|
|
try {
|
|
try {
|
|
if (options.type == 'native') {
|
|
if (options.type == 'native') {
|
|
- result = await Moralis.Web3API.account.getNativeBalance(options);
|
|
|
|
|
|
+ result = await Moralis.Web3API.account.getNativeBalance(balance_opts);
|
|
logger.log('getNativeBalance=', result);
|
|
logger.log('getNativeBalance=', result);
|
|
} else {
|
|
} else {
|
|
- result = await Moralis.Web3API.account.getTokenBalances(options);
|
|
|
|
|
|
+ result = await Moralis.Web3API.account.getTokenBalances(balance_opts);
|
|
logger.log('getTokenBalances=', result);
|
|
logger.log('getTokenBalances=', result);
|
|
}
|
|
}
|
|
if(tryCount < 4)
|
|
if(tryCount < 4)
|
|
{
|
|
{
|
|
- logger.error('getBalances succeed:', JSON.stringify(options), " 已重试:" + tryCount +"次")
|
|
|
|
|
|
+ logger.error('getBalances succeed:', JSON.stringify(balance_opts), " 已重试:" + tryCount +"次")
|
|
}
|
|
}
|
|
break
|
|
break
|
|
} catch (error) {
|
|
} catch (error) {
|
|
if (tryCount == 1) {
|
|
if (tryCount == 1) {
|
|
- logger.error('getBalances error:', error.toString(), JSON.stringify(options))
|
|
|
|
|
|
+ logger.error('getBalances error:', error.toString(), JSON.stringify(balance_opts))
|
|
result = null;
|
|
result = null;
|
|
}
|
|
}
|
|
tryCount -= 1;
|
|
tryCount -= 1;
|
|
await utils.sleep(delay)
|
|
await utils.sleep(delay)
|
|
delay += interval
|
|
delay += interval
|
|
- logger.error('getBalances error:', JSON.stringify(options), "重试:" + tryCount +"次")
|
|
|
|
-
|
|
|
|
|
|
+ logger.error('getBalances error:', JSON.stringify(balance_opts), "重试:" + tryCount +"次")
|
|
}
|
|
}
|
|
} while (tryCount >= 1);
|
|
} while (tryCount >= 1);
|
|
return result
|
|
return result
|
|
@@ -823,7 +827,7 @@ const transfer = async (obj) => {
|
|
if (error.reason != null) {
|
|
if (error.reason != null) {
|
|
return toJson(ERROR_CODE_001, null, error.toString());
|
|
return toJson(ERROR_CODE_001, null, error.toString());
|
|
} else {
|
|
} else {
|
|
- return toJson(ERROR_CODE_001, null, error.toString());;
|
|
|
|
|
|
+ return toJson(ERROR_CODE_001, null, error.toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|