UNPKG

@fluent-wallet/hw-app-conflux

Version:

Ledger Hardware Wallet Conflux Application API

99 lines (63 loc) 3.94 kB
## @fluent-wallet/hw-app-conflux Ledger Hardware Wallet Conflux JavaScript bindings. ## API <!-- Generated by documentation.js. Update this documentation by updating the source code. --> #### Table of Contents - [@fluent-wallet/hw-app-conflux](#fluent-wallethw-app-conflux) - [API](#api) - [Table of Contents](#table-of-contents) - [Conflux](#conflux) - [Parameters](#parameters) - [Examples](#examples) - [getAddress](#getaddress) - [Parameters](#parameters-1) - [Examples](#examples-1) - [signTransaction](#signtransaction) - [Parameters](#parameters-2) - [Examples](#examples-2) - [signPersonalMessage](#signpersonalmessage) - [Parameters](#parameters-3) - [Examples](#examples-3) ### Conflux Conflux API #### Parameters * `transport` **Transport** * `scrambleKey` (optional, default `"conflux_default_scramble_key"`) #### Examples ```javascript import Cfx from "@fluent-wallet/hw-app-conflux"; const cfx = new Cfx(transport) ``` #### getAddress get Conflux 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 cfx.getAddress("44'/503'/0'/0/0").then(o => o.publicKey) ``` Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{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 #### 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 cfx.signTransaction("44'/503'/0'/0/0", "0xeb1284561f61b9831e84809410109fc8df283027b6285cc889f5aa624eac1f55843b9aca0081800182040580").then(result => ...) ``` Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), v: [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)}>** #### signPersonalMessage You can sign a message 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 cfx.signPersonalMessage("44'/503'/0'/0/0", Buffer.from("test").toString("hex")).then(result => { console.log(result); }) ``` Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{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)}>**