@dynamic-labs/multi-wallet 0.17.0-RC.2 → 0.17.0-RC.21

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 (277) hide show
  1. package/CHANGELOG.md +242 -0
  2. package/package.json +10 -26
  3. package/src/index.cjs +0 -69
  4. package/src/index.d.ts +0 -18
  5. package/src/index.js +1 -23
  6. package/src/multi-wallet.cjs +38 -182
  7. package/src/multi-wallet.d.ts +1 -4
  8. package/src/multi-wallet.js +37 -180
  9. package/src/types.d.ts +12 -50
  10. package/src/utils/getApiProviders.cjs +15 -0
  11. package/src/utils/getApiProviders.d.ts +17 -0
  12. package/src/utils/getApiProviders.js +11 -0
  13. package/src/utils/message.cjs +3 -4
  14. package/src/utils/message.d.ts +2 -2
  15. package/src/utils/message.js +1 -2
  16. package/src/errors.cjs +0 -65
  17. package/src/errors.d.ts +0 -30
  18. package/src/errors.js +0 -53
  19. package/src/polyfills.cjs +0 -16
  20. package/src/polyfills.d.ts +0 -1
  21. package/src/polyfills.js +0 -14
  22. package/src/rpcProviders.cjs +0 -76
  23. package/src/rpcProviders.d.ts +0 -5
  24. package/src/rpcProviders.js +0 -69
  25. package/src/utils/CancellablePromise/CancellablePromise.cjs +0 -33
  26. package/src/utils/CancellablePromise/CancellablePromise.d.ts +0 -9
  27. package/src/utils/CancellablePromise/CancellablePromise.js +0 -29
  28. package/src/utils/CancellablePromise/index.d.ts +0 -1
  29. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs +0 -54
  30. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.d.ts +0 -3
  31. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js +0 -50
  32. package/src/utils/assignConfirmationScreenToProvider/index.d.ts +0 -1
  33. package/src/utils/convertors.cjs +0 -43
  34. package/src/utils/convertors.d.ts +0 -3
  35. package/src/utils/convertors.js +0 -38
  36. package/src/utils/encoding.cjs +0 -18
  37. package/src/utils/encoding.d.ts +0 -4
  38. package/src/utils/encoding.js +0 -12
  39. package/src/utils/extractNonce.cjs +0 -13
  40. package/src/utils/extractNonce.d.ts +0 -1
  41. package/src/utils/extractNonce.js +0 -9
  42. package/src/utils/getChainInfo/getChainInfo.cjs +0 -59
  43. package/src/utils/getChainInfo/getChainInfo.d.ts +0 -2
  44. package/src/utils/getChainInfo/getChainInfo.js +0 -55
  45. package/src/utils/getChainInfo/index.d.ts +0 -1
  46. package/src/utils/getWalletConnectorByName.cjs +0 -19
  47. package/src/utils/getWalletConnectorByName.d.ts +0 -2
  48. package/src/utils/getWalletConnectorByName.js +0 -15
  49. package/src/utils/isEmailOTPWalletConnector/index.d.ts +0 -1
  50. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.cjs +0 -7
  51. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.d.ts +0 -2
  52. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js +0 -3
  53. package/src/utils/isEmailWalletConnector/index.d.ts +0 -1
  54. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.cjs +0 -7
  55. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.d.ts +0 -2
  56. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.js +0 -3
  57. package/src/utils/isFunction/index.d.ts +0 -1
  58. package/src/utils/isFunction/isFunction.cjs +0 -8
  59. package/src/utils/isFunction/isFunction.d.ts +0 -1
  60. package/src/utils/isFunction/isFunction.js +0 -4
  61. package/src/utils/isMobile.cjs +0 -54
  62. package/src/utils/isMobile.d.ts +0 -13
  63. package/src/utils/isMobile.js +0 -46
  64. package/src/utils/isSameAddress/index.d.ts +0 -1
  65. package/src/utils/isSameAddress/isSameAddress.cjs +0 -9
  66. package/src/utils/isSameAddress/isSameAddress.d.ts +0 -1
  67. package/src/utils/isSameAddress/isSameAddress.js +0 -5
  68. package/src/utils/isSameAddress/utils/index.d.ts +0 -1
  69. package/src/utils/isSameAddress/utils/normalizeAddress/index.d.ts +0 -1
  70. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.cjs +0 -17
  71. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.d.ts +0 -1
  72. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js +0 -13
  73. package/src/utils/isSocialWalletConnector/index.d.ts +0 -1
  74. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.cjs +0 -7
  75. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.d.ts +0 -2
  76. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.js +0 -3
  77. package/src/utils/isUnsupportedProviderError/index.d.ts +0 -1
  78. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
  79. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.d.ts +0 -6
  80. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
  81. package/src/utils/localStorageAsync.cjs +0 -28
  82. package/src/utils/localStorageAsync.d.ts +0 -3
  83. package/src/utils/localStorageAsync.js +0 -22
  84. package/src/utils/logger.cjs +0 -9
  85. package/src/utils/logger.d.ts +0 -2
  86. package/src/utils/logger.js +0 -5
  87. package/src/utils/normalizeWalletName/index.d.ts +0 -1
  88. package/src/utils/normalizeWalletName/normalizeWalletName.cjs +0 -7
  89. package/src/utils/normalizeWalletName/normalizeWalletName.d.ts +0 -1
  90. package/src/utils/normalizeWalletName/normalizeWalletName.js +0 -3
  91. package/src/utils/shouldLowercaseAddress.cjs +0 -11
  92. package/src/utils/shouldLowercaseAddress.d.ts +0 -1
  93. package/src/utils/shouldLowercaseAddress.js +0 -7
  94. package/src/utils/walletConnect.cjs +0 -30
  95. package/src/utils/walletConnect.d.ts +0 -4
  96. package/src/utils/walletConnect.js +0 -26
  97. package/src/wallets/ProviderLookup.cjs +0 -18
  98. package/src/wallets/ProviderLookup.d.ts +0 -4
  99. package/src/wallets/ProviderLookup.js +0 -14
  100. package/src/wallets/algorand/MyAlgoWalletConnector.cjs +0 -149
  101. package/src/wallets/algorand/MyAlgoWalletConnector.d.ts +0 -21
  102. package/src/wallets/algorand/MyAlgoWalletConnector.js +0 -143
  103. package/src/wallets/algorand/myalgoSigner.cjs +0 -24
  104. package/src/wallets/algorand/myalgoSigner.d.ts +0 -21
  105. package/src/wallets/algorand/myalgoSigner.js +0 -20
  106. package/src/wallets/clients/coinbase/coinbase.cjs +0 -73
  107. package/src/wallets/clients/coinbase/coinbase.d.ts +0 -6
  108. package/src/wallets/clients/coinbase/coinbase.js +0 -66
  109. package/src/wallets/clients/coinbase/index.d.ts +0 -2
  110. package/src/wallets/clients/coinbase/types.d.ts +0 -14
  111. package/src/wallets/clients/walletConnect/index.d.ts +0 -1
  112. package/src/wallets/clients/walletConnect/types.d.ts +0 -4
  113. package/src/wallets/clients/walletConnect/walletConnect.cjs +0 -204
  114. package/src/wallets/clients/walletConnect/walletConnect.d.ts +0 -22
  115. package/src/wallets/clients/walletConnect/walletConnect.js +0 -187
  116. package/src/wallets/constants.cjs +0 -16
  117. package/src/wallets/constants.d.ts +0 -4
  118. package/src/wallets/constants.js +0 -10
  119. package/src/wallets/cosmos/KeplrWalletConnect.cjs +0 -196
  120. package/src/wallets/cosmos/KeplrWalletConnect.d.ts +0 -46
  121. package/src/wallets/cosmos/KeplrWalletConnect.js +0 -194
  122. package/src/wallets/cosmos/KeplrWalletConnector.cjs +0 -193
  123. package/src/wallets/cosmos/KeplrWalletConnector.d.ts +0 -70
  124. package/src/wallets/cosmos/KeplrWalletConnector.js +0 -189
  125. package/src/wallets/cosmos/getKeplrConnector.cjs +0 -18
  126. package/src/wallets/cosmos/getKeplrConnector.d.ts +0 -6
  127. package/src/wallets/cosmos/getKeplrConnector.js +0 -14
  128. package/src/wallets/cosmos/index.d.ts +0 -1
  129. package/src/wallets/cosmos/utils/indexDB.cjs +0 -97
  130. package/src/wallets/cosmos/utils/indexDB.d.ts +0 -18
  131. package/src/wallets/cosmos/utils/indexDB.js +0 -93
  132. package/src/wallets/cosmos/wcClient.cjs +0 -333
  133. package/src/wallets/cosmos/wcClient.d.ts +0 -104
  134. package/src/wallets/cosmos/wcClient.js +0 -325
  135. package/src/wallets/ethereum/BloctoEvm.cjs +0 -111
  136. package/src/wallets/ethereum/BloctoEvm.d.ts +0 -25
  137. package/src/wallets/ethereum/BloctoEvm.js +0 -105
  138. package/src/wallets/ethereum/EthWalletConnector.cjs +0 -191
  139. package/src/wallets/ethereum/EthWalletConnector.d.ts +0 -35
  140. package/src/wallets/ethereum/EthWalletConnector.js +0 -187
  141. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.cjs +0 -63
  142. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.d.ts +0 -12
  143. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.js +0 -59
  144. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/index.d.ts +0 -1
  145. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.cjs +0 -62
  146. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.d.ts +0 -11
  147. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.js +0 -58
  148. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/index.d.ts +0 -1
  149. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +0 -102
  150. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +0 -33
  151. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +0 -98
  152. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/index.d.ts +0 -2
  153. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs +0 -55
  154. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.d.ts +0 -12
  155. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js +0 -51
  156. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/index.d.ts +0 -1
  157. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +0 -175
  158. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +0 -53
  159. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +0 -171
  160. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/index.d.ts +0 -2
  161. package/src/wallets/ethereum/MagicConnector/index.d.ts +0 -5
  162. package/src/wallets/ethereum/coinbase.cjs +0 -65
  163. package/src/wallets/ethereum/coinbase.d.ts +0 -26
  164. package/src/wallets/ethereum/coinbase.js +0 -63
  165. package/src/wallets/ethereum/ethProviderHelper.cjs +0 -197
  166. package/src/wallets/ethereum/ethProviderHelper.d.ts +0 -40
  167. package/src/wallets/ethereum/ethProviderHelper.js +0 -193
  168. package/src/wallets/ethereum/evm-network.cjs +0 -20
  169. package/src/wallets/ethereum/evm-network.d.ts +0 -22
  170. package/src/wallets/ethereum/evm-network.js +0 -16
  171. package/src/wallets/ethereum/fortmatic.cjs +0 -75
  172. package/src/wallets/ethereum/fortmatic.d.ts +0 -26
  173. package/src/wallets/ethereum/fortmatic.js +0 -69
  174. package/src/wallets/ethereum/injected/BloctoInjected.cjs +0 -13
  175. package/src/wallets/ethereum/injected/BloctoInjected.d.ts +0 -6
  176. package/src/wallets/ethereum/injected/BloctoInjected.js +0 -11
  177. package/src/wallets/ethereum/injected/BraveEvm.cjs +0 -13
  178. package/src/wallets/ethereum/injected/BraveEvm.d.ts +0 -6
  179. package/src/wallets/ethereum/injected/BraveEvm.js +0 -11
  180. package/src/wallets/ethereum/injected/Dawn.cjs +0 -13
  181. package/src/wallets/ethereum/injected/Dawn.d.ts +0 -6
  182. package/src/wallets/ethereum/injected/Dawn.js +0 -11
  183. package/src/wallets/ethereum/injected/ExodusEvm.cjs +0 -13
  184. package/src/wallets/ethereum/injected/ExodusEvm.d.ts +0 -6
  185. package/src/wallets/ethereum/injected/ExodusEvm.js +0 -11
  186. package/src/wallets/ethereum/injected/Frame.cjs +0 -13
  187. package/src/wallets/ethereum/injected/Frame.d.ts +0 -6
  188. package/src/wallets/ethereum/injected/Frame.js +0 -11
  189. package/src/wallets/ethereum/injected/GameStop.cjs +0 -13
  190. package/src/wallets/ethereum/injected/GameStop.d.ts +0 -6
  191. package/src/wallets/ethereum/injected/GameStop.js +0 -11
  192. package/src/wallets/ethereum/injected/Opera.cjs +0 -13
  193. package/src/wallets/ethereum/injected/Opera.d.ts +0 -6
  194. package/src/wallets/ethereum/injected/Opera.js +0 -11
  195. package/src/wallets/ethereum/injected/PhantomEvm.cjs +0 -37
  196. package/src/wallets/ethereum/injected/PhantomEvm.d.ts +0 -7
  197. package/src/wallets/ethereum/injected/PhantomEvm.js +0 -35
  198. package/src/wallets/ethereum/injected/Trust.cjs +0 -13
  199. package/src/wallets/ethereum/injected/Trust.d.ts +0 -6
  200. package/src/wallets/ethereum/injected/Trust.js +0 -11
  201. package/src/wallets/ethereum/injected/UnknownInjectedWallet.cjs +0 -13
  202. package/src/wallets/ethereum/injected/UnknownInjectedWallet.d.ts +0 -6
  203. package/src/wallets/ethereum/injected/UnknownInjectedWallet.js +0 -11
  204. package/src/wallets/ethereum/injected/Zerion.cjs +0 -13
  205. package/src/wallets/ethereum/injected/Zerion.d.ts +0 -6
  206. package/src/wallets/ethereum/injected/Zerion.js +0 -11
  207. package/src/wallets/ethereum/meta-mask.cjs +0 -63
  208. package/src/wallets/ethereum/meta-mask.d.ts +0 -26
  209. package/src/wallets/ethereum/meta-mask.js +0 -61
  210. package/src/wallets/flow/FlowWalletConnector.cjs +0 -163
  211. package/src/wallets/flow/FlowWalletConnector.d.ts +0 -29
  212. package/src/wallets/flow/FlowWalletConnector.js +0 -158
  213. package/src/wallets/flow/blocto.cjs +0 -22
  214. package/src/wallets/flow/blocto.d.ts +0 -7
  215. package/src/wallets/flow/blocto.js +0 -20
  216. package/src/wallets/flow/dapper.cjs +0 -22
  217. package/src/wallets/flow/dapper.d.ts +0 -7
  218. package/src/wallets/flow/dapper.js +0 -20
  219. package/src/wallets/flow/lilico.cjs +0 -42
  220. package/src/wallets/flow/lilico.d.ts +0 -8
  221. package/src/wallets/flow/lilico.js +0 -40
  222. package/src/wallets/getMobileOrInjectedWallet.cjs +0 -26
  223. package/src/wallets/getMobileOrInjectedWallet.d.ts +0 -8
  224. package/src/wallets/getMobileOrInjectedWallet.js +0 -22
  225. package/src/wallets/getWalletConnectConnector.cjs +0 -19
  226. package/src/wallets/getWalletConnectConnector.d.ts +0 -8
  227. package/src/wallets/getWalletConnectConnector.js +0 -15
  228. package/src/wallets/solana/CoinbaseSolana.cjs +0 -54
  229. package/src/wallets/solana/CoinbaseSolana.d.ts +0 -17
  230. package/src/wallets/solana/CoinbaseSolana.js +0 -52
  231. package/src/wallets/solana/glow.cjs +0 -51
  232. package/src/wallets/solana/glow.d.ts +0 -16
  233. package/src/wallets/solana/glow.js +0 -49
  234. package/src/wallets/solana/injected/BraveSol.cjs +0 -18
  235. package/src/wallets/solana/injected/BraveSol.d.ts +0 -6
  236. package/src/wallets/solana/injected/BraveSol.js +0 -16
  237. package/src/wallets/solana/injected/ExodusSol.cjs +0 -12
  238. package/src/wallets/solana/injected/ExodusSol.d.ts +0 -5
  239. package/src/wallets/solana/injected/ExodusSol.js +0 -10
  240. package/src/wallets/solana/phantom-ledger.cjs +0 -71
  241. package/src/wallets/solana/phantom-ledger.d.ts +0 -16
  242. package/src/wallets/solana/phantom-ledger.js +0 -65
  243. package/src/wallets/solana/phantom.cjs +0 -74
  244. package/src/wallets/solana/phantom.d.ts +0 -17
  245. package/src/wallets/solana/phantom.js +0 -72
  246. package/src/wallets/solana/slope.cjs +0 -96
  247. package/src/wallets/solana/slope.d.ts +0 -27
  248. package/src/wallets/solana/slope.js +0 -94
  249. package/src/wallets/solana/solProviderHelper.cjs +0 -164
  250. package/src/wallets/solana/solProviderHelper.d.ts +0 -29
  251. package/src/wallets/solana/solProviderHelper.js +0 -160
  252. package/src/wallets/solana/solWalletConnector.cjs +0 -57
  253. package/src/wallets/solana/solWalletConnector.d.ts +0 -18
  254. package/src/wallets/solana/solWalletConnector.js +0 -53
  255. package/src/wallets/solana/solflare.cjs +0 -65
  256. package/src/wallets/solana/solflare.d.ts +0 -14
  257. package/src/wallets/solana/solflare.js +0 -63
  258. package/src/wallets/starknet/argentx.cjs +0 -20
  259. package/src/wallets/starknet/argentx.d.ts +0 -7
  260. package/src/wallets/starknet/argentx.js +0 -18
  261. package/src/wallets/starknet/braavos.cjs +0 -33
  262. package/src/wallets/starknet/braavos.d.ts +0 -7
  263. package/src/wallets/starknet/braavos.js +0 -31
  264. package/src/wallets/starknet/ethereumContractAbi.cjs +0 -357
  265. package/src/wallets/starknet/ethereumContractAbi.js +0 -355
  266. package/src/wallets/starknet/starknetWalletConnector.cjs +0 -171
  267. package/src/wallets/starknet/starknetWalletConnector.d.ts +0 -34
  268. package/src/wallets/starknet/starknetWalletConnector.js +0 -169
  269. package/src/wallets/walletConnect/index.d.ts +0 -2
  270. package/src/wallets/walletConnect/walletConnect.cjs +0 -130
  271. package/src/wallets/walletConnect/walletConnect.d.ts +0 -34
  272. package/src/wallets/walletConnect/walletConnect.js +0 -124
  273. package/src/wallets/walletConnect/walletConnectV2.cjs +0 -268
  274. package/src/wallets/walletConnect/walletConnectV2.d.ts +0 -38
  275. package/src/wallets/walletConnect/walletConnectV2.js +0 -262
  276. package/src/wallets/walletConnect/zerion.d.ts +0 -8
  277. package/src/wallets/window.d.ts +0 -95
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var sdkApi = require('@dynamic-labs/sdk-api');
6
+
7
+ const getApiProviders = (providers) => Object.values(sdkApi.ProviderEnum).reduce((acc, provider) => {
8
+ const foundProvider = providers.find((providerSetting) => providerSetting.provider === provider);
9
+ if (foundProvider) {
10
+ acc[provider] = foundProvider;
11
+ }
12
+ return acc;
13
+ }, {});
14
+
15
+ exports.getApiProviders = getApiProviders;
@@ -0,0 +1,17 @@
1
+ import { Provider, ProviderEnum } from '@dynamic-labs/sdk-api';
2
+ export declare const getApiProviders: (providers: Provider[]) => {
3
+ emailOnly?: Provider | undefined;
4
+ magicLink?: Provider | undefined;
5
+ apple?: Provider | undefined;
6
+ bitbucket?: Provider | undefined;
7
+ discord?: Provider | undefined;
8
+ facebook?: Provider | undefined;
9
+ github?: Provider | undefined;
10
+ gitlab?: Provider | undefined;
11
+ google?: Provider | undefined;
12
+ instagram?: Provider | undefined;
13
+ linkedin?: Provider | undefined;
14
+ microsoft?: Provider | undefined;
15
+ twitch?: Provider | undefined;
16
+ twitter?: Provider | undefined;
17
+ };
@@ -0,0 +1,11 @@
1
+ import { ProviderEnum } from '@dynamic-labs/sdk-api';
2
+
3
+ const getApiProviders = (providers) => Object.values(ProviderEnum).reduce((acc, provider) => {
4
+ const foundProvider = providers.find((providerSetting) => providerSetting.provider === provider);
5
+ if (foundProvider) {
6
+ acc[provider] = foundProvider;
7
+ }
8
+ return acc;
9
+ }, {});
10
+
11
+ export { getApiProviders };
@@ -3,15 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var utils = require('ethers/lib/utils');
6
- var logger = require('./logger.cjs');
7
- var getChainInfo = require('./getChainInfo/getChainInfo.cjs');
6
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
7
 
9
8
  const generateMessageToSign = ({ blockchain, domain, chainId, nonce, uri, publicKey, issuedAt = new Date().toISOString(), statement, requestId, resources, }) => {
10
9
  var _a, _b;
11
10
  if (blockchain === 'STARK') {
12
11
  return nonce;
13
12
  }
14
- const blockchainName = (_b = (_a = getChainInfo.getChainInfo(blockchain)) === null || _a === void 0 ? void 0 : _a.blockchainName) !== null && _b !== void 0 ? _b : 'Ethereum';
13
+ const blockchainName = (_b = (_a = walletConnectorCore.getChainInfo(blockchain)) === null || _a === void 0 ? void 0 : _a.blockchainName) !== null && _b !== void 0 ? _b : 'Ethereum';
15
14
  // This format follows the sign-in with ethereum (SIWE) standard,
16
15
  // but we are using it also for non-ethereum wallets for now (eg. Solana)
17
16
  // for more context on format and fields, please see:
@@ -48,7 +47,7 @@ const getEip55Address = (publicKey, chainId) => {
48
47
  }
49
48
  }
50
49
  catch (err) {
51
- logger.logger.debug(`Error getting checksum, returning default ${publicKey}`);
50
+ walletConnectorCore.logger.debug(`Error getting checksum, returning default ${publicKey}`);
52
51
  }
53
52
  return publicKey;
54
53
  };
@@ -1,7 +1,7 @@
1
1
  import { Chain } from '@dynamic-labs/wallet-connector-core';
2
2
  export interface MessageParameters {
3
3
  blockchain: Chain;
4
- chainId?: number;
4
+ chainId?: number | string;
5
5
  domain: string;
6
6
  issuedAt?: string;
7
7
  nonce: string;
@@ -12,4 +12,4 @@ export interface MessageParameters {
12
12
  uri: string;
13
13
  }
14
14
  export declare const generateMessageToSign: ({ blockchain, domain, chainId, nonce, uri, publicKey, issuedAt, statement, requestId, resources, }: MessageParameters) => string;
15
- export declare const getEip55Address: (publicKey: string, chainId?: number) => string;
15
+ export declare const getEip55Address: (publicKey: string, chainId?: number | string) => string;
@@ -1,6 +1,5 @@
1
1
  import { getAddress } from 'ethers/lib/utils.js';
2
- import { logger } from './logger.js';
3
- import { getChainInfo } from './getChainInfo/getChainInfo.js';
2
+ import { getChainInfo, logger } from '@dynamic-labs/wallet-connector-core';
4
3
 
5
4
  const generateMessageToSign = ({ blockchain, domain, chainId, nonce, uri, publicKey, issuedAt = new Date().toISOString(), statement, requestId, resources, }) => {
6
5
  var _a, _b;
package/src/errors.cjs DELETED
@@ -1,65 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- class DynamicError extends Error {
6
- }
7
- class NotSupportedError extends DynamicError {
8
- }
9
- class EmailVerificationError extends DynamicError {
10
- constructor(code) {
11
- super();
12
- this.name = 'EmailVerificationError';
13
- this.code = code;
14
- }
15
- }
16
- class NoAccessError extends DynamicError {
17
- constructor(walletPublicKey) {
18
- super('User does not have access');
19
- this.name = 'NoAccessError';
20
- this.walletPublicKey = walletPublicKey;
21
- }
22
- }
23
- class ChainalysisError extends DynamicError {
24
- constructor(walletPublicKey) {
25
- super('This address is not approved for access');
26
- this.name = 'ChainalysisError';
27
- this.walletPublicKey = walletPublicKey;
28
- }
29
- }
30
- class EmailAlreadyExistsError extends DynamicError {
31
- constructor() {
32
- super('Email already exists');
33
- this.name = 'EmailAlreadyExistsError';
34
- }
35
- }
36
- class UsernameAlreadyExistsError extends DynamicError {
37
- constructor() {
38
- super('Username already exists');
39
- this.name = 'UsernameAlreadyExistsError';
40
- }
41
- }
42
- class WalletNotDeployedError extends DynamicError {
43
- constructor() {
44
- super('Wallet has not been deployed');
45
- this.name = 'WalletNotDeployedError';
46
- this.code = 'wallet_not_deployed';
47
- }
48
- }
49
- class WalletUsedError extends DynamicError {
50
- constructor(code) {
51
- super();
52
- this.name = 'WalletUsedError';
53
- this.code = code;
54
- }
55
- }
56
-
57
- exports.ChainalysisError = ChainalysisError;
58
- exports.DynamicError = DynamicError;
59
- exports.EmailAlreadyExistsError = EmailAlreadyExistsError;
60
- exports.EmailVerificationError = EmailVerificationError;
61
- exports.NoAccessError = NoAccessError;
62
- exports.NotSupportedError = NotSupportedError;
63
- exports.UsernameAlreadyExistsError = UsernameAlreadyExistsError;
64
- exports.WalletNotDeployedError = WalletNotDeployedError;
65
- exports.WalletUsedError = WalletUsedError;
package/src/errors.d.ts DELETED
@@ -1,30 +0,0 @@
1
- export declare class DynamicError extends Error {
2
- }
3
- export declare class NotSupportedError extends DynamicError {
4
- }
5
- export declare class EmailVerificationError extends DynamicError {
6
- code: string | undefined;
7
- constructor(code: string);
8
- }
9
- export declare class NoAccessError extends DynamicError {
10
- walletPublicKey: string | undefined;
11
- constructor(walletPublicKey: string);
12
- }
13
- export declare class ChainalysisError extends DynamicError {
14
- walletPublicKey: string | undefined;
15
- constructor(walletPublicKey: string);
16
- }
17
- export declare class EmailAlreadyExistsError extends DynamicError {
18
- constructor();
19
- }
20
- export declare class UsernameAlreadyExistsError extends DynamicError {
21
- constructor();
22
- }
23
- export declare class WalletNotDeployedError extends DynamicError {
24
- code: string | undefined;
25
- constructor();
26
- }
27
- export declare class WalletUsedError extends DynamicError {
28
- code: string | undefined;
29
- constructor(code: string);
30
- }
package/src/errors.js DELETED
@@ -1,53 +0,0 @@
1
- class DynamicError extends Error {
2
- }
3
- class NotSupportedError extends DynamicError {
4
- }
5
- class EmailVerificationError extends DynamicError {
6
- constructor(code) {
7
- super();
8
- this.name = 'EmailVerificationError';
9
- this.code = code;
10
- }
11
- }
12
- class NoAccessError extends DynamicError {
13
- constructor(walletPublicKey) {
14
- super('User does not have access');
15
- this.name = 'NoAccessError';
16
- this.walletPublicKey = walletPublicKey;
17
- }
18
- }
19
- class ChainalysisError extends DynamicError {
20
- constructor(walletPublicKey) {
21
- super('This address is not approved for access');
22
- this.name = 'ChainalysisError';
23
- this.walletPublicKey = walletPublicKey;
24
- }
25
- }
26
- class EmailAlreadyExistsError extends DynamicError {
27
- constructor() {
28
- super('Email already exists');
29
- this.name = 'EmailAlreadyExistsError';
30
- }
31
- }
32
- class UsernameAlreadyExistsError extends DynamicError {
33
- constructor() {
34
- super('Username already exists');
35
- this.name = 'UsernameAlreadyExistsError';
36
- }
37
- }
38
- class WalletNotDeployedError extends DynamicError {
39
- constructor() {
40
- super('Wallet has not been deployed');
41
- this.name = 'WalletNotDeployedError';
42
- this.code = 'wallet_not_deployed';
43
- }
44
- }
45
- class WalletUsedError extends DynamicError {
46
- constructor(code) {
47
- super();
48
- this.name = 'WalletUsedError';
49
- this.code = code;
50
- }
51
- }
52
-
53
- export { ChainalysisError, DynamicError, EmailAlreadyExistsError, EmailVerificationError, NoAccessError, NotSupportedError, UsernameAlreadyExistsError, WalletNotDeployedError, WalletUsedError };
package/src/polyfills.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var _ = require('buffer/');
4
-
5
- /* eslint-disable */
6
- /**
7
- * @walletconnect/client and @walletconnect/qrcode-modal use `global` and `Buffer`, respectively.
8
- * This issue is captured here: https://github.com/WalletConnect/walletconnect-monorepo/issues/341
9
- * Here are some GH issues of others facing the same problem:
10
- * * https://github.com/WalletConnect/walletconnect-monorepo/issues/734
11
- * * https://github.com/WalletConnect/walletconnect-monorepo/issues/748
12
- */
13
- if (typeof window !== 'undefined') {
14
- window.global = globalThis;
15
- Object.assign(window, { Buffer: _.Buffer });
16
- }
@@ -1 +0,0 @@
1
- export {};
package/src/polyfills.js DELETED
@@ -1,14 +0,0 @@
1
- import { Buffer } from 'buffer/index.js';
2
-
3
- /* eslint-disable */
4
- /**
5
- * @walletconnect/client and @walletconnect/qrcode-modal use `global` and `Buffer`, respectively.
6
- * This issue is captured here: https://github.com/WalletConnect/walletconnect-monorepo/issues/341
7
- * Here are some GH issues of others facing the same problem:
8
- * * https://github.com/WalletConnect/walletconnect-monorepo/issues/734
9
- * * https://github.com/WalletConnect/walletconnect-monorepo/issues/748
10
- */
11
- if (typeof window !== 'undefined') {
12
- window.global = globalThis;
13
- Object.assign(window, { Buffer });
14
- }
@@ -1,76 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var web3_js = require('@solana/web3.js');
6
- var ethers = require('ethers');
7
-
8
- const getRpcProviders = (configurations) => {
9
- const rpcProviders = {};
10
- if (configurations === null || configurations === void 0 ? void 0 : configurations.evm) {
11
- rpcProviders.evm = configurations.evm.map((network) => {
12
- var _a;
13
- const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
14
- const provider = new ethers.ethers.providers.JsonRpcProvider(rpcUrl, network.chainId);
15
- return {
16
- chainId: network.chainId,
17
- chainName: network.chainName,
18
- provider,
19
- };
20
- });
21
- }
22
- if (configurations === null || configurations === void 0 ? void 0 : configurations.solana) {
23
- rpcProviders.solana = configurations.solana.map((network) => {
24
- var _a;
25
- const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
26
- const provider = new web3_js.Connection(rpcUrl);
27
- return {
28
- chainId: parseInt(network.chainId),
29
- chainName: network.name,
30
- provider,
31
- };
32
- });
33
- }
34
- if (Object.keys(rpcProviders).length === 0) {
35
- return undefined;
36
- }
37
- return rpcProviders;
38
- };
39
- const getEvmDefaultRpcProvider = (configurations) => {
40
- const rpcProviders = getRpcProviders(configurations);
41
- if (!rpcProviders) {
42
- return undefined;
43
- }
44
- if (!rpcProviders.evm) {
45
- return undefined;
46
- }
47
- const defaultProvider = rpcProviders.evm.find((provider) => provider.chainId === 1);
48
- return defaultProvider;
49
- };
50
- const getSolanaDefaultRpcProvider = (configurations) => {
51
- const rpcProviders = getRpcProviders(configurations);
52
- if (!rpcProviders) {
53
- return undefined;
54
- }
55
- if (!rpcProviders.solana) {
56
- return undefined;
57
- }
58
- const defaultProvider = rpcProviders.solana.find((provider) => provider.chainId === 101);
59
- return defaultProvider;
60
- };
61
- const getEvmRpcProviderByChainId = (configurations, chainId) => {
62
- const rpcProviders = getRpcProviders(configurations);
63
- if (!rpcProviders) {
64
- return undefined;
65
- }
66
- if (rpcProviders.evm) {
67
- const evmRpcProvider = rpcProviders.evm.find((rpcProvider) => rpcProvider.chainId === chainId);
68
- return evmRpcProvider;
69
- }
70
- return undefined;
71
- };
72
-
73
- exports.getEvmDefaultRpcProvider = getEvmDefaultRpcProvider;
74
- exports.getEvmRpcProviderByChainId = getEvmRpcProviderByChainId;
75
- exports.getRpcProviders = getRpcProviders;
76
- exports.getSolanaDefaultRpcProvider = getSolanaDefaultRpcProvider;
@@ -1,5 +0,0 @@
1
- import { EvmRpcProvider, NetworkConfigurationMap, RpcProviders, SolanaRpcProvider } from './types';
2
- export declare const getRpcProviders: (configurations: NetworkConfigurationMap) => RpcProviders | undefined;
3
- export declare const getEvmDefaultRpcProvider: (configurations: NetworkConfigurationMap) => EvmRpcProvider | undefined;
4
- export declare const getSolanaDefaultRpcProvider: (configurations: NetworkConfigurationMap) => SolanaRpcProvider | undefined;
5
- export declare const getEvmRpcProviderByChainId: (configurations: NetworkConfigurationMap, chainId: number) => EvmRpcProvider | undefined;
@@ -1,69 +0,0 @@
1
- import { Connection } from '@solana/web3.js';
2
- import { ethers } from 'ethers';
3
-
4
- const getRpcProviders = (configurations) => {
5
- const rpcProviders = {};
6
- if (configurations === null || configurations === void 0 ? void 0 : configurations.evm) {
7
- rpcProviders.evm = configurations.evm.map((network) => {
8
- var _a;
9
- const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
10
- const provider = new ethers.providers.JsonRpcProvider(rpcUrl, network.chainId);
11
- return {
12
- chainId: network.chainId,
13
- chainName: network.chainName,
14
- provider,
15
- };
16
- });
17
- }
18
- if (configurations === null || configurations === void 0 ? void 0 : configurations.solana) {
19
- rpcProviders.solana = configurations.solana.map((network) => {
20
- var _a;
21
- const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
22
- const provider = new Connection(rpcUrl);
23
- return {
24
- chainId: parseInt(network.chainId),
25
- chainName: network.name,
26
- provider,
27
- };
28
- });
29
- }
30
- if (Object.keys(rpcProviders).length === 0) {
31
- return undefined;
32
- }
33
- return rpcProviders;
34
- };
35
- const getEvmDefaultRpcProvider = (configurations) => {
36
- const rpcProviders = getRpcProviders(configurations);
37
- if (!rpcProviders) {
38
- return undefined;
39
- }
40
- if (!rpcProviders.evm) {
41
- return undefined;
42
- }
43
- const defaultProvider = rpcProviders.evm.find((provider) => provider.chainId === 1);
44
- return defaultProvider;
45
- };
46
- const getSolanaDefaultRpcProvider = (configurations) => {
47
- const rpcProviders = getRpcProviders(configurations);
48
- if (!rpcProviders) {
49
- return undefined;
50
- }
51
- if (!rpcProviders.solana) {
52
- return undefined;
53
- }
54
- const defaultProvider = rpcProviders.solana.find((provider) => provider.chainId === 101);
55
- return defaultProvider;
56
- };
57
- const getEvmRpcProviderByChainId = (configurations, chainId) => {
58
- const rpcProviders = getRpcProviders(configurations);
59
- if (!rpcProviders) {
60
- return undefined;
61
- }
62
- if (rpcProviders.evm) {
63
- const evmRpcProvider = rpcProviders.evm.find((rpcProvider) => rpcProvider.chainId === chainId);
64
- return evmRpcProvider;
65
- }
66
- return undefined;
67
- };
68
-
69
- export { getEvmDefaultRpcProvider, getEvmRpcProviderByChainId, getRpcProviders, getSolanaDefaultRpcProvider };
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- class CancellablePromise extends Promise {
6
- constructor(executor) {
7
- super((resolve, reject) => {
8
- executor((val) => {
9
- if (this.isCancelled)
10
- return;
11
- resolve(val);
12
- }, (err) => {
13
- if (this.isCancelled)
14
- return;
15
- reject(err);
16
- });
17
- });
18
- this._controller = new AbortController();
19
- }
20
- get isCancelled() {
21
- return this._controller.signal.aborted;
22
- }
23
- cancel() {
24
- this._controller.abort();
25
- }
26
- static fromPromise(promise) {
27
- return new CancellablePromise((resolve, reject) => {
28
- promise.then(resolve).catch(reject);
29
- });
30
- }
31
- }
32
-
33
- exports.CancellablePromise = CancellablePromise;
@@ -1,9 +0,0 @@
1
- type Executor<T> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void) => void;
2
- export declare class CancellablePromise<T> extends Promise<T> {
3
- _controller: AbortController;
4
- constructor(executor: Executor<T>);
5
- get isCancelled(): boolean;
6
- cancel(): void;
7
- static fromPromise<T>(promise: Promise<T>): CancellablePromise<T>;
8
- }
9
- export {};
@@ -1,29 +0,0 @@
1
- class CancellablePromise extends Promise {
2
- constructor(executor) {
3
- super((resolve, reject) => {
4
- executor((val) => {
5
- if (this.isCancelled)
6
- return;
7
- resolve(val);
8
- }, (err) => {
9
- if (this.isCancelled)
10
- return;
11
- reject(err);
12
- });
13
- });
14
- this._controller = new AbortController();
15
- }
16
- get isCancelled() {
17
- return this._controller.signal.aborted;
18
- }
19
- cancel() {
20
- this._controller.abort();
21
- }
22
- static fromPromise(promise) {
23
- return new CancellablePromise((resolve, reject) => {
24
- promise.then(resolve).catch(reject);
25
- });
26
- }
27
- }
28
-
29
- export { CancellablePromise };
@@ -1 +0,0 @@
1
- export { CancellablePromise } from './CancellablePromise';
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
- var isFunction = require('../isFunction/isFunction.cjs');
7
-
8
- const applyJsonRpcSignerGates = (jsonRpcSigner, walletUiUtils, provider) => {
9
- const originalSignMessage = jsonRpcSigner.signMessage;
10
- const originalSendUncheckedTransaction = jsonRpcSigner.sendUncheckedTransaction;
11
- if (isFunction.isFunction(originalSignMessage)) {
12
- Object.assign(jsonRpcSigner, {
13
- signMessage: (message) => tslib.__awaiter(void 0, void 0, void 0, function* () {
14
- return walletUiUtils.signMessage({
15
- handler: originalSignMessage.bind(jsonRpcSigner),
16
- message,
17
- });
18
- }),
19
- });
20
- }
21
- if (isFunction.isFunction(originalSendUncheckedTransaction)) {
22
- Object.assign(jsonRpcSigner, {
23
- sendUncheckedTransaction: (transaction) => tslib.__awaiter(void 0, void 0, void 0, function* () {
24
- return walletUiUtils.sendTransaction({
25
- handler: originalSendUncheckedTransaction.bind(jsonRpcSigner),
26
- provider,
27
- transaction,
28
- });
29
- }),
30
- });
31
- }
32
- };
33
- const assignConfirmationScreenToIntermediaryMethods = (parent, walletUiUtils, provider) => {
34
- const methods = ['getSigner', 'getUncheckedSigner', 'connectUnchecked'];
35
- methods.forEach((methodName) => {
36
- const method = parent[methodName];
37
- if (!isFunction.isFunction(method)) {
38
- return;
39
- }
40
- Object.assign(parent, {
41
- [methodName]: (...args) => {
42
- const result = method.bind(parent)(...args);
43
- if (typeof result === 'object' && result !== null) {
44
- assignConfirmationScreenToIntermediaryMethods(result, walletUiUtils, provider);
45
- applyJsonRpcSignerGates(result, walletUiUtils, provider);
46
- }
47
- return result;
48
- },
49
- });
50
- });
51
- };
52
- const assignConfirmationScreenToProvider = (provider, walletUiUtils) => assignConfirmationScreenToIntermediaryMethods(provider, walletUiUtils, provider);
53
-
54
- exports.assignConfirmationScreenToProvider = assignConfirmationScreenToProvider;
@@ -1,3 +0,0 @@
1
- import { ethers } from 'ethers';
2
- import { WalletUiUtils } from '../../types';
3
- export declare const assignConfirmationScreenToProvider: (provider: ethers.providers.Web3Provider, walletUiUtils: WalletUiUtils) => void;
@@ -1,50 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import { isFunction } from '../isFunction/isFunction.js';
3
-
4
- const applyJsonRpcSignerGates = (jsonRpcSigner, walletUiUtils, provider) => {
5
- const originalSignMessage = jsonRpcSigner.signMessage;
6
- const originalSendUncheckedTransaction = jsonRpcSigner.sendUncheckedTransaction;
7
- if (isFunction(originalSignMessage)) {
8
- Object.assign(jsonRpcSigner, {
9
- signMessage: (message) => __awaiter(void 0, void 0, void 0, function* () {
10
- return walletUiUtils.signMessage({
11
- handler: originalSignMessage.bind(jsonRpcSigner),
12
- message,
13
- });
14
- }),
15
- });
16
- }
17
- if (isFunction(originalSendUncheckedTransaction)) {
18
- Object.assign(jsonRpcSigner, {
19
- sendUncheckedTransaction: (transaction) => __awaiter(void 0, void 0, void 0, function* () {
20
- return walletUiUtils.sendTransaction({
21
- handler: originalSendUncheckedTransaction.bind(jsonRpcSigner),
22
- provider,
23
- transaction,
24
- });
25
- }),
26
- });
27
- }
28
- };
29
- const assignConfirmationScreenToIntermediaryMethods = (parent, walletUiUtils, provider) => {
30
- const methods = ['getSigner', 'getUncheckedSigner', 'connectUnchecked'];
31
- methods.forEach((methodName) => {
32
- const method = parent[methodName];
33
- if (!isFunction(method)) {
34
- return;
35
- }
36
- Object.assign(parent, {
37
- [methodName]: (...args) => {
38
- const result = method.bind(parent)(...args);
39
- if (typeof result === 'object' && result !== null) {
40
- assignConfirmationScreenToIntermediaryMethods(result, walletUiUtils, provider);
41
- applyJsonRpcSignerGates(result, walletUiUtils, provider);
42
- }
43
- return result;
44
- },
45
- });
46
- });
47
- };
48
- const assignConfirmationScreenToProvider = (provider, walletUiUtils) => assignConfirmationScreenToIntermediaryMethods(provider, walletUiUtils, provider);
49
-
50
- export { assignConfirmationScreenToProvider };
@@ -1 +0,0 @@
1
- export { assignConfirmationScreenToProvider } from './assignConfirmationScreenToProvider';