-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change secp256k1-haskell to libsecp256k1 #44
base: master
Are you sure you want to change the base?
Changes from all commits
20e26cc
1e5e5c9
43d968e
64a0760
4a3cbe4
4b96587
a4b527a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,16 @@ import Bitcoin ( | |
OutPoint (OutPoint), | ||
ParsedPath (..), | ||
PubKeyI, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Random comment: Upstream secp256k1 actually did a bunch of renames for the various types and stuff. I liked a lot of those changes/renames. We should consider adopting some of those name changes in our fork. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a list of the ones you like? |
||
PubKeyXO, | ||
ScriptOutput, | ||
SecKey, | ||
SigHash (..), | ||
SigInput (SigInput), | ||
SoftPath, | ||
Tx (Tx), | ||
TxHash, | ||
TxIn (TxIn), | ||
TxOut (TxOut), | ||
XOnlyPubKey, | ||
blockHashToHex, | ||
decodeHex, | ||
decodeOutputBS, | ||
|
@@ -32,6 +33,8 @@ import Bitcoin ( | |
hexBuilder, | ||
hexToBlockHash, | ||
hexToTxHash, | ||
importPubKeyXO, | ||
importSecKey, | ||
maybeToEither, | ||
parseHard, | ||
parsePath, | ||
|
@@ -57,10 +60,12 @@ import Data.Aeson ( | |
import Data.Aeson.Encoding (text, unsafeToEncoding) | ||
import qualified Data.Binary as Bin | ||
import Data.ByteString.Builder (char7) | ||
import qualified Data.ByteString.Char8 as B8 | ||
import qualified Data.ByteString.Lazy as BSL | ||
import Data.Maybe (maybeToList) | ||
import Data.Scientific (toBoundedInteger) | ||
import Data.String.Conversions (cs) | ||
import Test.QuickCheck | ||
|
||
|
||
instance FromJSON BlockHash where | ||
|
@@ -345,8 +350,15 @@ instance FromJSON SigInput where | |
|
||
|
||
-- | Hex encoding | ||
instance FromJSON XOnlyPubKey where | ||
instance FromJSON PubKeyXO where | ||
parseJSON = | ||
withText "XOnlyPubKey" $ | ||
either fail pure | ||
. (U.decode . BSL.fromStrict <=< maybe (Left "Unable to decode hex") Right . decodeHex) | ||
maybe (fail "") pure | ||
. (importPubKeyXO <=< decodeHex) | ||
|
||
|
||
-- | Arbitrary | ||
instance Arbitrary SecKey where | ||
arbitrary = do | ||
bytes <- B8.pack <$> vectorOf 32 arbitrary | ||
maybe arbitrary pure (importSecKey bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just completely get rid of the
ImplABC
stuff? Maybe that needs to be in a separate/follow-up PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's my plan for my next PR actually