Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Client as ApiClient } from "@tronscan/client";
import io from "socket.io-client";
import TronWeb from "tronweb";
import xhr from "axios/index";
import { API_URL } from "../constants.js";
import { setLoginWithAddress } from "../actions/app.js";
const ServerNode = "https://api.trongrid.io";
const HttpProvider = TronWeb.providers.HttpProvider; // This provider is optional, you can just use a url for the nodes instead
const fullNode = new HttpProvider(ServerNode); // Full node http endpoint
const solidityNode = new HttpProvider(ServerNode); // Solidity node http endpoint
const eventServer = ServerNode; // Contract events http endpoint
export const tronWeb = new TronWeb(fullNode, solidityNode, eventServer);
export const Client = new ApiClient(API_URL);
export function buildClient(account) {
return new ApiClient(API_URL);
}
export function channel(path, options) {
// return io(process.env.API_URL + path, options);
return io("https://wlcyapi.tronscan.org/socket.io" + path, options);
//return io('http://172.16.20.207:20110/socket.io' + path, options);
}
isLoggedIn: true,
address: passwordToAddress(action.password)
},
wallet: {
type: ACCOUNT_PRIVATE_KEY,
address: passwordToAddress(action.password),
isOpen: true,
},
};
}
case LOGIN_PK: {
Lockr.set("islogin", 0);
const ServerNode = SUNWEBCONFIG.MAINFULLNODE;
const HttpProvider = TronWeb.providers.HttpProvider; // This provider is optional, you can just use a url for the nodes instead
const fullNode = new HttpProvider(ServerNode); // Full node http endpoint
const solidityNode = new HttpProvider(ServerNode); // Solidity node http endpoint
const eventServer = ServerNode; // Contract events http endpoint
const privateKey = action.privateKey;
const tronWeb = new TronWeb({
fullNode,
solidityNode,
eventServer,
privateKey
}
);
const sunWeb = new SunWeb(
{
fullNode: ServerNode,
solidityNode: ServerNode,
eventServer: ServerNode,
init(){
const DUMMY_NET = 'https://api.shasta.trongrid.io'
const provider = new TronWeb.providers.HttpProvider(DUMMY_NET);
const tronWeb = new TronWeb(provider, provider, DUMMY_NET);
utils = tronWeb.utils;
}
import TronWeb from 'tronweb';
import Logger from '@tronlink/lib/logger';
import axios from 'axios';
const { HttpProvider } = TronWeb.providers;
const logger = new Logger('ProxiedProvider');
class ProxiedProvider extends HttpProvider {
constructor() {
super('http://127.0.0.1');
logger.info('Provider initialised');
this.ready = false;
this.queue = [];
}
configure(url) {
logger.info('Received new node:', url);
this.host = url;
import TronWeb from 'tronweb';
import Logger from '@tronlink/lib/logger';
import axios from 'axios';
const { HttpProvider } = TronWeb.providers;
const logger = new Logger('ProxiedProvider');
class ProxiedProvider extends HttpProvider {
constructor(chainType = 0) {
super('http://127.0.0.1');
logger.info('Provider initialised');
this.ready = false;
this.queue = [];
this.chainType = chainType;
}
configure(url) {
logger.info('Received new node:', url);