Skip to content

Commit

Permalink
upgrade (#17)
Browse files Browse the repository at this point in the history
* update teps

* update deps

* travis fix

* travis

* purescript-bytestrings v8.0.0
  • Loading branch information
safareli authored Oct 1, 2019
1 parent 0b77129 commit 531b533
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- >-
Expand Down
12 changes: 6 additions & 6 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
{
"name": "purescript-eth-core",
"version": "4.0.0",
"description": "",
"main": "index.js",
"private": true,
"dependencies": {
"bn.js": "^4.11.0",
"keccak": "^1.0.2",
"rlp": "^2.0.0",
"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"
}
}
2 changes: 1 addition & 1 deletion src/Network/Ethereum/Core/HexString.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions test/Spec/Hex.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 531b533

Please sign in to comment.