@reown/appkit-react-native 2.0.0-alpha.2 → 2.0.0-alpha.3
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 +64 -66
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/AppKitContext.js +4 -5
- package/lib/commonjs/AppKitContext.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +15 -3
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitEvents.js.map +1 -1
- package/lib/commonjs/hooks/useProvider.js +29 -10
- package/lib/commonjs/hooks/useProvider.js.map +1 -1
- package/lib/commonjs/hooks/useRouteTransition.js +83 -0
- package/lib/commonjs/hooks/useRouteTransition.js.map +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-account-button/index.js +1 -1
- package/lib/commonjs/modal/w3m-account-button/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js +11 -32
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/styles.js +0 -4
- package/lib/commonjs/modal/w3m-modal/styles.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/modal/w3m-router/index.js +16 -1
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-activity/index.js +8 -8
- package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-tokens/index.js +5 -5
- package/lib/commonjs/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js +5 -5
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-body/index.js +2 -2
- package/lib/commonjs/partials/w3m-connecting-body/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-mobile/index.js +12 -13
- package/lib/commonjs/partials/w3m-connecting-mobile/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js +27 -12
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-web/index.js +10 -11
- package/lib/commonjs/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +7 -15
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-information-modal/index.js +34 -32
- package/lib/commonjs/partials/w3m-information-modal/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-information-modal/styles.js +6 -4
- package/lib/commonjs/partials/w3m-information-modal/styles.js.map +1 -1
- package/lib/commonjs/partials/w3m-placeholder/index.js +5 -5
- package/lib/commonjs/partials/w3m-placeholder/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/index.js +65 -67
- package/lib/commonjs/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-selector-modal/styles.js +1 -0
- package/lib/commonjs/partials/w3m-selector-modal/styles.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js +2 -2
- package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-input/index.js +2 -2
- package/lib/commonjs/partials/w3m-swap-input/index.js.map +1 -1
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/HelpersUtil.js.map +1 -1
- package/lib/commonjs/utils/RouterUtil.js +52 -0
- package/lib/commonjs/utils/RouterUtil.js.map +1 -0
- package/lib/commonjs/utils/UiUtil.js +10 -19
- package/lib/commonjs/utils/UiUtil.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js +2 -2
- package/lib/commonjs/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js +17 -17
- 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 +4 -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 +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/components/social-login-list.js +4 -4
- package/lib/commonjs/views/w3m-connect-view/components/social-login-list.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js +8 -8
- package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js +7 -8
- package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js +6 -11
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-social-view/index.js +8 -10
- 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-get-wallet-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-network-switch-view/index.js +6 -5
- package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-networks-view/index.js +5 -8
- package/lib/commonjs/views/w3m-networks-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-checkout-view/index.js +16 -16
- package/lib/commonjs/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js +4 -4
- package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js +4 -4
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/utils.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-transaction-view/index.js +5 -5
- package/lib/commonjs/views/w3m-onramp-transaction-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/Currency.js +2 -2
- package/lib/commonjs/views/w3m-onramp-view/components/Currency.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/CurrencyInput.js +2 -2
- package/lib/commonjs/views/w3m-onramp-view/components/CurrencyInput.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/Header.js +5 -6
- package/lib/commonjs/views/w3m-onramp-view/components/Header.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/PaymentButton.js +4 -4
- package/lib/commonjs/views/w3m-onramp-view/components/PaymentButton.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/PaymentMethod.js +2 -2
- package/lib/commonjs/views/w3m-onramp-view/components/PaymentMethod.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/Quote.js +4 -4
- package/lib/commonjs/views/w3m-onramp-view/components/Quote.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/SelectPaymentModal.js +68 -70
- package/lib/commonjs/views/w3m-onramp-view/components/SelectPaymentModal.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-preview-view/index.js +1 -14
- package/lib/commonjs/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-preview-view/styles.js +3 -0
- package/lib/commonjs/views/w3m-swap-preview-view/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js +4 -3
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/styles.js +1 -2
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/styles.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-view/utils.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js +13 -23
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/styles.js +5 -1
- package/lib/commonjs/views/w3m-swap-view/styles.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 +2 -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/commonjs/views/w3m-wallet-send-view/index.js +4 -12
- package/lib/commonjs/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-view/styles.js +3 -0
- package/lib/commonjs/views/w3m-wallet-send-view/styles.js.map +1 -1
- package/lib/module/AppKit.js +65 -67
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/AppKitContext.js +2 -3
- package/lib/module/AppKitContext.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +16 -4
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/hooks/useAppKitEvents.js.map +1 -1
- package/lib/module/hooks/useProvider.js +30 -10
- package/lib/module/hooks/useProvider.js.map +1 -1
- package/lib/module/hooks/useRouteTransition.js +79 -0
- package/lib/module/hooks/useRouteTransition.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modal/w3m-account-button/index.js +2 -2
- package/lib/module/modal/w3m-account-button/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/index.js +12 -33
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/styles.js +0 -4
- package/lib/module/modal/w3m-modal/styles.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/modal/w3m-router/index.js +17 -2
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-account-activity/index.js +9 -9
- package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
- package/lib/module/partials/w3m-account-tokens/index.js +6 -6
- package/lib/module/partials/w3m-account-tokens/index.js.map +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js +5 -5
- package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-body/index.js +2 -2
- package/lib/module/partials/w3m-connecting-body/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-mobile/index.js +13 -14
- package/lib/module/partials/w3m-connecting-mobile/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-qrcode/index.js +28 -13
- package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-web/index.js +11 -12
- package/lib/module/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +8 -16
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/partials/w3m-information-modal/index.js +33 -31
- package/lib/module/partials/w3m-information-modal/index.js.map +1 -1
- package/lib/module/partials/w3m-information-modal/styles.js +7 -5
- package/lib/module/partials/w3m-information-modal/styles.js.map +1 -1
- package/lib/module/partials/w3m-placeholder/index.js +5 -5
- package/lib/module/partials/w3m-placeholder/index.js.map +1 -1
- package/lib/module/partials/w3m-selector-modal/index.js +66 -68
- package/lib/module/partials/w3m-selector-modal/index.js.map +1 -1
- package/lib/module/partials/w3m-selector-modal/styles.js +1 -0
- package/lib/module/partials/w3m-selector-modal/styles.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js +2 -2
- package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/module/partials/w3m-swap-input/index.js +2 -2
- package/lib/module/partials/w3m-swap-input/index.js.map +1 -1
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/HelpersUtil.js.map +1 -1
- package/lib/module/utils/NetworkUtil.js.map +1 -1
- package/lib/module/utils/RouterUtil.js +48 -0
- package/lib/module/utils/RouterUtil.js.map +1 -0
- package/lib/module/utils/UiUtil.js +12 -20
- package/lib/module/utils/UiUtil.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/components/auth-buttons.js +2 -2
- package/lib/module/views/w3m-account-default-view/components/auth-buttons.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/index.js +19 -19
- 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 +5 -5
- 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/components/social-login-list.js +4 -4
- package/lib/module/views/w3m-connect-view/components/social-login-list.js.map +1 -1
- package/lib/module/views/w3m-connect-view/index.js +8 -8
- package/lib/module/views/w3m-connect-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-external-view/index.js +9 -10
- package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-siwe-view/index.js +8 -13
- package/lib/module/views/w3m-connecting-siwe-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-social-view/index.js +10 -12
- 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-get-wallet-view/index.js.map +1 -1
- package/lib/module/views/w3m-network-switch-view/index.js +9 -7
- package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/module/views/w3m-networks-view/index.js +7 -10
- package/lib/module/views/w3m-networks-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-checkout-view/index.js +17 -17
- package/lib/module/views/w3m-onramp-checkout-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/components/Country.js +4 -4
- package/lib/module/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/index.js +4 -4
- package/lib/module/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/utils.js.map +1 -1
- package/lib/module/views/w3m-onramp-transaction-view/index.js +5 -5
- package/lib/module/views/w3m-onramp-transaction-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/Currency.js +2 -2
- package/lib/module/views/w3m-onramp-view/components/Currency.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/CurrencyInput.js +2 -2
- package/lib/module/views/w3m-onramp-view/components/CurrencyInput.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/Header.js +5 -6
- package/lib/module/views/w3m-onramp-view/components/Header.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/PaymentButton.js +4 -4
- package/lib/module/views/w3m-onramp-view/components/PaymentButton.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/PaymentMethod.js +2 -2
- package/lib/module/views/w3m-onramp-view/components/PaymentMethod.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/Quote.js +4 -4
- package/lib/module/views/w3m-onramp-view/components/Quote.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/SelectPaymentModal.js +68 -69
- package/lib/module/views/w3m-onramp-view/components/SelectPaymentModal.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-preview-view/index.js +3 -16
- package/lib/module/views/w3m-swap-preview-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-preview-view/styles.js +3 -0
- package/lib/module/views/w3m-swap-preview-view/styles.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js +5 -4
- package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/styles.js +1 -2
- package/lib/module/views/w3m-swap-view/components/select-token-view/styles.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-view/utils.js.map +1 -1
- package/lib/module/views/w3m-swap-view/index.js +14 -24
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/styles.js +5 -1
- package/lib/module/views/w3m-swap-view/styles.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 +3 -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/module/views/w3m-wallet-send-view/index.js +6 -14
- package/lib/module/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-view/styles.js +3 -0
- package/lib/module/views/w3m-wallet-send-view/styles.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +6 -25
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +3 -2
- package/lib/typescript/AppKitContext.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts +4 -3
- package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
- package/lib/typescript/hooks/useProvider.d.ts +28 -1
- package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
- package/lib/typescript/hooks/useRouteTransition.d.ts +16 -0
- package/lib/typescript/hooks/useRouteTransition.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-account-button/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/styles.d.ts +0 -4
- package/lib/typescript/modal/w3m-modal/styles.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-network-button/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/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-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-header/index.d.ts +1 -1
- package/lib/typescript/partials/w3m-connecting-header/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/partials/w3m-header/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-information-modal/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-information-modal/styles.d.ts +2 -0
- package/lib/typescript/partials/w3m-information-modal/styles.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-selector-modal/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-selector-modal/styles.d.ts +1 -0
- package/lib/typescript/partials/w3m-selector-modal/styles.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-swap-input/index.d.ts +1 -1
- package/lib/typescript/partials/w3m-swap-input/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +156 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils/HelpersUtil.d.ts +3 -3
- package/lib/typescript/utils/HelpersUtil.d.ts.map +1 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +1 -2
- package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
- package/lib/typescript/utils/RouterUtil.d.ts +9 -0
- package/lib/typescript/utils/RouterUtil.d.ts.map +1 -0
- package/lib/typescript/utils/UiUtil.d.ts +2 -6
- 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-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/components/custom-wallet-list.d.ts +1 -1
- package/lib/typescript/views/w3m-connect-view/components/custom-wallet-list.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-view/components/recent-wallet-list.d.ts +1 -1
- package/lib/typescript/views/w3m-connect-view/components/recent-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-connect-view/utils.d.ts +1 -1
- package/lib/typescript/views/w3m-connect-view/utils.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-get-wallet-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-settings-view/components/Country.d.ts +1 -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-onramp-settings-view/utils.d.ts +1 -1
- package/lib/typescript/views/w3m-onramp-settings-view/utils.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/Currency.d.ts +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/Currency.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/Header.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/PaymentMethod.d.ts +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/PaymentMethod.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/Quote.d.ts +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/Quote.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/components/SelectPaymentModal.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/utils.d.ts +1 -1
- package/lib/typescript/views/w3m-onramp-view/utils.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-preview-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-preview-view/styles.d.ts +3 -0
- package/lib/typescript/views/w3m-swap-preview-view/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts +4 -2
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/styles.d.ts +0 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/styles.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/utils.d.ts +1 -1
- package/lib/typescript/views/w3m-swap-view/components/select-token-view/utils.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/styles.d.ts +5 -1
- package/lib/typescript/views/w3m-swap-view/styles.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/lib/typescript/views/w3m-wallet-send-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-view/styles.d.ts +3 -0
- package/lib/typescript/views/w3m-wallet-send-view/styles.d.ts.map +1 -1
- package/package.json +5 -6
- package/src/AppKit.ts +87 -110
- package/src/AppKitContext.tsx +2 -2
- package/src/connectors/WalletConnectConnector.ts +20 -5
- package/src/hooks/useAppKitEvents.ts +2 -5
- package/src/hooks/useProvider.ts +30 -9
- package/src/hooks/useRouteTransition.ts +95 -0
- package/src/index.ts +1 -0
- package/src/modal/w3m-account-button/index.tsx +3 -2
- package/src/modal/w3m-modal/index.tsx +12 -39
- package/src/modal/w3m-modal/styles.ts +0 -4
- package/src/modal/w3m-network-button/index.tsx +2 -1
- package/src/modal/w3m-router/index.tsx +17 -2
- package/src/partials/w3m-account-activity/index.tsx +9 -8
- package/src/partials/w3m-account-tokens/index.tsx +4 -3
- package/src/partials/w3m-account-wallet-features/index.tsx +6 -6
- package/src/partials/w3m-all-wallets-list/index.tsx +2 -2
- package/src/partials/w3m-all-wallets-search/index.tsx +2 -6
- package/src/partials/w3m-connecting-body/index.tsx +2 -2
- package/src/partials/w3m-connecting-header/index.tsx +1 -1
- package/src/partials/w3m-connecting-mobile/index.tsx +13 -14
- package/src/partials/w3m-connecting-qrcode/index.tsx +18 -14
- package/src/partials/w3m-connecting-web/index.tsx +11 -13
- package/src/partials/w3m-header/index.tsx +4 -15
- package/src/partials/w3m-information-modal/index.tsx +28 -32
- package/src/partials/w3m-information-modal/styles.ts +7 -5
- package/src/partials/w3m-placeholder/index.tsx +8 -8
- package/src/partials/w3m-selector-modal/index.tsx +64 -68
- package/src/partials/w3m-selector-modal/styles.ts +1 -0
- package/src/partials/w3m-send-input-token/index.tsx +2 -2
- package/src/partials/w3m-swap-input/index.tsx +3 -4
- package/src/types.ts +187 -0
- package/src/utils/HelpersUtil.ts +3 -2
- package/src/utils/NetworkUtil.ts +1 -1
- package/src/utils/RouterUtil.ts +50 -0
- package/src/utils/UiUtil.ts +13 -29
- package/src/views/w3m-account-default-view/components/auth-buttons.tsx +2 -2
- package/src/views/w3m-account-default-view/index.tsx +25 -24
- package/src/views/w3m-account-view/index.tsx +2 -1
- package/src/views/w3m-all-wallets-view/index.tsx +6 -11
- package/src/views/w3m-connect-view/components/all-wallet-list.tsx +4 -4
- package/src/views/w3m-connect-view/components/custom-wallet-list.tsx +4 -4
- package/src/views/w3m-connect-view/components/recent-wallet-list.tsx +3 -7
- package/src/views/w3m-connect-view/components/social-login-list.tsx +4 -4
- package/src/views/w3m-connect-view/index.tsx +12 -13
- package/src/views/w3m-connect-view/utils.ts +1 -1
- package/src/views/w3m-connecting-external-view/index.tsx +9 -10
- package/src/views/w3m-connecting-siwe-view/index.tsx +5 -11
- package/src/views/w3m-connecting-social-view/index.tsx +10 -12
- package/src/views/w3m-connecting-view/index.tsx +10 -10
- package/src/views/w3m-get-wallet-view/index.tsx +2 -1
- package/src/views/w3m-network-switch-view/index.tsx +10 -8
- package/src/views/w3m-networks-view/index.tsx +6 -11
- package/src/views/w3m-onramp-checkout-view/index.tsx +17 -16
- package/src/views/w3m-onramp-settings-view/components/Country.tsx +6 -4
- package/src/views/w3m-onramp-settings-view/index.tsx +6 -9
- package/src/views/w3m-onramp-settings-view/utils.ts +2 -5
- package/src/views/w3m-onramp-transaction-view/index.tsx +6 -6
- package/src/views/w3m-onramp-view/components/Currency.tsx +3 -3
- package/src/views/w3m-onramp-view/components/CurrencyInput.tsx +2 -2
- package/src/views/w3m-onramp-view/components/Header.tsx +4 -6
- package/src/views/w3m-onramp-view/components/PaymentButton.tsx +4 -4
- package/src/views/w3m-onramp-view/components/PaymentMethod.tsx +4 -3
- package/src/views/w3m-onramp-view/components/Quote.tsx +4 -5
- package/src/views/w3m-onramp-view/components/SelectPaymentModal.tsx +51 -61
- package/src/views/w3m-onramp-view/index.tsx +8 -4
- package/src/views/w3m-swap-preview-view/index.tsx +4 -23
- package/src/views/w3m-swap-preview-view/styles.ts +3 -0
- package/src/views/w3m-swap-view/components/select-token-view/index.tsx +17 -7
- package/src/views/w3m-swap-view/components/select-token-view/styles.ts +1 -2
- package/src/views/w3m-swap-view/components/select-token-view/utils.ts +2 -1
- package/src/views/w3m-swap-view/index.tsx +12 -26
- package/src/views/w3m-swap-view/styles.ts +5 -1
- package/src/views/w3m-unsupported-chain-view/index.tsx +4 -5
- package/src/views/w3m-wallet-compatible-networks-view/index.tsx +3 -2
- package/src/views/w3m-wallet-receive-view/index.tsx +6 -2
- package/src/views/w3m-wallet-send-preview-view/components/preview-send-details.tsx +2 -2
- package/src/views/w3m-wallet-send-select-token-view/index.tsx +2 -1
- package/src/views/w3m-wallet-send-view/index.tsx +5 -10
- package/src/views/w3m-wallet-send-view/styles.ts +3 -0
- package/lib/commonjs/config/animations.js +0 -9
- package/lib/commonjs/config/animations.js.map +0 -1
- package/lib/commonjs/partials/w3m-otp-code/index.js +0 -89
- package/lib/commonjs/partials/w3m-otp-code/index.js.map +0 -1
- package/lib/commonjs/partials/w3m-otp-code/styles.js +0 -21
- package/lib/commonjs/partials/w3m-otp-code/styles.js.map +0 -1
- package/lib/module/config/animations.js +0 -9
- package/lib/module/config/animations.js.map +0 -1
- package/lib/module/partials/w3m-otp-code/index.js +0 -84
- package/lib/module/partials/w3m-otp-code/index.js.map +0 -1
- package/lib/module/partials/w3m-otp-code/styles.js +0 -17
- package/lib/module/partials/w3m-otp-code/styles.js.map +0 -1
- package/lib/typescript/config/animations.d.ts +0 -2
- package/lib/typescript/config/animations.d.ts.map +0 -1
- package/lib/typescript/partials/w3m-otp-code/index.d.ts +0 -16
- package/lib/typescript/partials/w3m-otp-code/index.d.ts.map +0 -1
- package/lib/typescript/partials/w3m-otp-code/styles.d.ts +0 -14
- package/lib/typescript/partials/w3m-otp-code/styles.d.ts.map +0 -1
- package/src/config/animations.ts +0 -7
- package/src/partials/w3m-otp-code/index.tsx +0 -81
- package/src/partials/w3m-otp-code/styles.ts +0 -15
package/src/AppKit.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type Features,
|
|
3
2
|
EventsController,
|
|
4
3
|
ModalController,
|
|
5
4
|
ConnectionsController,
|
|
@@ -7,9 +6,8 @@ import {
|
|
|
7
6
|
RouterController,
|
|
8
7
|
TransactionsController,
|
|
9
8
|
StorageUtil,
|
|
10
|
-
type OptionsControllerState,
|
|
11
9
|
ThemeController,
|
|
12
|
-
|
|
10
|
+
WcController,
|
|
13
11
|
SwapController,
|
|
14
12
|
OnRampController,
|
|
15
13
|
CoreHelperUtil,
|
|
@@ -23,18 +21,12 @@ import {
|
|
|
23
21
|
type ProposalNamespaces,
|
|
24
22
|
type ConnectorType,
|
|
25
23
|
type Namespaces,
|
|
26
|
-
type Metadata,
|
|
27
24
|
type CaipNetworkId,
|
|
28
25
|
type AppKitNetwork,
|
|
29
26
|
type Provider,
|
|
30
|
-
type ThemeVariables,
|
|
31
|
-
type ThemeMode,
|
|
32
27
|
type WalletInfo,
|
|
33
|
-
type Network,
|
|
34
28
|
type ChainNamespace,
|
|
35
|
-
type Storage,
|
|
36
29
|
type AppKitConnectOptions,
|
|
37
|
-
type AppKitSIWEClient,
|
|
38
30
|
type ConnectionProperties,
|
|
39
31
|
type AccountType,
|
|
40
32
|
type AppKitOpenOptions,
|
|
@@ -46,29 +38,8 @@ import { SIWEController } from '@reown/appkit-siwe-react-native';
|
|
|
46
38
|
import { WalletConnectConnector } from './connectors/WalletConnectConnector';
|
|
47
39
|
import { WcHelpersUtil } from './utils/HelpersUtil';
|
|
48
40
|
import { NetworkUtil } from './utils/NetworkUtil';
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
projectId: string;
|
|
52
|
-
metadata: Metadata;
|
|
53
|
-
adapters: BlockchainAdapter[];
|
|
54
|
-
networks: Network[];
|
|
55
|
-
storage: Storage;
|
|
56
|
-
extraConnectors?: WalletConnector[];
|
|
57
|
-
clipboardClient?: OptionsControllerState['clipboardClient'];
|
|
58
|
-
includeWalletIds?: OptionsControllerState['includeWalletIds'];
|
|
59
|
-
excludeWalletIds?: OptionsControllerState['excludeWalletIds'];
|
|
60
|
-
featuredWalletIds?: OptionsControllerState['featuredWalletIds'];
|
|
61
|
-
customWallets?: OptionsControllerState['customWallets'];
|
|
62
|
-
tokens?: OptionsControllerState['tokens']; //TODO: check if needed in OptionsController
|
|
63
|
-
enableAnalytics?: OptionsControllerState['enableAnalytics'];
|
|
64
|
-
debug?: OptionsControllerState['debug'];
|
|
65
|
-
themeMode?: ThemeMode;
|
|
66
|
-
themeVariables?: ThemeVariables;
|
|
67
|
-
siweConfig?: AppKitSIWEClient;
|
|
68
|
-
defaultNetwork?: Network;
|
|
69
|
-
features?: Features;
|
|
70
|
-
// chainImages?: Record<number, string>; //TODO: rename to networkImages
|
|
71
|
-
}
|
|
41
|
+
import { RouterUtil } from './utils/RouterUtil';
|
|
42
|
+
import { type AppKitConfig } from './types';
|
|
72
43
|
|
|
73
44
|
export class AppKit {
|
|
74
45
|
private projectId: string;
|
|
@@ -114,7 +85,10 @@ export class AppKit {
|
|
|
114
85
|
});
|
|
115
86
|
|
|
116
87
|
this.networks = networksWithAdapters;
|
|
117
|
-
this.namespaces = WcHelpersUtil.createNamespaces(
|
|
88
|
+
this.namespaces = WcHelpersUtil.createNamespaces(
|
|
89
|
+
this.networks,
|
|
90
|
+
config.universalProviderConfigOverride
|
|
91
|
+
) as ProposalNamespaces;
|
|
118
92
|
this.config = config;
|
|
119
93
|
this.extraConnectors = config.extraConnectors || [];
|
|
120
94
|
|
|
@@ -143,47 +117,59 @@ export class AppKit {
|
|
|
143
117
|
siweConfig: this.config?.siweConfig
|
|
144
118
|
});
|
|
145
119
|
|
|
146
|
-
|
|
147
|
-
const properties = connector.getProperties();
|
|
120
|
+
this.processConnection(connector, approvedNamespaces);
|
|
148
121
|
|
|
149
|
-
|
|
150
|
-
|
|
122
|
+
// Save connector type and namespaces in storage
|
|
123
|
+
if (approvedNamespaces && Object.keys(approvedNamespaces).length > 0) {
|
|
124
|
+
await StorageUtil.setConnectedConnectors({
|
|
125
|
+
type: connector.type,
|
|
126
|
+
namespaces: Object.keys(approvedNamespaces)
|
|
127
|
+
});
|
|
151
128
|
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.warn('Connection failed:', error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
152
134
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
135
|
+
private processConnection(
|
|
136
|
+
connector: WalletConnector,
|
|
137
|
+
namespaces?: Namespaces,
|
|
138
|
+
shouldCloseModal: boolean = true
|
|
139
|
+
) {
|
|
140
|
+
if (!namespaces || Object.keys(namespaces).length === 0) {
|
|
141
|
+
throw new Error('No namespaces provided');
|
|
142
|
+
}
|
|
158
143
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
//TODO: handle case where devs want to connect to a namespace that has no adapters. Could use the provider directly.
|
|
162
|
-
throw new Error('No compatible adapters found for the approved namespaces');
|
|
163
|
-
}
|
|
144
|
+
const walletInfo = connector.getWalletInfo();
|
|
145
|
+
const properties = connector.getProperties();
|
|
164
146
|
|
|
165
|
-
|
|
166
|
-
this.setConnection(approvedAdapters, approvedNamespaces, walletInfo, properties);
|
|
147
|
+
const initializedAdapters = this.setupAdaptersAndSubscribe(connector, Object.keys(namespaces));
|
|
167
148
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
type: connector.type,
|
|
171
|
-
namespaces: Object.keys(approvedNamespaces)
|
|
172
|
-
});
|
|
149
|
+
if (initializedAdapters.length === 0) {
|
|
150
|
+
console.warn('No compatible adapters found for namespaces:', Object.keys(namespaces));
|
|
173
151
|
|
|
174
|
-
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
175
154
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
155
|
+
// Store the connection details
|
|
156
|
+
this.setConnection(initializedAdapters, namespaces, walletInfo, properties);
|
|
157
|
+
|
|
158
|
+
// Sync accounts
|
|
159
|
+
this.syncAccounts(initializedAdapters);
|
|
160
|
+
|
|
161
|
+
// Handle SIWE if enabled
|
|
162
|
+
this.handleSiweConnectionIfEnabled(shouldCloseModal);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private handleSiweConnectionIfEnabled(shouldCloseModal: boolean = true): void {
|
|
166
|
+
if (
|
|
167
|
+
OptionsController.state.isSiweEnabled &&
|
|
168
|
+
ConnectionsController.state.activeNamespace === 'eip155'
|
|
169
|
+
) {
|
|
170
|
+
this.handleSiweChange({ isConnection: true });
|
|
171
|
+
} else if (shouldCloseModal) {
|
|
172
|
+
ModalController.close();
|
|
187
173
|
}
|
|
188
174
|
}
|
|
189
175
|
|
|
@@ -218,7 +204,7 @@ export class AppKit {
|
|
|
218
204
|
SwapController.resetState();
|
|
219
205
|
SendController.resetState();
|
|
220
206
|
OnRampController.resetState();
|
|
221
|
-
|
|
207
|
+
WcController.resetState();
|
|
222
208
|
|
|
223
209
|
if (ConnectionsController.state.activeNamespace === undefined) {
|
|
224
210
|
ConnectionsController.setActiveNamespace(
|
|
@@ -296,8 +282,33 @@ export class AppKit {
|
|
|
296
282
|
ModalController.open(options);
|
|
297
283
|
}
|
|
298
284
|
|
|
299
|
-
close() {
|
|
285
|
+
async close() {
|
|
300
286
|
ModalController.close();
|
|
287
|
+
|
|
288
|
+
if (OptionsController.state.isSiweEnabled && ConnectionsController.state.isConnected) {
|
|
289
|
+
const session = await SIWEController.getSession();
|
|
290
|
+
if (
|
|
291
|
+
!session &&
|
|
292
|
+
SIWEController.state.status !== 'success' &&
|
|
293
|
+
ConnectionsController.state.activeNamespace === 'eip155' &&
|
|
294
|
+
!!ConnectionsController.state.activeAddress
|
|
295
|
+
) {
|
|
296
|
+
await this.disconnect();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
RouterUtil.checkOnRampBack();
|
|
301
|
+
RouterUtil.checkSocialLoginBack();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
back() {
|
|
305
|
+
if (RouterController.state.history.length > 1) {
|
|
306
|
+
RouterUtil.checkBack();
|
|
307
|
+
|
|
308
|
+
return RouterController.goBack();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return this.close();
|
|
301
312
|
}
|
|
302
313
|
|
|
303
314
|
async switchAccountType(namespace: ChainNamespace, type: AccountType, network: AppKitNetwork) {
|
|
@@ -357,13 +368,12 @@ export class AppKit {
|
|
|
357
368
|
return this.walletConnectConnector;
|
|
358
369
|
}
|
|
359
370
|
|
|
360
|
-
//TODO: reuse logic with connect method
|
|
361
371
|
/**
|
|
362
372
|
* Initializes connectors based on stored connection data.
|
|
363
373
|
* This attempts to restore previous sessions.
|
|
364
374
|
*/
|
|
365
375
|
private async initConnectors() {
|
|
366
|
-
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
376
|
+
const connectedConnectors = await StorageUtil.getConnectedConnectors();
|
|
367
377
|
if (connectedConnectors.length > 0) {
|
|
368
378
|
ModalController.setLoading(true);
|
|
369
379
|
|
|
@@ -372,31 +382,8 @@ export class AppKit {
|
|
|
372
382
|
const connector = await this.createConnector(connected.type);
|
|
373
383
|
|
|
374
384
|
const namespaces = connector.getNamespaces();
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (namespaces && Object.keys(namespaces).length > 0) {
|
|
379
|
-
// Ensure namespaces is not empty
|
|
380
|
-
// Setup adapters and subscribe to events
|
|
381
|
-
const initializedAdapters = this.setupAdaptersAndSubscribe(
|
|
382
|
-
connector,
|
|
383
|
-
Object.keys(namespaces)
|
|
384
|
-
);
|
|
385
|
-
|
|
386
|
-
// If adapters were successfully initialized, store the connection details
|
|
387
|
-
if (initializedAdapters.length > 0) {
|
|
388
|
-
this.setConnection(initializedAdapters, namespaces, walletInfo, properties);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
this.syncAccounts(initializedAdapters);
|
|
392
|
-
|
|
393
|
-
if (
|
|
394
|
-
OptionsController.state.isSiweEnabled &&
|
|
395
|
-
ConnectionsController.state.activeNamespace === 'eip155'
|
|
396
|
-
) {
|
|
397
|
-
this.handleSiweChange({ isConnection: true });
|
|
398
|
-
}
|
|
399
|
-
}
|
|
385
|
+
|
|
386
|
+
this.processConnection(connector, namespaces, false);
|
|
400
387
|
} catch (error) {
|
|
401
388
|
// Use console.warn for non-critical initialization failures
|
|
402
389
|
console.warn(`Failed to initialize connector type ${connected.type}:`, error);
|
|
@@ -423,7 +410,7 @@ export class AppKit {
|
|
|
423
410
|
}
|
|
424
411
|
|
|
425
412
|
adapters.forEach(adapter => {
|
|
426
|
-
adapter.
|
|
413
|
+
adapter.init({ connector });
|
|
427
414
|
this.subscribeToAdapterEvents(adapter);
|
|
428
415
|
});
|
|
429
416
|
|
|
@@ -543,9 +530,7 @@ export class AppKit {
|
|
|
543
530
|
private subscribeToAdapterEvents(adapter: BlockchainAdapter): void {
|
|
544
531
|
adapter.on('accountsChanged', ({ accounts }) => {
|
|
545
532
|
const namespace = adapter.getSupportedNamespace();
|
|
546
|
-
|
|
547
|
-
console.log('accountsChanged', accounts, namespace);
|
|
548
|
-
//TODO: check this
|
|
533
|
+
ConnectionsController.updateAccounts(namespace, accounts);
|
|
549
534
|
|
|
550
535
|
if (namespace === 'eip155') {
|
|
551
536
|
this.handleSiweChange({ isAccountChange: true });
|
|
@@ -579,7 +564,6 @@ export class AppKit {
|
|
|
579
564
|
this.disconnect(namespace, false);
|
|
580
565
|
});
|
|
581
566
|
|
|
582
|
-
//TODO: Add types to this events
|
|
583
567
|
adapter.on('balanceChanged', ({ address, balance }) => {
|
|
584
568
|
//eslint-disable-next-line no-console
|
|
585
569
|
console.log('balanceChanged', address, balance);
|
|
@@ -597,7 +581,6 @@ export class AppKit {
|
|
|
597
581
|
this.setExcludedWallets(options);
|
|
598
582
|
this.setCustomWallets(options);
|
|
599
583
|
OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
|
|
600
|
-
OptionsController.setTokens(options.tokens);
|
|
601
584
|
OptionsController.setEnableAnalytics(options.enableAnalytics);
|
|
602
585
|
OptionsController.setDebug(options.debug);
|
|
603
586
|
OptionsController.setFeatures(options.features);
|
|
@@ -645,8 +628,6 @@ export class AppKit {
|
|
|
645
628
|
|
|
646
629
|
private async initRecentWallets(options: AppKitConfig) {
|
|
647
630
|
const wallets = await StorageUtil.getRecentWallets();
|
|
648
|
-
const connectedWalletImage = await StorageUtil.getConnectedWalletImageUrl();
|
|
649
|
-
|
|
650
631
|
const filteredWallets = wallets.filter(wallet => {
|
|
651
632
|
const { includeWalletIds, excludeWalletIds } = options;
|
|
652
633
|
if (includeWalletIds) {
|
|
@@ -659,11 +640,7 @@ export class AppKit {
|
|
|
659
640
|
return true;
|
|
660
641
|
});
|
|
661
642
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
if (connectedWalletImage) {
|
|
665
|
-
ConnectionController.setConnectedWalletImageUrl(connectedWalletImage);
|
|
666
|
-
}
|
|
643
|
+
WcController.setRecentWallets(filteredWallets);
|
|
667
644
|
}
|
|
668
645
|
|
|
669
646
|
private setExcludedWallets(options: AppKitConfig) {
|
|
@@ -673,7 +650,7 @@ export class AppKit {
|
|
|
673
650
|
const excludeCoinbase = !this.extraConnectors.some(connector => connector.type === 'coinbase');
|
|
674
651
|
|
|
675
652
|
if (excludeCoinbase) {
|
|
676
|
-
excludedWallets.push(ConstantsUtil.
|
|
653
|
+
excludedWallets.push(ConstantsUtil.COINBASE_CUSTOM_WALLET.id);
|
|
677
654
|
}
|
|
678
655
|
|
|
679
656
|
OptionsController.setExcludeWalletIds(excludedWallets);
|
|
@@ -743,7 +720,7 @@ export class AppKit {
|
|
|
743
720
|
// If it's connected but there's no session, show sign view
|
|
744
721
|
return this.onSiweNavigation();
|
|
745
722
|
} else if (isConnection) {
|
|
746
|
-
//Connected with 1CA
|
|
723
|
+
// Connected with 1CA
|
|
747
724
|
ModalController.close();
|
|
748
725
|
}
|
|
749
726
|
}
|
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');
|
|
@@ -32,6 +31,7 @@ export const useAppKit = () => {
|
|
|
32
31
|
disconnect: context.appKit.disconnect.bind(context.appKit),
|
|
33
32
|
open: context.appKit.open.bind(context.appKit),
|
|
34
33
|
close: context.appKit.close.bind(context.appKit),
|
|
34
|
+
back: context.appKit.back.bind(context.appKit),
|
|
35
35
|
switchNetwork: context.appKit.switchNetwork.bind(context.appKit),
|
|
36
36
|
getProvider: context.appKit.getProvider.bind(context.appKit),
|
|
37
37
|
switchAccountType: context.appKit.switchAccountType.bind(context.appKit)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WcController } from '@reown/appkit-core-react-native';
|
|
2
2
|
import { UniversalProvider, type IUniversalProvider } from '@walletconnect/universal-provider';
|
|
3
3
|
import {
|
|
4
4
|
WalletConnector,
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
type ConnectOptions,
|
|
12
12
|
type ConnectorInitOptions,
|
|
13
13
|
type Metadata,
|
|
14
|
-
type ConnectionProperties
|
|
14
|
+
type ConnectionProperties,
|
|
15
|
+
type RequestArguments
|
|
15
16
|
} from '@reown/appkit-common-react-native';
|
|
16
17
|
import { getDidAddress, getDidChainId, SIWEController } from '@reown/appkit-siwe-react-native';
|
|
17
18
|
|
|
@@ -95,7 +96,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
95
96
|
override async connect(opts: ConnectOptions) {
|
|
96
97
|
const { siweConfig, namespaces, defaultChain, universalLink } = opts;
|
|
97
98
|
function onUri(uri: string) {
|
|
98
|
-
|
|
99
|
+
WcController.setWcUri(uri);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
const provider = this.getProvider() as IUniversalProvider;
|
|
@@ -201,11 +202,25 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
201
202
|
return this.namespaces;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
override getProvider(): Provider {
|
|
205
|
+
override getProvider(namespace?: ChainNamespace): Provider {
|
|
205
206
|
if (!this.provider) {
|
|
206
207
|
throw new Error('WalletConnectConnector: Provider not initialized. Call init() first.');
|
|
207
208
|
}
|
|
208
209
|
|
|
210
|
+
const provider = this.provider as IUniversalProvider;
|
|
211
|
+
|
|
212
|
+
if (namespace) {
|
|
213
|
+
const _chainId = this.getChainId(namespace);
|
|
214
|
+
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
return {
|
|
217
|
+
...provider,
|
|
218
|
+
request: (args: RequestArguments, chainId?: CaipNetworkId) => {
|
|
219
|
+
return provider.request(args, chainId || _chainId);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
209
224
|
return this.provider;
|
|
210
225
|
}
|
|
211
226
|
|
|
@@ -238,7 +253,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
238
253
|
|
|
239
254
|
const chainId = (this.provider as IUniversalProvider).rpcProviders[
|
|
240
255
|
namespace
|
|
241
|
-
]?.getDefaultChain();
|
|
256
|
+
]?.getDefaultChain?.();
|
|
242
257
|
|
|
243
258
|
if (!chainId) {
|
|
244
259
|
return undefined;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type EventName,
|
|
6
|
-
type EventsControllerState
|
|
7
|
-
} from '@reown/appkit-core-react-native';
|
|
3
|
+
import { EventsController, type EventsControllerState } from '@reown/appkit-core-react-native';
|
|
4
|
+
import { type EventName } from '@reown/appkit-common-react-native';
|
|
8
5
|
import { useAppKit } from './useAppKit';
|
|
9
6
|
|
|
10
7
|
export function useAppKitEvents(callback?: (newEvent: EventsControllerState) => void) {
|
package/src/hooks/useProvider.ts
CHANGED
|
@@ -2,24 +2,45 @@ import { useSnapshot } from 'valtio';
|
|
|
2
2
|
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
3
|
import type { Provider, ChainNamespace } from '@reown/appkit-common-react-native';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Interface representing the result of the useProvider hook
|
|
7
|
+
*/
|
|
5
8
|
interface ProviderResult {
|
|
9
|
+
/** The active connection provider instance */
|
|
6
10
|
provider?: Provider;
|
|
11
|
+
/** The chain namespace supported by the provider */
|
|
7
12
|
providerType?: ChainNamespace;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Hook that returns the active connection provider and its supported chain namespace.
|
|
17
|
+
*
|
|
18
|
+
* This hook accesses the current connection and returns the provider instance along with its supported namespace.
|
|
19
|
+
*
|
|
20
|
+
* @returns {ProviderResult} An object containing:
|
|
21
|
+
* - `provider`: The active connection provider instance, or undefined if no connection exists
|
|
22
|
+
* - `providerType`: The chain namespace supported by the provider, or undefined if no connection exists
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const { provider, providerType } = useProvider();
|
|
27
|
+
*
|
|
28
|
+
* if (provider) {
|
|
29
|
+
* // Use the provider for blockchain operations
|
|
30
|
+
* const balance = await provider.request({
|
|
31
|
+
* method: 'eth_getBalance',
|
|
32
|
+
* params: [address, 'latest']
|
|
33
|
+
* });
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function useProvider(): ProviderResult {
|
|
38
|
+
const { connection } = useSnapshot(ConnectionsController.state);
|
|
18
39
|
|
|
19
40
|
if (!connection) return { provider: undefined, providerType: undefined };
|
|
20
41
|
|
|
21
42
|
return {
|
|
22
|
-
provider: connection.adapter.
|
|
43
|
+
provider: connection.adapter.getProvider(),
|
|
23
44
|
providerType: connection.adapter.getSupportedNamespace()
|
|
24
45
|
};
|
|
25
46
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
2
|
+
import { Animated, Dimensions } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const { width: screenWidth } = Dimensions.get('window');
|
|
5
|
+
|
|
6
|
+
export interface RouteTransitionConfig {
|
|
7
|
+
duration?: number;
|
|
8
|
+
useNativeDriver?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function useRouteTransition(config: RouteTransitionConfig = {}) {
|
|
12
|
+
const { duration = 300, useNativeDriver = true } = config;
|
|
13
|
+
|
|
14
|
+
const fadeAnim = useRef(new Animated.Value(1)).current;
|
|
15
|
+
const slideAnim = useRef(new Animated.Value(0)).current;
|
|
16
|
+
const isAnimating = useRef(false);
|
|
17
|
+
const currentAnimation = useRef<Animated.CompositeAnimation | null>(null);
|
|
18
|
+
|
|
19
|
+
const animateTransition = useCallback(
|
|
20
|
+
(direction: 'forward' | 'backward' | 'none') => {
|
|
21
|
+
if (isAnimating.current || direction === 'none') {
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (currentAnimation.current) {
|
|
26
|
+
currentAnimation.current.stop();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
isAnimating.current = true;
|
|
30
|
+
|
|
31
|
+
return new Promise<void>(resolve => {
|
|
32
|
+
const startPosition =
|
|
33
|
+
direction === 'forward'
|
|
34
|
+
? screenWidth * 0.02 // Start from right for forward
|
|
35
|
+
: -screenWidth * 0.02; // Start from left for backward
|
|
36
|
+
|
|
37
|
+
// Immediately set starting position and fade out
|
|
38
|
+
fadeAnim.setValue(0);
|
|
39
|
+
slideAnim.setValue(startPosition);
|
|
40
|
+
|
|
41
|
+
// Animate to final position with fade in
|
|
42
|
+
const animation = Animated.parallel([
|
|
43
|
+
Animated.timing(fadeAnim, {
|
|
44
|
+
toValue: 1,
|
|
45
|
+
duration,
|
|
46
|
+
useNativeDriver
|
|
47
|
+
}),
|
|
48
|
+
Animated.timing(slideAnim, {
|
|
49
|
+
toValue: 0, // Slide to center
|
|
50
|
+
duration,
|
|
51
|
+
useNativeDriver
|
|
52
|
+
})
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
currentAnimation.current = animation;
|
|
56
|
+
|
|
57
|
+
animation.start(({ finished }) => {
|
|
58
|
+
if (finished) {
|
|
59
|
+
isAnimating.current = false;
|
|
60
|
+
currentAnimation.current = null;
|
|
61
|
+
resolve();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
[fadeAnim, slideAnim, duration, useNativeDriver]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const getAnimatedStyle = useCallback(
|
|
70
|
+
() => ({
|
|
71
|
+
opacity: fadeAnim,
|
|
72
|
+
transform: [{ translateX: slideAnim }]
|
|
73
|
+
}),
|
|
74
|
+
[fadeAnim, slideAnim]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
fadeAnim.setValue(1);
|
|
79
|
+
slideAnim.setValue(0);
|
|
80
|
+
|
|
81
|
+
return () => {
|
|
82
|
+
if (currentAnimation.current) {
|
|
83
|
+
currentAnimation.current.stop();
|
|
84
|
+
currentAnimation.current = null;
|
|
85
|
+
}
|
|
86
|
+
isAnimating.current = false;
|
|
87
|
+
};
|
|
88
|
+
}, [fadeAnim, slideAnim]);
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
animateTransition,
|
|
92
|
+
getAnimatedStyle,
|
|
93
|
+
isAnimating: isAnimating.current
|
|
94
|
+
};
|
|
95
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { AppKit } from './modal/w3m-modal';
|
|
|
17
17
|
/********** Types **********/
|
|
18
18
|
export type * from '@reown/appkit-core-react-native';
|
|
19
19
|
export type { AppKitNetwork, Storage } from '@reown/appkit-common-react-native';
|
|
20
|
+
export type { AppKitConfig } from './types';
|
|
20
21
|
|
|
21
22
|
/****** Hooks *******/
|
|
22
23
|
export { useAppKit } from './hooks/useAppKit';
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
ModalController,
|
|
6
6
|
ThemeController,
|
|
7
7
|
ConnectionsController,
|
|
8
|
-
AssetController
|
|
8
|
+
AssetController,
|
|
9
|
+
AssetUtil
|
|
9
10
|
} from '@reown/appkit-core-react-native';
|
|
10
11
|
import { AccountButton as AccountButtonUI, ThemeProvider } from '@reown/appkit-ui-react-native';
|
|
11
12
|
|
|
@@ -26,7 +27,7 @@ export function AccountButton({ balance, disabled, style, testID }: AccountButto
|
|
|
26
27
|
identity
|
|
27
28
|
} = useSnapshot(ConnectionsController.state);
|
|
28
29
|
|
|
29
|
-
const networkImage = activeNetwork
|
|
30
|
+
const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
|
|
30
31
|
const showBalance = balance === 'show';
|
|
31
32
|
|
|
32
33
|
return (
|