From 662d061dfc476b75ea746af9ee99de7eb6ffe6c8 Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Thu, 5 Oct 2023 15:46:47 -0700 Subject: [PATCH] WIP latest consensusj snapshot --- gradle.properties | 6 +++--- .../src/main/java/foundation/omni/rpc/OmniClient.java | 5 +++-- .../main/java/foundation/omni/rpc/OmniProxyMethods.java | 6 +++--- .../foundation/omni/netapi/omnicore/OmniCoreClient.java | 5 +++-- .../omni/netapi/omniwallet/OmniwalletAbstractClient.java | 9 ++++----- .../groovy/foundation/omni/test/OmniTestSupport.groovy | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gradle.properties b/gradle.properties index b3f1c39d..b058cb78 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ -omnijVersion = 0.7.0-alpha2 +omnijVersion = 0.7.0-SNAPSHOT -useMavenLocal = false +useMavenLocal = true bitcoinjVersion = 0.17-alpha2 -consensusjVersion = 0.7.0-alpha2 +consensusjVersion = 0.7.0-SNAPSHOT slf4jVersion = 2.0.7 groovyVersion = 4.0.14 spockVersion = 2.3-groovy-4.0 diff --git a/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniClient.java b/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniClient.java index d624a688..ce8fcf98 100644 --- a/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniClient.java +++ b/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniClient.java @@ -20,6 +20,7 @@ import org.consensusj.bitcoin.jsonrpc.bitcoind.BitcoinConfFile; import org.consensusj.bitcoin.rx.jsonrpc.RxBitcoinClient; import org.consensusj.jsonrpc.JsonRpcException; +import org.consensusj.jsonrpc.JsonRpcTransport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +61,7 @@ public OmniClient(RpcConfig config) { } public OmniClient(Network network, URI server, String rpcuser, String rpcpassword) { - this(getDefaultSSLContext(), network, server, rpcuser, rpcpassword, false, false); + this(JsonRpcTransport.getDefaultSSLContext(), network, server, rpcuser, rpcpassword, false, false); } public OmniClient(SSLContext sslContext, Network network, URI server, String rpcuser, String rpcpassword, boolean useZmq) { @@ -68,7 +69,7 @@ public OmniClient(SSLContext sslContext, Network network, URI server, String rpc } public OmniClient(Network network, URI server, String rpcuser, String rpcpassword, boolean useZmq, boolean isOmniProxy) { - this(getDefaultSSLContext(), network, server, rpcuser, rpcpassword, useZmq, isOmniProxy); + this(JsonRpcTransport.getDefaultSSLContext(), network, server, rpcuser, rpcpassword, useZmq, isOmniProxy); } public OmniClient(SSLContext sslContext, Network network, URI server, String rpcuser, String rpcpassword, boolean useZmq, boolean isOmniProxy) { diff --git a/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniProxyMethods.java b/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniProxyMethods.java index de111cc7..4c36195e 100644 --- a/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniProxyMethods.java +++ b/omnij-jsonrpc/src/main/java/foundation/omni/rpc/OmniProxyMethods.java @@ -12,7 +12,7 @@ import org.bitcoinj.base.AddressParser; import org.bitcoinj.base.Sha256Hash; import org.consensusj.analytics.service.TokenRichList; -import org.consensusj.jsonrpc.JacksonRpcClient; +import org.consensusj.jsonrpc.JsonRpcClient; import org.consensusj.jsonrpc.JsonRpcException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +26,7 @@ /** * Interface with default methods implementing omniproxy RPCs. */ -public interface OmniProxyMethods extends JacksonRpcClient { +public interface OmniProxyMethods extends JsonRpcClient { Logger log = LoggerFactory.getLogger(OmniProxyMethods.class); AddressParser addressParser = AddressParser.getDefault(); @@ -37,7 +37,7 @@ public interface OmniProxyMethods extends JacksonRpcClient { boolean isOmniProxyServer(); private List omniProxyListPropertiesSync() throws IOException { - JavaType javaType = getMapper().getTypeFactory().constructCollectionType(List.class, OmniPropertyInfo.class); + JavaType javaType = collectionTypeForClasses(List.class, OmniPropertyInfo.class); return send("omniproxy.listproperties", javaType); } diff --git a/omnij-net-api/src/main/java/foundation/omni/netapi/omnicore/OmniCoreClient.java b/omnij-net-api/src/main/java/foundation/omni/netapi/omnicore/OmniCoreClient.java index 1af3d1da..ff00421f 100644 --- a/omnij-net-api/src/main/java/foundation/omni/netapi/omnicore/OmniCoreClient.java +++ b/omnij-net-api/src/main/java/foundation/omni/netapi/omnicore/OmniCoreClient.java @@ -13,6 +13,7 @@ import foundation.omni.rpc.OmniClient; import org.consensusj.bitcoin.json.pojo.ChainTip; import org.consensusj.bitcoin.json.pojo.bitcore.AddressBalanceInfo; +import org.consensusj.bitcoin.rx.ChainTipPublisher; import org.consensusj.jsonrpc.JsonRpcException; import org.consensusj.jsonrpc.JsonRpcStatusException; import foundation.omni.CurrencyID; @@ -261,11 +262,11 @@ public Single> richList(CurrencyID id, int @Override public Publisher> richListUpdates(CurrencyID id, int n) { - return client.pollOnNewBlock(() -> client.omniProxyGetRichListSync(id, n)); + return client.pollOnNewBlockAsync(() -> client.omniProxyGetRichList(id, n)); } @Override - public Publisher chainTipPublisher() { + public ChainTipPublisher chainTipPublisher() { return client.chainTipPublisher(); } diff --git a/omnij-net-api/src/main/java/foundation/omni/netapi/omniwallet/OmniwalletAbstractClient.java b/omnij-net-api/src/main/java/foundation/omni/netapi/omniwallet/OmniwalletAbstractClient.java index cbc313e0..56311806 100644 --- a/omnij-net-api/src/main/java/foundation/omni/netapi/omniwallet/OmniwalletAbstractClient.java +++ b/omnij-net-api/src/main/java/foundation/omni/netapi/omniwallet/OmniwalletAbstractClient.java @@ -26,7 +26,7 @@ import org.bitcoinj.base.Address; import org.bitcoinj.base.Network; import org.consensusj.bitcoin.json.pojo.ChainTip; -import org.consensusj.bitcoin.rx.jsonrpc.PollingChainTipService; +import org.consensusj.bitcoin.rx.ChainTipPublisher; import org.reactivestreams.Publisher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -181,9 +181,9 @@ public ConsensusSnapshot createSnapshot(CurrencyID id, int blockHeight, SortedMa } @Override - public Publisher chainTipPublisher() { + public ChainTipPublisher chainTipPublisher() { start(); - return chainTipProcessor; + return ChainTipPublisher.of(chainTipProcessor); } private ChainTip revisionInfoToChainTip(RevisionInfo info) { @@ -191,8 +191,7 @@ private ChainTip revisionInfoToChainTip(RevisionInfo info) { } /** - * Using a polling interval provided by {@link PollingChainTipService#getPollingInterval()} provide a - * stream of distinct {@link ChainTip}s. + * Use polling to provide a stream of distinct {@link ChainTip}s. * * @return A stream of distinct {@code ChainTip}s. */ diff --git a/omnij-rpc/src/main/groovy/foundation/omni/test/OmniTestSupport.groovy b/omnij-rpc/src/main/groovy/foundation/omni/test/OmniTestSupport.groovy index f0cb23bd..f3778223 100644 --- a/omnij-rpc/src/main/groovy/foundation/omni/test/OmniTestSupport.groovy +++ b/omnij-rpc/src/main/groovy/foundation/omni/test/OmniTestSupport.groovy @@ -2,7 +2,7 @@ package foundation.omni.test import foundation.omni.net.MoneyMan import foundation.omni.rpc.test.OmniTestClientAccessor -import org.consensusj.bitcoin.jsonrpc.groovy.test.BTCTestSupport +import org.consensusj.bitcoin.jsonrpc.test.BTCTestSupport import foundation.omni.Ecosystem import foundation.omni.OmniDivisibleValue import foundation.omni.OmniValue