From 559a46425267d6bdd14b6d0c652aa12f4f7682e0 Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Fri, 8 Nov 2019 18:53:50 -0500 Subject: [PATCH] solution: revise for the latest etherjar --- .../io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt | 7 ++++--- .../io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt | 7 +++++-- .../io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt index b7487527..4271023b 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ConfiguredUpstreams.kt @@ -132,13 +132,14 @@ open class ConfiguredUpstreams( } conn.rpc?.let { endpoint -> val rpcClient = ReactorHttpRpcClient.newBuilder() - .setTarget(endpoint.url) + .connectTo(endpoint.url) + .alwaysSeparate() conn.rpc?.basicAuth?.let { auth -> - rpcClient.setBasicAuth(auth.username, auth.password) + rpcClient.basicAuth(auth.username, auth.password) } conn.rpc?.tls?.let { tls -> tls.ca?.let { ca -> - fileResolver.resolve(ca).inputStream().use { cert -> rpcClient.setTrustedCertificate(cert) } + fileResolver.resolve(ca).inputStream().use { cert -> rpcClient.trustedCertificate(cert) } } } rpcApi = DirectEthereumApi( diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt index 356ead74..d0bdaaf1 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumWs.kt @@ -45,10 +45,13 @@ class EthereumWs( fun connect() { log.info("Connecting to WebSocket: $uri") - val client = WebsocketClient(uri, origin) + val clientBuilder = WebsocketClient.newBuilder() + .connectTo(uri) + .origin(origin) basicAuth?.let { auth -> - client.setBasicAuth(auth.username, auth.password) + clientBuilder.basicAuth(auth.username, auth.password) } + val client = clientBuilder.build() try { client.connect() } catch (e: Exception) { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt index bc32459b..694dbc0c 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/grpc/GrpcUpstreams.kt @@ -74,8 +74,8 @@ class GrpcUpstreams( val client = ReactorBlockchainGrpc.newReactorStub(channel.build()) this.client = client this.grpcTransport = ReactorEmeraldClient.newBuilder() - .forChannel(client.channel) - .setObjectMapper(objectMapper) + .connectUsing(client.channel) + .objectMapper(objectMapper) .build() val statusSubscription = AtomicReference()