# @cobo/tron

> ![travis](https://travis-ci.org/cobowallet/tron-wallet.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/cobowallet/tron-wallet/badge.svg?branch=master)](https://coveralls.io/github/cobowallet/tron-wallet?branch=master) [![JavaScrip

Latest version **0.2.3** (published 2019-11-12) · 0 weekly downloads

## Install

```sh
npm install @cobo/tron
pnpm add @cobo/tron
yarn add @cobo/tron
bun add @cobo/tron
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2019-11-12 |
| First published | 2018-05-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 12 |
| Unpacked size | 2.4 MB |
| Known vulnerabilities | 0 (+13 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | cobowallet |

## Links

- npm: https://www.npmjs.com/package/@cobo/tron
- npm.io page: https://npm.io/package/@cobo/tron

## Dependencies (12)

- [qs](https://npm.io/package/qs.md) 6.5.1
- [wif](https://npm.io/package/wif.md) 2.0.6
- [bs58](https://npm.io/package/bs58.md) 4.0.1
- [bip39](https://npm.io/package/bip39.md) 2.5.0
- [hdkey](https://npm.io/package/hdkey.md) 0.8.0
- [jssha](https://npm.io/package/jssha.md) 2.3.1
- [ethers](https://npm.io/package/ethers.md) ^4.0.13
- [js-sha3](https://npm.io/package/js-sha3.md) 0.7.0
- [elliptic](https://npm.io/package/elliptic.md) 6.4.1
- [secp256k1](https://npm.io/package/secp256k1.md) 3.5.0
- [safe-buffer](https://npm.io/package/safe-buffer.md) 5.1.1
- [@tronscan/client](https://npm.io/package/@tronscan/client.md) github:cobowallet/tronscan-node-client

## Recent versions

- 0.2.3 (latest) — 2019-11-12
- 0.2.2 — 2018-12-06
- 0.2.1 — 2018-11-26
- 0.1.11 — 2018-11-12
- 0.1.10 — 2018-10-09
- 0.1.9 — 2018-10-09
- 0.1.7 — 2018-06-04
- 0.1.6 — 2018-06-01
- 0.1.5 — 2018-05-30
- 0.1.4 — 2018-05-27
- 0.1.3 — 2018-05-26
- 0.1.1 — 2018-05-04
- 0.1.0 — 2018-05-04

## README

# Tron HDWallet

![travis](https://travis-ci.org/cobowallet/tron-wallet.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/cobowallet/tron-wallet/badge.svg?branch=master)](https://coveralls.io/github/cobowallet/tron-wallet?branch=master)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

You will create a tron HD instance and use the methods of the instance:

```
yarn add @cobo/tron
```

**Static Methods:**

* `fromMasterSeed` - Create HD instance from a master seed
* `fromExtendedKey` - Create HD instance from a base58 string
* `fromMnemonic` - Create HD instance from a mnemonic
* `fromPrivateKey` - Create HD instance from a private key
* `generateMnemonic` - Generate new mnemonic, or you can use `bip39` directly

**Instance Methods:**

* `derivePath` - Return a derived HD node instance use a path (`"m/44'/194'/0'/0/0"`)
* `deriveChild` - Return a derived HD node instance
* `getPrivateExtendedKey` - Return the private extend key (base58)
* `getPublicExtendedKey` - Return the public extend key (base58)
* `getAddress` - Return the tron address
* `signMessage` - Retrun signed message
* `verfiyMessage` - verify the Signature
* `generateTransaction` - Return a tron transaction
  * `to` - the address you want to send to
  * `amount` - 1000000 = 1 TRX
  * `token` - default is TRX
  * `latestBlock` - lastest tron block from any api backend
* `freeze` - Freeze to get TRON power
  * `amount` - int, 1000000 = 1 TRX
  * `duration` - int, how many days, default is 3
  * `latestBlock` - lastest block info
* `unfreeze` - Unfreeze all the TRX
  * `latestBlock` - lastest block info

```JavaScript
const latestBlock = {
  hash: 'e996dc5c0ecc96773d31d1cdd6e9db3140cdfcd6fcdbaadfc65ab3e4ad7b352f',
  number: 195022,
  timestamp: 1527312435000
}
return Tron
  .fromMnemonic('alice loves bob')
  .generateTransaction(latestBlock, '27Vsbb84NX6hNgR7kAGwi74BAXV7TdCcHTp', 100000000)
```

### Examples

See `test/test.js` for detail usage

---
_Source: https://npm.io/package/@cobo/tron · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
