-
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.
- Loading branch information
1 parent
5f2e7e5
commit 23e8e79
Showing
14 changed files
with
864 additions
and
76 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
24 changes: 10 additions & 14 deletions
24
src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipTokenProcessor.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,21 +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 SkipTokenProcessor(parser: ParserProtocol) : BaseProcessor(parser) { | ||
private val keyMap = mapOf( | ||
"string" to mapOf( | ||
"name" to "stringKey", | ||
"denom" to "type", | ||
"logo_uri" to "iconUrl", | ||
), | ||
) | ||
|
||
override fun received( | ||
existing: Map<String, Any>?, | ||
internal class SkipTokenProcessor(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["name"]), | ||
string = parser.asString(payload["name"]), | ||
type = parser.asString(payload["denom"]) ?: "", | ||
iconUrl = parser.asString(payload["logo_uri"]), | ||
) | ||
} | ||
} |
29 changes: 13 additions & 16 deletions
29
...ommonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipTokenResourceProcessor.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.processor.base.BaseProcessor | ||
import exchange.dydx.abacus.output.input.TransferInputTokenResource | ||
import exchange.dydx.abacus.protocols.ParserProtocol | ||
|
||
internal class SkipTokenResourceProcessor(parser: ParserProtocol) : BaseProcessor(parser) { | ||
private val keyMap = mapOf( | ||
"string" to mapOf( | ||
"name" to "name", | ||
"denom" to "address", | ||
"symbol" to "symbol", | ||
"decimals" to "decimals", | ||
"logo_uri" to "iconUrl", | ||
), | ||
) | ||
|
||
override fun received( | ||
existing: Map<String, Any>?, | ||
internal class SkipTokenResourceProcessor( | ||
private val parser: ParserProtocol | ||
) { | ||
fun received( | ||
payload: Map<String, Any> | ||
): Map<String, Any> { | ||
return transform(existing, payload, keyMap) | ||
): TransferInputTokenResource { | ||
return TransferInputTokenResource( | ||
name = parser.asString(payload["name"]), | ||
address = parser.asString(payload["denom"]), | ||
symbol = parser.asString(payload["symbol"]), | ||
decimals = parser.asInt(payload["decimals"]), | ||
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
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.