@reown/appkit-react-native 0.0.0-chore-spring-effect-20250909214820 → 0.0.0-chore-added-import-20251002170458
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 +133 -88
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/AppKitContext.js +16 -10
- package/lib/commonjs/AppKitContext.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +24 -57
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/hooks/useAccount.js +4 -3
- package/lib/commonjs/hooks/useAccount.js.map +1 -1
- package/lib/commonjs/hooks/useAppKit.js +12 -12
- package/lib/commonjs/hooks/useAppKit.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitLogs.js +88 -0
- package/lib/commonjs/hooks/useAppKitLogs.js.map +1 -0
- package/lib/commonjs/hooks/useAppKitState.js +32 -0
- package/lib/commonjs/hooks/useAppKitState.js.map +1 -0
- package/lib/commonjs/hooks/useProvider.js +14 -8
- package/lib/commonjs/hooks/useProvider.js.map +1 -1
- package/lib/commonjs/hooks/useWalletInfo.js +6 -4
- package/lib/commonjs/hooks/useWalletInfo.js.map +1 -1
- package/lib/commonjs/index.js +22 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js +9 -1
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +19 -21
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js +6 -3
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js +9 -2
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js +1 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js +3 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-mobile/index.js +21 -1
- package/lib/commonjs/partials/w3m-connecting-mobile/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js +5 -1
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-web/index.js +8 -2
- package/lib/commonjs/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +4 -4
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/utils/SIWXUtil.js +278 -0
- package/lib/commonjs/utils/SIWXUtil.js.map +1 -0
- package/lib/commonjs/views/w3m-account-default-view/index.js +3 -2
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-all-wallets-view/index.js +7 -4
- 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 +5 -3
- package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js +6 -3
- package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js +21 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-social-view/index.js +1 -0
- package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js +12 -31
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-network-switch-view/index.js +1 -0
- package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js +3 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js +2 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/LoadingView.js +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/LoadingView.js.map +1 -1
- package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +7 -43
- package/lib/commonjs/views/w3m-siwx-sign-view/index.js.map +1 -0
- package/lib/commonjs/views/w3m-siwx-sign-view/styles.js.map +1 -0
- package/lib/commonjs/views/w3m-swap-view/index.js +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js +1 -1
- package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
- package/lib/module/AppKit.js +133 -88
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/AppKitContext.js +17 -11
- package/lib/module/AppKitContext.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +22 -56
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/hooks/useAccount.js +3 -3
- package/lib/module/hooks/useAccount.js.map +1 -1
- package/lib/module/hooks/useAppKit.js +13 -13
- package/lib/module/hooks/useAppKit.js.map +1 -1
- package/lib/module/hooks/useAppKitLogs.js +83 -0
- package/lib/module/hooks/useAppKitLogs.js.map +1 -0
- package/lib/module/hooks/useAppKitState.js +27 -0
- package/lib/module/hooks/useAppKitState.js.map +1 -0
- package/lib/module/hooks/useProvider.js +13 -8
- package/lib/module/hooks/useProvider.js.map +1 -1
- package/lib/module/hooks/useWalletInfo.js +6 -4
- package/lib/module/hooks/useWalletInfo.js.map +1 -1
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/index.js +9 -1
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +20 -22
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js +6 -3
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js +9 -2
- package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/index.js +2 -1
- package/lib/module/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-search/index.js +4 -2
- package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-mobile/index.js +22 -2
- package/lib/module/partials/w3m-connecting-mobile/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-qrcode/index.js +6 -2
- package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-web/index.js +9 -3
- package/lib/module/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +4 -4
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/utils/SIWXUtil.js +275 -0
- package/lib/module/utils/SIWXUtil.js.map +1 -0
- package/lib/module/views/w3m-account-default-view/index.js +4 -3
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-all-wallets-view/index.js +7 -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 +5 -3
- package/lib/module/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
- package/lib/module/views/w3m-connect-view/index.js +6 -3
- package/lib/module/views/w3m-connect-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-external-view/index.js +22 -2
- package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-social-view/index.js +2 -1
- package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +14 -33
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/views/w3m-network-switch-view/index.js +2 -1
- package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/components/Country.js +3 -1
- package/lib/module/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/index.js +2 -1
- package/lib/module/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/LoadingView.js +1 -1
- package/lib/module/views/w3m-onramp-view/components/LoadingView.js.map +1 -1
- package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +7 -43
- package/lib/module/views/w3m-siwx-sign-view/index.js.map +1 -0
- package/lib/module/views/w3m-siwx-sign-view/styles.js.map +1 -0
- package/lib/module/views/w3m-swap-view/index.js +1 -1
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-what-is-a-wallet-view/index.js +1 -1
- package/lib/module/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +12 -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/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useAccount.d.ts +1 -1
- package/lib/typescript/hooks/useAccount.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKit.d.ts +2 -2
- package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts +75 -21
- package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitLogs.d.ts +57 -0
- package/lib/typescript/hooks/useAppKitLogs.d.ts.map +1 -0
- package/lib/typescript/hooks/useAppKitState.d.ts +38 -0
- package/lib/typescript/hooks/useAppKitState.d.ts.map +1 -0
- package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
- package/lib/typescript/hooks/useWalletInfo.d.ts +1 -0
- package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +4 -2
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts +3 -2
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts +1 -1
- package/lib/typescript/partials/w3m-all-wallets-search/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 +6 -7
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/SIWXUtil.d.ts +34 -0
- package/lib/typescript/utils/SIWXUtil.d.ts.map +1 -0
- package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-all-wallets-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts +1 -1
- package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-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-social-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-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-onramp-settings-view/components/Country.d.ts +2 -1
- package/lib/typescript/views/w3m-onramp-settings-view/components/Country.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-settings-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts +2 -0
- package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts.map +1 -0
- package/lib/typescript/views/w3m-siwx-sign-view/styles.d.ts.map +1 -0
- package/package.json +9 -9
- package/src/AppKit.ts +145 -96
- package/src/AppKitContext.tsx +19 -11
- package/src/connectors/WalletConnectConnector.ts +33 -69
- package/src/hooks/useAccount.ts +9 -4
- package/src/hooks/useAppKit.ts +19 -13
- package/src/hooks/useAppKitLogs.ts +129 -0
- package/src/hooks/useAppKitState.ts +26 -0
- package/src/hooks/useProvider.ts +11 -5
- package/src/hooks/useWalletInfo.ts +5 -2
- package/src/index.ts +14 -0
- package/src/modal/w3m-modal/index.tsx +9 -1
- package/src/modal/w3m-router/index.tsx +15 -18
- package/src/partials/w3m-account-wallet-features/index.tsx +1 -1
- package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +13 -3
- package/src/partials/w3m-all-wallets-list/components/WalletList.tsx +9 -2
- package/src/partials/w3m-all-wallets-list/index.tsx +3 -1
- package/src/partials/w3m-all-wallets-search/index.tsx +9 -3
- package/src/partials/w3m-connecting-mobile/index.tsx +24 -2
- package/src/partials/w3m-connecting-qrcode/index.tsx +8 -2
- package/src/partials/w3m-connecting-web/index.tsx +11 -3
- package/src/partials/w3m-header/index.tsx +4 -4
- package/src/types.ts +7 -8
- package/src/utils/SIWXUtil.ts +359 -0
- package/src/views/w3m-account-default-view/index.tsx +5 -3
- package/src/views/w3m-all-wallets-view/index.tsx +11 -4
- package/src/views/w3m-connect-view/components/all-wallet-list.tsx +6 -4
- package/src/views/w3m-connect-view/index.tsx +6 -3
- package/src/views/w3m-connecting-external-view/index.tsx +24 -2
- package/src/views/w3m-connecting-social-view/index.tsx +3 -1
- package/src/views/w3m-connecting-view/index.tsx +16 -33
- package/src/views/w3m-network-switch-view/index.tsx +2 -0
- package/src/views/w3m-onramp-settings-view/components/Country.tsx +3 -1
- package/src/views/w3m-onramp-settings-view/index.tsx +1 -0
- package/src/views/w3m-onramp-view/components/LoadingView.tsx +1 -1
- package/src/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.tsx +7 -37
- package/src/views/w3m-swap-view/index.tsx +1 -1
- package/src/views/w3m-what-is-a-wallet-view/index.tsx +1 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +0 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/styles.js.map +0 -1
- package/lib/module/views/w3m-connecting-siwe-view/index.js.map +0 -1
- package/lib/module/views/w3m-connecting-siwe-view/styles.js.map +0 -1
- package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +0 -1
- package/lib/typescript/views/w3m-connecting-siwe-view/styles.d.ts.map +0 -1
- /package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
- /package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
- /package/lib/typescript/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.d.ts +0 -0
- /package/src/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.ts +0 -0
|
@@ -2,7 +2,7 @@ import { type StyleProp, type ViewStyle } from 'react-native';
|
|
|
2
2
|
import { type WcWallet } from '@reown/appkit-common-react-native';
|
|
3
3
|
interface Props {
|
|
4
4
|
itemStyle: StyleProp<ViewStyle>;
|
|
5
|
-
onWalletPress: (wallet: WcWallet) => void;
|
|
5
|
+
onWalletPress: (wallet: WcWallet, displayIndex: number, isInstalled?: boolean) => void;
|
|
6
6
|
}
|
|
7
7
|
export declare function AllWalletList({ itemStyle, onWalletPress }: Props): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[] | null;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-wallet-list.d.ts","sourceRoot":"","sources":["../../../../../src/views/w3m-connect-view/components/all-wallet-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAIlE,UAAU,KAAK;IACb,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"all-wallet-list.d.ts","sourceRoot":"","sources":["../../../../../src/views/w3m-connect-view/components/all-wallet-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAIlE,UAAU,KAAK;IACb,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACxF;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,KAAK,8FAkDhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connect-view/index.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connect-view/index.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,4CAgF1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-external-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-external-view/index.tsx"],"names":[],"mappings":"AA6BA,wBAAgB,sBAAsB,4CAiIrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-social-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-social-view/index.tsx"],"names":[],"mappings":"AAwBA,wBAAgB,oBAAoB,4CAgFnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,cAAc,4CAuG7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-network-switch-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-network-switch-view/index.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,iBAAiB,4CAmFhC"}
|
|
@@ -5,8 +5,9 @@ interface Props {
|
|
|
5
5
|
item: OnRampCountry;
|
|
6
6
|
selected: boolean;
|
|
7
7
|
style?: StyleProp<ViewStyle>;
|
|
8
|
+
testID?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare const ITEM_HEIGHT = 60;
|
|
10
|
-
export declare function Country({ onPress, item, selected, style }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Country({ onPress, item, selected, style, testID }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
12
13
|
//# sourceMappingURL=Country.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Country.d.ts","sourceRoot":"","sources":["../../../../../src/views/w3m-onramp-settings-view/components/Country.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AASvE,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG1E,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACvC,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Country.d.ts","sourceRoot":"","sources":["../../../../../src/views/w3m-onramp-settings-view/components/Country.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AASvE,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAG1E,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACvC,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,2CAgCxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-onramp-settings-view/index.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-onramp-settings-view/index.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,kBAAkB,4CA+HjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-siwx-sign-view/index.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,mBAAmB,4CA0ElC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-siwx-sign-view/styles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,wBAkBG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0.0-chore-
|
|
3
|
+
"version": "0.0.0-chore-added-import-20251002170458",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -29,21 +29,21 @@
|
|
|
29
29
|
"repository": "https://github.com/reown-com/appkit-react-native",
|
|
30
30
|
"author": "Reown (https://discord.gg/reown)",
|
|
31
31
|
"homepage": "https://reown.com/appkit",
|
|
32
|
-
"license": "
|
|
32
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
33
33
|
"bugs": {
|
|
34
34
|
"url": "https://github.com/reown-com/appkit-react-native/issues"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"registry": "https://registry.npmjs.org/",
|
|
38
|
-
"access": "public"
|
|
38
|
+
"access": "public",
|
|
39
|
+
"provenance": true
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"@reown/appkit-common-react-native": "0.0.0-chore-
|
|
42
|
-
"@reown/appkit-core-react-native": "0.0.0-chore-
|
|
43
|
-
"@reown/appkit-
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"valtio": "2.1.5"
|
|
42
|
+
"@reown/appkit-common-react-native": "0.0.0-chore-added-import-20251002170458",
|
|
43
|
+
"@reown/appkit-core-react-native": "0.0.0-chore-added-import-20251002170458",
|
|
44
|
+
"@reown/appkit-ui-react-native": "0.0.0-chore-added-import-20251002170458",
|
|
45
|
+
"@walletconnect/universal-provider": "2.21.10",
|
|
46
|
+
"valtio": "2.1.8"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@walletconnect/react-native-compat": ">=2.16.1",
|
package/src/AppKit.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
SendController,
|
|
16
16
|
BlockchainApiController,
|
|
17
17
|
WalletUtil,
|
|
18
|
+
LogController,
|
|
18
19
|
type RouterControllerState
|
|
19
20
|
} from '@reown/appkit-core-react-native';
|
|
20
21
|
|
|
@@ -37,13 +38,20 @@ import {
|
|
|
37
38
|
type Connection,
|
|
38
39
|
type WcWallet
|
|
39
40
|
} from '@reown/appkit-common-react-native';
|
|
40
|
-
import { SIWEController } from '@reown/appkit-siwe-react-native';
|
|
41
41
|
|
|
42
42
|
import { WalletConnectConnector } from './connectors/WalletConnectConnector';
|
|
43
43
|
import { WcHelpersUtil } from './utils/HelpersUtil';
|
|
44
44
|
import { NetworkUtil } from './utils/NetworkUtil';
|
|
45
45
|
import { RouterUtil } from './utils/RouterUtil';
|
|
46
46
|
import { type AppKitConfig } from './types';
|
|
47
|
+
import { SIWXUtil } from './utils/SIWXUtil';
|
|
48
|
+
|
|
49
|
+
const APPKIT_INSTANCE_KEY = Symbol.for('__REOWN_APPKIT_INSTANCE__');
|
|
50
|
+
|
|
51
|
+
// Type helper to access the symbol-keyed property on globalThis
|
|
52
|
+
interface GlobalWithAppKit {
|
|
53
|
+
[key: symbol]: AppKit | undefined;
|
|
54
|
+
}
|
|
47
55
|
|
|
48
56
|
export class AppKit {
|
|
49
57
|
private projectId: string;
|
|
@@ -131,8 +139,7 @@ export class AppKit {
|
|
|
131
139
|
const approvedNamespaces = await connector.connect({
|
|
132
140
|
namespaces: this.namespaces,
|
|
133
141
|
defaultNetwork: chain,
|
|
134
|
-
universalLink: targetWallet?.link_mode ?? undefined
|
|
135
|
-
siweConfig: this.config?.siweConfig
|
|
142
|
+
universalLink: targetWallet?.link_mode ?? undefined
|
|
136
143
|
});
|
|
137
144
|
|
|
138
145
|
this.processConnection(connector, approvedNamespaces);
|
|
@@ -145,16 +152,12 @@ export class AppKit {
|
|
|
145
152
|
});
|
|
146
153
|
}
|
|
147
154
|
} catch (error) {
|
|
148
|
-
|
|
155
|
+
LogController.sendError(error, 'AppKit.ts', 'connect');
|
|
149
156
|
throw error;
|
|
150
157
|
}
|
|
151
158
|
}
|
|
152
159
|
|
|
153
|
-
private async processConnection(
|
|
154
|
-
connector: WalletConnector,
|
|
155
|
-
namespaces?: Namespaces,
|
|
156
|
-
shouldCloseModal: boolean = true
|
|
157
|
-
) {
|
|
160
|
+
private async processConnection(connector: WalletConnector, namespaces?: Namespaces) {
|
|
158
161
|
if (!namespaces || Object.keys(namespaces).length === 0) {
|
|
159
162
|
throw new Error('No namespaces provided');
|
|
160
163
|
}
|
|
@@ -176,19 +179,7 @@ export class AppKit {
|
|
|
176
179
|
// Sync accounts
|
|
177
180
|
await this.syncAccounts(initializedAdapters);
|
|
178
181
|
|
|
179
|
-
|
|
180
|
-
this.handleSiweConnectionIfEnabled(shouldCloseModal);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
private handleSiweConnectionIfEnabled(shouldCloseModal: boolean = true): void {
|
|
184
|
-
if (
|
|
185
|
-
OptionsController.state.isSiweEnabled &&
|
|
186
|
-
ConnectionsController.state.activeNamespace === 'eip155'
|
|
187
|
-
) {
|
|
188
|
-
this.handleSiweChange({ isConnection: true });
|
|
189
|
-
} else if (shouldCloseModal) {
|
|
190
|
-
ModalController.close();
|
|
191
|
-
}
|
|
182
|
+
await SIWXUtil.initializeIfEnabled({ onDisconnect: this.disconnect, closeModal: true });
|
|
192
183
|
}
|
|
193
184
|
|
|
194
185
|
/**
|
|
@@ -196,7 +187,7 @@ export class AppKit {
|
|
|
196
187
|
* @param namespace - The namespace to disconnect from.
|
|
197
188
|
* @param isInternal - Whether the disconnect is internal (i.e. from the AppKit) or external (i.e. from wallet side).
|
|
198
189
|
*/
|
|
199
|
-
async disconnect(namespace?:
|
|
190
|
+
async disconnect(namespace?: ChainNamespace, isInternal?: boolean): Promise<void> {
|
|
200
191
|
try {
|
|
201
192
|
const activeNamespace = namespace ?? ConnectionsController.state.activeNamespace;
|
|
202
193
|
|
|
@@ -230,15 +221,19 @@ export class AppKit {
|
|
|
230
221
|
);
|
|
231
222
|
}
|
|
232
223
|
|
|
233
|
-
if (
|
|
234
|
-
await
|
|
224
|
+
if (SIWXUtil.getSIWX()?.signOutOnDisconnect) {
|
|
225
|
+
await SIWXUtil.clearSessions();
|
|
235
226
|
}
|
|
236
227
|
|
|
237
228
|
EventsController.sendEvent({
|
|
238
229
|
type: 'track',
|
|
239
|
-
event: 'DISCONNECT_SUCCESS'
|
|
230
|
+
event: 'DISCONNECT_SUCCESS',
|
|
231
|
+
properties: {
|
|
232
|
+
namespace: activeNamespace
|
|
233
|
+
}
|
|
240
234
|
});
|
|
241
235
|
} catch (error) {
|
|
236
|
+
LogController.sendError(error, 'AppKit.ts', 'disconnect');
|
|
242
237
|
EventsController.sendEvent({
|
|
243
238
|
type: 'track',
|
|
244
239
|
event: 'DISCONNECT_ERROR'
|
|
@@ -285,7 +280,7 @@ export class AppKit {
|
|
|
285
280
|
type: 'track',
|
|
286
281
|
event: 'SWITCH_NETWORK',
|
|
287
282
|
properties: {
|
|
288
|
-
network: network.
|
|
283
|
+
network: network.caipNetworkId
|
|
289
284
|
}
|
|
290
285
|
});
|
|
291
286
|
|
|
@@ -298,15 +293,11 @@ export class AppKit {
|
|
|
298
293
|
|
|
299
294
|
async close() {
|
|
300
295
|
ModalController.close();
|
|
296
|
+
const isSIWXRequired = SIWXUtil.getSIWX()?.getRequired?.();
|
|
301
297
|
|
|
302
|
-
if (
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
!session &&
|
|
306
|
-
SIWEController.state.status !== 'success' &&
|
|
307
|
-
ConnectionsController.state.activeNamespace === 'eip155' &&
|
|
308
|
-
!!ConnectionsController.state.activeAddress
|
|
309
|
-
) {
|
|
298
|
+
if (isSIWXRequired && ConnectionsController.state.isConnected) {
|
|
299
|
+
const sessions = await SIWXUtil.getSessions();
|
|
300
|
+
if (!sessions.length) {
|
|
310
301
|
return await this.disconnect();
|
|
311
302
|
}
|
|
312
303
|
}
|
|
@@ -326,6 +317,13 @@ export class AppKit {
|
|
|
326
317
|
return RouterController.goBack();
|
|
327
318
|
}
|
|
328
319
|
|
|
320
|
+
const isSIWXRequired = SIWXUtil.getSIWX()?.getRequired?.();
|
|
321
|
+
|
|
322
|
+
if (isSIWXRequired) {
|
|
323
|
+
// Don't close the modal if SIWX is required
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
329
327
|
return this.close();
|
|
330
328
|
}
|
|
331
329
|
|
|
@@ -396,25 +394,44 @@ export class AppKit {
|
|
|
396
394
|
* This attempts to restore previous sessions.
|
|
397
395
|
*/
|
|
398
396
|
private async initConnectors() {
|
|
397
|
+
ModalController.setLoading(true);
|
|
398
|
+
|
|
399
|
+
//Always init the walletconnect connector
|
|
400
|
+
await this.createWalletConnectConnector();
|
|
401
|
+
|
|
399
402
|
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
400
403
|
if (connectedConnectors.length > 0) {
|
|
401
|
-
ModalController.setLoading(true);
|
|
402
|
-
|
|
403
404
|
for (const connected of connectedConnectors) {
|
|
404
405
|
try {
|
|
405
406
|
const connector = await this.createConnector(connected.type);
|
|
406
407
|
|
|
407
408
|
const namespaces = connector.getNamespaces();
|
|
408
409
|
|
|
409
|
-
await this.processConnection(connector, namespaces
|
|
410
|
+
await this.processConnection(connector, namespaces);
|
|
410
411
|
} catch (error) {
|
|
411
|
-
|
|
412
|
-
|
|
412
|
+
LogController.sendError(error, 'AppKit.ts', 'initializeConnector', {
|
|
413
|
+
connectorType: connected.type
|
|
414
|
+
});
|
|
413
415
|
await StorageUtil.removeConnectedConnectors(connected.type);
|
|
414
416
|
}
|
|
415
417
|
}
|
|
416
|
-
|
|
418
|
+
|
|
419
|
+
const address = ConnectionsController.state.activeAddress;
|
|
420
|
+
const walletInfo = ConnectionsController.state.walletInfo;
|
|
421
|
+
if (address) {
|
|
422
|
+
EventsController.sendEvent({
|
|
423
|
+
type: 'track',
|
|
424
|
+
event: 'CONNECT_SUCCESS',
|
|
425
|
+
address: CoreHelperUtil.getPlainAddress(address),
|
|
426
|
+
properties: {
|
|
427
|
+
name: walletInfo?.name ?? 'Unknown',
|
|
428
|
+
reconnect: true
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
}
|
|
417
432
|
}
|
|
433
|
+
|
|
434
|
+
ModalController.setLoading(false);
|
|
418
435
|
}
|
|
419
436
|
|
|
420
437
|
private setupAdaptersAndSubscribe(
|
|
@@ -506,6 +523,7 @@ export class AppKit {
|
|
|
506
523
|
);
|
|
507
524
|
}
|
|
508
525
|
} catch (error) {
|
|
526
|
+
LogController.sendError(error, 'AppKit.ts', 'syncIdentity');
|
|
509
527
|
// Continue processing other addresses even if one fails
|
|
510
528
|
}
|
|
511
529
|
}
|
|
@@ -524,8 +542,9 @@ export class AppKit {
|
|
|
524
542
|
this.syncNativeBalance(adapter, network);
|
|
525
543
|
}
|
|
526
544
|
}
|
|
527
|
-
} catch {
|
|
545
|
+
} catch (error) {
|
|
528
546
|
// ignore
|
|
547
|
+
LogController.sendError(error, 'AppKit.ts', 'refreshBalance');
|
|
529
548
|
}
|
|
530
549
|
}
|
|
531
550
|
|
|
@@ -603,11 +622,7 @@ export class AppKit {
|
|
|
603
622
|
private subscribeToAdapterEvents(adapter: BlockchainAdapter): void {
|
|
604
623
|
adapter.on('accountsChanged', ({ accounts }) => {
|
|
605
624
|
const namespace = adapter.getSupportedNamespace();
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
if (hasChanged && namespace === 'eip155') {
|
|
609
|
-
this.handleSiweChange({ isAccountChange: true });
|
|
610
|
-
}
|
|
625
|
+
ConnectionsController.updateAccounts(namespace, accounts);
|
|
611
626
|
});
|
|
612
627
|
|
|
613
628
|
adapter.on('chainChanged', async ({ chainId }) => {
|
|
@@ -618,6 +633,13 @@ export class AppKit {
|
|
|
618
633
|
|
|
619
634
|
const namespace = adapter.getSupportedNamespace();
|
|
620
635
|
const chain = `${namespace}:${chainId}` as CaipNetworkId;
|
|
636
|
+
|
|
637
|
+
const activeNetwork = ConnectionsController.getActiveNetworkId(namespace);
|
|
638
|
+
if (activeNetwork === chain) {
|
|
639
|
+
// No need to update the active network
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
|
|
621
643
|
ConnectionsController.setActiveNetwork(namespace, chain);
|
|
622
644
|
|
|
623
645
|
const connection = ConnectionsController.state.connections.get(namespace);
|
|
@@ -639,10 +661,13 @@ export class AppKit {
|
|
|
639
661
|
TransactionsController.fetchTransactions(address, true);
|
|
640
662
|
}
|
|
641
663
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
664
|
+
const closeModal = RouterController.state.view === 'UnsupportedChain';
|
|
665
|
+
|
|
666
|
+
SIWXUtil.initializeIfEnabled({
|
|
667
|
+
onDisconnect: this.disconnect,
|
|
668
|
+
caipAddress: address,
|
|
669
|
+
closeModal
|
|
670
|
+
});
|
|
646
671
|
});
|
|
647
672
|
|
|
648
673
|
adapter.on('disconnect', () => {
|
|
@@ -658,6 +683,7 @@ export class AppKit {
|
|
|
658
683
|
|
|
659
684
|
private async initControllers(options: AppKitConfig) {
|
|
660
685
|
await this.initStorageAndValues(options);
|
|
686
|
+
let defaultNetwork;
|
|
661
687
|
|
|
662
688
|
OptionsController.setProjectId(options.projectId);
|
|
663
689
|
OptionsController.setMetadata(options.metadata);
|
|
@@ -666,16 +692,26 @@ export class AppKit {
|
|
|
666
692
|
this.setCustomWallets(options);
|
|
667
693
|
OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
|
|
668
694
|
OptionsController.setEnableAnalytics(options.enableAnalytics);
|
|
669
|
-
OptionsController.setDebug(options.debug);
|
|
695
|
+
OptionsController.setDebug(options.debug && __DEV__);
|
|
696
|
+
|
|
697
|
+
// Initialize LogController after debug option is set
|
|
698
|
+
LogController.initialize();
|
|
699
|
+
LogController.sendInfo('AppKit initialization started', 'AppKit.ts', 'initControllers', {
|
|
700
|
+
projectId: options.projectId,
|
|
701
|
+
adapters: this.adapters.map(a => a.constructor.name),
|
|
702
|
+
networks: this.networks.map(n => n.name),
|
|
703
|
+
debug: options.debug
|
|
704
|
+
});
|
|
705
|
+
|
|
670
706
|
OptionsController.setFeatures(options.features);
|
|
671
707
|
OptionsController.setRequestedNetworks(this.networks);
|
|
672
708
|
|
|
673
709
|
if (options.defaultNetwork) {
|
|
674
|
-
|
|
675
|
-
OptionsController.setDefaultNetwork(
|
|
710
|
+
defaultNetwork = NetworkUtil.formatNetwork(options.defaultNetwork, this.projectId);
|
|
711
|
+
OptionsController.setDefaultNetwork(defaultNetwork);
|
|
676
712
|
}
|
|
677
713
|
|
|
678
|
-
ThemeController.
|
|
714
|
+
ThemeController.setDefaultThemeMode(options.themeMode);
|
|
679
715
|
ThemeController.setThemeVariables(options.themeVariables);
|
|
680
716
|
|
|
681
717
|
OptionsController.setSdkVersion(
|
|
@@ -688,9 +724,8 @@ export class AppKit {
|
|
|
688
724
|
|
|
689
725
|
ConnectionsController.setNetworks(this.networks);
|
|
690
726
|
|
|
691
|
-
if (options.
|
|
692
|
-
|
|
693
|
-
OptionsController.setIsSiweEnabled(options.siweConfig.options.enabled);
|
|
727
|
+
if (options.siwx) {
|
|
728
|
+
OptionsController.setSiwx(options.siwx);
|
|
694
729
|
}
|
|
695
730
|
|
|
696
731
|
if (
|
|
@@ -699,6 +734,24 @@ export class AppKit {
|
|
|
699
734
|
) {
|
|
700
735
|
OptionsController.setIsOnRampEnabled(true);
|
|
701
736
|
}
|
|
737
|
+
|
|
738
|
+
EventsController.sendEvent({
|
|
739
|
+
type: 'track',
|
|
740
|
+
event: 'INITIALIZE',
|
|
741
|
+
properties: {
|
|
742
|
+
showWallets: options.features?.showWallets,
|
|
743
|
+
themeMode: options.themeMode,
|
|
744
|
+
themeVariables: options.themeVariables,
|
|
745
|
+
networks: this.networks.map(network => network.caipNetworkId).filter(Boolean),
|
|
746
|
+
defaultNetwork: defaultNetwork?.caipNetworkId,
|
|
747
|
+
metadata: options.metadata,
|
|
748
|
+
enableAnalytics: options.enableAnalytics,
|
|
749
|
+
features: options.features,
|
|
750
|
+
adapters: this.adapters.map(adapter => adapter?.constructor?.name).filter(Boolean),
|
|
751
|
+
extraConnectors: this.extraConnectors.map(connector => connector?.type).filter(Boolean),
|
|
752
|
+
siwx: !!options.siwx
|
|
753
|
+
}
|
|
754
|
+
});
|
|
702
755
|
}
|
|
703
756
|
|
|
704
757
|
private async initActiveNamespace() {
|
|
@@ -796,47 +849,43 @@ export class AppKit {
|
|
|
796
849
|
ModalController.open({ view: routeName });
|
|
797
850
|
}
|
|
798
851
|
};
|
|
852
|
+
}
|
|
799
853
|
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
if (
|
|
816
|
-
if (
|
|
817
|
-
//
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
return this.navigate('ConnectingSiwe');
|
|
821
|
-
}
|
|
822
|
-
} else if (session && isNetworkChange) {
|
|
823
|
-
if (signOutOnNetworkChange) {
|
|
824
|
-
// If the network has changed and signOnNetworkChange is enabled, sign out
|
|
825
|
-
await SIWEController.signOut();
|
|
826
|
-
|
|
827
|
-
return this.navigate('ConnectingSiwe');
|
|
854
|
+
/**
|
|
855
|
+
* Creates or returns the existing AppKit singleton instance.
|
|
856
|
+
*
|
|
857
|
+
* @warning This function implements a singleton pattern. If an instance already exists,
|
|
858
|
+
* it will be returned and the provided config parameter will be IGNORED. If you need to
|
|
859
|
+
* change configuration, you must reload your application or clear the singleton manually.
|
|
860
|
+
*
|
|
861
|
+
* @param config - AppKit configuration options
|
|
862
|
+
* @returns The AppKit singleton instance
|
|
863
|
+
* @throws Error if configuration validation fails
|
|
864
|
+
*/
|
|
865
|
+
export function createAppKit(config: AppKitConfig): AppKit {
|
|
866
|
+
try {
|
|
867
|
+
const globalWithAppKit = globalThis as GlobalWithAppKit;
|
|
868
|
+
|
|
869
|
+
if (!globalWithAppKit[APPKIT_INSTANCE_KEY]) {
|
|
870
|
+
if (config.debug && __DEV__) {
|
|
871
|
+
// using console.log to avoid possible issues with LogController not being initialized
|
|
872
|
+
//eslint-disable-next-line no-console
|
|
873
|
+
console.log('AppKit: Creating new instance - AppKit.ts:createAppKit');
|
|
828
874
|
}
|
|
829
|
-
|
|
830
|
-
|
|
875
|
+
globalWithAppKit[APPKIT_INSTANCE_KEY] = new AppKit(config);
|
|
876
|
+
} else if (config.debug && __DEV__) {
|
|
877
|
+
//eslint-disable-next-line no-console
|
|
878
|
+
console.log('AppKit: Reusing existing instance - AppKit.ts:createAppKit');
|
|
879
|
+
}
|
|
831
880
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
881
|
+
return globalWithAppKit[APPKIT_INSTANCE_KEY]!;
|
|
882
|
+
} catch (error) {
|
|
883
|
+
if (__DEV__) {
|
|
884
|
+
// using console.error to avoid possible issues with LogController not being initialized
|
|
885
|
+
//eslint-disable-next-line no-console
|
|
886
|
+
console.error('AppKit: Failed to create instance - AppKit.ts:createAppKit', error);
|
|
836
887
|
}
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
888
|
|
|
840
|
-
|
|
841
|
-
|
|
889
|
+
throw error;
|
|
890
|
+
}
|
|
842
891
|
}
|
package/src/AppKitContext.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useContext, type ReactNode } from 'react';
|
|
1
|
+
import React, { createContext, useContext, useMemo, type ReactNode } from 'react';
|
|
2
2
|
import { AppKit } from './AppKit';
|
|
3
3
|
|
|
4
4
|
interface AppKitContextType {
|
|
@@ -26,14 +26,22 @@ export const useInternalAppKit = () => {
|
|
|
26
26
|
throw new Error('AppKit instance is not yet available in context.');
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const stableFunctions = useMemo(() => {
|
|
30
|
+
if (!context.appKit) {
|
|
31
|
+
throw new Error('AppKit instance is not available');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
connect: context.appKit.connect.bind(context.appKit),
|
|
36
|
+
disconnect: context.appKit.disconnect.bind(context.appKit),
|
|
37
|
+
open: context.appKit.open.bind(context.appKit),
|
|
38
|
+
close: context.appKit.close.bind(context.appKit),
|
|
39
|
+
back: context.appKit.back.bind(context.appKit),
|
|
40
|
+
switchNetwork: context.appKit.switchNetwork.bind(context.appKit),
|
|
41
|
+
getProvider: context.appKit.getProvider.bind(context.appKit),
|
|
42
|
+
switchAccountType: context.appKit.switchAccountType.bind(context.appKit)
|
|
43
|
+
};
|
|
44
|
+
}, [context.appKit]);
|
|
45
|
+
|
|
46
|
+
return stableFunctions;
|
|
39
47
|
};
|