Skip to main content

Migration Guide from v7.2 to v7.3 for Web3Auth PnP Android SDK

Overview

This migration guide provides steps for upgrading from version 7.2(v7.2) to version 7.3(v7.3) of the Web3Auth PnP Android SDK. The guide outlines significant changes in the request method.

Changes in Detail

request method updates

From v7.2, loginParams is removed from the request method. To further improve developer experience, developers can now pass the chainConfig to request signature for specific chain.

Before (v7.2)

Usage
val params = JsonArray().apply {
add("Hello, World!")
add("<User's Hex address>")
add("Android")
}

val signMsgCompletableFuture = web3Auth.request(
loginParams = LoginParams(
selectedLoginProvider,
extraLoginOptions = null,
mfaLevel = MFALevel.NONE,
),
"personal_sign",
requestParams = params
)

signMsgCompletableFuture.whenComplete { _, error ->
if (error == null) {
Log.d("MainActivity_Web3Auth", "Message signed successfully")
} else {
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
}
}

After (v7.3)

Usage
val params = JsonArray().apply {
add("Hello, World!")
add("<User's Hex address>")
add("Android")
}

val signMsgCompletableFuture = web3Auth.request(
chainConfig = ChainConfig(
chainId = "0x1",
rpcTarget = "https://mainnet.infura.io/v3/$key",
),
"personal_sign",
requestParams = params
)

signMsgCompletableFuture.whenComplete { _, error ->
if (error == null) {
Log.d("MainActivity_Web3Auth", "Message signed successfully")
} else {
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
}
}