-
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.
Merge branch 'main' into cosmos-wallet-connected
- Loading branch information
Showing
17 changed files
with
552 additions
and
74 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
25 changes: 10 additions & 15 deletions
25
src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipChainProcessor.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,22 +1,17 @@ | ||
package exchange.dydx.abacus.processor.router.skip | ||
|
||
import exchange.dydx.abacus.processor.base.BaseProcessor | ||
import exchange.dydx.abacus.output.input.SelectionOption | ||
import exchange.dydx.abacus.protocols.ParserProtocol | ||
|
||
internal class SkipChainProcessor(parser: ParserProtocol) : BaseProcessor(parser) { | ||
private val keyMap = mapOf( | ||
"string" to mapOf( | ||
"chain_name" to "stringKey", | ||
"networkIdentifier" to "stringKey", | ||
"chain_id" to "type", | ||
"logo_uri" to "iconUrl", | ||
), | ||
) | ||
|
||
override fun received( | ||
existing: Map<String, Any>?, | ||
internal class SkipChainProcessor(private val parser: ParserProtocol) { | ||
fun received( | ||
payload: Map<String, Any> | ||
): Map<String, Any> { | ||
return transform(existing, payload, keyMap) | ||
): SelectionOption { | ||
return SelectionOption( | ||
stringKey = parser.asString(payload["network_identifier"]) ?: parser.asString(payload["chain_name"]), | ||
string = parser.asString(payload["network_identifier"]) ?: parser.asString(payload["chain_name"]), | ||
type = parser.asString(payload["chain_id"]) ?: "", | ||
iconUrl = parser.asString(payload["logo_uri"]), | ||
) | ||
} | ||
} |
26 changes: 11 additions & 15 deletions
26
...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,19 @@ | ||
package exchange.dydx.abacus.processor.router.skip | ||
|
||
import exchange.dydx.abacus.processor.base.BaseProcessor | ||
import exchange.dydx.abacus.output.input.TransferInputChainResource | ||
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
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
Oops, something went wrong.