Skip to content

Commit c5e81b1

Browse files
committed
Update to latest pact (v4.11)
1 parent 7bb4a44 commit c5e81b1

20 files changed

+184
-98
lines changed

cabal.project

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ package pact
77

88
source-repository-package
99
type: git
10-
location: https://github.com/mightybyte/HsYAML.git
11-
tag: 2ad3cbd1c84f8ab362cf1f5fd4bb3e869dfcc102
12-
--sha256: 1cmwavqz7vdpjvfybxbjphnw7448xy0353wmy9h29ix24lv8w7rr
10+
location: https://github.com/kadena-io/HsYAML.git
11+
tag: b3c49dbceb39733dfc07c22f2097d3c74fc86e74
12+
--sha256: 1cmwavqz7vdpjvfybxbjphnw7448xy0353wmy9h29ix24lv8w6rr
1313

1414
source-repository-package
1515
type: git
16-
location: https://github.com/mightybyte/HsYAML-aeson.git
17-
tag: 077110e5e52dc91d593c546dd1baaafd3066558d
18-
--sha256: 1r91ldq4sb49wqg1agvbjj21z6nwiyk3yx4r80arz0fhcv083czv
16+
location: https://github.com/kadena-io/HsYAML-aeson.git
17+
tag: 84292468200166b96ff4e8c7324ee01e6ab6d181
18+
--sha256: 1r91ldq4sb49wqg1agvbjj21z6nwiyk3yx4r80arz0fhcv082czv
1919

2020
source-repository-package
2121
type: git
@@ -26,29 +26,23 @@ source-repository-package
2626
source-repository-package
2727
type: git
2828
location: https://github.com/kadena-io/chainweb-api.git
29-
tag: b3e28d62c622ebda0d84e136ea6c995d5f97e46f
30-
--sha256: 1m9x9n5mwmv97fkv2z3hvlhlj59xm2mpsc816hzriw28pv1jb9zh
29+
tag: 1b2de025cfdc09698bfb1ec3807cd85405d6a339
30+
--sha256: 1m9x9n5mwmv97fkv2z3hvlhlj59xm2mpsc816hzriw28pv1jb8zh
3131

3232
source-repository-package
3333
type: git
34-
location: https://github.com/pcapriotti/optparse-applicative
35-
tag: 9399fd0f745e4d4d71e8bba03d402648b767363c
36-
--sha256: 0gkgccix898mafrs25fajqwxbb7zmg30livrj7b79knd6a5sqj76
34+
location: https://github.com/kadena-io/pact.git
35+
tag: a1c7906efbf32095883e71594a53a21162fbe5a7
36+
--sha256: sha256-Mtgz/ilxa81TDUoBKQv5x3BlOftFjNV1Ak0uYzSguNQ=
3737

3838
source-repository-package
39-
type: git
40-
location: https://github.com/kadena-io/pact.git
41-
tag: 83c5944991d6edcd34d79f9fbf8e537d060689c6
42-
--sha256: 0l59xi2by6l6gi10r8c437m7ics29215zr0zl1syyr3039vgmv0x
43-
44-
allow-newer: hashable:base
45-
allow-newer: chainweb-api:aeson
46-
47-
-- bounds from pact
48-
constraints: aeson <2
49-
constraints: base16-bytestring <1
50-
constraints: base64-bytestring <1.1
51-
constraints: hashable <1.3.1
52-
constraints: prettyprinter <1.6.1
53-
constraints: unordered-containers <0.2.16
54-
constraints: tls <1.7.0
39+
type: git
40+
location: https://github.com/kadena-io/pact-json.git
41+
tag: 1d260bfaa48312b54851057885de4c43c420e35f
42+
--sha256: 0fzq4mzaszj5clvixx9mn1x6r4dcrnwvbl2znd0p5mmy5h2jr0hh
43+
44+
source-repository-package
45+
type: git
46+
location: https://github.com/kadena-io/kadena-ethereum-bridge.git
47+
tag: a32d901e4a79be62af9c27c01152c9a4c3912a62
48+
--sha256: sha256-xdawv/tdjh61MbJKcBqm9Fje36+gVljuZsAxOTX1gP0=

flake.lock

Lines changed: 58 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
kdaToolProject =
1313
final.haskell-nix.project' {
1414
src = ./.;
15-
compiler-nix-name = "ghc8107";
15+
compiler-nix-name = "ghc964";
1616
shell.tools = {
1717
cabal = {};
1818
};

kda-tool.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ library
4545
Decimal
4646
, HsYAML
4747
, HsYAML-aeson
48-
, aeson < 2
48+
, aeson
4949
, async
5050
, attoparsec
5151
, base >= 4.13 && < 5
@@ -80,6 +80,7 @@ library
8080
, network-uri
8181
, optparse-applicative
8282
, pact
83+
, pact-json
8384
, process
8485
, resource-pool
8586
, retry

src/AppMain.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ module AppMain where
99
import Control.Monad.IO.Class
1010
import Data.Aeson
1111
import Data.Default
12+
import Data.String (fromString)
1213
import Katip
1314
import Network.HTTP.Client hiding (withConnection)
1415
import Network.HTTP.Client.TLS
1516
import Options.Applicative
16-
import Options.Applicative.Help.Pretty hiding ((</>))
1717
import System.Directory
1818
import System.FilePath
1919
import System.IO
@@ -81,7 +81,7 @@ appMain = do
8181
, header "kda - Command line tool for interacting with the Kadena blockchain"
8282
, footerDoc (Just theFooter)
8383
]
84-
theFooter = string $ unlines
84+
theFooter = fromString $ unlines
8585
[ "Run the following command to enable tab completion:"
8686
, ""
8787
, "source <(kda --bash-completion-script `which kda`)"

src/Commands/GenTx.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import Network.HTTP.Client.TLS
2727
import Network.HTTP.Types.Status
2828
--import Pact.ApiReq
2929
import qualified Pact.ApiReq as Pact
30+
import qualified Pact.JSON.Encode as J
3031
import Pact.Types.Command
3132
import Pact.Types.SigData
3233
import System.IO
@@ -100,7 +101,7 @@ genFromContents op tplContents useOldOutput = do
100101
cmds :: [Command Text] <- mapM (fmap snd . lift . Pact.mkApiReqCmd True "") apiReqs
101102
let chooseFormat i =
102103
if useOldOutput
103-
then pure $ encodeText i
104+
then pure $ encodeText $ J.toJsonViaEncode i
104105
else fmap encodeText $ sdToCsd i
105106
let outs :: [Text] = catMaybes $ map (chooseFormat <=< hush . commandToSigData) cmds
106107
let outPat = maybe (defaultOutPat augmentedVars) T.pack $ _genData_outFilePat gd

src/Commands/Keygen.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ import Pact.Types.Crypto
1515
import Keys
1616
import Types.KeyType
1717
import Utils
18+
import Data.Base16.Types (extractBase16)
1819
------------------------------------------------------------------------------
1920

2021
keygenCommand :: KeyType -> IO ()
2122
keygenCommand kt = do
2223
case kt of
2324
Plain -> do
24-
kp <- genKeyPair defaultScheme
25-
putStrLn $ "public: " ++ T.unpack (encodeBase16 $ getPublic kp)
26-
putStrLn $ "secret: " ++ T.unpack (encodeBase16 $ getPrivate kp)
25+
kp <- genKeyPair
26+
putStrLn $ "public: " ++ T.unpack (extractBase16 $ encodeBase16 $ getPublic kp)
27+
putStrLn $ "secret: " ++ T.unpack (extractBase16 $ encodeBase16 $ getPrivate kp)
2728
HD -> do
2829
let toPhrase = T.unwords . M.elems . mkPhraseMapFromMnemonic
2930
let prettyErr err = "ERROR generating menmonic: " <> tshow err

src/Commands/Local.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Control.Lens hiding ((.=))
1111
import Control.Monad
1212
import Control.Monad.Trans
1313
import Data.Aeson
14+
import Data.Aeson.Key
1415
import Data.Aeson.Lens
1516
import Data.Bifunctor
1617
import qualified Data.ByteString.Lazy as LB
@@ -47,7 +48,7 @@ localCommand e (LocalCmdArgs args verifySigs shortOutput) = do
4748
printf "%s: testing %d commands on %d chains\n"
4849
(schemeHostPortToText shp) (length txs) (length groups)
4950
responses <- lift $ mapM (localNodeQuery le verifySigs n) txs
50-
pure $ schemeHostPortToText shp .= map responseToValue responses
51+
pure $ fromText (schemeHostPortToText shp) .= map responseToValue responses
5152
case res of
5253
Left er -> putStrLn er >> exitFailure
5354
Right results -> do

src/Commands/Poll.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Control.Error
1010
import Control.Monad
1111
import Control.Monad.Trans
1212
import Data.Aeson
13+
import Data.Aeson.Key
1314
import Data.Bifunctor
1415
import qualified Data.ByteString.Lazy as LB
1516
import Data.Function
@@ -46,7 +47,7 @@ pollCommand e args = do
4647
printf "%s: polling %d commands to %d chains\n"
4748
(schemeHostPortToText shp) (length txs) (length groups)
4849
responses <- lift $ mapM (\ts -> pollNode le n (txChain $ NE.head ts) (_transaction_hash <$> ts)) groups
49-
pure $ schemeHostPortToText shp .= map responseToValue responses
50+
pure $ fromText (schemeHostPortToText shp) .= map responseToValue responses
5051
case res of
5152
Left er -> putStrLn er >> exitFailure
5253
Right results -> T.putStrLn $ toS $ encode $ Object $ mconcat results

src/Commands/Send.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Control.Error
99
import Control.Monad
1010
import Control.Monad.Trans
1111
import Data.Aeson
12+
import Data.Aeson.Key
1213
import Data.Bifunctor
1314
import qualified Data.ByteString.Lazy as LB
1415
import Data.Function
@@ -48,7 +49,7 @@ sendCommand e args = do
4849
printf "%s: sending %d commands to %d chains\n"
4950
(schemeHostPortToText shp) (length txs) (length groups)
5051
responses <- lift $ mapM (sendToNode le n) groups
51-
pure $ schemeHostPortToText shp .= map responseToValue responses
52+
pure $ fromText (schemeHostPortToText shp) .= map responseToValue responses
5253
case res of
5354
Left er -> putStrLn er >> exitFailure
5455
Right results -> T.putStrLn $ toS $ encode $ Object $ mconcat results

0 commit comments

Comments
 (0)