-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d628c33
commit 75c74d9
Showing
11 changed files
with
173 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/io/emeraldpay/dshackle/upstream/TonCompoundHttpFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.emeraldpay.dshackle.upstream | ||
|
||
import io.emeraldpay.dshackle.Chain | ||
import io.emeraldpay.dshackle.upstream.restclient.TonCompoundRestHttpReader | ||
|
||
class TonCompoundHttpFactory( | ||
private val tonHttpFactory: HttpFactory, | ||
private val tonV3HttpFactory: HttpFactory?, | ||
) : HttpFactory { | ||
|
||
override fun create(id: String?, chain: Chain): HttpReader { | ||
val tonReader = tonHttpFactory.create(id, chain) | ||
if (tonV3HttpFactory != null) { | ||
return TonCompoundRestHttpReader(tonReader, tonV3HttpFactory.create(id, chain)) | ||
} | ||
return tonReader | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/io/emeraldpay/dshackle/upstream/restclient/TonCompoundRestHttpReader.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.emeraldpay.dshackle.upstream.restclient | ||
|
||
import io.emeraldpay.dshackle.upstream.ChainRequest | ||
import io.emeraldpay.dshackle.upstream.ChainResponse | ||
import io.emeraldpay.dshackle.upstream.HttpReader | ||
import reactor.core.publisher.Mono | ||
|
||
class TonCompoundRestHttpReader( | ||
private val restReader: HttpReader, | ||
private val restReaderV3: HttpReader, | ||
) : HttpReader() { | ||
|
||
override fun read(key: ChainRequest): Mono<ChainResponse> { | ||
if (key.method.contains("v3")) { | ||
return restReaderV3.read(key) | ||
} | ||
return restReader.read(key) | ||
} | ||
|
||
override fun internalRead(key: ChainRequest): Mono<ChainResponse> { | ||
return Mono.empty() | ||
} | ||
|
||
override fun onStop() { | ||
restReader.onStop() | ||
restReaderV3.onStop() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters