@reown/appkit-react-native 0.0.0-feat-multichain-20250731180941 → 0.0.0-feat-multichain-20250804182547
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/AppKit.js +46 -64
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/AppKitContext.js +3 -5
- package/lib/commonjs/AppKitContext.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +14 -2
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/hooks/useProvider.js +29 -10
- package/lib/commonjs/hooks/useProvider.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-account-button/index.js +1 -1
- package/lib/commonjs/modal/w3m-account-button/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-network-button/index.js +1 -1
- package/lib/commonjs/modal/w3m-network-button/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-activity/index.js +1 -1
- package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-tokens/index.js +1 -1
- package/lib/commonjs/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-mobile/index.js +6 -7
- package/lib/commonjs/partials/w3m-connecting-mobile/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js +25 -10
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-web/index.js +6 -7
- package/lib/commonjs/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +1 -1
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/index.js +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/HelpersUtil.js.map +1 -1
- package/lib/commonjs/utils/UiUtil.js +0 -14
- package/lib/commonjs/utils/UiUtil.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js +2 -2
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-account-view/index.js +1 -1
- package/lib/commonjs/views/w3m-account-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-all-wallets-view/index.js +3 -3
- package/lib/commonjs/views/w3m-all-wallets-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/recent-wallet-list.js +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/recent-wallet-list.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js +5 -6
- package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js +6 -10
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-social-view/index.js +6 -8
- package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js +7 -7
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-network-switch-view/index.js +4 -3
- package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-networks-view/index.js +2 -2
- package/lib/commonjs/views/w3m-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-checkout-view/index.js +1 -1
- package/lib/commonjs/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/Header.js +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/Header.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/index.js +1 -1
- package/lib/commonjs/views/w3m-onramp-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-unsupported-chain-view/index.js +2 -4
- package/lib/commonjs/views/w3m-unsupported-chain-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js +1 -1
- package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-receive-view/index.js +2 -2
- package/lib/commonjs/views/w3m-wallet-receive-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js +1 -1
- package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js +1 -1
- package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
- package/lib/module/AppKit.js +47 -65
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/AppKitContext.js +1 -3
- package/lib/module/AppKitContext.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +15 -3
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/hooks/useProvider.js +30 -10
- package/lib/module/hooks/useProvider.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/modal/w3m-account-button/index.js +2 -2
- package/lib/module/modal/w3m-account-button/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/index.js +2 -2
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/modal/w3m-network-button/index.js +2 -2
- package/lib/module/modal/w3m-network-button/index.js.map +1 -1
- package/lib/module/partials/w3m-account-activity/index.js +2 -2
- package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/module/partials/w3m-account-tokens/index.js +2 -2
- package/lib/module/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-mobile/index.js +7 -8
- package/lib/module/partials/w3m-connecting-mobile/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-qrcode/index.js +26 -11
- package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-web/index.js +7 -8
- package/lib/module/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +2 -2
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/partials/w3m-selector-modal/index.js +2 -2
- package/lib/module/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/HelpersUtil.js.map +1 -1
- package/lib/module/utils/UiUtil.js +2 -15
- package/lib/module/utils/UiUtil.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/index.js +4 -4
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-account-view/index.js +2 -2
- package/lib/module/views/w3m-account-view/index.js.map +1 -1
- package/lib/module/views/w3m-all-wallets-view/index.js +4 -4
- package/lib/module/views/w3m-all-wallets-view/index.js.map +1 -1
- package/lib/module/views/w3m-connect-view/components/all-wallet-list.js +2 -2
- package/lib/module/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
- package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js +2 -2
- package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
- package/lib/module/views/w3m-connect-view/components/recent-wallet-list.js +2 -2
- package/lib/module/views/w3m-connect-view/components/recent-wallet-list.js.map +1 -1
- package/lib/module/views/w3m-connect-view/index.js +1 -1
- package/lib/module/views/w3m-connect-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-external-view/index.js +7 -8
- package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-siwe-view/index.js +8 -12
- package/lib/module/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-social-view/index.js +8 -10
- package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +9 -9
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/views/w3m-network-switch-view/index.js +7 -5
- package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/module/views/w3m-networks-view/index.js +4 -4
- package/lib/module/views/w3m-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-checkout-view/index.js +2 -2
- package/lib/module/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/Header.js +2 -2
- package/lib/module/views/w3m-onramp-view/components/Header.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/index.js +2 -2
- package/lib/module/views/w3m-onramp-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js +2 -2
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/module/views/w3m-unsupported-chain-view/index.js +4 -6
- package/lib/module/views/w3m-unsupported-chain-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js +2 -2
- package/lib/module/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-receive-view/index.js +3 -3
- package/lib/module/views/w3m-wallet-receive-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js +2 -2
- package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-select-token-view/index.js +2 -2
- package/lib/module/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +4 -24
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +1 -1
- package/lib/typescript/AppKitContext.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useProvider.d.ts +28 -1
- package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-account-button/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-network-button/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-activity/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-account-tokens/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-mobile/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-qrcode/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-web/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +156 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils/HelpersUtil.d.ts +3 -2
- package/lib/typescript/utils/HelpersUtil.d.ts.map +1 -1
- package/lib/typescript/utils/UiUtil.d.ts +0 -4
- package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-external-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-social-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-network-switch-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-networks-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-checkout-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-unsupported-chain-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-compatible-networks-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-receive-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-select-token-view/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/AppKit.ts +59 -108
- package/src/AppKitContext.tsx +1 -2
- package/src/connectors/WalletConnectConnector.ts +19 -4
- package/src/hooks/useProvider.ts +30 -9
- package/src/index.ts +1 -0
- package/src/modal/w3m-account-button/index.tsx +3 -2
- package/src/modal/w3m-modal/index.tsx +2 -2
- package/src/modal/w3m-network-button/index.tsx +2 -1
- package/src/partials/w3m-account-activity/index.tsx +2 -1
- package/src/partials/w3m-account-tokens/index.tsx +2 -1
- package/src/partials/w3m-connecting-mobile/index.tsx +7 -8
- package/src/partials/w3m-connecting-qrcode/index.tsx +16 -12
- package/src/partials/w3m-connecting-web/index.tsx +7 -9
- package/src/partials/w3m-header/index.tsx +2 -2
- package/src/partials/w3m-selector-modal/index.tsx +2 -2
- package/src/types.ts +190 -0
- package/src/utils/HelpersUtil.ts +3 -2
- package/src/utils/UiUtil.ts +1 -25
- package/src/views/w3m-account-default-view/index.tsx +5 -4
- package/src/views/w3m-account-view/index.tsx +2 -1
- package/src/views/w3m-all-wallets-view/index.tsx +5 -5
- package/src/views/w3m-connect-view/components/all-wallet-list.tsx +3 -3
- package/src/views/w3m-connect-view/components/custom-wallet-list.tsx +3 -3
- package/src/views/w3m-connect-view/components/recent-wallet-list.tsx +2 -2
- package/src/views/w3m-connect-view/index.tsx +2 -2
- package/src/views/w3m-connecting-external-view/index.tsx +7 -8
- package/src/views/w3m-connecting-siwe-view/index.tsx +5 -9
- package/src/views/w3m-connecting-social-view/index.tsx +8 -10
- package/src/views/w3m-connecting-view/index.tsx +9 -9
- package/src/views/w3m-network-switch-view/index.tsx +8 -6
- package/src/views/w3m-networks-view/index.tsx +5 -4
- package/src/views/w3m-onramp-checkout-view/index.tsx +2 -1
- package/src/views/w3m-onramp-view/components/Header.tsx +2 -2
- package/src/views/w3m-onramp-view/index.tsx +3 -2
- package/src/views/w3m-swap-view/components/select-token-view/index.tsx +2 -1
- package/src/views/w3m-unsupported-chain-view/index.tsx +4 -5
- package/src/views/w3m-wallet-compatible-networks-view/index.tsx +2 -1
- package/src/views/w3m-wallet-receive-view/index.tsx +6 -2
- package/src/views/w3m-wallet-send-preview-view/components/preview-send-details.tsx +2 -2
- package/src/views/w3m-wallet-send-select-token-view/index.tsx +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0.0-feat-multichain-
|
|
3
|
+
"version": "0.0.0-feat-multichain-20250804182547",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@reown/appkit-common-react-native": "0.0.0-feat-multichain-
|
|
42
|
-
"@reown/appkit-core-react-native": "0.0.0-feat-multichain-
|
|
43
|
-
"@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-
|
|
44
|
-
"@reown/appkit-ui-react-native": "0.0.0-feat-multichain-
|
|
41
|
+
"@reown/appkit-common-react-native": "0.0.0-feat-multichain-20250804182547",
|
|
42
|
+
"@reown/appkit-core-react-native": "0.0.0-feat-multichain-20250804182547",
|
|
43
|
+
"@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-20250804182547",
|
|
44
|
+
"@reown/appkit-ui-react-native": "0.0.0-feat-multichain-20250804182547",
|
|
45
45
|
"@walletconnect/universal-provider": "2.21.5",
|
|
46
46
|
"valtio": "2.1.5"
|
|
47
47
|
},
|
package/src/AppKit.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type Features,
|
|
3
2
|
EventsController,
|
|
4
3
|
ModalController,
|
|
5
4
|
ConnectionsController,
|
|
@@ -7,9 +6,8 @@ import {
|
|
|
7
6
|
RouterController,
|
|
8
7
|
TransactionsController,
|
|
9
8
|
StorageUtil,
|
|
10
|
-
type OptionsControllerState,
|
|
11
9
|
ThemeController,
|
|
12
|
-
|
|
10
|
+
WcController,
|
|
13
11
|
SwapController,
|
|
14
12
|
OnRampController,
|
|
15
13
|
CoreHelperUtil,
|
|
@@ -23,18 +21,12 @@ import {
|
|
|
23
21
|
type ProposalNamespaces,
|
|
24
22
|
type ConnectorType,
|
|
25
23
|
type Namespaces,
|
|
26
|
-
type Metadata,
|
|
27
24
|
type CaipNetworkId,
|
|
28
25
|
type AppKitNetwork,
|
|
29
26
|
type Provider,
|
|
30
|
-
type ThemeVariables,
|
|
31
|
-
type ThemeMode,
|
|
32
27
|
type WalletInfo,
|
|
33
|
-
type Network,
|
|
34
28
|
type ChainNamespace,
|
|
35
|
-
type Storage,
|
|
36
29
|
type AppKitConnectOptions,
|
|
37
|
-
type AppKitSIWEClient,
|
|
38
30
|
type ConnectionProperties,
|
|
39
31
|
type AccountType,
|
|
40
32
|
type AppKitOpenOptions,
|
|
@@ -47,29 +39,7 @@ import { WalletConnectConnector } from './connectors/WalletConnectConnector';
|
|
|
47
39
|
import { WcHelpersUtil } from './utils/HelpersUtil';
|
|
48
40
|
import { NetworkUtil } from './utils/NetworkUtil';
|
|
49
41
|
import { RouterUtil } from './utils/RouterUtil';
|
|
50
|
-
|
|
51
|
-
interface AppKitConfig {
|
|
52
|
-
projectId: string;
|
|
53
|
-
metadata: Metadata;
|
|
54
|
-
adapters: BlockchainAdapter[];
|
|
55
|
-
networks: Network[];
|
|
56
|
-
storage: Storage;
|
|
57
|
-
extraConnectors?: WalletConnector[];
|
|
58
|
-
clipboardClient?: OptionsControllerState['clipboardClient'];
|
|
59
|
-
includeWalletIds?: OptionsControllerState['includeWalletIds'];
|
|
60
|
-
excludeWalletIds?: OptionsControllerState['excludeWalletIds'];
|
|
61
|
-
featuredWalletIds?: OptionsControllerState['featuredWalletIds'];
|
|
62
|
-
customWallets?: OptionsControllerState['customWallets'];
|
|
63
|
-
tokens?: OptionsControllerState['tokens']; //TODO: check if needed in OptionsController
|
|
64
|
-
enableAnalytics?: OptionsControllerState['enableAnalytics'];
|
|
65
|
-
debug?: OptionsControllerState['debug'];
|
|
66
|
-
themeMode?: ThemeMode;
|
|
67
|
-
themeVariables?: ThemeVariables;
|
|
68
|
-
siweConfig?: AppKitSIWEClient;
|
|
69
|
-
defaultNetwork?: Network;
|
|
70
|
-
features?: Features;
|
|
71
|
-
// chainImages?: Record<number, string>; //TODO: rename to networkImages
|
|
72
|
-
}
|
|
42
|
+
import { type AppKitConfig } from './types';
|
|
73
43
|
|
|
74
44
|
export class AppKit {
|
|
75
45
|
private projectId: string;
|
|
@@ -115,7 +85,10 @@ export class AppKit {
|
|
|
115
85
|
});
|
|
116
86
|
|
|
117
87
|
this.networks = networksWithAdapters;
|
|
118
|
-
this.namespaces = WcHelpersUtil.createNamespaces(
|
|
88
|
+
this.namespaces = WcHelpersUtil.createNamespaces(
|
|
89
|
+
this.networks,
|
|
90
|
+
config.universalProviderConfigOverride
|
|
91
|
+
) as ProposalNamespaces;
|
|
119
92
|
this.config = config;
|
|
120
93
|
this.extraConnectors = config.extraConnectors || [];
|
|
121
94
|
|
|
@@ -144,47 +117,59 @@ export class AppKit {
|
|
|
144
117
|
siweConfig: this.config?.siweConfig
|
|
145
118
|
});
|
|
146
119
|
|
|
147
|
-
|
|
148
|
-
const properties = connector.getProperties();
|
|
120
|
+
this.processConnection(connector, approvedNamespaces);
|
|
149
121
|
|
|
150
|
-
|
|
151
|
-
|
|
122
|
+
// Save connector type and namespaces in storage
|
|
123
|
+
if (approvedNamespaces && Object.keys(approvedNamespaces).length > 0) {
|
|
124
|
+
await StorageUtil.setConnectedConnectors({
|
|
125
|
+
type: connector.type,
|
|
126
|
+
namespaces: Object.keys(approvedNamespaces)
|
|
127
|
+
});
|
|
152
128
|
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.warn('Connection failed:', error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
153
134
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
135
|
+
private processConnection(
|
|
136
|
+
connector: WalletConnector,
|
|
137
|
+
namespaces?: Namespaces,
|
|
138
|
+
shouldCloseModal: boolean = true
|
|
139
|
+
) {
|
|
140
|
+
if (!namespaces || Object.keys(namespaces).length === 0) {
|
|
141
|
+
throw new Error('No namespaces provided');
|
|
142
|
+
}
|
|
159
143
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
//TODO: handle case where devs want to connect to a namespace that has no adapters. Could use the provider directly.
|
|
163
|
-
throw new Error('No compatible adapters found for the approved namespaces');
|
|
164
|
-
}
|
|
144
|
+
const walletInfo = connector.getWalletInfo();
|
|
145
|
+
const properties = connector.getProperties();
|
|
165
146
|
|
|
166
|
-
|
|
167
|
-
this.setConnection(approvedAdapters, approvedNamespaces, walletInfo, properties);
|
|
147
|
+
const initializedAdapters = this.setupAdaptersAndSubscribe(connector, Object.keys(namespaces));
|
|
168
148
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
type: connector.type,
|
|
172
|
-
namespaces: Object.keys(approvedNamespaces)
|
|
173
|
-
});
|
|
149
|
+
if (initializedAdapters.length === 0) {
|
|
150
|
+
console.warn('No compatible adapters found for namespaces:', Object.keys(namespaces));
|
|
174
151
|
|
|
175
|
-
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
176
154
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
155
|
+
// Store the connection details
|
|
156
|
+
this.setConnection(initializedAdapters, namespaces, walletInfo, properties);
|
|
157
|
+
|
|
158
|
+
// Sync accounts
|
|
159
|
+
this.syncAccounts(initializedAdapters);
|
|
160
|
+
|
|
161
|
+
// Handle SIWE if enabled
|
|
162
|
+
this.handleSiweConnectionIfEnabled(shouldCloseModal);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private handleSiweConnectionIfEnabled(shouldCloseModal: boolean = true): void {
|
|
166
|
+
if (
|
|
167
|
+
OptionsController.state.isSiweEnabled &&
|
|
168
|
+
ConnectionsController.state.activeNamespace === 'eip155'
|
|
169
|
+
) {
|
|
170
|
+
this.handleSiweChange({ isConnection: true });
|
|
171
|
+
} else if (shouldCloseModal) {
|
|
172
|
+
ModalController.close();
|
|
188
173
|
}
|
|
189
174
|
}
|
|
190
175
|
|
|
@@ -219,7 +204,7 @@ export class AppKit {
|
|
|
219
204
|
SwapController.resetState();
|
|
220
205
|
SendController.resetState();
|
|
221
206
|
OnRampController.resetState();
|
|
222
|
-
|
|
207
|
+
WcController.resetState();
|
|
223
208
|
|
|
224
209
|
if (ConnectionsController.state.activeNamespace === undefined) {
|
|
225
210
|
ConnectionsController.setActiveNamespace(
|
|
@@ -383,13 +368,12 @@ export class AppKit {
|
|
|
383
368
|
return this.walletConnectConnector;
|
|
384
369
|
}
|
|
385
370
|
|
|
386
|
-
//TODO: reuse logic with connect method
|
|
387
371
|
/**
|
|
388
372
|
* Initializes connectors based on stored connection data.
|
|
389
373
|
* This attempts to restore previous sessions.
|
|
390
374
|
*/
|
|
391
375
|
private async initConnectors() {
|
|
392
|
-
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
376
|
+
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
393
377
|
if (connectedConnectors.length > 0) {
|
|
394
378
|
ModalController.setLoading(true);
|
|
395
379
|
|
|
@@ -398,31 +382,8 @@ export class AppKit {
|
|
|
398
382
|
const connector = await this.createConnector(connected.type);
|
|
399
383
|
|
|
400
384
|
const namespaces = connector.getNamespaces();
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (namespaces && Object.keys(namespaces).length > 0) {
|
|
405
|
-
// Ensure namespaces is not empty
|
|
406
|
-
// Setup adapters and subscribe to events
|
|
407
|
-
const initializedAdapters = this.setupAdaptersAndSubscribe(
|
|
408
|
-
connector,
|
|
409
|
-
Object.keys(namespaces)
|
|
410
|
-
);
|
|
411
|
-
|
|
412
|
-
// If adapters were successfully initialized, store the connection details
|
|
413
|
-
if (initializedAdapters.length > 0) {
|
|
414
|
-
this.setConnection(initializedAdapters, namespaces, walletInfo, properties);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
this.syncAccounts(initializedAdapters);
|
|
418
|
-
|
|
419
|
-
if (
|
|
420
|
-
OptionsController.state.isSiweEnabled &&
|
|
421
|
-
ConnectionsController.state.activeNamespace === 'eip155'
|
|
422
|
-
) {
|
|
423
|
-
this.handleSiweChange({ isConnection: true });
|
|
424
|
-
}
|
|
425
|
-
}
|
|
385
|
+
|
|
386
|
+
this.processConnection(connector, namespaces, false);
|
|
426
387
|
} catch (error) {
|
|
427
388
|
// Use console.warn for non-critical initialization failures
|
|
428
389
|
console.warn(`Failed to initialize connector type ${connected.type}:`, error);
|
|
@@ -449,7 +410,7 @@ export class AppKit {
|
|
|
449
410
|
}
|
|
450
411
|
|
|
451
412
|
adapters.forEach(adapter => {
|
|
452
|
-
adapter.
|
|
413
|
+
adapter.init({ connector });
|
|
453
414
|
this.subscribeToAdapterEvents(adapter);
|
|
454
415
|
});
|
|
455
416
|
|
|
@@ -569,9 +530,7 @@ export class AppKit {
|
|
|
569
530
|
private subscribeToAdapterEvents(adapter: BlockchainAdapter): void {
|
|
570
531
|
adapter.on('accountsChanged', ({ accounts }) => {
|
|
571
532
|
const namespace = adapter.getSupportedNamespace();
|
|
572
|
-
|
|
573
|
-
console.log('accountsChanged', accounts, namespace);
|
|
574
|
-
//TODO: check this
|
|
533
|
+
ConnectionsController.updateAccounts(namespace, accounts);
|
|
575
534
|
|
|
576
535
|
if (namespace === 'eip155') {
|
|
577
536
|
this.handleSiweChange({ isAccountChange: true });
|
|
@@ -605,7 +564,6 @@ export class AppKit {
|
|
|
605
564
|
this.disconnect(namespace, false);
|
|
606
565
|
});
|
|
607
566
|
|
|
608
|
-
//TODO: Add types to this events
|
|
609
567
|
adapter.on('balanceChanged', ({ address, balance }) => {
|
|
610
568
|
//eslint-disable-next-line no-console
|
|
611
569
|
console.log('balanceChanged', address, balance);
|
|
@@ -623,7 +581,6 @@ export class AppKit {
|
|
|
623
581
|
this.setExcludedWallets(options);
|
|
624
582
|
this.setCustomWallets(options);
|
|
625
583
|
OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
|
|
626
|
-
OptionsController.setTokens(options.tokens);
|
|
627
584
|
OptionsController.setEnableAnalytics(options.enableAnalytics);
|
|
628
585
|
OptionsController.setDebug(options.debug);
|
|
629
586
|
OptionsController.setFeatures(options.features);
|
|
@@ -671,8 +628,6 @@ export class AppKit {
|
|
|
671
628
|
|
|
672
629
|
private async initRecentWallets(options: AppKitConfig) {
|
|
673
630
|
const wallets = await StorageUtil.getRecentWallets();
|
|
674
|
-
const connectedWalletImage = await StorageUtil.getConnectedWalletImageUrl();
|
|
675
|
-
|
|
676
631
|
const filteredWallets = wallets.filter(wallet => {
|
|
677
632
|
const { includeWalletIds, excludeWalletIds } = options;
|
|
678
633
|
if (includeWalletIds) {
|
|
@@ -685,11 +640,7 @@ export class AppKit {
|
|
|
685
640
|
return true;
|
|
686
641
|
});
|
|
687
642
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (connectedWalletImage) {
|
|
691
|
-
ConnectionController.setConnectedWalletImageUrl(connectedWalletImage);
|
|
692
|
-
}
|
|
643
|
+
WcController.setRecentWallets(filteredWallets);
|
|
693
644
|
}
|
|
694
645
|
|
|
695
646
|
private setExcludedWallets(options: AppKitConfig) {
|
|
@@ -699,7 +650,7 @@ export class AppKit {
|
|
|
699
650
|
const excludeCoinbase = !this.extraConnectors.some(connector => connector.type === 'coinbase');
|
|
700
651
|
|
|
701
652
|
if (excludeCoinbase) {
|
|
702
|
-
excludedWallets.push(ConstantsUtil.
|
|
653
|
+
excludedWallets.push(ConstantsUtil.COINBASE_CUSTOM_WALLET.id);
|
|
703
654
|
}
|
|
704
655
|
|
|
705
656
|
OptionsController.setExcludeWalletIds(excludedWallets);
|
package/src/AppKitContext.tsx
CHANGED
|
@@ -16,8 +16,7 @@ export const AppKitProvider: React.FC<AppKitProviderProps> = ({ children, instan
|
|
|
16
16
|
return <AppKitContext.Provider value={{ appKit: instance }}>{children}</AppKitContext.Provider>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
export const useAppKit = () => {
|
|
19
|
+
export const useInternalAppKit = () => {
|
|
21
20
|
const context = useContext(AppKitContext);
|
|
22
21
|
if (context === undefined) {
|
|
23
22
|
throw new Error('useAppKit must be used within an AppKitProvider');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WcController } from '@reown/appkit-core-react-native';
|
|
2
2
|
import { UniversalProvider, type IUniversalProvider } from '@walletconnect/universal-provider';
|
|
3
3
|
import {
|
|
4
4
|
WalletConnector,
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
type ConnectOptions,
|
|
12
12
|
type ConnectorInitOptions,
|
|
13
13
|
type Metadata,
|
|
14
|
-
type ConnectionProperties
|
|
14
|
+
type ConnectionProperties,
|
|
15
|
+
type RequestArguments
|
|
15
16
|
} from '@reown/appkit-common-react-native';
|
|
16
17
|
import { getDidAddress, getDidChainId, SIWEController } from '@reown/appkit-siwe-react-native';
|
|
17
18
|
|
|
@@ -95,7 +96,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
95
96
|
override async connect(opts: ConnectOptions) {
|
|
96
97
|
const { siweConfig, namespaces, defaultChain, universalLink } = opts;
|
|
97
98
|
function onUri(uri: string) {
|
|
98
|
-
|
|
99
|
+
WcController.setWcUri(uri);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
const provider = this.getProvider() as IUniversalProvider;
|
|
@@ -201,11 +202,25 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
201
202
|
return this.namespaces;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
override getProvider(): Provider {
|
|
205
|
+
override getProvider(namespace?: ChainNamespace): Provider {
|
|
205
206
|
if (!this.provider) {
|
|
206
207
|
throw new Error('WalletConnectConnector: Provider not initialized. Call init() first.');
|
|
207
208
|
}
|
|
208
209
|
|
|
210
|
+
const provider = this.provider as IUniversalProvider;
|
|
211
|
+
|
|
212
|
+
if (namespace) {
|
|
213
|
+
const _chainId = this.getChainId(namespace);
|
|
214
|
+
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
return {
|
|
217
|
+
...provider,
|
|
218
|
+
request: (args: RequestArguments, chainId?: CaipNetworkId) => {
|
|
219
|
+
return provider.request(args, chainId || _chainId);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
209
224
|
return this.provider;
|
|
210
225
|
}
|
|
211
226
|
|
package/src/hooks/useProvider.ts
CHANGED
|
@@ -2,24 +2,45 @@ import { useSnapshot } from 'valtio';
|
|
|
2
2
|
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
3
|
import type { Provider, ChainNamespace } from '@reown/appkit-common-react-native';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Interface representing the result of the useProvider hook
|
|
7
|
+
*/
|
|
5
8
|
interface ProviderResult {
|
|
9
|
+
/** The active connection provider instance */
|
|
6
10
|
provider?: Provider;
|
|
11
|
+
/** The chain namespace supported by the provider */
|
|
7
12
|
providerType?: ChainNamespace;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Hook that returns the active connection provider and its supported chain namespace.
|
|
17
|
+
*
|
|
18
|
+
* This hook accesses the current connection and returns the provider instance along with its supported namespace.
|
|
19
|
+
*
|
|
20
|
+
* @returns {ProviderResult} An object containing:
|
|
21
|
+
* - `provider`: The active connection provider instance, or undefined if no connection exists
|
|
22
|
+
* - `providerType`: The chain namespace supported by the provider, or undefined if no connection exists
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const { provider, providerType } = useProvider();
|
|
27
|
+
*
|
|
28
|
+
* if (provider) {
|
|
29
|
+
* // Use the provider for blockchain operations
|
|
30
|
+
* const balance = await provider.request({
|
|
31
|
+
* method: 'eth_getBalance',
|
|
32
|
+
* params: [address, 'latest']
|
|
33
|
+
* });
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function useProvider(): ProviderResult {
|
|
38
|
+
const { connection } = useSnapshot(ConnectionsController.state);
|
|
18
39
|
|
|
19
40
|
if (!connection) return { provider: undefined, providerType: undefined };
|
|
20
41
|
|
|
21
42
|
return {
|
|
22
|
-
provider: connection.adapter.
|
|
43
|
+
provider: connection.adapter.getProvider(),
|
|
23
44
|
providerType: connection.adapter.getSupportedNamespace()
|
|
24
45
|
};
|
|
25
46
|
}
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { AppKit } from './modal/w3m-modal';
|
|
|
17
17
|
/********** Types **********/
|
|
18
18
|
export type * from '@reown/appkit-core-react-native';
|
|
19
19
|
export type { AppKitNetwork, Storage } from '@reown/appkit-common-react-native';
|
|
20
|
+
export type { AppKitConfig } from './types';
|
|
20
21
|
|
|
21
22
|
/****** Hooks *******/
|
|
22
23
|
export { useAppKit } from './hooks/useAppKit';
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
ModalController,
|
|
6
6
|
ThemeController,
|
|
7
7
|
ConnectionsController,
|
|
8
|
-
AssetController
|
|
8
|
+
AssetController,
|
|
9
|
+
AssetUtil
|
|
9
10
|
} from '@reown/appkit-core-react-native';
|
|
10
11
|
import { AccountButton as AccountButtonUI, ThemeProvider } from '@reown/appkit-ui-react-native';
|
|
11
12
|
|
|
@@ -26,7 +27,7 @@ export function AccountButton({ balance, disabled, style, testID }: AccountButto
|
|
|
26
27
|
identity
|
|
27
28
|
} = useSnapshot(ConnectionsController.state);
|
|
28
29
|
|
|
29
|
-
const networkImage = activeNetwork
|
|
30
|
+
const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
|
|
30
31
|
const showBalance = balance === 'show';
|
|
31
32
|
|
|
32
33
|
return (
|
|
@@ -15,11 +15,11 @@ import { AppKitRouter } from '../w3m-router';
|
|
|
15
15
|
import { Header } from '../../partials/w3m-header';
|
|
16
16
|
import { Snackbar } from '../../partials/w3m-snackbar';
|
|
17
17
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
18
|
-
import {
|
|
18
|
+
import { useInternalAppKit } from '../../AppKitContext';
|
|
19
19
|
import styles from './styles';
|
|
20
20
|
|
|
21
21
|
export function AppKit() {
|
|
22
|
-
const { close } =
|
|
22
|
+
const { close } = useInternalAppKit();
|
|
23
23
|
const { open } = useSnapshot(ModalController.state);
|
|
24
24
|
const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
|
|
25
25
|
const { projectId } = useSnapshot(OptionsController.state);
|
|
@@ -3,6 +3,7 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
3
3
|
import {
|
|
4
4
|
ApiController,
|
|
5
5
|
AssetController,
|
|
6
|
+
AssetUtil,
|
|
6
7
|
ConnectionsController,
|
|
7
8
|
EventsController,
|
|
8
9
|
ModalController,
|
|
@@ -24,7 +25,7 @@ export function NetworkButton({ disabled, style }: NetworkButtonProps) {
|
|
|
24
25
|
const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
|
|
25
26
|
|
|
26
27
|
const network = isConnected ? activeNetwork : defaultNetwork;
|
|
27
|
-
const networkImage = network
|
|
28
|
+
const networkImage = AssetUtil.getNetworkImage(network, networkImages);
|
|
28
29
|
|
|
29
30
|
const onNetworkPress = () => {
|
|
30
31
|
ModalController.open({ view: 'Networks' });
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { type Transaction, type TransactionImage } from '@reown/appkit-common-react-native';
|
|
14
14
|
import {
|
|
15
15
|
AssetController,
|
|
16
|
+
AssetUtil,
|
|
16
17
|
ConnectionsController,
|
|
17
18
|
ConstantsUtil,
|
|
18
19
|
EventsController,
|
|
@@ -34,7 +35,7 @@ export function AccountActivity({ style }: Props) {
|
|
|
34
35
|
const { loading, transactions, next } = useSnapshot(TransactionsController.state);
|
|
35
36
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
36
37
|
const { networkImages } = useSnapshot(AssetController.state);
|
|
37
|
-
const networkImage = activeNetwork
|
|
38
|
+
const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
|
|
38
39
|
const isSupported =
|
|
39
40
|
activeNetwork?.caipNetworkId &&
|
|
40
41
|
ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(activeNetwork.caipNetworkId);
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { useSnapshot } from 'valtio';
|
|
10
10
|
import {
|
|
11
11
|
AssetController,
|
|
12
|
+
AssetUtil,
|
|
12
13
|
ConnectionsController,
|
|
13
14
|
RouterController
|
|
14
15
|
} from '@reown/appkit-core-react-native';
|
|
@@ -32,7 +33,7 @@ export function AccountTokens({ style, isLoading }: Props) {
|
|
|
32
33
|
const [refreshing, setRefreshing] = useState(false);
|
|
33
34
|
const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
|
|
34
35
|
const { networkImages } = useSnapshot(AssetController.state);
|
|
35
|
-
const networkImage = activeNetwork
|
|
36
|
+
const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
|
|
36
37
|
|
|
37
38
|
const getBalance = useCallback(async () => {
|
|
38
39
|
setRefreshing(true);
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
RouterController,
|
|
6
6
|
ApiController,
|
|
7
7
|
AssetUtil,
|
|
8
|
-
|
|
8
|
+
WcController,
|
|
9
9
|
CoreHelperUtil,
|
|
10
10
|
OptionsController,
|
|
11
11
|
EventsController,
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
} from '@reown/appkit-ui-react-native';
|
|
22
22
|
|
|
23
23
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
24
|
-
import { UiUtil } from '../../utils/UiUtil';
|
|
25
24
|
import { StoreLink } from './components/StoreLink';
|
|
26
25
|
import { ConnectingBody, getMessage, type BodyErrorType } from '../w3m-connecting-body';
|
|
27
26
|
import styles from './styles';
|
|
@@ -35,7 +34,7 @@ interface Props {
|
|
|
35
34
|
export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
|
|
36
35
|
const { data } = RouterController.state;
|
|
37
36
|
const { maxWidth: width } = useCustomDimensions();
|
|
38
|
-
const { wcUri, wcError } = useSnapshot(
|
|
37
|
+
const { wcUri, wcError } = useSnapshot(WcController.state);
|
|
39
38
|
const [errorType, setErrorType] = useState<BodyErrorType>();
|
|
40
39
|
const showCopy =
|
|
41
40
|
OptionsController.isClipboardAvailable() &&
|
|
@@ -52,7 +51,7 @@ export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
|
|
|
52
51
|
|
|
53
52
|
const onRetryPress = () => {
|
|
54
53
|
setErrorType(undefined);
|
|
55
|
-
|
|
54
|
+
WcController.setWcError(false);
|
|
56
55
|
onRetry?.();
|
|
57
56
|
};
|
|
58
57
|
|
|
@@ -68,11 +67,11 @@ export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
|
|
|
68
67
|
if (name && mobile_link && wcUri) {
|
|
69
68
|
const { redirect, href } = CoreHelperUtil.formatNativeUrl(mobile_link, wcUri);
|
|
70
69
|
const wcLinking = { name, href };
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
WcController.setWcLinking(wcLinking);
|
|
71
|
+
WcController.setPressedWallet(data?.wallet);
|
|
73
72
|
await CoreHelperUtil.openLink(redirect);
|
|
74
|
-
await
|
|
75
|
-
|
|
73
|
+
await WcController.state.wcPromise;
|
|
74
|
+
WcController.setConnectedWallet(wcLinking, data?.wallet);
|
|
76
75
|
EventsController.sendEvent({
|
|
77
76
|
type: 'track',
|
|
78
77
|
event: 'CONNECT_SUCCESS',
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
ConnectionController,
|
|
4
|
+
WcController,
|
|
6
5
|
EventsController,
|
|
7
6
|
OptionsController,
|
|
8
7
|
SnackController
|
|
9
8
|
} from '@reown/appkit-core-react-native';
|
|
10
|
-
import { FlexView, Link, QrCode, Text, Spacing } from '@reown/appkit-ui-react-native';
|
|
11
9
|
import { ConstantsUtil } from '@reown/appkit-common-react-native';
|
|
10
|
+
import { FlexView, Link, QrCode, Text, Spacing, Icon } from '@reown/appkit-ui-react-native';
|
|
12
11
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
13
12
|
import styles from './styles';
|
|
13
|
+
import { Linking, Pressable } from 'react-native';
|
|
14
14
|
|
|
15
15
|
export function ConnectingQrCode() {
|
|
16
|
-
const { wcUri } = useSnapshot(
|
|
16
|
+
const { wcUri } = useSnapshot(WcController.state);
|
|
17
17
|
const showCopy = OptionsController.isClipboardAvailable();
|
|
18
18
|
const { maxWidth: windowSize, isPortrait } = useCustomDimensions();
|
|
19
19
|
const qrSize = (windowSize - Spacing.xl * 2) / (isPortrait ? 1 : 1.5);
|
|
20
20
|
|
|
21
21
|
const onCopyAddress = () => {
|
|
22
|
-
if (
|
|
23
|
-
OptionsController.copyToClipboard(
|
|
22
|
+
if (WcController.state.wcUri) {
|
|
23
|
+
OptionsController.copyToClipboard(WcController.state.wcUri);
|
|
24
24
|
SnackController.showSuccess('Link copied');
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const onConnect = async () => {
|
|
29
|
-
await
|
|
29
|
+
await WcController.state.wcPromise;
|
|
30
30
|
|
|
31
31
|
EventsController.sendEvent({
|
|
32
32
|
type: 'track',
|
|
@@ -36,10 +36,6 @@ export function ConnectingQrCode() {
|
|
|
36
36
|
name: 'WalletConnect'
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
//TODO: check this
|
|
41
|
-
const url = AssetUtil.getConnectorImage(ConstantsUtil.WALLET_CONNECT_IMAGE_ID);
|
|
42
|
-
ConnectionController.setConnectedWalletImageUrl(url);
|
|
43
39
|
};
|
|
44
40
|
|
|
45
41
|
useEffect(() => {
|
|
@@ -56,7 +52,7 @@ export function ConnectingQrCode() {
|
|
|
56
52
|
padding={['xl', 'xl', '2xl', 'xl']}
|
|
57
53
|
>
|
|
58
54
|
<QrCode size={qrSize} uri={wcUri} testID="qr-code" />
|
|
59
|
-
<FlexView alignItems="center" margin=
|
|
55
|
+
<FlexView alignItems="center" margin={['m', 'm', '3xl', 'm']}>
|
|
60
56
|
<Text variant="paragraph-500">Scan this QR code with your phone</Text>
|
|
61
57
|
{showCopy && (
|
|
62
58
|
<Link
|
|
@@ -70,6 +66,14 @@ export function ConnectingQrCode() {
|
|
|
70
66
|
</Link>
|
|
71
67
|
)}
|
|
72
68
|
</FlexView>
|
|
69
|
+
<Pressable onPress={() => Linking.openURL(ConstantsUtil.REOWN_URL)}>
|
|
70
|
+
<FlexView alignItems="center" justifyContent="center" flexDirection="row" columnGap="2xs">
|
|
71
|
+
<Text variant="small-500" color="fg-100">
|
|
72
|
+
UX by
|
|
73
|
+
</Text>
|
|
74
|
+
<Icon name="reown" color="fg-150" width={100} height={30} />
|
|
75
|
+
</FlexView>
|
|
76
|
+
</Pressable>
|
|
73
77
|
</FlexView>
|
|
74
78
|
);
|
|
75
79
|
}
|