|
| 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. |
0 commit comments