|
| 1 | +--- |
| 2 | +title: PnP Flutter SDK - v5 to v6 |
| 3 | +description: "PnP Flutter SDK - v5 to v6 | Documentation - Web3Auth" |
| 4 | +sidebar_label: v5 to v6 |
| 5 | +--- |
| 6 | + |
| 7 | +This migration guide provides steps for upgrading from version v5 to v6 of the PnP Flutter 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 v6, 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 v6, the `request` method will return the |
| 20 | +`SignResponse` directly. |
| 21 | + |
| 22 | +```dart |
| 23 | +try { |
| 24 | + List<dynamic> params = []; |
| 25 | + // Message to be signed |
| 26 | + params.add("Hello, Web3Auth from Flutter!"); |
| 27 | + // User's EOA address |
| 28 | + params.add("<User Address in Hex>"); |
| 29 | +
|
| 30 | + // add-next-line |
| 31 | + final response = await Web3AuthFlutter.request( |
| 32 | + ChainConfig( |
| 33 | + chainId: "0x1", |
| 34 | + rpcTarget: "https://mainnet.infura.io/v3/$key", |
| 35 | + ), |
| 36 | + "personal_sign", |
| 37 | + params, |
| 38 | + ); |
| 39 | +
|
| 40 | + // remove-next-line |
| 41 | + final response = await Web3AuthFlutter.getSignResponse(); |
| 42 | +
|
| 43 | + log(response.toString()); |
| 44 | +} on UserCancelledException { |
| 45 | + log("User cancelled."); |
| 46 | +} catch(e) { |
| 47 | + log("Unknown exception occurred"); |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +## Minimum Android SDK Version |
| 52 | + |
| 53 | +The minimum Android SDK version for the PnP Flutter SDK is now 26. Please update your app level |
| 54 | +gradle file to set the minimum SDK version to 26. |
| 55 | + |
| 56 | +```gradle |
| 57 | +defaultConfig { |
| 58 | + // ... |
| 59 | + // add-next-line |
| 60 | + minSdkVersion 26 //flutter.minSdkVersion |
| 61 | + // remove-next-line |
| 62 | + minSdkVersion 24 //flutter.minSdkVersion |
| 63 | + // ... |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +## Enhancements |
| 68 | + |
| 69 | +In the latest version v6, we have added support for the Web3Auth Auth Service version v9, and Wallet |
| 70 | +Services v3. In Wallet Services v3, the prebuilt wallet UI now supports the swap functionality |
| 71 | +allowing users to swap to their favorite token from the app itself. |
0 commit comments