Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
loadTokenHolders = async (page = 1, pageSize = 20) => {
let {filter} = this.props;
this.setState({loading: true});
// let {addresses, total} = await Client.getTokenHolders(filter.token, {
// sort: '-balance',
// limit: pageSize,
// start: (page - 1) * pageSize,
// count: true
// });
let { data } = await xhr.get(API_URL+"/api/token_trc20/holders?sort=-balance&start=" +(page - 1) * pageSize+ "&limit="+pageSize+"&contract_address=" + filter.token);
let addresses = data.trc20_tokens;
let total= data.total;
let rangeTotal = data.rangeTotal;
for (let index in addresses) {
addresses[index].index = parseInt(index) + 1 + (page-1)*pageSize;
}
let exchangeFlag = await Client.getTagNameList()
if(addresses.length){
addresses.map(item => {
item.tagName = ''
exchangeFlag.map(coin => {
const typeList = Object.keys(coin.addressList)
typeList.map(type => {
if(coin.addressList[type].length == 1){
if(coin.addressList[type][0] === item.address){
async loadAccounts() {
// let {accounts} = await Client.getAccounts({
// limit: 35,
// sort: '-balance',
// });
let accountData = await xhr.get("https://assistapi.tronscan.org/api/account?limit=35&sort=-balance");
let accounts = accountData.data;
this.setState({
accounts: filter(accounts, account => !includes(tronAddresses, account.address))
.slice(0, 10)
.map(account => ({
name: account.address,
value: account.balance / ONE_TRX,
}))
});
}
loadTotalTRXSupply = async() =>{
async load() {
/* let {total: totalTransactions} = await Client.getTransfers({
limit: 1,
date_start: subDays(new Date(), 1),
});
*/
let vol = await xhr.get("https://api.coinmarketcap.com/v1/ticker/tron/");
let volume = vol.data[0]["24h_volume_usd"];
let totalAccounts = await Client.getAccounts();
let {txOverviewStats} = await Client.getTxOverviewStats();
let temp = [];
for (let txs in txOverviewStats) {
let tx = parseInt(txs);
if (tx === 0) {
temp.push(txOverviewStats[tx]);
}
else {
temp.push({
module.exports.nupnp = function () {
return axios.get('https://discovery.meethue.com', {
headers: {accept: 'application/json'},
httpsAgent: caChain.getDiscoveryMeetHueHttpsAgent()
})
.catch(err => {
throw new ApiError(`Problems resolving hue bridges, ${err.message}`);
})
.then(response => {
if (response.status === 200) {
return response.data;
} else {
throw new ApiError(`Status code unexpected when using N-UPnP endpoint: ${response.status}`);
}
});
};
export async function loadBranches () {
try {
const response = await axios.get(`/odaapi/api/masters/${store.state.shortName}/branches/`)
return response.data.branches
} catch (e) {
error({e})
}
}
var dataEur = Lockr.get("dataEur");
var dataEth = Lockr.get("dataEth");
let eurURL = encodeURI(
`https://api.coinmarketcap.com/v1/ticker/tronix/?convert=EUR`
);
let ethURL = encodeURI(
`https://api.coinmarketcap.com/v1/ticker/tronix/?convert=ETH`
);
if (!Lockr.get("dataEur")) {
var { data: dataEur } = await xhr.get(
`${API_URL}/api/system/proxy?url=${eurURL}`
);
}
if (!Lockr.get("dataEth")) {
var { data: dataEth } = await xhr.get(
`${API_URL}/api/system/proxy?url=${ethURL}`
);
}
let newPrices = {
BTC: parseFloat(dataEur[0].price_btc),
EUR: parseFloat(dataEur[0].price_eur),
USD: parseFloat(dataEur[0].price_usd),
ETH: parseFloat(dataEth[0].price_eth),
TRX: 1
};
this.setState(state => ({
prices: newPrices,
activePrice: newPrices[state.priceShown.toUpperCase()]
}));
export async function listMyDocuments () {
try {
const response = await axios.get(`/odaapi/api/masters/`)
return response.data
} catch (e) {
error({e, message: 'deleting a structure definition'})
}
}
const getSignInPromise = () => {
return axios.get(`${API_SERVER}/users/user`, {headers: {'x-access-token': getToken()}});
}
load = async (page = 1, pageSize = 20) => {
let { wallet } = this.props;
let { filter } = this.state;
let {
data: { data }
} = await xhr.get(
"https://list.tronlink.org/api/wallet/multi/trx_record",
{
params: {
address: wallet.address,
start: (page - 1) * pageSize,
state: filter.direction,
limit: 5000,
netType: "main_net"
}
}
);
let signatureList = data.data || [];
signatureList.map(item => {
if (item.state == 0) {
item.signatureProgress.map((sign, index) => {
if (sign.address == wallet.address) {
async getAppealRecent10(address){
const {data: {data, retCode}} = await xhr.get(CONTRACT_MAINNET_API_URL+'/external/trc_appeals/recent?address='+ address)
if(retCode == 0){
this.setState({appealInfo: data.appeal})
}
}