@reown/appkit-react-native 0.0.0-feat-multichain-20250730193426 → 0.0.0-feat-multichain-20250801190527
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 +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.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 +4 -9
- 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/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 +2 -2
- package/lib/module/connectors/WalletConnectConnector.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 +5 -10
- 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/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 +6 -3
- 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/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/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 +64 -81
- package/src/AppKitContext.tsx +1 -2
- package/src/connectors/WalletConnectConnector.ts +2 -2
- 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 +5 -11
- 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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-select-token-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-select-token-view/index.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,yBAAyB,4CA+DxC"}
|
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-20250801190527",
|
|
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-20250801190527",
|
|
42
|
+
"@reown/appkit-core-react-native": "0.0.0-feat-multichain-20250801190527",
|
|
43
|
+
"@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-20250801190527",
|
|
44
|
+
"@reown/appkit-ui-react-native": "0.0.0-feat-multichain-20250801190527",
|
|
45
45
|
"@walletconnect/universal-provider": "2.21.5",
|
|
46
46
|
"valtio": "2.1.5"
|
|
47
47
|
},
|
package/src/AppKit.ts
CHANGED
|
@@ -9,12 +9,13 @@ import {
|
|
|
9
9
|
StorageUtil,
|
|
10
10
|
type OptionsControllerState,
|
|
11
11
|
ThemeController,
|
|
12
|
-
|
|
12
|
+
WcController,
|
|
13
13
|
SwapController,
|
|
14
14
|
OnRampController,
|
|
15
15
|
CoreHelperUtil,
|
|
16
16
|
SendController,
|
|
17
|
-
BlockchainApiController
|
|
17
|
+
BlockchainApiController,
|
|
18
|
+
type UniversalProviderConfigOverride
|
|
18
19
|
} from '@reown/appkit-core-react-native';
|
|
19
20
|
|
|
20
21
|
import {
|
|
@@ -39,7 +40,8 @@ import {
|
|
|
39
40
|
type AccountType,
|
|
40
41
|
type AppKitOpenOptions,
|
|
41
42
|
ConstantsUtil,
|
|
42
|
-
type Connection
|
|
43
|
+
type Connection,
|
|
44
|
+
type Tokens
|
|
43
45
|
} from '@reown/appkit-common-react-native';
|
|
44
46
|
import { SIWEController } from '@reown/appkit-siwe-react-native';
|
|
45
47
|
|
|
@@ -60,7 +62,7 @@ interface AppKitConfig {
|
|
|
60
62
|
excludeWalletIds?: OptionsControllerState['excludeWalletIds'];
|
|
61
63
|
featuredWalletIds?: OptionsControllerState['featuredWalletIds'];
|
|
62
64
|
customWallets?: OptionsControllerState['customWallets'];
|
|
63
|
-
tokens?:
|
|
65
|
+
tokens?: Tokens;
|
|
64
66
|
enableAnalytics?: OptionsControllerState['enableAnalytics'];
|
|
65
67
|
debug?: OptionsControllerState['debug'];
|
|
66
68
|
themeMode?: ThemeMode;
|
|
@@ -68,7 +70,7 @@ interface AppKitConfig {
|
|
|
68
70
|
siweConfig?: AppKitSIWEClient;
|
|
69
71
|
defaultNetwork?: Network;
|
|
70
72
|
features?: Features;
|
|
71
|
-
|
|
73
|
+
universalProviderConfigOverride?: UniversalProviderConfigOverride;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
export class AppKit {
|
|
@@ -115,7 +117,10 @@ export class AppKit {
|
|
|
115
117
|
});
|
|
116
118
|
|
|
117
119
|
this.networks = networksWithAdapters;
|
|
118
|
-
this.namespaces = WcHelpersUtil.createNamespaces(
|
|
120
|
+
this.namespaces = WcHelpersUtil.createNamespaces(
|
|
121
|
+
this.networks,
|
|
122
|
+
config.universalProviderConfigOverride
|
|
123
|
+
) as ProposalNamespaces;
|
|
119
124
|
this.config = config;
|
|
120
125
|
this.extraConnectors = config.extraConnectors || [];
|
|
121
126
|
|
|
@@ -144,47 +149,59 @@ export class AppKit {
|
|
|
144
149
|
siweConfig: this.config?.siweConfig
|
|
145
150
|
});
|
|
146
151
|
|
|
147
|
-
|
|
148
|
-
const properties = connector.getProperties();
|
|
152
|
+
this.processConnection(connector, approvedNamespaces);
|
|
149
153
|
|
|
150
|
-
|
|
151
|
-
|
|
154
|
+
// Save connector type and namespaces in storage
|
|
155
|
+
if (approvedNamespaces && Object.keys(approvedNamespaces).length > 0) {
|
|
156
|
+
await StorageUtil.setConnectedConnectors({
|
|
157
|
+
type: connector.type,
|
|
158
|
+
namespaces: Object.keys(approvedNamespaces)
|
|
159
|
+
});
|
|
152
160
|
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
console.warn('Connection failed:', error);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
153
166
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
167
|
+
private processConnection(
|
|
168
|
+
connector: WalletConnector,
|
|
169
|
+
namespaces?: Namespaces,
|
|
170
|
+
shouldCloseModal: boolean = true
|
|
171
|
+
) {
|
|
172
|
+
if (!namespaces || Object.keys(namespaces).length === 0) {
|
|
173
|
+
throw new Error('No namespaces provided');
|
|
174
|
+
}
|
|
159
175
|
|
|
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
|
-
}
|
|
176
|
+
const walletInfo = connector.getWalletInfo();
|
|
177
|
+
const properties = connector.getProperties();
|
|
165
178
|
|
|
166
|
-
|
|
167
|
-
this.setConnection(approvedAdapters, approvedNamespaces, walletInfo, properties);
|
|
179
|
+
const initializedAdapters = this.setupAdaptersAndSubscribe(connector, Object.keys(namespaces));
|
|
168
180
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
type: connector.type,
|
|
172
|
-
namespaces: Object.keys(approvedNamespaces)
|
|
173
|
-
});
|
|
181
|
+
if (initializedAdapters.length === 0) {
|
|
182
|
+
console.warn('No compatible adapters found for namespaces:', Object.keys(namespaces));
|
|
174
183
|
|
|
175
|
-
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
176
186
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
// Store the connection details
|
|
188
|
+
this.setConnection(initializedAdapters, namespaces, walletInfo, properties);
|
|
189
|
+
|
|
190
|
+
// Sync accounts
|
|
191
|
+
this.syncAccounts(initializedAdapters);
|
|
192
|
+
|
|
193
|
+
// Handle SIWE if enabled
|
|
194
|
+
this.handleSiweConnectionIfEnabled(shouldCloseModal);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private handleSiweConnectionIfEnabled(shouldCloseModal: boolean = true): void {
|
|
198
|
+
if (
|
|
199
|
+
OptionsController.state.isSiweEnabled &&
|
|
200
|
+
ConnectionsController.state.activeNamespace === 'eip155'
|
|
201
|
+
) {
|
|
202
|
+
this.handleSiweChange({ isConnection: true });
|
|
203
|
+
} else if (shouldCloseModal) {
|
|
204
|
+
ModalController.close();
|
|
188
205
|
}
|
|
189
206
|
}
|
|
190
207
|
|
|
@@ -219,7 +236,7 @@ export class AppKit {
|
|
|
219
236
|
SwapController.resetState();
|
|
220
237
|
SendController.resetState();
|
|
221
238
|
OnRampController.resetState();
|
|
222
|
-
|
|
239
|
+
WcController.resetState();
|
|
223
240
|
|
|
224
241
|
if (ConnectionsController.state.activeNamespace === undefined) {
|
|
225
242
|
ConnectionsController.setActiveNamespace(
|
|
@@ -383,13 +400,12 @@ export class AppKit {
|
|
|
383
400
|
return this.walletConnectConnector;
|
|
384
401
|
}
|
|
385
402
|
|
|
386
|
-
//TODO: reuse logic with connect method
|
|
387
403
|
/**
|
|
388
404
|
* Initializes connectors based on stored connection data.
|
|
389
405
|
* This attempts to restore previous sessions.
|
|
390
406
|
*/
|
|
391
407
|
private async initConnectors() {
|
|
392
|
-
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
408
|
+
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
393
409
|
if (connectedConnectors.length > 0) {
|
|
394
410
|
ModalController.setLoading(true);
|
|
395
411
|
|
|
@@ -398,31 +414,8 @@ export class AppKit {
|
|
|
398
414
|
const connector = await this.createConnector(connected.type);
|
|
399
415
|
|
|
400
416
|
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
|
-
}
|
|
417
|
+
|
|
418
|
+
this.processConnection(connector, namespaces, false);
|
|
426
419
|
} catch (error) {
|
|
427
420
|
// Use console.warn for non-critical initialization failures
|
|
428
421
|
console.warn(`Failed to initialize connector type ${connected.type}:`, error);
|
|
@@ -449,7 +442,7 @@ export class AppKit {
|
|
|
449
442
|
}
|
|
450
443
|
|
|
451
444
|
adapters.forEach(adapter => {
|
|
452
|
-
adapter.
|
|
445
|
+
adapter.init({ connector });
|
|
453
446
|
this.subscribeToAdapterEvents(adapter);
|
|
454
447
|
});
|
|
455
448
|
|
|
@@ -569,9 +562,7 @@ export class AppKit {
|
|
|
569
562
|
private subscribeToAdapterEvents(adapter: BlockchainAdapter): void {
|
|
570
563
|
adapter.on('accountsChanged', ({ accounts }) => {
|
|
571
564
|
const namespace = adapter.getSupportedNamespace();
|
|
572
|
-
|
|
573
|
-
console.log('accountsChanged', accounts, namespace);
|
|
574
|
-
//TODO: check this
|
|
565
|
+
ConnectionsController.updateAccounts(namespace, accounts);
|
|
575
566
|
|
|
576
567
|
if (namespace === 'eip155') {
|
|
577
568
|
this.handleSiweChange({ isAccountChange: true });
|
|
@@ -605,7 +596,6 @@ export class AppKit {
|
|
|
605
596
|
this.disconnect(namespace, false);
|
|
606
597
|
});
|
|
607
598
|
|
|
608
|
-
//TODO: Add types to this events
|
|
609
599
|
adapter.on('balanceChanged', ({ address, balance }) => {
|
|
610
600
|
//eslint-disable-next-line no-console
|
|
611
601
|
console.log('balanceChanged', address, balance);
|
|
@@ -623,7 +613,6 @@ export class AppKit {
|
|
|
623
613
|
this.setExcludedWallets(options);
|
|
624
614
|
this.setCustomWallets(options);
|
|
625
615
|
OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
|
|
626
|
-
OptionsController.setTokens(options.tokens);
|
|
627
616
|
OptionsController.setEnableAnalytics(options.enableAnalytics);
|
|
628
617
|
OptionsController.setDebug(options.debug);
|
|
629
618
|
OptionsController.setFeatures(options.features);
|
|
@@ -671,8 +660,6 @@ export class AppKit {
|
|
|
671
660
|
|
|
672
661
|
private async initRecentWallets(options: AppKitConfig) {
|
|
673
662
|
const wallets = await StorageUtil.getRecentWallets();
|
|
674
|
-
const connectedWalletImage = await StorageUtil.getConnectedWalletImageUrl();
|
|
675
|
-
|
|
676
663
|
const filteredWallets = wallets.filter(wallet => {
|
|
677
664
|
const { includeWalletIds, excludeWalletIds } = options;
|
|
678
665
|
if (includeWalletIds) {
|
|
@@ -685,11 +672,7 @@ export class AppKit {
|
|
|
685
672
|
return true;
|
|
686
673
|
});
|
|
687
674
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (connectedWalletImage) {
|
|
691
|
-
ConnectionController.setConnectedWalletImageUrl(connectedWalletImage);
|
|
692
|
-
}
|
|
675
|
+
WcController.setRecentWallets(filteredWallets);
|
|
693
676
|
}
|
|
694
677
|
|
|
695
678
|
private setExcludedWallets(options: AppKitConfig) {
|
|
@@ -699,7 +682,7 @@ export class AppKit {
|
|
|
699
682
|
const excludeCoinbase = !this.extraConnectors.some(connector => connector.type === 'coinbase');
|
|
700
683
|
|
|
701
684
|
if (excludeCoinbase) {
|
|
702
|
-
excludedWallets.push(ConstantsUtil.
|
|
685
|
+
excludedWallets.push(ConstantsUtil.COINBASE_CUSTOM_WALLET.id);
|
|
703
686
|
}
|
|
704
687
|
|
|
705
688
|
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,
|
|
@@ -95,7 +95,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
95
95
|
override async connect(opts: ConnectOptions) {
|
|
96
96
|
const { siweConfig, namespaces, defaultChain, universalLink } = opts;
|
|
97
97
|
function onUri(uri: string) {
|
|
98
|
-
|
|
98
|
+
WcController.setWcUri(uri);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const provider = this.getProvider() as IUniversalProvider;
|
|
@@ -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,30 @@
|
|
|
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
9
|
import { FlexView, Link, QrCode, Text, Spacing } from '@reown/appkit-ui-react-native';
|
|
11
|
-
import { ConstantsUtil } from '@reown/appkit-common-react-native';
|
|
12
10
|
import { useCustomDimensions } from '../../hooks/useCustomDimensions';
|
|
13
11
|
import styles from './styles';
|
|
14
12
|
|
|
15
13
|
export function ConnectingQrCode() {
|
|
16
|
-
const { wcUri } = useSnapshot(
|
|
14
|
+
const { wcUri } = useSnapshot(WcController.state);
|
|
17
15
|
const showCopy = OptionsController.isClipboardAvailable();
|
|
18
16
|
const { maxWidth: windowSize, isPortrait } = useCustomDimensions();
|
|
19
17
|
const qrSize = (windowSize - Spacing.xl * 2) / (isPortrait ? 1 : 1.5);
|
|
20
18
|
|
|
21
19
|
const onCopyAddress = () => {
|
|
22
|
-
if (
|
|
23
|
-
OptionsController.copyToClipboard(
|
|
20
|
+
if (WcController.state.wcUri) {
|
|
21
|
+
OptionsController.copyToClipboard(WcController.state.wcUri);
|
|
24
22
|
SnackController.showSuccess('Link copied');
|
|
25
23
|
}
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
const onConnect = async () => {
|
|
29
|
-
await
|
|
27
|
+
await WcController.state.wcPromise;
|
|
30
28
|
|
|
31
29
|
EventsController.sendEvent({
|
|
32
30
|
type: 'track',
|
|
@@ -36,10 +34,6 @@ export function ConnectingQrCode() {
|
|
|
36
34
|
name: 'WalletConnect'
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
|
-
|
|
40
|
-
//TODO: check this
|
|
41
|
-
const url = AssetUtil.getConnectorImage(ConstantsUtil.WALLET_CONNECT_IMAGE_ID);
|
|
42
|
-
ConnectionController.setConnectedWalletImageUrl(url);
|
|
43
37
|
};
|
|
44
38
|
|
|
45
39
|
useEffect(() => {
|
|
@@ -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
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
IconBox
|
|
20
20
|
} from '@reown/appkit-ui-react-native';
|
|
21
21
|
|
|
22
|
-
import { UiUtil } from '../../utils/UiUtil';
|
|
23
22
|
import { ConnectingBody, getMessage } from '../w3m-connecting-body';
|
|
24
23
|
import styles from './styles';
|
|
25
24
|
|
|
@@ -29,7 +28,7 @@ interface ConnectingWebProps {
|
|
|
29
28
|
|
|
30
29
|
export function ConnectingWeb({ onCopyUri }: ConnectingWebProps) {
|
|
31
30
|
const { data } = RouterController.state;
|
|
32
|
-
const { wcUri, wcError } = useSnapshot(
|
|
31
|
+
const { wcUri, wcError } = useSnapshot(WcController.state);
|
|
33
32
|
const showCopy = OptionsController.isClipboardAvailable();
|
|
34
33
|
const bodyMessage = getMessage({
|
|
35
34
|
walletName: data?.wallet?.name,
|
|
@@ -41,15 +40,14 @@ export function ConnectingWeb({ onCopyUri }: ConnectingWebProps) {
|
|
|
41
40
|
try {
|
|
42
41
|
const { name, webapp_link } = data?.wallet ?? {};
|
|
43
42
|
if (name && webapp_link && wcUri) {
|
|
44
|
-
|
|
43
|
+
WcController.setWcError(false);
|
|
45
44
|
const { redirect, href } = CoreHelperUtil.formatUniversalUrl(webapp_link, wcUri);
|
|
46
45
|
const wcLinking = { name, href };
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
WcController.setWcLinking(wcLinking);
|
|
47
|
+
WcController.setPressedWallet(data?.wallet);
|
|
49
48
|
await Linking.openURL(redirect);
|
|
50
|
-
await
|
|
51
|
-
|
|
52
|
-
UiUtil.storeConnectedWallet(wcLinking, data?.wallet);
|
|
49
|
+
await WcController.state.wcPromise;
|
|
50
|
+
WcController.setConnectedWallet(wcLinking, data?.wallet);
|
|
53
51
|
|
|
54
52
|
EventsController.sendEvent({
|
|
55
53
|
type: 'track',
|
|
@@ -8,10 +8,10 @@ import { IconLink, Text, FlexView } from '@reown/appkit-ui-react-native';
|
|
|
8
8
|
import { StringUtil } from '@reown/appkit-common-react-native';
|
|
9
9
|
|
|
10
10
|
import styles from './styles';
|
|
11
|
-
import {
|
|
11
|
+
import { useInternalAppKit } from '../../AppKitContext';
|
|
12
12
|
|
|
13
13
|
export function Header() {
|
|
14
|
-
const { close, back } =
|
|
14
|
+
const { close, back } = useInternalAppKit();
|
|
15
15
|
const { data, view } = useSnapshot(RouterController.state);
|
|
16
16
|
const onHelpPress = () => {
|
|
17
17
|
RouterController.push('WhatIsAWallet');
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useTheme
|
|
13
13
|
} from '@reown/appkit-ui-react-native';
|
|
14
14
|
import styles from './styles';
|
|
15
|
-
import { AssetController, ConnectionsController } from '@reown/appkit-core-react-native';
|
|
15
|
+
import { AssetController, AssetUtil, ConnectionsController } from '@reown/appkit-core-react-native';
|
|
16
16
|
|
|
17
17
|
interface SelectorModalProps {
|
|
18
18
|
title?: string;
|
|
@@ -46,7 +46,7 @@ export function SelectorModal({
|
|
|
46
46
|
const Theme = useTheme();
|
|
47
47
|
const { activeNetwork } = useSnapshot(ConnectionsController.state);
|
|
48
48
|
const { networkImages } = useSnapshot(AssetController.state);
|
|
49
|
-
const networkImage = activeNetwork
|
|
49
|
+
const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
|
|
50
50
|
|
|
51
51
|
const renderSeparator = () => {
|
|
52
52
|
return <View style={{ height: SEPARATOR_HEIGHT }} />;
|
package/src/utils/HelpersUtil.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
solana,
|
|
7
7
|
solanaDevnet
|
|
8
8
|
} from '@reown/appkit-common-react-native';
|
|
9
|
+
import type { UniversalProviderConfigOverride } from '@reown/appkit-core-react-native';
|
|
9
10
|
|
|
10
11
|
export const DEFAULT_METHODS = {
|
|
11
12
|
solana: [
|
|
@@ -64,7 +65,7 @@ export const WcHelpersUtil = {
|
|
|
64
65
|
|
|
65
66
|
applyNamespaceOverrides(
|
|
66
67
|
baseNamespaces: NamespaceConfig,
|
|
67
|
-
overrides?:
|
|
68
|
+
overrides?: UniversalProviderConfigOverride
|
|
68
69
|
): NamespaceConfig {
|
|
69
70
|
if (!overrides) {
|
|
70
71
|
return { ...baseNamespaces };
|
|
@@ -160,7 +161,7 @@ export const WcHelpersUtil = {
|
|
|
160
161
|
|
|
161
162
|
createNamespaces(
|
|
162
163
|
caipNetworks: AppKitNetwork[],
|
|
163
|
-
configOverride?:
|
|
164
|
+
configOverride?: UniversalProviderConfigOverride
|
|
164
165
|
): NamespaceConfig {
|
|
165
166
|
const defaultNamespaces = caipNetworks.reduce<NamespaceConfig>((acc, chain) => {
|
|
166
167
|
const { id, rpcUrls } = chain;
|
package/src/utils/UiUtil.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AssetUtil,
|
|
3
|
-
ConnectionController,
|
|
4
|
-
RouterController,
|
|
5
|
-
StorageUtil,
|
|
6
|
-
type WcWallet
|
|
7
|
-
} from '@reown/appkit-core-react-native';
|
|
8
|
-
import type { WalletDeepLink } from '@reown/appkit-common-react-native';
|
|
1
|
+
import { RouterController } from '@reown/appkit-core-react-native';
|
|
9
2
|
|
|
10
3
|
// Global animation instance to coordinate transitions
|
|
11
4
|
let currentRouteTransition: ((direction: 'forward' | 'backward' | 'none') => Promise<void>) | null =
|
|
@@ -25,22 +18,5 @@ export const UiUtil = {
|
|
|
25
18
|
const { navigationDirection } = RouterController.state;
|
|
26
19
|
await currentRouteTransition(navigationDirection);
|
|
27
20
|
}
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
storeConnectedWallet: async (wcLinking: WalletDeepLink, pressedWallet?: WcWallet) => {
|
|
31
|
-
StorageUtil.setWalletConnectDeepLink(wcLinking);
|
|
32
|
-
|
|
33
|
-
if (pressedWallet) {
|
|
34
|
-
UiUtil.storeRecentWallet(pressedWallet);
|
|
35
|
-
const url = AssetUtil.getWalletImage(pressedWallet);
|
|
36
|
-
ConnectionController.setConnectedWalletImageUrl(url);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
storeRecentWallet: async (wallet: WcWallet) => {
|
|
41
|
-
const recentWallets = await StorageUtil.addRecentWallet(wallet);
|
|
42
|
-
if (recentWallets) {
|
|
43
|
-
ConnectionController.setRecentWallets(recentWallets);
|
|
44
|
-
}
|
|
45
21
|
}
|
|
46
22
|
};
|