Skip to content

Commit 559d296

Browse files
Merge pull request #1006 from Web3Auth/pnp-android-v9
[Android PnP] Update docs for v9
2 parents 52b6f1a + 0ea0a72 commit 559d296

File tree

6 files changed

+77
-14
lines changed

6 files changed

+77
-14
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: PnP Android SDK - v8 to v9
3+
description: "PnP Android SDK - v8 to v9 | Documentation - Web3Auth"
4+
sidebar_label: v8 to v9
5+
---
6+
7+
This migration guide provides steps for upgrading from version v8 to v9 of the PnP Android SDK. The
8+
guide outlines significant changes and enhancements, including the support of Web3Auth OpenLogin
9+
version v9, and Wallet Services v3.
10+
11+
## Breaking Changes
12+
13+
### `getSignResponse` is now removed.
14+
15+
In v9, we try to improve the developer experience by removing the `getSignResponse` method and
16+
returning the result in the `request` method itself.
17+
18+
Previously, after calling the `request` method, developers had to use the `getSignResponse` method
19+
to retrieve the `SignResponse`. In the latest version v9, the `request` method will return the
20+
`SignResponse` directly.
21+
22+
```kotlin
23+
val params = JsonArray().apply {
24+
// Message to be signed
25+
add("Hello, World!")
26+
// User's EOA address
27+
add(address)
28+
}
29+
30+
val chainConfig = ChainConfig(
31+
chainId = "0x1",
32+
rpcTarget = "https://rpc.ankr.com/eth",
33+
ticker = "ETH",
34+
chainNamespace = ChainNamespace.EIP155
35+
)
36+
37+
val signMsgCompletableFuture = web3Auth.request(
38+
chainConfig = chainConfig,
39+
"personal_sign",
40+
requestParams = params
41+
)
42+
43+
// focus-start
44+
// remove-next-line
45+
signMsgCompletableFuture.whenComplete { _, error ->
46+
// add-next-line
47+
signMsgCompletableFuture.whenComplete { signResult, error ->
48+
if (error == null) {
49+
// remove-next-line
50+
val signResult = Web3Auth.getSignResponse()
51+
Log.d("Sign Result", signResult.toString())
52+
53+
} else {
54+
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
55+
}
56+
}
57+
// focus-end
58+
```
59+
60+
## Enhancements
61+
62+
In the latest version v9, we have added support for the Web3Auth Auth Service version v9, and Wallet
63+
Services v3. In Wallet Services v3, the prebuilt wallet UI now supports the swap functionality
64+
allowing users to swap to their favorite token from the app itself.

docs/sdk/pnp/android/initialize.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ these methods will return an empty string; otherwise, they will return the respe
125125
Note that if the API call to fetch the project configuration fails, the method will throw an error.
126126

127127
```kotlin
128-
val sessionResponse: CompletableFuture<Void> = web3Auth.initialize()
129-
sessionResponse.whenComplete { _, error ->
128+
val initializeCF: CompletableFuture<Void> = web3Auth.initialize()
129+
initializeCF.whenComplete { _, error ->
130130
if (error == null) {
131131
// Check for the active session
132132
if(web3Auth.getPrivKey()isNotEmpty()) {

docs/sdk/pnp/android/usage.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,13 @@ val signMsgCompletableFuture = web3Auth.request(
514514
)
515515
// focus-end
516516

517-
signMsgCompletableFuture.whenComplete { _, error ->
517+
signMsgCompletableFuture.whenComplete { signResult, error ->
518518
if (error == null) {
519-
Log.d("MainActivity_Web3Auth", "Message signed successfully")
520519
// focus-next-line
521-
val signResult = Web3Auth.getSignResponse()
522-
Log.d("MainActivity_Web3Auth", signResult.toString())
520+
Log.d("Sign Result", signResult.toString())
523521

524522
} else {
525-
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
523+
Log.d("Sign Error", error.message ?: "Something went wrong")
526524
}
527525
}
528526
```

sidebars.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,12 +1311,13 @@ const sidebars: SidebarsConfig = {
13111311
type: "category",
13121312
label: "Migration Guides",
13131313
items: [
1314-
"migration-guides/android-v4-to-v5",
1315-
"migration-guides/android-v5-to-v6",
1316-
"migration-guides/android-v6-to-v6.1",
1317-
"migration-guides/android-v7.1.1-to-v7.1.2",
1318-
"migration-guides/android-v7.1.2-to-v7.2",
1314+
"migration-guides/android-v8-to-v9",
13191315
"migration-guides/android-v7.2-to-v7.3",
1316+
"migration-guides/android-v7.1.2-to-v7.2",
1317+
"migration-guides/android-v7.1.1-to-v7.1.2",
1318+
"migration-guides/android-v6-to-v6.1",
1319+
"migration-guides/android-v5-to-v6",
1320+
"migration-guides/android-v4-to-v5",
13201321
],
13211322
},
13221323
...sdkQuickLinks,

src/common/sdk/pnp/android/_installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
dependencies {
33
// ...
44
// focus-next-line
5-
implementation 'com.github.web3auth:web3auth-android-sdk:8.0.3'
5+
implementation 'com.github.web3auth:web3auth-android-sdk:9.0.1'
66
}
77
```

src/common/versions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const pnpWebVersion = `9.3.x`;
2-
export const pnpAndroidVersion = `8.0.3`;
2+
export const pnpAndroidVersion = `9.0.1`;
33
export const pnpIOSVersion = `9.0.0`;
44
export const pnpRNVersion = `7.0.x`;
55
export const pnpFlutterVersion = `5.0.4`;

0 commit comments

Comments
 (0)