diff --git a/BlockchainGateway/bc-gateway-core/src/main/kotlin/co/nilin/opex/bcgateway/core/spi/ChainEndpointProxyFinder.kt b/BlockchainGateway/bc-gateway-core/src/main/kotlin/co/nilin/opex/bcgateway/core/spi/ChainEndpointProxyFinder.kt
index 7db1ba870..f4762765a 100644
--- a/BlockchainGateway/bc-gateway-core/src/main/kotlin/co/nilin/opex/bcgateway/core/spi/ChainEndpointProxyFinder.kt
+++ b/BlockchainGateway/bc-gateway-core/src/main/kotlin/co/nilin/opex/bcgateway/core/spi/ChainEndpointProxyFinder.kt
@@ -1,5 +1,5 @@
package co.nilin.opex.bcgateway.core.spi
interface ChainEndpointProxyFinder {
- suspend fun findChainEndpointProxy(chainName: String):ChainEndpointProxy
-}
\ No newline at end of file
+ suspend fun findChainEndpointProxy(chainName: String): ChainEndpointProxy
+}
diff --git a/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/.gitignore b/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/.gitignore
new file mode 100644
index 000000000..f4e066ca5
--- /dev/null
+++ b/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/.gitignore
@@ -0,0 +1,36 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+!/.mvn/
+
+.DS_Store
diff --git a/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/pom.xml b/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/pom.xml
new file mode 100644
index 000000000..ca4affcdc
--- /dev/null
+++ b/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/pom.xml
@@ -0,0 +1,90 @@
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.4.4
+
+
+ 4.0.0
+
+ co.nilin.opex.external
+ bc-chain-proxy
+ 1.0-SNAPSHOT
+
+
+ 1.8
+ 1.4.31
+ ${version}
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ io.projectreactor.kotlin
+ reactor-kotlin-extensions
+
+
+ org.jetbrains.kotlin
+ kotlin-reflect
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib-jdk8
+
+
+ org.jetbrains.kotlinx
+ kotlinx-coroutines-reactor
+
+
+ org.jetbrains.kotlinx
+ kotlinx-coroutines-core
+
+
+ co.nilin.opex.external
+ bc-gateway-core
+ ${bc-gateway.version}
+
+
+
+
+ ${project.basedir}/src/main/kotlin
+ ${project.basedir}/src/test/kotlin
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-plugin
+
+
+ -Xjsr305=strict
+
+
+ spring
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-allopen
+ ${kotlin.version}
+
+
+
+
+
+
+
+
+ spring-milestones
+ Spring Milestones
+ https://repo.spring.io/milestone
+
+
+
+
diff --git a/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/src/main/kotlin/co.nilin.opex.port.bcgateway.chainproxy/impl/ChainEndpointProxyImpl.kt b/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/src/main/kotlin/co.nilin.opex.port.bcgateway.chainproxy/impl/ChainEndpointProxyImpl.kt
new file mode 100644
index 000000000..bf9e4e217
--- /dev/null
+++ b/BlockchainGateway/bc-gateway-ports/bc-chain-proxy/src/main/kotlin/co.nilin.opex.port.bcgateway.chainproxy/impl/ChainEndpointProxyImpl.kt
@@ -0,0 +1,12 @@
+package co.nilin.opex.port.bcgateway.chainproxy.impl
+
+import co.nilin.opex.bcgateway.core.model.ChainSyncRecord
+import co.nilin.opex.bcgateway.core.model.Endpoint
+import co.nilin.opex.bcgateway.core.spi.ChainEndpointProxy
+import org.springframework.stereotype.Component
+
+class ChainEndpointProxyImpl(private val endpoints: List) : ChainEndpointProxy {
+ override suspend fun syncTransfers(filter: ChainEndpointProxy.DepositFilter): ChainSyncRecord {
+ TODO("Not yet implemented")
+ }
+}
diff --git a/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/pom.xml b/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/pom.xml
index 321effaa2..f289f6e96 100644
--- a/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/pom.xml
+++ b/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/pom.xml
@@ -67,7 +67,13 @@
reactor-test
test
-
+
+ co.nilin.opex.external
+ bc-chain-proxy
+ 1.0-SNAPSHOT
+ compile
+
+
${project.basedir}/src/main/kotlin
diff --git a/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/src/main/kotlin/co/nilin/opex/port/bcgateway/postgres/dao/ChainRepository.kt b/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/src/main/kotlin/co/nilin/opex/port/bcgateway/postgres/dao/ChainRepository.kt
index 9395b112a..299ca7127 100644
--- a/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/src/main/kotlin/co/nilin/opex/port/bcgateway/postgres/dao/ChainRepository.kt
+++ b/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/src/main/kotlin/co/nilin/opex/port/bcgateway/postgres/dao/ChainRepository.kt
@@ -7,10 +7,11 @@ import kotlinx.coroutines.flow.Flow
import org.springframework.data.r2dbc.repository.Query
import org.springframework.data.repository.reactive.ReactiveCrudRepository
import org.springframework.stereotype.Repository
+import reactor.core.publisher.Mono
@Repository
interface ChainRepository : ReactiveCrudRepository {
- fun findByName(name: String): Flow
+ fun findByName(name: String): Mono
@Query(
"""
@@ -25,4 +26,4 @@ interface ChainRepository : ReactiveCrudRepository {
@Query("select * from chain_endpoints where chain_name = :name")
fun findEndpointsByName(name: String): Flow
-}
\ No newline at end of file
+}
diff --git a/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/src/main/kotlin/co/nilin/opex/port/bcgateway/postgres/impl/ChainEndpointProxyFinderImpl.kt b/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/src/main/kotlin/co/nilin/opex/port/bcgateway/postgres/impl/ChainEndpointProxyFinderImpl.kt
new file mode 100644
index 000000000..b0873c9f9
--- /dev/null
+++ b/BlockchainGateway/bc-gateway-ports/bc-persister-postgres/src/main/kotlin/co/nilin/opex/port/bcgateway/postgres/impl/ChainEndpointProxyFinderImpl.kt
@@ -0,0 +1,18 @@
+package co.nilin.opex.port.bcgateway.postgres.impl
+
+import co.nilin.opex.bcgateway.core.model.Endpoint
+import co.nilin.opex.bcgateway.core.spi.ChainEndpointProxy
+import co.nilin.opex.bcgateway.core.spi.ChainEndpointProxyFinder
+import co.nilin.opex.port.bcgateway.chainproxy.impl.ChainEndpointProxyImpl
+import co.nilin.opex.port.bcgateway.postgres.dao.ChainRepository
+import kotlinx.coroutines.flow.map
+import kotlinx.coroutines.flow.toList
+import org.springframework.stereotype.Component
+
+@Component
+class ChainEndpointProxyFinderImpl(private val chainRepository: ChainRepository) : ChainEndpointProxyFinder {
+ override suspend fun findChainEndpointProxy(chainName: String): ChainEndpointProxy {
+ val endpoints = chainRepository.findEndpointsByName(chainName).map { Endpoint(it.url) }.toList()
+ return ChainEndpointProxyImpl(endpoints)
+ }
+}
diff --git a/BlockchainGateway/pom.xml b/BlockchainGateway/pom.xml
index d2090befe..7c8b77ddf 100644
--- a/BlockchainGateway/pom.xml
+++ b/BlockchainGateway/pom.xml
@@ -13,5 +13,6 @@
bc-gateway-core
bc-gateway-app
bc-gateway-ports/bc-persister-postgres
+ bc-gateway-ports/bc-chain-proxy