-
Notifications
You must be signed in to change notification settings - Fork 78
[ETCM-215] faucet rpc client #798
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
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7d6cb9b
add new RpcClient Base
biandratti 9141528
add security in rpc client
biandratti e4a6271
change ssl config
biandratti b95c6ec
change certificate config
biandratti f7d0e8b
change ssl config
biandratti 2c02633
merge with develop
biandratti a2c0f21
change package from json rpc client
biandratti 6fb2470
add new test
biandratti 0fbeac3
improvement in ssl context
biandratti 144adb8
add tls default folder
biandratti 711cc91
merge with develop
biandratti ab402f4
add new tls config from rpc client
biandratti c0f313f
fix and add README TLS config
biandratti ae51850
change rpcclient
biandratti 91b18ab
change name ssl function
biandratti 754fa83
merge with develop
biandratti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/main/scala/io/iohk/ethereum/consensus/TestConsensusBuilder.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/scala/io/iohk/ethereum/faucet/jsonrpc/WalletRpcClient.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package io.iohk.ethereum.faucet.jsonrpc | ||
|
|
||
| import akka.actor.ActorSystem | ||
| import akka.http.scaladsl.model.Uri | ||
| import io.circe.syntax._ | ||
| import akka.util.ByteString | ||
| import io.iohk.ethereum.domain.Address | ||
| import io.iohk.ethereum.jsonrpc.client.RpcClient | ||
| import io.iohk.ethereum.jsonrpc.client.RpcClient.RpcError | ||
| import io.iohk.ethereum.security.SSLError | ||
| import io.iohk.ethereum.utils.Logger | ||
| import javax.net.ssl.SSLContext | ||
| import monix.eval.Task | ||
|
|
||
| import scala.concurrent.ExecutionContext | ||
|
|
||
| class WalletRpcClient(node: Uri, getSSLContext: () => Either[SSLError, SSLContext])(implicit | ||
| system: ActorSystem, | ||
| ec: ExecutionContext | ||
| ) extends RpcClient(node, getSSLContext) | ||
| with Logger { | ||
| import io.iohk.ethereum.jsonrpc.client.CommonJsonCodecs._ | ||
|
|
||
| def getNonce(address: Address): Task[Either[RpcError, BigInt]] = | ||
| doRequest[BigInt]("eth_getTransactionCount", List(address.asJson, "latest".asJson)) | ||
|
|
||
| def sendTransaction(rawTx: ByteString): Task[Either[RpcError, ByteString]] = | ||
| doRequest[ByteString]("eth_sendRawTransaction", List(rawTx.asJson)) | ||
| } |
32 changes: 15 additions & 17 deletions
32
src/main/scala/io/iohk/ethereum/faucet/jsonrpc/WalletService.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eum/mallet/service/CommonJsonCodecs.scala → ...eum/jsonrpc/client/CommonJsonCodecs.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.