New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tronweb

Package Overview
Dependencies
Maintainers
4
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tronweb

JavaScript SDK that encapsulates the TRON Node HTTP API

  • 2.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19K
decreased by-69.92%
Maintainers
4
Weekly downloads
 
Created

What is tronweb?

TronWeb is a JavaScript library that provides a comprehensive set of tools for interacting with the TRON blockchain. It allows developers to create, deploy, and interact with smart contracts, manage accounts, and perform transactions on the TRON network.

What are tronweb's main functionalities?

Account Management

This feature allows you to manage TRON accounts, including retrieving account information such as balance and transaction history. The code sample demonstrates how to initialize TronWeb and fetch account details using an address.

const TronWeb = require('tronweb');
const tronWeb = new TronWeb({
  fullHost: 'https://api.trongrid.io',
  privateKey: 'your_private_key'
});

async function getAccountInfo(address) {
  const accountInfo = await tronWeb.trx.getAccount(address);
  console.log(accountInfo);
}

getAccountInfo('your_tron_address');

Smart Contract Interaction

TronWeb allows you to interact with smart contracts on the TRON network. This code sample shows how to call a method on a deployed smart contract by specifying the contract address, method name, and parameters.

const TronWeb = require('tronweb');
const tronWeb = new TronWeb({
  fullHost: 'https://api.trongrid.io',
  privateKey: 'your_private_key'
});

async function callContractMethod(contractAddress, methodName, parameters) {
  const contract = await tronWeb.contract().at(contractAddress);
  const result = await contract[methodName](...parameters).call();
  console.log(result);
}

callContractMethod('contract_address', 'methodName', ['param1', 'param2']);

Transaction Management

This feature enables you to manage transactions on the TRON network, including sending TRX tokens. The code sample demonstrates how to send a transaction to a specified address with a given amount.

const TronWeb = require('tronweb');
const tronWeb = new TronWeb({
  fullHost: 'https://api.trongrid.io',
  privateKey: 'your_private_key'
});

async function sendTransaction(to, amount) {
  const transaction = await tronWeb.trx.sendTransaction(to, amount);
  console.log(transaction);
}

sendTransaction('recipient_address', 1000);

Other packages similar to tronweb

FAQs

Package last updated on 14 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc