solution: upgrade to the latest api definitions
This commit is contained in:
10
build.gradle
10
build.gradle
@@ -37,8 +37,10 @@ group = 'io.emeraldpay.dshackle'
|
||||
// x.x-SNAPSHOT for development
|
||||
version = '0.9.0-SNAPSHOT'
|
||||
|
||||
targetCompatibility = '11'
|
||||
sourceCompatibility = '11'
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
@@ -57,7 +59,7 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.emeraldpay:emerald-api:0.8.0"
|
||||
implementation "io.emeraldpay:emerald-api:0.9.0"
|
||||
|
||||
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
|
||||
implementation "io.grpc:grpc-stub:${grpcVersion}"
|
||||
@@ -82,7 +84,7 @@ dependencies {
|
||||
implementation "io.projectreactor.netty:reactor-netty:0.9.7.RELEASE"
|
||||
implementation 'io.projectreactor.addons:reactor-extra:3.3.3.RELEASE'
|
||||
implementation 'io.projectreactor.kotlin:reactor-kotlin-extensions:1.0.2.RELEASE'
|
||||
implementation 'com.salesforce.servicelibs:reactor-grpc:0.10.0'
|
||||
implementation "com.salesforce.servicelibs:reactor-grpc:$reactiveGrpcVersion"
|
||||
implementation 'io.lettuce:lettuce-core:5.2.2.RELEASE'
|
||||
|
||||
implementation "io.infinitape:etherjar-domain:$etherjarVersion"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# Languages
|
||||
groovyVersion=2.5.5
|
||||
kotlinVersion=1.3.11
|
||||
protocVersion=3.7.1
|
||||
protocVersion=3.9.0
|
||||
# Main Libs
|
||||
slf4jVersion=1.7.25
|
||||
jacksonVersion=2.11.0
|
||||
grpcVersion=1.25.0
|
||||
protobufVersion=3.7.1
|
||||
grpcVersion=1.32.1
|
||||
reactiveGrpcVersion=1.0.1
|
||||
springBootVersion=2.1.14.RELEASE
|
||||
springVersion=5.2.6.RELEASE
|
||||
springSecurtyVersion=5.3.2.RELEASE
|
||||
|
||||
@@ -28,6 +28,7 @@ import io.emeraldpay.dshackle.upstream.bitcoin.BitcoinMultistream
|
||||
import io.emeraldpay.dshackle.upstream.bitcoin.data.SimpleUnspent
|
||||
import io.emeraldpay.dshackle.upstream.grpc.BitcoinGrpcUpstream
|
||||
import io.emeraldpay.grpc.Chain
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.bitcoinj.params.MainNetParams
|
||||
import org.bitcoinj.params.TestNet3Params
|
||||
import org.slf4j.LoggerFactory
|
||||
@@ -101,10 +102,10 @@ class TrackBitcoinAddress(
|
||||
?: return Flux.error(IllegalStateException("Xpub verification is not available"))
|
||||
|
||||
val addressXpub = request.address.addressXpub
|
||||
if (!addressXpub.xpub.isValidUtf8) {
|
||||
return Flux.error(IllegalArgumentException("Invalid xpub string"))
|
||||
if (StringUtils.isEmpty(addressXpub.xpub)) {
|
||||
return Flux.error(IllegalArgumentException("xpub string is empty"))
|
||||
}
|
||||
val xpub = addressXpub.xpub.toStringUtf8()
|
||||
val xpub = addressXpub.xpub
|
||||
val start = Math.max(0, addressXpub.start).toInt()
|
||||
val limit = Math.min(100, Math.max(1, addressXpub.limit)).toInt()
|
||||
xpubAddresses.activeAddresses(xpub, start, limit)
|
||||
@@ -197,12 +198,26 @@ class TrackBitcoinAddress(
|
||||
val chain = Chain.byId(request.asset.chainValue)
|
||||
val upstream = multistreamHolder.getUpstream(chain)?.cast(BitcoinMultistream::class.java)
|
||||
?: return Flux.error(SilentException.UnsupportedBlockchain(request.asset.chainValue))
|
||||
println("call get balance")
|
||||
return if (isBalanceAvailable(chain)) {
|
||||
val addresses = allAddresses(upstream, request)
|
||||
requestBalances(chain, upstream, addresses, request.includeUtxo)
|
||||
.map(this@TrackBitcoinAddress::buildResponse)
|
||||
.doOnError { t ->
|
||||
log.error("Failed to get balance", t)
|
||||
}
|
||||
} else {
|
||||
println("call remote balance")
|
||||
getRemoteBalance(upstream, request)
|
||||
.doOnEach {
|
||||
println("each ${it.type}")
|
||||
}
|
||||
.doOnError { t ->
|
||||
t.printStackTrace()
|
||||
}
|
||||
.doOnComplete {
|
||||
println("received all")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user