From 531b5330e54e9bdf01b5d108c76ccb9bf05b236e Mon Sep 17 00:00:00 2001 From: Irakli Safareli Date: Tue, 1 Oct 2019 13:02:55 +0400 Subject: [PATCH] upgrade (#17) * update teps * update deps * travis fix * travis * purescript-bytestrings v8.0.0 --- .travis.yml | 4 +++- bower.json | 12 ++++++------ package.json | 15 ++++++--------- src/Network/Ethereum/Core/HexString.purs | 2 +- test/Spec/Hex.purs | 14 +++++++------- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d799ce..47dee52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,10 @@ node_js: stable install: - npm install -g bower - npm install - - bower install + - bower install --production script: + - npm run -s build-strict + - bower install - npm run -s test after_success: - >- diff --git a/bower.json b/bower.json index 531975e..430d3dd 100644 --- a/bower.json +++ b/bower.json @@ -19,13 +19,13 @@ ], "dependencies": { "purescript-prelude": "^4.0.0", - "purescript-ring-modules": "^5.0.0", - "purescript-foreign-generic": "^8.0.0", - "purescript-simple-json": "^4.0.0", + "purescript-ring-modules": "^5.0.1", + "purescript-foreign-generic": "^10.0.0", + "purescript-simple-json": "^7.0.0", "purescript-ordered-collections": "^1.0.0", - "purescript-bytestrings": "^7.0.0", - "purescript-argonaut": "^5.0.0", - "purescript-parsing": "5.0.0" + "purescript-bytestrings": "^8.0.0", + "purescript-argonaut": "^6.0.0", + "purescript-parsing": "^5.0.0" }, "devDependencies": { "purescript-psci-support": "^4.0.0", diff --git a/package.json b/package.json index 5f8c7fd..3befeb1 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,6 @@ { "name": "purescript-eth-core", - "version": "4.0.0", - "description": "", - "main": "index.js", + "private": true, "dependencies": { "bn.js": "^4.11.0", "keccak": "^1.0.2", @@ -10,13 +8,12 @@ "secp256k1": "^3.0.1" }, "devDependencies": { - "purescript-psa": "^0.6.0", - "purescript": "^0.12.0", - "pulp": "^12.2.0" + "purescript-psa": "^0.7.3", + "purescript": "^0.13.0", + "pulp": "^13.0.0" }, "scripts": { + "build-strict": "pulp build -- --strict", "test": "pulp test" - }, - "author": "", - "license": "ISC" + } } diff --git a/src/Network/Ethereum/Core/HexString.purs b/src/Network/Ethereum/Core/HexString.purs index 5d1c74c..7c77561 100644 --- a/src/Network/Ethereum/Core/HexString.purs +++ b/src/Network/Ethereum/Core/HexString.purs @@ -213,7 +213,7 @@ toAscii hx = flip BS.toString ASCII $ unsafePartial $ fromJust $ BS.fromString ( -- | Get the 'HexString' corresponding to the UTF8 encoding. fromUtf8 :: String -> HexString fromUtf8 s = unsafePartial fromJust $ - let s' = unsafePartial $ split (Pattern "\0000") s `unsafeIndex` 0 + let s' = unsafePartial $ split (Pattern "\x0000") s `unsafeIndex` 0 in BS.fromString s' UTF8 >>= (pure <<< flip BS.toString Hex) >>= mkHexString -- | Get the 'HexString' corresponding to the ASCII encoding. diff --git a/test/Spec/Hex.purs b/test/Spec/Hex.purs index 0f804bf..9e5b632 100644 --- a/test/Spec/Hex.purs +++ b/test/Spec/Hex.purs @@ -31,27 +31,27 @@ hexSpec = describe "hex-spec" do it "can convert hex strings to utf8" do toUtf8 (unsafePartial (fromJust <<< mkHexString) "6d79537472696e67") `shouldEqual` "myString" - toUtf8 (unsafePartial (fromJust <<< mkHexString) "6d79537472696e6700") `shouldEqual` "myString\00" + toUtf8 (unsafePartial (fromJust <<< mkHexString) "6d79537472696e6700") `shouldEqual` "myString\x00" toUtf8 (unsafePartial (fromJust <<< mkHexString) "65787065637465642076616c7565000000000000000000000000000000000000") - `shouldEqual` "expected value\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" + `shouldEqual` "expected value\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" it "can convert strings to hex" do fromUtf8 "myString" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "6d79537472696e67" - fromUtf8 "myString\00" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "6d79537472696e67" - fromUtf8 "expected value\00\00\00" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "65787065637465642076616c7565" + fromUtf8 "myString\x00" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "6d79537472696e67" + fromUtf8 "expected value\x00\x00\x00" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "65787065637465642076616c7565" describe "ascii tests" do it "can convert hex strings to ascii" do toAscii (unsafePartial (fromJust <<< mkHexString) "6d79537472696e67") `shouldEqual` "myString" - toAscii (unsafePartial (fromJust <<< mkHexString) "6d79537472696e6700") `shouldEqual` "myString\0000" + toAscii (unsafePartial (fromJust <<< mkHexString) "6d79537472696e6700") `shouldEqual` "myString\x0000" -- toAscii ((fromJust <<< mkHexString) "0300000035e8c6d54c5d127c9dcebe9e1a37ab9b05321128d097590a3c100000000000006521df642ff1f5ec0c3a7aa6cea6b1e7b7f7cda2cbdf07362a85088e97f19ef94331c955c0e9321ad386428c") - -- `shouldEqual` "\0003\0000\0000\00005èÆÕL]\0012|Î¾ž\001a7«›\00052\0011(ЗY\n<\0010\0000\0000\0000\0000\0000\0000e!ßd/ñõì\f:z¦Î¦±ç·÷Í¢Ëß\00076*…\bŽ—ñžùC1ÉUÀé2\001aӆBŒ" + -- `shouldEqual` "\x0003\x0000\x0000\x00005èÆÕL]\x0012|Î¾ž\x001a7«›\x00052\x0011(ЗY\n<\x0010\x0000\x0000\x0000\x0000\x0000\x0000e!ßd/ñõì\f:z¦Î¦±ç·÷Í¢Ëß\x00076*…\bŽ—ñžùC1ÉUÀé2\x001aӆBŒ" it "can convert asci to hex" do fromAscii "myString" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "6d79537472696e67" - fromAscii "myString\00" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "6d79537472696e6700" + fromAscii "myString\x00" `shouldEqual` unsafePartial (fromJust <<< mkHexString) "6d79537472696e6700" describe "json tests" do