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