-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update chain resources processor as well
- Loading branch information
1 parent
bbbc67e
commit 8b37a88
Showing
5 changed files
with
30 additions
and
30 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
25 changes: 11 additions & 14 deletions
25
...ommonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipChainResourceProcessor.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,23 +1,20 @@ | ||
package exchange.dydx.abacus.processor.router.skip | ||
|
||
import exchange.dydx.abacus.output.input.TransferInputChainResource | ||
import exchange.dydx.abacus.processor.base.BaseProcessor | ||
import exchange.dydx.abacus.protocols.ParserProtocol | ||
|
||
internal class SkipChainResourceProcessor(parser: ParserProtocol) : BaseProcessor(parser) { | ||
private val keyMap = mapOf( | ||
"string" to mapOf( | ||
"chain_name" to "chainName", | ||
"rpc" to "rpc", | ||
"networkName" to "networkName", | ||
"chain_id" to "chainId", | ||
"logo_uri" to "iconUrl", | ||
), | ||
) | ||
internal class SkipChainResourceProcessor(private val parser: ParserProtocol) { | ||
|
||
override fun received( | ||
existing: Map<String, Any>?, | ||
fun received( | ||
payload: Map<String, Any> | ||
): Map<String, Any> { | ||
return transform(existing, payload, keyMap) | ||
): TransferInputChainResource { | ||
return TransferInputChainResource( | ||
chainName=parser.asString(payload["chain_name"]), | ||
rpc=parser.asString(payload["rpc"]), | ||
networkName=parser.asString(payload["networkName"]), | ||
chainId=parser.asInt(payload["chain_id"]), | ||
iconUrl=parser.asString(payload["logo_uri"]), | ||
) | ||
} | ||
} |
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