@web3auth/no-modal 10.0.0-beta.1 → 10.0.0-beta.10
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/dist/lib.cjs/base/connector/baseConnector.js +2 -1
- package/dist/lib.cjs/base/connector/constants.js +3 -1
- package/dist/lib.cjs/base/constants.js +7 -0
- package/dist/lib.cjs/base/cookie.js +38 -0
- package/dist/lib.cjs/base/deserialize.js +13 -0
- package/dist/lib.cjs/base/errors/index.js +3 -22
- package/dist/lib.cjs/base/utils.js +24 -6
- package/dist/lib.cjs/base/wallet/index.js +2 -4
- package/dist/lib.cjs/connectors/auth-connector/authConnector.js +63 -20
- package/dist/lib.cjs/connectors/coinbase-connector/coinbaseConnector.js +13 -5
- package/dist/lib.cjs/connectors/coinbase-connector/index.js +7 -0
- package/dist/lib.cjs/connectors/injected-evm-connector/injectedEvmConnector.js +7 -3
- package/dist/lib.cjs/connectors/injected-solana-connector/walletStandardConnector.js +7 -4
- package/dist/lib.cjs/connectors/metamask-connector/metamaskConnector.js +43 -15
- package/dist/lib.cjs/connectors/utils.js +10 -0
- package/dist/lib.cjs/connectors/wallet-connect-v2-connector/config.js +6 -1
- package/dist/lib.cjs/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +6 -2
- package/dist/lib.cjs/index.js +13 -9
- package/dist/lib.cjs/noModal.js +190 -69
- package/dist/lib.cjs/plugins/nft-checkout-plugin/plugin.js +2 -2
- package/dist/lib.cjs/plugins/wallet-services-plugin/plugin.js +1 -1
- package/dist/lib.cjs/providers/account-abstraction-provider/index.js +5 -0
- package/dist/lib.cjs/providers/account-abstraction-provider/providers/AccountAbstractionProvider.js +29 -2
- package/dist/lib.cjs/providers/account-abstraction-provider/rpc/ethRpcMiddlewares.js +25 -3
- package/dist/lib.cjs/providers/base-provider/baseProvider.js +2 -0
- package/dist/lib.cjs/providers/ethereum-mpc-provider/index.js +7 -0
- package/dist/lib.cjs/providers/xrpl-provider/index.js +9 -0
- package/dist/lib.cjs/react/Web3AuthProvider.js +19 -0
- package/dist/lib.cjs/react/{wallet-services-plugin/WalletServicesContext.js → context/WalletServicesInnerContext.js} +18 -33
- package/dist/lib.cjs/react/{no-modal → context}/Web3AuthInnerContext.js +37 -95
- package/dist/lib.cjs/react/hooks/useCheckout.js +45 -0
- package/dist/lib.cjs/react/hooks/useEnableMFA.js +30 -0
- package/dist/lib.cjs/react/hooks/useIdentityToken.js +42 -0
- package/dist/lib.cjs/react/hooks/useManageMFA.js +30 -0
- package/dist/lib.cjs/react/hooks/useSwap.js +45 -0
- package/dist/lib.cjs/react/hooks/useSwitchChain.js +32 -0
- package/dist/lib.cjs/react/hooks/useWalletConnectScanner.js +45 -0
- package/dist/lib.cjs/react/hooks/useWalletServicesPlugin.js +19 -0
- package/dist/lib.cjs/react/hooks/useWalletUI.js +45 -0
- package/dist/lib.cjs/react/hooks/useWeb3Auth.js +28 -0
- package/dist/lib.cjs/react/hooks/useWeb3AuthConnect.js +48 -0
- package/dist/lib.cjs/react/hooks/useWeb3AuthDisconnect.js +30 -0
- package/dist/lib.cjs/react/{no-modal/hooks/useWeb3Auth.js → hooks/useWeb3AuthInner.js} +9 -9
- package/dist/lib.cjs/react/hooks/useWeb3AuthUser.js +50 -0
- package/dist/lib.cjs/react/index.js +26 -9
- package/dist/lib.cjs/react/solana/hooks/useSignAndSendTransaction.js +35 -0
- package/dist/lib.cjs/react/solana/hooks/useSignMessage.js +36 -0
- package/dist/lib.cjs/react/solana/hooks/useSignTransaction.js +34 -0
- package/dist/lib.cjs/react/solana/hooks/useSolanaWallet.js +62 -0
- package/dist/lib.cjs/react/solana/index.js +13 -0
- package/dist/lib.cjs/react/wagmi/constants.js +16 -0
- package/dist/lib.cjs/react/wagmi/index.js +7 -0
- package/dist/lib.cjs/react/wagmi/provider.js +189 -0
- package/dist/lib.cjs/types/base/connector/baseConnector.d.ts +4 -5
- package/dist/lib.cjs/types/base/connector/constants.d.ts +2 -0
- package/dist/lib.cjs/types/base/connector/interfaces.d.ts +18 -16
- package/dist/lib.cjs/types/base/constants.d.ts +5 -0
- package/dist/lib.cjs/types/base/cookie.d.ts +10 -0
- package/dist/lib.cjs/types/base/core/IWeb3Auth.d.ts +40 -12
- package/dist/lib.cjs/types/base/deserialize.d.ts +3 -0
- package/dist/lib.cjs/types/base/errors/index.d.ts +1 -2
- package/dist/lib.cjs/types/base/hooks/index.d.ts +3 -23
- package/dist/lib.cjs/types/base/index.d.ts +1 -0
- package/dist/lib.cjs/types/base/interfaces.d.ts +9 -4
- package/dist/lib.cjs/types/base/plugin/IPlugin.d.ts +1 -1
- package/dist/lib.cjs/types/base/utils.d.ts +3 -1
- package/dist/lib.cjs/types/base/wallet/index.d.ts +18 -17
- package/dist/lib.cjs/types/connectors/auth-connector/authConnector.d.ts +5 -6
- package/dist/lib.cjs/types/connectors/auth-connector/interface.d.ts +3 -2
- package/dist/lib.cjs/types/connectors/coinbase-connector/coinbaseConnector.d.ts +1 -1
- package/dist/lib.cjs/types/connectors/index.d.ts +1 -1
- package/dist/lib.cjs/types/connectors/metamask-connector/index.d.ts +1 -1
- package/dist/lib.cjs/types/connectors/metamask-connector/metamaskConnector.d.ts +2 -2
- package/dist/lib.cjs/types/connectors/utils.d.ts +8 -0
- package/dist/lib.cjs/types/noModal.d.ts +20 -9
- package/dist/lib.cjs/types/plugins/nft-checkout-plugin/plugin.d.ts +2 -2
- package/dist/lib.cjs/types/plugins/wallet-services-plugin/plugin.d.ts +2 -2
- package/dist/lib.cjs/types/providers/account-abstraction-provider/providers/AccountAbstractionProvider.d.ts +3 -2
- package/dist/lib.cjs/types/providers/account-abstraction-provider/providers/smartAccounts/index.d.ts +1 -1
- package/dist/lib.cjs/types/providers/account-abstraction-provider/rpc/ethRpcMiddlewares.d.ts +4 -1
- package/dist/lib.cjs/types/providers/ethereum-mpc-provider/providers/signingProviders/EthereumSigningProvider.d.ts +1 -1
- package/dist/lib.cjs/types/providers/index.d.ts +0 -2
- package/dist/lib.cjs/types/providers/solana-provider/providers/injectedProviders/base/baseInjectedProvider.d.ts +1 -1
- package/dist/lib.cjs/types/providers/xrpl-provider/providers/privateKeyProviders/xrplPrivateKeyProvider.d.ts +1 -1
- package/dist/lib.cjs/types/react/context/WalletServicesInnerContext.d.ts +6 -0
- package/dist/lib.cjs/types/react/{no-modal → context}/Web3AuthInnerContext.d.ts +1 -1
- package/dist/lib.cjs/types/react/hooks/index.d.ts +13 -0
- package/dist/lib.cjs/types/react/hooks/useCheckout.d.ts +8 -0
- package/dist/lib.cjs/types/react/hooks/useEnableMFA.d.ts +7 -0
- package/dist/lib.cjs/types/react/hooks/useIdentityToken.d.ts +13 -0
- package/dist/lib.cjs/types/react/hooks/useManageMFA.d.ts +7 -0
- package/dist/lib.cjs/types/react/hooks/useSwap.d.ts +8 -0
- package/dist/lib.cjs/types/react/hooks/useSwitchChain.d.ts +7 -0
- package/dist/lib.cjs/types/react/hooks/useWalletConnectScanner.d.ts +8 -0
- package/dist/lib.cjs/types/react/hooks/useWalletUI.d.ts +8 -0
- package/dist/lib.cjs/types/react/hooks/useWeb3Auth.d.ts +3 -0
- package/dist/lib.cjs/types/react/hooks/useWeb3AuthConnect.d.ts +9 -0
- package/dist/lib.cjs/types/react/hooks/useWeb3AuthDisconnect.d.ts +9 -0
- package/dist/lib.cjs/types/react/hooks/useWeb3AuthInner.d.ts +2 -0
- package/dist/lib.cjs/types/react/hooks/useWeb3AuthUser.d.ts +9 -0
- package/dist/lib.cjs/types/react/index.d.ts +3 -2
- package/dist/lib.cjs/types/react/interfaces.d.ts +21 -0
- package/dist/lib.cjs/types/react/solana/hooks/index.d.ts +4 -0
- package/dist/lib.cjs/types/react/solana/hooks/useSignAndSendTransaction.d.ts +9 -0
- package/dist/lib.cjs/types/react/solana/hooks/useSignMessage.d.ts +8 -0
- package/dist/lib.cjs/types/react/solana/hooks/useSignTransaction.d.ts +14 -0
- package/dist/lib.cjs/types/react/solana/hooks/useSolanaWallet.d.ts +8 -0
- package/dist/lib.cjs/types/react/solana/index.d.ts +1 -0
- package/dist/lib.cjs/types/react/wagmi/constants.d.ts +43 -0
- package/dist/lib.cjs/types/react/wagmi/index.d.ts +1 -0
- package/dist/lib.cjs/types/react/wagmi/interface.d.ts +4 -0
- package/dist/lib.cjs/types/react/wagmi/provider.d.ts +3 -0
- package/dist/lib.cjs/types/vue/WalletServicesInnerProvider.d.ts +1 -0
- package/dist/lib.cjs/types/vue/composables/index.d.ts +13 -0
- package/dist/lib.cjs/types/vue/composables/useCheckout.d.ts +9 -0
- package/dist/lib.cjs/types/vue/composables/useEnableMFA.d.ts +8 -0
- package/dist/lib.cjs/types/vue/composables/useIdentityToken.d.ts +9 -0
- package/dist/lib.cjs/types/vue/composables/useManageMFA.d.ts +8 -0
- package/dist/lib.cjs/types/vue/composables/useSwap.d.ts +9 -0
- package/dist/lib.cjs/types/vue/composables/useSwitchChain.d.ts +10 -0
- package/dist/lib.cjs/types/vue/composables/useWalletConnectScanner.d.ts +9 -0
- package/dist/lib.cjs/types/vue/composables/useWalletServicesPlugin.d.ts +2 -0
- package/dist/lib.cjs/types/vue/composables/useWalletUI.d.ts +9 -0
- package/dist/lib.cjs/types/vue/composables/useWeb3Auth.d.ts +3 -0
- package/dist/lib.cjs/types/vue/composables/useWeb3AuthConnect.d.ts +10 -0
- package/dist/lib.cjs/types/vue/composables/useWeb3AuthDisconnect.d.ts +10 -0
- package/dist/lib.cjs/types/vue/composables/useWeb3AuthInner.d.ts +2 -0
- package/dist/lib.cjs/types/vue/composables/useWeb3AuthUser.d.ts +10 -0
- package/dist/lib.cjs/types/vue/{wallet-services-plugin/context.d.ts → context/WalletServicesContext.d.ts} +2 -2
- package/dist/lib.cjs/types/vue/context/index.d.ts +1 -0
- package/dist/lib.cjs/types/vue/index.d.ts +4 -2
- package/dist/lib.cjs/types/vue/interfaces.d.ts +30 -0
- package/dist/lib.cjs/types/vue/solana/composables/index.d.ts +4 -0
- package/dist/lib.cjs/types/vue/solana/composables/useSignAndSendTransaction.d.ts +10 -0
- package/dist/lib.cjs/types/vue/solana/composables/useSignMessage.d.ts +9 -0
- package/dist/lib.cjs/types/vue/solana/composables/useSignTransaction.d.ts +10 -0
- package/dist/lib.cjs/types/vue/solana/composables/useSolanaWallet.d.ts +9 -0
- package/dist/lib.cjs/types/vue/solana/index.d.ts +1 -0
- package/dist/lib.cjs/types/vue/wagmi/constants.d.ts +43 -0
- package/dist/lib.cjs/types/vue/wagmi/index.d.ts +2 -0
- package/dist/lib.cjs/types/vue/wagmi/interface.d.ts +4 -0
- package/dist/lib.cjs/types/vue/wagmi/provider.d.ts +17 -0
- package/dist/lib.cjs/vue/{wallet-services-plugin/WalletServicesProvider.js → WalletServicesInnerProvider.js} +26 -43
- package/dist/lib.cjs/vue/{no-modal/Web3AuthProvider.js → Web3AuthProvider.js} +45 -86
- package/dist/lib.cjs/vue/composables/useCheckout.js +45 -0
- package/dist/lib.cjs/vue/composables/useEnableMFA.js +43 -0
- package/dist/lib.cjs/vue/composables/useIdentityToken.js +55 -0
- package/dist/lib.cjs/vue/composables/useManageMFA.js +43 -0
- package/dist/lib.cjs/vue/composables/useSwap.js +45 -0
- package/dist/lib.cjs/vue/composables/useSwitchChain.js +43 -0
- package/dist/lib.cjs/vue/composables/useWalletConnectScanner.js +45 -0
- package/dist/lib.cjs/vue/composables/useWalletServicesPlugin.js +12 -0
- package/dist/lib.cjs/vue/composables/useWalletUI.js +45 -0
- package/dist/lib.cjs/vue/composables/useWeb3Auth.js +28 -0
- package/dist/lib.cjs/vue/composables/useWeb3AuthConnect.js +61 -0
- package/dist/lib.cjs/vue/composables/useWeb3AuthDisconnect.js +43 -0
- package/dist/lib.cjs/vue/{no-modal/composables/useWeb3Auth.js → composables/useWeb3AuthInner.js} +9 -9
- package/dist/lib.cjs/vue/composables/useWeb3AuthUser.js +64 -0
- package/dist/lib.cjs/vue/index.js +28 -8
- package/dist/lib.cjs/vue/solana/composables/useSignAndSendTransaction.js +36 -0
- package/dist/lib.cjs/vue/solana/composables/useSignMessage.js +38 -0
- package/dist/lib.cjs/vue/solana/composables/useSignTransaction.js +36 -0
- package/dist/lib.cjs/vue/solana/composables/useSolanaWallet.js +64 -0
- package/dist/lib.cjs/vue/solana/index.js +13 -0
- package/dist/lib.cjs/vue/wagmi/constants.js +16 -0
- package/dist/lib.cjs/vue/wagmi/index.js +7 -0
- package/dist/lib.cjs/vue/wagmi/provider.js +244 -0
- package/dist/lib.esm/base/connector/baseConnector.js +6 -1
- package/dist/lib.esm/base/connector/constants.js +3 -1
- package/dist/lib.esm/base/constants.js +6 -1
- package/dist/lib.esm/base/cookie.js +34 -0
- package/dist/lib.esm/base/deserialize.js +11 -0
- package/dist/lib.esm/base/errors/index.js +14 -22
- package/dist/lib.esm/base/plugin/errors.js +2 -0
- package/dist/lib.esm/base/utils.js +28 -12
- package/dist/lib.esm/base/wallet/index.js +2 -4
- package/dist/lib.esm/connectors/auth-connector/authConnector.js +83 -30
- package/dist/lib.esm/connectors/base-evm-connector/baseEvmConnector.js +1 -8
- package/dist/lib.esm/connectors/base-solana-connector/baseSolanaConnector.js +1 -8
- package/dist/lib.esm/connectors/coinbase-connector/coinbaseConnector.js +16 -15
- package/dist/lib.esm/connectors/coinbase-connector/index.js +1 -0
- package/dist/lib.esm/connectors/injected-evm-connector/injectedEvmConnector.js +11 -12
- package/dist/lib.esm/connectors/injected-solana-connector/walletStandardConnector.js +13 -17
- package/dist/lib.esm/connectors/metamask-connector/metamaskConnector.js +52 -27
- package/dist/lib.esm/connectors/utils.js +14 -1
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/WalletConnectV2Provider.js +8 -25
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/config.js +20 -25
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +15 -15
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/walletConnectV2Utils.js +1 -11
- package/dist/lib.esm/index.js +12 -14
- package/dist/lib.esm/noModal.js +217 -80
- package/dist/lib.esm/plugins/nft-checkout-plugin/embed.js +4 -1
- package/dist/lib.esm/plugins/nft-checkout-plugin/plugin.js +4 -10
- package/dist/lib.esm/plugins/wallet-services-plugin/plugin.js +7 -9
- package/dist/lib.esm/providers/account-abstraction-provider/index.js +2 -2
- package/dist/lib.esm/providers/account-abstraction-provider/providers/AccountAbstractionProvider.js +37 -20
- package/dist/lib.esm/providers/account-abstraction-provider/providers/utils.js +0 -10
- package/dist/lib.esm/providers/account-abstraction-provider/rpc/ethRpcMiddlewares.js +26 -3
- package/dist/lib.esm/providers/base-provider/baseProvider.js +7 -9
- package/dist/lib.esm/providers/base-provider/utils.js +3 -3
- package/dist/lib.esm/providers/ethereum-mpc-provider/index.js +1 -0
- package/dist/lib.esm/providers/ethereum-mpc-provider/providers/signingProviders/EthereumSigningProvider.js +4 -17
- package/dist/lib.esm/providers/ethereum-mpc-provider/providers/signingProviders/signingUtils.js +3 -13
- package/dist/lib.esm/providers/ethereum-mpc-provider/rpc/ethRpcMiddlewares.js +1 -0
- package/dist/lib.esm/providers/ethereum-provider/providers/converter.js +1 -0
- package/dist/lib.esm/providers/ethereum-provider/providers/privateKeyProviders/TransactionFormatter/formatter.js +10 -11
- package/dist/lib.esm/providers/ethereum-provider/providers/privateKeyProviders/TransactionFormatter/interfaces.js +3 -3
- package/dist/lib.esm/providers/ethereum-provider/providers/privateKeyProviders/TransactionFormatter/utils.js +1 -0
- package/dist/lib.esm/providers/ethereum-provider/rpc/walletMidddleware.js +8 -0
- package/dist/lib.esm/providers/solana-provider/providers/injectedProviders/base/baseInjectedProvider.js +2 -15
- package/dist/lib.esm/providers/solana-provider/providers/injectedProviders/walletStandardProvider.js +5 -12
- package/dist/lib.esm/providers/solana-provider/rpc/solanaRpcMiddlewares.js +1 -1
- package/dist/lib.esm/providers/solana-provider/solanaWallet.js +3 -0
- package/dist/lib.esm/providers/xrpl-provider/index.js +2 -0
- package/dist/lib.esm/providers/xrpl-provider/providers/privateKeyProviders/xrplPrivateKeyProvider.js +3 -14
- package/dist/lib.esm/providers/xrpl-provider/rpc/xrplRpcMiddlewares.js +1 -0
- package/dist/lib.esm/react/Web3AuthProvider.js +17 -0
- package/dist/lib.esm/react/context/WalletServicesInnerContext.js +70 -0
- package/dist/lib.esm/react/context/Web3AuthInnerContext.js +129 -0
- package/dist/lib.esm/react/hooks/useCheckout.js +32 -0
- package/dist/lib.esm/react/hooks/useEnableMFA.js +28 -0
- package/dist/lib.esm/react/hooks/useIdentityToken.js +40 -0
- package/dist/lib.esm/react/hooks/useManageMFA.js +28 -0
- package/dist/lib.esm/react/hooks/useSwap.js +32 -0
- package/dist/lib.esm/react/hooks/useSwitchChain.js +30 -0
- package/dist/lib.esm/react/hooks/useWalletConnectScanner.js +32 -0
- package/dist/lib.esm/react/hooks/useWalletServicesPlugin.js +17 -0
- package/dist/lib.esm/react/hooks/useWalletUI.js +32 -0
- package/dist/lib.esm/react/hooks/useWeb3Auth.js +26 -0
- package/dist/lib.esm/react/hooks/useWeb3AuthConnect.js +46 -0
- package/dist/lib.esm/react/hooks/useWeb3AuthDisconnect.js +28 -0
- package/dist/lib.esm/react/hooks/useWeb3AuthInner.js +13 -0
- package/dist/lib.esm/react/hooks/useWeb3AuthUser.js +48 -0
- package/dist/lib.esm/react/index.js +14 -5
- package/dist/lib.esm/react/solana/hooks/useSignAndSendTransaction.js +33 -0
- package/dist/lib.esm/react/solana/hooks/useSignMessage.js +34 -0
- package/dist/lib.esm/react/solana/hooks/useSignTransaction.js +32 -0
- package/dist/lib.esm/react/solana/hooks/useSolanaWallet.js +42 -0
- package/dist/lib.esm/react/solana/index.js +4 -0
- package/dist/lib.esm/react/wagmi/constants.js +14 -0
- package/dist/lib.esm/react/wagmi/index.js +1 -0
- package/dist/lib.esm/react/wagmi/provider.js +179 -0
- package/dist/lib.esm/vue/WalletServicesInnerProvider.js +71 -0
- package/dist/lib.esm/vue/Web3AuthProvider.js +154 -0
- package/dist/lib.esm/vue/composables/useCheckout.js +32 -0
- package/dist/lib.esm/vue/composables/useEnableMFA.js +30 -0
- package/dist/lib.esm/vue/composables/useIdentityToken.js +42 -0
- package/dist/lib.esm/vue/composables/useManageMFA.js +30 -0
- package/dist/lib.esm/vue/composables/useSwap.js +32 -0
- package/dist/lib.esm/vue/composables/useSwitchChain.js +30 -0
- package/dist/lib.esm/vue/composables/useWalletConnectScanner.js +32 -0
- package/dist/lib.esm/vue/composables/useWalletServicesPlugin.js +10 -0
- package/dist/lib.esm/vue/composables/useWalletUI.js +32 -0
- package/dist/lib.esm/vue/composables/useWeb3Auth.js +26 -0
- package/dist/lib.esm/vue/composables/useWeb3AuthConnect.js +48 -0
- package/dist/lib.esm/vue/composables/useWeb3AuthDisconnect.js +30 -0
- package/dist/lib.esm/vue/composables/useWeb3AuthInner.js +11 -0
- package/dist/lib.esm/vue/composables/useWeb3AuthUser.js +51 -0
- package/dist/lib.esm/vue/index.js +15 -5
- package/dist/lib.esm/vue/solana/composables/useSignAndSendTransaction.js +34 -0
- package/dist/lib.esm/vue/solana/composables/useSignMessage.js +36 -0
- package/dist/lib.esm/vue/solana/composables/useSignTransaction.js +34 -0
- package/dist/lib.esm/vue/solana/composables/useSolanaWallet.js +51 -0
- package/dist/lib.esm/vue/solana/index.js +4 -0
- package/dist/lib.esm/vue/wagmi/constants.js +14 -0
- package/dist/lib.esm/vue/wagmi/index.js +1 -0
- package/dist/lib.esm/vue/wagmi/provider.js +237 -0
- package/dist/noModal.umd.min.js +1 -1
- package/dist/noModal.umd.min.js.LICENSE.txt +0 -26
- package/package.json +79 -20
- package/dist/lib.cjs/react/no-modal/Web3AuthProvider.js +0 -15
- package/dist/lib.cjs/react/wallet-services-plugin/WalletServicesProvider.js +0 -16
- package/dist/lib.cjs/react/wallet-services-plugin/hooks/useWalletServicesPlugin.js +0 -26
- package/dist/lib.cjs/types/react/no-modal/hooks/index.d.ts +0 -1
- package/dist/lib.cjs/types/react/no-modal/hooks/useWeb3Auth.d.ts +0 -2
- package/dist/lib.cjs/types/react/no-modal/index.d.ts +0 -3
- package/dist/lib.cjs/types/react/no-modal/interfaces.d.ts +0 -15
- package/dist/lib.cjs/types/react/wallet-services-plugin/WalletServicesContext.d.ts +0 -7
- package/dist/lib.cjs/types/react/wallet-services-plugin/WalletServicesProvider.d.ts +0 -7
- package/dist/lib.cjs/types/react/wallet-services-plugin/hooks/index.d.ts +0 -1
- package/dist/lib.cjs/types/react/wallet-services-plugin/index.d.ts +0 -4
- package/dist/lib.cjs/types/react/wallet-services-plugin/interfaces.d.ts +0 -5
- package/dist/lib.cjs/types/vue/no-modal/composables/index.d.ts +0 -1
- package/dist/lib.cjs/types/vue/no-modal/composables/useWeb3Auth.d.ts +0 -2
- package/dist/lib.cjs/types/vue/no-modal/index.d.ts +0 -3
- package/dist/lib.cjs/types/vue/no-modal/interfaces.d.ts +0 -39
- package/dist/lib.cjs/types/vue/wallet-services-plugin/WalletServicesProvider.d.ts +0 -1
- package/dist/lib.cjs/types/vue/wallet-services-plugin/composables/index.d.ts +0 -1
- package/dist/lib.cjs/types/vue/wallet-services-plugin/composables/useWalletServicesPlugin.d.ts +0 -2
- package/dist/lib.cjs/types/vue/wallet-services-plugin/index.d.ts +0 -4
- package/dist/lib.cjs/types/vue/wallet-services-plugin/interfaces.d.ts +0 -13
- package/dist/lib.cjs/vue/wallet-services-plugin/composables/useWalletServicesPlugin.js +0 -24
- package/dist/lib.esm/react/no-modal/Web3AuthInnerContext.js +0 -197
- package/dist/lib.esm/react/no-modal/Web3AuthProvider.js +0 -13
- package/dist/lib.esm/react/no-modal/hooks/useWeb3Auth.js +0 -24
- package/dist/lib.esm/react/wallet-services-plugin/WalletServicesContext.js +0 -95
- package/dist/lib.esm/react/wallet-services-plugin/WalletServicesProvider.js +0 -14
- package/dist/lib.esm/react/wallet-services-plugin/hooks/useWalletServicesPlugin.js +0 -24
- package/dist/lib.esm/vue/no-modal/Web3AuthProvider.js +0 -203
- package/dist/lib.esm/vue/no-modal/composables/useWeb3Auth.js +0 -22
- package/dist/lib.esm/vue/wallet-services-plugin/WalletServicesProvider.js +0 -96
- package/dist/lib.esm/vue/wallet-services-plugin/composables/useWalletServicesPlugin.js +0 -22
- /package/dist/lib.cjs/types/react/{no-modal/Web3AuthProvider.d.ts → Web3AuthProvider.d.ts} +0 -0
- /package/dist/lib.cjs/types/react/{wallet-services-plugin/hooks → hooks}/useWalletServicesPlugin.d.ts +0 -0
- /package/dist/lib.cjs/types/vue/{no-modal/Web3AuthProvider.d.ts → Web3AuthProvider.d.ts} +0 -0
- /package/dist/lib.cjs/vue/{wallet-services-plugin/context.js → context/WalletServicesContext.js} +0 -0
- /package/dist/lib.esm/vue/{wallet-services-plugin/context.js → context/WalletServicesContext.js} +0 -0
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import '@web3auth/auth';
|
|
5
|
-
import { WalletInitializationError } from '../../../base/errors/index.js';
|
|
6
|
-
import '../../../base/wallet/index.js';
|
|
7
|
-
import '../../../base/connector/constants.js';
|
|
8
|
-
import 'jwt-decode';
|
|
9
|
-
import '../../../base/loglevel.js';
|
|
10
|
-
import '../../../base/plugin/errors.js';
|
|
11
|
-
import '../../../base/plugin/IPlugin.js';
|
|
12
|
-
import '@toruslabs/constants';
|
|
13
|
-
import '@toruslabs/http-helpers';
|
|
14
|
-
import { Web3AuthInnerContext } from '../Web3AuthInnerContext.js';
|
|
15
|
-
|
|
16
|
-
const useWeb3Auth = () => {
|
|
17
|
-
const context = useContext(Web3AuthInnerContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw WalletInitializationError.fromCode(1000, "usage of useWeb3Auth not wrapped in `Web3AuthContextProvider`.");
|
|
20
|
-
}
|
|
21
|
-
return context;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { useWeb3Auth };
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { createContext, useState, useContext, useEffect, useCallback, useMemo, createElement } from 'react';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import '@web3auth/auth';
|
|
5
|
-
import '../../base/errors/index.js';
|
|
6
|
-
import '../../base/wallet/index.js';
|
|
7
|
-
import { CONNECTOR_STATUS } from '../../base/connector/constants.js';
|
|
8
|
-
import 'jwt-decode';
|
|
9
|
-
import '../../base/loglevel.js';
|
|
10
|
-
import { WalletServicesPluginError } from '../../base/plugin/errors.js';
|
|
11
|
-
import { EVM_PLUGINS, PLUGIN_EVENTS } from '../../base/plugin/IPlugin.js';
|
|
12
|
-
import '@toruslabs/constants';
|
|
13
|
-
import '@toruslabs/http-helpers';
|
|
14
|
-
|
|
15
|
-
const WalletServicesContext = createContext(null);
|
|
16
|
-
function WalletServicesContextProvider({
|
|
17
|
-
children,
|
|
18
|
-
context
|
|
19
|
-
}) {
|
|
20
|
-
const [isPluginConnected, setIsPluginConnected] = useState(false);
|
|
21
|
-
const [walletServicesPlugin, setWalletServicesPlugin] = useState(null);
|
|
22
|
-
const web3AuthContext = useContext(context);
|
|
23
|
-
const {
|
|
24
|
-
getPlugin,
|
|
25
|
-
isInitialized,
|
|
26
|
-
isConnected
|
|
27
|
-
} = web3AuthContext;
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (isInitialized) {
|
|
30
|
-
const plugin = getPlugin(EVM_PLUGINS.WALLET_SERVICES);
|
|
31
|
-
setWalletServicesPlugin(plugin);
|
|
32
|
-
}
|
|
33
|
-
}, [isInitialized, getPlugin]);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (isConnected) {
|
|
36
|
-
const plugin = getPlugin(EVM_PLUGINS.WALLET_SERVICES);
|
|
37
|
-
if (!walletServicesPlugin) setWalletServicesPlugin(plugin);
|
|
38
|
-
// when rehydrating, the connectedListener may be registered after the connected event is emitted, we need to check the status here
|
|
39
|
-
if ((walletServicesPlugin === null || walletServicesPlugin === void 0 ? void 0 : walletServicesPlugin.status) === CONNECTOR_STATUS.CONNECTED) setIsPluginConnected(true);
|
|
40
|
-
}
|
|
41
|
-
}, [isConnected, getPlugin, walletServicesPlugin]);
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
const connectedListener = () => {
|
|
44
|
-
setIsPluginConnected(true);
|
|
45
|
-
};
|
|
46
|
-
const disconnectedListener = () => {
|
|
47
|
-
setIsPluginConnected(false);
|
|
48
|
-
};
|
|
49
|
-
if (walletServicesPlugin) {
|
|
50
|
-
walletServicesPlugin.on(PLUGIN_EVENTS.CONNECTED, connectedListener);
|
|
51
|
-
walletServicesPlugin.on(PLUGIN_EVENTS.DISCONNECTED, disconnectedListener);
|
|
52
|
-
}
|
|
53
|
-
return () => {
|
|
54
|
-
if (walletServicesPlugin) {
|
|
55
|
-
walletServicesPlugin.off(PLUGIN_EVENTS.CONNECTED, connectedListener);
|
|
56
|
-
walletServicesPlugin.off(PLUGIN_EVENTS.DISCONNECTED, disconnectedListener);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}, [walletServicesPlugin]);
|
|
60
|
-
const showWalletConnectScanner = useCallback(async showWalletConnectParams => {
|
|
61
|
-
if (!walletServicesPlugin) throw WalletServicesPluginError.notInitialized();
|
|
62
|
-
if (!isPluginConnected) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
63
|
-
return walletServicesPlugin.showWalletConnectScanner(showWalletConnectParams);
|
|
64
|
-
}, [walletServicesPlugin, isPluginConnected]);
|
|
65
|
-
const showWalletUI = useCallback(async showWalletUiParams => {
|
|
66
|
-
if (!walletServicesPlugin) throw WalletServicesPluginError.notInitialized();
|
|
67
|
-
if (!isPluginConnected) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
68
|
-
return walletServicesPlugin.showWalletUi(showWalletUiParams);
|
|
69
|
-
}, [walletServicesPlugin, isPluginConnected]);
|
|
70
|
-
const showCheckout = useCallback(async showCheckoutParams => {
|
|
71
|
-
if (!walletServicesPlugin) throw WalletServicesPluginError.notInitialized();
|
|
72
|
-
if (!isPluginConnected) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
73
|
-
return walletServicesPlugin.showCheckout(showCheckoutParams);
|
|
74
|
-
}, [walletServicesPlugin, isPluginConnected]);
|
|
75
|
-
const showSwap = useCallback(async showSwapParams => {
|
|
76
|
-
if (!walletServicesPlugin) throw WalletServicesPluginError.notInitialized();
|
|
77
|
-
if (!isPluginConnected) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
78
|
-
return walletServicesPlugin.showSwap(showSwapParams);
|
|
79
|
-
}, [walletServicesPlugin, isPluginConnected]);
|
|
80
|
-
const value = useMemo(() => {
|
|
81
|
-
return {
|
|
82
|
-
plugin: walletServicesPlugin,
|
|
83
|
-
isPluginConnected,
|
|
84
|
-
showWalletConnectScanner,
|
|
85
|
-
showCheckout,
|
|
86
|
-
showWalletUI,
|
|
87
|
-
showSwap
|
|
88
|
-
};
|
|
89
|
-
}, [walletServicesPlugin, isPluginConnected, showWalletConnectScanner, showCheckout, showWalletUI, showSwap]);
|
|
90
|
-
return createElement(WalletServicesContext.Provider, {
|
|
91
|
-
value
|
|
92
|
-
}, children);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { WalletServicesContext, WalletServicesContextProvider };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'react';
|
|
2
|
-
import { WalletServicesContextProvider } from './WalletServicesContext.js';
|
|
3
|
-
|
|
4
|
-
function WalletServicesProvider({
|
|
5
|
-
children,
|
|
6
|
-
context
|
|
7
|
-
}) {
|
|
8
|
-
const wsElement = createElement(WalletServicesContextProvider, {
|
|
9
|
-
context
|
|
10
|
-
}, children);
|
|
11
|
-
return wsElement;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { WalletServicesProvider };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import '@web3auth/auth';
|
|
5
|
-
import { WalletInitializationError } from '../../../base/errors/index.js';
|
|
6
|
-
import '../../../base/wallet/index.js';
|
|
7
|
-
import '../../../base/connector/constants.js';
|
|
8
|
-
import 'jwt-decode';
|
|
9
|
-
import '../../../base/loglevel.js';
|
|
10
|
-
import '../../../base/plugin/errors.js';
|
|
11
|
-
import '../../../base/plugin/IPlugin.js';
|
|
12
|
-
import '@toruslabs/constants';
|
|
13
|
-
import '@toruslabs/http-helpers';
|
|
14
|
-
import { WalletServicesContext } from '../WalletServicesContext.js';
|
|
15
|
-
|
|
16
|
-
const useWalletServicesPlugin = () => {
|
|
17
|
-
const context = useContext(WalletServicesContext);
|
|
18
|
-
if (!context) {
|
|
19
|
-
throw WalletInitializationError.fromCode(1000, "usage of useWalletServicesPlugin not wrapped in `WalletServicesContextProvider`.");
|
|
20
|
-
}
|
|
21
|
-
return context;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { useWalletServicesPlugin };
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, shallowRef, ref, watch, provide } from 'vue';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import { Web3AuthContextKey } from '../../base/composables/index.js';
|
|
4
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
5
|
-
import '@web3auth/auth';
|
|
6
|
-
import { WalletInitializationError, WalletLoginError } from '../../base/errors/index.js';
|
|
7
|
-
import '../../base/wallet/index.js';
|
|
8
|
-
import { CONNECTOR_EVENTS, CONNECTOR_STATUS } from '../../base/connector/constants.js';
|
|
9
|
-
import 'jwt-decode';
|
|
10
|
-
import '../../base/loglevel.js';
|
|
11
|
-
import '../../base/plugin/errors.js';
|
|
12
|
-
import '../../base/plugin/IPlugin.js';
|
|
13
|
-
import '@toruslabs/constants';
|
|
14
|
-
import '@toruslabs/http-helpers';
|
|
15
|
-
import { Web3AuthNoModal } from '../../noModal.js';
|
|
16
|
-
|
|
17
|
-
const Web3AuthProvider = defineComponent({
|
|
18
|
-
name: "Web3AuthProvider",
|
|
19
|
-
props: {
|
|
20
|
-
config: {
|
|
21
|
-
type: Object,
|
|
22
|
-
required: true
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
setup(props) {
|
|
26
|
-
const web3Auth = shallowRef(null);
|
|
27
|
-
const provider = ref(null);
|
|
28
|
-
const userInfo = ref(null);
|
|
29
|
-
const isMFAEnabled = ref(false);
|
|
30
|
-
const status = ref(null);
|
|
31
|
-
const isInitializing = ref(false);
|
|
32
|
-
const initError = ref(null);
|
|
33
|
-
const isInitialized = ref(false);
|
|
34
|
-
const isConnecting = ref(false);
|
|
35
|
-
const connectError = ref(null);
|
|
36
|
-
const isConnected = ref(false);
|
|
37
|
-
const getPlugin = name => {
|
|
38
|
-
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
39
|
-
return web3Auth.value.getPlugin(name);
|
|
40
|
-
};
|
|
41
|
-
const enableMFA = async loginParams => {
|
|
42
|
-
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
43
|
-
if (!isConnected.value) throw WalletLoginError.notConnectedError();
|
|
44
|
-
await web3Auth.value.enableMFA(loginParams);
|
|
45
|
-
const localUserInfo = await web3Auth.value.getUserInfo();
|
|
46
|
-
userInfo.value = localUserInfo;
|
|
47
|
-
isMFAEnabled.value = localUserInfo.isMfaEnabled || false;
|
|
48
|
-
};
|
|
49
|
-
const manageMFA = async loginParams => {
|
|
50
|
-
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
51
|
-
if (!isConnected.value) throw WalletLoginError.notConnectedError();
|
|
52
|
-
await web3Auth.value.manageMFA(loginParams);
|
|
53
|
-
};
|
|
54
|
-
const logout = async (logoutParams = {
|
|
55
|
-
cleanup: false
|
|
56
|
-
}) => {
|
|
57
|
-
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
58
|
-
if (!isConnected.value) throw WalletLoginError.notConnectedError();
|
|
59
|
-
await web3Auth.value.logout(logoutParams);
|
|
60
|
-
};
|
|
61
|
-
const connectTo = async (walletName, loginParams) => {
|
|
62
|
-
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
63
|
-
try {
|
|
64
|
-
connectError.value = null;
|
|
65
|
-
isConnecting.value = true;
|
|
66
|
-
const localProvider = await web3Auth.value.connectTo(walletName, loginParams);
|
|
67
|
-
return localProvider;
|
|
68
|
-
} catch (error) {
|
|
69
|
-
connectError.value = error;
|
|
70
|
-
} finally {
|
|
71
|
-
isConnecting.value = false;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const authenticateUser = async () => {
|
|
75
|
-
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
76
|
-
return web3Auth.value.authenticateUser();
|
|
77
|
-
};
|
|
78
|
-
const switchChain = chainParams => {
|
|
79
|
-
if (!web3Auth.value) throw WalletInitializationError.notReady();
|
|
80
|
-
return web3Auth.value.switchChain(chainParams);
|
|
81
|
-
};
|
|
82
|
-
watch(() => props.config, newConfig => {
|
|
83
|
-
const resetHookState = () => {
|
|
84
|
-
provider.value = null;
|
|
85
|
-
userInfo.value = null;
|
|
86
|
-
isMFAEnabled.value = false;
|
|
87
|
-
isConnected.value = false;
|
|
88
|
-
status.value = null;
|
|
89
|
-
};
|
|
90
|
-
resetHookState();
|
|
91
|
-
const {
|
|
92
|
-
web3AuthOptions
|
|
93
|
-
} = newConfig;
|
|
94
|
-
const web3AuthInstance = new Web3AuthNoModal(web3AuthOptions);
|
|
95
|
-
web3Auth.value = web3AuthInstance;
|
|
96
|
-
}, {
|
|
97
|
-
immediate: true
|
|
98
|
-
});
|
|
99
|
-
watch(web3Auth, async newWeb3Auth => {
|
|
100
|
-
if (newWeb3Auth) {
|
|
101
|
-
try {
|
|
102
|
-
initError.value = null;
|
|
103
|
-
isInitializing.value = true;
|
|
104
|
-
await newWeb3Auth.init();
|
|
105
|
-
} catch (error) {
|
|
106
|
-
initError.value = error;
|
|
107
|
-
} finally {
|
|
108
|
-
isInitializing.value = false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}, {
|
|
112
|
-
immediate: true
|
|
113
|
-
});
|
|
114
|
-
watch(isConnected, () => {
|
|
115
|
-
if (web3Auth.value) {
|
|
116
|
-
const addState = async web3AuthInstance => {
|
|
117
|
-
provider.value = web3AuthInstance.provider;
|
|
118
|
-
const userState = await web3AuthInstance.getUserInfo();
|
|
119
|
-
userInfo.value = userState;
|
|
120
|
-
isMFAEnabled.value = (userState === null || userState === void 0 ? void 0 : userState.isMfaEnabled) || false;
|
|
121
|
-
};
|
|
122
|
-
const resetState = () => {
|
|
123
|
-
provider.value = null;
|
|
124
|
-
userInfo.value = null;
|
|
125
|
-
isMFAEnabled.value = false;
|
|
126
|
-
};
|
|
127
|
-
if (isConnected.value) addState(web3Auth.value);else resetState();
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
watch(web3Auth, (newWeb3Auth, prevWeb3Auth) => {
|
|
131
|
-
const notReadyListener = () => status.value = web3Auth.value.status;
|
|
132
|
-
const readyListener = () => {
|
|
133
|
-
status.value = web3Auth.value.status;
|
|
134
|
-
isInitialized.value = true;
|
|
135
|
-
};
|
|
136
|
-
const connectedListener = () => {
|
|
137
|
-
status.value = web3Auth.value.status;
|
|
138
|
-
// we do this because of rehydration issues. status connected is fired first but web3auth sdk is not ready yet.
|
|
139
|
-
if (web3Auth.value.status === CONNECTOR_STATUS.CONNECTED) {
|
|
140
|
-
isInitialized.value = true;
|
|
141
|
-
isConnected.value = true;
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
const disconnectedListener = () => {
|
|
145
|
-
status.value = web3Auth.value.status;
|
|
146
|
-
isConnected.value = false;
|
|
147
|
-
};
|
|
148
|
-
const connectingListener = () => {
|
|
149
|
-
status.value = web3Auth.value.status;
|
|
150
|
-
};
|
|
151
|
-
const errorListener = () => {
|
|
152
|
-
status.value = CONNECTOR_EVENTS.ERRORED;
|
|
153
|
-
};
|
|
154
|
-
// unregister previous listeners
|
|
155
|
-
if (prevWeb3Auth && newWeb3Auth !== prevWeb3Auth) {
|
|
156
|
-
prevWeb3Auth.off(CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
157
|
-
prevWeb3Auth.off(CONNECTOR_EVENTS.READY, readyListener);
|
|
158
|
-
prevWeb3Auth.off(CONNECTOR_EVENTS.CONNECTED, connectedListener);
|
|
159
|
-
prevWeb3Auth.off(CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
160
|
-
prevWeb3Auth.off(CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
161
|
-
prevWeb3Auth.off(CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
162
|
-
}
|
|
163
|
-
if (newWeb3Auth && newWeb3Auth !== prevWeb3Auth) {
|
|
164
|
-
status.value = newWeb3Auth.status;
|
|
165
|
-
// web3Auth is initialized here.
|
|
166
|
-
newWeb3Auth.on(CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
167
|
-
newWeb3Auth.on(CONNECTOR_EVENTS.READY, readyListener);
|
|
168
|
-
newWeb3Auth.on(CONNECTOR_EVENTS.CONNECTED, connectedListener);
|
|
169
|
-
newWeb3Auth.on(CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
170
|
-
newWeb3Auth.on(CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
171
|
-
newWeb3Auth.on(CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
172
|
-
}
|
|
173
|
-
}, {
|
|
174
|
-
immediate: true
|
|
175
|
-
});
|
|
176
|
-
provide(Web3AuthContextKey, {
|
|
177
|
-
web3Auth,
|
|
178
|
-
isConnected,
|
|
179
|
-
isInitialized,
|
|
180
|
-
provider,
|
|
181
|
-
userInfo,
|
|
182
|
-
isMFAEnabled,
|
|
183
|
-
status,
|
|
184
|
-
getPlugin,
|
|
185
|
-
connectTo,
|
|
186
|
-
enableMFA,
|
|
187
|
-
manageMFA,
|
|
188
|
-
logout,
|
|
189
|
-
authenticateUser,
|
|
190
|
-
switchChain,
|
|
191
|
-
isInitializing,
|
|
192
|
-
isConnecting,
|
|
193
|
-
initError,
|
|
194
|
-
connectError
|
|
195
|
-
});
|
|
196
|
-
},
|
|
197
|
-
render() {
|
|
198
|
-
var _this$$slots$default;
|
|
199
|
-
return h((_this$$slots$default = this.$slots.default) !== null && _this$$slots$default !== void 0 ? _this$$slots$default : "");
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
export { Web3AuthProvider };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { inject } from 'vue';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import { Web3AuthContextKey } from '../../../base/composables/index.js';
|
|
4
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
5
|
-
import '@web3auth/auth';
|
|
6
|
-
import { WalletInitializationError } from '../../../base/errors/index.js';
|
|
7
|
-
import '../../../base/wallet/index.js';
|
|
8
|
-
import '../../../base/connector/constants.js';
|
|
9
|
-
import 'jwt-decode';
|
|
10
|
-
import '../../../base/loglevel.js';
|
|
11
|
-
import '../../../base/plugin/errors.js';
|
|
12
|
-
import '../../../base/plugin/IPlugin.js';
|
|
13
|
-
import '@toruslabs/constants';
|
|
14
|
-
import '@toruslabs/http-helpers';
|
|
15
|
-
|
|
16
|
-
const useWeb3Auth = () => {
|
|
17
|
-
const context = inject(Web3AuthContextKey);
|
|
18
|
-
if (!context) throw WalletInitializationError.fromCode(1000, "usage of `useWeb3Auth` not wrapped in `Web3AuthProvider`.");
|
|
19
|
-
return context;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { useWeb3Auth };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, inject, ref, watch, provide } from 'vue';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import { Web3AuthContextKey } from '../../base/composables/index.js';
|
|
4
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
5
|
-
import '@web3auth/auth';
|
|
6
|
-
import '../../base/errors/index.js';
|
|
7
|
-
import '../../base/wallet/index.js';
|
|
8
|
-
import { CONNECTOR_STATUS } from '../../base/connector/constants.js';
|
|
9
|
-
import 'jwt-decode';
|
|
10
|
-
import '../../base/loglevel.js';
|
|
11
|
-
import { WalletServicesPluginError } from '../../base/plugin/errors.js';
|
|
12
|
-
import { EVM_PLUGINS, PLUGIN_EVENTS } from '../../base/plugin/IPlugin.js';
|
|
13
|
-
import '@toruslabs/constants';
|
|
14
|
-
import '@toruslabs/http-helpers';
|
|
15
|
-
import { WalletServicesContextKey } from './context.js';
|
|
16
|
-
|
|
17
|
-
const WalletServicesProvider = defineComponent({
|
|
18
|
-
name: "WalletServicesProvider",
|
|
19
|
-
setup() {
|
|
20
|
-
const web3AuthContext = inject(Web3AuthContextKey);
|
|
21
|
-
if (!web3AuthContext) throw WalletServicesPluginError.fromCode(1000, "`WalletServicesProvider` must be wrapped by `Web3AuthProvider`");
|
|
22
|
-
const {
|
|
23
|
-
getPlugin,
|
|
24
|
-
isInitialized,
|
|
25
|
-
isConnected
|
|
26
|
-
} = web3AuthContext;
|
|
27
|
-
const walletServicesPlugin = ref(null);
|
|
28
|
-
const isPluginConnected = ref(false);
|
|
29
|
-
watch(isInitialized, newIsInitialized => {
|
|
30
|
-
if (newIsInitialized) {
|
|
31
|
-
const plugin = getPlugin(EVM_PLUGINS.WALLET_SERVICES);
|
|
32
|
-
walletServicesPlugin.value = plugin;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
watch(isConnected, newIsConnected => {
|
|
36
|
-
if (newIsConnected) {
|
|
37
|
-
var _walletServicesPlugin;
|
|
38
|
-
const plugin = getPlugin(EVM_PLUGINS.WALLET_SERVICES);
|
|
39
|
-
if (!walletServicesPlugin.value) walletServicesPlugin.value = plugin;
|
|
40
|
-
// when rehydrating, the connectedListener may be registered after the connected event is emitted, we need to check the status here
|
|
41
|
-
if (((_walletServicesPlugin = walletServicesPlugin.value) === null || _walletServicesPlugin === void 0 ? void 0 : _walletServicesPlugin.status) === CONNECTOR_STATUS.CONNECTED) isPluginConnected.value = true;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
watch(walletServicesPlugin, (newWalletServicesPlugin, prevWalletServicesPlugin) => {
|
|
45
|
-
const connectedListener = () => {
|
|
46
|
-
isPluginConnected.value = true;
|
|
47
|
-
};
|
|
48
|
-
const disconnectedListener = () => {
|
|
49
|
-
isPluginConnected.value = false;
|
|
50
|
-
};
|
|
51
|
-
// unregister previous listeners
|
|
52
|
-
if (prevWalletServicesPlugin && newWalletServicesPlugin !== prevWalletServicesPlugin) {
|
|
53
|
-
prevWalletServicesPlugin.off(PLUGIN_EVENTS.CONNECTED, connectedListener);
|
|
54
|
-
prevWalletServicesPlugin.off(PLUGIN_EVENTS.DISCONNECTED, disconnectedListener);
|
|
55
|
-
}
|
|
56
|
-
if (newWalletServicesPlugin && newWalletServicesPlugin !== prevWalletServicesPlugin) {
|
|
57
|
-
newWalletServicesPlugin.on(PLUGIN_EVENTS.CONNECTED, connectedListener);
|
|
58
|
-
newWalletServicesPlugin.on(PLUGIN_EVENTS.DISCONNECTED, disconnectedListener);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const showWalletConnectScanner = async showWalletConnectScannerParams => {
|
|
62
|
-
if (!walletServicesPlugin.value) throw WalletServicesPluginError.notInitialized();
|
|
63
|
-
if (!isPluginConnected.value) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
64
|
-
return walletServicesPlugin.value.showWalletConnectScanner(showWalletConnectScannerParams);
|
|
65
|
-
};
|
|
66
|
-
const showWalletUI = async showWalletUiParams => {
|
|
67
|
-
if (!walletServicesPlugin.value) throw WalletServicesPluginError.notInitialized();
|
|
68
|
-
if (!isPluginConnected.value) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
69
|
-
return walletServicesPlugin.value.showWalletUi(showWalletUiParams);
|
|
70
|
-
};
|
|
71
|
-
const showCheckout = async showCheckoutParams => {
|
|
72
|
-
if (!walletServicesPlugin.value) throw WalletServicesPluginError.notInitialized();
|
|
73
|
-
if (!isPluginConnected.value) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
74
|
-
return walletServicesPlugin.value.showCheckout(showCheckoutParams);
|
|
75
|
-
};
|
|
76
|
-
const showSwap = async showSwapParams => {
|
|
77
|
-
if (!walletServicesPlugin.value) throw WalletServicesPluginError.notInitialized();
|
|
78
|
-
if (!isPluginConnected.value) throw WalletServicesPluginError.walletPluginNotConnected();
|
|
79
|
-
return walletServicesPlugin.value.showSwap(showSwapParams);
|
|
80
|
-
};
|
|
81
|
-
provide(WalletServicesContextKey, {
|
|
82
|
-
plugin: walletServicesPlugin,
|
|
83
|
-
isPluginConnected,
|
|
84
|
-
showWalletConnectScanner,
|
|
85
|
-
showCheckout,
|
|
86
|
-
showWalletUI,
|
|
87
|
-
showSwap
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
render() {
|
|
91
|
-
var _this$$slots$default;
|
|
92
|
-
return h((_this$$slots$default = this.$slots.default) !== null && _this$$slots$default !== void 0 ? _this$$slots$default : "");
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
export { WalletServicesProvider };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { inject } from 'vue';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import '@web3auth/auth';
|
|
5
|
-
import '../../../base/errors/index.js';
|
|
6
|
-
import '../../../base/wallet/index.js';
|
|
7
|
-
import '../../../base/connector/constants.js';
|
|
8
|
-
import 'jwt-decode';
|
|
9
|
-
import '../../../base/loglevel.js';
|
|
10
|
-
import { WalletServicesPluginError } from '../../../base/plugin/errors.js';
|
|
11
|
-
import '../../../base/plugin/IPlugin.js';
|
|
12
|
-
import '@toruslabs/constants';
|
|
13
|
-
import '@toruslabs/http-helpers';
|
|
14
|
-
import { WalletServicesContextKey } from '../context.js';
|
|
15
|
-
|
|
16
|
-
const useWalletServicesPlugin = () => {
|
|
17
|
-
const context = inject(WalletServicesContextKey);
|
|
18
|
-
if (!context) throw WalletServicesPluginError.fromCode(1000, "usage of `useWalletServicesPlugin` not wrapped in `WalletServicesProvider`.");
|
|
19
|
-
return context;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { useWalletServicesPlugin };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/lib.cjs/vue/{wallet-services-plugin/context.js → context/WalletServicesContext.js}
RENAMED
|
File without changes
|
/package/dist/lib.esm/vue/{wallet-services-plugin/context.js → context/WalletServicesContext.js}
RENAMED
|
File without changes
|