@reown/appkit-react-native 0.0.0-feat-multichain-20250925192219 → 0.0.0-feat-multichain-20251001210321
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 +105 -14
- package/lib/commonjs/AppKit.js.map +1 -1
- 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/index.js +7 -0
- package/lib/commonjs/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 +2 -1
- 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 +3 -1
- 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 +1 -0
- 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/utils/SIWXUtil.js +4 -8
- package/lib/commonjs/utils/SIWXUtil.js.map +1 -1
- 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 +5 -2
- 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 +5 -2
- 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 +1 -0
- 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-siwx-sign-view/index.js +1 -0
- package/lib/commonjs/views/w3m-siwx-sign-view/index.js.map +1 -1
- 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 +106 -15
- package/lib/module/AppKit.js.map +1 -1
- 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/index.js +1 -0
- package/lib/module/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 +2 -1
- 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 +3 -1
- 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 +2 -1
- 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/utils/SIWXUtil.js +5 -9
- package/lib/module/utils/SIWXUtil.js.map +1 -1
- 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 +5 -2
- 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 +5 -2
- 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 +2 -1
- 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-siwx-sign-view/index.js +2 -1
- package/lib/module/views/w3m-siwx-sign-view/index.js.map +1 -1
- 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 -1
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +1 -1
- package/lib/typescript/hooks/useAccount.d.ts +1 -1
- package/lib/typescript/hooks/useAppKit.d.ts +2 -1
- package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts +69 -17
- 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 +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +3 -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 +1 -1
- 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 +1 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/SIWXUtil.d.ts +1 -1
- package/lib/typescript/utils/SIWXUtil.d.ts.map +1 -1
- 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-siwx-sign-view/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/AppKit.ts +122 -14
- package/src/hooks/useAppKit.ts +3 -2
- package/src/hooks/useAppKitLogs.ts +129 -0
- package/src/index.ts +8 -0
- package/src/partials/w3m-account-wallet-features/index.tsx +1 -1
- package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +11 -3
- package/src/partials/w3m-all-wallets-list/components/WalletList.tsx +3 -2
- package/src/partials/w3m-all-wallets-list/index.tsx +3 -1
- package/src/partials/w3m-all-wallets-search/index.tsx +8 -2
- 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/types.ts +1 -0
- package/src/utils/SIWXUtil.ts +6 -11
- package/src/views/w3m-account-default-view/index.tsx +5 -3
- package/src/views/w3m-all-wallets-view/index.tsx +9 -2
- package/src/views/w3m-connect-view/components/all-wallet-list.tsx +6 -4
- package/src/views/w3m-connect-view/index.tsx +5 -2
- 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 +3 -1
- package/src/views/w3m-network-switch-view/index.tsx +2 -0
- package/src/views/w3m-siwx-sign-view/index.tsx +2 -0
- package/src/views/w3m-swap-view/index.tsx +1 -1
- package/src/views/w3m-what-is-a-wallet-view/index.tsx +1 -1
|
@@ -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
|
data: WcWallet[];
|
|
5
|
-
onItemPress: (wallet: WcWallet) => void;
|
|
5
|
+
onItemPress: (wallet: WcWallet, displayIndex: number) => void;
|
|
6
6
|
onEndReached?: () => void;
|
|
7
7
|
onEndReachedThreshold?: number;
|
|
8
8
|
isLoading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletList.d.ts","sourceRoot":"","sources":["../../../../../src/partials/w3m-all-wallets-list/components/WalletList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAUpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAQlE,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"WalletList.d.ts","sourceRoot":"","sources":["../../../../../src/partials/w3m-all-wallets-list/components/WalletList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAUpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAQlE,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,SAAiB,EACjB,YAAiB,EACjB,SAAS,EACT,KAAK,EACN,EAAE,KAAK,2CA8CP"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type WcWallet } from '@reown/appkit-common-react-native';
|
|
2
2
|
interface AllWalletsListProps {
|
|
3
|
-
onItemPress: (wallet: WcWallet) => void;
|
|
3
|
+
onItemPress: (wallet: WcWallet, displayIndex: number) => void;
|
|
4
4
|
headerHeight?: number;
|
|
5
5
|
}
|
|
6
6
|
export declare function AllWalletsList({ onItemPress }: AllWalletsListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-all-wallets-list/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-all-wallets-list/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAOlE,UAAU,mBAAmB;IAC3B,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,EAAE,WAAW,EAAE,EAAE,mBAAmB,2CAqGlE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type WcWallet } from '@reown/appkit-common-react-native';
|
|
2
2
|
export interface AllWalletsSearchProps {
|
|
3
|
-
onItemPress: (wallet: WcWallet) => void;
|
|
3
|
+
onItemPress: (wallet: WcWallet, displayIndex: number) => void;
|
|
4
4
|
searchQuery?: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function AllWalletsSearch({ searchQuery, onItemPress }: AllWalletsSearchProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-all-wallets-search/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-all-wallets-search/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAQlE,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,qBAAqB,2CAkEnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-mobile/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-mobile/index.tsx"],"names":[],"mappings":"AA8BA,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,KAAK,2CAgJ1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-qrcode/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-qrcode/index.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,gBAAgB,4CA+D/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-web/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-web/index.tsx"],"names":[],"mappings":"AA2BA,UAAU,kBAAkB;IAC1B,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE,kBAAkB,2CAuF9D"}
|
|
@@ -103,6 +103,7 @@ export interface AppKitConfig {
|
|
|
103
103
|
/**
|
|
104
104
|
* Optional flag to enable debug mode.
|
|
105
105
|
* When enabled, additional logging and debugging information will be output.
|
|
106
|
+
* Only enabled in development mode.
|
|
106
107
|
*
|
|
107
108
|
* @see {@link https://docs.reown.com/appkit/react-native/core/options#debug | Debug Documentation}
|
|
108
109
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,+BAA+B,EACpC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,UAAU,EAChB,MAAM,mCAAmC,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;;;;OAMG;IACH,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAE9B;;;;;OAKG;IACH,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEpB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;IAEpC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAE5D;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;IAE9D;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;IAE9D;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC,eAAe,CAAC,CAAC;IAExD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAE5D
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,+BAA+B,EACpC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,UAAU,EAChB,MAAM,mCAAmC,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB;;;;;;OAMG;IACH,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAE9B;;;;;OAKG;IACH,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEpB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;IAEpC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAE5D;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;IAE9D;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;IAE9D;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,aAAa,CAAC,EAAE,sBAAsB,CAAC,eAAe,CAAC,CAAC;IAExD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAE5D;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAExC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;OAGG;IACH,+BAA+B,CAAC,EAAE,+BAA+B,CAAC;CACnE"}
|
|
@@ -25,7 +25,7 @@ export declare const SIWXUtil: {
|
|
|
25
25
|
universalLink?: string | undefined;
|
|
26
26
|
}): Promise<import("@walletconnect/types").SessionTypes.Struct | undefined>;
|
|
27
27
|
getSIWXEventProperties(error?: unknown): {
|
|
28
|
-
network: string;
|
|
28
|
+
network: `${string}:${string}` | undefined;
|
|
29
29
|
isSmartAccount: boolean;
|
|
30
30
|
message: string | undefined;
|
|
31
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SIWXUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SIWXUtil.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAElE,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,WAAW,EACjB,MAAM,mCAAmC,CAAC;AAa3C;;GAEG;AAEH,eAAO,MAAM,QAAQ;;;sBAUH,MAAM,QAAQ,IAAI,CAAC;;;;;
|
|
1
|
+
{"version":3,"file":"SIWXUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SIWXUtil.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAElE,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,WAAW,EACjB,MAAM,mCAAmC,CAAC;AAa3C;;GAEG;AAEH,eAAO,MAAM,QAAQ;;;sBAUH,MAAM,QAAQ,IAAI,CAAC;;;;;oCAqIG,MAAM,QAAQ,IAAI,CAAC;;uBAsChC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,aAAa,CAAA;KAAE;;;2BAwCvD,iBAAiB;gBAC5B,aAAa,EAAE;iBACd,MAAM,EAAE;;;mCAkGY,OAAO;;;;;;CAcvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,kBAAkB,4CA6TjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-all-wallets-view/index.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-all-wallets-view/index.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,cAAc,4CAyF7B"}
|
|
@@ -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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-siwx-sign-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-siwx-sign-view/index.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,mBAAmB,4CA0ElC"}
|
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-20251001210321",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"provenance": true
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@reown/appkit-common-react-native": "0.0.0-feat-multichain-
|
|
43
|
-
"@reown/appkit-core-react-native": "0.0.0-feat-multichain-
|
|
44
|
-
"@reown/appkit-ui-react-native": "0.0.0-feat-multichain-
|
|
45
|
-
"@walletconnect/universal-provider": "2.21.
|
|
46
|
-
"valtio": "2.1.
|
|
42
|
+
"@reown/appkit-common-react-native": "0.0.0-feat-multichain-20251001210321",
|
|
43
|
+
"@reown/appkit-core-react-native": "0.0.0-feat-multichain-20251001210321",
|
|
44
|
+
"@reown/appkit-ui-react-native": "0.0.0-feat-multichain-20251001210321",
|
|
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
|
|
|
@@ -45,6 +46,13 @@ import { RouterUtil } from './utils/RouterUtil';
|
|
|
45
46
|
import { type AppKitConfig } from './types';
|
|
46
47
|
import { SIWXUtil } from './utils/SIWXUtil';
|
|
47
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
|
+
}
|
|
55
|
+
|
|
48
56
|
export class AppKit {
|
|
49
57
|
private projectId: string;
|
|
50
58
|
private adapters: BlockchainAdapter[];
|
|
@@ -144,7 +152,7 @@ export class AppKit {
|
|
|
144
152
|
});
|
|
145
153
|
}
|
|
146
154
|
} catch (error) {
|
|
147
|
-
|
|
155
|
+
LogController.sendError(error, 'AppKit.ts', 'connect');
|
|
148
156
|
throw error;
|
|
149
157
|
}
|
|
150
158
|
}
|
|
@@ -179,7 +187,7 @@ export class AppKit {
|
|
|
179
187
|
* @param namespace - The namespace to disconnect from.
|
|
180
188
|
* @param isInternal - Whether the disconnect is internal (i.e. from the AppKit) or external (i.e. from wallet side).
|
|
181
189
|
*/
|
|
182
|
-
async disconnect(namespace?:
|
|
190
|
+
async disconnect(namespace?: ChainNamespace, isInternal?: boolean): Promise<void> {
|
|
183
191
|
try {
|
|
184
192
|
const activeNamespace = namespace ?? ConnectionsController.state.activeNamespace;
|
|
185
193
|
|
|
@@ -219,9 +227,13 @@ export class AppKit {
|
|
|
219
227
|
|
|
220
228
|
EventsController.sendEvent({
|
|
221
229
|
type: 'track',
|
|
222
|
-
event: 'DISCONNECT_SUCCESS'
|
|
230
|
+
event: 'DISCONNECT_SUCCESS',
|
|
231
|
+
properties: {
|
|
232
|
+
namespace: activeNamespace
|
|
233
|
+
}
|
|
223
234
|
});
|
|
224
235
|
} catch (error) {
|
|
236
|
+
LogController.sendError(error, 'AppKit.ts', 'disconnect');
|
|
225
237
|
EventsController.sendEvent({
|
|
226
238
|
type: 'track',
|
|
227
239
|
event: 'DISCONNECT_ERROR'
|
|
@@ -268,7 +280,7 @@ export class AppKit {
|
|
|
268
280
|
type: 'track',
|
|
269
281
|
event: 'SWITCH_NETWORK',
|
|
270
282
|
properties: {
|
|
271
|
-
network: network.
|
|
283
|
+
network: network.caipNetworkId
|
|
272
284
|
}
|
|
273
285
|
});
|
|
274
286
|
|
|
@@ -383,6 +395,10 @@ export class AppKit {
|
|
|
383
395
|
*/
|
|
384
396
|
private async initConnectors() {
|
|
385
397
|
ModalController.setLoading(true);
|
|
398
|
+
|
|
399
|
+
//Always init the walletconnect connector
|
|
400
|
+
await this.createWalletConnectConnector();
|
|
401
|
+
|
|
386
402
|
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
387
403
|
if (connectedConnectors.length > 0) {
|
|
388
404
|
for (const connected of connectedConnectors) {
|
|
@@ -393,15 +409,28 @@ export class AppKit {
|
|
|
393
409
|
|
|
394
410
|
await this.processConnection(connector, namespaces);
|
|
395
411
|
} catch (error) {
|
|
396
|
-
|
|
397
|
-
|
|
412
|
+
LogController.sendError(error, 'AppKit.ts', 'initializeConnector', {
|
|
413
|
+
connectorType: connected.type
|
|
414
|
+
});
|
|
398
415
|
await StorageUtil.removeConnectedConnectors(connected.type);
|
|
399
416
|
}
|
|
400
417
|
}
|
|
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
|
+
}
|
|
401
432
|
}
|
|
402
433
|
|
|
403
|
-
//Always init the walletconnect connector
|
|
404
|
-
await this.createWalletConnectConnector();
|
|
405
434
|
ModalController.setLoading(false);
|
|
406
435
|
}
|
|
407
436
|
|
|
@@ -494,6 +523,7 @@ export class AppKit {
|
|
|
494
523
|
);
|
|
495
524
|
}
|
|
496
525
|
} catch (error) {
|
|
526
|
+
LogController.sendError(error, 'AppKit.ts', 'syncIdentity');
|
|
497
527
|
// Continue processing other addresses even if one fails
|
|
498
528
|
}
|
|
499
529
|
}
|
|
@@ -512,8 +542,9 @@ export class AppKit {
|
|
|
512
542
|
this.syncNativeBalance(adapter, network);
|
|
513
543
|
}
|
|
514
544
|
}
|
|
515
|
-
} catch {
|
|
545
|
+
} catch (error) {
|
|
516
546
|
// ignore
|
|
547
|
+
LogController.sendError(error, 'AppKit.ts', 'refreshBalance');
|
|
517
548
|
}
|
|
518
549
|
}
|
|
519
550
|
|
|
@@ -602,6 +633,13 @@ export class AppKit {
|
|
|
602
633
|
|
|
603
634
|
const namespace = adapter.getSupportedNamespace();
|
|
604
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
|
+
|
|
605
643
|
ConnectionsController.setActiveNetwork(namespace, chain);
|
|
606
644
|
|
|
607
645
|
const connection = ConnectionsController.state.connections.get(namespace);
|
|
@@ -623,7 +661,13 @@ export class AppKit {
|
|
|
623
661
|
TransactionsController.fetchTransactions(address, true);
|
|
624
662
|
}
|
|
625
663
|
|
|
626
|
-
|
|
664
|
+
const closeModal = RouterController.state.view === 'UnsupportedChain';
|
|
665
|
+
|
|
666
|
+
SIWXUtil.initializeIfEnabled({
|
|
667
|
+
onDisconnect: this.disconnect,
|
|
668
|
+
caipAddress: address,
|
|
669
|
+
closeModal
|
|
670
|
+
});
|
|
627
671
|
});
|
|
628
672
|
|
|
629
673
|
adapter.on('disconnect', () => {
|
|
@@ -639,6 +683,7 @@ export class AppKit {
|
|
|
639
683
|
|
|
640
684
|
private async initControllers(options: AppKitConfig) {
|
|
641
685
|
await this.initStorageAndValues(options);
|
|
686
|
+
let defaultNetwork;
|
|
642
687
|
|
|
643
688
|
OptionsController.setProjectId(options.projectId);
|
|
644
689
|
OptionsController.setMetadata(options.metadata);
|
|
@@ -647,13 +692,23 @@ export class AppKit {
|
|
|
647
692
|
this.setCustomWallets(options);
|
|
648
693
|
OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
|
|
649
694
|
OptionsController.setEnableAnalytics(options.enableAnalytics);
|
|
650
|
-
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
|
+
|
|
651
706
|
OptionsController.setFeatures(options.features);
|
|
652
707
|
OptionsController.setRequestedNetworks(this.networks);
|
|
653
708
|
|
|
654
709
|
if (options.defaultNetwork) {
|
|
655
|
-
|
|
656
|
-
OptionsController.setDefaultNetwork(
|
|
710
|
+
defaultNetwork = NetworkUtil.formatNetwork(options.defaultNetwork, this.projectId);
|
|
711
|
+
OptionsController.setDefaultNetwork(defaultNetwork);
|
|
657
712
|
}
|
|
658
713
|
|
|
659
714
|
ThemeController.setDefaultThemeMode(options.themeMode);
|
|
@@ -679,6 +734,24 @@ export class AppKit {
|
|
|
679
734
|
) {
|
|
680
735
|
OptionsController.setIsOnRampEnabled(true);
|
|
681
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
|
+
});
|
|
682
755
|
}
|
|
683
756
|
|
|
684
757
|
private async initActiveNamespace() {
|
|
@@ -778,6 +851,41 @@ export class AppKit {
|
|
|
778
851
|
};
|
|
779
852
|
}
|
|
780
853
|
|
|
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
|
+
*/
|
|
781
865
|
export function createAppKit(config: AppKitConfig): AppKit {
|
|
782
|
-
|
|
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');
|
|
874
|
+
}
|
|
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
|
+
}
|
|
880
|
+
|
|
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);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
throw error;
|
|
890
|
+
}
|
|
783
891
|
}
|
package/src/hooks/useAppKit.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useContext, useMemo } from 'react';
|
|
2
|
+
import type { ChainNamespace } from '@reown/appkit-common-react-native';
|
|
2
3
|
|
|
3
4
|
import type { AppKit } from '../AppKit';
|
|
4
5
|
import { AppKitContext } from '../AppKitContext';
|
|
@@ -6,7 +7,7 @@ import { AppKitContext } from '../AppKitContext';
|
|
|
6
7
|
interface UseAppKitReturn {
|
|
7
8
|
open: AppKit['open'];
|
|
8
9
|
close: AppKit['close'];
|
|
9
|
-
disconnect: (namespace?:
|
|
10
|
+
disconnect: (namespace?: ChainNamespace) => void;
|
|
10
11
|
switchNetwork: AppKit['switchNetwork'];
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -30,7 +31,7 @@ export const useAppKit = (): UseAppKitReturn => {
|
|
|
30
31
|
return {
|
|
31
32
|
open: context.appKit.open.bind(context.appKit),
|
|
32
33
|
close: context.appKit.close.bind(context.appKit),
|
|
33
|
-
disconnect: (namespace?:
|
|
34
|
+
disconnect: (namespace?: ChainNamespace) =>
|
|
34
35
|
context.appKit!.disconnect.bind(context.appKit!)(namespace),
|
|
35
36
|
switchNetwork: context.appKit.switchNetwork.bind(context.appKit)
|
|
36
37
|
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import { useSnapshot } from 'valtio';
|
|
3
|
+
import { LogController, type LogEntry, type LogLevel } from '@reown/appkit-core-react-native';
|
|
4
|
+
import { AppKitContext } from '../AppKitContext';
|
|
5
|
+
|
|
6
|
+
export interface UseAppKitLogsReturn {
|
|
7
|
+
/**
|
|
8
|
+
* All logs from AppKit
|
|
9
|
+
*/
|
|
10
|
+
logs: LogEntry[];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get logs filtered by level
|
|
14
|
+
*/
|
|
15
|
+
getLogsByLevel: (level: LogLevel) => LogEntry[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get recent logs (default: 100)
|
|
19
|
+
*/
|
|
20
|
+
getRecentLogs: (count?: number) => LogEntry[];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Export all logs as JSON string
|
|
24
|
+
*/
|
|
25
|
+
exportLogs: () => string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get logging statistics by level
|
|
29
|
+
*/
|
|
30
|
+
getLogsStats: () => Record<LogLevel, number>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Clear all logs
|
|
34
|
+
*/
|
|
35
|
+
clearLogs: () => void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Convenience getters for different log levels (regular arrays, safe for console.log)
|
|
39
|
+
*/
|
|
40
|
+
errorLogs: LogEntry[];
|
|
41
|
+
warningLogs: LogEntry[];
|
|
42
|
+
infoLogs: LogEntry[];
|
|
43
|
+
debugLogs: LogEntry[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* React hook for accessing AppKit logs
|
|
48
|
+
*
|
|
49
|
+
* This hook provides reactive access to AppKit's internal logging system.
|
|
50
|
+
* It automatically updates when new logs are added or when logs are cleaned up.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* function MyComponent() {
|
|
55
|
+
* const { logs, errorLogs, exportLogs, clearLogs } = useAppKitLogs();
|
|
56
|
+
*
|
|
57
|
+
* return (
|
|
58
|
+
* <View>
|
|
59
|
+
* <Text>Total logs: {logs.length}</Text>
|
|
60
|
+
* <Text>Error logs: {errorLogs.length}</Text>
|
|
61
|
+
* <Button onPress={clearLogs} title="Clear Logs" />
|
|
62
|
+
* </View>
|
|
63
|
+
* );
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export const useAppKitLogs = (): UseAppKitLogsReturn => {
|
|
68
|
+
const context = useContext(AppKitContext);
|
|
69
|
+
|
|
70
|
+
if (context === undefined) {
|
|
71
|
+
throw new Error('useAppKitLogs must be used within an AppKitProvider');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!context.appKit) {
|
|
75
|
+
throw new Error('AppKit instance is not yet available in context.');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const { logs } = useSnapshot(LogController.state);
|
|
79
|
+
|
|
80
|
+
// Memoized functions that don't need to change on every render
|
|
81
|
+
const stableFunctions = useMemo(
|
|
82
|
+
() => ({
|
|
83
|
+
getLogsByLevel: (level: LogLevel) => LogController.getLogsByLevel(level),
|
|
84
|
+
getRecentLogs: (count?: number) => LogController.getRecentLogs(count),
|
|
85
|
+
exportLogs: () => LogController.exportLogs(),
|
|
86
|
+
getLogsStats: () => LogController.getLogsStats(),
|
|
87
|
+
clearLogs: () => LogController.clearLogs()
|
|
88
|
+
}),
|
|
89
|
+
[]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const regularArrays = useMemo(() => {
|
|
93
|
+
const allLogs = [...logs]; // Convert proxy to regular array
|
|
94
|
+
const errorLogs: LogEntry[] = [];
|
|
95
|
+
const warningLogs: LogEntry[] = [];
|
|
96
|
+
const infoLogs: LogEntry[] = [];
|
|
97
|
+
const debugLogs: LogEntry[] = [];
|
|
98
|
+
|
|
99
|
+
for (const log of allLogs) {
|
|
100
|
+
switch (log.level) {
|
|
101
|
+
case 'error':
|
|
102
|
+
errorLogs.push(log);
|
|
103
|
+
break;
|
|
104
|
+
case 'warn':
|
|
105
|
+
warningLogs.push(log);
|
|
106
|
+
break;
|
|
107
|
+
case 'info':
|
|
108
|
+
infoLogs.push(log);
|
|
109
|
+
break;
|
|
110
|
+
case 'debug':
|
|
111
|
+
debugLogs.push(log);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
logs: allLogs,
|
|
118
|
+
errorLogs,
|
|
119
|
+
warningLogs,
|
|
120
|
+
infoLogs,
|
|
121
|
+
debugLogs
|
|
122
|
+
};
|
|
123
|
+
}, [logs]);
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
...regularArrays,
|
|
127
|
+
...stableFunctions
|
|
128
|
+
};
|
|
129
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,13 @@ 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 {
|
|
21
|
+
SIWXConfig,
|
|
22
|
+
SIWXMessage,
|
|
23
|
+
SIWXSession,
|
|
24
|
+
SIWXStorage,
|
|
25
|
+
SIWXVerifier
|
|
26
|
+
} from '@reown/appkit-common-react-native';
|
|
20
27
|
export type { AppKitConfig } from './types';
|
|
21
28
|
|
|
22
29
|
/****** Hooks *******/
|
|
@@ -26,6 +33,7 @@ export { useAccount } from './hooks/useAccount';
|
|
|
26
33
|
export { useWalletInfo } from './hooks/useWalletInfo';
|
|
27
34
|
export { useAppKitEvents, useAppKitEventSubscription } from './hooks/useAppKitEvents';
|
|
28
35
|
export { useAppKitState } from './hooks/useAppKitState';
|
|
36
|
+
export { useAppKitLogs, type UseAppKitLogsReturn } from './hooks/useAppKitLogs';
|
|
29
37
|
|
|
30
38
|
/********** Networks **********/
|
|
31
39
|
export { solana, solanaDevnet, solanaTestnet } from '@reown/appkit-common-react-native';
|
|
@@ -21,7 +21,7 @@ export function AccountWalletFeatures() {
|
|
|
21
21
|
const { features, isOnRampEnabled } = useSnapshot(OptionsController.state);
|
|
22
22
|
const { activeNetwork, balances, activeNamespace } = useSnapshot(ConnectionsController.state);
|
|
23
23
|
const balance = CoreHelperUtil.calculateAndFormatBalance(balances as BalanceType[]);
|
|
24
|
-
const network = ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
24
|
+
const network = ConnectionsController.state.activeNetwork?.caipNetworkId;
|
|
25
25
|
const isSmartAccount = ConnectionsController.state.accountType === 'smartAccount';
|
|
26
26
|
const showSend =
|
|
27
27
|
activeNamespace && ConstantsUtil.SEND_SUPPORTED_NAMESPACES.includes(activeNamespace);
|