diff --git a/docs/migration-guides/android-v8-to-v9.mdx b/docs/migration-guides/android-v8-to-v9.mdx new file mode 100644 index 000000000..576b229b4 --- /dev/null +++ b/docs/migration-guides/android-v8-to-v9.mdx @@ -0,0 +1,64 @@ +--- +title: PnP Android SDK - v8 to v9 +description: "PnP Android SDK - v8 to v9 | Documentation - Web3Auth" +sidebar_label: 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. + +```kotlin +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 +) + +// focus-start +// remove-next-line +signMsgCompletableFuture.whenComplete { _, error -> +// add-next-line +signMsgCompletableFuture.whenComplete { signResult, error -> + if (error == null) { + // remove-next-line + val signResult = Web3Auth.getSignResponse() + Log.d("Sign Result", signResult.toString()) + + } else { + Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong") + } +} +// focus-end +``` + +## 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. diff --git a/docs/sdk/pnp/android/initialize.mdx b/docs/sdk/pnp/android/initialize.mdx index 0145830d2..966f02731 100644 --- a/docs/sdk/pnp/android/initialize.mdx +++ b/docs/sdk/pnp/android/initialize.mdx @@ -125,8 +125,8 @@ these methods will return an empty string; otherwise, they will return the respe Note that if the API call to fetch the project configuration fails, the method will throw an error. ```kotlin -val sessionResponse: CompletableFuture = web3Auth.initialize() -sessionResponse.whenComplete { _, error -> +val initializeCF: CompletableFuture = web3Auth.initialize() +initializeCF.whenComplete { _, error -> if (error == null) { // Check for the active session if(web3Auth.getPrivKey()isNotEmpty()) { diff --git a/docs/sdk/pnp/android/usage.mdx b/docs/sdk/pnp/android/usage.mdx index 8440138de..480058a6f 100644 --- a/docs/sdk/pnp/android/usage.mdx +++ b/docs/sdk/pnp/android/usage.mdx @@ -514,15 +514,13 @@ val signMsgCompletableFuture = web3Auth.request( ) // focus-end -signMsgCompletableFuture.whenComplete { _, error -> +signMsgCompletableFuture.whenComplete { signResult, error -> if (error == null) { - Log.d("MainActivity_Web3Auth", "Message signed successfully") // focus-next-line - val signResult = Web3Auth.getSignResponse() - Log.d("MainActivity_Web3Auth", signResult.toString()) + Log.d("Sign Result", signResult.toString()) } else { - Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong") + Log.d("Sign Error", error.message ?: "Something went wrong") } } ``` diff --git a/sidebars.ts b/sidebars.ts index ad30722a2..36fd6f71f 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -1311,12 +1311,13 @@ const sidebars: SidebarsConfig = { type: "category", label: "Migration Guides", items: [ - "migration-guides/android-v4-to-v5", - "migration-guides/android-v5-to-v6", - "migration-guides/android-v6-to-v6.1", - "migration-guides/android-v7.1.1-to-v7.1.2", - "migration-guides/android-v7.1.2-to-v7.2", + "migration-guides/android-v8-to-v9", "migration-guides/android-v7.2-to-v7.3", + "migration-guides/android-v7.1.2-to-v7.2", + "migration-guides/android-v7.1.1-to-v7.1.2", + "migration-guides/android-v6-to-v6.1", + "migration-guides/android-v5-to-v6", + "migration-guides/android-v4-to-v5", ], }, ...sdkQuickLinks, diff --git a/src/common/sdk/pnp/android/_installation.mdx b/src/common/sdk/pnp/android/_installation.mdx index 440f26b94..50967699b 100644 --- a/src/common/sdk/pnp/android/_installation.mdx +++ b/src/common/sdk/pnp/android/_installation.mdx @@ -2,6 +2,6 @@ dependencies { // ... // focus-next-line - implementation 'com.github.web3auth:web3auth-android-sdk:8.0.3' + implementation 'com.github.web3auth:web3auth-android-sdk:9.0.1' } ``` diff --git a/src/common/versions.ts b/src/common/versions.ts index fe3f45314..34ac8d1c4 100644 --- a/src/common/versions.ts +++ b/src/common/versions.ts @@ -1,5 +1,5 @@ export const pnpWebVersion = `9.3.x`; -export const pnpAndroidVersion = `8.0.3`; +export const pnpAndroidVersion = `9.0.1`; export const pnpIOSVersion = `9.0.0`; export const pnpRNVersion = `7.0.x`; export const pnpFlutterVersion = `5.0.4`;