Skip to content

Commit 993d363

Browse files
committed
feat: Resolved PR comments.
Signed-off-by: Gaurav Goel <[email protected]>
1 parent 1bfa09f commit 993d363

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

app/src/main/java/com/web3auth/app/MainActivity.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,10 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemClickListener {
251251
add("Android")
252252
}
253253
val signMsgCompletableFuture = web3Auth.request(
254-
chainId = "0x89",
255-
chainConfig = listOf(
256-
ChainsConfig(
257-
chainId = "0x89",
258-
rpcTarget = "https://polygon-rpc.com/",
259-
chainNamespace = ChainNamespace.EIP155
260-
)
254+
chainConfig = ChainsConfig(
255+
chainId = "0x89",
256+
rpcTarget = "https://polygon-rpc.com/",
257+
chainNamespace = ChainNamespace.EIP155
261258
), "personal_sign", requestParams = params, appState = "web3Auth"
262259
)
263260
signMsgCompletableFuture.whenComplete { signResult, error ->

core/src/main/java/com/web3auth/core/Web3Auth.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,7 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
583583
* @return A CompletableFuture<Void> representing the asynchronous operation.
584584
*/
585585
fun request(
586-
chainId: String,
587-
chainConfig: List<ChainsConfig>,
586+
chainConfig: ChainsConfig,
588587
method: String,
589588
requestParams: JsonArray,
590589
path: String? = "wallet/request",
@@ -597,10 +596,11 @@ class Web3Auth(web3AuthOptions: Web3AuthOptions, context: Context) : WebViewResu
597596
if (sessionId.isNotBlank()) {
598597
val sdkUrl = Uri.parse(web3AuthOption.walletSdkUrl)
599598
val initOptions = JSONObject(gson.toJson(getInitOptions()))
599+
val chainConfigList = arrayListOf(chainConfig)
600600
initOptions.put(
601-
"chains", gson.toJson(chainConfig)
601+
"chains", gson.toJson(chainConfigList)
602602
)
603-
initOptions.put("chainId", chainId)
603+
initOptions.put("chainId", chainConfig.chainId)
604604
val paramMap = JSONObject()
605605
paramMap.put(
606606
"options", initOptions

0 commit comments

Comments
 (0)