# @qiushaoxi/hw-app-ont

> Ledger Javascript API for ONT and NEO.

Latest version **1.0.6** (published 2019-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @qiushaoxi/hw-app-ont
pnpm add @qiushaoxi/hw-app-ont
yarn add @qiushaoxi/hw-app-ont
bun add @qiushaoxi/hw-app-ont
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2019-07-22 |
| First published | 2019-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 52.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | qiushaoxi |
| Maintainers | qiushaoxi |
| Keywords | Ledger, Javascript, ONT |

## Links

- npm: https://www.npmjs.com/package/@qiushaoxi/hw-app-ont
- Repository: https://github.com/qiushaoxi/hw-app-ont
- Homepage: https://github.com/qiushaoxi/hw-app-ont#readme
- Issues: https://github.com/qiushaoxi/hw-app-ont/issues
- npm.io page: https://npm.io/package/@qiushaoxi/hw-app-ont

## Dependencies (7)

- [elliptic](https://npm.io/package/elliptic.md) ^6.5.0
- [@types/long](https://npm.io/package/@types/long.md) ^4.0.0
- [@types/node](https://npm.io/package/@types/node.md) ^12.6.8
- [@types/elliptic](https://npm.io/package/@types/elliptic.md) ^6.4.9
- [ontology-ts-sdk](https://npm.io/package/ontology-ts-sdk.md) ^1.0.18
- [@ledgerhq/hw-transport-node-hid](https://npm.io/package/@ledgerhq/hw-transport-node-hid.md) ^4.68.0
- [@types/ledgerhq__hw-transport-node-hid](https://npm.io/package/@types/ledgerhq__hw-transport-node-hid.md) ^4.22.1

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [stockfish](https://npm.io/package/stockfish.md) — 27.0K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2019-07-22
- 1.0.5 — 2019-07-22
- 1.0.4 — 2019-07-22
- 1.0.3 — 2019-07-22
- 1.0.2 — 2019-07-22

## README

# Ledger javascript API for ONT and NEO

## Usage

```typescript
require("babel-polyfill");
import TransportNodeHid from "@ledgerhq/hw-transport-node-hid";
import HwAppOnt from "@qiushaoxi/hw-app-ont";
import { Crypto, Transaction, utils } from 'ontology-ts-sdk';

export class OntLedgerSigner {
    path: string
    transport: any
    app: any
    constructor(path: string) {
        this.path = path
    }
    async init() {
        this.transport = await TransportNodeHid.open("");
        this.app = new HwAppOnt(this.transport);
    }
    async close() {
        await this.transport.close()
    }
    async sign(transaction: Transaction): Promise<Crypto.Signature> {
        const unsignedData = transaction.serializeUnsignedData();
        const result = await this.app.signMessage(this.path, unsignedData);
        const ontSignature = new Crypto.Signature(Crypto.SignatureScheme.ECDSAwithSHA256, result);
        const signatureHex = ontSignature.serializeHex();
        console.log(signatureHex);
        return ontSignature;
    }
    async getPublicKey(): Promise<Crypto.PublicKey> {
        const publicKeyStr = await this.app.getPublicKey(this.path);
        console.log(publicKeyStr);
        const publicKey = Crypto.PublicKey.deserializeHex(new utils.StringReader(publicKeyStr))
        console.log(publicKey.serializeHex())
        return publicKey;
    }
};
```

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