@ledgerhq/hw-app-str
Advanced tools
Comparing version 4.8.0-rc1.1b178f67 to 4.11.1
{ | ||
"name": "@ledgerhq/hw-app-str", | ||
"version": "4.8.0-rc1.1b178f67", | ||
"version": "4.11.1", | ||
"description": "Ledger Hardware Wallet Stellar Application API", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ledgerhq/hw-transport": "^4.8.0-rc1.1b178f67", | ||
"@ledgerhq/hw-transport": "^4.7.3", | ||
"base32.js": "^0.1.0", | ||
@@ -31,0 +31,0 @@ "crc": "^3.5.0", |
@@ -9,5 +9,8 @@ <img src="https://user-images.githubusercontent.com/211411/34776833-6f1ef4da-f618-11e7-8b13-f0697901d6a8.png" height="100" /> | ||
```js | ||
// when using "@ledgerhq/hw-transport-node-hid" library you need to go to | ||
// Settings -> Browser support in ledger stellar app and set this setting to 'No' | ||
import Transport from "@ledgerhq/hw-transport-node-hid"; | ||
// import Transport from "@ledgerhq/hw-transport-u2f"; // for browser | ||
import Str from "@ledgerhq/hw-app-str"; | ||
import StellarSdk from "stellar-sdk"; | ||
@@ -28,6 +31,16 @@ const getStrAppVersion = async () => { | ||
}; | ||
getStrPublicKey().then(pk => console.log(pk)); | ||
let publicKey; | ||
getStrPublicKey().then(pk => { | ||
console.log(pk); | ||
publicKey = pk; | ||
}); | ||
const signStrTransaction = async () => { | ||
const transaction = ...; | ||
const signStrTransaction = async (publicKey) => { | ||
const transaction = new StellarSdk.TransactionBuilder({accountId: () => publicKey, sequenceNumber: () => '1234', incrementSequenceNumber: () => null}) | ||
.addOperation(StellarSdk.Operation.createAccount({ | ||
source: publicKey, | ||
destination: 'GBLYVYCCCRYTZTWTWGOMJYKEGQMTH2U3X4R4NUI7CUGIGEJEKYD5S5OJ', // SATIS5GR33FXKM7HVWZ2UQO33GM66TVORZUEF2HPUQ3J7K634CTOAWQ7 | ||
startingBalance: '11.331', | ||
})) | ||
.build(); | ||
const transport = await Transport.create(); | ||
@@ -40,3 +53,3 @@ const str = new Str(transport); | ||
const hint = keyPair.signatureHint(); | ||
const decorated = new StellarSdk.xdr.DecoratedSignature({hint: hint, signature: signature}); | ||
const decorated = new StellarSdk.xdr.DecoratedSignature({hint: hint, signature: result.signature}); | ||
transaction.signatures.push(decorated); | ||
@@ -46,3 +59,3 @@ | ||
} | ||
signStrTransaction().then(s => console.log(s.toString('hex'))); | ||
signStrTransaction(publicKey).then(transaction => console.log(transaction.toEnvelope().toXDR().toString('base64'))); | ||
``` | ||
@@ -49,0 +62,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
76397
18
1184
0
63