Skip to content

Commit 7f66933

Browse files
authored
Merge pull request #412 from reown-com/feature/flutter_docs_update
Flutter docs update
2 parents a7794aa + d552d9d commit 7f66933

File tree

6 files changed

+100
-35
lines changed

6 files changed

+100
-35
lines changed

appkit/flutter/core/actions.mdx

+24-6
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,28 @@ ValueListenableBuilder<String>(
1717

1818
```
1919

20-
### - Launch the current wallet
20+
### Launch block explorer
2121

22-
If you connected your dApp through deep linking to a Wallet app you can launch that wallet app with the following:
22+
You can open the selected chain's block explorer easily:
2323

2424
```javascript
25-
_appKitModal.launchConnectedWallet();
25+
_appKitModal.launchBlockExplorer();
2626
```
2727

28-
### - Launch block explorer
28+
### - Reconnect relay
2929

30-
You can open the selected chain's block explorer easily:
30+
In most cases it shouldn't be needed as it is called internally but this method is useful to reconnect the relay when internet connection is back after inactivity.
3131

3232
```javascript
33-
_appKitModal.launchBlockExplorer();
33+
await _appKitModal.reconnectRelay();
34+
```
35+
36+
### - Load account data such as balance and identity
37+
38+
In most cases it shouldn't be needed as it is called internally but this method is useful to reload account data such as balance and identity. Particularly useful after a transaction.
39+
40+
```javascript
41+
await _appKitModal.loadAccountData();
3442
```
3543

3644
### - Send an RPC request
@@ -75,6 +83,16 @@ _appKitModal.getApprovedMethods();
7583
_appKitModal.getApprovedEvents();
7684
```
7785

86+
### - Request switch to or add chain
87+
88+
If you add a new chain on an ongoing session you should call `requestSwitchToChain()` so the wallet can add it as well. Otherwise it will just be not usable.
89+
`requestAddChain()` is called automatically by `requestSwitchToChain()` in case of failing with the proper error from the wallet.
90+
91+
```javascript
92+
await _appKitModal.requestSwitchToChain(ReownAppKitModalNetworkInfo newChain);
93+
await _appKitModal.requestAddChain(ReownAppKitModalNetworkInfo newChain);
94+
```
95+
7896
### - Interact with Smart Contracts
7997

8098
<Info>

appkit/flutter/core/custom-chains.mdx

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ This means that if you intend to support just EVM and Solana networks then no fu
1010

1111
However, with extra configuration to `ReownAppKitModalNetworks` and `optionalNamespaces` you can connect to whatever other network you'd like.
1212

13+
<Note>
14+
If you are starting from scratch, you can avoid this by using our [CLI tool](https://pub.dev/packages/reown_cli) and passing the chains you want to support as arguments.
15+
</Note>
16+
17+
1318
For instance, if you want to support also Polkadot blockchain then first add Polkadot to the supported networks list:
1419

1520
```javascript

appkit/flutter/core/email.mdx

+15-16
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Remember to whitelist your dapp's iOS's bundleId and Android's packageName in yo
2121
3. Add your iOS Bundle ID and your Android Package Name
2222
</Warning>
2323

24-
<Warning>
24+
<Note>
2525
Email and Social login are supported only on EVM networks and Solana.
26-
</Warning>
26+
</Note>
2727

2828
## Integration
2929

3030
In order to support Email and Social Wallets creation just set `featuresConfig:` parameter in `ReownAppKitModal` initialization.
3131

32-
```javascript {14-23}
32+
```javascript {14-27}
3333
final _appKitModal = ReownAppKitModal(
3434
context: context,
3535
projectId: '{YOUR_PROJECT_ID}',
@@ -44,26 +44,29 @@ final _appKitModal = ReownAppKitModal(
4444
),
4545
),
4646
featuresConfig: FeaturesConfig(
47-
email: true,
4847
socials: [
49-
AppKitSocialOption.Farcaster,
48+
AppKitSocialOption.Email,
5049
AppKitSocialOption.X,
50+
AppKitSocialOption.Google,
5151
AppKitSocialOption.Apple,
5252
AppKitSocialOption.Discord,
53+
AppKitSocialOption.GitHub,
54+
AppKitSocialOption.Facebook,
55+
AppKitSocialOption.Twitch,
56+
AppKitSocialOption.Telegram,
5357
],
54-
showMainWallets: false,
58+
showMainWallets: false, // OPTIONAL - true by default
5559
),
5660
);
5761
```
5862

5963
## Options
6064

61-
- **_email `bool`_** : This boolean defines whether you want to enable email login. Default `true`
62-
- **_socials `List<AppKitSocialOption>`_** : This list contains the list of social platforms that you want to enable for user authentication. The platforms in the example include Farcaster, X, Discord. Is empty by default, it means that no social options is enabled.
63-
- **showMainWallets `bool`\_** : This boolean defines whether you want to show the main wallet options on the first connect screen. If this is `false` it will show a button that directs you to a new screen displaying all available wallets. Default `true`.
65+
- **_socials `List<AppKitSocialOption>`_** : This list contains the list of social platforms that you want to enable for user authentication. Is empty by default, it means that no social options is enabled. The buttons in the modal will be shown in the same order you configure the list.
66+
- **_showMainWallets `bool`_** : This boolean defines whether you want to show the main wallet options on the first connect screen. If this is `false` it will show a button that directs you to a new screen displaying all available wallets. Default `true`.
6467

6568
<Info>
66-
In order for Email Wallet to work properly, either `AppKitModalConnectButton()` or `AppKitModalAccountButton()` has to be instantiated during the whole lifetime of the app.
69+
In order for Farcaster to work properly, either `AppKitModalConnectButton()` or `AppKitModalAccountButton()` has to be instantiated during the whole lifetime of the app.
6770

6871
If you already use them then nothing else has to be done, but in case you don't use them but still want to support Email & Social Wallets you would have to instantiate and hide them as follows:
6972

@@ -81,10 +84,6 @@ AppKitModalAccountButton(
8184

8285
## User Flow
8386

84-
1. Users will be able to connect to you application by simply using an email address. AppKit will send to them a One Time Password (OTP) to copy and paste in the modal, which will help to verify the user's authenticity. This will create a non-custodial wallet for your user which will be available in any application that integrates AppKit and Email Wallets.
87+
1. Users can connect to your application using either an email address or a social login option. Upon selecting an option, they will be redirected to a secure login page in the device’s default browser. If the Email option is selected, AppKit will first send an approval link to the user's email, followed by a One-Time Password (OTP) to be used in the login flow. This process helps verify the user’s identity. In both cases, whether using Email or Social login, a non-custodial wallet will be created for the user. This wallet will be accessible across any application that integrates AppKit and Email Wallets.
8588

86-
2. Eventually the user can optionally choose to move from a non-custodial wallet to a self-custodial one by pressing "Upgrade Wallet" on AppKit. This will open the (Reown secure website) that will walk your user through the upgrading process.
87-
88-
<Note>
89-
Due to Safari’s strict third-party cookie policies, the SDK is not preserving sessions after the app is terminated (removed from memory). So upon app termination the user will have to re-authenticate themselves through a new OTP code if they want to sign. Our team is working to solve this issue soon.
90-
</Note>
89+
2. Eventually, users can optionally choose to upgrade from a non-custodial wallet to a self-custodial one by tapping “Upgrade Wallet” in AppKit. This action opens the Reown secure website, which guides the user through the upgrade process.

appkit/flutter/core/installation.mdx

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Let's get started with the installation and configuration!
99

1010
## Installation
1111

12-
<Info>
12+
<Note>
1313
If you are just starting a new project, you can use our [CLI tool](https://pub.dev/packages/reown_cli) to get started quickly.
14-
</Info>
14+
</Note>
1515

1616
1. - Add `reown_appkit` as dependency in your `pubspec.yaml` and run `flutter pub get` (check out the [latest version](https://pub.dev/packages/reown_appkit/install))
1717
- Or simply run `flutter pub add reown_appkit`
@@ -79,8 +79,6 @@ Example:
7979
</Tab>
8080
</Tabs>
8181

82-
<hr />
83-
8482
### Coinbase Wallet support
8583

8684
Coinbase Wallet does not use the WalletConnect protocol for communication between the dApp and the wallet.

appkit/flutter/core/options.mdx

+40-8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Options
44

55
```javascript
66
final _appKitModal = ReownAppKitModal(
7+
logLevel: LogLevel.error,
78
context: context,
89
projectId: '{YOUR_PROJECT_ID}',
910
metadata: const PairingMetadata(
@@ -14,7 +15,7 @@ final _appKitModal = ReownAppKitModal(
1415
redirect: Redirect( // OPTIONAL
1516
native: 'exampleapp://',
1617
universal: 'https://reown.com/exampleapp',
17-
linkMode: false,
18+
linkMode: true|false,
1819
),
1920
),
2021
// disconnectOnDispose: false,
@@ -25,12 +26,19 @@ final _appKitModal = ReownAppKitModal(
2526
// socials: [...], // OPTIONAL - empty by default
2627
// showMainWallets: true, // OPTIONAL - true by default
2728
// ),
28-
// getBalanceFallback: () async { }, OPTIONAL - null by default
29-
// requiredNamespaces: {}, OPTIONAL - null by default
30-
// optionalNamespaces: {}, OPTIONAL - null by default
31-
// featuredWalletIds: {}, OPTIONAL - null by default
32-
// includedWalletIds: {}, OPTIONAL - null by default
33-
// excludedWalletIds: {}, OPTIONAL - null by default
29+
// getBalanceFallback: () async { }, // OPTIONAL - null by default
30+
// requiredNamespaces: {}, // OPTIONAL - null by default
31+
// optionalNamespaces: {}, // OPTIONAL - null by default
32+
// featuredWalletIds: {}, // OPTIONAL - null by default
33+
// includedWalletIds: {}, // OPTIONAL - null by default
34+
// excludedWalletIds: {}, // OPTIONAL - null by default
35+
// customWallets: [ // OPTIONAL - null by default
36+
// ReownAppKitModalWalletInfo(
37+
// listing: AppKitModalWalletListing(
38+
// ...
39+
// ),
40+
// ),
41+
// ],
3442
);
3543
```
3644

@@ -56,7 +64,7 @@ This callback method will be triggered if getting the balance from our blockchai
5664

5765
These are the set of namespaces that will be requested to the wallet you are connecting to.
5866

59-
These values are optionals and, in most cases, not required since AppKit already defines every required and optional namespace internally based on configured networks.
67+
These values are optional and, in most cases, not required, as AppKit already defines all required and optional namespaces internally based on the configured networks (EVM and Solana by default).
6068

6169
However, if you would want to override that definition with your own or support more networks than just EVM and Solana (i.e. Polkadot, Kadena, etc...) these are the object you should modify. See [Custom Networks](../core/custom-chains). section.
6270

@@ -96,3 +104,27 @@ final Set<String> excludedWalletIds = {
96104
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase Wallet
97105
}
98106
```
107+
108+
### customWallets:
109+
110+
A list of user defined wallets. Example:
111+
112+
```javascript
113+
customWallets: [
114+
ReownAppKitModalWalletInfo(
115+
listing: AppKitModalWalletListing(
116+
id: '00001',
117+
name: 'Reown Web Sample',
118+
homepage: 'https://react-wallet.walletconnect.com',
119+
imageId:
120+
'https://avatars.githubusercontent.com/u/179229932?s=200&v=4',
121+
order: 1,
122+
webappLink: 'https://react-wallet.walletconnect.com',
123+
),
124+
),
125+
],
126+
```
127+
128+
### disconnectOnDispose:
129+
130+
Whether if you want to disconnect the user when disposing the context that holds your modal instance

appkit/flutter/core/usage.mdx

+14-1
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,32 @@ In order to initialize `ReownAppKitModal()` instance you must provide a _project
2323
```javascript
2424
// AppKit Modal instance
2525
final _appKitModal = ReownAppKitModal(
26+
logLevel: LogLevel.error,
2627
context: context,
2728
projectId: '{YOUR_PROJECT_ID}',
2829
metadata: const PairingMetadata(
2930
name: 'Example App',
3031
description: 'Example app description',
3132
url: 'https://example.com/',
3233
icons: ['https://example.com/logo.png'],
33-
redirect: Redirect( // OPTIONAL
34+
redirect: Redirect(
3435
native: 'exampleapp://',
3536
universal: 'https://reown.com/exampleapp',
3637
linkMode: true|false,
3738
),
3839
),
40+
enableAnalytics: true,
41+
siweConfig: SIWEConfig(...),
42+
featuresConfig: FeaturesConfig(...),
43+
getBalanceFallback: () async {},
44+
disconnectOnDispose: true|false,
45+
customWallets: [
46+
ReownAppKitModalWalletInfo(
47+
listing: AppKitModalWalletListing(
48+
...
49+
),
50+
),
51+
],
3952
);
4053

4154
// Register here the event callbacks on the service you'd like to use. See `Events` section.

0 commit comments

Comments
 (0)