Skip to main content

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

Overview

This migration guide provides steps for upgrading from version 7.1.2(v7.1.2) to version 7.2(v7.2) of the Web3Auth PnP Android SDK. The guide outlines significant changes and enhancements, including the introduction of new login providers, and launchWalletServices updates.

Changes in Detail

launchWalletServices method updates

From v7.2, the loginParams is removed from the launchWalletServices method. Developers only need to pass the chainConfig as the required parameter.

Before (v7.1.2)

Usage
val launchWalletCompletableFuture = web3Auth.launchWalletServices(
loginParams = LoginParams(
selectedLoginProvider,
extraLoginOptions = null,
mfaLevel = MFALevel.NONE,
),

chainConfig = ChainConfig(
chainId = "0x1",
rpcTarget = "https://mainnet.infura.io/v3/$key",
ticker = "ETH",
chainNamespace = ChainNamespace.EIP155
)
)

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

After (v7.2)

Usage

val launchWalletCompletableFuture = web3Auth.launchWalletServices(
chainConfig = ChainConfig(
chainId = "0x1",
rpcTarget = "https://mainnet.infura.io/v3/$key",
ticker = "ETH",
chainNamespace = ChainNamespace.EIP155
)
)

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

New Login Providers

v4 update brings two new providers. Now developers can use the SMS Passwordless and Farcaster login options.

SMS Passwordless

import com.web3auth.core.Web3Auth
import com.web3auth.core.types.Web3AuthOptions

val web3Auth = Web3Auth(
Web3AuthOptions(
context = this,
clientId = "YOUR_WEB3AUTH_CLIENT_ID", // Pass over your Web3Auth Client ID from Developer Dashboard
network = Network.MAINNET,
redirectUrl = Uri.parse("{YOUR_APP_PACKAGE_NAME}://auth"),
)
)

val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(
LoginParams(
Provider.SMS_PASSWORDLESS,
extraLoginOptions = ExtraLoginOptions(login_hint = "+91-9911223344")
)
)

Farcaster

Usage
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(
LoginParams(
Provider.farcaster,
)
)