npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tron-wallets

v0.1.2

Published

## 集成

Readme

TRON-WALLETS

集成

npm install tron-wallets
yarn add tron-wallets
// 实例化
let client = new Tron();

初始化

init 初始化参数

client.init({
    query: () => {
        return new Promise((resolve, reject) => {
            resolve(JSON.parse(localStorage.getItem('asset')));
        })
    },
    store: (data) => {
        localStorage.setItem('asset', JSON.stringify(data));
    },
    redux: (data) => {
        console.log(data)
    }
});

|属性|说明|类型|默认值| |-|-|-|-| |query|查询钱包数据的方法|Function(返回一个Promise)|无| |store|存储钱包数据的方法|Function|无| |redux|数据更新的回调|Function|无|

返回 data

{
    "wallets": {
        "TQZnT1qEjCydyFm2w7kvWDJFeJBZV5n364": {
            "name": "hallo",
            "active": true,
            "privateKey": "631EFE989A1C9BB6104553B62D708BEB71C5985D80BD64C3A47ED6F4A591E83C",
            "address": "TQZnT1qEjCydyFm2w7kvWDJFeJBZV5n364",
            "frozen": 20,
            "account": {
                "NetUsed": 200,
                "NetLimit": 400,
                "EnergyUsed": 200,
                "EnergyLimit": 400
            },
            "tokens": [{
                "name": "test",
                "logo": "logo",
                "abbr": "tt",
                "type": "trc10",
                "balance": 20,
                "cny": 200,
                "usd": 1200,
                "official": 1
            }]
        },
        "TPW5omvVNX7a1NXiXxU36tvMeh1kXnzrfW": {
            "name": "hallo",
            "active": false,
            "privateKey": "016A0572B805706261380ADD1F23D500C735F92B888FA24F4587AC1EAB7DE181",
            "address": "TPW5omvVNX7a1NXiXxU36tvMeh1kXnzrfW",
            "tokens": []
        }
    },
    "active": "TQZnT1qEjCydyFm2w7kvWDJFeJBZV5n364"
}

创建

generateMnemonicAccount 生成助记词私钥

Tron.generateMnemonicAccount();

返回数据格式

{
    "mnemonic": "symbol emotion carbon course drama trumpet suffer silk humble length movie now",
    "privateKey": "2dba64b281f7217d3293e7ac1c3f0a2a5ad078d092672efa9080631342f2abef"
}

generateWallet 添加钱包

client.generateWallet(name, active, privateKey, address, mnemonic);

|属性|说明|类型|必填|默认值| |-|-|-|-|-| |name|钱包名|String|必填|无| |active|是否为当前激活钱包|Boolean|必填|无| |privateKey|钱包私钥|String|必填|无| |address|钱包地址|String|必填|无| |mnemonic|钱包助记词|String|非必填|空|


工具

判断助记词是否合法

utils.isValidMnemonic(mnemonic);

判断私钥是否合法

utils.isValidPrivateKey(pk);

判断地址是否合法

utils.isAddress(address);

获取数据

getInfo 查询数据

client.getInfo(type)

|type|说明|示例| |-|-|-|-| |asset|资产详情|{wallets: {}, active: ''}| |wallets|钱包数组|[{}, {}]| |wallet|当前激活钱包|{}| |address|当前激活钱包地址|''|