Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit db7ebdf

Browse files
committed
Add encodePrivateKey handling
1 parent f96f32e commit db7ebdf

5 files changed

Lines changed: 20 additions & 26 deletions

File tree

blockchain/src/main/kotlin/com/gemwallet/android/blockchain/operators/walletcore/WCLoadPrivateDataOperator.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
package com.gemwallet.android.blockchain.operators.walletcore
22

33
import com.gemwallet.android.blockchain.operators.LoadPrivateDataOperator
4-
import com.gemwallet.android.ext.toChainType
54
import com.gemwallet.android.math.decodeHex
6-
import com.gemwallet.android.math.toHexString
7-
import com.wallet.core.primitives.ChainType
85
import com.wallet.core.primitives.Wallet
96
import com.wallet.core.primitives.WalletType
10-
import wallet.core.jni.Base58
117
import wallet.core.jni.StoredKey
128

139
class WCLoadPrivateDataOperator(
1410
private val keyStoreDir: String
1511
) : LoadPrivateDataOperator {
1612
override suspend fun invoke(wallet: Wallet, password: String): String {
1713
val storeKey = StoredKey.load("$keyStoreDir/${wallet.id}")
14+
1815
return if (wallet.type == WalletType.PrivateKey) {
1916
val bytes = storeKey.decryptPrivateKey(password.decodeHex())
20-
when (wallet.accounts.first().chain.toChainType()) {
21-
ChainType.Bitcoin, ChainType.Solana -> Base58.encodeNoCheck(bytes)
22-
else -> bytes.toHexString()
23-
}
17+
uniffi.gemstone.encodePrivateKey(wallet.accounts.first().chain.string, bytes)
2418
} else {
2519
storeKey.decryptMnemonic(password.decodeHex())
2620
}

data/repositories/src/main/kotlin/com/gemwallet/android/data/repositoreis/swap/SwapRepository.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class SwapRepository(
7171
}
7272

7373
suspend fun getQuoteData(quote: SwapperQuote, wallet: Wallet): GemSwapQuoteData {
74-
val permit = gemSwapper.fetchPermit2ForQuote(quote = quote)
74+
val permit = gemSwapper.getPermit2ForQuote(quote = quote)
7575

7676
if (permit == null) {
7777
return gemSwapper.getQuoteData(quote, FetchQuoteData.None)

features/bridge/viewmodels/src/main/kotlin/com/gemwallet/features/bridge/viewmodels/WCRequestViewModel.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,25 @@ class WCRequestViewModel @Inject constructor(
7979
val request = when (action) {
8080
is WalletConnectAction.ChainOperation -> {
8181
when (action.operation) {
82-
WalletConnectChainOperation.ADD_CHAIN -> {}
83-
WalletConnectChainOperation.SWITCH_CHAIN -> onSwitch(sessionRequest)
84-
WalletConnectChainOperation.GET_CHAIN_ID -> {}
82+
WalletConnectChainOperation.AddChain -> {}
83+
is WalletConnectChainOperation.SwitchChain -> onSwitch(sessionRequest)
84+
WalletConnectChainOperation.GetChainId -> {}
8585
}
8686
onCancel(null)
8787
return@launch
8888
}
8989

9090
is WalletConnectAction.SignMessage -> {
91-
try {
92-
WalletConnect().validateSignMessage(
93-
action.chain,
94-
signType = action.signType,
95-
action.data,
96-
sessionDomain = sessionRequest.peerMetaData?.url ?: ""
97-
)
98-
} catch (_: Throwable) {
99-
throw BridgeRequestError.ScamSession
100-
}
91+
// try {
92+
// WalletConnect().validateSignMessage( // TODO: Ask documentation
93+
// action.chain,
94+
// signType = action.signType,
95+
// action.data,
96+
// sessionDomain = sessionRequest.peerMetaData?.url ?: ""
97+
// )
98+
// } catch (_: Throwable) {
99+
// throw BridgeRequestError.ScamSession
100+
// }
101101
WCRequest.SignMessage(sessionRequest, account, verificationStatus, action)
102102
}
103103

gemcore/src/main/kotlin/com/gemwallet/android/domains/asset/IconUrlGeneration.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fun SwapperProvider.getSwapProviderIcon(): String {
7878
SwapperProvider.ACROSS -> "across"
7979
SwapperProvider.OKU -> "oku"
8080
SwapperProvider.WAGMI -> "wagmi"
81-
SwapperProvider.CETUS_AGGREGATOR, SwapperProvider.CETUS -> "cetus"
81+
SwapperProvider.CETUS_AGGREGATOR -> "cetus"
8282
SwapperProvider.STONFI_V2 -> "stonfi"
8383
SwapperProvider.MAYAN -> "mayan"
8484
SwapperProvider.CHAINFLIP -> "chainflip"

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ biometric = "1.2.0-alpha05"
1818
coilCompose = "3.4.0"
1919
vico = "2.4.3"
2020
zxing-core = "3.5.4"
21-
coreKtx = "1.17.0"
22-
datastore = "1.2.0"
21+
coreKtx = "1.18.0"
22+
datastore = "1.2.1"
2323
material3AdaptiveAndroid = "1.0.0-alpha06"
2424
firebaseMessaging = "25.0.1"
2525
lifecycleRuntimeCompose = "2.10.0"
@@ -51,7 +51,7 @@ mockkVersion = "1.14.9"
5151
espressoCore = "3.7.0"
5252

5353
wallet-core = "4.3.22"
54-
gemstone = "1.0.7"
54+
gemstone = "1.0.10"
5555

5656
glance-widgets = "1.1.1"
5757

0 commit comments

Comments
 (0)