@dynamic-labs/multi-wallet 0.17.0-RC.3 → 0.17.0-RC.30
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/CHANGELOG.md +312 -0
- package/package.json +10 -26
- package/src/index.cjs +0 -69
- package/src/index.d.ts +0 -18
- package/src/index.js +1 -23
- package/src/multi-wallet.cjs +36 -176
- package/src/multi-wallet.d.ts +1 -3
- package/src/multi-wallet.js +36 -175
- package/src/types.d.ts +12 -50
- package/src/utils/getApiProviders.cjs +15 -0
- package/src/utils/getApiProviders.d.ts +17 -0
- package/src/utils/getApiProviders.js +11 -0
- package/src/utils/message.cjs +3 -4
- package/src/utils/message.d.ts +2 -2
- package/src/utils/message.js +1 -2
- package/src/errors.cjs +0 -66
- package/src/errors.d.ts +0 -34
- package/src/errors.js +0 -54
- package/src/polyfills.cjs +0 -16
- package/src/polyfills.d.ts +0 -1
- package/src/polyfills.js +0 -14
- package/src/rpcProviders.cjs +0 -76
- package/src/rpcProviders.d.ts +0 -5
- package/src/rpcProviders.js +0 -69
- package/src/utils/CancellablePromise/CancellablePromise.cjs +0 -33
- package/src/utils/CancellablePromise/CancellablePromise.d.ts +0 -9
- package/src/utils/CancellablePromise/CancellablePromise.js +0 -29
- package/src/utils/CancellablePromise/index.d.ts +0 -1
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs +0 -54
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.d.ts +0 -3
- package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js +0 -50
- package/src/utils/assignConfirmationScreenToProvider/index.d.ts +0 -1
- package/src/utils/convertors.cjs +0 -43
- package/src/utils/convertors.d.ts +0 -3
- package/src/utils/convertors.js +0 -38
- package/src/utils/encoding.cjs +0 -18
- package/src/utils/encoding.d.ts +0 -4
- package/src/utils/encoding.js +0 -12
- package/src/utils/extractNonce.cjs +0 -13
- package/src/utils/extractNonce.d.ts +0 -1
- package/src/utils/extractNonce.js +0 -9
- package/src/utils/getChainInfo/getChainInfo.cjs +0 -59
- package/src/utils/getChainInfo/getChainInfo.d.ts +0 -2
- package/src/utils/getChainInfo/getChainInfo.js +0 -55
- package/src/utils/getChainInfo/index.d.ts +0 -1
- package/src/utils/getWalletConnectorByName.cjs +0 -19
- package/src/utils/getWalletConnectorByName.d.ts +0 -2
- package/src/utils/getWalletConnectorByName.js +0 -15
- package/src/utils/isEmailOTPWalletConnector/index.d.ts +0 -1
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.cjs +0 -7
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.d.ts +0 -2
- package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js +0 -3
- package/src/utils/isEmailWalletConnector/index.d.ts +0 -1
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.cjs +0 -7
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.d.ts +0 -2
- package/src/utils/isEmailWalletConnector/isEmailWalletConnector.js +0 -3
- package/src/utils/isFunction/index.d.ts +0 -1
- package/src/utils/isFunction/isFunction.cjs +0 -8
- package/src/utils/isFunction/isFunction.d.ts +0 -1
- package/src/utils/isFunction/isFunction.js +0 -4
- package/src/utils/isMobile.cjs +0 -54
- package/src/utils/isMobile.d.ts +0 -13
- package/src/utils/isMobile.js +0 -46
- package/src/utils/isSameAddress/index.d.ts +0 -1
- package/src/utils/isSameAddress/isSameAddress.cjs +0 -9
- package/src/utils/isSameAddress/isSameAddress.d.ts +0 -1
- package/src/utils/isSameAddress/isSameAddress.js +0 -5
- package/src/utils/isSameAddress/utils/index.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/index.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.cjs +0 -17
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.d.ts +0 -1
- package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js +0 -13
- package/src/utils/isSocialWalletConnector/index.d.ts +0 -1
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.cjs +0 -7
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.d.ts +0 -2
- package/src/utils/isSocialWalletConnector/isSocialWalletConnector.js +0 -3
- package/src/utils/isUnsupportedProviderError/index.d.ts +0 -1
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.d.ts +0 -6
- package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
- package/src/utils/localStorageAsync.cjs +0 -28
- package/src/utils/localStorageAsync.d.ts +0 -3
- package/src/utils/localStorageAsync.js +0 -22
- package/src/utils/logger.cjs +0 -9
- package/src/utils/logger.d.ts +0 -2
- package/src/utils/logger.js +0 -5
- package/src/utils/normalizeWalletName/index.d.ts +0 -1
- package/src/utils/normalizeWalletName/normalizeWalletName.cjs +0 -7
- package/src/utils/normalizeWalletName/normalizeWalletName.d.ts +0 -1
- package/src/utils/normalizeWalletName/normalizeWalletName.js +0 -3
- package/src/utils/shouldLowercaseAddress.cjs +0 -11
- package/src/utils/shouldLowercaseAddress.d.ts +0 -1
- package/src/utils/shouldLowercaseAddress.js +0 -7
- package/src/utils/walletConnect.cjs +0 -30
- package/src/utils/walletConnect.d.ts +0 -4
- package/src/utils/walletConnect.js +0 -26
- package/src/wallets/ProviderLookup.cjs +0 -18
- package/src/wallets/ProviderLookup.d.ts +0 -4
- package/src/wallets/ProviderLookup.js +0 -14
- package/src/wallets/algorand/MyAlgoWalletConnector.cjs +0 -149
- package/src/wallets/algorand/MyAlgoWalletConnector.d.ts +0 -21
- package/src/wallets/algorand/MyAlgoWalletConnector.js +0 -143
- package/src/wallets/algorand/myalgoSigner.cjs +0 -24
- package/src/wallets/algorand/myalgoSigner.d.ts +0 -21
- package/src/wallets/algorand/myalgoSigner.js +0 -20
- package/src/wallets/clients/coinbase/coinbase.cjs +0 -73
- package/src/wallets/clients/coinbase/coinbase.d.ts +0 -6
- package/src/wallets/clients/coinbase/coinbase.js +0 -66
- package/src/wallets/clients/coinbase/index.d.ts +0 -2
- package/src/wallets/clients/coinbase/types.d.ts +0 -14
- package/src/wallets/clients/walletConnect/index.d.ts +0 -1
- package/src/wallets/clients/walletConnect/types.d.ts +0 -4
- package/src/wallets/clients/walletConnect/walletConnect.cjs +0 -204
- package/src/wallets/clients/walletConnect/walletConnect.d.ts +0 -22
- package/src/wallets/clients/walletConnect/walletConnect.js +0 -187
- package/src/wallets/constants.cjs +0 -16
- package/src/wallets/constants.d.ts +0 -4
- package/src/wallets/constants.js +0 -10
- package/src/wallets/cosmos/KeplrWalletConnect.cjs +0 -196
- package/src/wallets/cosmos/KeplrWalletConnect.d.ts +0 -46
- package/src/wallets/cosmos/KeplrWalletConnect.js +0 -194
- package/src/wallets/cosmos/KeplrWalletConnector.cjs +0 -193
- package/src/wallets/cosmos/KeplrWalletConnector.d.ts +0 -70
- package/src/wallets/cosmos/KeplrWalletConnector.js +0 -189
- package/src/wallets/cosmos/getKeplrConnector.cjs +0 -18
- package/src/wallets/cosmos/getKeplrConnector.d.ts +0 -6
- package/src/wallets/cosmos/getKeplrConnector.js +0 -14
- package/src/wallets/cosmos/index.d.ts +0 -1
- package/src/wallets/cosmos/utils/indexDB.cjs +0 -97
- package/src/wallets/cosmos/utils/indexDB.d.ts +0 -18
- package/src/wallets/cosmos/utils/indexDB.js +0 -93
- package/src/wallets/cosmos/wcClient.cjs +0 -333
- package/src/wallets/cosmos/wcClient.d.ts +0 -104
- package/src/wallets/cosmos/wcClient.js +0 -325
- package/src/wallets/ethereum/BloctoEvm.cjs +0 -111
- package/src/wallets/ethereum/BloctoEvm.d.ts +0 -25
- package/src/wallets/ethereum/BloctoEvm.js +0 -105
- package/src/wallets/ethereum/EthWalletConnector.cjs +0 -191
- package/src/wallets/ethereum/EthWalletConnector.d.ts +0 -35
- package/src/wallets/ethereum/EthWalletConnector.js +0 -187
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.cjs +0 -63
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.d.ts +0 -12
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.js +0 -59
- package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.cjs +0 -62
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.d.ts +0 -11
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.js +0 -58
- package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +0 -102
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +0 -33
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +0 -98
- package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/index.d.ts +0 -2
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs +0 -55
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.d.ts +0 -12
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js +0 -51
- package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/index.d.ts +0 -1
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +0 -175
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +0 -53
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +0 -171
- package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/index.d.ts +0 -2
- package/src/wallets/ethereum/MagicConnector/index.d.ts +0 -5
- package/src/wallets/ethereum/coinbase.cjs +0 -65
- package/src/wallets/ethereum/coinbase.d.ts +0 -26
- package/src/wallets/ethereum/coinbase.js +0 -63
- package/src/wallets/ethereum/ethProviderHelper.cjs +0 -197
- package/src/wallets/ethereum/ethProviderHelper.d.ts +0 -40
- package/src/wallets/ethereum/ethProviderHelper.js +0 -193
- package/src/wallets/ethereum/evm-network.cjs +0 -20
- package/src/wallets/ethereum/evm-network.d.ts +0 -22
- package/src/wallets/ethereum/evm-network.js +0 -16
- package/src/wallets/ethereum/fortmatic.cjs +0 -75
- package/src/wallets/ethereum/fortmatic.d.ts +0 -26
- package/src/wallets/ethereum/fortmatic.js +0 -69
- package/src/wallets/ethereum/injected/BloctoInjected.cjs +0 -13
- package/src/wallets/ethereum/injected/BloctoInjected.d.ts +0 -6
- package/src/wallets/ethereum/injected/BloctoInjected.js +0 -11
- package/src/wallets/ethereum/injected/BraveEvm.cjs +0 -13
- package/src/wallets/ethereum/injected/BraveEvm.d.ts +0 -6
- package/src/wallets/ethereum/injected/BraveEvm.js +0 -11
- package/src/wallets/ethereum/injected/Dawn.cjs +0 -13
- package/src/wallets/ethereum/injected/Dawn.d.ts +0 -6
- package/src/wallets/ethereum/injected/Dawn.js +0 -11
- package/src/wallets/ethereum/injected/ExodusEvm.cjs +0 -13
- package/src/wallets/ethereum/injected/ExodusEvm.d.ts +0 -6
- package/src/wallets/ethereum/injected/ExodusEvm.js +0 -11
- package/src/wallets/ethereum/injected/Frame.cjs +0 -13
- package/src/wallets/ethereum/injected/Frame.d.ts +0 -6
- package/src/wallets/ethereum/injected/Frame.js +0 -11
- package/src/wallets/ethereum/injected/GameStop.cjs +0 -13
- package/src/wallets/ethereum/injected/GameStop.d.ts +0 -6
- package/src/wallets/ethereum/injected/GameStop.js +0 -11
- package/src/wallets/ethereum/injected/Opera.cjs +0 -13
- package/src/wallets/ethereum/injected/Opera.d.ts +0 -6
- package/src/wallets/ethereum/injected/Opera.js +0 -11
- package/src/wallets/ethereum/injected/PhantomEvm.cjs +0 -37
- package/src/wallets/ethereum/injected/PhantomEvm.d.ts +0 -7
- package/src/wallets/ethereum/injected/PhantomEvm.js +0 -35
- package/src/wallets/ethereum/injected/Trust.cjs +0 -13
- package/src/wallets/ethereum/injected/Trust.d.ts +0 -6
- package/src/wallets/ethereum/injected/Trust.js +0 -11
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.cjs +0 -13
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.d.ts +0 -6
- package/src/wallets/ethereum/injected/UnknownInjectedWallet.js +0 -11
- package/src/wallets/ethereum/injected/Zerion.cjs +0 -13
- package/src/wallets/ethereum/injected/Zerion.d.ts +0 -6
- package/src/wallets/ethereum/injected/Zerion.js +0 -11
- package/src/wallets/ethereum/meta-mask.cjs +0 -63
- package/src/wallets/ethereum/meta-mask.d.ts +0 -26
- package/src/wallets/ethereum/meta-mask.js +0 -61
- package/src/wallets/flow/FlowWalletConnector.cjs +0 -163
- package/src/wallets/flow/FlowWalletConnector.d.ts +0 -29
- package/src/wallets/flow/FlowWalletConnector.js +0 -158
- package/src/wallets/flow/blocto.cjs +0 -22
- package/src/wallets/flow/blocto.d.ts +0 -7
- package/src/wallets/flow/blocto.js +0 -20
- package/src/wallets/flow/dapper.cjs +0 -22
- package/src/wallets/flow/dapper.d.ts +0 -7
- package/src/wallets/flow/dapper.js +0 -20
- package/src/wallets/flow/lilico.cjs +0 -42
- package/src/wallets/flow/lilico.d.ts +0 -8
- package/src/wallets/flow/lilico.js +0 -40
- package/src/wallets/getMobileOrInjectedWallet.cjs +0 -26
- package/src/wallets/getMobileOrInjectedWallet.d.ts +0 -8
- package/src/wallets/getMobileOrInjectedWallet.js +0 -22
- package/src/wallets/getWalletConnectConnector.cjs +0 -19
- package/src/wallets/getWalletConnectConnector.d.ts +0 -8
- package/src/wallets/getWalletConnectConnector.js +0 -15
- package/src/wallets/solana/CoinbaseSolana.cjs +0 -54
- package/src/wallets/solana/CoinbaseSolana.d.ts +0 -17
- package/src/wallets/solana/CoinbaseSolana.js +0 -52
- package/src/wallets/solana/glow.cjs +0 -51
- package/src/wallets/solana/glow.d.ts +0 -16
- package/src/wallets/solana/glow.js +0 -49
- package/src/wallets/solana/injected/BraveSol.cjs +0 -18
- package/src/wallets/solana/injected/BraveSol.d.ts +0 -6
- package/src/wallets/solana/injected/BraveSol.js +0 -16
- package/src/wallets/solana/injected/ExodusSol.cjs +0 -12
- package/src/wallets/solana/injected/ExodusSol.d.ts +0 -5
- package/src/wallets/solana/injected/ExodusSol.js +0 -10
- package/src/wallets/solana/phantom-ledger.cjs +0 -71
- package/src/wallets/solana/phantom-ledger.d.ts +0 -16
- package/src/wallets/solana/phantom-ledger.js +0 -65
- package/src/wallets/solana/phantom.cjs +0 -74
- package/src/wallets/solana/phantom.d.ts +0 -17
- package/src/wallets/solana/phantom.js +0 -72
- package/src/wallets/solana/slope.cjs +0 -96
- package/src/wallets/solana/slope.d.ts +0 -27
- package/src/wallets/solana/slope.js +0 -94
- package/src/wallets/solana/solProviderHelper.cjs +0 -164
- package/src/wallets/solana/solProviderHelper.d.ts +0 -29
- package/src/wallets/solana/solProviderHelper.js +0 -160
- package/src/wallets/solana/solWalletConnector.cjs +0 -57
- package/src/wallets/solana/solWalletConnector.d.ts +0 -18
- package/src/wallets/solana/solWalletConnector.js +0 -53
- package/src/wallets/solana/solflare.cjs +0 -65
- package/src/wallets/solana/solflare.d.ts +0 -14
- package/src/wallets/solana/solflare.js +0 -63
- package/src/wallets/starknet/argentx.cjs +0 -20
- package/src/wallets/starknet/argentx.d.ts +0 -7
- package/src/wallets/starknet/argentx.js +0 -18
- package/src/wallets/starknet/braavos.cjs +0 -33
- package/src/wallets/starknet/braavos.d.ts +0 -7
- package/src/wallets/starknet/braavos.js +0 -31
- package/src/wallets/starknet/ethereumContractAbi.cjs +0 -357
- package/src/wallets/starknet/ethereumContractAbi.js +0 -355
- package/src/wallets/starknet/starknetWalletConnector.cjs +0 -171
- package/src/wallets/starknet/starknetWalletConnector.d.ts +0 -34
- package/src/wallets/starknet/starknetWalletConnector.js +0 -169
- package/src/wallets/walletConnect/index.d.ts +0 -2
- package/src/wallets/walletConnect/walletConnect.cjs +0 -130
- package/src/wallets/walletConnect/walletConnect.d.ts +0 -34
- package/src/wallets/walletConnect/walletConnect.js +0 -124
- package/src/wallets/walletConnect/walletConnectV2.cjs +0 -268
- package/src/wallets/walletConnect/walletConnectV2.d.ts +0 -38
- package/src/wallets/walletConnect/walletConnectV2.js +0 -262
- package/src/wallets/walletConnect/zerion.d.ts +0 -8
- package/src/wallets/window.d.ts +0 -95
package/src/multi-wallet.cjs
CHANGED
|
@@ -2,64 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
6
6
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var slope = require('./wallets/solana/slope.cjs');
|
|
10
|
-
var solflare = require('./wallets/solana/solflare.cjs');
|
|
11
|
-
var glow = require('./wallets/solana/glow.cjs');
|
|
12
|
-
var blocto = require('./wallets/flow/blocto.cjs');
|
|
13
|
-
var dapper = require('./wallets/flow/dapper.cjs');
|
|
14
|
-
var isMobile = require('./utils/isMobile.cjs');
|
|
15
|
-
var walletConnect = require('./utils/walletConnect.cjs');
|
|
16
|
-
var MyAlgoWalletConnector = require('./wallets/algorand/MyAlgoWalletConnector.cjs');
|
|
17
|
-
var BraveEvm = require('./wallets/ethereum/injected/BraveEvm.cjs');
|
|
18
|
-
var Opera = require('./wallets/ethereum/injected/Opera.cjs');
|
|
19
|
-
var BraveSol = require('./wallets/solana/injected/BraveSol.cjs');
|
|
20
|
-
var UnknownInjectedWallet = require('./wallets/ethereum/injected/UnknownInjectedWallet.cjs');
|
|
21
|
-
var GameStop = require('./wallets/ethereum/injected/GameStop.cjs');
|
|
22
|
-
var ExodusEvm = require('./wallets/ethereum/injected/ExodusEvm.cjs');
|
|
23
|
-
var ExodusSol = require('./wallets/solana/injected/ExodusSol.cjs');
|
|
24
|
-
var BloctoInjected = require('./wallets/ethereum/injected/BloctoInjected.cjs');
|
|
25
|
-
var argentx = require('./wallets/starknet/argentx.cjs');
|
|
26
|
-
var braavos = require('./wallets/starknet/braavos.cjs');
|
|
27
|
-
var BloctoEvm = require('./wallets/ethereum/BloctoEvm.cjs');
|
|
28
|
-
var phantomLedger = require('./wallets/solana/phantom-ledger.cjs');
|
|
29
|
-
var CoinbaseSolana = require('./wallets/solana/CoinbaseSolana.cjs');
|
|
30
|
-
var Frame = require('./wallets/ethereum/injected/Frame.cjs');
|
|
31
|
-
var fortmatic = require('./wallets/ethereum/fortmatic.cjs');
|
|
32
|
-
var lilico = require('./wallets/flow/lilico.cjs');
|
|
33
|
-
var getWalletConnectConnector = require('./wallets/getWalletConnectConnector.cjs');
|
|
34
|
-
var Dawn = require('./wallets/ethereum/injected/Dawn.cjs');
|
|
35
|
-
var PhantomEvm = require('./wallets/ethereum/injected/PhantomEvm.cjs');
|
|
36
|
-
require('magic-sdk');
|
|
37
|
-
require('ethers');
|
|
38
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
39
|
-
require('./utils/logger.cjs');
|
|
40
|
-
var EmailOTPMagicWalletConnector = require('./wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.cjs');
|
|
41
|
-
var MagicSocialWalletConnector = require('./wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs');
|
|
42
|
-
var isEmailWalletConnector = require('./utils/isEmailWalletConnector/isEmailWalletConnector.cjs');
|
|
43
|
-
var getKeplrConnector = require('./wallets/cosmos/getKeplrConnector.cjs');
|
|
44
|
-
var Zerion = require('./wallets/ethereum/injected/Zerion.cjs');
|
|
45
|
-
var getMobileOrInjectedWallet = require('./wallets/getMobileOrInjectedWallet.cjs');
|
|
46
|
-
var metaMask = require('./wallets/ethereum/meta-mask.cjs');
|
|
47
|
-
var Trust = require('./wallets/ethereum/injected/Trust.cjs');
|
|
7
|
+
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var getApiProviders = require('./utils/getApiProviders.cjs');
|
|
48
9
|
|
|
49
10
|
let wallets = [];
|
|
50
|
-
// These wallets are either not supported or implement their
|
|
51
|
-
// own WalletConnect connector
|
|
52
|
-
const filteredWalletConnectWallets = [
|
|
53
|
-
'MetaMask',
|
|
54
|
-
'Gnosis Safe',
|
|
55
|
-
'Trust',
|
|
56
|
-
'lilico',
|
|
57
|
-
'Keplr',
|
|
58
|
-
'Zerion',
|
|
59
|
-
];
|
|
60
11
|
const defaultWalletUiUtils = {
|
|
61
|
-
|
|
62
|
-
throw Error('
|
|
12
|
+
disabledConfirmationOnce: () => {
|
|
13
|
+
throw Error('disabledConfirmationOnce, not implemented');
|
|
63
14
|
},
|
|
64
15
|
sendTransaction: () => {
|
|
65
16
|
throw Error('requestSendTransactionConfirmation not implemented');
|
|
@@ -68,112 +19,37 @@ const defaultWalletUiUtils = {
|
|
|
68
19
|
throw Error('signMessage not implemented');
|
|
69
20
|
},
|
|
70
21
|
};
|
|
71
|
-
const getSupportedWallets = (
|
|
72
|
-
appLogoUrl: '',
|
|
73
|
-
appName: '',
|
|
74
|
-
isWalletConnectV2Enabled: false,
|
|
75
|
-
networkConfigurations: { cosmos: [], evm: [], solana: [], starknet: [] },
|
|
76
|
-
skipMemo: false,
|
|
77
|
-
vendorCredentials: {},
|
|
78
|
-
walletConnectProjectId: '',
|
|
79
|
-
}) => tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
const getSupportedWallets = (args) => {
|
|
23
|
+
const { appLogoUrl = '', appName = '', chainRpcProviders, flowNetwork, isWalletConnectV2Enabled = false, networkConfigurations = { cosmos: [], evm: [], solana: [], starknet: [] }, customerApiProviders = [], skipMemo = false, walletConnectProjectId = '', walletConnectorsProp, walletUiUtils = undefined, } = args;
|
|
80
24
|
if (!skipMemo && wallets.length > 0) {
|
|
81
25
|
return wallets;
|
|
82
26
|
}
|
|
83
27
|
const evmNetworkConfigs = (networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.evm) || [];
|
|
84
28
|
const solanaNetworkConfigs = (networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.solana) || [];
|
|
85
29
|
const cosmosNetworkConfigs = (networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.cosmos) || [];
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}),
|
|
105
|
-
new PhantomEvm({ evmNetworks: evmNetworkConfigs }),
|
|
106
|
-
new phantomLedger["default"]({ solNetworks: solanaNetworkConfigs }),
|
|
107
|
-
new coinbase({
|
|
108
|
-
appLogoUrl,
|
|
109
|
-
appName,
|
|
110
|
-
evmNetworks: evmNetworkConfigs,
|
|
111
|
-
}),
|
|
112
|
-
new solflare({ solNetworks: solanaNetworkConfigs }),
|
|
113
|
-
new glow({ solNetworks: solanaNetworkConfigs }),
|
|
114
|
-
new slope({ solNetworks: solanaNetworkConfigs }),
|
|
115
|
-
new dapper({ appLogoUrl, appName }),
|
|
116
|
-
new blocto({ appLogoUrl, appName }),
|
|
117
|
-
new BloctoEvm({ evmNetworks: evmNetworkConfigs }),
|
|
118
|
-
new BloctoInjected({ evmNetworks: evmNetworkConfigs }),
|
|
119
|
-
getWalletConnectConnector.getWalletConnectConnector({
|
|
120
|
-
evmNetworks: evmNetworkConfigs,
|
|
121
|
-
isWalletConnectV2Enabled,
|
|
122
|
-
projectId: walletConnectProjectId,
|
|
123
|
-
}),
|
|
124
|
-
new BraveSol({ solNetworks: solanaNetworkConfigs }),
|
|
125
|
-
new BraveEvm({ evmNetworks: evmNetworkConfigs }),
|
|
126
|
-
new UnknownInjectedWallet({ evmNetworks: evmNetworkConfigs }),
|
|
127
|
-
new GameStop({ evmNetworks: evmNetworkConfigs }),
|
|
128
|
-
new ExodusEvm({ evmNetworks: evmNetworkConfigs }),
|
|
129
|
-
new ExodusSol({ solNetworks: solanaNetworkConfigs }),
|
|
130
|
-
new Opera({ evmNetworks: evmNetworkConfigs }),
|
|
131
|
-
...(magicLinkApiKey
|
|
132
|
-
? [
|
|
133
|
-
new EmailOTPMagicWalletConnector.EmailOTPMagicWalletConnector({
|
|
134
|
-
apiKey: magicLinkApiKey,
|
|
135
|
-
config: magicLinkConfig,
|
|
136
|
-
evmNetworks: evmNetworkConfigs,
|
|
137
|
-
walletUiUtils: walletUiUtils || defaultWalletUiUtils,
|
|
138
|
-
}),
|
|
139
|
-
new MagicSocialWalletConnector.MagicSocialWalletConnector({
|
|
140
|
-
apiKey: magicLinkApiKey,
|
|
141
|
-
config: magicLinkConfig,
|
|
142
|
-
evmNetworks: evmNetworkConfigs,
|
|
143
|
-
walletUiUtils: walletUiUtils || defaultWalletUiUtils,
|
|
144
|
-
}),
|
|
145
|
-
]
|
|
146
|
-
: []),
|
|
147
|
-
new MyAlgoWalletConnector(),
|
|
148
|
-
new argentx(),
|
|
149
|
-
new braavos(),
|
|
150
|
-
new CoinbaseSolana({ solNetworks: solanaNetworkConfigs }),
|
|
151
|
-
new Frame({ evmNetworks: evmNetworkConfigs }),
|
|
152
|
-
new lilico({ appLogoUrl, appName }),
|
|
153
|
-
getMobileOrInjectedWallet.getMobileOrInjectedWallet({
|
|
154
|
-
evmNetworks: evmNetworkConfigs,
|
|
155
|
-
injectedWallet: new Zerion({ evmNetworks: evmNetworkConfigs }),
|
|
156
|
-
isWalletConnectV2: isWalletConnectV2Enabled,
|
|
157
|
-
walletConnectName: 'Zerion',
|
|
158
|
-
}),
|
|
159
|
-
//TODO: https://linear.app/dynamic-labs/issue/DYN-2127/rename-evmnetworks-to-networks-across-the-application
|
|
160
|
-
getKeplrConnector.getKeplerConnector({ evmNetworks: cosmosNetworkConfigs }),
|
|
161
|
-
...((vendorCredentials === null || vendorCredentials === void 0 ? void 0 : vendorCredentials.fortmatic)
|
|
162
|
-
? [
|
|
163
|
-
new fortmatic({
|
|
164
|
-
apiKey: vendorCredentials.fortmatic,
|
|
165
|
-
evmNetworks: evmNetworkConfigs,
|
|
166
|
-
}),
|
|
167
|
-
]
|
|
168
|
-
: []),
|
|
169
|
-
...filtered,
|
|
170
|
-
];
|
|
171
|
-
yield Promise.all(allWallets.map((wallet) => { var _a; return (_a = wallet.init) === null || _a === void 0 ? void 0 : _a.call(wallet); }));
|
|
30
|
+
const apiProviders = getApiProviders.getApiProviders(customerApiProviders);
|
|
31
|
+
const opts = {
|
|
32
|
+
apiProviders,
|
|
33
|
+
appLogoUrl,
|
|
34
|
+
appName,
|
|
35
|
+
chainRpcProviders,
|
|
36
|
+
cosmosNetworks: cosmosNetworkConfigs,
|
|
37
|
+
evmNetworks: evmNetworkConfigs,
|
|
38
|
+
flowNetwork,
|
|
39
|
+
isWalletConnectV2Enabled,
|
|
40
|
+
projectId: walletConnectProjectId,
|
|
41
|
+
solNetworks: solanaNetworkConfigs,
|
|
42
|
+
walletUiUtils: walletUiUtils || defaultWalletUiUtils,
|
|
43
|
+
};
|
|
44
|
+
const allWallets = walletConnectorsProp
|
|
45
|
+
.map((walletConnector) => walletConnector(opts))
|
|
46
|
+
.flat()
|
|
47
|
+
.map((wallet) => new wallet(opts).getMobileOrInstalledWallet());
|
|
172
48
|
// Memoize the wallets
|
|
173
49
|
const filteredWallets = filterWalletsForPlatform(allWallets);
|
|
174
50
|
wallets = applyLinksOverrides(filteredWallets);
|
|
175
51
|
return wallets;
|
|
176
|
-
}
|
|
52
|
+
};
|
|
177
53
|
const applyLinksOverrides = (wallets) => wallets.map((wallet) => {
|
|
178
54
|
const metadata = walletBook.getWalletBookWallet(wallet.name);
|
|
179
55
|
if (metadata.switchNetworkOnlyFromWallet !== undefined) {
|
|
@@ -186,30 +62,22 @@ const filterWalletsForPlatform = (wallets) => wallets.filter((wallet) => {
|
|
|
186
62
|
if (wallet.isInstalledOnBrowser()) {
|
|
187
63
|
return true;
|
|
188
64
|
}
|
|
189
|
-
else if (
|
|
65
|
+
else if (walletConnectorCore.isEmbeddedConnector(wallet)) {
|
|
190
66
|
return true;
|
|
191
67
|
}
|
|
192
68
|
else if (metadata.showOnlyIfInstalled) {
|
|
193
69
|
return false;
|
|
194
70
|
}
|
|
195
|
-
else if (!
|
|
71
|
+
else if (!utils.isMobile()) {
|
|
196
72
|
return true;
|
|
197
73
|
}
|
|
198
74
|
else {
|
|
199
|
-
return handleMobileWalletFilter(wallet, metadata);
|
|
75
|
+
return handleMobileWalletFilter(wallet.name, metadata);
|
|
200
76
|
}
|
|
201
77
|
});
|
|
202
|
-
const handleMobileWalletFilter = (
|
|
78
|
+
const handleMobileWalletFilter = (walletName, metadata) => {
|
|
203
79
|
if (!metadata.mobile)
|
|
204
80
|
return false;
|
|
205
|
-
/**
|
|
206
|
-
* Custom check added with DYN-1489 for mobile version only:
|
|
207
|
-
* it shows a WalletConnect listItem that wraps-up all the WalletConnect wallets
|
|
208
|
-
* in a new wallet-list view.
|
|
209
|
-
*/
|
|
210
|
-
if (wallet.isWalletConnect && wallet.name === 'WalletConnect') {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
81
|
/**
|
|
214
82
|
* WalletConnect provides a "universal" and "native" deep link. They recommend using
|
|
215
83
|
* the universal deep link over the native one due to UX differences, and our current
|
|
@@ -218,20 +86,14 @@ const handleMobileWalletFilter = (wallet, metadata) => {
|
|
|
218
86
|
*/
|
|
219
87
|
const hasWalletConnectLink = Boolean(metadata.mobile.universal) || Boolean(metadata.mobile.native);
|
|
220
88
|
const isWalletConnectWallet = metadata.walletConnect !== undefined;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
* if a wallet has a non-empty value for ios, that means that wallet has an ios app
|
|
224
|
-
* and we support that app. the same goes for android
|
|
225
|
-
*/
|
|
226
|
-
if (isMobile.isIPad() || isMobile.isIPhone()) {
|
|
227
|
-
const hasIOSLink = metadata.mobile.iosId !== undefined;
|
|
89
|
+
if (utils.isIPad() || utils.isIPhone()) {
|
|
90
|
+
const hasIOSLink = Boolean(walletBook.getWalletLinks(walletName).ios);
|
|
228
91
|
return !isWalletConnectWallet
|
|
229
92
|
? hasIOSLink
|
|
230
93
|
: hasIOSLink && hasWalletConnectLink;
|
|
231
|
-
// It is an android device
|
|
232
94
|
}
|
|
233
95
|
else {
|
|
234
|
-
const hasAndroidLink =
|
|
96
|
+
const hasAndroidLink = Boolean(walletBook.getWalletLinks(walletName).android);
|
|
235
97
|
return !isWalletConnectWallet
|
|
236
98
|
? hasAndroidLink
|
|
237
99
|
: hasAndroidLink && hasWalletConnectLink;
|
|
@@ -266,16 +128,14 @@ const getSupportedChainsForWalletConnector = (walletConnector) => {
|
|
|
266
128
|
});
|
|
267
129
|
return [...chainSet];
|
|
268
130
|
};
|
|
269
|
-
const getEnabledWallets = (props) =>
|
|
270
|
-
const supportedWallets =
|
|
131
|
+
const getEnabledWallets = (props) => {
|
|
132
|
+
const supportedWallets = getSupportedWallets(props.getSupportedWalletOpts);
|
|
271
133
|
const allEnabledWallets = supportedWallets.filter((wallet) => (props.enabledChains.some((chain) => getSupportedChainsForWalletConnector(wallet).includes(chain)) &&
|
|
272
134
|
wallet.isInstalledOnBrowser() === props.installed) ||
|
|
273
135
|
wallet.key === 'magiclink');
|
|
274
136
|
return allEnabledWallets;
|
|
275
|
-
}
|
|
137
|
+
};
|
|
276
138
|
|
|
277
|
-
exports.phantomLedgerWalletName = phantomLedger.walletName;
|
|
278
|
-
exports.filteredWalletConnectWallets = filteredWalletConnectWallets;
|
|
279
139
|
exports.getEnabledWallets = getEnabledWallets;
|
|
280
140
|
exports.getSupportedChainsForWalletConnector = getSupportedChainsForWalletConnector;
|
|
281
141
|
exports.getSupportedWallets = getSupportedWallets;
|
package/src/multi-wallet.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Chain, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
2
|
import { GetSupportedWallets, GetSupportedWalletsOpts } from './types';
|
|
3
|
-
export { walletName as phantomLedgerWalletName } from './wallets/solana/phantom-ledger';
|
|
4
|
-
export declare const filteredWalletConnectWallets: string[];
|
|
5
3
|
export declare const getSupportedWallets: GetSupportedWallets;
|
|
6
4
|
export declare const getSupportedChainsForWalletConnector: (walletConnector: WalletConnector) => Chain[];
|
|
7
5
|
export declare const getEnabledWallets: (props: {
|
|
8
6
|
enabledChains: Chain[];
|
|
9
7
|
getSupportedWalletOpts: GetSupportedWalletsOpts;
|
|
10
8
|
installed: boolean;
|
|
11
|
-
}) =>
|
|
9
|
+
}) => WalletConnector[];
|
package/src/multi-wallet.js
CHANGED
|
@@ -1,62 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import Slope from './wallets/solana/slope.js';
|
|
6
|
-
import Solflare from './wallets/solana/solflare.js';
|
|
7
|
-
import Glow from './wallets/solana/glow.js';
|
|
8
|
-
import Blocto from './wallets/flow/blocto.js';
|
|
9
|
-
import Dapper from './wallets/flow/dapper.js';
|
|
10
|
-
import { isMobile, isIPad, isIPhone } from './utils/isMobile.js';
|
|
11
|
-
import { fetchWalletConnectWallets } from './utils/walletConnect.js';
|
|
12
|
-
import MyAlgoWalletConnector from './wallets/algorand/MyAlgoWalletConnector.js';
|
|
13
|
-
import BraveEvm from './wallets/ethereum/injected/BraveEvm.js';
|
|
14
|
-
import Opera from './wallets/ethereum/injected/Opera.js';
|
|
15
|
-
import BraveSol from './wallets/solana/injected/BraveSol.js';
|
|
16
|
-
import UnknownInjectedWallet from './wallets/ethereum/injected/UnknownInjectedWallet.js';
|
|
17
|
-
import GameStop from './wallets/ethereum/injected/GameStop.js';
|
|
18
|
-
import ExodusEvm from './wallets/ethereum/injected/ExodusEvm.js';
|
|
19
|
-
import ExodusSol from './wallets/solana/injected/ExodusSol.js';
|
|
20
|
-
import BloctoInjected from './wallets/ethereum/injected/BloctoInjected.js';
|
|
21
|
-
import ArgentX from './wallets/starknet/argentx.js';
|
|
22
|
-
import Braavos from './wallets/starknet/braavos.js';
|
|
23
|
-
import BloctoEvm from './wallets/ethereum/BloctoEvm.js';
|
|
24
|
-
import PhantomLedger from './wallets/solana/phantom-ledger.js';
|
|
25
|
-
export { walletName as phantomLedgerWalletName } from './wallets/solana/phantom-ledger.js';
|
|
26
|
-
import CoinbaseSolana from './wallets/solana/CoinbaseSolana.js';
|
|
27
|
-
import Frame from './wallets/ethereum/injected/Frame.js';
|
|
28
|
-
import Fortmatic from './wallets/ethereum/fortmatic.js';
|
|
29
|
-
import Lilico from './wallets/flow/lilico.js';
|
|
30
|
-
import { getWalletConnectConnector } from './wallets/getWalletConnectConnector.js';
|
|
31
|
-
import Dawn from './wallets/ethereum/injected/Dawn.js';
|
|
32
|
-
import PhantomEvm from './wallets/ethereum/injected/PhantomEvm.js';
|
|
33
|
-
import 'magic-sdk';
|
|
34
|
-
import 'ethers';
|
|
35
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
36
|
-
import './utils/logger.js';
|
|
37
|
-
import { EmailOTPMagicWalletConnector } from './wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.js';
|
|
38
|
-
import { MagicSocialWalletConnector } from './wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js';
|
|
39
|
-
import { isEmailWalletConnector } from './utils/isEmailWalletConnector/isEmailWalletConnector.js';
|
|
40
|
-
import { getKeplerConnector } from './wallets/cosmos/getKeplrConnector.js';
|
|
41
|
-
import Zerion from './wallets/ethereum/injected/Zerion.js';
|
|
42
|
-
import { getMobileOrInjectedWallet } from './wallets/getMobileOrInjectedWallet.js';
|
|
43
|
-
import MetaMask from './wallets/ethereum/meta-mask.js';
|
|
44
|
-
import Trust from './wallets/ethereum/injected/Trust.js';
|
|
1
|
+
import { isEmbeddedConnector } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { getWalletBookWallet, getWalletLinks } from '@dynamic-labs/wallet-book';
|
|
3
|
+
import { isMobile, isIPad, isIPhone } from '@dynamic-labs/utils';
|
|
4
|
+
import { getApiProviders } from './utils/getApiProviders.js';
|
|
45
5
|
|
|
46
6
|
let wallets = [];
|
|
47
|
-
// These wallets are either not supported or implement their
|
|
48
|
-
// own WalletConnect connector
|
|
49
|
-
const filteredWalletConnectWallets = [
|
|
50
|
-
'MetaMask',
|
|
51
|
-
'Gnosis Safe',
|
|
52
|
-
'Trust',
|
|
53
|
-
'lilico',
|
|
54
|
-
'Keplr',
|
|
55
|
-
'Zerion',
|
|
56
|
-
];
|
|
57
7
|
const defaultWalletUiUtils = {
|
|
58
|
-
|
|
59
|
-
throw Error('
|
|
8
|
+
disabledConfirmationOnce: () => {
|
|
9
|
+
throw Error('disabledConfirmationOnce, not implemented');
|
|
60
10
|
},
|
|
61
11
|
sendTransaction: () => {
|
|
62
12
|
throw Error('requestSendTransactionConfirmation not implemented');
|
|
@@ -65,112 +15,37 @@ const defaultWalletUiUtils = {
|
|
|
65
15
|
throw Error('signMessage not implemented');
|
|
66
16
|
},
|
|
67
17
|
};
|
|
68
|
-
const getSupportedWallets = (
|
|
69
|
-
appLogoUrl: '',
|
|
70
|
-
appName: '',
|
|
71
|
-
isWalletConnectV2Enabled: false,
|
|
72
|
-
networkConfigurations: { cosmos: [], evm: [], solana: [], starknet: [] },
|
|
73
|
-
skipMemo: false,
|
|
74
|
-
vendorCredentials: {},
|
|
75
|
-
walletConnectProjectId: '',
|
|
76
|
-
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const getSupportedWallets = (args) => {
|
|
19
|
+
const { appLogoUrl = '', appName = '', chainRpcProviders, flowNetwork, isWalletConnectV2Enabled = false, networkConfigurations = { cosmos: [], evm: [], solana: [], starknet: [] }, customerApiProviders = [], skipMemo = false, walletConnectProjectId = '', walletConnectorsProp, walletUiUtils = undefined, } = args;
|
|
77
20
|
if (!skipMemo && wallets.length > 0) {
|
|
78
21
|
return wallets;
|
|
79
22
|
}
|
|
80
23
|
const evmNetworkConfigs = (networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.evm) || [];
|
|
81
24
|
const solanaNetworkConfigs = (networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.solana) || [];
|
|
82
25
|
const cosmosNetworkConfigs = (networkConfigurations === null || networkConfigurations === void 0 ? void 0 : networkConfigurations.cosmos) || [];
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}),
|
|
102
|
-
new PhantomEvm({ evmNetworks: evmNetworkConfigs }),
|
|
103
|
-
new PhantomLedger({ solNetworks: solanaNetworkConfigs }),
|
|
104
|
-
new Coinbase({
|
|
105
|
-
appLogoUrl,
|
|
106
|
-
appName,
|
|
107
|
-
evmNetworks: evmNetworkConfigs,
|
|
108
|
-
}),
|
|
109
|
-
new Solflare({ solNetworks: solanaNetworkConfigs }),
|
|
110
|
-
new Glow({ solNetworks: solanaNetworkConfigs }),
|
|
111
|
-
new Slope({ solNetworks: solanaNetworkConfigs }),
|
|
112
|
-
new Dapper({ appLogoUrl, appName }),
|
|
113
|
-
new Blocto({ appLogoUrl, appName }),
|
|
114
|
-
new BloctoEvm({ evmNetworks: evmNetworkConfigs }),
|
|
115
|
-
new BloctoInjected({ evmNetworks: evmNetworkConfigs }),
|
|
116
|
-
getWalletConnectConnector({
|
|
117
|
-
evmNetworks: evmNetworkConfigs,
|
|
118
|
-
isWalletConnectV2Enabled,
|
|
119
|
-
projectId: walletConnectProjectId,
|
|
120
|
-
}),
|
|
121
|
-
new BraveSol({ solNetworks: solanaNetworkConfigs }),
|
|
122
|
-
new BraveEvm({ evmNetworks: evmNetworkConfigs }),
|
|
123
|
-
new UnknownInjectedWallet({ evmNetworks: evmNetworkConfigs }),
|
|
124
|
-
new GameStop({ evmNetworks: evmNetworkConfigs }),
|
|
125
|
-
new ExodusEvm({ evmNetworks: evmNetworkConfigs }),
|
|
126
|
-
new ExodusSol({ solNetworks: solanaNetworkConfigs }),
|
|
127
|
-
new Opera({ evmNetworks: evmNetworkConfigs }),
|
|
128
|
-
...(magicLinkApiKey
|
|
129
|
-
? [
|
|
130
|
-
new EmailOTPMagicWalletConnector({
|
|
131
|
-
apiKey: magicLinkApiKey,
|
|
132
|
-
config: magicLinkConfig,
|
|
133
|
-
evmNetworks: evmNetworkConfigs,
|
|
134
|
-
walletUiUtils: walletUiUtils || defaultWalletUiUtils,
|
|
135
|
-
}),
|
|
136
|
-
new MagicSocialWalletConnector({
|
|
137
|
-
apiKey: magicLinkApiKey,
|
|
138
|
-
config: magicLinkConfig,
|
|
139
|
-
evmNetworks: evmNetworkConfigs,
|
|
140
|
-
walletUiUtils: walletUiUtils || defaultWalletUiUtils,
|
|
141
|
-
}),
|
|
142
|
-
]
|
|
143
|
-
: []),
|
|
144
|
-
new MyAlgoWalletConnector(),
|
|
145
|
-
new ArgentX(),
|
|
146
|
-
new Braavos(),
|
|
147
|
-
new CoinbaseSolana({ solNetworks: solanaNetworkConfigs }),
|
|
148
|
-
new Frame({ evmNetworks: evmNetworkConfigs }),
|
|
149
|
-
new Lilico({ appLogoUrl, appName }),
|
|
150
|
-
getMobileOrInjectedWallet({
|
|
151
|
-
evmNetworks: evmNetworkConfigs,
|
|
152
|
-
injectedWallet: new Zerion({ evmNetworks: evmNetworkConfigs }),
|
|
153
|
-
isWalletConnectV2: isWalletConnectV2Enabled,
|
|
154
|
-
walletConnectName: 'Zerion',
|
|
155
|
-
}),
|
|
156
|
-
//TODO: https://linear.app/dynamic-labs/issue/DYN-2127/rename-evmnetworks-to-networks-across-the-application
|
|
157
|
-
getKeplerConnector({ evmNetworks: cosmosNetworkConfigs }),
|
|
158
|
-
...((vendorCredentials === null || vendorCredentials === void 0 ? void 0 : vendorCredentials.fortmatic)
|
|
159
|
-
? [
|
|
160
|
-
new Fortmatic({
|
|
161
|
-
apiKey: vendorCredentials.fortmatic,
|
|
162
|
-
evmNetworks: evmNetworkConfigs,
|
|
163
|
-
}),
|
|
164
|
-
]
|
|
165
|
-
: []),
|
|
166
|
-
...filtered,
|
|
167
|
-
];
|
|
168
|
-
yield Promise.all(allWallets.map((wallet) => { var _a; return (_a = wallet.init) === null || _a === void 0 ? void 0 : _a.call(wallet); }));
|
|
26
|
+
const apiProviders = getApiProviders(customerApiProviders);
|
|
27
|
+
const opts = {
|
|
28
|
+
apiProviders,
|
|
29
|
+
appLogoUrl,
|
|
30
|
+
appName,
|
|
31
|
+
chainRpcProviders,
|
|
32
|
+
cosmosNetworks: cosmosNetworkConfigs,
|
|
33
|
+
evmNetworks: evmNetworkConfigs,
|
|
34
|
+
flowNetwork,
|
|
35
|
+
isWalletConnectV2Enabled,
|
|
36
|
+
projectId: walletConnectProjectId,
|
|
37
|
+
solNetworks: solanaNetworkConfigs,
|
|
38
|
+
walletUiUtils: walletUiUtils || defaultWalletUiUtils,
|
|
39
|
+
};
|
|
40
|
+
const allWallets = walletConnectorsProp
|
|
41
|
+
.map((walletConnector) => walletConnector(opts))
|
|
42
|
+
.flat()
|
|
43
|
+
.map((wallet) => new wallet(opts).getMobileOrInstalledWallet());
|
|
169
44
|
// Memoize the wallets
|
|
170
45
|
const filteredWallets = filterWalletsForPlatform(allWallets);
|
|
171
46
|
wallets = applyLinksOverrides(filteredWallets);
|
|
172
47
|
return wallets;
|
|
173
|
-
}
|
|
48
|
+
};
|
|
174
49
|
const applyLinksOverrides = (wallets) => wallets.map((wallet) => {
|
|
175
50
|
const metadata = getWalletBookWallet(wallet.name);
|
|
176
51
|
if (metadata.switchNetworkOnlyFromWallet !== undefined) {
|
|
@@ -183,7 +58,7 @@ const filterWalletsForPlatform = (wallets) => wallets.filter((wallet) => {
|
|
|
183
58
|
if (wallet.isInstalledOnBrowser()) {
|
|
184
59
|
return true;
|
|
185
60
|
}
|
|
186
|
-
else if (
|
|
61
|
+
else if (isEmbeddedConnector(wallet)) {
|
|
187
62
|
return true;
|
|
188
63
|
}
|
|
189
64
|
else if (metadata.showOnlyIfInstalled) {
|
|
@@ -193,20 +68,12 @@ const filterWalletsForPlatform = (wallets) => wallets.filter((wallet) => {
|
|
|
193
68
|
return true;
|
|
194
69
|
}
|
|
195
70
|
else {
|
|
196
|
-
return handleMobileWalletFilter(wallet, metadata);
|
|
71
|
+
return handleMobileWalletFilter(wallet.name, metadata);
|
|
197
72
|
}
|
|
198
73
|
});
|
|
199
|
-
const handleMobileWalletFilter = (
|
|
74
|
+
const handleMobileWalletFilter = (walletName, metadata) => {
|
|
200
75
|
if (!metadata.mobile)
|
|
201
76
|
return false;
|
|
202
|
-
/**
|
|
203
|
-
* Custom check added with DYN-1489 for mobile version only:
|
|
204
|
-
* it shows a WalletConnect listItem that wraps-up all the WalletConnect wallets
|
|
205
|
-
* in a new wallet-list view.
|
|
206
|
-
*/
|
|
207
|
-
if (wallet.isWalletConnect && wallet.name === 'WalletConnect') {
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
77
|
/**
|
|
211
78
|
* WalletConnect provides a "universal" and "native" deep link. They recommend using
|
|
212
79
|
* the universal deep link over the native one due to UX differences, and our current
|
|
@@ -215,20 +82,14 @@ const handleMobileWalletFilter = (wallet, metadata) => {
|
|
|
215
82
|
*/
|
|
216
83
|
const hasWalletConnectLink = Boolean(metadata.mobile.universal) || Boolean(metadata.mobile.native);
|
|
217
84
|
const isWalletConnectWallet = metadata.walletConnect !== undefined;
|
|
218
|
-
/**
|
|
219
|
-
* wallets-links.json is the source of truth for wallet support on mobile platforms.
|
|
220
|
-
* if a wallet has a non-empty value for ios, that means that wallet has an ios app
|
|
221
|
-
* and we support that app. the same goes for android
|
|
222
|
-
*/
|
|
223
85
|
if (isIPad() || isIPhone()) {
|
|
224
|
-
const hasIOSLink =
|
|
86
|
+
const hasIOSLink = Boolean(getWalletLinks(walletName).ios);
|
|
225
87
|
return !isWalletConnectWallet
|
|
226
88
|
? hasIOSLink
|
|
227
89
|
: hasIOSLink && hasWalletConnectLink;
|
|
228
|
-
// It is an android device
|
|
229
90
|
}
|
|
230
91
|
else {
|
|
231
|
-
const hasAndroidLink =
|
|
92
|
+
const hasAndroidLink = Boolean(getWalletLinks(walletName).android);
|
|
232
93
|
return !isWalletConnectWallet
|
|
233
94
|
? hasAndroidLink
|
|
234
95
|
: hasAndroidLink && hasWalletConnectLink;
|
|
@@ -263,12 +124,12 @@ const getSupportedChainsForWalletConnector = (walletConnector) => {
|
|
|
263
124
|
});
|
|
264
125
|
return [...chainSet];
|
|
265
126
|
};
|
|
266
|
-
const getEnabledWallets = (props) =>
|
|
267
|
-
const supportedWallets =
|
|
127
|
+
const getEnabledWallets = (props) => {
|
|
128
|
+
const supportedWallets = getSupportedWallets(props.getSupportedWalletOpts);
|
|
268
129
|
const allEnabledWallets = supportedWallets.filter((wallet) => (props.enabledChains.some((chain) => getSupportedChainsForWalletConnector(wallet).includes(chain)) &&
|
|
269
130
|
wallet.isInstalledOnBrowser() === props.installed) ||
|
|
270
131
|
wallet.key === 'magiclink');
|
|
271
132
|
return allEnabledWallets;
|
|
272
|
-
}
|
|
133
|
+
};
|
|
273
134
|
|
|
274
|
-
export {
|
|
135
|
+
export { getEnabledWallets, getSupportedChainsForWalletConnector, getSupportedWallets };
|
package/src/types.d.ts
CHANGED
|
@@ -1,58 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { WalletConnector, Chain } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { EvmNetwork } from './wallets/ethereum/evm-network';
|
|
7
|
-
import { MagicLinkConfig } from './wallets/ethereum/MagicConnector';
|
|
8
|
-
export type VendorCredentials = {
|
|
9
|
-
fortmatic?: string;
|
|
10
|
-
};
|
|
11
|
-
export type EvmRpcProvider = {
|
|
12
|
-
chainId: number;
|
|
13
|
-
chainName: string;
|
|
14
|
-
provider: ethers.providers.JsonRpcProvider;
|
|
15
|
-
};
|
|
16
|
-
export type SolanaRpcProvider = {
|
|
17
|
-
chainId?: number;
|
|
18
|
-
chainName: string;
|
|
19
|
-
provider: Connection;
|
|
20
|
-
};
|
|
21
|
-
export type RpcProviders = {
|
|
22
|
-
evm?: EvmRpcProvider[];
|
|
23
|
-
solana?: SolanaRpcProvider[];
|
|
24
|
-
};
|
|
25
|
-
export type NetworkConfigurationMap = {
|
|
26
|
-
cosmos: EvmNetwork[] | undefined;
|
|
27
|
-
evm: EvmNetwork[] | undefined;
|
|
28
|
-
solana: NetworkConfiguration[] | undefined;
|
|
29
|
-
starknet: NetworkConfiguration[] | undefined;
|
|
30
|
-
};
|
|
1
|
+
import type { Provider } from '@dynamic-labs/sdk-api';
|
|
2
|
+
import { WalletConnector, Chain, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { NetworkConfigurationMap, WalletUiUtils } from '@dynamic-labs/types';
|
|
4
|
+
import { ChainRpcProviders } from '@dynamic-labs/rpc-providers';
|
|
31
5
|
export type GetSupportedWalletsOpts = {
|
|
32
6
|
appLogoUrl?: string;
|
|
33
7
|
appName?: string;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
chainRpcProviders: typeof ChainRpcProviders;
|
|
9
|
+
customerApiProviders?: Provider[];
|
|
10
|
+
flowNetwork?: 'mainnet' | 'testnet';
|
|
11
|
+
isWalletConnectV2Enabled?: boolean;
|
|
12
|
+
networkConfigurations?: NetworkConfigurationMap;
|
|
38
13
|
skipMemo?: boolean;
|
|
39
|
-
|
|
40
|
-
|
|
14
|
+
walletConnectProjectId?: string;
|
|
15
|
+
walletConnectorsProp: WalletConnectorsMethod[];
|
|
41
16
|
walletUiUtils?: WalletUiUtils;
|
|
42
17
|
};
|
|
43
|
-
export type GetSupportedWallets = (opts
|
|
44
|
-
export type WalletUiUtils = {
|
|
45
|
-
enableInternalSign: () => void;
|
|
46
|
-
sendTransaction: (props: {
|
|
47
|
-
handler: (transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>) => Promise<ethers.providers.TransactionResponse>;
|
|
48
|
-
provider: ethers.providers.Web3Provider;
|
|
49
|
-
transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
|
|
50
|
-
}) => Promise<ethers.providers.TransactionResponse>;
|
|
51
|
-
signMessage: (props: {
|
|
52
|
-
handler: (message: string | ethers.utils.Bytes) => Promise<string>;
|
|
53
|
-
message: string | ethers.utils.Bytes;
|
|
54
|
-
}) => Promise<string>;
|
|
55
|
-
};
|
|
18
|
+
export type GetSupportedWallets = (opts: GetSupportedWalletsOpts) => WalletConnector[];
|
|
56
19
|
export type ChainInfo = {
|
|
57
20
|
blockchainName: string;
|
|
58
21
|
displayName: string;
|
|
@@ -63,4 +26,3 @@ export type ChainWihtIcon = {
|
|
|
63
26
|
icon?: string;
|
|
64
27
|
name: string | undefined;
|
|
65
28
|
};
|
|
66
|
-
export type SocialOAuthProvider = OAuthProvider;
|