npm package: @kompose-app/hw-app-klaytn
Description: Ledger Hardware Wallet Klaytn Application API
Latest version: 1.5.0

## @kompose-app/hw-app-klaytn

Ledger Hardware Wallet Klaytn JavaScript bindings.

## API

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

#### Table of Contents

-   [Klaytn](#klaytn)
    -   [Parameters](#parameters)
    -   [Examples](#examples)
    -   [getAddress](#getaddress)
        -   [Parameters](#parameters-1)
        -   [Examples](#examples-1)
    -   [provideKctTokenInformation](#providekcttokeninformation)
        -   [Parameters](#parameters-2)
        -   [Examples](#examples-2)
    -   [signTransaction](#signtransaction)
        -   [Parameters](#parameters-3)
        -   [Examples](#examples-3)
    -   [getAppConfiguration](#getappconfiguration)
    -   [signPersonalMessage](#signpersonalmessage)
        -   [Parameters](#parameters-4)
        -   [Examples](#examples-4)
-   [KCT](#kct)
    -   [Examples](#examples-5)
    -   [byContractAddress](#bycontractaddress)
        -   [Parameters](#parameters-5)
    -   [list](#list)

### Klaytn

Klaytn API

#### Parameters

-   `transport` **Transport&lt;any>** 
-   `scrambleKey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**  (optional, default `"klaytn"`)

#### Examples

```javascript
import Klaytn from "@kompose-app/hw-app-klaytn";
const klay = new Klaytn(transport)
```

#### getAddress

get Klaytn legacy account address for a given BIP 32 path.

##### Parameters

-   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP 32 format
-   `boolDisplay` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** 
-   `boolChaincode` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** 

##### Examples

```javascript
klay.getAddress("44'/8217'/0'/0/0").then(o => o.address)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;{publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), address: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), chainCode: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?}>** an object with a publicKey, address and (optionally) chainCode

#### provideKctTokenInformation

This commands provides a trusted description of an KCT token
to associate a contract address with a ticker and number of decimals.

It shall be run immediately before performing a transaction involving a contract
calling this contract address to display the proper token information to the user if necessary.

##### Parameters

-   `info` **any** : a blob from "kct.js" utilities that contains all token information.
    -   `info.data`  

##### Examples

```javascript
import { byContractAddress } from "@kompose-app/hw-app-klaytn/kct"
const kusdInfo = byContractAddress("0x5faad3204b3ca681a6a312e15ff52a4cc76ade06")
if (kusdInfo) await klay.provideKctTokenInformation(kusdInfo)
const signed = await klay.signTransaction(path, rawTxHex)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** 

#### signTransaction

You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign

##### Parameters

-   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `rawTxHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

##### Examples

```javascript
klay.signTransaction("44'/8217'/0'/0/0", "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080").then(result => ...)
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** 

#### getAppConfiguration

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;{arbitraryDataEnabled: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), kctProvisioningNecessary: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), version: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** 

#### signPersonalMessage

You can sign a message according to klay_sign RPC call and retrieve v, r, s given the message and the BIP 32 path of the account to sign.

##### Parameters

-   `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `messageHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

##### Examples

```javascript
klay.signPersonalMessage("44'/8217'/0'/0/0", Buffer.from("test").toString("hex")).then(result => {
var v = result['v'] - 27;
v = v.toString(16);
if (v.length < 2) {
v = "0" + v;
}
console.log("Signature 0x" + result['r'] + result['s'] + v);
})
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>** 

### KCT

Klaytn KCT Tokens

#### Examples

```javascript
import KCT from "@kompose-app/hw-app-klaytn/kct";
const kctList = new KCT().list();
```

#### byContractAddress

Retrieve the token information by a given contract address if any

##### Parameters

-   `contract` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

Returns **TokenInfo?** 

#### list

List all the KCT tokens informations

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;TokenInfo>**