Skip to content

Commit 9333b37

Browse files
authored
Merge branch 'master' into add-guide-multiple-chains
2 parents 2604e59 + c553ffa commit 9333b37

61 files changed

Lines changed: 2838 additions & 389 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
---
2+
title: PnP Android SDK - v5 to v6
3+
displayed_sidebar: sdk
4+
description: "PnP Android SDK - v5 to v6 | Documentation - Web3Auth"
5+
sidebar_label: v5 to v6
6+
---
7+
8+
import TabItem from "@theme/TabItem";
9+
import Tabs from "@theme/Tabs";
10+
11+
# Migration Guide from v5 to v6 for Web3Auth PnP Android SDK
12+
13+
## Overview
14+
15+
This migration guide provides steps for upgrading from version 5(v5) to version 6(v6) of the
16+
Web3Auth PnP Android SDK. The guide outlines significant changes and enhancements, including the
17+
introduction of `enableMFA` method to initiate MFA setup flow, and `launchWalletServices` method for
18+
template wallet interface.
19+
20+
## Changes in Detail
21+
22+
### `enableMFA` method
23+
24+
From v6, developers can use the `enableMFA` method to initiate MFA setup flow for already logged in
25+
users.
26+
27+
<Tabs
28+
defaultValue="default-verifier"
29+
values={[
30+
{ label: "Default Verifier", value: "default-verifier" },
31+
{ label: "Custom JWT Verifier", value: "custom-jwt-verifier" },
32+
]}
33+
>
34+
35+
<TabItem value = "default-verifier">
36+
```kotlin title="Usage"
37+
import android.widget.Button
38+
import com.web3auth.core.Web3Auth
39+
import android.os.Bundle
40+
41+
class MainActivity : AppCompatActivity() { private lateinit var web3Auth: Web3Auth
42+
43+
private fun enableMFA() {
44+
// highlight-next-line
45+
val completableFuture = web3Auth.enableMFA()
46+
47+
completableFuture.whenComplete{_, error ->
48+
if (error == null) {
49+
Log.d("MainActivity_Web3Auth", "Launched successfully")
50+
// Add your logic
51+
} else {
52+
// Add your logic on error
53+
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
54+
}
55+
}
56+
}
57+
58+
override fun onCreate(savedInstanceState: Bundle?) {
59+
...
60+
// Setup UI and event handlers
61+
val enableMFAButton = findViewById<Button>(R.id.enableMFAButton)
62+
enableMFAButton.setOnClickListener { enableMFA() }
63+
...
64+
}
65+
...
66+
67+
}
68+
69+
````
70+
</TabItem>
71+
72+
<TabItem value="custom-jwt-verifier">
73+
```kotlin title="Usage"
74+
import android.widget.Button
75+
import com.web3auth.core.Web3Auth
76+
import android.os.Bundle
77+
78+
class MainActivity : AppCompatActivity() { private lateinit var web3Auth: Web3Auth
79+
80+
private fun enableMFA() {
81+
val loginParams = LoginParams(
82+
Provider.JWT,
83+
extraLoginOptions = ExtraLoginOptions(id_token = "your_jwt_token")
84+
)
85+
86+
// highlight-next-line
87+
val completableFuture = web3Auth.enableMFA(loginParams)
88+
89+
completableFuture.whenComplete{_, error ->
90+
if (error == null) {
91+
Log.d("MainActivity_Web3Auth", "Launched successfully")
92+
// Add your logic
93+
} else {
94+
// Add your logic on error
95+
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
96+
}
97+
}
98+
}
99+
100+
override fun onCreate(savedInstanceState: Bundle?) {
101+
...
102+
// Setup UI and event handlers
103+
val enableMFAButton = findViewById<Button>(R.id.enableMFAButton)
104+
enableMFAButton.setOnClickListener { enableMFA() }
105+
...
106+
}
107+
...
108+
109+
}
110+
````
111+
112+
</TabItem>
113+
</Tabs>
114+
115+
### `launchWalletServices` method
116+
117+
From v6, developers can use the `launchWalletServices` to launches a WebView which allows them to
118+
use the templated wallet UI services. Developers can pass the `ChainConfig` to open wallet services
119+
with a specific chain selected.
120+
121+
:::note Minimum Scale plan required
122+
123+
Access to Wallet Services is gated. You can use this feature in the development environment for
124+
free. The minimum [pricing plan](https://web3auth.io/pricing.html) to use this feature in a
125+
production environment is the **Scale Plan**.
126+
127+
:::
128+
129+
#### ChainConfig Arguments
130+
131+
| Parameter | Description |
132+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
133+
| `chainNamespace` | Custom configuration for your preferred blockchain. As of now only EVM supported. Default value is `ChainNamespace.EIP155`. |
134+
| `decimals?` | Number of decimals for the currency ticker. Default value is 18, and accepts `Int` as value. |
135+
| `blockExplorerUrl?` | Blockchain's explorer URL. (eg: `https://etherscan.io`) |
136+
| `chainId` | The chain id of the selected blockchain in hex `String`. |
137+
| `displayName?` | Display Name for the chain. |
138+
| `logo?` | Logo for the selected `chainNamespace` & `chainId`. |
139+
| `rpcTarget` | RPC Target URL for the selected `chainNamespace` & `chainId`. |
140+
| `ticker?` | Default currency ticker of the network (e.g: `ETH`) |
141+
| `tickerName?` | Name for currency ticker (e.g: `Ethereum`) |
142+
143+
#### Usage
144+
145+
```kotlin title="Usage"
146+
// highlight-start
147+
val launchWalletCompletableFuture = web3Auth.launchWalletServices(
148+
loginParams = LoginParams(
149+
selectedLoginProvider,
150+
extraLoginOptions = null,
151+
mfaLevel = MFALevel.NONE,
152+
),
153+
154+
chainConfig = ChainConfig(
155+
chainId = "0x1",
156+
rpcTarget = "https://mainnet.infura.io/v3/$key",
157+
ticker = "ETH",
158+
chainNamespace = ChainNamespace.EIP155
159+
)
160+
)
161+
// highlight-end
162+
163+
launchWalletCompletableFuture.whenComplete { _, error ->
164+
if (error == null) {
165+
Log.d("MainActivity_Web3Auth", "Wallet launched successfully")
166+
} else {
167+
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
168+
}
169+
}
170+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: PnP Android SDK - v6 to v6.1
3+
displayed_sidebar: sdk
4+
description: "PnP Android SDK - v6 to v6.1 | Documentation - Web3Auth"
5+
sidebar_label: v6 to v6.1
6+
---
7+
8+
import TabItem from "@theme/TabItem";
9+
import Tabs from "@theme/Tabs";
10+
11+
# Migration Guide from v6 to v6.1 for Web3Auth PnP Android SDK
12+
13+
## Overview
14+
15+
This migration guide provides steps for upgrading from version 6(v6) to version 6.1(v6.1) of the
16+
Web3Auth PnP Android SDK. The guide outlines the introduction of new `request` method.
17+
18+
## Changes in Detail
19+
20+
### `request` method
21+
22+
Now, developers can use the `request` method to use the templated transaction confirmation screens
23+
for signing transactions. To retrive the signature for the request, developers can use the
24+
`getSignResponse` static method.
25+
26+
```kotlin title="Usage"
27+
val params = JsonArray().apply {
28+
add("Hello, World!")
29+
add("<User's Hex address>")
30+
add("Android")
31+
}
32+
33+
// highlight-start
34+
val signMsgCompletableFuture = web3Auth.request(
35+
loginParams = LoginParams(
36+
selectedLoginProvider,
37+
extraLoginOptions = null,
38+
mfaLevel = MFALevel.NONE,
39+
),
40+
"personal_sign",
41+
requestParams = params
42+
)
43+
// highlight-end
44+
45+
signMsgCompletableFuture.whenComplete { _, error ->
46+
if (error == null) {
47+
Log.d("MainActivity_Web3Auth", "Message signed successfully")
48+
} else {
49+
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
50+
}
51+
}
52+
```
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: PnP Android SDK - v7.1.1 to v7.1.2
3+
displayed_sidebar: sdk
4+
description: "PnP Android SDK - v7.1.1 to v7.1.2 | Documentation - Web3Auth"
5+
sidebar_label: v7.1.1 to v7.1.2
6+
---
7+
8+
import TabItem from "@theme/TabItem";
9+
import Tabs from "@theme/Tabs";
10+
11+
# Migration Guide from v7.1.1 to v7.1.2 for Web3Auth PnP Android SDK
12+
13+
## Overview
14+
15+
This migration guide provides steps for upgrading from version 7.1.1(v7.1.1) to version
16+
7.1.2(v7.1.2) of the Web3Auth PnP Android SDK. The guide outlines the breaking changes in the
17+
AndroidManifest file.
18+
19+
## Changes in Detail
20+
21+
### AndroidManifest changes
22+
23+
From version **7.1.2**, please make sure to set `android:allowBackup` to `false`, and add
24+
`tools:replace="android:fullBackupContent"` in your `AndroidManifest.xml` file.
25+
26+
```xml
27+
<application
28+
// highlight-start
29+
android:allowBackup="false"
30+
tools:replace="android:fullBackupContent"
31+
// highlight-end
32+
android:dataExtractionRules="@xml/data_extraction_rules"
33+
android:fullBackupContent="@xml/backup_rules"
34+
android:icon="@mipmap/ic_launcher">
35+
</application>
36+
```
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
title: PnP Android SDK - v7.1.2 to v7.2
3+
displayed_sidebar: sdk
4+
description: "PnP Android SDK - v7.1.2 to v7.2 | Documentation - Web3Auth"
5+
sidebar_label: v7.1.2 to v7.2
6+
---
7+
8+
import TabItem from "@theme/TabItem";
9+
import Tabs from "@theme/Tabs";
10+
import SMSPasswordless from "@site/src/common/sdk/pnp/android/_sms_passwordless.mdx";
11+
12+
# Migration Guide from v7.1.2 to v7.2 for Web3Auth PnP Android SDK
13+
14+
## Overview
15+
16+
This migration guide provides steps for upgrading from version 7.1.2(v7.1.2) to version 7.2(v7.2) of
17+
the Web3Auth PnP Android SDK. The guide outlines significant changes and enhancements, including the
18+
introduction of new login providers, and `launchWalletServices` updates.
19+
20+
## Changes in Detail
21+
22+
### `launchWalletServices` method updates
23+
24+
From v7.2, the `loginParams` is removed from the `launchWalletServices` method. Developers only need
25+
to pass the `chainConfig` as the required parameter.
26+
27+
#### Before (v7.1.2)
28+
29+
```kotlin title="Usage"
30+
// highlight-start
31+
val launchWalletCompletableFuture = web3Auth.launchWalletServices(
32+
loginParams = LoginParams(
33+
selectedLoginProvider,
34+
extraLoginOptions = null,
35+
mfaLevel = MFALevel.NONE,
36+
),
37+
38+
chainConfig = ChainConfig(
39+
chainId = "0x1",
40+
rpcTarget = "https://mainnet.infura.io/v3/$key",
41+
ticker = "ETH",
42+
chainNamespace = ChainNamespace.EIP155
43+
)
44+
)
45+
// highlight-end
46+
47+
launchWalletCompletableFuture.whenComplete { _, error ->
48+
if (error == null) {
49+
Log.d("MainActivity_Web3Auth", "Wallet launched successfully")
50+
} else {
51+
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
52+
}
53+
}
54+
```
55+
56+
#### After (v7.2)
57+
58+
```kotlin title="Usage"
59+
60+
// highlight-start
61+
val launchWalletCompletableFuture = web3Auth.launchWalletServices(
62+
chainConfig = ChainConfig(
63+
chainId = "0x1",
64+
rpcTarget = "https://mainnet.infura.io/v3/$key",
65+
ticker = "ETH",
66+
chainNamespace = ChainNamespace.EIP155
67+
)
68+
)
69+
// highlight-end
70+
71+
launchWalletCompletableFuture.whenComplete { _, error ->
72+
if (error == null) {
73+
Log.d("MainActivity_Web3Auth", "Wallet launched successfully")
74+
} else {
75+
Log.d("MainActivity_Web3Auth", error.message ?: "Something went wrong")
76+
}
77+
}
78+
```
79+
80+
### New Login Providers
81+
82+
v4 update brings two new providers. Now developers can use the SMS Passwordless and Farcaster login
83+
options.
84+
85+
#### SMS Passwordless
86+
87+
<SMSPasswordless />
88+
89+
#### Farcaster
90+
91+
```kotlin title="Usage"
92+
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(
93+
LoginParams(
94+
// highlight-next-line
95+
Provider.farcaster,
96+
)
97+
)
98+
```

0 commit comments

Comments
 (0)