https://github.com/pontem-network/hw-app-aptos
https://github.com/pontem-network/hw-app-aptos
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/pontem-network/hw-app-aptos
- Owner: pontem-network
- Created: 2022-11-07T13:37:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-18T19:11:09.000Z (over 2 years ago)
- Last Synced: 2025-03-30T18:13:33.424Z (about 2 months ago)
- Language: TypeScript
- Size: 158 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Aptos Hardware Wallet Example
#### Table of Contents
* [Aptos](#aptos)
* [Parameters](#parameters)
* [Examples](#examples)
* [getVersion](#getversion)
* [Examples](#examples-1)
* [getAddress](#getaddress)
* [Parameters](#parameters-1)
* [Examples](#examples-2)
* [signTransaction](#signtransaction)
* [Parameters](#parameters-2)
* [Examples](#examples-3)#### Parameters
* `transport` **Transport** a transport for sending commands to a device
* `scrambleKey` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a scramble key (optional, default `"aptos"`)#### Examples
```javascript
import Aptos from "hw-app-aptos";
const aptos = new Aptos(transport);
```#### getVersion
Get application version.
##### Examples
```javascript
aptos.getVersion().then(r => r.version)
```Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\** an object with the version field
#### getAddress
Get Aptos address (public key) for a BIP32 path.
Because Aptos uses Ed25519 keypairs, as per SLIP-0010
all derivation-path indexes will be promoted to hardened indexes.##### 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 (optional, default `false`)##### Examples
```javascript
aptos.getAddress("m/44'/637'/1'/0'/0'").then(r => r.address)
```Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\** an object with publicKey, chainCode, address fields
#### signTransaction
Sign an Aptos transaction.
##### Parameters
* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a BIP32 path
* `txBuffer` **[Buffer](https://nodejs.org/api/buffer.html)** serialized transaction##### Examples
```javascript
aptos.signTransaction("m/44'/637'/1'/0'/0'", txBuffer).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)}>** an object with the signature field