当前位置: 首页 > ops >正文

与 TRON (波场) 区块链进行交互的命令行工具 (CLI): tstroncli

源码仓库

在这里插入图片描述

一个基于 Node.js 和 TypeScript 构建的,用于与 TRON (波场) 区块链进行交互的命令行工具 (CLI)。

本项目旨在提供一个简单、可扩展的框架,让开发者可以轻松地通过命令行调用 TRON 的 HTTP API,实现查询链上信息、发送交易等操作。

✨ 功能特性

  • 交互式命令行: 在终端中提供一个持续运行的交互式提示符。
  • 清晰的架构: 命令逻辑、定义和主程序分离,易于理解和维护。
  • 易于扩展: 添加新命令只需修改一个文件,无需改动核心逻辑。
  • TypeScript 支持: 完整的类型定义,提供更好的开发体验和代码健壮性。
  • 美观的输出: 使用 chalkfiglet 美化输出,使用 console.table 格式化帮助信息。

🚀 安装

源码仓库

📖 使用说明

tstroncli程序启动后,你可以输入相应的命令并按回车键来执行。

可用命令

输入 /help 可以查看所有支持的命令及其说明:
在这里插入图片描述

(index)方法名中文解释英文解释
0createrandom创建 12 位的助记词Create a 12-word mnemonic phrase
1createaccount创建地址账号 <未激活的新地址>Create an address account
2getaccount根据地址查询账户信息。用法: getaccount <address: b58hex>
3getaccountresources获取账号中的能量和带宽资源。用法: getaccount <address: b58hex>
4getgenesisblock获取创世区块(最早的区块)信息Get information about the genesis block (earliest block)
5getnowblock获取最新的区块信息Get information about the latest block
6getblocknumber获取最新的区块信息Get the latest block number
7getbalance获取账户可用 TRX 余额。用法: getbalance <address: b58hex>
8getbandwidth获取账户可用带宽余额。用法: getbandwidth <address: b58hex>
9getbandwidthprices查询历史带宽单价Query historical bandwidth unit prices
10getblock通过区块高度或区块 ID 查询区块信息。用法: getblock <blockNumberblockId
11getblockbyhash通过区块 ID 查询区块信息。用法: getblock Query block information by block ID. Usage: getblock
12getblockbynumber通过区块高度查询区块信息。用法: getblockbynumber Query block information by block height. Usage: getblockbynumber
13getblockrange通过区块高度区间查询区块信息。用法: getblockrange <startBlockNumber, endBlockNumber>Query block information by block height range. Usage: getblockrange <startBlockNumber, endBlockNumber>
14getblocktransactioncount检索区块内的交易数量。用法: getBlockTransactionCount <blockHeightblockHash
15getbrokerage获取 SR 经纪佣金比例。用法: getbrokerage
Get the SR brokerage commission ratio. Usage: getbrokerage
16getnodeinfo查询节点信息Query node information
17gettokenlistbyname通过代币名称 查询 TRC10 代币列表信息。用法: gettokenlistbyname Query TRC10 token list information by token name. Usage: gettokenlistbyname
18gettokenbyid通过代币 id 查询 TRC10 代币信息。用法: gettokenbyid Query TRC10 token information by token ID. Usage: gettokenbyid
19gettokenfromid通过代币 id 查询 TRC10 代币信息。用法: gettokenfromid Query TRC10 token information by token ID. Usage: gettokenfromid
20gettokensissuedbyaddress查询账户的 TRC10 代币发行信息。用法: gettokensissuedbyaddress <address: b58hex>
21gettransaction通过交易 id 查询交易信息。用法: gettransaction Query transaction information by transaction ID. Usage: gettransaction
22sendtoken交易 TRC10。用法: sendtoken <to: b58, amount: 1 (对应代币最小单位), tokenID: 代币 ID>Transfer TRC10 tokens. Usage: sendtoken <to: b58, amount: 1 (smallest token unit), tokenID: token ID>
23sendrawtransaction交易 TRX。用法: sendrawtransaction <to: b58, amount: 1 (单位: TRX)>Transfer TRX. Usage: sendrawtransaction <to: b58, amount: 1 (unit: TRX)>
24sendtrc20交易 TRC20(注意:此交易会消耗 100TRX)。用法: sendtrc20 <to: b58, amount: 代币数量, contractAddress: 合约地址>Transfer TRC20 tokens (Note: consumes 100 TRX). Usage: sendtrc20 <to: b58, amount: token amount, contractAddress: contract address>
25sign交易签名(并未广播上链)。用法: sign <from: b58, amount: 1 (单位 TRX), to: b58>Sign a transaction (not broadcasted). Usage: sign <from: b58, amount: 1 (unit TRX), to: b58>
26sendhextransaction交易签名(将上一步的 sign 广播上链)。用法: sendhextransaction Broadcast a signed transaction. Usage: sendhextransaction
27delegatebandwidth代理带宽。用法: delegatebandwidth <to: b58, amount>Delegate bandwidth. Usage: delegatebandwidth <to: b58, amount>
28undelegatebandwidth回收带宽。用法: undelegatebandwidth <from: b58, amount>Undelegate bandwidth. Usage: undelegatebandwidth <from: b58, amount>
29delegateenergy代理能量。用法: delegateenergy <to: b58, amount>Delegate energy. Usage: delegateenergy <to: b58, amount>
30undelegateenergy回收带宽。用法: undelegateenergy <from: b58, amount>Undelegate energy. Usage: undelegateenergy <from: b58, amount>
31frommnemonic根据助记词回复地址和私钥 用法: frommnemonic
32suntotrxsun to trx。用法: suntotrx Convert sun to TRX. Usage: suntotrx
33isaddressisAddress。用法: isaddress <address: b58hex>
34tobignumberto big number。用法: tobignumber Convert to big number. Usage: tobignumber
35todecimalto decimal: todecimal <value: 0x15>Convert to decimal. Usage: todecimal <value: 0x15>

项目还在开发中,命令尚未加完.如果你愿意,很乐意你参与其中加入新的命令

源码仓库

http://www.xdnf.cn/news/16224.html

相关文章:

  • ISAAC ROS 在Jetson Orin NX上的部署
  • Mkdocs相关插件推荐(原创+合作)
  • 目标导向的强化学习:问题定义与 HER 算法详解—强化学习(19)
  • 双非上岸985!专业课140分经验!信号与系统考研专业课140+上岸中南大学,通信考研小马哥
  • Zookeeper 3.6.3【详细技术讲解】整
  • Day 3: 机器学习进阶算法与集成学习
  • GPU服务器与PC 集群(PC农场):科技算力双子星
  • IPv6网络排障详细步骤指南(附工具命令+配置检查点+典型案例)
  • Jenkins中HTML文件显示样式问题解决方案
  • linux修改用户名和主目录及权限-linux029
  • 初识JVM--从Java文件到机器指令
  • 百度蜘蛛池解析机制:原创
  • 视频质量检测效率提升28%!陌讯多模态融合方案在流媒体场景的技术实践
  • Python之--集合
  • C#(数据类型)
  • 冠捷科技 | 内生外化,精准触达,实现数字化转型精准赋能
  • Matlab中的 for 与while是有区别的
  • geomtry空间索引sql查询慢优化
  • Android 的16 KB内存页设备需要硬件支持吗,还是只需要手机升级到Android15系统就可以
  • [python][基础]Flask 技术栈
  • 软件工程之可行性研究:从理论到实践的全面解析
  • JAVA知识点(四):SpringBoot与分布式、微服务架构
  • 腾讯云CodeBuddy+微信小程序:5分钟开发番茄小闹钟
  • ClickHouse 高性能实时分析数据库-物化视图篇
  • 【lucene】如何给StandardAnalyzer添加charfilter
  • P1106 删数问题 - 洛谷
  • Multiscale Structure Guided Diffusion for Image Deblurring 论文阅读
  • 用友ERP 反射xss漏洞复现(CVE-2025-2709)
  • [NLP]多电源域设计的仿真验证方法
  • Linux运维新人自用笔记(Rsync远程传输备份,服务端、邮箱和客户端配置、脚本)