<img src="https://user-images.githubusercontent.com/4631227/191834116-59cf590e-25cc-4956-ae5c-812ea464f324.png" height="100" />

[GitHub](https://github.com/LedgerHQ/ledger-live/),
[Ledger Devs Discord](https://developers.ledger.com/discord-pro),
[Developer Portal](https://developers.ledger.com/)

## @ledgerhq/hw-app-helium

Ledger Hardware Wallet Helium JavaScript bindings.

***

## Are you adding Ledger support to your software wallet?

You may be using this package to communicate with the Helium Nano App.

For a smooth and quick integration:

*   See the developers’ documentation on the [Developer Portal](https://developers.ledger.com/docs/transport/overview/) and
*   Go on [Discord](https://developers.ledger.com/discord-pro/) to chat with developer support and the developer community.

***

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

*   [Helium](#helium)
    *   [Parameters](#parameters)
    *   [Examples](#examples)
    *   [getVersion](#getversion)
        *   [Examples](#examples-1)
    *   [getAddress](#getaddress)
        *   [Parameters](#parameters-1)
        *   [Examples](#examples-2)
    *   [signPaymentV2](#signpaymentv2)
        *   [Parameters](#parameters-2)
        *   [Examples](#examples-3)
    *   [signTokenBurnV1](#signtokenburnv1)
        *   [Parameters](#parameters-3)
        *   [Examples](#examples-4)
    *   [signStakeValidatorV1](#signstakevalidatorv1)
        *   [Parameters](#parameters-4)
        *   [Examples](#examples-5)
    *   [signUnstakeValidatorV1](#signunstakevalidatorv1)
        *   [Parameters](#parameters-5)
        *   [Examples](#examples-6)
    *   [signTransferValidatorStakeV1](#signtransfervalidatorstakev1)
        *   [Parameters](#parameters-6)
        *   [Examples](#examples-7)
    *   [signSecurityExchangeV1](#signsecurityexchangev1)
        *   [Parameters](#parameters-7)
        *   [Examples](#examples-8)

### Helium

Helium API

#### Parameters

*   `transport` **Transport** a transport for sending commands to a device
*   `scrambleKey`  a scramble key (optional, default `"helium_default_scramble_key"`)

#### Examples

```javascript
import Helium from "@ledgerhq/hw-app-helium";
const helium = new Helium(transport);
```

#### getVersion

Get application version.

##### Examples

```javascript
helium.getVersion().then(r => r.version)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{version: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** version object

#### getAddress

Get Helium address (public key) for a BIP32 path.

##### Parameters

*   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a BIP32 path
*   `display` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** flag to show display
*   `accountIndex`  index of account address (optional, default `0`)

##### Examples

```javascript
helium.getAddress("44'/904'/0'/0'/0'").then(r => r.address)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{index: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), address: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** an object with the address field

#### signPaymentV2

Sign a Helium `PaymentV2` transaction.

##### Parameters

*   `txn` **PaymentV2** a PaymentV2 transaction
*   `accountIndex`  index of account address (optional, default `0`)

##### Examples

```javascript
import { PaymentV2 } from '@helium/transactions'
const txn = new PaymentV2({ ... })
helium.signTransaction(txn).then(r => r.signature)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{signature: [Buffer](https://nodejs.org/api/buffer.html), txn: PaymentV2}>** an object with the signed transaction and signature

#### signTokenBurnV1

Sign a Helium `TokenBurnV1` transaction.

##### Parameters

*   `txn` **TokenBurnV1** a TokenBurnV1 transaction
*   `accountIndex`  index of account address (optional, default `0`)

##### Examples

```javascript
import { TokenBurnV1 } from '@helium/transactions'
const txn = new TokenBurnV1({ ... })
helium.signTransaction(txn).then(r => r.signature)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{signature: [Buffer](https://nodejs.org/api/buffer.html), txn: TokenBurnV1}>** an object with the signed transaction and signature

#### signStakeValidatorV1

Sign a Helium `StakeValidatorV1` transaction.

##### Parameters

*   `txn` **StakeValidatorV1** a StakeValidatorV1 transaction
*   `accountIndex`  index of account address (optional, default `0`)

##### Examples

```javascript
import { StakeValidatorV1 } from '@helium/transactions'
const txn = new StakeValidatorV1({ ... })
helium.signTransaction(txn).then(r => r.signature)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{signature: [Buffer](https://nodejs.org/api/buffer.html), txn: StakeValidatorV1}>** an object with the signed transaction and signature

#### signUnstakeValidatorV1

Sign a Helium `UnstakeValidatorV1` transaction.

##### Parameters

*   `txn` **UnstakeValidatorV1** a UnstakeValidatorV1 transaction
*   `accountIndex`  index of account address (optional, default `0`)

##### Examples

```javascript
import { UnstakeValidatorV1 } from '@helium/transactions'
const txn = new UnstakeValidatorV1({ ... })
helium.signTransaction(txn).then(r => r.signature)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{signature: [Buffer](https://nodejs.org/api/buffer.html), txn: UnstakeValidatorV1}>** an object with the signed transaction and signature

#### signTransferValidatorStakeV1

Sign a Helium `TransferValidatorStakeV1` transaction.

##### Parameters

*   `txn` **TransferValidatorStakeV1** a TransferValidatorStakeV1 transaction
*   `ownerType` **(`"old"` | `"new"`)** whether to sign as the old or new owner in the transfer
*   `accountIndex`  index of account address (optional, default `0`)

##### Examples

```javascript
import { TransferValidatorStakeV1 } from '@helium/transactions'
const txn = new TransferValidatorStakeV1({ ... }, 'old')
helium.signTransaction(txn).then(r => r.signature)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{signature: [Buffer](https://nodejs.org/api/buffer.html), txn: TransferValidatorStakeV1}>** an object with the signed transaction and signature

#### signSecurityExchangeV1

Sign a Helium `SecurityExchangeV1` transaction.

##### Parameters

*   `txn` **SecurityExchangeV1** a SecurityExchangeV1 transaction
*   `accountIndex`  index of account address (optional, default `0`)

##### Examples

```javascript
import { SecurityExchangeV1 } from '@helium/transactions'
const txn = new SecurityExchangeV1({ ... })
helium.signTransaction(txn).then(r => r.signature)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{signature: [Buffer](https://nodejs.org/api/buffer.html), txn: SecurityExchangeV1}>** an object with the signed transaction and signature
