Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parsing for wallet connect modal wallet list #768

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.13.42"
version = "1.13.43"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package exchange.dydx.abacus.state.manager

import exchange.dydx.abacus.protocols.LocalizerProtocol
import exchange.dydx.abacus.protocols.ParserProtocol
import exchange.dydx.abacus.protocols.asTypedList
import exchange.dydx.abacus.utils.IList
import exchange.dydx.abacus.utils.IMap
import exchange.dydx.abacus.utils.ServerTime
Expand Down Expand Up @@ -263,14 +264,33 @@ data class WalletConnectV1(
@JsExport
data class WalletConnectV2(
val projectId: String,
val wallets: WalletConnectV2Wallets?
) {
companion object {
fun parse(
data: Map<String, Any>?,
parser: ParserProtocol,
): WalletConnectV2? {
val projectId = parser.asString(data?.get("projectId")) ?: return null
return WalletConnectV2(projectId)
val wallets = WalletConnectV2Wallets.parse(parser.asMap(data?.get("wallets")), parser)
return WalletConnectV2(projectId, wallets)
}
}
}

@JsExport
data class WalletConnectV2Wallets(
val ios: IList<String>?,
val android: IList<String>?
) {
companion object {
fun parse(
data: Map<String, Any>?,
parser: ParserProtocol,
): WalletConnectV2Wallets? {
val ios = parser.asTypedList<String>(data?.get("ios"))?.toIList()
val android = parser.asTypedList<String>(data?.get("android"))?.toIList()
return WalletConnectV2Wallets(ios, android)
}
}
}
Expand Down Expand Up @@ -345,11 +365,11 @@ data class WalletConnection(
val signTypedDataDomainName = parser.asString(data?.get("signTypedDataDomainName"))
return if (walletConnect != null || walletSegue != null) {
WalletConnection(
walletConnect,
walletSegue,
"$deploymentUri$images",
signTypedDataAction,
signTypedDataDomainName,
walletConnect = walletConnect,
walletSegue = walletSegue,
images = "$deploymentUri$images",
signTypedDataAction = signTypedDataAction,
signTypedDataDomainName = signTypedDataDomainName,
)
} else {
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,24 @@ class AbacusMockData {
tradingRewardsLearnMore = "https://docs.dydx.exchange/concepts-trading/rewards_fees_and_parameters",
),
walletConnection = WalletConnection(
WalletConnect(
walletConnect = WalletConnect(
WalletConnectClient(
"test",
"test",
"test",
name = "test",
description = "test",
iconUrl = "test",
),
WalletConnectV1(
"test",
bridgeUrl = "test",
),
WalletConnectV2(
"test",
projectId = "test",
wallets = null,
),
),
WalletSegue("callback"),
"/images/",
"test",
"test",
walletSegue = WalletSegue("callback"),
images = "/images/",
signTypedDataAction = "test",
signTypedDataDomainName = "test",
),
apps = null,
tokens = mapOf(
Expand Down
2 changes: 1 addition & 1 deletion v4_abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'v4_abacus'
spec.version = '1.13.42'
spec.version = '1.13.43'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down