Skip to content

Commit 3258f30

Browse files
authored
v0.14 (#146)
* Support purescript v0.14
1 parent 360afea commit 3258f30

35 files changed

+405
-486
lines changed

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
2-
dist: trusty
2+
dist: focal
33
sudo: required
44
node_js: stable
55
services:
@@ -8,7 +8,6 @@ install:
88
- npm install
99
- npm run build
1010

11-
1211
jobs:
1312
include:
1413

@@ -23,8 +22,8 @@ jobs:
2322
name: "Ensure that code matches style guidleines for PRs to master (Purescript)"
2423
if: branch = master
2524
script:
26-
- echo "test formatting"
27-
- npm run purty-check
25+
- echo "test formatting disabled since purty isn't up-to-date with purescript v0.14"
26+
# - npm run purty-check
2827

2928
after_success:
3029
- >-

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# purescript-web3
22
<img src=https://github.com/f-o-a-m/purescript-web3/blob/master/purescript-web3-logo.png width="75">
33

4-
54
[![Latest release](http://img.shields.io/github/release/f-o-a-m/purescript-web3.svg?branch=master)](https://github.com/f-o-a-m/purescript-web3/releases)
65
[![purescript-web3 on Pursuit](https://pursuit.purescript.org/packages/purescript-web3/badge)](https://pursuit.purescript.org/packages/purescript-web3)
7-
[![Build status](https://travis-ci.org/f-o-a-m/purescript-web3.svg?branch=master)](https://travis-ci.org/f-o-a-m/purescript-web3?branch=master)
6+
[![Build status](https://travis-ci.com/f-o-a-m/purescript-web3.svg?branch=master)](https://travis-ci.com/f-o-a-m/purescript-web3?branch=master)
87

98
# A Purescript Client for the Web3 API
109

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
"secp256k1": "^3.0.1"
1515
},
1616
"devDependencies": {
17-
"pulp": "^15.0.0",
18-
"purescript": "^0.13.8",
19-
"purescript-psa": "^0.7.3",
17+
"purescript": "^0.14.2",
18+
"purescript-psa": "^0.8.2",
2019
"purty": "^7.0.0",
21-
"spago": "^0.16.0"
20+
"spago": "^0.20.3"
2221
}
2322
}

packages.dhall

Lines changed: 18 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,18 @@
1-
{-
2-
Welcome to your new Dhall package-set!
3-
4-
Below are instructions for how to edit this file for most use
5-
cases, so that you don't need to know Dhall to use it.
6-
7-
## Warning: Don't Move This Top-Level Comment!
8-
9-
Due to how `dhall format` currently works, this comment's
10-
instructions cannot appear near corresponding sections below
11-
because `dhall format` will delete the comment. However,
12-
it will not delete a top-level comment like this one.
13-
14-
## Use Cases
15-
16-
Most will want to do one or both of these options:
17-
1. Override/Patch a package's dependency
18-
2. Add a package not already in the default package set
19-
20-
This file will continue to work whether you use one or both options.
21-
Instructions for each option are explained below.
22-
23-
### Overriding/Patching a package
24-
25-
Purpose:
26-
- Change a package's dependency to a newer/older release than the
27-
default package set's release
28-
- Use your own modified version of some dependency that may
29-
include new API, changed API, removed API by
30-
using your custom git repo of the library rather than
31-
the package set's repo
32-
33-
Syntax:
34-
where `entityName` is one of the following:
35-
- dependencies
36-
- repo
37-
- version
38-
-------------------------------
39-
let upstream = --
40-
in upstream
41-
with packageName.entityName = "new value"
42-
-------------------------------
43-
44-
Example:
45-
-------------------------------
46-
let upstream = --
47-
in upstream
48-
with halogen.version = "master"
49-
with halogen.repo = "https://example.com/path/to/git/repo.git"
50-
51-
with halogen-vdom.version = "v4.0.0"
52-
-------------------------------
53-
54-
### Additions
55-
56-
Purpose:
57-
- Add packages that aren't already included in the default package set
58-
59-
Syntax:
60-
where `<version>` is:
61-
- a tag (i.e. "v4.0.0")
62-
- a branch (i.e. "master")
63-
- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977")
64-
-------------------------------
65-
let upstream = --
66-
in upstream
67-
with new-package-name =
68-
{ dependencies =
69-
[ "dependency1"
70-
, "dependency2"
71-
]
72-
, repo =
73-
"https://example.com/path/to/git/repo.git"
74-
, version =
75-
"<version>"
76-
}
77-
-------------------------------
78-
79-
Example:
80-
-------------------------------
81-
let upstream = --
82-
in upstream
83-
with benchotron =
84-
{ dependencies =
85-
[ "arrays"
86-
, "exists"
87-
, "profunctor"
88-
, "strings"
89-
, "quickcheck"
90-
, "lcg"
91-
, "transformers"
92-
, "foldable-traversable"
93-
, "exceptions"
94-
, "node-fs"
95-
, "node-buffer"
96-
, "node-readline"
97-
, "datetime"
98-
, "now"
99-
]
100-
, repo =
101-
"https://github.com/hdgarrood/purescript-benchotron.git"
102-
, version =
103-
"v7.0.0"
104-
}
105-
-------------------------------
106-
-}
107-
1081
let upstream =
109-
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200922/packages.dhall sha256:5edc9af74593eab8834d7e324e5868a3d258bbab75c5531d2eb770d4324a2900
110-
111-
2+
https://github.com/purescript/package-sets/releases/download/psc-0.14.2-20210629/packages.dhall sha256:534c490bb73cae75adb5a39871142fd8db5c2d74c90509797a80b8bb0d5c3f7b
1123

1134
let overrides = {=}
1145

1156
let additions =
116-
{ coroutine-transducers =
117-
{ dependencies =
118-
[ "aff"
119-
, "coroutines"
120-
, "effect"
121-
, "maybe"
122-
, "psci-support"
123-
]
124-
, repo =
125-
"https://github.com/blinky3713/purescript-coroutine-transducers"
126-
, version =
127-
"v1.0.0"
128-
}
129-
, eth-core =
130-
{ dependencies =
7+
{ coroutine-transducers =
8+
{ dependencies =
9+
[ "aff", "coroutines", "effect", "maybe", "psci-support" ]
10+
, repo =
11+
"https://github.com/blinky3713/purescript-coroutine-transducers"
12+
, version = "v1.0.0"
13+
}
14+
, eth-core =
15+
{ dependencies =
13116
[ "argonaut"
13217
, "bytestrings"
13318
, "console"
@@ -141,21 +26,14 @@ let additions =
14126
, "ring-modules"
14227
, "simple-json"
14328
]
144-
, repo =
145-
"https://github.com/f-o-a-m/purescript-eth-core.git"
146-
, version =
147-
"v6.0.0"
148-
}
149-
, tagged =
150-
{ dependencies =
151-
[ "identity"
152-
, "profunctor"
153-
]
154-
, repo =
155-
"https://github.com/LiamGoodacre/purescript-tagged"
156-
, version =
157-
"v3.0.0"
29+
, repo = "https://github.com/f-o-a-m/purescript-eth-core.git"
30+
, version = "v7.0.0"
31+
}
32+
, tagged =
33+
{ dependencies = [ "identity", "profunctor" ]
34+
, repo = "https://github.com/kejace/purescript-tagged"
35+
, version = "v0.14"
36+
}
15837
}
159-
}
16038

16139
in upstream // overrides // additions

spago.dhall

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,44 @@ You can edit this file as you like.
55
{ name = "web3"
66
, dependencies =
77
[ "aff"
8-
, "avar"
9-
, "console"
108
, "coroutines"
119
, "coroutine-transducers"
12-
, "debug"
1310
, "effect"
1411
, "errors"
1512
, "eth-core"
1613
, "foreign"
1714
, "foreign-generic"
1815
, "fork"
19-
, "free"
2016
, "heterogeneous"
21-
, "identity"
2217
, "parsing"
2318
, "partial"
2419
, "profunctor-lenses"
25-
, "proxy"
2620
, "psci-support"
2721
, "tagged"
2822
, "transformers"
2923
, "typelevel-prelude"
3024
, "variant"
25+
, "argonaut"
26+
, "arrays"
27+
, "bifunctors"
28+
, "bytestrings"
29+
, "control"
30+
, "either"
31+
, "exceptions"
32+
, "foldable-traversable"
33+
, "foreign-object"
34+
, "integers"
35+
, "maybe"
36+
, "newtype"
37+
, "parallel"
38+
, "prelude"
39+
, "record"
40+
, "ring-modules"
41+
, "simple-json"
42+
, "strings"
43+
, "tailrec"
44+
, "tuples"
45+
, "unfoldable"
3146
]
3247
, packages = ./packages.dhall
3348
, sources = [ "src/**/*.purs" ]

src/Network/Ethereum/Web3.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Network.Ethereum.Web3
66
, module Network.Ethereum.Web3.Types.Provider
77
) where
88

9-
import Network.Ethereum.Web3.Contract (class EventFilter, eventFilter, event, call, sendTx, deployContract, mkDataField)
9+
import Network.Ethereum.Web3.Contract (class EventFilter, event, eventFilter, call, sendTx, deployContract, mkDataField)
1010
import Network.Ethereum.Web3.Contract.Events (event', EventHandler, MultiFilterStreamState(..), FilterStreamState, ChangeReceipt)
1111
import Network.Ethereum.Web3.Solidity
1212
( D0

src/Network/Ethereum/Web3/Api.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Network.Ethereum.Web3.Api where
33
import Data.Maybe (Maybe, fromMaybe)
44
import Network.Ethereum.Types (Address, HexString, BigNumber)
55
import Network.Ethereum.Web3.JsonRPC (remote)
6-
import Network.Ethereum.Web3.Types (Block, BlockNumber, ChainCursor, Change, FalseOrObject, Filter, FilterId, NoPay, SyncStatus, Transaction, TransactionOptions, TransactionReceipt, Web3)
6+
import Network.Ethereum.Web3.Types (Block, BlockNumber, ChainCursor, Change, FalseOrObject, Filter, FilterId, SyncStatus, Transaction, TransactionOptions, TransactionReceipt, Web3)
77
import Network.Ethereum.Web3.Types.TokenUnit (MinorUnit)
88

99
-- | Returns current node version string.

src/Network/Ethereum/Web3/Contract.purs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ import Data.Functor.Tagged (Tagged, untagged)
1717
import Data.Generic.Rep (class Generic, Constructor)
1818
import Data.Lens ((.~), (%~), (?~))
1919
import Data.Maybe (Maybe(..))
20-
import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
20+
import Type.Proxy (Proxy(..))
21+
import Data.Symbol (class IsSymbol, reflectSymbol)
2122
import Effect.Exception (error)
2223
import Network.Ethereum.Core.Keccak256 (toSelector)
2324
import Network.Ethereum.Types (Address, HexString)
2425
import Network.Ethereum.Web3.Api (eth_call, eth_sendTransaction)
2526
import Network.Ethereum.Web3.Contract.Events (MultiFilterStreamState(..), event', FilterStreamState, ChangeReceipt, EventHandler)
2627
import Network.Ethereum.Web3.Solidity (class DecodeEvent, class GenericABIDecode, class GenericABIEncode, class RecordFieldsIso, genericABIEncode, genericFromData, genericFromRecordFields)
2728
import Network.Ethereum.Web3.Types (class TokenUnit, CallError(..), ChainCursor, ETHER, Filter, NoPay, TransactionOptions, Value, Web3, _data, _value, convert, throwWeb3)
28-
import Type.Proxy (Proxy)
29+
2930

3031
--------------------------------------------------------------------------------
31-
-- * Events
32-
--------------------------------------------------------------------------------
32+
-- * Events
33+
--------------------------------------------------------------------------------
34+
class EventFilter :: forall k. k -> Constraint
3335
class EventFilter e where
3436
-- | Event filter structure used by low-level subscription methods
3537
eventFilter :: Proxy e -> Address -> Filter e
@@ -68,7 +70,7 @@ class TxMethod (selector :: Symbol) a where
6870
TokenUnit (Value (u ETHER)) =>
6971
IsSymbol selector =>
7072
TransactionOptions u ->
71-
Tagged (SProxy selector) a ->
73+
Tagged (Proxy selector) a ->
7274
Web3 HexString
7375

7476
-- ^ 'Web3' wrapped tx hash
@@ -78,7 +80,7 @@ class CallMethod (selector :: Symbol) a b where
7880
IsSymbol selector =>
7981
TransactionOptions NoPay ->
8082
ChainCursor ->
81-
Tagged (SProxy selector) a ->
83+
Tagged (Proxy selector) a ->
8284
Web3 (Either CallError b)
8385

8486
-- ^ 'Web3' wrapped result
@@ -95,11 +97,11 @@ _sendTransaction ::
9597
GenericABIEncode rep =>
9698
TokenUnit (Value (u ETHER)) =>
9799
TransactionOptions u ->
98-
Tagged (SProxy selector) a ->
100+
Tagged (Proxy selector) a ->
99101
Web3 HexString
100102
_sendTransaction txOptions dat = do
101103
let
102-
sel = toSelector <<< reflectSymbol $ (SProxy :: SProxy selector)
104+
sel = toSelector <<< reflectSymbol $ (Proxy :: Proxy selector)
103105
eth_sendTransaction $ txdata $ sel <> (genericABIEncode <<< untagged $ dat)
104106
where
105107
txdata d =
@@ -116,11 +118,11 @@ _call ::
116118
GenericABIDecode brep =>
117119
TransactionOptions NoPay ->
118120
ChainCursor ->
119-
Tagged (SProxy selector) a ->
121+
Tagged (Proxy selector) a ->
120122
Web3 (Either CallError b)
121123
_call txOptions cursor dat = do
122124
let
123-
sig = reflectSymbol $ (SProxy :: SProxy selector)
125+
sig = reflectSymbol $ (Proxy :: Proxy selector)
124126

125127
sel = toSelector sig
126128

@@ -163,12 +165,12 @@ mkDataField ::
163165
Generic a (Constructor name args) =>
164166
RecordFieldsIso args fields l =>
165167
GenericABIEncode (Constructor name args) =>
166-
Proxy (Tagged (SProxy selector) a) ->
168+
Proxy (Tagged (Proxy selector) a) ->
167169
Record fields ->
168170
HexString
169171
mkDataField _ r =
170172
let
171-
sig = reflectSymbol (SProxy :: SProxy selector)
173+
sig = reflectSymbol (Proxy :: Proxy selector)
172174

173175
sel = toSelector sig
174176

0 commit comments

Comments
 (0)