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

与 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.lryc.cn/news/600081.html

相关文章:

  • 关闭chrome自带的跨域限制,简化本地开发
  • 【Chrome】下载chromedriver的地址
  • 中国航天集团实习第一周总结
  • 低速信号设计之 SWD 篇
  • 随机抽签服务API集成指南
  • python学习DAY22打卡
  • 如何评估一个RWA项目的可信度?关键指标解析
  • 图书推荐-由浅入深的大模型构建《从零构建大模型》
  • C语言————原码 补码 反码 (日渐清晰版)
  • openGauss数据库在CentOS 7 中的单机部署与配置
  • 在幸狐RV1106板子上用gcc14.2本地编译安装ssh客户端/服务器、vim编辑器、sl和vsftpd服务器
  • 基础很薄弱如何规划考研
  • 解密负载均衡:如何轻松提升业务性能
  • QT开发---多线程编程
  • 【SpringAI实战】ChatPDF实现RAG知识库
  • XORIndex:朝鲜不断发展的供应链恶意软件再次瞄准 npm 生态系统
  • 从分治的思想下优化快速排序算法
  • 免模型控制
  • 蓝桥杯java算法例题
  • 计算机网络(第八版)— 第2章课后习题参考答案
  • [NLP]多电源域设计的仿真验证方法
  • 数字化转型-AI落地金字塔法则
  • 【日志】unity俄罗斯方块——边界限制检测
  • 深度学习篇---图像数据采集
  • 【VLAs篇】06:从动作词元化视角谈VLA模型的综述
  • JavaSE-图书信息管理系统
  • 9 个优秀帮助中心案例:打造提升客户体验的自助支持系统
  • Allegro软件光绘文件Artwork到底如何配置?
  • 飞算JavaAI“删除接口信息” 功能:3 步清理冗余接口,让管理效率翻倍
  • Android Ntp系统校时流程