@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
package/dist/lib.esm/providers/account-abstraction-provider/providers/AccountAbstractionProvider.js
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
-
import { SMART_ACCOUNT } from '@toruslabs/ethereum-controllers';
|
|
3
|
+
import { SMART_ACCOUNT, METHOD_TYPES } from '@toruslabs/ethereum-controllers';
|
|
4
4
|
export { SMART_ACCOUNT } from '@toruslabs/ethereum-controllers';
|
|
5
|
-
import {
|
|
6
|
-
import { defineChain, createPublicClient, http } from 'viem';
|
|
5
|
+
import { JRPCEngine, providerFromEngine, providerErrors } from '@web3auth/auth';
|
|
6
|
+
import { defineChain, createPublicClient, http, createWalletClient, custom } from 'viem';
|
|
7
7
|
import { createPaymasterClient, createBundlerClient } from 'viem/account-abstraction';
|
|
8
|
+
import { createEoaMiddleware, providerAsMiddleware, createAaMiddleware } from '../rpc/ethRpcMiddlewares.js';
|
|
9
|
+
import { getProviderHandlers } from './utils.js';
|
|
10
|
+
import { BaseProvider } from '../../base-provider/baseProvider.js';
|
|
8
11
|
import { CHAIN_NAMESPACES } from '@toruslabs/base-controllers';
|
|
9
12
|
import { WalletInitializationError } from '../../../base/errors/index.js';
|
|
10
|
-
import '../../../base/wallet/index.js';
|
|
11
|
-
import '../../../base/connector/constants.js';
|
|
12
|
-
import 'jwt-decode';
|
|
13
|
-
import '../../../base/loglevel.js';
|
|
14
|
-
import '../../../base/plugin/errors.js';
|
|
15
|
-
import '../../../base/plugin/IPlugin.js';
|
|
16
|
-
import '@toruslabs/constants';
|
|
17
|
-
import '@toruslabs/http-helpers';
|
|
18
|
-
import { BaseProvider } from '../../base-provider/baseProvider.js';
|
|
19
|
-
import '../../base-provider/CommonJRPCProvider.js';
|
|
20
|
-
import '../../base-provider/commonPrivateKeyProvider.js';
|
|
21
|
-
import '../../base-provider/utils.js';
|
|
22
|
-
import { createAaMiddleware, eoaProviderAsMiddleware } from '../rpc/ethRpcMiddlewares.js';
|
|
23
|
-
import { getProviderHandlers } from './utils.js';
|
|
24
13
|
|
|
25
14
|
var _AccountAbstractionProvider;
|
|
26
15
|
class AccountAbstractionProvider extends BaseProvider {
|
|
@@ -106,10 +95,19 @@ class AccountAbstractionProvider extends BaseProvider {
|
|
|
106
95
|
chain,
|
|
107
96
|
transport: http(currentChain.rpcTarget)
|
|
108
97
|
});
|
|
98
|
+
const [eoaAddress] = await eoaProvider.request({
|
|
99
|
+
method: METHOD_TYPES.ETH_REQUEST_ACCOUNTS
|
|
100
|
+
});
|
|
101
|
+
const walletClient = createWalletClient({
|
|
102
|
+
account: eoaAddress,
|
|
103
|
+
chain,
|
|
104
|
+
transport: custom(eoaProvider)
|
|
105
|
+
});
|
|
109
106
|
this._smartAccount = await this.config.smartAccountInit.getSmartAccount({
|
|
110
|
-
|
|
107
|
+
walletClient,
|
|
111
108
|
client: this._publicClient
|
|
112
109
|
});
|
|
110
|
+
|
|
113
111
|
// setup bundler and paymaster
|
|
114
112
|
if (paymasterConfig) {
|
|
115
113
|
var _paymasterConfig$tran;
|
|
@@ -129,6 +127,7 @@ class AccountAbstractionProvider extends BaseProvider {
|
|
|
129
127
|
chain,
|
|
130
128
|
eoaProvider
|
|
131
129
|
});
|
|
130
|
+
|
|
132
131
|
// setup rpc engine and AA middleware
|
|
133
132
|
const engine = new JRPCEngine();
|
|
134
133
|
const aaMiddleware = await createAaMiddleware({
|
|
@@ -136,7 +135,7 @@ class AccountAbstractionProvider extends BaseProvider {
|
|
|
136
135
|
handlers: providerHandlers
|
|
137
136
|
});
|
|
138
137
|
engine.push(aaMiddleware);
|
|
139
|
-
const eoaMiddleware =
|
|
138
|
+
const eoaMiddleware = providerAsMiddleware(eoaProvider);
|
|
140
139
|
engine.push(eoaMiddleware);
|
|
141
140
|
const provider = providerFromEngine(engine);
|
|
142
141
|
this.updateProviderEngineProxy(provider);
|
|
@@ -227,6 +226,14 @@ const accountAbstractionProvider = async ({
|
|
|
227
226
|
smartAccountInit = new TrustSmartAccount(smartAccountConfig);
|
|
228
227
|
break;
|
|
229
228
|
}
|
|
229
|
+
case SMART_ACCOUNT.METAMASK:
|
|
230
|
+
{
|
|
231
|
+
const {
|
|
232
|
+
MetamaskSmartAccount
|
|
233
|
+
} = await import('@toruslabs/ethereum-controllers');
|
|
234
|
+
smartAccountInit = new MetamaskSmartAccount(smartAccountConfig);
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
230
237
|
default:
|
|
231
238
|
throw new Error("Smart account type not supported");
|
|
232
239
|
}
|
|
@@ -238,5 +245,15 @@ const accountAbstractionProvider = async ({
|
|
|
238
245
|
smartAccountChainsConfig
|
|
239
246
|
});
|
|
240
247
|
};
|
|
248
|
+
const toEoaProvider = async aaProvider => {
|
|
249
|
+
// derive EOA provider from AA provider
|
|
250
|
+
const engine = new JRPCEngine();
|
|
251
|
+
const eoaMiddleware = await createEoaMiddleware({
|
|
252
|
+
aaProvider
|
|
253
|
+
});
|
|
254
|
+
engine.push(eoaMiddleware);
|
|
255
|
+
engine.push(providerAsMiddleware(aaProvider));
|
|
256
|
+
return providerFromEngine(engine);
|
|
257
|
+
};
|
|
241
258
|
|
|
242
|
-
export { accountAbstractionProvider };
|
|
259
|
+
export { accountAbstractionProvider, toEoaProvider };
|
|
@@ -2,17 +2,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import { isHexString, addHexPrefix } from '@ethereumjs/util';
|
|
3
3
|
import { providerErrors } from '@web3auth/auth';
|
|
4
4
|
import { createWalletClient, http } from 'viem';
|
|
5
|
-
import '@toruslabs/base-controllers';
|
|
6
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
7
|
-
import '../../../base/errors/index.js';
|
|
8
|
-
import '../../../base/wallet/index.js';
|
|
9
|
-
import '../../../base/connector/constants.js';
|
|
10
|
-
import 'jwt-decode';
|
|
11
5
|
import { log } from '../../../base/loglevel.js';
|
|
12
|
-
import '../../../base/plugin/errors.js';
|
|
13
|
-
import '../../../base/plugin/IPlugin.js';
|
|
14
|
-
import '@toruslabs/constants';
|
|
15
|
-
import '@toruslabs/http-helpers';
|
|
16
6
|
|
|
17
7
|
function getProviderHandlers({
|
|
18
8
|
bundlerClient,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import { METHOD_TYPES } from '@toruslabs/ethereum-controllers';
|
|
2
3
|
import { createScaffoldMiddleware, createAsyncMiddleware, rpcErrors } from '@web3auth/auth';
|
|
3
4
|
|
|
4
5
|
async function createAaMiddleware({
|
|
@@ -6,8 +7,9 @@ async function createAaMiddleware({
|
|
|
6
7
|
handlers
|
|
7
8
|
}) {
|
|
8
9
|
const [eoaAddress] = await eoaProvider.request({
|
|
9
|
-
method:
|
|
10
|
+
method: METHOD_TYPES.GET_ACCOUNTS
|
|
10
11
|
});
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* Validates the keyholder address, and returns a normalized (i.e. lowercase)
|
|
13
15
|
* copy of it.
|
|
@@ -66,6 +68,7 @@ async function createAaMiddleware({
|
|
|
66
68
|
const txParams = req.params[0] || {
|
|
67
69
|
from: ""
|
|
68
70
|
};
|
|
71
|
+
|
|
69
72
|
// normalize sender address
|
|
70
73
|
if (txParams.from) {
|
|
71
74
|
txParams.from = await normalizeSignSenderAddress(txParams.from, req);
|
|
@@ -153,7 +156,27 @@ async function createAaMiddleware({
|
|
|
153
156
|
personal_sign: createAsyncMiddleware(personalSign)
|
|
154
157
|
});
|
|
155
158
|
}
|
|
156
|
-
function
|
|
159
|
+
async function createEoaMiddleware({
|
|
160
|
+
aaProvider
|
|
161
|
+
}) {
|
|
162
|
+
async function getAccounts(_req, res) {
|
|
163
|
+
const [, eoaAddress] = await aaProvider.request({
|
|
164
|
+
method: METHOD_TYPES.GET_ACCOUNTS
|
|
165
|
+
});
|
|
166
|
+
res.result = [eoaAddress];
|
|
167
|
+
}
|
|
168
|
+
async function requestAccounts(_req, res) {
|
|
169
|
+
const [, eoaAddress] = await aaProvider.request({
|
|
170
|
+
method: METHOD_TYPES.ETH_REQUEST_ACCOUNTS
|
|
171
|
+
});
|
|
172
|
+
res.result = [eoaAddress];
|
|
173
|
+
}
|
|
174
|
+
return createScaffoldMiddleware({
|
|
175
|
+
eth_accounts: createAsyncMiddleware(getAccounts),
|
|
176
|
+
eth_requestAccounts: createAsyncMiddleware(requestAccounts)
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function providerAsMiddleware(provider) {
|
|
157
180
|
return async (req, res, _next, end) => {
|
|
158
181
|
// send request to provider
|
|
159
182
|
try {
|
|
@@ -166,4 +189,4 @@ function eoaProviderAsMiddleware(provider) {
|
|
|
166
189
|
};
|
|
167
190
|
}
|
|
168
191
|
|
|
169
|
-
export { createAaMiddleware,
|
|
192
|
+
export { createAaMiddleware, createEoaMiddleware, providerAsMiddleware };
|
|
@@ -2,16 +2,8 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import { BaseController, createEventEmitterProxy } from '@toruslabs/base-controllers';
|
|
4
4
|
import { rpcErrors } from '@web3auth/auth';
|
|
5
|
-
import { WalletInitializationError, WalletProviderError } 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
5
|
import { EIP1193_EVENTS } from './utils.js';
|
|
6
|
+
import { WalletInitializationError, WalletProviderError } from '../../base/errors/index.js';
|
|
15
7
|
|
|
16
8
|
class BaseProvider extends BaseController {
|
|
17
9
|
constructor({
|
|
@@ -101,9 +93,13 @@ class BaseProvider extends BaseController {
|
|
|
101
93
|
if (this._providerEngineProxy) {
|
|
102
94
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
95
|
this._providerEngineProxy.setTarget(provider);
|
|
96
|
+
|
|
104
97
|
// we want events to propagate from Ethereum provider -> wrapper provider (e.g. CommonJRPC provider) -> SDK -> dapp
|
|
105
98
|
// ensure that only one handler is added for each event
|
|
106
99
|
const reEmitHandler = event => {
|
|
100
|
+
// skip newListener event
|
|
101
|
+
if (event === "newListener") return;
|
|
102
|
+
|
|
107
103
|
// listen to the event from the Ethereum provider
|
|
108
104
|
provider.on(event, (...args) => {
|
|
109
105
|
// handle chainChanged event: update chainId state
|
|
@@ -113,11 +109,13 @@ class BaseProvider extends BaseController {
|
|
|
113
109
|
chainId
|
|
114
110
|
});
|
|
115
111
|
}
|
|
112
|
+
|
|
116
113
|
// re-emit the event
|
|
117
114
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
115
|
this.emit(event, ...args);
|
|
119
116
|
});
|
|
120
117
|
};
|
|
118
|
+
|
|
121
119
|
// handle existing events
|
|
122
120
|
this.eventNames().forEach(event => {
|
|
123
121
|
reEmitHandler(event);
|
|
@@ -2,13 +2,13 @@ import getCreateRandomId from 'json-rpc-random-id';
|
|
|
2
2
|
export { getED25519Key } from '@web3auth/auth';
|
|
3
3
|
|
|
4
4
|
const createRandomId = getCreateRandomId();
|
|
5
|
-
|
|
6
|
-
(function (EIP1193_EVENTS) {
|
|
5
|
+
let EIP1193_EVENTS = /*#__PURE__*/function (EIP1193_EVENTS) {
|
|
7
6
|
EIP1193_EVENTS["ACCOUNTS_CHANGED"] = "accountsChanged";
|
|
8
7
|
EIP1193_EVENTS["CHAIN_CHANGED"] = "chainChanged";
|
|
9
8
|
EIP1193_EVENTS["CONNECT"] = "connect";
|
|
10
9
|
EIP1193_EVENTS["DISCONNECT"] = "disconnect";
|
|
11
10
|
EIP1193_EVENTS["MESSAGE"] = "message";
|
|
12
|
-
|
|
11
|
+
return EIP1193_EVENTS;
|
|
12
|
+
}({});
|
|
13
13
|
|
|
14
14
|
export { EIP1193_EVENTS, createRandomId };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EthereumSigningProvider } from './providers/signingProviders/EthereumSigningProvider.js';
|
|
@@ -2,27 +2,14 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import { isHexString } from '@ethereumjs/util';
|
|
4
4
|
import { providerErrors, JRPCEngine, providerFromEngine, rpcErrors } from '@web3auth/auth';
|
|
5
|
+
import { createEthAccountMiddleware } from '../../rpc/ethRpcMiddlewares.js';
|
|
6
|
+
import { getProviderHandlers } from './signingUtils.js';
|
|
7
|
+
import { TransactionFormatter } from '../../../ethereum-provider/providers/privateKeyProviders/TransactionFormatter/formatter.js';
|
|
8
|
+
import { BaseProvider } from '../../../base-provider/baseProvider.js';
|
|
5
9
|
import { CHAIN_NAMESPACES } from '@toruslabs/base-controllers';
|
|
6
10
|
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
|
-
import { BaseProvider } from '../../../base-provider/baseProvider.js';
|
|
16
|
-
import '../../../base-provider/CommonJRPCProvider.js';
|
|
17
|
-
import '../../../base-provider/commonPrivateKeyProvider.js';
|
|
18
|
-
import '../../../base-provider/utils.js';
|
|
19
|
-
import { TransactionFormatter } from '../../../ethereum-provider/providers/privateKeyProviders/TransactionFormatter/formatter.js';
|
|
20
|
-
import '../../../ethereum-provider/providers/privateKeyProviders/TransactionFormatter/interfaces.js';
|
|
21
|
-
import '../../../ethereum-provider/providers/converter.js';
|
|
22
11
|
import { createEthMiddleware, createEthChainSwitchMiddleware } from '../../../ethereum-provider/rpc/ethRpcMiddlewares.js';
|
|
23
12
|
import { createEthJsonRpcClient } from '../../../ethereum-provider/rpc/jrpcClient.js';
|
|
24
|
-
import { createEthAccountMiddleware } from '../../rpc/ethRpcMiddlewares.js';
|
|
25
|
-
import { getProviderHandlers } from './signingUtils.js';
|
|
26
13
|
|
|
27
14
|
var _EthereumSigningProvider;
|
|
28
15
|
class EthereumSigningProvider extends BaseProvider {
|
package/dist/lib.esm/providers/ethereum-mpc-provider/providers/signingProviders/signingUtils.js
CHANGED
|
@@ -4,21 +4,9 @@ import { concatSig } from '@toruslabs/base-controllers';
|
|
|
4
4
|
import { providerErrors } from '@web3auth/auth';
|
|
5
5
|
import { hashMessage, Signature } from 'ethers';
|
|
6
6
|
import { validateTypedData, hexToBytes, hashTypedData } from 'viem';
|
|
7
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
8
|
-
import '../../../../base/errors/index.js';
|
|
9
|
-
import '../../../../base/wallet/index.js';
|
|
10
|
-
import '../../../../base/connector/constants.js';
|
|
11
|
-
import 'jwt-decode';
|
|
12
|
-
import { log } from '../../../../base/loglevel.js';
|
|
13
|
-
import '../../../../base/plugin/errors.js';
|
|
14
|
-
import '../../../../base/plugin/IPlugin.js';
|
|
15
|
-
import '@toruslabs/constants';
|
|
16
|
-
import '@toruslabs/http-helpers';
|
|
17
|
-
import 'bignumber.js';
|
|
18
|
-
import '../../../ethereum-provider/providers/converter.js';
|
|
19
|
-
import 'bn.js';
|
|
20
7
|
import { validateTypedSignMessageDataV4 } from '../../../ethereum-provider/providers/privateKeyProviders/TransactionFormatter/utils.js';
|
|
21
8
|
import { SignTypedDataVersion } from '../../../ethereum-provider/providers/privateKeyProviders/TransactionFormatter/interfaces.js';
|
|
9
|
+
import { log } from '../../../../base/loglevel.js';
|
|
22
10
|
|
|
23
11
|
async function signTx(txParams, sign, txFormatter) {
|
|
24
12
|
const {
|
|
@@ -37,10 +25,12 @@ async function signTx(txParams, sign, txFormatter) {
|
|
|
37
25
|
r,
|
|
38
26
|
s
|
|
39
27
|
} = vrs;
|
|
28
|
+
|
|
40
29
|
// mpc-core-kit workaround (revert back to 0/1)
|
|
41
30
|
if (v > 1) {
|
|
42
31
|
v = v - 27;
|
|
43
32
|
}
|
|
33
|
+
|
|
44
34
|
// addSignature will handle the v value
|
|
45
35
|
const tx = ethTx;
|
|
46
36
|
tx.signature = Signature.from({
|
|
@@ -5,6 +5,7 @@ import { BigNumber } from 'bignumber.js';
|
|
|
5
5
|
const BIG_NUMBER_WEI_MULTIPLIER = new BigNumber("1e18");
|
|
6
6
|
const BIG_NUMBER_GWEI_MULTIPLIER = new BigNumber("1e9");
|
|
7
7
|
const BIG_NUMBER_ETH_MULTIPLIER = new BigNumber("1");
|
|
8
|
+
|
|
8
9
|
// Setter Maps
|
|
9
10
|
const toBigNumber = {
|
|
10
11
|
hex: n => typeof n === "string" ? new BigNumber(stripHexPrefix(n), 16) : new BigNumber(n, 16),
|
|
@@ -2,21 +2,11 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
3
|
import { addHexPrefix, stripHexPrefix } from '@ethereumjs/util';
|
|
4
4
|
import { BigNumber } from 'bignumber.js';
|
|
5
|
-
import '@toruslabs/base-controllers';
|
|
6
|
-
import '@web3auth/auth';
|
|
7
|
-
import '../../../../../base/errors/index.js';
|
|
8
|
-
import '../../../../../base/wallet/index.js';
|
|
9
|
-
import '../../../../../base/connector/constants.js';
|
|
10
|
-
import 'jwt-decode';
|
|
11
|
-
import { log } from '../../../../../base/loglevel.js';
|
|
12
|
-
import '../../../../../base/plugin/errors.js';
|
|
13
|
-
import '../../../../../base/plugin/IPlugin.js';
|
|
14
|
-
import '@toruslabs/constants';
|
|
15
|
-
import '@toruslabs/http-helpers';
|
|
16
5
|
import { hexWEIToDecGWEI, decGWEIToHexWEI } from '../../converter.js';
|
|
17
6
|
import { bnLessThan, hexToBn, BnMultiplyByFraction, bnToHex } from '../../utils.js';
|
|
18
7
|
import { TRANSACTION_ENVELOPE_TYPES, EIP1559APIEndpoint, GAS_ESTIMATE_TYPES, LegacyGasAPIEndpoint, TRANSACTION_TYPES } from './constants.js';
|
|
19
8
|
import { fetchEip1159GasEstimates, fetchLegacyGasPriceEstimates } from './utils.js';
|
|
9
|
+
import { log } from '../../../../../base/loglevel.js';
|
|
20
10
|
|
|
21
11
|
class TransactionFormatter {
|
|
22
12
|
constructor({
|
|
@@ -108,14 +98,18 @@ class TransactionFormatter {
|
|
|
108
98
|
clonedTxParams.maxPriorityFeePerGas = clonedTxParams.maxFeePerGas;
|
|
109
99
|
}
|
|
110
100
|
}
|
|
101
|
+
|
|
111
102
|
// We remove the gasPrice param entirely when on an eip1559 compatible network
|
|
103
|
+
|
|
112
104
|
delete clonedTxParams.gasPrice;
|
|
113
105
|
} else {
|
|
114
106
|
// We ensure that maxFeePerGas and maxPriorityFeePerGas are not in the transaction params
|
|
115
107
|
// when not on a EIP1559 compatible network
|
|
108
|
+
|
|
116
109
|
delete clonedTxParams.maxPriorityFeePerGas;
|
|
117
110
|
delete clonedTxParams.maxFeePerGas;
|
|
118
111
|
}
|
|
112
|
+
|
|
119
113
|
// If we have gotten to this point, and none of gasPrice, maxPriorityFeePerGas or maxFeePerGas are
|
|
120
114
|
// set on txParams, it means that either we are on a non-EIP1559 network and the dapp didn't suggest
|
|
121
115
|
// a gas price, or we are on an EIP1559 network, and none of gasPrice, maxPriorityFeePerGas or maxFeePerGas
|
|
@@ -145,6 +139,7 @@ class TransactionFormatter {
|
|
|
145
139
|
method: "eth_feeHistory",
|
|
146
140
|
params: [noOfBlocks, newestBlock, percentileValues]
|
|
147
141
|
});
|
|
142
|
+
|
|
148
143
|
// this is in hex wei
|
|
149
144
|
const finalBaseFeePerGas = feeHistory.baseFeePerGas[feeHistory.baseFeePerGas.length - 1];
|
|
150
145
|
// this is in hex wei
|
|
@@ -279,6 +274,7 @@ class TransactionFormatter {
|
|
|
279
274
|
}
|
|
280
275
|
async estimateTxGas(txMeta) {
|
|
281
276
|
const txParams = _objectSpread({}, txMeta);
|
|
277
|
+
|
|
282
278
|
// `eth_estimateGas` can fail if the user has insufficient balance for the
|
|
283
279
|
// value being sent, or for the gas cost. We don't want to check their
|
|
284
280
|
// balance here, we just want the gas estimate. The gas price is removed
|
|
@@ -317,6 +313,7 @@ class TransactionFormatter {
|
|
|
317
313
|
const blockGasLimitBn = hexToBn(blockGasLimitHex);
|
|
318
314
|
const upperGasLimitBn = blockGasLimitBn.muln(0.9);
|
|
319
315
|
const bufferedGasLimitBn = initialGasLimitBn.muln(multiplier);
|
|
316
|
+
|
|
320
317
|
// if initialGasLimit is above blockGasLimit, dont modify it
|
|
321
318
|
if (initialGasLimitBn.gt(upperGasLimitBn)) return bnToHex(initialGasLimitBn);
|
|
322
319
|
// if bufferedGasLimit is below blockGasLimit, use bufferedGasLimit
|
|
@@ -363,6 +360,7 @@ class TransactionFormatter {
|
|
|
363
360
|
throw Error("TxGasUtil - Trying to call a function on a non-contract address");
|
|
364
361
|
}
|
|
365
362
|
const TWENTY_ONE_THOUSAND = 21000;
|
|
363
|
+
|
|
366
364
|
// This is a standard ether simple send, gas requirement is exactly 21k
|
|
367
365
|
return addHexPrefix(TWENTY_ONE_THOUSAND.toString(16));
|
|
368
366
|
}
|
|
@@ -370,6 +368,7 @@ class TransactionFormatter {
|
|
|
370
368
|
blockGasLimit,
|
|
371
369
|
estimatedGasHex
|
|
372
370
|
} = await this.analyzeGasUsage(txParams);
|
|
371
|
+
|
|
373
372
|
// add additional gas buffer to our estimation for safety
|
|
374
373
|
const gasLimit = this.addGasBuffer(addHexPrefix(estimatedGasHex), blockGasLimit);
|
|
375
374
|
return gasLimit;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
(function (SignTypedDataVersion) {
|
|
1
|
+
let SignTypedDataVersion = /*#__PURE__*/function (SignTypedDataVersion) {
|
|
3
2
|
SignTypedDataVersion["V1"] = "V1";
|
|
4
3
|
SignTypedDataVersion["V3"] = "V3";
|
|
5
4
|
SignTypedDataVersion["V4"] = "V4";
|
|
6
|
-
|
|
5
|
+
return SignTypedDataVersion;
|
|
6
|
+
}({});
|
|
7
7
|
|
|
8
8
|
export { SignTypedDataVersion };
|
|
@@ -14,9 +14,11 @@ function createWalletMiddleware({
|
|
|
14
14
|
if (!getAccounts) {
|
|
15
15
|
throw new Error("opts.getAccounts is required");
|
|
16
16
|
}
|
|
17
|
+
|
|
17
18
|
//
|
|
18
19
|
// utility
|
|
19
20
|
//
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* Validates the keyholder address, and returns a normalized (i.e. lowercase)
|
|
22
24
|
* copy of it.
|
|
@@ -37,15 +39,19 @@ function createWalletMiddleware({
|
|
|
37
39
|
message: `Invalid parameters: must provide an Ethereum address.`
|
|
38
40
|
});
|
|
39
41
|
}
|
|
42
|
+
|
|
40
43
|
//
|
|
41
44
|
// account lookups
|
|
42
45
|
//
|
|
46
|
+
|
|
43
47
|
async function lookupAccounts(req, res) {
|
|
44
48
|
res.result = await getAccounts(req);
|
|
45
49
|
}
|
|
50
|
+
|
|
46
51
|
//
|
|
47
52
|
// transaction signatures
|
|
48
53
|
//
|
|
54
|
+
|
|
49
55
|
async function sendTransaction(req, res) {
|
|
50
56
|
if (!processTransaction) {
|
|
51
57
|
throw rpcErrors.methodNotSupported();
|
|
@@ -66,9 +72,11 @@ function createWalletMiddleware({
|
|
|
66
72
|
txParams.from = await validateAndNormalizeKeyholder(txParams.from, req);
|
|
67
73
|
res.result = await processSignTransaction(txParams, req);
|
|
68
74
|
}
|
|
75
|
+
|
|
69
76
|
//
|
|
70
77
|
// message signatures
|
|
71
78
|
//
|
|
79
|
+
|
|
72
80
|
async function ethSign(req, res) {
|
|
73
81
|
if (!processEthSignMessage) {
|
|
74
82
|
throw rpcErrors.methodNotSupported();
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import { JRPCEngine, providerFromEngine } from '@web3auth/auth';
|
|
2
|
-
import '@toruslabs/base-controllers';
|
|
3
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import { WalletLoginError } from '../../../../../base/errors/index.js';
|
|
5
|
-
import '../../../../../base/wallet/index.js';
|
|
6
|
-
import '../../../../../base/connector/constants.js';
|
|
7
|
-
import 'jwt-decode';
|
|
8
|
-
import '../../../../../base/loglevel.js';
|
|
9
|
-
import '../../../../../base/plugin/errors.js';
|
|
10
|
-
import '../../../../../base/plugin/IPlugin.js';
|
|
11
|
-
import '@toruslabs/constants';
|
|
12
|
-
import '@toruslabs/http-helpers';
|
|
13
|
-
import { BaseProvider } from '../../../../base-provider/baseProvider.js';
|
|
14
|
-
import '../../../../base-provider/CommonJRPCProvider.js';
|
|
15
|
-
import '../../../../base-provider/commonPrivateKeyProvider.js';
|
|
16
|
-
import '../../../../base-provider/utils.js';
|
|
17
2
|
import { createConfigMiddleware } from '../../../rpc/JrpcClient.js';
|
|
18
3
|
import { createSolanaMiddleware } from '../../../rpc/solanaRpcMiddlewares.js';
|
|
4
|
+
import { BaseProvider } from '../../../../base-provider/baseProvider.js';
|
|
5
|
+
import { WalletLoginError } from '../../../../../base/errors/index.js';
|
|
19
6
|
|
|
20
7
|
class BaseInjectedProvider extends BaseProvider {
|
|
21
8
|
constructor({
|
package/dist/lib.esm/providers/solana-provider/providers/injectedProviders/walletStandardProvider.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import { SolanaSignAndSendTransaction, SolanaSignTransaction, SolanaSignMessage } from '@solana/wallet-standard-features';
|
|
2
2
|
import { PublicKey, VersionedTransaction } from '@solana/web3.js';
|
|
3
3
|
import { bs58 } from '@toruslabs/bs58';
|
|
4
|
-
import '@toruslabs/base-controllers';
|
|
5
|
-
import '@babel/runtime/helpers/defineProperty';
|
|
6
|
-
import '@web3auth/auth';
|
|
7
|
-
import { WalletLoginError } from '../../../../base/errors/index.js';
|
|
8
|
-
import '../../../../base/wallet/index.js';
|
|
9
|
-
import '../../../../base/connector/constants.js';
|
|
10
|
-
import 'jwt-decode';
|
|
11
|
-
import '../../../../base/loglevel.js';
|
|
12
|
-
import '../../../../base/plugin/errors.js';
|
|
13
|
-
import '../../../../base/plugin/IPlugin.js';
|
|
14
|
-
import '@toruslabs/constants';
|
|
15
|
-
import '@toruslabs/http-helpers';
|
|
16
4
|
import { BaseInjectedProvider } from './base/baseInjectedProvider.js';
|
|
17
5
|
import { getBaseProviderHandlers } from './base/providerHandlers.js';
|
|
18
6
|
import { getSolanaChainByChainConfig } from './utils.js';
|
|
7
|
+
import { WalletLoginError } from '../../../../base/errors/index.js';
|
|
19
8
|
|
|
20
9
|
class WalletStandardProvider extends BaseInjectedProvider {
|
|
21
10
|
getProviderHandlers(wallet) {
|
|
@@ -25,6 +14,7 @@ class WalletStandardProvider extends BaseInjectedProvider {
|
|
|
25
14
|
if (!account) throw WalletLoginError.notConnectedError();
|
|
26
15
|
return account;
|
|
27
16
|
};
|
|
17
|
+
|
|
28
18
|
/**
|
|
29
19
|
* Signs a message and returns the signature
|
|
30
20
|
* @param message - The message to sign
|
|
@@ -39,6 +29,7 @@ class WalletStandardProvider extends BaseInjectedProvider {
|
|
|
39
29
|
});
|
|
40
30
|
return bs58.encode(signature[0].signature);
|
|
41
31
|
};
|
|
32
|
+
|
|
42
33
|
/**
|
|
43
34
|
* Signs a transaction and returns the signature
|
|
44
35
|
* @param transaction - The transaction to sign
|
|
@@ -53,6 +44,7 @@ class WalletStandardProvider extends BaseInjectedProvider {
|
|
|
53
44
|
});
|
|
54
45
|
return bs58.encode(VersionedTransaction.deserialize(output[0].signedTransaction).signatures[0]);
|
|
55
46
|
};
|
|
47
|
+
|
|
56
48
|
/**
|
|
57
49
|
* Signs multiple transactions and returns the serialized transactions
|
|
58
50
|
* @param transactions - The transactions to sign
|
|
@@ -69,6 +61,7 @@ class WalletStandardProvider extends BaseInjectedProvider {
|
|
|
69
61
|
return Buffer.from(output[0].signedTransaction).toString("base64");
|
|
70
62
|
}));
|
|
71
63
|
};
|
|
64
|
+
|
|
72
65
|
/**
|
|
73
66
|
* Signs a transaction and sends it to the network
|
|
74
67
|
* @param transaction - The transaction to sign and send
|
|
@@ -22,6 +22,7 @@ class SolanaWallet {
|
|
|
22
22
|
});
|
|
23
23
|
return signature;
|
|
24
24
|
}
|
|
25
|
+
|
|
25
26
|
/**
|
|
26
27
|
* Signs a transaction and returns the signature
|
|
27
28
|
* @param transaction - The transaction to sign
|
|
@@ -36,6 +37,7 @@ class SolanaWallet {
|
|
|
36
37
|
});
|
|
37
38
|
return signature;
|
|
38
39
|
}
|
|
40
|
+
|
|
39
41
|
/**
|
|
40
42
|
* Signs multiple transactions and returns the serialized transactions
|
|
41
43
|
* @param transactions - The transactions to sign
|
|
@@ -51,6 +53,7 @@ class SolanaWallet {
|
|
|
51
53
|
});
|
|
52
54
|
return signedTransactions;
|
|
53
55
|
}
|
|
56
|
+
|
|
54
57
|
/**
|
|
55
58
|
* Signs a message and returns the signature
|
|
56
59
|
* @param message - The message to sign
|
package/dist/lib.esm/providers/xrpl-provider/providers/privateKeyProviders/xrplPrivateKeyProvider.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import { providerErrors, JRPCEngine, providerFromEngine, rpcErrors } from '@web3auth/auth';
|
|
3
|
-
import { CHAIN_NAMESPACES } from '@toruslabs/base-controllers';
|
|
4
|
-
import { WalletInitializationError } from '../../../../base/errors/index.js';
|
|
5
|
-
import '../../../../base/wallet/index.js';
|
|
6
|
-
import '../../../../base/connector/constants.js';
|
|
7
|
-
import 'jwt-decode';
|
|
8
|
-
import '../../../../base/loglevel.js';
|
|
9
|
-
import '../../../../base/plugin/errors.js';
|
|
10
|
-
import '../../../../base/plugin/IPlugin.js';
|
|
11
|
-
import '@toruslabs/constants';
|
|
12
|
-
import '@toruslabs/http-helpers';
|
|
13
|
-
import { BaseProvider } from '../../../base-provider/baseProvider.js';
|
|
14
|
-
import '../../../base-provider/CommonJRPCProvider.js';
|
|
15
|
-
import '../../../base-provider/commonPrivateKeyProvider.js';
|
|
16
|
-
import '../../../base-provider/utils.js';
|
|
17
3
|
import { createXrplJsonRpcClient } from '../../rpc/JrpcClient.js';
|
|
18
4
|
import { RPC_METHODS, createXRPLMiddleware, creatXrplChainSwitchMiddleware } from '../../rpc/xrplRpcMiddlewares.js';
|
|
19
5
|
import { getProviderHandlers } from './xrplWalletUtils.js';
|
|
6
|
+
import { BaseProvider } from '../../../base-provider/baseProvider.js';
|
|
7
|
+
import { CHAIN_NAMESPACES } from '@toruslabs/base-controllers';
|
|
8
|
+
import { WalletInitializationError } from '../../../../base/errors/index.js';
|
|
20
9
|
|
|
21
10
|
var _XrplPrivateKeyProvider;
|
|
22
11
|
class XrplPrivateKeyProvider extends BaseProvider {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { WalletServicesContextProvider } from './context/WalletServicesInnerContext.js';
|
|
3
|
+
import { Web3AuthInnerContext, Web3AuthInnerProvider } from './context/Web3AuthInnerContext.js';
|
|
4
|
+
|
|
5
|
+
function Web3AuthProvider({
|
|
6
|
+
config,
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
const pluginChild = createElement(WalletServicesContextProvider, {
|
|
10
|
+
context: Web3AuthInnerContext
|
|
11
|
+
}, children);
|
|
12
|
+
return createElement(Web3AuthInnerProvider, {
|
|
13
|
+
config
|
|
14
|
+
}, pluginChild);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Web3AuthProvider };
|