@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
28 lines • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultTronWeb = void 0;
exports.generateTronWeb = generateTronWeb;
// @ts-ignore
const tronweb_1 = require("tronweb");
const utils_1 = require("../utils");
const constants_1 = require("./constants");
function generateTronWeb(nodeInfo) {
try {
const { fullNode, solidityNode, eventServer, headers } = nodeInfo;
const tronWeb = new tronweb_1.TronWeb(
// @ts-ignore
new utils_1.httpProxy({ host: fullNode, headers }), new utils_1.httpProxy({ host: solidityNode, headers }), new utils_1.httpProxy({ host: eventServer, headers }));
return tronWeb;
}
catch (error) {
throw new Error('initTronWeb failed');
}
}
const mainNetNodeInfo = {
fullNode: constants_1.TRONGRID_API_URL,
solidityNode: constants_1.TRONGRID_API_URL,
eventServer: constants_1.TRONGRID_API_URL,
headers: {},
};
exports.defaultTronWeb = generateTronWeb(mainNetNodeInfo);
//# sourceMappingURL=generateTronWeb.js.map