@ledgerhq/hw-app-btc 6.24.0 → 6.24.2-monorepo.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +19 -0
- package/jest.config.ts +6 -0
- package/lib/Btc.d.ts +0 -0
- package/lib/Btc.d.ts.map +0 -0
- package/lib/Btc.js +5 -1
- package/lib/Btc.js.map +1 -1
- package/lib/BtcNew.d.ts +0 -0
- package/lib/BtcNew.d.ts.map +0 -0
- package/lib/BtcNew.js +0 -0
- package/lib/BtcNew.js.map +0 -0
- package/lib/BtcOld.d.ts +0 -0
- package/lib/BtcOld.d.ts.map +0 -0
- package/lib/BtcOld.js +0 -0
- package/lib/BtcOld.js.map +0 -0
- package/lib/bip32.d.ts +0 -0
- package/lib/bip32.d.ts.map +1 -1
- package/lib/bip32.js +0 -0
- package/lib/bip32.js.map +1 -1
- package/lib/buffertools.d.ts +0 -0
- package/lib/buffertools.d.ts.map +0 -0
- package/lib/buffertools.js +0 -0
- package/lib/buffertools.js.map +0 -0
- package/lib/compressPublicKey.d.ts +0 -0
- package/lib/compressPublicKey.d.ts.map +0 -0
- package/lib/compressPublicKey.js +0 -0
- package/lib/compressPublicKey.js.map +0 -0
- package/lib/constants.d.ts +0 -0
- package/lib/constants.d.ts.map +0 -0
- package/lib/constants.js +0 -0
- package/lib/constants.js.map +0 -0
- package/lib/createTransaction.d.ts +0 -0
- package/lib/createTransaction.d.ts.map +0 -0
- package/lib/createTransaction.js +0 -0
- package/lib/createTransaction.js.map +0 -0
- package/lib/debug.d.ts +0 -0
- package/lib/debug.d.ts.map +0 -0
- package/lib/debug.js +0 -0
- package/lib/debug.js.map +0 -0
- package/lib/finalizeInput.d.ts +0 -0
- package/lib/finalizeInput.d.ts.map +0 -0
- package/lib/finalizeInput.js +0 -0
- package/lib/finalizeInput.js.map +0 -0
- package/lib/getAppAndVersion.d.ts +0 -0
- package/lib/getAppAndVersion.d.ts.map +0 -0
- package/lib/getAppAndVersion.js +0 -0
- package/lib/getAppAndVersion.js.map +0 -0
- package/lib/getTrustedInput.d.ts +0 -0
- package/lib/getTrustedInput.d.ts.map +1 -1
- package/lib/getTrustedInput.js +0 -0
- package/lib/getTrustedInput.js.map +1 -1
- package/lib/getTrustedInputBIP143.d.ts +0 -0
- package/lib/getTrustedInputBIP143.d.ts.map +0 -0
- package/lib/getTrustedInputBIP143.js +0 -0
- package/lib/getTrustedInputBIP143.js.map +0 -0
- package/lib/getWalletPublicKey.d.ts +0 -0
- package/lib/getWalletPublicKey.d.ts.map +0 -0
- package/lib/getWalletPublicKey.js +0 -0
- package/lib/getWalletPublicKey.js.map +0 -0
- package/lib/hashPublicKey.d.ts +0 -0
- package/lib/hashPublicKey.d.ts.map +0 -0
- package/lib/hashPublicKey.js +0 -0
- package/lib/hashPublicKey.js.map +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.d.ts.map +0 -0
- package/lib/index.js +0 -0
- package/lib/index.js.map +0 -0
- package/lib/newops/accounttype.d.ts +0 -0
- package/lib/newops/accounttype.d.ts.map +0 -0
- package/lib/newops/accounttype.js +0 -0
- package/lib/newops/accounttype.js.map +0 -0
- package/lib/newops/appClient.d.ts +0 -0
- package/lib/newops/appClient.d.ts.map +1 -1
- package/lib/newops/appClient.js +1 -4
- package/lib/newops/appClient.js.map +1 -1
- package/lib/newops/clientCommands.d.ts +0 -0
- package/lib/newops/clientCommands.d.ts.map +0 -0
- package/lib/newops/clientCommands.js +0 -0
- package/lib/newops/clientCommands.js.map +0 -0
- package/lib/newops/merkelizedPsbt.d.ts +0 -0
- package/lib/newops/merkelizedPsbt.d.ts.map +0 -0
- package/lib/newops/merkelizedPsbt.js +0 -0
- package/lib/newops/merkelizedPsbt.js.map +0 -0
- package/lib/newops/merkle.d.ts +0 -0
- package/lib/newops/merkle.d.ts.map +0 -0
- package/lib/newops/merkle.js +0 -0
- package/lib/newops/merkle.js.map +0 -0
- package/lib/newops/merkleMap.d.ts +0 -0
- package/lib/newops/merkleMap.d.ts.map +0 -0
- package/lib/newops/merkleMap.js +0 -0
- package/lib/newops/merkleMap.js.map +0 -0
- package/lib/newops/policy.d.ts +0 -0
- package/lib/newops/policy.d.ts.map +0 -0
- package/lib/newops/policy.js +0 -0
- package/lib/newops/policy.js.map +0 -0
- package/lib/newops/psbtExtractor.d.ts +0 -0
- package/lib/newops/psbtExtractor.d.ts.map +0 -0
- package/lib/newops/psbtExtractor.js +0 -0
- package/lib/newops/psbtExtractor.js.map +0 -0
- package/lib/newops/psbtFinalizer.d.ts +0 -0
- package/lib/newops/psbtFinalizer.d.ts.map +0 -0
- package/lib/newops/psbtFinalizer.js +0 -0
- package/lib/newops/psbtFinalizer.js.map +0 -0
- package/lib/newops/psbtv2.d.ts +0 -0
- package/lib/newops/psbtv2.d.ts.map +1 -1
- package/lib/newops/psbtv2.js +0 -0
- package/lib/newops/psbtv2.js.map +1 -1
- package/lib/serializeTransaction.d.ts +0 -0
- package/lib/serializeTransaction.d.ts.map +0 -0
- package/lib/serializeTransaction.js +0 -0
- package/lib/serializeTransaction.js.map +0 -0
- package/lib/shouldUseTrustedInputForSegwit.d.ts +0 -0
- package/lib/shouldUseTrustedInputForSegwit.d.ts.map +0 -0
- package/lib/shouldUseTrustedInputForSegwit.js +0 -0
- package/lib/shouldUseTrustedInputForSegwit.js.map +0 -0
- package/lib/signMessage.d.ts +0 -0
- package/lib/signMessage.d.ts.map +0 -0
- package/lib/signMessage.js +0 -0
- package/lib/signMessage.js.map +0 -0
- package/lib/signP2SHTransaction.d.ts +0 -0
- package/lib/signP2SHTransaction.d.ts.map +0 -0
- package/lib/signP2SHTransaction.js +0 -0
- package/lib/signP2SHTransaction.js.map +0 -0
- package/lib/signTransaction.d.ts +0 -0
- package/lib/signTransaction.d.ts.map +0 -0
- package/lib/signTransaction.js +0 -0
- package/lib/signTransaction.js.map +0 -0
- package/lib/splitTransaction.d.ts +0 -0
- package/lib/splitTransaction.d.ts.map +0 -0
- package/lib/splitTransaction.js +0 -0
- package/lib/splitTransaction.js.map +0 -0
- package/lib/startUntrustedHashTransactionInput.d.ts +0 -0
- package/lib/startUntrustedHashTransactionInput.d.ts.map +0 -0
- package/lib/startUntrustedHashTransactionInput.js +0 -0
- package/lib/startUntrustedHashTransactionInput.js.map +0 -0
- package/lib/types.d.ts +0 -0
- package/lib/types.d.ts.map +0 -0
- package/lib/types.js +0 -0
- package/lib/types.js.map +0 -0
- package/lib/varint.d.ts +0 -0
- package/lib/varint.d.ts.map +0 -0
- package/lib/varint.js +0 -0
- package/lib/varint.js.map +0 -0
- package/lib-es/Btc.d.ts +0 -0
- package/lib-es/Btc.d.ts.map +0 -0
- package/lib-es/Btc.js +0 -0
- package/lib-es/Btc.js.map +0 -0
- package/lib-es/BtcNew.d.ts +0 -0
- package/lib-es/BtcNew.d.ts.map +0 -0
- package/lib-es/BtcNew.js +0 -0
- package/lib-es/BtcNew.js.map +0 -0
- package/lib-es/BtcOld.d.ts +0 -0
- package/lib-es/BtcOld.d.ts.map +0 -0
- package/lib-es/BtcOld.js +0 -0
- package/lib-es/BtcOld.js.map +0 -0
- package/lib-es/bip32.d.ts +0 -0
- package/lib-es/bip32.d.ts.map +1 -1
- package/lib-es/bip32.js +0 -0
- package/lib-es/bip32.js.map +1 -1
- package/lib-es/buffertools.d.ts +0 -0
- package/lib-es/buffertools.d.ts.map +0 -0
- package/lib-es/buffertools.js +0 -0
- package/lib-es/buffertools.js.map +0 -0
- package/lib-es/compressPublicKey.d.ts +0 -0
- package/lib-es/compressPublicKey.d.ts.map +0 -0
- package/lib-es/compressPublicKey.js +0 -0
- package/lib-es/compressPublicKey.js.map +0 -0
- package/lib-es/constants.d.ts +0 -0
- package/lib-es/constants.d.ts.map +0 -0
- package/lib-es/constants.js +0 -0
- package/lib-es/constants.js.map +0 -0
- package/lib-es/createTransaction.d.ts +0 -0
- package/lib-es/createTransaction.d.ts.map +0 -0
- package/lib-es/createTransaction.js +0 -0
- package/lib-es/createTransaction.js.map +0 -0
- package/lib-es/debug.d.ts +0 -0
- package/lib-es/debug.d.ts.map +0 -0
- package/lib-es/debug.js +0 -0
- package/lib-es/debug.js.map +0 -0
- package/lib-es/finalizeInput.d.ts +0 -0
- package/lib-es/finalizeInput.d.ts.map +0 -0
- package/lib-es/finalizeInput.js +0 -0
- package/lib-es/finalizeInput.js.map +0 -0
- package/lib-es/getAppAndVersion.d.ts +0 -0
- package/lib-es/getAppAndVersion.d.ts.map +0 -0
- package/lib-es/getAppAndVersion.js +0 -0
- package/lib-es/getAppAndVersion.js.map +0 -0
- package/lib-es/getTrustedInput.d.ts +0 -0
- package/lib-es/getTrustedInput.d.ts.map +1 -1
- package/lib-es/getTrustedInput.js +0 -0
- package/lib-es/getTrustedInput.js.map +1 -1
- package/lib-es/getTrustedInputBIP143.d.ts +0 -0
- package/lib-es/getTrustedInputBIP143.d.ts.map +0 -0
- package/lib-es/getTrustedInputBIP143.js +0 -0
- package/lib-es/getTrustedInputBIP143.js.map +0 -0
- package/lib-es/getWalletPublicKey.d.ts +0 -0
- package/lib-es/getWalletPublicKey.d.ts.map +0 -0
- package/lib-es/getWalletPublicKey.js +0 -0
- package/lib-es/getWalletPublicKey.js.map +0 -0
- package/lib-es/hashPublicKey.d.ts +0 -0
- package/lib-es/hashPublicKey.d.ts.map +0 -0
- package/lib-es/hashPublicKey.js +0 -0
- package/lib-es/hashPublicKey.js.map +0 -0
- package/lib-es/index.d.ts +0 -0
- package/lib-es/index.d.ts.map +0 -0
- package/lib-es/index.js +0 -0
- package/lib-es/index.js.map +0 -0
- package/lib-es/newops/accounttype.d.ts +0 -0
- package/lib-es/newops/accounttype.d.ts.map +0 -0
- package/lib-es/newops/accounttype.js +0 -0
- package/lib-es/newops/accounttype.js.map +0 -0
- package/lib-es/newops/appClient.d.ts +0 -0
- package/lib-es/newops/appClient.d.ts.map +1 -1
- package/lib-es/newops/appClient.js +1 -4
- package/lib-es/newops/appClient.js.map +1 -1
- package/lib-es/newops/clientCommands.d.ts +0 -0
- package/lib-es/newops/clientCommands.d.ts.map +0 -0
- package/lib-es/newops/clientCommands.js +0 -0
- package/lib-es/newops/clientCommands.js.map +0 -0
- package/lib-es/newops/merkelizedPsbt.d.ts +0 -0
- package/lib-es/newops/merkelizedPsbt.d.ts.map +0 -0
- package/lib-es/newops/merkelizedPsbt.js +0 -0
- package/lib-es/newops/merkelizedPsbt.js.map +0 -0
- package/lib-es/newops/merkle.d.ts +0 -0
- package/lib-es/newops/merkle.d.ts.map +0 -0
- package/lib-es/newops/merkle.js +0 -0
- package/lib-es/newops/merkle.js.map +0 -0
- package/lib-es/newops/merkleMap.d.ts +0 -0
- package/lib-es/newops/merkleMap.d.ts.map +0 -0
- package/lib-es/newops/merkleMap.js +0 -0
- package/lib-es/newops/merkleMap.js.map +0 -0
- package/lib-es/newops/policy.d.ts +0 -0
- package/lib-es/newops/policy.d.ts.map +0 -0
- package/lib-es/newops/policy.js +0 -0
- package/lib-es/newops/policy.js.map +0 -0
- package/lib-es/newops/psbtExtractor.d.ts +0 -0
- package/lib-es/newops/psbtExtractor.d.ts.map +0 -0
- package/lib-es/newops/psbtExtractor.js +0 -0
- package/lib-es/newops/psbtExtractor.js.map +0 -0
- package/lib-es/newops/psbtFinalizer.d.ts +0 -0
- package/lib-es/newops/psbtFinalizer.d.ts.map +0 -0
- package/lib-es/newops/psbtFinalizer.js +0 -0
- package/lib-es/newops/psbtFinalizer.js.map +0 -0
- package/lib-es/newops/psbtv2.d.ts +0 -0
- package/lib-es/newops/psbtv2.d.ts.map +1 -1
- package/lib-es/newops/psbtv2.js +0 -0
- package/lib-es/newops/psbtv2.js.map +1 -1
- package/lib-es/serializeTransaction.d.ts +0 -0
- package/lib-es/serializeTransaction.d.ts.map +0 -0
- package/lib-es/serializeTransaction.js +0 -0
- package/lib-es/serializeTransaction.js.map +0 -0
- package/lib-es/shouldUseTrustedInputForSegwit.d.ts +0 -0
- package/lib-es/shouldUseTrustedInputForSegwit.d.ts.map +0 -0
- package/lib-es/shouldUseTrustedInputForSegwit.js +0 -0
- package/lib-es/shouldUseTrustedInputForSegwit.js.map +0 -0
- package/lib-es/signMessage.d.ts +0 -0
- package/lib-es/signMessage.d.ts.map +0 -0
- package/lib-es/signMessage.js +0 -0
- package/lib-es/signMessage.js.map +0 -0
- package/lib-es/signP2SHTransaction.d.ts +0 -0
- package/lib-es/signP2SHTransaction.d.ts.map +0 -0
- package/lib-es/signP2SHTransaction.js +0 -0
- package/lib-es/signP2SHTransaction.js.map +0 -0
- package/lib-es/signTransaction.d.ts +0 -0
- package/lib-es/signTransaction.d.ts.map +0 -0
- package/lib-es/signTransaction.js +0 -0
- package/lib-es/signTransaction.js.map +0 -0
- package/lib-es/splitTransaction.d.ts +0 -0
- package/lib-es/splitTransaction.d.ts.map +0 -0
- package/lib-es/splitTransaction.js +0 -0
- package/lib-es/splitTransaction.js.map +0 -0
- package/lib-es/startUntrustedHashTransactionInput.d.ts +0 -0
- package/lib-es/startUntrustedHashTransactionInput.d.ts.map +0 -0
- package/lib-es/startUntrustedHashTransactionInput.js +0 -0
- package/lib-es/startUntrustedHashTransactionInput.js.map +0 -0
- package/lib-es/types.d.ts +0 -0
- package/lib-es/types.d.ts.map +0 -0
- package/lib-es/types.js +0 -0
- package/lib-es/types.js.map +0 -0
- package/lib-es/varint.d.ts +0 -0
- package/lib-es/varint.d.ts.map +0 -0
- package/lib-es/varint.js +0 -0
- package/lib-es/varint.js.map +0 -0
- package/package.json +15 -6
- package/src/bip32.ts +5 -3
- package/src/getTrustedInput.ts +2 -8
- package/src/newops/appClient.ts +8 -4
- package/src/newops/psbtv2.ts +13 -9
- package/LICENSE +0 -202
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/hw-app-btc",
|
|
3
|
-
"version": "6.24.
|
|
3
|
+
"version": "6.24.2-monorepo.1",
|
|
4
4
|
"description": "Ledger Hardware Wallet Bitcoin Application API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"types": "lib/Btc.d.ts",
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ledgerhq/hw-transport": "^6.
|
|
31
|
-
"@ledgerhq/logs": "^6.10.
|
|
30
|
+
"@ledgerhq/hw-transport": "^6.24.2-monorepo.1",
|
|
31
|
+
"@ledgerhq/logs": "^6.10.1-monorepo.1",
|
|
32
32
|
"bip32-path": "^0.4.2",
|
|
33
33
|
"bitcoinjs-lib": "^5.2.0",
|
|
34
34
|
"bs58": "^4.0.1",
|
|
35
|
+
"bs58check": "^2.1.2",
|
|
35
36
|
"invariant": "^2.2.4",
|
|
36
37
|
"ripemd160": "2",
|
|
37
38
|
"semver": "^7.3.5",
|
|
@@ -39,11 +40,19 @@
|
|
|
39
40
|
"tiny-secp256k1": "1.1.6",
|
|
40
41
|
"varuint-bitcoin": "1.1.2"
|
|
41
42
|
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@ledgerhq/hw-transport-mocker": "^6.24.2-monorepo.1",
|
|
45
|
+
"@ledgerhq/hw-transport-node-speculos": "^6.24.2-monorepo.1",
|
|
46
|
+
"axios": "^0.25.0"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec",
|
|
42
49
|
"scripts": {
|
|
43
50
|
"clean": "bash ../../script/clean.sh",
|
|
44
51
|
"build": "bash ../../script/build.sh",
|
|
45
52
|
"watch": "bash ../../script/watch.sh",
|
|
46
|
-
"doc": "bash ../../script/doc.sh"
|
|
53
|
+
"doc": "bash ../../script/doc.sh",
|
|
54
|
+
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx",
|
|
55
|
+
"test": "jest"
|
|
47
56
|
},
|
|
48
|
-
"gitHead": "b97c53ae460ea09aff7126733a9f2422357073b5"
|
|
49
|
-
}
|
|
57
|
+
"readme": "<img src=\"https://user-images.githubusercontent.com/211411/34776833-6f1ef4da-f618-11e7-8b13-f0697901d6a8.png\" height=\"100\" />\n\n[Github](https://github.com/LedgerHQ/ledgerjs/),\n[Ledger Devs Slack](https://ledger-dev.slack.com/)\n\n## @ledgerhq/hw-app-btc\n\nLedger Hardware Wallet BTC JavaScript bindings. Also supports many altcoins.\n\n## API\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n* [Btc](#btc)\n * [Parameters](#parameters)\n * [Examples](#examples)\n * [getWalletXpub](#getwalletxpub)\n * [Parameters](#parameters-1)\n * [getWalletPublicKey](#getwalletpublickey)\n * [Parameters](#parameters-2)\n * [Examples](#examples-1)\n * [signMessageNew](#signmessagenew)\n * [Parameters](#parameters-3)\n * [Examples](#examples-2)\n * [createPaymentTransactionNew](#createpaymenttransactionnew)\n * [Parameters](#parameters-4)\n * [Examples](#examples-3)\n * [signP2SHTransaction](#signp2shtransaction)\n * [Parameters](#parameters-5)\n * [Examples](#examples-4)\n * [splitTransaction](#splittransaction)\n * [Parameters](#parameters-6)\n * [Examples](#examples-5)\n * [serializeTransactionOutputs](#serializetransactionoutputs)\n * [Parameters](#parameters-7)\n * [Examples](#examples-6)\n* [impl](#impl)\n* [BtcNew](#btcnew)\n * [Parameters](#parameters-8)\n * [getWalletXpub](#getwalletxpub-1)\n * [Parameters](#parameters-9)\n * [getWalletPublicKey](#getwalletpublickey-1)\n * [Parameters](#parameters-10)\n * [createPaymentTransactionNew](#createpaymenttransactionnew-1)\n * [Parameters](#parameters-11)\n* [BtcOld](#btcold)\n * [Parameters](#parameters-12)\n * [Examples](#examples-7)\n * [getWalletPublicKey](#getwalletpublickey-2)\n * [Parameters](#parameters-13)\n * [Examples](#examples-8)\n * [signMessageNew](#signmessagenew-1)\n * [Parameters](#parameters-14)\n * [Examples](#examples-9)\n * [createPaymentTransactionNew](#createpaymenttransactionnew-2)\n * [Parameters](#parameters-15)\n * [Examples](#examples-10)\n * [signP2SHTransaction](#signp2shtransaction-1)\n * [Parameters](#parameters-16)\n * [Examples](#examples-11)\n* [CreateTransactionArg](#createtransactionarg)\n * [Properties](#properties)\n* [AddressFormat](#addressformat)\n* [AccountType](#accounttype)\n * [spendingCondition](#spendingcondition)\n * [Parameters](#parameters-17)\n * [setInput](#setinput)\n * [Parameters](#parameters-18)\n * [setOwnOutput](#setownoutput)\n * [Parameters](#parameters-19)\n * [getDescriptorTemplate](#getdescriptortemplate)\n* [SingleKeyAccount](#singlekeyaccount)\n* [getTaprootOutputKey](#gettaprootoutputkey)\n * [Parameters](#parameters-20)\n* [AppClient](#appclient)\n * [Parameters](#parameters-21)\n* [ClientCommandInterpreter](#clientcommandinterpreter)\n * [Parameters](#parameters-22)\n* [MerkelizedPsbt](#merkelizedpsbt)\n * [Parameters](#parameters-23)\n* [Merkle](#merkle)\n * [Parameters](#parameters-24)\n* [MerkleMap](#merklemap)\n * [Parameters](#parameters-25)\n* [WalletPolicy](#walletpolicy)\n * [Parameters](#parameters-26)\n* [extract](#extract)\n * [Parameters](#parameters-27)\n* [finalize](#finalize)\n * [Parameters](#parameters-28)\n* [clearFinalizedInput](#clearfinalizedinput)\n * [Parameters](#parameters-29)\n* [writePush](#writepush)\n * [Parameters](#parameters-30)\n* [PsbtV2](#psbtv2)\n* [serializeTransactionOutputs](#serializetransactionoutputs-1)\n * [Parameters](#parameters-31)\n * [Examples](#examples-12)\n* [SignP2SHTransactionArg](#signp2shtransactionarg)\n * [Properties](#properties-1)\n* [TransactionInput](#transactioninput)\n* [TransactionOutput](#transactionoutput)\n* [Transaction](#transaction)\n\n### Btc\n\nBitcoin API.\n\n#### Parameters\n\n* `transport` **Transport** \n* `scrambleKey` (optional, default `\"BTC\"`)\n\n#### Examples\n\n```javascript\nimport Btc from \"@ledgerhq/hw-app-btc\";\nconst btc = new Btc(transport)\n```\n\n#### getWalletXpub\n\nGet an XPUB with a ledger device\n\n##### Parameters\n\n* `arg` **{path: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), xpubVersion: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}** derivation parameter* path: a BIP 32 path of the account level. e.g. `84'/0'/0'`\n * xpubVersion: the XPUBVersion of the coin used. (use @ledgerhq/currencies if needed)\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** XPUB of the account\n\n#### getWalletPublicKey\n\n##### Parameters\n\n* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a BIP 32 path\n* `opts` **{verify: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, format: [AddressFormat](#addressformat)?}?** \n* `options` an object with optional these fields:* verify (boolean) will ask user to confirm the address on the device\n\n * format (\"legacy\" | \"p2sh\" | \"bech32\" | \"bech32m\" | \"cashaddr\") to use different bitcoin address formatter.NB The normal usage is to use:* legacy format with 44' paths\n\n * p2sh format with 49' paths\n\n * bech32 format with 84' paths\n\n * cashaddr in case of Bitcoin Cash\n\n##### Examples\n\n```javascript\nbtc.getWalletPublicKey(\"44'/0'/0'/0/0\").then(o => o.bitcoinAddress)\nbtc.getWalletPublicKey(\"49'/0'/0'/0/0\", { format: \"p2sh\" }).then(o => o.bitcoinAddress)\n```\n\nReturns **[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), bitcoinAddress: [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)}>** \n\n#### signMessageNew\n\nYou can sign a message according to the Bitcoin Signature format and retrieve v, r, s given the message and the BIP 32 path of the account to sign.\n\n##### Parameters\n\n* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n* `messageHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n##### Examples\n\n```javascript\nbtc.signMessageNew_async(\"44'/60'/0'/0'/0\", Buffer.from(\"test\").toString(\"hex\")).then(function(result) {\nvar v = result['v'] + 27 + 4;\nvar signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');\nconsole.log(\"Signature : \" + signature);\n}).catch(function(ex) {console.log(ex);});\n```\n\nReturns **[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), 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)}>** \n\n#### createPaymentTransactionNew\n\nTo sign a transaction involving standard (P2PKH) inputs, call createTransaction with the following parameters\n\n##### Parameters\n\n* `arg` **[CreateTransactionArg](#createtransactionarg)** \n* `inputs` is an array of \\[ transaction, output_index, optional redeem script, optional sequence ] where* transaction is the previously computed transaction object for this UTXO\n * output_index is the output in the transaction used as input for this UTXO (counting from 0)\n * redeem script is the optional redeem script to use when consuming a Segregated Witness input\n * sequence is the sequence number to use for this input (when using RBF), or non present\n* `associatedKeysets` is an array of BIP 32 paths pointing to the path to the private key used for each UTXO\n* `changePath` is an optional BIP 32 path pointing to the path to the public key used to compute the change address\n* `outputScriptHex` is the hexadecimal serialized outputs of the transaction to sign, including leading vararg voutCount\n* `lockTime` is the optional lockTime of the transaction to sign, or default (0)\n* `sigHashType` is the hash type of the transaction to sign, or default (all)\n* `segwit` is an optional boolean indicating wether to use segwit or not. This includes wrapped segwit.\n* `initialTimestamp` is an optional timestamp of the function call to use for coins that necessitate timestamps only, (not the one that the tx will include)\n* `additionals` list of additionnal options* \"bech32\" for spending native segwit outputs\n * \"bech32m\" for spending segwit v1+ outputs\n * \"abc\" for bch\n * \"gold\" for btg\n * \"bipxxx\" for using BIPxxx\n * \"sapling\" to indicate a zec transaction is supporting sapling (to be set over block 419200)\n* `expiryHeight` is an optional Buffer for zec overwinter / sapling Txs\n* `useTrustedInputForSegwit` trust inputs for segwit transactions. If app version >= 1.4.0 this should be true.\n\n##### Examples\n\n```javascript\nbtc.createTransaction({\ninputs: [ [tx1, 1] ],\nassociatedKeysets: [\"0'/0/0\"],\noutputScriptHex: \"01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac\"\n}).then(res => ...);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** the signed transaction ready to be broadcast\n\n#### signP2SHTransaction\n\nTo obtain the signature of multisignature (P2SH) inputs, call signP2SHTransaction_async with the folowing parameters\n\n##### Parameters\n\n* `arg` **[SignP2SHTransactionArg](#signp2shtransactionarg)** \n* `inputs` is an array of \\[ transaction, output_index, redeem script, optional sequence ] where* transaction is the previously computed transaction object for this UTXO\n * output_index is the output in the transaction used as input for this UTXO (counting from 0)\n * redeem script is the mandatory redeem script associated to the current P2SH input\n * sequence is the sequence number to use for this input (when using RBF), or non present\n* `associatedKeysets` is an array of BIP 32 paths pointing to the path to the private key used for each UTXO\n* `outputScriptHex` is the hexadecimal serialized outputs of the transaction to sign\n* `lockTime` is the optional lockTime of the transaction to sign, or default (0)\n* `sigHashType` is the hash type of the transaction to sign, or default (all)\n\n##### Examples\n\n```javascript\nbtc.signP2SHTransaction({\ninputs: [ [tx, 1, \"52210289b4a3ad52a919abd2bdd6920d8a6879b1e788c38aa76f0440a6f32a9f1996d02103a3393b1439d1693b063482c04bd40142db97bdf139eedd1b51ffb7070a37eac321030b9a409a1e476b0d5d17b804fcdb81cf30f9b99c6f3ae1178206e08bc500639853ae\"] ],\nassociatedKeysets: [\"0'/0/0\"],\noutputScriptHex: \"01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac\"\n}).then(result => ...);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>>** the signed transaction ready to be broadcast\n\n#### splitTransaction\n\nFor each UTXO included in your transaction, create a transaction object from the raw serialized version of the transaction used in this UTXO.\n\n##### Parameters\n\n* `transactionHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n* `isSegwitSupported` **([boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** (optional, default `false`)\n* `hasTimestamp` (optional, default `false`)\n* `hasExtraData` (optional, default `false`)\n* `additionals` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** (optional, default `[]`)\n\n##### Examples\n\n```javascript\nconst tx1 = btc.splitTransaction(\"01000000014ea60aeac5252c14291d428915bd7ccd1bfc4af009f4d4dc57ae597ed0420b71010000008a47304402201f36a12c240dbf9e566bc04321050b1984cd6eaf6caee8f02bb0bfec08e3354b022012ee2aeadcbbfd1e92959f57c15c1c6debb757b798451b104665aa3010569b49014104090b15bde569386734abf2a2b99f9ca6a50656627e77de663ca7325702769986cf26cc9dd7fdea0af432c8e2becc867c932e1b9dd742f2a108997c2252e2bdebffffffff0281b72e00000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88aca0860100000000001976a9144533f5fb9b4817f713c48f0bfe96b9f50c476c9b88ac00000000\");\n```\n\nReturns **[Transaction](#transaction)** \n\n#### serializeTransactionOutputs\n\n##### Parameters\n\n* `t` **[Transaction](#transaction)** \n\n##### Examples\n\n```javascript\nconst tx1 = btc.splitTransaction(\"01000000014ea60aeac5252c14291d428915bd7ccd1bfc4af009f4d4dc57ae597ed0420b71010000008a47304402201f36a12c240dbf9e566bc04321050b1984cd6eaf6caee8f02bb0bfec08e3354b022012ee2aeadcbbfd1e92959f57c15c1c6debb757b798451b104665aa3010569b49014104090b15bde569386734abf2a2b99f9ca6a50656627e77de663ca7325702769986cf26cc9dd7fdea0af432c8e2becc867c932e1b9dd742f2a108997c2252e2bdebffffffff0281b72e00000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88aca0860100000000001976a9144533f5fb9b4817f713c48f0bfe96b9f50c476c9b88ac00000000\");\nconst outputScript = btc.serializeTransactionOutputs(tx1).toString('hex');\n```\n\nReturns **[Buffer](https://nodejs.org/api/buffer.html)** \n\n### impl\n\nDefinition: A \"normal path\" is a prefix of a standard path where all\nthe hardened steps of the standard path are included. For example, the\npaths m/44'/1'/17' and m/44'/1'/17'/1 are normal paths, but m/44'/1'\nis not. m/'199/1'/17'/0/1 is not a normal path either.\n\nThere's a compatiblity issue between old and new app: When exporting\nthe key of a non-normal path with verify=false, the new app would\nreturn an error, whereas the old app would return the key.\n\nSee\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#get_extended_pubkey>\n\nIf format bech32m is used, we'll not use old, because it doesn't\nsupport it.\n\nWhen to use new (given the app supports it)\n\n* format is bech32m or\n* path is normal or\n* verify is true\n\nOtherwise use old.\n\n### BtcNew\n\nThis class implements the same interface as BtcOld (formerly\nnamed Btc), but interacts with Bitcoin hardware app version 2+\nwhich uses a totally new APDU protocol. This new\nprotocol is documented at\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md>\n\nSince the interface must remain compatible with BtcOld, the methods\nof this class are quite clunky, because it needs to adapt legacy\ninput data into the PSBT process. In the future, a new interface should\nbe developed that exposes PSBT to the outer world, which would render\na much cleaner implementation.\n\n#### Parameters\n\n* `` \n\n#### getWalletXpub\n\nThis is a new method that allow users to get an xpub at a standard path.\nStandard paths are described at\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#description>\n\nThis boils down to paths (N=0 for Bitcoin, N=1 for Testnet):\nM/44'/N'/x'/\\*\\*\nM/48'/N'/x'/y'/\\*\\*\nM/49'/N'/x'/\\*\\*\nM/84'/N'/x'/\\*\\*\nM/86'/N'/x'/\\*\\*\n\nThe method was added because of added security in the hardware app v2+. The\nnew hardware app will allow export of any xpub up to and including the\ndeepest hardened key of standard derivation paths, whereas the old app\nwould allow export of any key.\n\nThis caused an issue for callers of this class, who only had\ngetWalletPublicKey() to call which means they have to constuct xpub\nthemselves:\n\nSuppose a user of this class wants to create an account xpub on a standard\npath, M/44'/0'/Z'. The user must get the parent key fingerprint (see BIP32)\nby requesting the parent key M/44'/0'. The new app won't allow that, because\nit only allows exporting deepest level hardened path. So the options are to\nallow requesting M/44'/0' from the app, or to add a new function\n\"getWalletXpub\".\n\nWe opted for adding a new function, which can greatly simplify client code.\n\n##### Parameters\n\n* `$0` **{path: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), xpubVersion: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}** \n\n * `$0.path` \n * `$0.xpubVersion` \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** \n\n#### getWalletPublicKey\n\nThis method returns a public key, a bitcoin address, and and a chaincode\nfor a specific derivation path.\n\nLimitation: If the path is not a leaf node of a standard path, the address\nwill be the empty string \"\", see this.getWalletAddress() for details.\n\n##### Parameters\n\n* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n* `opts` **{verify: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, format: [AddressFormat](#addressformat)?}?** \n\nReturns **[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), bitcoinAddress: [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)}>** \n\n#### createPaymentTransactionNew\n\nBuild and sign a transaction. See Btc.createPaymentTransactionNew for\ndetails on how to use this method.\n\nThis method will convert the legacy arguments, CreateTransactionArg, into\na psbt which is finally signed and finalized, and the extracted fully signed\ntransaction is returned.\n\n##### Parameters\n\n* `arg` **[CreateTransactionArg](#createtransactionarg)** \n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** \n\n### BtcOld\n\nBitcoin API.\n\n#### Parameters\n\n* `` \n\n#### Examples\n\n```javascript\nimport Btc from \"@ledgerhq/hw-app-btc\";\nconst btc = new Btc(transport)\n```\n\n#### getWalletPublicKey\n\n##### Parameters\n\n* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a BIP 32 path\n* `opts` **{verify: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, format: [AddressFormat](#addressformat)?}?** \n* `options` an object with optional these fields:* verify (boolean) will ask user to confirm the address on the device\n\n * format (\"legacy\" | \"p2sh\" | \"bech32\" | \"cashaddr\") to use different bitcoin address formatter.NB The normal usage is to use:* legacy format with 44' paths\n\n * p2sh format with 49' paths\n\n * bech32 format with 173' paths\n\n * cashaddr in case of Bitcoin Cash\n\n##### Examples\n\n```javascript\nbtc.getWalletPublicKey(\"44'/0'/0'/0/0\").then(o => o.bitcoinAddress)\nbtc.getWalletPublicKey(\"49'/0'/0'/0/0\", { format: \"p2sh\" }).then(o => o.bitcoinAddress)\n```\n\nReturns **[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), bitcoinAddress: [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)}>** \n\n#### signMessageNew\n\nYou can sign a message according to the Bitcoin Signature format and retrieve v, r, s given the message and the BIP 32 path of the account to sign.\n\n##### Parameters\n\n* `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n* `messageHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n##### Examples\n\n```javascript\nbtc.signMessageNew_async(\"44'/60'/0'/0'/0\", Buffer.from(\"test\").toString(\"hex\")).then(function(result) {\nvar v = result['v'] + 27 + 4;\nvar signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');\nconsole.log(\"Signature : \" + signature);\n}).catch(function(ex) {console.log(ex);});\n```\n\nReturns **[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), 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)}>** \n\n#### createPaymentTransactionNew\n\nTo sign a transaction involving standard (P2PKH) inputs, call createTransaction with the following parameters\n\n##### Parameters\n\n* `arg` **[CreateTransactionArg](#createtransactionarg)** \n* `inputs` is an array of \\[ transaction, output_index, optional redeem script, optional sequence ] where* transaction is the previously computed transaction object for this UTXO\n * output_index is the output in the transaction used as input for this UTXO (counting from 0)\n * redeem script is the optional redeem script to use when consuming a Segregated Witness input\n * sequence is the sequence number to use for this input (when using RBF), or non present\n* `associatedKeysets` is an array of BIP 32 paths pointing to the path to the private key used for each UTXO\n* `changePath` is an optional BIP 32 path pointing to the path to the public key used to compute the change address\n* `outputScriptHex` is the hexadecimal serialized outputs of the transaction to sign\n* `lockTime` is the optional lockTime of the transaction to sign, or default (0)\n* `sigHashType` is the hash type of the transaction to sign, or default (all)\n* `segwit` is an optional boolean indicating wether to use segwit or not\n* `initialTimestamp` is an optional timestamp of the function call to use for coins that necessitate timestamps only, (not the one that the tx will include)\n* `additionals` list of additionnal options* \"bech32\" for spending native segwit outputs\n * \"abc\" for bch\n * \"gold\" for btg\n * \"bipxxx\" for using BIPxxx\n * \"sapling\" to indicate a zec transaction is supporting sapling (to be set over block 419200)\n* `expiryHeight` is an optional Buffer for zec overwinter / sapling Txs\n* `useTrustedInputForSegwit` trust inputs for segwit transactions\n\n##### Examples\n\n```javascript\nbtc.createTransaction({\ninputs: [ [tx1, 1] ],\nassociatedKeysets: [\"0'/0/0\"],\noutputScriptHex: \"01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac\"\n}).then(res => ...);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** the signed transaction ready to be broadcast\n\n#### signP2SHTransaction\n\nTo obtain the signature of multisignature (P2SH) inputs, call signP2SHTransaction_async with the folowing parameters\n\n##### Parameters\n\n* `arg` **[SignP2SHTransactionArg](#signp2shtransactionarg)** \n* `inputs` is an array of \\[ transaction, output_index, redeem script, optional sequence ] where* transaction is the previously computed transaction object for this UTXO\n * output_index is the output in the transaction used as input for this UTXO (counting from 0)\n * redeem script is the mandatory redeem script associated to the current P2SH input\n * sequence is the sequence number to use for this input (when using RBF), or non present\n* `associatedKeysets` is an array of BIP 32 paths pointing to the path to the private key used for each UTXO\n* `outputScriptHex` is the hexadecimal serialized outputs of the transaction to sign\n* `lockTime` is the optional lockTime of the transaction to sign, or default (0)\n* `sigHashType` is the hash type of the transaction to sign, or default (all)\n\n##### Examples\n\n```javascript\nbtc.signP2SHTransaction({\ninputs: [ [tx, 1, \"52210289b4a3ad52a919abd2bdd6920d8a6879b1e788c38aa76f0440a6f32a9f1996d02103a3393b1439d1693b063482c04bd40142db97bdf139eedd1b51ffb7070a37eac321030b9a409a1e476b0d5d17b804fcdb81cf30f9b99c6f3ae1178206e08bc500639853ae\"] ],\nassociatedKeysets: [\"0'/0/0\"],\noutputScriptHex: \"01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac\"\n}).then(result => ...);\n```\n\nReturns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>>** the signed transaction ready to be broadcast\n\n### CreateTransactionArg\n\nType: {inputs: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<\\[[Transaction](#transaction), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)), ([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))]>, associatedKeysets: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>, changePath: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, outputScriptHex: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), lockTime: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, sigHashType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, segwit: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, initialTimestamp: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, additionals: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>, expiryHeight: [Buffer](https://nodejs.org/api/buffer.html)?, useTrustedInputForSegwit: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, onDeviceStreaming: function (arg0: {progress: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), total: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), index: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}): void?, onDeviceSignatureRequested: function (): void?, onDeviceSignatureGranted: function (): void?}\n\n#### Properties\n\n* `inputs` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<\\[[Transaction](#transaction), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)), ([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))]>** \n* `associatedKeysets` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** \n* `changePath` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** \n* `outputScriptHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n* `lockTime` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** \n* `sigHashType` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** \n* `segwit` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** \n* `initialTimestamp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** \n* `additionals` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** \n* `expiryHeight` **[Buffer](https://nodejs.org/api/buffer.html)?** \n* `useTrustedInputForSegwit` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** \n* `onDeviceStreaming` **function (arg0: {progress: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), total: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), index: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}): void?** \n* `onDeviceSignatureRequested` **function (): void?** \n* `onDeviceSignatureGranted` **function (): void?** \n\n### AddressFormat\n\naddress format is one of legacy | p2sh | bech32 | cashaddr\n\nType: (`\"legacy\"` | `\"p2sh\"` | `\"bech32\"` | `\"bech32m\"` | `\"cashaddr\"`)\n\n### AccountType\n\nEncapsulates differences between account types, for example p2wpkh,\np2wpkhWrapped, p2tr.\n\n#### spendingCondition\n\nGenerates a scriptPubKey (output script) from a list of public keys. If a\np2sh redeemScript or a p2wsh witnessScript is needed it will also be set on\nthe returned SpendingCondition.\n\nThe pubkeys are expected to be 33 byte ecdsa compressed pubkeys.\n\n##### Parameters\n\n* `pubkeys` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Buffer](https://nodejs.org/api/buffer.html)>** \n\nReturns **SpendingCondition** \n\n#### setInput\n\nPopulates the psbt with account type-specific data for an input.\n\n##### Parameters\n\n* `i` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The index of the input map to populate\n* `inputTx` **([Buffer](https://nodejs.org/api/buffer.html) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** The full transaction containing the spent output. This may\n be omitted for taproot.\n* `spentOutput` **SpentOutput** The amount and spending condition of the spent output\n* `pubkeys` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Buffer](https://nodejs.org/api/buffer.html)>** The 33 byte ecdsa compressed public keys involved in the input\n* `pathElems` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** The paths corresponding to the pubkeys, in same order.\n\nReturns **void** \n\n#### setOwnOutput\n\nPopulates the psbt with account type-specific data for an output. This is typically\ndone for change outputs and other outputs that goes to the same account as\nbeing spent from.\n\n##### Parameters\n\n* `i` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The index of the output map to populate\n* `cond` **SpendingCondition** The spending condition for this output\n* `pubkeys` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Buffer](https://nodejs.org/api/buffer.html)>** The 33 byte ecdsa compressed public keys involved in this output\n* `paths` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** The paths corresponding to the pubkeys, in same order.\n\nReturns **void** \n\n#### getDescriptorTemplate\n\nReturns the descriptor template for this account type. Currently only\nDefaultDescriptorTemplates are allowed, but that might be changed in the\nfuture. See class WalletPolicy for more information on descriptor\ntemplates.\n\nReturns **DefaultDescriptorTemplate** \n\n### SingleKeyAccount\n\n**Extends BaseAccount**\n\nSuperclass for single signature accounts. This will make sure that the pubkey\narrays and path arrays in the method arguments contains exactly one element\nand calls an abstract method to do the actual work.\n\n### getTaprootOutputKey\n\nCalculates a taproot output key from an internal key. This output key will be\nused as witness program in a taproot output. The internal key is tweaked\naccording to recommendation in BIP341:\n<https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_ref-22-0>\n\n#### Parameters\n\n* `internalPubkey` **[Buffer](https://nodejs.org/api/buffer.html)** A 32 byte x-only taproot internal key\n\nReturns **[Buffer](https://nodejs.org/api/buffer.html)** The output key\n\n### AppClient\n\nThis class encapsulates the APDU protocol documented at\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md>\n\n#### Parameters\n\n* `transport` **Transport** \n\n### ClientCommandInterpreter\n\nThis class will dispatch a client command coming from the hardware device to\nthe appropriate client command implementation. Those client commands\ntypically requests data from a merkle tree or merkelized maps.\n\nA ClientCommandInterpreter is prepared by adding the merkle trees and\nmerkelized maps it should be able to serve to the hardware device. This class\ndoesn't know anything about the semantics of the data it holds, it just\nserves merkle data. It doesn't even know in what context it is being\nexecuted, ie SignPsbt, getWalletAddress, etc.\n\nIf the command yelds results to the client, as signPsbt does, the yielded\ndata will be accessible after the command completed by calling getYielded(),\nwhich will return the yields in the same order as they came in.\n\n#### Parameters\n\n* `progressCallback` **function (): void** \n\n### MerkelizedPsbt\n\n**Extends PsbtV2**\n\nThis class merkelizes a PSBTv2, by merkelizing the different\nmaps of the psbt. This is used during the transaction signing process,\nwhere the hardware app can request specific parts of the psbt from the\nclient code and be sure that the response data actually belong to the psbt.\nThe reason for this is the limited amount of memory available to the app,\nso it can't always store the full psbt in memory.\n\nThe signing process is documented at\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#sign_psbt>\n\n#### Parameters\n\n* `psbt` **[PsbtV2](#psbtv2)** \n\n### Merkle\n\nThis class implements the merkle tree used by Ledger Bitcoin app v2+,\nwhich is documented at\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/merkle.md>\n\n#### Parameters\n\n* `leaves` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Buffer](https://nodejs.org/api/buffer.html)>** \n* `hasher` **function (buf: [Buffer](https://nodejs.org/api/buffer.html)): [Buffer](https://nodejs.org/api/buffer.html)** (optional, default `crypto.sha256`)\n\n### MerkleMap\n\nThis implements \"Merkelized Maps\", documented at\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/merkle.md#merkleized-maps>\n\nA merkelized map consist of two merkle trees, one for the keys of\na map and one for the values of the same map, thus the two merkle\ntrees have the same shape. The commitment is the number elements\nin the map followed by the keys' merkle root followed by the\nvalues' merkle root.\n\n#### Parameters\n\n* `keys` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Buffer](https://nodejs.org/api/buffer.html)>** Sorted list of (unhashed) keys\n* `values` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Buffer](https://nodejs.org/api/buffer.html)>** values, in corresponding order as the keys, and of equal length\n\n### WalletPolicy\n\nThe Bitcon hardware app uses a descriptors-like thing to describe\nhow to construct output scripts from keys. A \"Wallet Policy\" consists\nof a \"Descriptor Template\" and a list of \"keys\". A key is basically\na serialized BIP32 extended public key with some added derivation path\ninformation. This is documented at\n<https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/wallet.md>\n\n#### Parameters\n\n* `descriptorTemplate` **DefaultDescriptorTemplate** \n* `key` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n### extract\n\nThis implements the \"Transaction Extractor\" role of BIP370 (PSBTv2\n<https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki#transaction-extractor>). However\nthe role is partially documented in BIP174 (PSBTv0\n<https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#transaction-extractor>).\n\n#### Parameters\n\n* `psbt` **[PsbtV2](#psbtv2)** \n\nReturns **[Buffer](https://nodejs.org/api/buffer.html)** \n\n### finalize\n\nThis roughly implements the \"input finalizer\" role of BIP370 (PSBTv2\n<https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki>). However\nthe role is documented in BIP174 (PSBTv0\n<https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>).\n\nVerify that all inputs have a signature, and set inputFinalScriptwitness\nand/or inputFinalScriptSig depending on the type of the spent outputs. Clean\nfields that aren't useful anymore, partial signatures, redeem script and\nderivation paths.\n\n#### Parameters\n\n* `psbt` **[PsbtV2](#psbtv2)** The psbt with all signatures added as partial sigs, either\n through PSBT_IN_PARTIAL_SIG or PSBT_IN_TAP_KEY_SIG\n\nReturns **void** \n\n### clearFinalizedInput\n\nDeletes fields that are no longer neccesary from the psbt.\n\nNote, the spec doesn't say anything about removing ouput fields\nlike PSBT_OUT_BIP32\\_DERIVATION_PATH and others, so we keep them\nwithout actually knowing why. I think we should remove them too.\n\n#### Parameters\n\n* `psbt` **[PsbtV2](#psbtv2)** \n* `inputIndex` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** \n\n### writePush\n\nWrites a script push operation to buf, which looks different\ndepending on the size of the data. See\n<https://en.bitcoin.it/wiki/Script#Constants>\n\n#### Parameters\n\n* `buf` **BufferWriter** the BufferWriter to write to\n* `data` **[Buffer](https://nodejs.org/api/buffer.html)** the Buffer to be pushed.\n\n### PsbtV2\n\nImplements Partially Signed Bitcoin Transaction version 2, BIP370, as\ndocumented at <https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki>\nand <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>\n\nA psbt is a data structure that can carry all relevant information about a\ntransaction through all stages of the signing process. From constructing an\nunsigned transaction to extracting the final serialized transaction ready for\nbroadcast.\n\nThis implementation is limited to what's needed in ledgerjs to carry out its\nduties, which means that support for features like multisig or taproot script\npath spending are not implemented. Specifically, it supports p2pkh,\np2wpkhWrappedInP2sh, p2wpkh and p2tr key path spending.\n\nThis class is made purposefully dumb, so it's easy to add support for\ncomplemantary fields as needed in the future.\n\n### serializeTransactionOutputs\n\n#### Parameters\n\n* `$0` **[Transaction](#transaction)** \n\n * `$0.outputs` \n\n#### Examples\n\n```javascript\nconst tx1 = btc.splitTransaction(\"01000000014ea60aeac5252c14291d428915bd7ccd1bfc4af009f4d4dc57ae597ed0420b71010000008a47304402201f36a12c240dbf9e566bc04321050b1984cd6eaf6caee8f02bb0bfec08e3354b022012ee2aeadcbbfd1e92959f57c15c1c6debb757b798451b104665aa3010569b49014104090b15bde569386734abf2a2b99f9ca6a50656627e77de663ca7325702769986cf26cc9dd7fdea0af432c8e2becc867c932e1b9dd742f2a108997c2252e2bdebffffffff0281b72e00000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88aca0860100000000001976a9144533f5fb9b4817f713c48f0bfe96b9f50c476c9b88ac00000000\");\nconst outputScript = btc.serializeTransactionOutputs(tx1).toString('hex');\n```\n\nReturns **[Buffer](https://nodejs.org/api/buffer.html)** \n\n### SignP2SHTransactionArg\n\nType: {inputs: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<\\[[Transaction](#transaction), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)), ([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))]>, associatedKeysets: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>, outputScriptHex: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), lockTime: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, sigHashType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, segwit: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, transactionVersion: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?}\n\n#### Properties\n\n* `inputs` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<\\[[Transaction](#transaction), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)), ([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))]>** \n* `associatedKeysets` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** \n* `outputScriptHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n* `lockTime` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** \n* `sigHashType` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** \n* `segwit` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** \n* `transactionVersion` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** \n\n### TransactionInput\n\n### TransactionOutput\n\n### Transaction\n"
|
|
58
|
+
}
|
package/src/bip32.ts
CHANGED
|
@@ -31,9 +31,11 @@ export function pubkeyFromXpub(xpub: string): Buffer {
|
|
|
31
31
|
return xpubBuf.slice(xpubBuf.length - 33);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export function getXpubComponents(
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
export function getXpubComponents(xpub: string): {
|
|
35
|
+
chaincode: Buffer;
|
|
36
|
+
pubkey: Buffer;
|
|
37
|
+
version: number;
|
|
38
|
+
} {
|
|
37
39
|
const xpubBuf: Buffer = bs58check.decode(xpub);
|
|
38
40
|
return {
|
|
39
41
|
chaincode: xpubBuf.slice(13, 13 + 32),
|
package/src/getTrustedInput.ts
CHANGED
|
@@ -36,14 +36,8 @@ export async function getTrustedInput(
|
|
|
36
36
|
transaction: Transaction,
|
|
37
37
|
additionals: Array<string> = []
|
|
38
38
|
): Promise<string> {
|
|
39
|
-
const {
|
|
40
|
-
|
|
41
|
-
inputs,
|
|
42
|
-
outputs,
|
|
43
|
-
locktime,
|
|
44
|
-
nExpiryHeight,
|
|
45
|
-
extraData,
|
|
46
|
-
} = transaction;
|
|
39
|
+
const { version, inputs, outputs, locktime, nExpiryHeight, extraData } =
|
|
40
|
+
transaction;
|
|
47
41
|
|
|
48
42
|
if (!outputs || !locktime) {
|
|
49
43
|
throw new Error("getTrustedInput: locktime & outputs is expected");
|
package/src/newops/appClient.ts
CHANGED
|
@@ -39,10 +39,14 @@ export class AppClient {
|
|
|
39
39
|
data: Buffer,
|
|
40
40
|
cci?: ClientCommandInterpreter
|
|
41
41
|
): Promise<Buffer> {
|
|
42
|
-
let response: Buffer = await this.transport.send(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
let response: Buffer = await this.transport.send(
|
|
43
|
+
CLA_BTC,
|
|
44
|
+
ins,
|
|
45
|
+
0,
|
|
46
|
+
0,
|
|
47
|
+
data,
|
|
48
|
+
[0x9000, 0xe000]
|
|
49
|
+
);
|
|
46
50
|
while (response.readUInt16BE(response.length - 2) === 0xe000) {
|
|
47
51
|
if (!cci) {
|
|
48
52
|
throw new Error("Unexpected SW_INTERRUPTED_EXECUTION");
|
package/src/newops/psbtv2.ts
CHANGED
|
@@ -427,9 +427,10 @@ export class PsbtV2 {
|
|
|
427
427
|
this.writeBip32Derivation(buf, masterFingerprint, path);
|
|
428
428
|
return buf.buffer();
|
|
429
429
|
}
|
|
430
|
-
private decodeBip32Derivation(
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
private decodeBip32Derivation(buffer: Buffer): {
|
|
431
|
+
masterFingerprint: Buffer;
|
|
432
|
+
path: number[];
|
|
433
|
+
} {
|
|
433
434
|
const buf = new BufferReader(buffer);
|
|
434
435
|
return this.readBip32Derivation(buf);
|
|
435
436
|
}
|
|
@@ -443,9 +444,10 @@ export class PsbtV2 {
|
|
|
443
444
|
buf.writeUInt32(element);
|
|
444
445
|
});
|
|
445
446
|
}
|
|
446
|
-
private readBip32Derivation(
|
|
447
|
-
|
|
448
|
-
|
|
447
|
+
private readBip32Derivation(buf: BufferReader): {
|
|
448
|
+
masterFingerprint: Buffer;
|
|
449
|
+
path: number[];
|
|
450
|
+
} {
|
|
449
451
|
const masterFingerprint = buf.readSlice(4);
|
|
450
452
|
const path: number[] = [];
|
|
451
453
|
while (buf.offset < buf.buffer.length) {
|
|
@@ -466,9 +468,11 @@ export class PsbtV2 {
|
|
|
466
468
|
this.writeBip32Derivation(buf, masterFingerprint, path);
|
|
467
469
|
return buf.buffer();
|
|
468
470
|
}
|
|
469
|
-
private decodeTapBip32Derivation(
|
|
470
|
-
|
|
471
|
-
|
|
471
|
+
private decodeTapBip32Derivation(buffer: Buffer): {
|
|
472
|
+
hashes: Buffer[];
|
|
473
|
+
masterFingerprint: Buffer;
|
|
474
|
+
path: number[];
|
|
475
|
+
} {
|
|
472
476
|
const buf = new BufferReader(buffer);
|
|
473
477
|
const hashCount = buf.readVarInt();
|
|
474
478
|
const hashes: Buffer[] = [];
|
package/LICENSE
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright {yyyy} {name of copyright owner}
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
202
|
-
|