-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrades beignet to 0.0.18. Allows users to set p2tr addresses as their default, but only in dev mode. Adds taproot support to AddressViewer without need for dev mode. Adds addressTypesToMonitor to reduce bandwidth for unused address types. Removed unused create-hmac dependency.
- Loading branch information
1 parent
d62e7a2
commit 2d5acc4
Showing
22 changed files
with
265 additions
and
868 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
const bitcoin = require("bitcoinjs-lib"); | ||
const { toXOnly } = require("bitcoinjs-lib/src/psbt/bip371"); | ||
|
||
const getTapRootAddressFromPublicKey = ({ | ||
publicKey, | ||
network | ||
})=> { | ||
try { | ||
const internalPubkey = toXOnly(publicKey); | ||
const { address, output } = bitcoin.payments.p2tr({ | ||
internalPubkey, | ||
network | ||
}); | ||
if (!address) return { error: true, value: 'Unable to get address from key pair.' }; | ||
if (!output) return { error: true, value: 'Unable to get output from key pair.' }; | ||
return { error: false, address, output }; | ||
} catch (e) { | ||
console.log(e); | ||
return { error: true, value: e }; | ||
} | ||
}; | ||
|
||
const sha256 = (str) => { | ||
return bitcoin.crypto.sha256(str); | ||
} | ||
|
||
module.exports = { | ||
sha256, | ||
getTapRootAddressFromPublicKey, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.