@dynamic-labs/multi-wallet 0.17.0-RC.0 → 0.17.0-RC.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.
Files changed (268) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/package.json +11 -14
  3. package/src/index.cjs +2 -66
  4. package/src/index.d.ts +1 -16
  5. package/src/index.js +2 -21
  6. package/src/multi-wallet.cjs +46 -159
  7. package/src/multi-wallet.d.ts +0 -3
  8. package/src/multi-wallet.js +44 -156
  9. package/src/types.d.ts +9 -49
  10. package/src/utils/convertors.cjs +0 -7
  11. package/src/utils/convertors.d.ts +0 -1
  12. package/src/utils/convertors.js +1 -7
  13. package/src/utils/getApiProviders.cjs +15 -0
  14. package/src/utils/getApiProviders.d.ts +10 -0
  15. package/src/utils/getApiProviders.js +11 -0
  16. package/src/utils/message.cjs +4 -5
  17. package/src/utils/message.d.ts +2 -2
  18. package/src/utils/message.js +2 -3
  19. package/src/wallets/constants.cjs +0 -2
  20. package/src/wallets/constants.js +1 -2
  21. package/src/wallets/cosmos/{keplrWalletConnect.cjs → KeplrWalletConnect.cjs} +27 -43
  22. package/src/wallets/cosmos/{keplrWalletConnect.d.ts → KeplrWalletConnect.d.ts} +16 -20
  23. package/src/wallets/cosmos/{keplrWalletConnect.js → KeplrWalletConnect.js} +20 -36
  24. package/src/wallets/cosmos/{keplr.cjs → KeplrWalletConnector.cjs} +24 -21
  25. package/src/wallets/cosmos/{keplr.d.ts → KeplrWalletConnector.d.ts} +14 -18
  26. package/src/wallets/cosmos/{keplr.js → KeplrWalletConnector.js} +23 -20
  27. package/src/wallets/cosmos/index.d.ts +1 -1
  28. package/src/wallets/{clients/walletConnect/walletConnect.cjs → cosmos/wcClient.lib.cjs} +38 -101
  29. package/src/wallets/{clients/walletConnect/walletConnect.d.ts → cosmos/wcClient.lib.d.ts} +8 -10
  30. package/src/wallets/{clients/walletConnect/walletConnect.js → cosmos/wcClient.lib.js} +36 -97
  31. package/src/wallets/flow/{flow-provider.cjs → FlowWalletConnector.cjs} +13 -41
  32. package/src/wallets/flow/{flow-provider.d.ts → FlowWalletConnector.d.ts} +4 -11
  33. package/src/wallets/flow/{flow-provider.js → FlowWalletConnector.js} +7 -35
  34. package/src/wallets/flow/blocto.cjs +2 -10
  35. package/src/wallets/flow/blocto.d.ts +2 -8
  36. package/src/wallets/flow/blocto.js +2 -10
  37. package/src/wallets/flow/dapper.cjs +2 -10
  38. package/src/wallets/flow/dapper.d.ts +2 -8
  39. package/src/wallets/flow/dapper.js +2 -10
  40. package/src/wallets/flow/lilico.cjs +4 -13
  41. package/src/wallets/flow/lilico.d.ts +2 -9
  42. package/src/wallets/flow/lilico.js +3 -12
  43. package/src/wallets/starknet/argentx.cjs +2 -2
  44. package/src/wallets/starknet/argentx.d.ts +1 -1
  45. package/src/wallets/starknet/argentx.js +2 -2
  46. package/src/wallets/starknet/braavos.cjs +4 -4
  47. package/src/wallets/starknet/braavos.d.ts +1 -1
  48. package/src/wallets/starknet/braavos.js +3 -3
  49. package/src/wallets/starknet/{starknetProvider.cjs → starknetWalletConnector.cjs} +9 -40
  50. package/src/wallets/starknet/{starknetProvider.d.ts → starknetWalletConnector.d.ts} +3 -14
  51. package/src/wallets/starknet/{starknetProvider.js → starknetWalletConnector.js} +5 -36
  52. package/src/wallets/window.d.ts +0 -77
  53. package/src/errors.cjs +0 -65
  54. package/src/errors.d.ts +0 -30
  55. package/src/errors.js +0 -53
  56. package/src/rpcProviders.cjs +0 -76
  57. package/src/rpcProviders.d.ts +0 -5
  58. package/src/rpcProviders.js +0 -69
  59. package/src/utils/CancellablePromise/CancellablePromise.cjs +0 -33
  60. package/src/utils/CancellablePromise/CancellablePromise.d.ts +0 -9
  61. package/src/utils/CancellablePromise/CancellablePromise.js +0 -29
  62. package/src/utils/CancellablePromise/index.d.ts +0 -1
  63. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs +0 -54
  64. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.d.ts +0 -3
  65. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js +0 -50
  66. package/src/utils/assignConfirmationScreenToProvider/index.d.ts +0 -1
  67. package/src/utils/encoding.cjs +0 -18
  68. package/src/utils/encoding.d.ts +0 -4
  69. package/src/utils/encoding.js +0 -12
  70. package/src/utils/extractNonce.cjs +0 -13
  71. package/src/utils/extractNonce.d.ts +0 -1
  72. package/src/utils/extractNonce.js +0 -9
  73. package/src/utils/getChainInfo/getChainInfo.cjs +0 -59
  74. package/src/utils/getChainInfo/getChainInfo.d.ts +0 -2
  75. package/src/utils/getChainInfo/getChainInfo.js +0 -55
  76. package/src/utils/getChainInfo/index.d.ts +0 -1
  77. package/src/utils/getWalletConnectorByName.cjs +0 -19
  78. package/src/utils/getWalletConnectorByName.d.ts +0 -2
  79. package/src/utils/getWalletConnectorByName.js +0 -15
  80. package/src/utils/isEmailOTPWalletConnector/index.d.ts +0 -1
  81. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.cjs +0 -7
  82. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.d.ts +0 -2
  83. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js +0 -3
  84. package/src/utils/isEmailWalletConnector/index.d.ts +0 -1
  85. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.cjs +0 -7
  86. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.d.ts +0 -2
  87. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.js +0 -3
  88. package/src/utils/isFunction/index.d.ts +0 -1
  89. package/src/utils/isFunction/isFunction.cjs +0 -8
  90. package/src/utils/isFunction/isFunction.d.ts +0 -1
  91. package/src/utils/isFunction/isFunction.js +0 -4
  92. package/src/utils/isMobile.cjs +0 -54
  93. package/src/utils/isMobile.d.ts +0 -13
  94. package/src/utils/isMobile.js +0 -46
  95. package/src/utils/isSameAddress/index.d.ts +0 -1
  96. package/src/utils/isSameAddress/isSameAddress.cjs +0 -9
  97. package/src/utils/isSameAddress/isSameAddress.d.ts +0 -1
  98. package/src/utils/isSameAddress/isSameAddress.js +0 -5
  99. package/src/utils/isSameAddress/utils/index.d.ts +0 -1
  100. package/src/utils/isSameAddress/utils/normalizeAddress/index.d.ts +0 -1
  101. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.cjs +0 -17
  102. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.d.ts +0 -1
  103. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js +0 -13
  104. package/src/utils/isSocialWalletConnector/index.d.ts +0 -1
  105. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.cjs +0 -7
  106. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.d.ts +0 -2
  107. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.js +0 -3
  108. package/src/utils/isUnsupportedProviderError/index.d.ts +0 -1
  109. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
  110. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.d.ts +0 -6
  111. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
  112. package/src/utils/localStorageAsync.cjs +0 -28
  113. package/src/utils/localStorageAsync.d.ts +0 -3
  114. package/src/utils/localStorageAsync.js +0 -22
  115. package/src/utils/logger.cjs +0 -9
  116. package/src/utils/logger.d.ts +0 -2
  117. package/src/utils/logger.js +0 -5
  118. package/src/utils/normalizeWalletName/index.d.ts +0 -1
  119. package/src/utils/normalizeWalletName/normalizeWalletName.cjs +0 -7
  120. package/src/utils/normalizeWalletName/normalizeWalletName.d.ts +0 -1
  121. package/src/utils/normalizeWalletName/normalizeWalletName.js +0 -3
  122. package/src/utils/shouldLowercaseAddress.cjs +0 -11
  123. package/src/utils/shouldLowercaseAddress.d.ts +0 -1
  124. package/src/utils/shouldLowercaseAddress.js +0 -7
  125. package/src/utils/walletConnect.cjs +0 -30
  126. package/src/utils/walletConnect.d.ts +0 -4
  127. package/src/utils/walletConnect.js +0 -26
  128. package/src/wallets/ProviderLookup.cjs +0 -18
  129. package/src/wallets/ProviderLookup.d.ts +0 -4
  130. package/src/wallets/ProviderLookup.js +0 -14
  131. package/src/wallets/algorand/myalgo.cjs +0 -187
  132. package/src/wallets/algorand/myalgo.d.ts +0 -36
  133. package/src/wallets/algorand/myalgo.js +0 -181
  134. package/src/wallets/algorand/myalgoSigner.cjs +0 -24
  135. package/src/wallets/algorand/myalgoSigner.d.ts +0 -21
  136. package/src/wallets/algorand/myalgoSigner.js +0 -20
  137. package/src/wallets/clients/coinbase/coinbase.cjs +0 -77
  138. package/src/wallets/clients/coinbase/coinbase.d.ts +0 -6
  139. package/src/wallets/clients/coinbase/coinbase.js +0 -66
  140. package/src/wallets/clients/coinbase/index.d.ts +0 -2
  141. package/src/wallets/clients/coinbase/types.d.ts +0 -14
  142. package/src/wallets/clients/walletConnect/index.d.ts +0 -1
  143. package/src/wallets/clients/walletConnect/types.d.ts +0 -4
  144. package/src/wallets/cosmos/getKeplrConnector.cjs +0 -18
  145. package/src/wallets/cosmos/getKeplrConnector.d.ts +0 -6
  146. package/src/wallets/cosmos/getKeplrConnector.js +0 -14
  147. package/src/wallets/ethereum/BloctoEvm.cjs +0 -140
  148. package/src/wallets/ethereum/BloctoEvm.d.ts +0 -34
  149. package/src/wallets/ethereum/BloctoEvm.js +0 -134
  150. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.cjs +0 -58
  151. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.d.ts +0 -12
  152. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.js +0 -54
  153. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/index.d.ts +0 -1
  154. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.cjs +0 -62
  155. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.d.ts +0 -11
  156. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.js +0 -58
  157. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/index.d.ts +0 -1
  158. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +0 -103
  159. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +0 -34
  160. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +0 -99
  161. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/index.d.ts +0 -2
  162. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs +0 -56
  163. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.d.ts +0 -12
  164. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js +0 -52
  165. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/index.d.ts +0 -1
  166. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +0 -182
  167. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +0 -60
  168. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +0 -178
  169. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/index.d.ts +0 -2
  170. package/src/wallets/ethereum/MagicConnector/index.d.ts +0 -5
  171. package/src/wallets/ethereum/coinbase.cjs +0 -81
  172. package/src/wallets/ethereum/coinbase.d.ts +0 -31
  173. package/src/wallets/ethereum/coinbase.js +0 -79
  174. package/src/wallets/ethereum/ethProvider.cjs +0 -171
  175. package/src/wallets/ethereum/ethProvider.d.ts +0 -35
  176. package/src/wallets/ethereum/ethProvider.js +0 -167
  177. package/src/wallets/ethereum/ethProviderHelper.cjs +0 -190
  178. package/src/wallets/ethereum/ethProviderHelper.d.ts +0 -40
  179. package/src/wallets/ethereum/ethProviderHelper.js +0 -186
  180. package/src/wallets/ethereum/evm-network.cjs +0 -20
  181. package/src/wallets/ethereum/evm-network.d.ts +0 -22
  182. package/src/wallets/ethereum/evm-network.js +0 -16
  183. package/src/wallets/ethereum/fortmatic.cjs +0 -98
  184. package/src/wallets/ethereum/fortmatic.d.ts +0 -34
  185. package/src/wallets/ethereum/fortmatic.js +0 -92
  186. package/src/wallets/ethereum/injected/BloctoInjected.cjs +0 -13
  187. package/src/wallets/ethereum/injected/BloctoInjected.d.ts +0 -6
  188. package/src/wallets/ethereum/injected/BloctoInjected.js +0 -11
  189. package/src/wallets/ethereum/injected/BraveEvm.cjs +0 -13
  190. package/src/wallets/ethereum/injected/BraveEvm.d.ts +0 -6
  191. package/src/wallets/ethereum/injected/BraveEvm.js +0 -11
  192. package/src/wallets/ethereum/injected/Dawn.cjs +0 -13
  193. package/src/wallets/ethereum/injected/Dawn.d.ts +0 -6
  194. package/src/wallets/ethereum/injected/Dawn.js +0 -11
  195. package/src/wallets/ethereum/injected/ExodusEvm.cjs +0 -13
  196. package/src/wallets/ethereum/injected/ExodusEvm.d.ts +0 -6
  197. package/src/wallets/ethereum/injected/ExodusEvm.js +0 -11
  198. package/src/wallets/ethereum/injected/Frame.cjs +0 -13
  199. package/src/wallets/ethereum/injected/Frame.d.ts +0 -6
  200. package/src/wallets/ethereum/injected/Frame.js +0 -11
  201. package/src/wallets/ethereum/injected/GameStop.cjs +0 -13
  202. package/src/wallets/ethereum/injected/GameStop.d.ts +0 -6
  203. package/src/wallets/ethereum/injected/GameStop.js +0 -11
  204. package/src/wallets/ethereum/injected/Opera.cjs +0 -13
  205. package/src/wallets/ethereum/injected/Opera.d.ts +0 -6
  206. package/src/wallets/ethereum/injected/Opera.js +0 -11
  207. package/src/wallets/ethereum/injected/PhantomEvm.cjs +0 -37
  208. package/src/wallets/ethereum/injected/PhantomEvm.d.ts +0 -7
  209. package/src/wallets/ethereum/injected/PhantomEvm.js +0 -35
  210. package/src/wallets/ethereum/injected/Trust.cjs +0 -13
  211. package/src/wallets/ethereum/injected/Trust.d.ts +0 -6
  212. package/src/wallets/ethereum/injected/Trust.js +0 -11
  213. package/src/wallets/ethereum/injected/UnknownInjectedWallet.cjs +0 -13
  214. package/src/wallets/ethereum/injected/UnknownInjectedWallet.d.ts +0 -6
  215. package/src/wallets/ethereum/injected/UnknownInjectedWallet.js +0 -11
  216. package/src/wallets/ethereum/injected/Zerion.cjs +0 -13
  217. package/src/wallets/ethereum/injected/Zerion.d.ts +0 -6
  218. package/src/wallets/ethereum/injected/Zerion.js +0 -11
  219. package/src/wallets/ethereum/meta-mask.cjs +0 -70
  220. package/src/wallets/ethereum/meta-mask.d.ts +0 -30
  221. package/src/wallets/ethereum/meta-mask.js +0 -68
  222. package/src/wallets/getMobileOrInjectedWallet.cjs +0 -26
  223. package/src/wallets/getMobileOrInjectedWallet.d.ts +0 -10
  224. package/src/wallets/getMobileOrInjectedWallet.js +0 -22
  225. package/src/wallets/getWalletConnectConnector.cjs +0 -18
  226. package/src/wallets/getWalletConnectConnector.d.ts +0 -7
  227. package/src/wallets/getWalletConnectConnector.js +0 -14
  228. package/src/wallets/initializeWalletProviders.cjs +0 -14
  229. package/src/wallets/initializeWalletProviders.d.ts +0 -6
  230. package/src/wallets/initializeWalletProviders.js +0 -10
  231. package/src/wallets/solana/CoinbaseSolana.cjs +0 -77
  232. package/src/wallets/solana/CoinbaseSolana.d.ts +0 -26
  233. package/src/wallets/solana/CoinbaseSolana.js +0 -75
  234. package/src/wallets/solana/glow.cjs +0 -74
  235. package/src/wallets/solana/glow.d.ts +0 -25
  236. package/src/wallets/solana/glow.js +0 -72
  237. package/src/wallets/solana/injected/BraveSol.cjs +0 -18
  238. package/src/wallets/solana/injected/BraveSol.d.ts +0 -6
  239. package/src/wallets/solana/injected/BraveSol.js +0 -16
  240. package/src/wallets/solana/injected/ExodusSol.cjs +0 -12
  241. package/src/wallets/solana/injected/ExodusSol.d.ts +0 -5
  242. package/src/wallets/solana/injected/ExodusSol.js +0 -10
  243. package/src/wallets/solana/phantom-ledger.cjs +0 -71
  244. package/src/wallets/solana/phantom-ledger.d.ts +0 -16
  245. package/src/wallets/solana/phantom-ledger.js +0 -65
  246. package/src/wallets/solana/phantom.cjs +0 -97
  247. package/src/wallets/solana/phantom.d.ts +0 -26
  248. package/src/wallets/solana/phantom.js +0 -95
  249. package/src/wallets/solana/slope.cjs +0 -125
  250. package/src/wallets/solana/slope.d.ts +0 -39
  251. package/src/wallets/solana/slope.js +0 -123
  252. package/src/wallets/solana/solProvider.cjs +0 -62
  253. package/src/wallets/solana/solProvider.d.ts +0 -18
  254. package/src/wallets/solana/solProvider.js +0 -58
  255. package/src/wallets/solana/solProviderHelper.cjs +0 -164
  256. package/src/wallets/solana/solProviderHelper.d.ts +0 -29
  257. package/src/wallets/solana/solProviderHelper.js +0 -160
  258. package/src/wallets/solana/solflare.cjs +0 -94
  259. package/src/wallets/solana/solflare.d.ts +0 -26
  260. package/src/wallets/solana/solflare.js +0 -92
  261. package/src/wallets/walletConnect/index.d.ts +0 -2
  262. package/src/wallets/walletConnect/walletConnect.cjs +0 -147
  263. package/src/wallets/walletConnect/walletConnect.d.ts +0 -39
  264. package/src/wallets/walletConnect/walletConnect.js +0 -141
  265. package/src/wallets/walletConnect/walletConnectV2.cjs +0 -282
  266. package/src/wallets/walletConnect/walletConnectV2.d.ts +0 -40
  267. package/src/wallets/walletConnect/walletConnectV2.js +0 -273
  268. package/src/wallets/walletConnect/zerion.d.ts +0 -8
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var keplr = require('./keplr.cjs');
6
- var keplrWalletConnect = require('./keplrWalletConnect.cjs');
7
-
8
- const getKeplerConnector = ({ evmNetworks, }) => {
9
- const keplr$1 = new keplr.Keplr({ evmNetworks });
10
- if (keplr$1.isInstalledOnBrowser()) {
11
- return keplr$1;
12
- }
13
- else {
14
- return new keplrWalletConnect({ evmNetworks });
15
- }
16
- };
17
-
18
- exports.getKeplerConnector = getKeplerConnector;
@@ -1,6 +0,0 @@
1
- import { EvmNetwork } from '../ethereum/evm-network';
2
- import { Keplr } from './keplr';
3
- import KeplrWalletConnect from './keplrWalletConnect';
4
- export declare const getKeplerConnector: ({ evmNetworks, }: {
5
- evmNetworks: EvmNetwork[];
6
- }) => Keplr | KeplrWalletConnect;
@@ -1,14 +0,0 @@
1
- import { Keplr } from './keplr.js';
2
- import KeplrWalletConnect from './keplrWalletConnect.js';
3
-
4
- const getKeplerConnector = ({ evmNetworks, }) => {
5
- const keplr = new Keplr({ evmNetworks });
6
- if (keplr.isInstalledOnBrowser()) {
7
- return keplr;
8
- }
9
- else {
10
- return new KeplrWalletConnect({ evmNetworks });
11
- }
12
- };
13
-
14
- export { getKeplerConnector };
@@ -1,140 +0,0 @@
1
- 'use strict';
2
-
3
- var tslib = require('tslib');
4
- var BloctoSDK = require('@blocto/sdk');
5
- var ethers = require('ethers');
6
- var normalizeWalletName = require('../../utils/normalizeWalletName/normalizeWalletName.cjs');
7
- var logger = require('../../utils/logger.cjs');
8
- var ethProvider = require('./ethProvider.cjs');
9
- var ethProviderHelper = require('./ethProviderHelper.cjs');
10
-
11
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
-
13
- var BloctoSDK__default = /*#__PURE__*/_interopDefaultLegacy(BloctoSDK);
14
-
15
- class BloctoEvm extends ethProvider.EthProvider {
16
- constructor({ evmNetworks }) {
17
- var _a, _b;
18
- // Taken from : https://docs.blocto.app/blocto-sdk/javascript-sdk/evm-sdk/provider
19
- const BLOCTO_SUPPORTED_CHAIN_IDS = [1, 4, 56, 97, 137, 80001, 43114, 43113];
20
- const bloctoSupportedNetworks = evmNetworks.filter((n) => BLOCTO_SUPPORTED_CHAIN_IDS.includes(n.chainId));
21
- super({ evmNetworks: bloctoSupportedNetworks });
22
- this.LOCAL_STORAGE_KEY = 'dynamic_blocto_evm_chain_id';
23
- this.name = 'bloctoevm';
24
- this.canConnectViaQrCode = false;
25
- this.canConnectViaCustodialService = true;
26
- this.isWalletConnect = false;
27
- this.connectedChain = 'EVM';
28
- this.supportedChains = ['EVM', 'ETH'];
29
- this.ethProviderHelper = new ethProviderHelper.EthProviderHelper();
30
- this.supportsNetworkSwitching = () => false;
31
- this.chainId =
32
- Number(localStorage.getItem(this.LOCAL_STORAGE_KEY)) ||
33
- ((_a = bloctoSupportedNetworks.find((n) => n.chainId === 137)) === null || _a === void 0 ? void 0 : _a.chainId) ||
34
- ((_b = bloctoSupportedNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId);
35
- }
36
- get key() {
37
- return normalizeWalletName.normalizeWalletName(this.name);
38
- }
39
- getClient() {
40
- if (!this.client) {
41
- const network = this.evmNetworks.find((n) => n.chainId === this.chainId);
42
- if (network) {
43
- this.client = new BloctoSDK__default["default"]({
44
- ethereum: {
45
- chainId: `0x${this.chainId.toString(16)}`,
46
- rpc: network.rpcUrls[0],
47
- },
48
- });
49
- }
50
- else {
51
- logger.logger.error("Couldn't find a configured network for Blocto EVM");
52
- }
53
- }
54
- return this.client;
55
- }
56
- getWeb3Provider() {
57
- const client = this.getClient();
58
- // If there are no accounts yet, we shouldn't wrap the provider in ethers
59
- if (client && client.ethereum && client.ethereum.accounts.length > 0) {
60
- return new ethers.ethers.providers.Web3Provider(client.ethereum);
61
- }
62
- else {
63
- return undefined;
64
- }
65
- }
66
- // We are calling the client directly and not via Web3Provider because if we will wrap it in Ethers,
67
- // Ethers will be making retries on failure. This becomes an issue on the connect step.
68
- // When Blocto's modal closes prior to receiving a response with the address on the connect step,
69
- // then ethers would retry and the modal will open again.
70
- fetchPublicAddress() {
71
- return tslib.__awaiter(this, void 0, void 0, function* () {
72
- try {
73
- const client = this.getClient();
74
- if (client && client.ethereum) {
75
- const addresses = yield client.ethereum.request({
76
- method: 'eth_requestAccounts',
77
- });
78
- if (addresses.length > 0) {
79
- return addresses[0];
80
- }
81
- }
82
- return undefined;
83
- }
84
- catch (e) {
85
- logger.logger.error(e);
86
- return Promise.reject(e);
87
- }
88
- });
89
- }
90
- connect() {
91
- return tslib.__awaiter(this, void 0, void 0, function* () {
92
- yield this.fetchPublicAddress();
93
- });
94
- }
95
- isInstalledOnBrowser() {
96
- return false;
97
- }
98
- proveOwnership(messageToSign) {
99
- return this.signMessage(messageToSign);
100
- }
101
- signMessage(messageToSign) {
102
- return tslib.__awaiter(this, void 0, void 0, function* () {
103
- try {
104
- const signer = yield this.getSigner();
105
- return yield (signer === null || signer === void 0 ? void 0 : signer.signMessage(messageToSign));
106
- }
107
- catch (e) {
108
- if (e.message === 'User declined the signing request') {
109
- return Promise.reject({ code: '4001' });
110
- }
111
- else {
112
- return Promise.reject(e);
113
- }
114
- }
115
- });
116
- }
117
- endSession() {
118
- return tslib.__awaiter(this, void 0, void 0, function* () {
119
- const client = this.getClient();
120
- localStorage.removeItem('sdk.session');
121
- if (client && client.ethereum && client.ethereum.accounts.length > 0) {
122
- yield client.ethereum.request({ method: 'wallet_disconnect' });
123
- }
124
- });
125
- }
126
- // *********************
127
- // Unimplemented methods
128
- // *********************
129
- switchNetwork() {
130
- return Promise.resolve();
131
- }
132
- setupEventListeners() {
133
- return;
134
- }
135
- teardownEventListeners() {
136
- return;
137
- }
138
- }
139
-
140
- module.exports = BloctoEvm;
@@ -1,34 +0,0 @@
1
- import { ethers } from 'ethers';
2
- import { Chain, WalletConnector } from '@dynamic-labs/wallet-connector-core';
3
- import { EvmNetwork } from './evm-network';
4
- import { EthProvider } from './ethProvider';
5
- import { EthProviderHelper } from './ethProviderHelper';
6
- declare class BloctoEvm extends EthProvider implements WalletConnector {
7
- LOCAL_STORAGE_KEY: string;
8
- private client?;
9
- name: string;
10
- canConnectViaQrCode: boolean;
11
- canConnectViaCustodialService: boolean;
12
- isWalletConnect: boolean;
13
- connectedChain: Chain;
14
- supportedChains: Chain[];
15
- chainId: number;
16
- ethProviderHelper: EthProviderHelper;
17
- supportsNetworkSwitching: () => boolean;
18
- constructor({ evmNetworks }: {
19
- evmNetworks: EvmNetwork[];
20
- });
21
- get key(): string;
22
- private getClient;
23
- getWeb3Provider(): ethers.providers.Web3Provider | undefined;
24
- fetchPublicAddress(): Promise<string | undefined>;
25
- connect(): Promise<void>;
26
- isInstalledOnBrowser(): boolean;
27
- proveOwnership(messageToSign: string): Promise<string | undefined>;
28
- signMessage(messageToSign: string): Promise<string | undefined>;
29
- endSession?(): Promise<void>;
30
- switchNetwork(): Promise<void>;
31
- setupEventListeners(): void;
32
- teardownEventListeners(): void;
33
- }
34
- export default BloctoEvm;
@@ -1,134 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import BloctoSDK from '@blocto/sdk';
3
- import { ethers } from 'ethers';
4
- import { normalizeWalletName } from '../../utils/normalizeWalletName/normalizeWalletName.js';
5
- import { logger } from '../../utils/logger.js';
6
- import { EthProvider } from './ethProvider.js';
7
- import { EthProviderHelper } from './ethProviderHelper.js';
8
-
9
- class BloctoEvm extends EthProvider {
10
- constructor({ evmNetworks }) {
11
- var _a, _b;
12
- // Taken from : https://docs.blocto.app/blocto-sdk/javascript-sdk/evm-sdk/provider
13
- const BLOCTO_SUPPORTED_CHAIN_IDS = [1, 4, 56, 97, 137, 80001, 43114, 43113];
14
- const bloctoSupportedNetworks = evmNetworks.filter((n) => BLOCTO_SUPPORTED_CHAIN_IDS.includes(n.chainId));
15
- super({ evmNetworks: bloctoSupportedNetworks });
16
- this.LOCAL_STORAGE_KEY = 'dynamic_blocto_evm_chain_id';
17
- this.name = 'bloctoevm';
18
- this.canConnectViaQrCode = false;
19
- this.canConnectViaCustodialService = true;
20
- this.isWalletConnect = false;
21
- this.connectedChain = 'EVM';
22
- this.supportedChains = ['EVM', 'ETH'];
23
- this.ethProviderHelper = new EthProviderHelper();
24
- this.supportsNetworkSwitching = () => false;
25
- this.chainId =
26
- Number(localStorage.getItem(this.LOCAL_STORAGE_KEY)) ||
27
- ((_a = bloctoSupportedNetworks.find((n) => n.chainId === 137)) === null || _a === void 0 ? void 0 : _a.chainId) ||
28
- ((_b = bloctoSupportedNetworks[0]) === null || _b === void 0 ? void 0 : _b.chainId);
29
- }
30
- get key() {
31
- return normalizeWalletName(this.name);
32
- }
33
- getClient() {
34
- if (!this.client) {
35
- const network = this.evmNetworks.find((n) => n.chainId === this.chainId);
36
- if (network) {
37
- this.client = new BloctoSDK({
38
- ethereum: {
39
- chainId: `0x${this.chainId.toString(16)}`,
40
- rpc: network.rpcUrls[0],
41
- },
42
- });
43
- }
44
- else {
45
- logger.error("Couldn't find a configured network for Blocto EVM");
46
- }
47
- }
48
- return this.client;
49
- }
50
- getWeb3Provider() {
51
- const client = this.getClient();
52
- // If there are no accounts yet, we shouldn't wrap the provider in ethers
53
- if (client && client.ethereum && client.ethereum.accounts.length > 0) {
54
- return new ethers.providers.Web3Provider(client.ethereum);
55
- }
56
- else {
57
- return undefined;
58
- }
59
- }
60
- // We are calling the client directly and not via Web3Provider because if we will wrap it in Ethers,
61
- // Ethers will be making retries on failure. This becomes an issue on the connect step.
62
- // When Blocto's modal closes prior to receiving a response with the address on the connect step,
63
- // then ethers would retry and the modal will open again.
64
- fetchPublicAddress() {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- try {
67
- const client = this.getClient();
68
- if (client && client.ethereum) {
69
- const addresses = yield client.ethereum.request({
70
- method: 'eth_requestAccounts',
71
- });
72
- if (addresses.length > 0) {
73
- return addresses[0];
74
- }
75
- }
76
- return undefined;
77
- }
78
- catch (e) {
79
- logger.error(e);
80
- return Promise.reject(e);
81
- }
82
- });
83
- }
84
- connect() {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- yield this.fetchPublicAddress();
87
- });
88
- }
89
- isInstalledOnBrowser() {
90
- return false;
91
- }
92
- proveOwnership(messageToSign) {
93
- return this.signMessage(messageToSign);
94
- }
95
- signMessage(messageToSign) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- try {
98
- const signer = yield this.getSigner();
99
- return yield (signer === null || signer === void 0 ? void 0 : signer.signMessage(messageToSign));
100
- }
101
- catch (e) {
102
- if (e.message === 'User declined the signing request') {
103
- return Promise.reject({ code: '4001' });
104
- }
105
- else {
106
- return Promise.reject(e);
107
- }
108
- }
109
- });
110
- }
111
- endSession() {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- const client = this.getClient();
114
- localStorage.removeItem('sdk.session');
115
- if (client && client.ethereum && client.ethereum.accounts.length > 0) {
116
- yield client.ethereum.request({ method: 'wallet_disconnect' });
117
- }
118
- });
119
- }
120
- // *********************
121
- // Unimplemented methods
122
- // *********************
123
- switchNetwork() {
124
- return Promise.resolve();
125
- }
126
- setupEventListeners() {
127
- return;
128
- }
129
- teardownEventListeners() {
130
- return;
131
- }
132
- }
133
-
134
- export { BloctoEvm as default };
@@ -1,58 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
- var MagicWalletConnector = require('../MagicWalletConnector/MagicWalletConnector.cjs');
7
-
8
- class EmailMagicWalletConnector extends MagicWalletConnector.MagicWalletConnector {
9
- constructor() {
10
- super(...arguments);
11
- this.canConnectViaEmail = true;
12
- }
13
- get email() {
14
- return this._email;
15
- }
16
- setEmail(email) {
17
- this._email = email;
18
- localStorage.setItem('magic-link-email', email);
19
- }
20
- clearEmail() {
21
- this._email = '';
22
- localStorage.removeItem('magic-link-email');
23
- }
24
- endSession() {
25
- const _super = Object.create(null, {
26
- endSession: { get: () => super.endSession }
27
- });
28
- return tslib.__awaiter(this, void 0, void 0, function* () {
29
- yield _super.endSession.call(this);
30
- this.clearEmail();
31
- });
32
- }
33
- cancelPreviousEmail() {
34
- var _a;
35
- (_a = this._currentAuthCancellablePromise) === null || _a === void 0 ? void 0 : _a.cancel();
36
- }
37
- loginWithMagic() {
38
- var _a;
39
- return tslib.__awaiter(this, void 0, void 0, function* () {
40
- const client = this._magicClient.getClient();
41
- const user = yield this.getUserMetadata();
42
- if (user && user.publicAddress) {
43
- this.setEmail((user === null || user === void 0 ? void 0 : user.email) || '');
44
- return user.publicAddress;
45
- }
46
- const { email } = this;
47
- if (!email)
48
- return;
49
- return client.auth.loginWithMagicLink({
50
- email,
51
- redirectURI: (_a = this._magicClient.config) === null || _a === void 0 ? void 0 : _a.redirectURI,
52
- showUI: false,
53
- });
54
- });
55
- }
56
- }
57
-
58
- exports.EmailMagicWalletConnector = EmailMagicWalletConnector;
@@ -1,12 +0,0 @@
1
- import { EmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
2
- import { MagicPromiEvent, MagicWalletConnector } from '../MagicWalletConnector';
3
- export declare class EmailMagicWalletConnector extends MagicWalletConnector implements EmailWalletConnector {
4
- canConnectViaEmail: boolean;
5
- _email: string | undefined;
6
- get email(): string | undefined;
7
- setEmail(email: string): void;
8
- clearEmail(): void;
9
- endSession(): Promise<void>;
10
- cancelPreviousEmail(): void;
11
- loginWithMagic(): Promise<MagicPromiEvent | undefined>;
12
- }
@@ -1,54 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import { MagicWalletConnector } from '../MagicWalletConnector/MagicWalletConnector.js';
3
-
4
- class EmailMagicWalletConnector extends MagicWalletConnector {
5
- constructor() {
6
- super(...arguments);
7
- this.canConnectViaEmail = true;
8
- }
9
- get email() {
10
- return this._email;
11
- }
12
- setEmail(email) {
13
- this._email = email;
14
- localStorage.setItem('magic-link-email', email);
15
- }
16
- clearEmail() {
17
- this._email = '';
18
- localStorage.removeItem('magic-link-email');
19
- }
20
- endSession() {
21
- const _super = Object.create(null, {
22
- endSession: { get: () => super.endSession }
23
- });
24
- return __awaiter(this, void 0, void 0, function* () {
25
- yield _super.endSession.call(this);
26
- this.clearEmail();
27
- });
28
- }
29
- cancelPreviousEmail() {
30
- var _a;
31
- (_a = this._currentAuthCancellablePromise) === null || _a === void 0 ? void 0 : _a.cancel();
32
- }
33
- loginWithMagic() {
34
- var _a;
35
- return __awaiter(this, void 0, void 0, function* () {
36
- const client = this._magicClient.getClient();
37
- const user = yield this.getUserMetadata();
38
- if (user && user.publicAddress) {
39
- this.setEmail((user === null || user === void 0 ? void 0 : user.email) || '');
40
- return user.publicAddress;
41
- }
42
- const { email } = this;
43
- if (!email)
44
- return;
45
- return client.auth.loginWithMagicLink({
46
- email,
47
- redirectURI: (_a = this._magicClient.config) === null || _a === void 0 ? void 0 : _a.redirectURI,
48
- showUI: false,
49
- });
50
- });
51
- }
52
- }
53
-
54
- export { EmailMagicWalletConnector };
@@ -1 +0,0 @@
1
- export { EmailMagicWalletConnector } from './EmailMagicWalletConnector';
@@ -1,62 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
- var logger = require('../../../../utils/logger.cjs');
7
- var EmailMagicWalletConnector = require('../EmailMagicWalletConnector/EmailMagicWalletConnector.cjs');
8
-
9
- class EmailOTPMagicWalletConnector extends EmailMagicWalletConnector.EmailMagicWalletConnector {
10
- verifyOneTimePassword(otp) {
11
- return tslib.__awaiter(this, void 0, void 0, function* () {
12
- const handle = this._handle;
13
- const timeoutMs = 1000 * 10;
14
- const invalidOTPError = new Error('Please double check your code and try again');
15
- if (!handle) {
16
- throw new Error('Login with email OTP before verifying');
17
- }
18
- const timeoutPromise = new Promise((resolve, reject) => {
19
- setTimeout(() => {
20
- reject(invalidOTPError);
21
- }, timeoutMs);
22
- });
23
- const promise = new Promise((resolve, reject) => {
24
- handle
25
- .on('done', () => resolve(true))
26
- .on('invalid-email-otp', () => reject(invalidOTPError))
27
- .on('error', reject)
28
- .catch(reject)
29
- .emit('verify-email-otp', otp);
30
- });
31
- return Promise.race([promise, timeoutPromise]);
32
- });
33
- }
34
- loginWithMagic() {
35
- var _a;
36
- return tslib.__awaiter(this, void 0, void 0, function* () {
37
- const client = this._magicClient.getClient();
38
- const user = yield this.getUserMetadata();
39
- if (user && user.publicAddress) {
40
- this.setEmail((user === null || user === void 0 ? void 0 : user.email) || '');
41
- return user.publicAddress;
42
- }
43
- const { email } = this;
44
- if (!email)
45
- return;
46
- (_a = this._handle) === null || _a === void 0 ? void 0 : _a.emit('cancel');
47
- try {
48
- yield this._handle;
49
- }
50
- catch (err) {
51
- logger.logger.error(err);
52
- }
53
- this._handle = client.auth.loginWithEmailOTP({
54
- email,
55
- showUI: false,
56
- });
57
- return this._handle;
58
- });
59
- }
60
- }
61
-
62
- exports.EmailOTPMagicWalletConnector = EmailOTPMagicWalletConnector;
@@ -1,11 +0,0 @@
1
- import { Magic } from 'magic-sdk';
2
- import { EmailOTPWalletConnector } from '@dynamic-labs/wallet-connector-core';
3
- import { EmailMagicWalletConnector } from '../EmailMagicWalletConnector';
4
- import { MagicPromiEvent } from '../MagicWalletConnector';
5
- type LoginWithEmailOTPPromiEvent = ReturnType<Magic['auth']['loginWithEmailOTP']>;
6
- export declare class EmailOTPMagicWalletConnector extends EmailMagicWalletConnector implements EmailOTPWalletConnector {
7
- _handle: LoginWithEmailOTPPromiEvent | undefined;
8
- verifyOneTimePassword(otp: string): Promise<boolean>;
9
- loginWithMagic(): Promise<MagicPromiEvent | undefined>;
10
- }
11
- export {};
@@ -1,58 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import { logger } from '../../../../utils/logger.js';
3
- import { EmailMagicWalletConnector } from '../EmailMagicWalletConnector/EmailMagicWalletConnector.js';
4
-
5
- class EmailOTPMagicWalletConnector extends EmailMagicWalletConnector {
6
- verifyOneTimePassword(otp) {
7
- return __awaiter(this, void 0, void 0, function* () {
8
- const handle = this._handle;
9
- const timeoutMs = 1000 * 10;
10
- const invalidOTPError = new Error('Please double check your code and try again');
11
- if (!handle) {
12
- throw new Error('Login with email OTP before verifying');
13
- }
14
- const timeoutPromise = new Promise((resolve, reject) => {
15
- setTimeout(() => {
16
- reject(invalidOTPError);
17
- }, timeoutMs);
18
- });
19
- const promise = new Promise((resolve, reject) => {
20
- handle
21
- .on('done', () => resolve(true))
22
- .on('invalid-email-otp', () => reject(invalidOTPError))
23
- .on('error', reject)
24
- .catch(reject)
25
- .emit('verify-email-otp', otp);
26
- });
27
- return Promise.race([promise, timeoutPromise]);
28
- });
29
- }
30
- loginWithMagic() {
31
- var _a;
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const client = this._magicClient.getClient();
34
- const user = yield this.getUserMetadata();
35
- if (user && user.publicAddress) {
36
- this.setEmail((user === null || user === void 0 ? void 0 : user.email) || '');
37
- return user.publicAddress;
38
- }
39
- const { email } = this;
40
- if (!email)
41
- return;
42
- (_a = this._handle) === null || _a === void 0 ? void 0 : _a.emit('cancel');
43
- try {
44
- yield this._handle;
45
- }
46
- catch (err) {
47
- logger.error(err);
48
- }
49
- this._handle = client.auth.loginWithEmailOTP({
50
- email,
51
- showUI: false,
52
- });
53
- return this._handle;
54
- });
55
- }
56
- }
57
-
58
- export { EmailOTPMagicWalletConnector };
@@ -1 +0,0 @@
1
- export { EmailOTPMagicWalletConnector } from './EmailOTPMagicWalletConnector';