Skip to content

Commit

Permalink
Merge pull request #5 from WalletConnect/update-appkit
Browse files Browse the repository at this point in the history
AppKit update: Updating the code references to reown
  • Loading branch information
rohit-710 committed Sep 13, 2024
2 parents 9d12814 + 12ee6d8 commit eec66ba
Show file tree
Hide file tree
Showing 132 changed files with 1,773 additions and 1,373 deletions.
4 changes: 1 addition & 3 deletions docs/advanced/walletconnectmodal/resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import PlatformTabItem from '../../components/PlatformTabItem'

Valuable assets for developers and users interested in integrating Web3Wallet into their applications.

<!--Todo: Prettify this section-->

- [Awesome WalletConnect](https://github.com/WalletConnect/awesome-walletconnect) - Community-curated collection of WalletConnect-enabled wallets, libraries, and tools.
- [AppKit Laboratory](https://lab.web3modal.com) - A place to test your wallet integrations against various setups of AppKit.
- [AppKit Laboratory](https://appkit-lab.reown.com/) - A place to test your wallet integrations against various setups of AppKit.
- [Web3Wallet GitHub](https://github.com/WalletConnect/walletconnect-monorepo/tree/v2.0/packages/web3wallet) - Web3Wallet GitHub repository.

## Implementation Examples
Expand Down
22 changes: 11 additions & 11 deletions docs/appkit/android/core/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

### Get selected chain

You can get selected chain by calling the `getSelectedChain()` on the `Web3Modal` object.
You can get selected chain by calling the `getSelectedChain()` on the `AppKit` object.

```kotlin
Web3Modal.getSelectedChain()
AppKit.getSelectedChain()
```

## Web3Modal.ModalDelegate
## AppKit.ModalDelegate

```kotlin
val web3ModalModalDelegate = object : Web3Modal.ModalDelegate {
val appKitModalDelegate = object : AppKit.ModalDelegate {
override fun onSessionApproved(approvedSession: Modal.Model.ApprovedSession) {
// Triggered when receives the session approval from wallet
}
Expand Down Expand Up @@ -60,10 +60,10 @@ val web3ModalModalDelegate = object : Web3Modal.ModalDelegate {
}
```

You have set delegate on Web3Modal to start getting updates from Wallet.
You have set delegate on AppKit to start getting updates from Wallet.

```kotlin
Web3Modal.setDelegate(web3ModalModalDelegate)
AppKit.setDelegate(appKitModalDelegate)
```

## Actions
Expand All @@ -72,7 +72,7 @@ You have set delegate on Web3Modal to start getting updates from Wallet.

```kotlin

Web3Modal.disconnect(
AppKit.disconnect(
onSuccess = {
/* callback that letting you know that you have successfully disconnected */
},
Expand All @@ -90,7 +90,7 @@ val requestParams = Modal.Params.Request(
params = /* Method params */,
)

Web3Modal.request(
AppKit.request(
request = requestParams,
onSuccess = {
/* callback that letting you know that you have successful request */
Expand All @@ -103,16 +103,16 @@ Web3Modal.request(

### Get Active Account

Returns the current active account connected via Web3Modal
Returns the current active account connected via AppKit

```kotlin
Web3Modal.getAccount()
AppKit.getAccount()
```

### Get Connection type

Return information about the type of our connection

```kotlin
Web3Modal.getConnectorType()
AppKit.getConnectorType()
```
72 changes: 36 additions & 36 deletions docs/appkit/android/core/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TabItem from '@theme/TabItem'

# Components

You can use predefined Web3ModalComponent and add it in your application. As a view, dialog or modal.
You can use predefined AppKitComponent and add it in your application. As a view, dialog or modal.

```kotlin
import androidx.compose.material.ExperimentalMaterialApi
Expand All @@ -20,7 +20,7 @@ setContent {

ModalBottomSheetLayout(
sheetContent = {
Web3ModalComponent(
AppKitComponent(
shouldOpenChooseNetwork = true | false,
closeModal = { coroutineScope.launch { modalSheetState.hide() }
)
Expand All @@ -44,15 +44,15 @@ You can add ready made button components to your application
<TabItem value="compose" label="Compose">

```kotlin
import com.walletconnect.web3.modal.ui.components.button.Web3Button
import com.walletconnect.web3.modal.ui.components.button.ConnectButtonSize
import com.walletconnect.web3.modal.ui.components.button.AccountButtonType
import com.walletconnect.web3.modal.ui.components.button.rememberWeb3ModalState
import com.reown.appkit.ui.components.button.Web3Button
import com.reown.appkit.ui.components.button.ConnectButtonSize
import com.reown.appkit.ui.components.button.AccountButtonType
import com.reown.appkit.ui.components.button.rememberAppKitState

YourAppScreen(navController: NavController) {
val web3ModalState = rememberWeb3ModalState(navController = navController)
val appKitState = rememberAppKitState(navController = navController)
Web3Button(
state = web3ModalState,
state = appKitState,
accountButtonType = AccountButtonType.NORMAL || AccountButtonType.MIXED,
connectButtonSize = ConnectButtonSize.NORMAL || ConnectButtonSize.SMALL
)
Expand All @@ -72,7 +72,7 @@ YourAppScreen(navController: NavController) {
android:gravity="center"
android:orientation="vertical">

<com.walletconnect.web3.modal.ui.components.button.views.Web3Button
<com.reown.appkit.ui.components.button.views.Web3Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:connect_button_size="NORMAL" || "SMALL"
Expand All @@ -93,12 +93,12 @@ YourAppScreen(navController: NavController) {
<TabItem value="compose" label="Compose">

```kotlin
import com.walletconnect.web3.modal.ui.components.button.NetworkButton
import com.walletconnect.web3.modal.ui.components.button.rememberWeb3ModalState
import com.reown.appkit.ui.components.button.NetworkButton
import com.reown.appkit.ui.components.button.rememberAppKitState

YourAppScreen(navController: NavController) {
val web3ModalState = rememberWeb3ModalState(navController = navController)
NetworkButton(state = web3ModalState)
val appKitState = rememberAppKitState(navController = navController)
NetworkButton(state = appKitState)
}
```

Expand All @@ -114,7 +114,7 @@ YourAppScreen(navController: NavController) {
android:gravity="center"
android:orientation="vertical">

<com.walletconnect.web3.modal.ui.components.button.views.NetworkButton
<com.reown.appkit.ui.components.button.views.NetworkButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Expand All @@ -133,14 +133,14 @@ YourAppScreen(navController: NavController) {
<TabItem value="compose" label="Compose">

```kotlin
import com.walletconnect.web3.modal.ui.components.button.ConnectButton
import com.walletconnect.web3.modal.ui.components.button.ConnectButtonSize
import com.walletconnect.web3.modal.ui.components.button.rememberWeb3ModalState
import com.reown.appkit.ui.components.button.ConnectButton
import com.reown.appkit.ui.components.button.ConnectButtonSize
import com.reown.appkit.ui.components.button.rememberAppKitState

YourAppScreen(navController: NavController) {
val web3ModalState = rememberWeb3ModalState(navController = navController)
val appKitState = rememberAppKitState(navController = navController)
ConnectButton(
state = web3ModalState,
state = appKitState,
buttonSize = ConnectButtonSize.NORMAL || ConnectButtonSize.SMALL
)
}
Expand All @@ -159,7 +159,7 @@ YourAppScreen(navController: NavController) {
android:gravity="center"
android:orientation="vertical">

<com.walletconnect.web3.modal.ui.components.button.views.ConnectButton
<com.reown.appkit.ui.components.button.views.ConnectButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:connect_button_size="NORMAL" || "SMALL"
Expand All @@ -179,14 +179,14 @@ YourAppScreen(navController: NavController) {
<TabItem value="compose" label="Compose">

```kotlin
import com.walletconnect.web3.modal.ui.components.button.AccountButton
import com.walletconnect.web3.modal.ui.components.button.AccountButtonType
import com.walletconnect.web3.modal.ui.components.button.rememberWeb3ModalState
import com.reown.appkit.ui.components.button.AccountButton
import com.reown.appkit.ui.components.button.AccountButtonType
import com.reown.appkit.ui.components.button.rememberAppKitState

YourAppScreen(navController: NavController) {
val web3ModalState = rememberWeb3ModalState(navController = navController)
val appKitState = rememberAppKitState(navController = navController)
AccountButton(
state = web3ModalState,
state = appKitState,
buttonSize = AccountButtonType.NORMAL || AccountButtonType.MIXED
)
}
Expand All @@ -205,7 +205,7 @@ YourAppScreen(navController: NavController) {
android:gravity="center"
android:orientation="vertical">

<com.walletconnect.web3.modal.ui.components.button.views.AccountButton
<com.reown.appkit.ui.components.button.views.AccountButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:account_button_type="NORMAL" || "MIXED"
Expand All @@ -216,28 +216,28 @@ YourAppScreen(navController: NavController) {
</TabItem>
</Tabs>

### Web3Modal State
### AppKit State

Web3modalState is an object that ensures communication between your application and the state of the Web3Modal.
AppKitState is an object that ensures communication between your application and the state of the AppKit.

#### Create web3ModalState:
#### Create appKitState:

NavController is required to create Web3ModalState
NavController is required to create appKitState

```kotlin
val web3modalState = rememberWeb3ModalState(navController)
val appKitState = rememberAppKitState(navController)
```

#### Web3ModalState methods
#### AppKitState methods

```kotlin
web3ModalState.isOpen
appKitState.isOpen
```

returns `StateFlow<Boolean>` whose value is updated depending on whether the web3modal component is open
returns `StateFlow<Boolean>` whose value is updated depending on whether the appkit component is open

```kotlin
web3modalState.isConnected
appKitState.isConnected
```

returns `StateFlow<Boolean>` whose value depends on the active session in Web3Modal
returns `StateFlow<Boolean>` whose value depends on the active session in AppKit
10 changes: 5 additions & 5 deletions docs/appkit/android/core/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Kotlin implementation of AppKit for Android applications.

Android Core ![Maven Central](https://img.shields.io/maven-central/v/com.walletconnect/android-core)
Android Core ![Maven Central](https://img.shields.io/maven-central/v/com.reown/android-core)

Web3Modal ![Maven Central](https://img.shields.io/maven-central/v/com.walletconnect/web3modal)
AppKit ![Maven Central](https://img.shields.io/maven-central/v/com.reown/appkit)

### Requirements

Expand All @@ -27,7 +27,7 @@ allprojects {
app/build.gradle.kts

```gradle
implementation(platform("com.walletconnect:android-bom:$BOM_VERSION"))
implementation("com.walletconnect:android-core")
implementation("com.walletconnect:web3modal")
implementation(platform("com.reown:android-bom:$BOM_VERSION"))
implementation("com.reown:android-core")
implementation("com.reown:appkit")
```
14 changes: 7 additions & 7 deletions docs/appkit/android/core/one-click-auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Connecting a wallet, proving control of an address with an off-chain signature,

## Configure your AppKit Client

To integrate SIWE with AppKit, you need to configure your Web3Modal client using `Modal.Model.AuthPayloadParams`, which are required to create a SIWE message for the user to sign:
To integrate SIWE with AppKit, you need to configure your AppKit client using `Modal.Model.AuthPayloadParams`, which are required to create a SIWE message for the user to sign:

```kotlin
Web3Modal.setAuthRequestParams(authPayloadParams)
AppKit.setAuthRequestParams(authPayloadParams)
```

#### Example of AuthRequestParams
Expand All @@ -33,9 +33,9 @@ To integrate SIWE with AppKit, you need to configure your Web3Modal client using
)
```

Configuring your Web3Modal client with Modal.Model.AuthPayloadParams will prioritize authentication requests over regular session proposals. If the wallet supports One-Click Auth, the session will be created and the user will automatically authenticate without needing to send another SIWE request over personal_sign. If the wallet does not support One-Click Auth, it will fall back to the session proposal. In this case, to authenticate the user, AppKit will send another session request to prove address ownership.
Configuring your AppKit client with Modal.Model.AuthPayloadParams will prioritize authentication requests over regular session proposals. If the wallet supports One-Click Auth, the session will be created and the user will automatically authenticate without needing to send another SIWE request over personal_sign. If the wallet does not support One-Click Auth, it will fall back to the session proposal. In this case, to authenticate the user, AppKit will send another session request to prove address ownership.

To check whether the user has signed a SIWE message, check `onSessionAuthenticateResponse` callback from `Web3Modal.ModalDelegate`:
To check whether the user has signed a SIWE message, check `onSessionAuthenticateResponse` callback from `AppKit.ModalDelegate`:

```kotlin
fun onSessionAuthenticateResponse(response: Modal.Model.SessionAuthenticateResponse) {
Expand Down Expand Up @@ -85,15 +85,15 @@ CoreClient.initialize(
...
)

Web3Modal.initialize(Modal.Params.Init(core = CoreClient))
AppKit.initialize(Modal.Params.Init(core = CoreClient))
```

Once link mode is configured, your dApp will connect and send requests to wallets via app links after receiving proof from the wallet that it also supports link mode.

The wallet will also send responses using app links. Your app needs to pass these responses to the Web3Modal client so it can process them.
The wallet will also send responses using app links. Your app needs to pass these responses to the AppKit client so it can process them.

```kotlin
Web3Modal.handleDeepLink(url) { error ->
AppKit.handleDeepLink(url) { error ->
//handle error

}
Expand Down
10 changes: 5 additions & 5 deletions docs/appkit/android/core/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val recommendedWalletsIds = listOf<String>(

val initParams = Modal.Params.Init(core = CoreClient, recommendedWalletsIds = recommendedWalletsIds)

Web3Modal.initialize(
AppKit.initialize(
init = initParams,
onSuccess = {
// Callback will be called if initialization is successful
Expand All @@ -35,7 +35,7 @@ val excludedWalletIds = listOf<String>(

val initParams = Modal.Params.Init(core = CoreClient, excludedWalletIds = excludedWalletIds)

Web3Modal.initialize(
AppKit.initialize(
init = initParams,
onSuccess = {
// Callback will be called if initialization is successful
Expand Down Expand Up @@ -76,7 +76,7 @@ Coinbase has been added since version 1.2.0
```kotlin
val initParams = Modal.Params.Init(core = CoreClient, coinbaseEnabled = true)

Web3Modal.initialize(
AppKit.initialize(
init = initParams,
onSuccess = {
// Callback will be called if initialization is successful
Expand All @@ -87,12 +87,12 @@ Web3Modal.initialize(
)
```

Coinbase Wallet SDK requires Web3Modal registration in Activity to receive responses from Coinbase wallet
Coinbase Wallet SDK requires AppKit registration in Activity to receive responses from Coinbase wallet

```kotlin
fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Web3Modal.register(this)
AppKit.register(this)
// Your content
}
```
Loading

0 comments on commit eec66ba

Please sign in to comment.