-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
9 changed files
with
112 additions
and
130 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
8 changes: 8 additions & 0 deletions
8
backend/src/main/kotlin/com/retypeme/project/chain/ChainSettings.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,8 @@ | ||
package com.retypeme.project.chain | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
|
||
@ConfigurationProperties(prefix = "w3") | ||
class ChainSettings { | ||
var chains: List<ChainItemConfig> = mutableListOf() | ||
} |
19 changes: 5 additions & 14 deletions
19
backend/src/main/kotlin/com/retypeme/project/chain/ConfigReaderService.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 |
---|---|---|
@@ -1,25 +1,16 @@ | ||
package com.retypeme.project.chain | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class ConfigReaderService { | ||
val config: String = | ||
""" | ||
chains: | ||
class ConfigReaderService(private val settings: ChainSettings) { | ||
|
||
- id: 84532 | ||
name: Base Sepolia | ||
rpc: "https://sepolia.base.org" | ||
contract: "0xb4eb30e7f583d788a1611f4b7022bdda4bd4af81" | ||
""".trimIndent() | ||
@Value("\${contract.chains}") | ||
private lateinit var contractChains: List<Int> | ||
|
||
fun readChainConfig(): ChainConfig { | ||
val objectMapper = ObjectMapper(YAMLFactory()) | ||
return objectMapper.readValue(config, ChainConfig::class.java) | ||
return ChainConfig(settings.chains.filter { contractChains.contains(it.id) }) | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
backend/src/main/kotlin/com/retypeme/project/chain/ExtConfig.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,10 @@ | ||
package com.retypeme.project.chain | ||
|
||
import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
import org.springframework.context.annotation.Configuration | ||
|
||
|
||
@Configuration | ||
@EnableConfigurationProperties(ChainSettings::class) | ||
class ExtConfig { | ||
} |
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 was deleted.
Oops, something went wrong.
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