# nakajs-tx

> An simple module for creating, manipulating, and signing Naka transactions

Latest version **1.1.0** (published 2018-11-30) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install nakajs-tx
pnpm add nakajs-tx
yarn add nakajs-tx
bun add nakajs-tx
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-11-30 |
| First published | 2018-11-22 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 43.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Deric Walintukan |
| Maintainers | dwalintukan |
| Keywords | nakachain, naka, transactions, signer |

## Links

- npm: https://www.npmjs.com/package/nakajs-tx
- Repository: https://github.com/nakachain/nakajs-tx
- Issues: https://github.com/nakachain/nakajs-tx/issues
- npm.io page: https://npm.io/package/nakajs-tx

## Dependencies (2)

- [ethereum-common](https://npm.io/package/ethereum-common.md) ^0.0.18
- [ethereumjs-util](https://npm.io/package/ethereumjs-util.md) ^5.0.0

## Recent versions

- 1.1.0 (latest) — 2018-11-30
- 1.0.2 — 2018-11-22

## README

[![NPM Package](https://img.shields.io/npm/v/nakajs-tx.svg?style=flat-square)](https://www.npmjs.org/package/nakajs-tx)

# INSTALL
```
npm install nakajs-tx
```

# USAGE
```javascript
const Transaction = require('nakajs-tx');

// Without pay by token fields
const txParams = {
  nonce: '0x00',
  gasPrice: '0xB165100C4', 
  gasLimit: '0x5208',
  to: '0x0000000000000000000000000000000000000000', 
  value: '0x00', 
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
  chainId: 25
};

// With pay by token fields
const txParams = {
  nonce: "0x0",
  gasLimit: "0xB165100C4",
  gasPrice: "0x5208",
  to: "0x1111111111111111111111111111111111111111",
  value: "0x0",
  data: "0x2bdb7097000000000000000000000000c891d581be98880cce6a10f26af2e4cf4e730bbb0000000000000000000000000000000000000000000000000DE0B6B3A7640000",
  token: "0xc891d581be98880cce6a10f26af2e4cf4e730bbb",
  exchanger: "0x8102c0ecece895b8fefbddf42b95b7a20925b0c8",
  exchangeRate: "0xDE0B6B3A7640000",
  chainId: 25
};

const tx = new Transaction(txParams);
const privateKey = Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex');
tx.sign(privateKey);
const serializedTx = tx.serialize();
```

**Note:** this package expects ECMAScript 6 (ES6) as a minimum environment. From browsers lacking ES6 support, please use a shim (like [es6-shim](https://github.com/paulmillr/es6-shim)) before including any of the builds from this repo.

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