Skip to content

0.12 Updates #118

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

Merged
merged 7 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,27 @@
"!src/**/*"
],
"dependencies": {
"purescript-errors": "^3.0.0",
"purescript-profunctor-lenses": "^3.8.0",
"purescript-foreign": "^4.0.1",
"purescript-foreign-generic": "^6.0.0",
"purescript-proxy": "^2.1.0",
"purescript-bytestrings": "^6.0.0",
"purescript-eth-core": "^v2.0.0",
"purescript-partial": "^1.2.1",
"purescript-parsing": "^4.3.1",
"purescript-transformers": "^3.6.0",
"purescript-identity": "^3.1.0",
"purescript-aff": "^4.1.0",
"purescript-tagged": "^2.0.0",
"purescript-free": "^4.3.0",
"purescript-coroutines": "^4.0.0",
"purescript-typelevel-prelude": "^2.7.0",
"purescript-modules": "^3.0.0",
"purescript-fork": "^3.0.0"
"purescript-errors": "^4.0.0",
"purescript-avar": "^3.0.0",
"purescript-profunctor-lenses": "^4.0.0",
"purescript-foreign": "^5.0.0",
"purescript-foreign-generic": "^7.0.0",
"purescript-proxy": "^3.0.0",
"purescript-eth-core": "^3.0.0",
"purescript-partial": "^2.0.0",
"purescript-parsing": "^5.0.0",
"purescript-transformers": "^4.0.0",
"purescript-identity": "^4.0.0",
"purescript-aff": "^5.0.0",
"purescript-tagged": "^3.0.0",
"purescript-free": "^5.0.0",
"purescript-coroutines": "^5.0.0",
"purescript-typelevel-prelude": "^3.0.0",
"purescript-fork": "^4.0.0"
},
"devDependencies": {
"purescript-debug": "v3.0.0",
"purescript-spec": "v2.0.0",
"purescript-psci-support": "v3.0.0"
"purescript-debug": "^4.0.0",
"purescript-spec": "^3.0.0",
"purescript-psci-support": "^4.0.0"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"secp256k1": "^3.0.1"
},
"devDependencies": {
"pulp": "^12.0.0",
"purescript": "^0.11.7",
"purescript-psa": "^0.6.0"
"purescript-psa": "^0.6.0",
"purescript": "^0.12.0",
"pulp": "^12.2.0"
}
}
2 changes: 1 addition & 1 deletion src/Network/Ethereum/Web3.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ import Network.Ethereum.Web3.Solidity
, Address, BigNumber, ByteString, BytesN, UIntN, Vector, fromByteString, fromData
, intNFromBigNumber, nilVector, toVector, uIntNFromBigNumber, unBytesN, unIntN, unUIntN, vCons, (:<)
)
import Network.Ethereum.Web3.Types (forkWeb3, forkWeb3',runWeb3, Address, Babbage, BigNumber, Block(..), BlockNumber(..), ChainCursor(..), Change(..), ETH, Ether, EventAction(..), Filter, FilterId, Finney, HexString, KEther, Lovelace, CallError(..), Shannon, Szabo, Transaction(..), TransactionOptions(..), TransactionReceipt(..), TransactionStatus(..), Value, Web3, Web3Par, Web3Error(..), Wei, _address, _data, _from, _fromBlock, _gas, _gasPrice, _nonce, _to, _toBlock, _topics, _value, convert, defaultFilter, defaultTransactionOptions, embed, formatValue, fromMinorUnit, mkAddress, mkHexString, mkValue, toMinorUnit, throwWeb3, unAddress, unHex)
import Network.Ethereum.Web3.Types (forkWeb3, forkWeb3',runWeb3, Address, Babbage, BigNumber, Block(..), BlockNumber(..), ChainCursor(..), Change(..), Ether, EventAction(..), Filter, FilterId, Finney, HexString, KEther, Lovelace, CallError(..), Shannon, Szabo, Transaction(..), TransactionOptions(..), TransactionReceipt(..), TransactionStatus(..), Value, Web3, Web3Par, Web3Error(..), Wei, _address, _data, _from, _fromBlock, _gas, _gasPrice, _nonce, _to, _toBlock, _topics, _value, convert, defaultFilter, defaultTransactionOptions, embed, formatValue, fromMinorUnit, mkAddress, mkHexString, mkValue, toMinorUnit, throwWeb3, unAddress, unHex)
import Network.Ethereum.Web3.Types.Provider (Provider, httpProvider, metamaskProvider)
84 changes: 42 additions & 42 deletions src/Network/Ethereum/Web3/Api.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,171 +8,171 @@ import Network.Ethereum.Web3.Types.TokenUnit (MinorUnit)
import Type.Data.Boolean (kind Boolean)

-- | Returns current node version string.
web3_clientVersion :: forall e . Partial => Web3 e String
web3_clientVersion :: Partial => Web3 String
web3_clientVersion = remote "web3_clientVersion"

-- | Returns Keccak-256 (*not* the standardized SHA3-256) of the given data.
web3_sha3 :: forall e. Partial => HexString -> Web3 e HexString
web3_sha3 :: Partial => HexString -> Web3 HexString
web3_sha3 hexInput = remote "web3_sha3" hexInput

-- | Get the network id that the node is listening to.
net_version :: forall e . Web3 e String
net_version :: Web3 String
net_version = remote "net_version"

-- | Returns `true`` if client is actively listening for network connections
net_listening :: forall e . Web3 e Boolean
net_listening :: Web3 Boolean
net_listening = remote "net_listening"

-- | Get the number of currently connected peers.
net_getPeerCount :: forall e. Web3 e BigNumber
net_getPeerCount :: Web3 BigNumber
net_getPeerCount = remote "net_peerCount"

-- | Returns the current ethereum protocol version
eth_protocolVersion :: forall e. Web3 e String
eth_protocolVersion :: Web3 String
eth_protocolVersion = remote "eth_protocolVersion"

-- | Get the sync status of the node.
eth_getSyncing :: forall e. Web3 e (FalseOrObject SyncStatus)
eth_getSyncing :: Web3 (FalseOrObject SyncStatus)
eth_getSyncing = remote "eth_syncing"

-- | Returns the client coinbase address
eth_coinbase :: forall e. Web3 e Address
eth_coinbase :: Web3 Address
eth_coinbase = remote "eth_coinbase"

-- | Returns `true` if client is actively mining new blocks
eth_mining :: forall e. Web3 e Boolean
eth_mining :: Web3 Boolean
eth_mining = remote "eth_mining"

-- | Returns the number of hashes per second that the node is mining with
eth_hashrate :: forall e. Web3 e BigNumber
eth_hashrate :: Web3 BigNumber
eth_hashrate = remote "eth_hashrate"

-- | Returns the current price per gas in wei
eth_gasPrice :: forall e. Web3 e BigNumber
eth_gasPrice :: Web3 BigNumber
eth_gasPrice = remote "eth_gasPrice"

-- | Returns the number of most recent block
eth_blockNumber :: forall e. Web3 e BlockNumber
eth_blockNumber :: Web3 BlockNumber
eth_blockNumber = remote "eth_blockNumber"

-- | Returns the balance of the account of given address.
eth_getBalance :: forall e . Address -> ChainCursor -> Web3 e BigNumber
eth_getBalance :: Address -> ChainCursor -> Web3 BigNumber
eth_getBalance addr cm = remote "eth_getBalance" addr cm

-- | Returns the value from a storage position at a given address
eth_getStorageAt :: forall e. Address -> BigNumber -> ChainCursor -> Web3 e HexString
eth_getStorageAt :: Address -> BigNumber -> ChainCursor -> Web3 HexString
eth_getStorageAt addr storagePos cm = remote "eth_getStorageAt" addr storagePos cm

-- | Returns the number of transactions *sent* from an address
eth_getTransactionCount :: forall e. Address -> ChainCursor -> Web3 e BigNumber
eth_getTransactionCount :: Address -> ChainCursor -> Web3 BigNumber
eth_getTransactionCount addr cm = remote "eth_getTransactionCount" addr cm

-- | Returns the number of transactions in a block from a block matching the given block hash
eth_getBlockTransactionCountByHash :: forall e. HexString -> Web3 e BigNumber
eth_getBlockTransactionCountByHash :: HexString -> Web3 BigNumber
eth_getBlockTransactionCountByHash blockHash = remote "eth_getBlockTransactionCountByHash" blockHash

-- | Returns the number of transactions in a block matching the given block number
eth_getBlockTransactionCountByNumber :: forall e. ChainCursor -> Web3 e BigNumber
eth_getBlockTransactionCountByNumber :: ChainCursor -> Web3 BigNumber
eth_getBlockTransactionCountByNumber cm = remote "eth_getBlockTransactionCountByNumber" cm

-- | Returns the number of uncles in a block from a block matching the given block hash
eth_getUncleCountByBlockHash :: forall e. HexString -> Web3 e BigNumber
eth_getUncleCountByBlockHash :: HexString -> Web3 BigNumber
eth_getUncleCountByBlockHash blockNumber = remote "eth_getUncleCountByBlockHash" blockNumber

-- | Returns the number of uncles in a block from a block matching the given block number
eth_getUncleCountByBlockNumber :: forall e. ChainCursor -> Web3 e BigNumber
eth_getUncleCountByBlockNumber :: ChainCursor -> Web3 BigNumber
eth_getUncleCountByBlockNumber cm = remote "eth_getUncleCountByBlockNumber" cm

-- | Returns code at a given address
eth_getCode :: forall e. Address -> ChainCursor -> Web3 e HexString
eth_getCode :: Address -> ChainCursor -> Web3 HexString
eth_getCode addr cm = remote "eth_getCode" addr cm

-- | Creates new message call transaction or a contract creation for signed transactions
eth_sendRawTransaction :: forall e. HexString -> Web3 e HexString
eth_sendRawTransaction :: HexString -> Web3 HexString
eth_sendRawTransaction rawTx = remote "eth_sendRawTransaction" rawTx

-- | Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas.
eth_estimateGas :: forall e. TransactionOptions MinorUnit -> Web3 e BigNumber
eth_estimateGas :: TransactionOptions MinorUnit -> Web3 BigNumber
eth_estimateGas txOpts = remote "eth_estimateGas" txOpts

-- | Returns information about a transaction by block hash and transaction index position.
eth_getTransactionByBlockHashAndIndex :: forall e. HexString -> BigNumber -> Web3 e Transaction
eth_getTransactionByBlockHashAndIndex :: HexString -> BigNumber -> Web3 Transaction
eth_getTransactionByBlockHashAndIndex blockHash txIndex = remote "eth_getTransactionByBlockHashAndIndex" blockHash txIndex

-- | Returns information about a transaction by block number and transaction index position.
eth_getTransactionByBlockNumberAndIndex :: forall e. ChainCursor -> BigNumber -> Web3 e Transaction
eth_getTransactionByBlockNumberAndIndex :: ChainCursor -> BigNumber -> Web3 Transaction
eth_getTransactionByBlockNumberAndIndex cm txIndex = remote "eth_getTransactionByBlockNumberAndIndex" cm txIndex

-- | Returns the receipt of a transaction by transaction hash.
eth_getTransactionReceipt :: forall e. HexString -> Web3 e TransactionReceipt
eth_getTransactionReceipt :: HexString -> Web3 TransactionReceipt
eth_getTransactionReceipt txHash = remote "eth_getTransactionReceipt" txHash

-- | Returns information about a uncle of a block by hash and uncle index position.
eth_getUncleByBlockHashAndIndex :: forall e. HexString -> BigNumber -> Web3 e Block
eth_getUncleByBlockHashAndIndex :: HexString -> BigNumber -> Web3 Block
eth_getUncleByBlockHashAndIndex blockHash uncleIndex = remote "eth_getUncleByBlockHashAndIndex" blockHash uncleIndex

-- | Returns information about a uncle of a block by number and uncle index position.
eth_getUncleByBlockNumberAndIndex :: forall e. ChainCursor -> BigNumber -> Web3 e Block
eth_getUncleByBlockNumberAndIndex :: ChainCursor -> BigNumber -> Web3 Block
eth_getUncleByBlockNumberAndIndex cm uncleIndex = remote "eth_getUncleByBlockNumberAndIndex" cm uncleIndex

-- | Returns a list of available compilers in the client.
eth_getCompilers :: forall e. Partial => Web3 e (Array String)
eth_getCompilers :: Partial => Web3 (Array String)
eth_getCompilers = remote "eth_getCompilers"

-- | Returns information about a block by number.
eth_getBlockByNumber :: forall e . ChainCursor -> Web3 e Block
eth_getBlockByNumber :: ChainCursor -> Web3 Block
eth_getBlockByNumber cm = remote "eth_getBlockByNumber" cm false

-- | Returns information about a block by hash.
eth_getBlockByHash :: forall e . HexString -> Web3 e Block
eth_getBlockByHash :: HexString -> Web3 Block
eth_getBlockByHash hx = remote "eth_getBlockByHash" hx false

-- | Returns information about a transaction by hash.
eth_getTransaction :: forall e . HexString -> Web3 e Transaction
eth_getTransaction :: HexString -> Web3 Transaction
eth_getTransaction hx = remote "eth_getTransactionByHash" hx

-- | Call a function on a particular block's state root.
eth_call :: forall e . TransactionOptions NoPay -> ChainCursor -> Web3 e HexString
eth_call :: TransactionOptions NoPay -> ChainCursor -> Web3 HexString
eth_call opts cm = remote "eth_call" opts cm

-- | Creates new message call transaction or a contract creation, if the data field contains code.
eth_sendTransaction :: forall e . TransactionOptions MinorUnit -> Web3 e HexString
eth_sendTransaction :: TransactionOptions MinorUnit -> Web3 HexString
eth_sendTransaction opts = remote "eth_sendTransaction" opts

-- | Get all account addresses registered at the `Provider`
eth_getAccounts :: forall e . Web3 e (Array Address)
eth_getAccounts :: Web3 (Array Address)
eth_getAccounts = remote "eth_accounts"

-- | Creates a filter object, based on filter options, to notify when the
-- | state changes (logs). To check if the state has changed, call 'eth_getFilterChanges'.
eth_newFilter :: forall a e . Filter a -> Web3 e FilterId
eth_newFilter :: forall a . Filter a -> Web3 FilterId
eth_newFilter f = remote "eth_newFilter" f

-- | Creates a filter in the node, to notify when a new block arrives.
-- | To check if the state has changed, call `eth_getFilterChanges`.
eth_newBlockFilter :: forall e. Web3 e FilterId
eth_newBlockFilter :: Web3 FilterId
eth_newBlockFilter = remote "eth_newBlockFilter"

-- | Polling method for a filter, which returns an array of logs which occurred since last poll.
eth_getFilterChanges :: forall e . FilterId -> Web3 e (Array Change)
eth_getFilterChanges :: FilterId -> Web3 (Array Change)
eth_getFilterChanges fid = remote "eth_getFilterChanges" fid

-- | Returns an array of all logs matching filter with given id.
eth_getFilterLogs :: forall e. FilterId -> Web3 e (Array Change)
eth_getFilterLogs :: FilterId -> Web3 (Array Change)
eth_getFilterLogs fid = remote "eth_getFilterLogs" fid

-- | Returns an array of all logs matching a given filter object
eth_getLogs :: forall a e. Filter a -> Web3 e (Array Change)
eth_getLogs :: forall a. Filter a -> Web3 (Array Change)
eth_getLogs filter = remote "eth_getLogs" filter

-- | Uninstalls a filter with given id. Should always be called when watch is no longer needed.
eth_uninstallFilter :: forall e . FilterId -> Web3 e Boolean
eth_uninstallFilter :: FilterId -> Web3 Boolean
eth_uninstallFilter fid = remote "eth_uninstallFilter" fid

-- | Sign a message with the given address, returning the signature.
personal_sign :: forall e . HexString -> Address -> Maybe String -> Web3 e HexString
personal_sign :: HexString -> Address -> Maybe String -> Web3 HexString
personal_sign _data signer password = remote "personal_sign" _data signer (fromMaybe "" password)

-- | Recover the address that signed the message from (1) the message and (2) the signature
personal_ecRecover :: forall e . HexString -> HexString -> Web3 e Address
personal_ecRecover :: HexString -> HexString -> Web3 Address
personal_ecRecover _data sig = remote "personal_ecRecover" _data sig
Loading