Skip to content

Commit 54a1bec

Browse files
Merge pull request #1004 from Web3Auth/swift-pnp-v10
Update docs for iOS v10, and add migration guide
2 parents 559d296 + 640f958 commit 54a1bec

File tree

7 files changed

+71
-15
lines changed

7 files changed

+71
-15
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: PnP iOS SDK - v9 to v10
3+
description: "PnP iOS SDK - v9 to v10 | Documentation - Web3Auth"
4+
sidebar_label: v9 to v10
5+
---
6+
7+
This migration guide provides steps for upgrading from version v9 to v10 of the PnP iOS 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 v10, 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 v10, the `request` method will return the
20+
`SignResponse` directly.
21+
22+
```swift
23+
// remove-next-line
24+
try await self.web3Auth?.request(
25+
// add-next-line
26+
let response = try await self.web3Auth?.request(
27+
chainConfig: ChainConfig(
28+
chainId: "0x89",
29+
rpcTarget: "https://polygon.llamarpc.com"
30+
),
31+
method: "personal_sign",
32+
requestParams: params
33+
)
34+
35+
36+
// remove-next-line
37+
let response = try Web3Auth.getSignResponse()
38+
if response!.success {
39+
print(response!.result!)
40+
} else {
41+
print(response!.error!)
42+
}
43+
44+
```
45+
46+
## Enhancements
47+
48+
In the latest version v10, we have added support for the Web3Auth Auth Service version v9, and
49+
Wallet Services v3. In Wallet Services v3, the prebuilt wallet UI now supports the swap
50+
functionality allowing users to swap to their favorite token from the app itself.

docs/sdk/pnp/ios/ios.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ authentication flow of your choice.
1414

1515
### Requirements
1616

17-
- iOS 14
17+
- iOS 14+
1818
- Xcode 12+
1919
- Swift 5.x
2020

docs/sdk/pnp/ios/usage.mdx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,7 @@ do {
423423
## Request signature
424424

425425
The `request` method facilitates the use of templated transaction screens for signing transactions.
426-
Upon successful completion, you can retrieve the signature for the request using the
427-
`getSignResponse` static method.
426+
The method will return [SignResponse](#signresponse).
428427

429428
Please check the list of
430429
[JSON RPC methods](https://docs.metamask.io/wallet/reference/json-rpc-api/), noting that the request
@@ -451,7 +450,7 @@ do {
451450
params.append(address)
452451

453452
// focus-start
454-
try await self.web3Auth?.request(
453+
let response = try await self.web3Auth?.request(
455454
chainConfig: ChainConfig(
456455
chainId: "11155111",
457456
rpcTarget: "https://eth-sepolia.public.blastapi.io"
@@ -461,17 +460,23 @@ do {
461460
)
462461
// focus-end
463462

464-
// focus-next-line
465-
let response = try Web3Auth.getSignResponse()
466-
467-
if response!.success {
463+
if response!.success {
468464
print(response!.result!)
469465
} else {
470466
// Handle Error
471467
print(response!.error!)
472468
}
469+
473470
} catch {
474471
print(error.localizedDescription)
475472
// Handle error
476473
}
477474
```
475+
476+
### SignResponse
477+
478+
| Name | Description |
479+
| --------- | ------------------------------------------------------------- |
480+
| `success` | Determines whether the request was successful or not. |
481+
| `result?` | Holds the signature for the request when `success` is `true`. |
482+
| `error?` | Holds the error for the request when `success` is `false`. |

sidebars.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,11 +1364,12 @@ const sidebars: SidebarsConfig = {
13641364
type: "category",
13651365
label: "Migration Guides",
13661366
items: [
1367-
"migration-guides/ios-v6-to-v7",
1368-
"migration-guides/ios-v7-to-v8",
1369-
"migration-guides/ios-v8-to-v8.1",
1370-
"migration-guides/ios-v8.1-to-v8.2",
1367+
"migration-guides/ios-v9-to-v10",
13711368
"migration-guides/ios-v8.2-to-v8.3",
1369+
"migration-guides/ios-v8.1-to-v8.2",
1370+
"migration-guides/ios-v8-to-v8.1",
1371+
"migration-guides/ios-v7-to-v8",
1372+
"migration-guides/ios-v6-to-v7",
13721373
],
13731374
},
13741375
...sdkQuickLinks,

src/common/sdk/pnp/ios/_cocoapods.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ To install the Web3Auth SDK using Cocoapods, follow the below steps:
33
1. Open the Podfile, and add the Web3Auth pod:
44

55
```sh
6-
pod 'Web3Auth', '~> 9.0.0'
6+
pod 'Web3Auth', '~> 10.0.1'
77
```
88

99
2. Once added, use `pod install` command to download the Web3Auth dependency.

src/common/sdk/pnp/ios/_spm.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
https://github.com/Web3Auth/web3auth-swift-sdk
77
```
88

9-
From the `Dependency Rule` dropdown, select `Exact Version` and enter `9.0.0` as the version.
9+
From the `Dependency Rule` dropdown, select `Exact Version` and enter `10.0.1` as the version.
1010

1111
3. When finished, Xcode will automatically begin resolving and downloading your dependencies in the
1212
background.

src/common/versions.ts

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

0 commit comments

Comments
 (0)