@tronlink/core
Version:
The library serves as a core module within TronLink Extension, which provides low-level wallet functionality for both Tron and Ethereum networks, primary features includes account generation and transaction signing
24 lines • 832 B
JavaScript
// @ts-ignore
import { TronWeb } from 'tronweb';
import { httpProxy } from '../utils';
import { TRONGRID_API_URL } from './constants';
export function generateTronWeb(nodeInfo) {
try {
const { fullNode, solidityNode, eventServer, headers } = nodeInfo;
const tronWeb = new TronWeb(
// @ts-ignore
new httpProxy({ host: fullNode, headers }), new httpProxy({ host: solidityNode, headers }), new httpProxy({ host: eventServer, headers }));
return tronWeb;
}
catch (error) {
throw new Error('initTronWeb failed');
}
}
const mainNetNodeInfo = {
fullNode: TRONGRID_API_URL,
solidityNode: TRONGRID_API_URL,
eventServer: TRONGRID_API_URL,
headers: {},
};
export const defaultTronWeb = generateTronWeb(mainNetNodeInfo);
//# sourceMappingURL=generateTronWeb.js.map