Skip to content

Commit

Permalink
update docs for ios v10
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushBherwani1998 committed Dec 2, 2024
1 parent 136f5cc commit 76b1d20
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 15 deletions.
50 changes: 50 additions & 0 deletions docs/migration-guides/ios-v9-to-v10.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: PnP iOS SDK - v9 to v10
description: "PnP iOS SDK - v9 to v10 | Documentation - Web3Auth"
sidebar_label: v9 to v10
---

This migration guide provides steps for upgrading from version v9 to v10 of the PnP iOS 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 v10, 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 v10, the `request` method will return the
`SignResponse` directly.

```swift
// remove-next-line
try await self.web3Auth?.request(
// add-next-line
let response = try await self.web3Auth?.request(
chainConfig: ChainConfig(
chainId: "0x89",
rpcTarget: "https://polygon.llamarpc.com"
),
method: "personal_sign",
requestParams: params
)


// remove-next-line
let response = try Web3Auth.getSignResponse()
if response!.success {
print(response!.result!)
} else {
print(response!.error!)
}

```

## Enhancements

In the latest version v10, we have added support for the Web3Auth OpenLogin 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.
2 changes: 1 addition & 1 deletion docs/sdk/pnp/ios/ios.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authentication flow of your choice.

### Requirements

- iOS 14
- iOS 14+
- Xcode 12+
- Swift 5.x

Expand Down
19 changes: 12 additions & 7 deletions docs/sdk/pnp/ios/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ do {
## Request signature

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

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

// focus-start
try await self.web3Auth?.request(
let response = try await self.web3Auth?.request(
chainConfig: ChainConfig(
chainId: "11155111",
rpcTarget: "https://eth-sepolia.public.blastapi.io"
Expand All @@ -461,17 +460,23 @@ do {
)
// focus-end

// focus-next-line
let response = try Web3Auth.getSignResponse()

if response!.success {
if response!.success {
print(response!.result!)
} else {
// Handle Error
print(response!.error!)
}

} catch {
print(error.localizedDescription)
// Handle error
}
```

### SignResponse

| Name | Description |
| --------- | ------------------------------------------------------------- |
| `success` | Determines whether the request was successful or not. |
| `result?` | Holds the signature for the request when `success` is `true`. |
| `error?` | Holds the error for the request when `success` is `false`. |
9 changes: 5 additions & 4 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,11 +1363,12 @@ const sidebars: SidebarsConfig = {
type: "category",
label: "Migration Guides",
items: [
"migration-guides/ios-v6-to-v7",
"migration-guides/ios-v7-to-v8",
"migration-guides/ios-v8-to-v8.1",
"migration-guides/ios-v8.1-to-v8.2",
"migration-guides/ios-v9-to-v10",
"migration-guides/ios-v8.2-to-v8.3",
"migration-guides/ios-v8.1-to-v8.2",
"migration-guides/ios-v8-to-v8.1",
"migration-guides/ios-v7-to-v8",
"migration-guides/ios-v6-to-v7",
],
},
...sdkQuickLinks,
Expand Down
2 changes: 1 addition & 1 deletion src/common/sdk/pnp/ios/_cocoapods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ To install the Web3Auth SDK using Cocoapods, follow the below steps:
1. Open the Podfile, and add the Web3Auth pod:

```sh
pod 'Web3Auth', '~> 9.0.0'
pod 'Web3Auth', '~> 10.0.1'
```

2. Once added, use `pod install` command to download the Web3Auth dependency.
2 changes: 1 addition & 1 deletion src/common/sdk/pnp/ios/_spm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
https://github.com/Web3Auth/web3auth-swift-sdk
```

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

3. When finished, Xcode will automatically begin resolving and downloading your dependencies in the
background.
2 changes: 1 addition & 1 deletion src/common/versions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const pnpWebVersion = `9.3.x`;
export const pnpAndroidVersion = `8.0.3`;
export const pnpIOSVersion = `9.0.0`;
export const pnpIOSVersion = `10.0.1`;
export const pnpRNVersion = `7.0.x`;
export const pnpFlutterVersion = `5.0.4`;
export const pnpUnityVersion = `5.x.x`;
Expand Down

0 comments on commit 76b1d20

Please sign in to comment.