PnP Android SDK - v8 to v9
This migration guide provides steps for upgrading from version v8 to v9 of the PnP Android SDK. The guide outlines significant changes and enhancements, including the support of Web3Auth OpenLogin version v9, and Wallet Services v3.
Breaking Changes
getSignResponse
is now removed.
In v9, we try to improve the developer experience by removing the getSignResponse
method and
returning the result in the request
method itself.
Previously, after calling the request
method, developers had to use the getSignResponse
method
to retrieve the SignResponse
. In the latest version v9, the request
method will return the
SignResponse
directly.
val params = JsonArray().apply {
// Message to be signed
add("Hello, World!")
// User's EOA address
add(address)
}
val chainConfig = ChainConfig(
chainId = "0x1",
rpcTarget = "https://rpc.ankr.com/eth",
ticker = "ETH",
chainNamespace = ChainNamespace.EIP155
)
val signMsgCompletableFuture = web3Auth.request(
chainConfig = chainConfig,
"personal_sign",
requestParams = params
)
signMsgCompletableFuture.whenComplete { _, error ->
signMsgCompletableFuture.whenComplete { signResult, error ->
if (error == null) {
val signResult = Web3Auth.getSignResponse()
Log.d("Sign Result", signResult.toString())
} else {
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
}
}
Enhancements
In the latest version v9, we have added support for the Web3Auth Auth Service version v9, and Wallet Services v3. In Wallet Services v3, the prebuilt wallet UI now supports the swap functionality allowing users to swap to their favorite token from the app itself.