@dynamic-labs/multi-wallet 0.17.0-RC.8 → 0.17.0-RC.9

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 (184) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.json +7 -12
  3. package/src/index.cjs +0 -44
  4. package/src/index.d.ts +0 -11
  5. package/src/index.js +1 -16
  6. package/src/multi-wallet.cjs +16 -64
  7. package/src/multi-wallet.d.ts +0 -1
  8. package/src/multi-wallet.js +12 -59
  9. package/src/types.d.ts +0 -2
  10. package/src/utils/message.cjs +1 -2
  11. package/src/utils/message.js +1 -2
  12. package/src/wallets/constants.cjs +0 -2
  13. package/src/wallets/constants.js +1 -2
  14. package/src/wallets/cosmos/KeplrWalletConnect.cjs +4 -6
  15. package/src/wallets/cosmos/KeplrWalletConnect.d.ts +4 -1
  16. package/src/wallets/cosmos/KeplrWalletConnect.js +2 -4
  17. package/src/wallets/cosmos/KeplrWalletConnector.d.ts +1 -2
  18. package/src/wallets/cosmos/wcClient.lib.cjs +45 -4
  19. package/src/wallets/cosmos/wcClient.lib.js +42 -3
  20. package/src/wallets/flow/lilico.cjs +2 -2
  21. package/src/wallets/flow/lilico.js +1 -1
  22. package/src/wallets/solana/phantom.cjs +3 -3
  23. package/src/wallets/solana/phantom.js +1 -1
  24. package/src/wallets/solana/solProviderHelper.cjs +3 -4
  25. package/src/wallets/solana/solProviderHelper.d.ts +3 -3
  26. package/src/wallets/solana/solProviderHelper.js +1 -2
  27. package/src/wallets/starknet/braavos.cjs +2 -2
  28. package/src/wallets/starknet/braavos.js +1 -1
  29. package/src/wallets/window.d.ts +10 -22
  30. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.cjs +0 -54
  31. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.d.ts +0 -3
  32. package/src/utils/assignConfirmationScreenToProvider/assignConfirmationScreenToProvider.js +0 -50
  33. package/src/utils/assignConfirmationScreenToProvider/index.d.ts +0 -1
  34. package/src/utils/encoding.cjs +0 -18
  35. package/src/utils/encoding.d.ts +0 -4
  36. package/src/utils/encoding.js +0 -12
  37. package/src/utils/getChainInfo/getChainInfo.cjs +0 -59
  38. package/src/utils/getChainInfo/getChainInfo.d.ts +0 -2
  39. package/src/utils/getChainInfo/getChainInfo.js +0 -55
  40. package/src/utils/getChainInfo/index.d.ts +0 -1
  41. package/src/utils/getWalletConnectorByName.cjs +0 -19
  42. package/src/utils/getWalletConnectorByName.d.ts +0 -2
  43. package/src/utils/getWalletConnectorByName.js +0 -15
  44. package/src/utils/isEmailOTPWalletConnector/index.d.ts +0 -1
  45. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.cjs +0 -7
  46. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.d.ts +0 -2
  47. package/src/utils/isEmailOTPWalletConnector/isEmailOTPWalletConnector.js +0 -3
  48. package/src/utils/isEmailWalletConnector/index.d.ts +0 -1
  49. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.cjs +0 -7
  50. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.d.ts +0 -2
  51. package/src/utils/isEmailWalletConnector/isEmailWalletConnector.js +0 -3
  52. package/src/utils/isFunction/index.d.ts +0 -1
  53. package/src/utils/isFunction/isFunction.cjs +0 -8
  54. package/src/utils/isFunction/isFunction.d.ts +0 -1
  55. package/src/utils/isFunction/isFunction.js +0 -4
  56. package/src/utils/isMobile.cjs +0 -54
  57. package/src/utils/isMobile.d.ts +0 -13
  58. package/src/utils/isMobile.js +0 -46
  59. package/src/utils/isSameAddress/index.d.ts +0 -1
  60. package/src/utils/isSameAddress/isSameAddress.cjs +0 -9
  61. package/src/utils/isSameAddress/isSameAddress.d.ts +0 -1
  62. package/src/utils/isSameAddress/isSameAddress.js +0 -5
  63. package/src/utils/isSameAddress/utils/index.d.ts +0 -1
  64. package/src/utils/isSameAddress/utils/normalizeAddress/index.d.ts +0 -1
  65. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.cjs +0 -17
  66. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.d.ts +0 -1
  67. package/src/utils/isSameAddress/utils/normalizeAddress/normalizeAddress.js +0 -13
  68. package/src/utils/isSocialWalletConnector/index.d.ts +0 -1
  69. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.cjs +0 -7
  70. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.d.ts +0 -2
  71. package/src/utils/isSocialWalletConnector/isSocialWalletConnector.js +0 -3
  72. package/src/utils/isUnsupportedProviderError/index.d.ts +0 -1
  73. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.cjs +0 -13
  74. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.d.ts +0 -6
  75. package/src/utils/isUnsupportedProviderError/isUnsupportedProviderError.js +0 -9
  76. package/src/utils/normalizeWalletName/index.d.ts +0 -1
  77. package/src/utils/normalizeWalletName/normalizeWalletName.cjs +0 -7
  78. package/src/utils/normalizeWalletName/normalizeWalletName.d.ts +0 -1
  79. package/src/utils/normalizeWalletName/normalizeWalletName.js +0 -3
  80. package/src/utils/shouldLowercaseAddress.cjs +0 -11
  81. package/src/utils/shouldLowercaseAddress.d.ts +0 -1
  82. package/src/utils/shouldLowercaseAddress.js +0 -7
  83. package/src/utils/walletConnect.cjs +0 -33
  84. package/src/utils/walletConnect.d.ts +0 -4
  85. package/src/utils/walletConnect.js +0 -29
  86. package/src/wallets/ProviderLookup.cjs +0 -18
  87. package/src/wallets/ProviderLookup.d.ts +0 -4
  88. package/src/wallets/ProviderLookup.js +0 -14
  89. package/src/wallets/clients/coinbase/coinbase.cjs +0 -73
  90. package/src/wallets/clients/coinbase/coinbase.d.ts +0 -6
  91. package/src/wallets/clients/coinbase/coinbase.js +0 -66
  92. package/src/wallets/clients/coinbase/index.d.ts +0 -2
  93. package/src/wallets/clients/coinbase/types.d.ts +0 -14
  94. package/src/wallets/clients/walletConnect/index.d.ts +0 -1
  95. package/src/wallets/clients/walletConnect/types.d.ts +0 -4
  96. package/src/wallets/clients/walletConnect/walletConnect.cjs +0 -229
  97. package/src/wallets/clients/walletConnect/walletConnect.d.ts +0 -21
  98. package/src/wallets/clients/walletConnect/walletConnect.js +0 -213
  99. package/src/wallets/ethereum/BloctoEvm.cjs +0 -109
  100. package/src/wallets/ethereum/BloctoEvm.d.ts +0 -20
  101. package/src/wallets/ethereum/BloctoEvm.js +0 -103
  102. package/src/wallets/ethereum/EthWalletConnector.cjs +0 -206
  103. package/src/wallets/ethereum/EthWalletConnector.d.ts +0 -39
  104. package/src/wallets/ethereum/EthWalletConnector.js +0 -202
  105. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.cjs +0 -61
  106. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.d.ts +0 -12
  107. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/EmailMagicWalletConnector.js +0 -57
  108. package/src/wallets/ethereum/MagicConnector/EmailMagicWalletConnector/index.d.ts +0 -1
  109. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.cjs +0 -62
  110. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.d.ts +0 -11
  111. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/EmailOTPMagicWalletConnector.js +0 -58
  112. package/src/wallets/ethereum/MagicConnector/EmailOTPMagicWalletConnector/index.d.ts +0 -1
  113. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.cjs +0 -78
  114. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.d.ts +0 -31
  115. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/MagicClientNetworkHandler.js +0 -74
  116. package/src/wallets/ethereum/MagicConnector/MagicClientNetworkHandler/index.d.ts +0 -2
  117. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.cjs +0 -61
  118. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.d.ts +0 -12
  119. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/MagicSocialWalletConnector.js +0 -57
  120. package/src/wallets/ethereum/MagicConnector/MagicSocialWalletConnector/index.d.ts +0 -1
  121. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.cjs +0 -179
  122. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.d.ts +0 -54
  123. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/MagicWalletConnector.js +0 -175
  124. package/src/wallets/ethereum/MagicConnector/MagicWalletConnector/index.d.ts +0 -2
  125. package/src/wallets/ethereum/MagicConnector/index.d.ts +0 -5
  126. package/src/wallets/ethereum/coinbase.cjs +0 -63
  127. package/src/wallets/ethereum/coinbase.d.ts +0 -22
  128. package/src/wallets/ethereum/coinbase.js +0 -61
  129. package/src/wallets/ethereum/ethProviderHelper.cjs +0 -199
  130. package/src/wallets/ethereum/ethProviderHelper.d.ts +0 -33
  131. package/src/wallets/ethereum/ethProviderHelper.js +0 -195
  132. package/src/wallets/ethereum/evm-network.cjs +0 -20
  133. package/src/wallets/ethereum/evm-network.d.ts +0 -6
  134. package/src/wallets/ethereum/evm-network.js +0 -16
  135. package/src/wallets/ethereum/injected/BloctoInjected.cjs +0 -12
  136. package/src/wallets/ethereum/injected/BloctoInjected.d.ts +0 -5
  137. package/src/wallets/ethereum/injected/BloctoInjected.js +0 -10
  138. package/src/wallets/ethereum/injected/BraveEvm.cjs +0 -12
  139. package/src/wallets/ethereum/injected/BraveEvm.d.ts +0 -5
  140. package/src/wallets/ethereum/injected/BraveEvm.js +0 -10
  141. package/src/wallets/ethereum/injected/Dawn.cjs +0 -12
  142. package/src/wallets/ethereum/injected/Dawn.d.ts +0 -5
  143. package/src/wallets/ethereum/injected/Dawn.js +0 -10
  144. package/src/wallets/ethereum/injected/ExodusEvm.cjs +0 -12
  145. package/src/wallets/ethereum/injected/ExodusEvm.d.ts +0 -5
  146. package/src/wallets/ethereum/injected/ExodusEvm.js +0 -10
  147. package/src/wallets/ethereum/injected/Frame.cjs +0 -12
  148. package/src/wallets/ethereum/injected/Frame.d.ts +0 -5
  149. package/src/wallets/ethereum/injected/Frame.js +0 -10
  150. package/src/wallets/ethereum/injected/GameStop.cjs +0 -12
  151. package/src/wallets/ethereum/injected/GameStop.d.ts +0 -5
  152. package/src/wallets/ethereum/injected/GameStop.js +0 -10
  153. package/src/wallets/ethereum/injected/InjectedWalletBase.cjs +0 -74
  154. package/src/wallets/ethereum/injected/InjectedWalletBase.d.ts +0 -24
  155. package/src/wallets/ethereum/injected/InjectedWalletBase.js +0 -72
  156. package/src/wallets/ethereum/injected/MetaMask.cjs +0 -13
  157. package/src/wallets/ethereum/injected/MetaMask.d.ts +0 -6
  158. package/src/wallets/ethereum/injected/MetaMask.js +0 -11
  159. package/src/wallets/ethereum/injected/Opera.cjs +0 -12
  160. package/src/wallets/ethereum/injected/Opera.d.ts +0 -5
  161. package/src/wallets/ethereum/injected/Opera.js +0 -10
  162. package/src/wallets/ethereum/injected/PhantomEvm.cjs +0 -36
  163. package/src/wallets/ethereum/injected/PhantomEvm.d.ts +0 -6
  164. package/src/wallets/ethereum/injected/PhantomEvm.js +0 -34
  165. package/src/wallets/ethereum/injected/Trust.cjs +0 -13
  166. package/src/wallets/ethereum/injected/Trust.d.ts +0 -6
  167. package/src/wallets/ethereum/injected/Trust.js +0 -11
  168. package/src/wallets/ethereum/injected/UnknownInjectedWallet.cjs +0 -12
  169. package/src/wallets/ethereum/injected/UnknownInjectedWallet.d.ts +0 -5
  170. package/src/wallets/ethereum/injected/UnknownInjectedWallet.js +0 -10
  171. package/src/wallets/ethereum/injected/Zerion.cjs +0 -13
  172. package/src/wallets/ethereum/injected/Zerion.d.ts +0 -6
  173. package/src/wallets/ethereum/injected/Zerion.js +0 -11
  174. package/src/wallets/getWalletConnectConnector.cjs +0 -16
  175. package/src/wallets/getWalletConnectConnector.d.ts +0 -5
  176. package/src/wallets/getWalletConnectConnector.js +0 -12
  177. package/src/wallets/walletConnect/index.d.ts +0 -2
  178. package/src/wallets/walletConnect/walletConnect.cjs +0 -133
  179. package/src/wallets/walletConnect/walletConnect.d.ts +0 -34
  180. package/src/wallets/walletConnect/walletConnect.js +0 -127
  181. package/src/wallets/walletConnect/walletConnectV2.cjs +0 -268
  182. package/src/wallets/walletConnect/walletConnectV2.d.ts +0 -38
  183. package/src/wallets/walletConnect/walletConnectV2.js +0 -262
  184. package/src/wallets/walletConnect/zerion.d.ts +0 -6
@@ -1,15 +0,0 @@
1
- import { normalizeWalletName } from './normalizeWalletName/normalizeWalletName.js';
2
-
3
- const filterWalletsByName = (wallets, names) => names
4
- .flatMap((name) => wallets.find((w) => walletHasName(w, name)))
5
- .filter(isWalletConnector);
6
- const walletHasName = (wallet, name) => normalizeWalletName(wallet.name) === name;
7
- const isWalletConnector = (item) => Boolean(item);
8
- const getWalletConnectorByName = (wallets, name) => {
9
- const normalizedWalletname = normalizeWalletName(name);
10
- return filterWalletsByName(wallets, [normalizedWalletname]).length > 0
11
- ? filterWalletsByName(wallets, [normalizedWalletname])[0]
12
- : null;
13
- };
14
-
15
- export { getWalletConnectorByName };
@@ -1 +0,0 @@
1
- export { isEmailOTPWalletConnector } from './isEmailOTPWalletConnector';
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const isEmailOTPWalletConnector = (walletConnector) => Boolean(walletConnector.verifyOneTimePassword);
6
-
7
- exports.isEmailOTPWalletConnector = isEmailOTPWalletConnector;
@@ -1,2 +0,0 @@
1
- import { IEmailOTPWalletConnector, WalletConnector } from '@dynamic-labs/wallet-connector-core';
2
- export declare const isEmailOTPWalletConnector: (walletConnector: WalletConnector | IEmailOTPWalletConnector) => walletConnector is IEmailOTPWalletConnector;
@@ -1,3 +0,0 @@
1
- const isEmailOTPWalletConnector = (walletConnector) => Boolean(walletConnector.verifyOneTimePassword);
2
-
3
- export { isEmailOTPWalletConnector };
@@ -1 +0,0 @@
1
- export { isEmailWalletConnector } from './isEmailWalletConnector';
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const isEmailWalletConnector = (walletConnector) => Boolean(walletConnector.canConnectViaEmail);
6
-
7
- exports.isEmailWalletConnector = isEmailWalletConnector;
@@ -1,2 +0,0 @@
1
- import { WalletConnector, IEmailWalletConnector } from '@dynamic-labs/wallet-connector-core';
2
- export declare const isEmailWalletConnector: (walletConnector: WalletConnector | IEmailWalletConnector) => walletConnector is IEmailWalletConnector;
@@ -1,3 +0,0 @@
1
- const isEmailWalletConnector = (walletConnector) => Boolean(walletConnector.canConnectViaEmail);
2
-
3
- export { isEmailWalletConnector };
@@ -1 +0,0 @@
1
- export { isFunction } from './isFunction';
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- // eslint-disable-next-line @typescript-eslint/ban-types
6
- const isFunction = (value) => typeof value === 'function';
7
-
8
- exports.isFunction = isFunction;
@@ -1 +0,0 @@
1
- export declare const isFunction: (value: Function | unknown) => value is Function;
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-types
2
- const isFunction = (value) => typeof value === 'function';
3
-
4
- export { isFunction };
@@ -1,54 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- /**
6
- * Sourced from http://detectmobilebrowsers.com/
7
- */
8
- /* eslint-disable max-len, no-useless-escape */
9
- const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;
10
- const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
11
- // This is a regex that covers both iphone, android and any other mobile device.
12
- const isMobile = (maxTouchPointsOverride) => {
13
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
14
- return false;
15
- }
16
- return (userAgentRegex1.test(navigator.userAgent) ||
17
- userAgentRegex2.test(navigator.userAgent.substring(0, 4)) ||
18
- isIPad(maxTouchPointsOverride) ||
19
- isIPhone());
20
- };
21
- const isIPhone = () => typeof window === 'undefined' || typeof navigator === 'undefined'
22
- ? false
23
- : /iPhone/.test(navigator.userAgent);
24
- /**
25
- * @param [optional] maxTouchPointsOverride - this is used for testing since
26
- * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
27
- * to mock it
28
- */
29
- const isIPad = (maxTouchPointsOverride) => {
30
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
31
- return false;
32
- }
33
- const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
34
- return (/iPad/.test(navigator.userAgent) ||
35
- (/Mac/.test(navigator.userAgent) && maxTouchPoints === 5));
36
- };
37
- const isIOS = (maxTouchPointsOverride) => {
38
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
39
- return false;
40
- }
41
- return isIPhone() || isIPad(maxTouchPointsOverride);
42
- };
43
- const isSamsungBrowser = () => {
44
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
45
- return false;
46
- }
47
- return navigator.userAgent.includes('SamsungBrowser');
48
- };
49
-
50
- exports.isIOS = isIOS;
51
- exports.isIPad = isIPad;
52
- exports.isIPhone = isIPhone;
53
- exports.isMobile = isMobile;
54
- exports.isSamsungBrowser = isSamsungBrowser;
@@ -1,13 +0,0 @@
1
- /**
2
- * Sourced from http://detectmobilebrowsers.com/
3
- */
4
- export declare const isMobile: (maxTouchPointsOverride?: number) => boolean;
5
- export declare const isIPhone: () => boolean;
6
- /**
7
- * @param [optional] maxTouchPointsOverride - this is used for testing since
8
- * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
9
- * to mock it
10
- */
11
- export declare const isIPad: (maxTouchPointsOverride?: number) => boolean;
12
- export declare const isIOS: (maxTouchPointsOverride?: number) => boolean;
13
- export declare const isSamsungBrowser: () => boolean;
@@ -1,46 +0,0 @@
1
- /**
2
- * Sourced from http://detectmobilebrowsers.com/
3
- */
4
- /* eslint-disable max-len, no-useless-escape */
5
- const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;
6
- const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
7
- // This is a regex that covers both iphone, android and any other mobile device.
8
- const isMobile = (maxTouchPointsOverride) => {
9
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
10
- return false;
11
- }
12
- return (userAgentRegex1.test(navigator.userAgent) ||
13
- userAgentRegex2.test(navigator.userAgent.substring(0, 4)) ||
14
- isIPad(maxTouchPointsOverride) ||
15
- isIPhone());
16
- };
17
- const isIPhone = () => typeof window === 'undefined' || typeof navigator === 'undefined'
18
- ? false
19
- : /iPhone/.test(navigator.userAgent);
20
- /**
21
- * @param [optional] maxTouchPointsOverride - this is used for testing since
22
- * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
23
- * to mock it
24
- */
25
- const isIPad = (maxTouchPointsOverride) => {
26
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
27
- return false;
28
- }
29
- const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
30
- return (/iPad/.test(navigator.userAgent) ||
31
- (/Mac/.test(navigator.userAgent) && maxTouchPoints === 5));
32
- };
33
- const isIOS = (maxTouchPointsOverride) => {
34
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
35
- return false;
36
- }
37
- return isIPhone() || isIPad(maxTouchPointsOverride);
38
- };
39
- const isSamsungBrowser = () => {
40
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
41
- return false;
42
- }
43
- return navigator.userAgent.includes('SamsungBrowser');
44
- };
45
-
46
- export { isIOS, isIPad, isIPhone, isMobile, isSamsungBrowser };
@@ -1 +0,0 @@
1
- export { isSameAddress } from './isSameAddress';
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var normalizeAddress = require('./utils/normalizeAddress/normalizeAddress.cjs');
6
-
7
- const isSameAddress = (left, right, chain) => normalizeAddress.normalizeAddress(left, chain) === normalizeAddress.normalizeAddress(right, chain);
8
-
9
- exports.isSameAddress = isSameAddress;
@@ -1 +0,0 @@
1
- export declare const isSameAddress: (left: string, right: string, chain: string) => boolean;
@@ -1,5 +0,0 @@
1
- import { normalizeAddress } from './utils/normalizeAddress/normalizeAddress.js';
2
-
3
- const isSameAddress = (left, right, chain) => normalizeAddress(left, chain) === normalizeAddress(right, chain);
4
-
5
- export { isSameAddress };
@@ -1 +0,0 @@
1
- export * from './normalizeAddress';
@@ -1 +0,0 @@
1
- export { normalizeAddress } from './normalizeAddress';
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var shouldLowercaseAddress = require('../../../shouldLowercaseAddress.cjs');
6
-
7
- const normalizeAddress = (rawAddress, chain) => {
8
- if (rawAddress.startsWith('0x')) {
9
- rawAddress = rawAddress.slice(2);
10
- }
11
- const address = shouldLowercaseAddress.shouldLowercaseAddress(chain)
12
- ? rawAddress.toLowerCase()
13
- : rawAddress;
14
- return address;
15
- };
16
-
17
- exports.normalizeAddress = normalizeAddress;
@@ -1 +0,0 @@
1
- export declare const normalizeAddress: (rawAddress: string, chain: string) => string;
@@ -1,13 +0,0 @@
1
- import { shouldLowercaseAddress } from '../../../shouldLowercaseAddress.js';
2
-
3
- const normalizeAddress = (rawAddress, chain) => {
4
- if (rawAddress.startsWith('0x')) {
5
- rawAddress = rawAddress.slice(2);
6
- }
7
- const address = shouldLowercaseAddress(chain)
8
- ? rawAddress.toLowerCase()
9
- : rawAddress;
10
- return address;
11
- };
12
-
13
- export { normalizeAddress };
@@ -1 +0,0 @@
1
- export { isSocialWalletConnector } from './isSocialWalletConnector';
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const isSocialWalletConnector = (walletConnector) => Boolean(walletConnector.canConnectViaSocial);
6
-
7
- exports.isSocialWalletConnector = isSocialWalletConnector;
@@ -1,2 +0,0 @@
1
- import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
2
- export declare const isSocialWalletConnector: (walletConnector: WalletConnector) => boolean;
@@ -1,3 +0,0 @@
1
- const isSocialWalletConnector = (walletConnector) => Boolean(walletConnector.canConnectViaSocial);
2
-
3
- export { isSocialWalletConnector };
@@ -1 +0,0 @@
1
- export { isUnsupportedProviderError } from './isUnsupportedProviderError';
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const isUnsupportedProviderError = (error) => {
6
- const isObject = typeof error === 'object';
7
- if (!isObject)
8
- return false;
9
- const isUnsupportedProviderErrorReason = error['reason'] === 'unsupported provider';
10
- return isUnsupportedProviderErrorReason;
11
- };
12
-
13
- exports.isUnsupportedProviderError = isUnsupportedProviderError;
@@ -1,6 +0,0 @@
1
- type UnsupportedProviderError = {
2
- reason: string;
3
- value: unknown;
4
- };
5
- export declare const isUnsupportedProviderError: (error: UnsupportedProviderError | unknown) => error is UnsupportedProviderError;
6
- export {};
@@ -1,9 +0,0 @@
1
- const isUnsupportedProviderError = (error) => {
2
- const isObject = typeof error === 'object';
3
- if (!isObject)
4
- return false;
5
- const isUnsupportedProviderErrorReason = error['reason'] === 'unsupported provider';
6
- return isUnsupportedProviderErrorReason;
7
- };
8
-
9
- export { isUnsupportedProviderError };
@@ -1 +0,0 @@
1
- export { normalizeWalletName } from './normalizeWalletName';
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const normalizeWalletName = (name) => name.replace(/\W/g, '').toLowerCase();
6
-
7
- exports.normalizeWalletName = normalizeWalletName;
@@ -1 +0,0 @@
1
- export declare const normalizeWalletName: (name: string) => string;
@@ -1,3 +0,0 @@
1
- const normalizeWalletName = (name) => name.replace(/\W/g, '').toLowerCase();
2
-
3
- export { normalizeWalletName };
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const shouldLowercaseAddress = (chain) =>
6
- // these are standard from CAIP-2: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
7
- // see also: https://github.com/ChainAgnostic/namespaces
8
- // note: no standard namespace currently exists for flow
9
- ['eip155', 'flow', 'evm', 'eth'].includes(chain.toLowerCase());
10
-
11
- exports.shouldLowercaseAddress = shouldLowercaseAddress;
@@ -1 +0,0 @@
1
- export declare const shouldLowercaseAddress: (chain: string) => boolean;
@@ -1,7 +0,0 @@
1
- const shouldLowercaseAddress = (chain) =>
2
- // these are standard from CAIP-2: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
3
- // see also: https://github.com/ChainAgnostic/namespaces
4
- // note: no standard namespace currently exists for flow
5
- ['eip155', 'flow', 'evm', 'eth'].includes(chain.toLowerCase());
6
-
7
- export { shouldLowercaseAddress };
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var walletBook = require('@dynamic-labs/wallet-book');
6
- var walletConnect = require('../wallets/walletConnect/walletConnect.cjs');
7
- var walletConnectV2 = require('../wallets/walletConnect/walletConnectV2.cjs');
8
-
9
- const fetchWalletConnectWallets = ({ isV2Enabled, }) => Object.values(walletBook.useWalletBook().wallets)
10
- .filter((wallet) => wallet.walletConnect)
11
- .map((wallet) => {
12
- var _a;
13
- const { shortName } = wallet;
14
- const name = shortName || wallet.name;
15
- // justification: we filtered out null/undefined above
16
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
17
- if (isV2Enabled && ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
18
- return class extends walletConnectV2 {
19
- constructor(props) {
20
- super(Object.assign(Object.assign({}, props), { walletName: name }));
21
- }
22
- };
23
- }
24
- else {
25
- return class extends walletConnect {
26
- constructor(props) {
27
- super(Object.assign(Object.assign({}, props), { walletName: name }));
28
- }
29
- };
30
- }
31
- });
32
-
33
- exports.fetchWalletConnectWallets = fetchWalletConnectWallets;
@@ -1,4 +0,0 @@
1
- import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
2
- export declare const fetchWalletConnectWallets: ({ isV2Enabled, }: {
3
- isV2Enabled: boolean;
4
- }) => Array<WalletConnectorConstructor>;
@@ -1,29 +0,0 @@
1
- import { useWalletBook } from '@dynamic-labs/wallet-book';
2
- import WalletConnect from '../wallets/walletConnect/walletConnect.js';
3
- import WalletConnectV2 from '../wallets/walletConnect/walletConnectV2.js';
4
-
5
- const fetchWalletConnectWallets = ({ isV2Enabled, }) => Object.values(useWalletBook().wallets)
6
- .filter((wallet) => wallet.walletConnect)
7
- .map((wallet) => {
8
- var _a;
9
- const { shortName } = wallet;
10
- const name = shortName || wallet.name;
11
- // justification: we filtered out null/undefined above
12
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13
- if (isV2Enabled && ((_a = wallet.walletConnect.sdks) === null || _a === void 0 ? void 0 : _a.includes('sign_v2'))) {
14
- return class extends WalletConnectV2 {
15
- constructor(props) {
16
- super(Object.assign(Object.assign({}, props), { walletName: name }));
17
- }
18
- };
19
- }
20
- else {
21
- return class extends WalletConnect {
22
- constructor(props) {
23
- super(Object.assign(Object.assign({}, props), { walletName: name }));
24
- }
25
- };
26
- }
27
- });
28
-
29
- export { fetchWalletConnectWallets };
@@ -1,18 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const ProviderLookup = (installedProviders, providerFlags) => {
6
- if (providerFlags.length === 0) {
7
- return undefined;
8
- }
9
- return installedProviders.find((provider) => {
10
- const providerFlagMatch = providerFlags.every((condition) => {
11
- const flagValue = (provider === null || provider === void 0 ? void 0 : provider[condition.flag]) || false;
12
- return flagValue === condition.value;
13
- });
14
- return providerFlagMatch === true;
15
- });
16
- };
17
-
18
- exports.ProviderLookup = ProviderLookup;
@@ -1,4 +0,0 @@
1
- import { IEthereum, ISolana, ProviderCondition } from './window';
2
- type AllowedProvidersInterfaces = IEthereum | ISolana;
3
- export declare const ProviderLookup: <T extends AllowedProvidersInterfaces>(installedProviders: T[], providerFlags: Array<ProviderCondition>) => T | undefined;
4
- export {};
@@ -1,14 +0,0 @@
1
- const ProviderLookup = (installedProviders, providerFlags) => {
2
- if (providerFlags.length === 0) {
3
- return undefined;
4
- }
5
- return installedProviders.find((provider) => {
6
- const providerFlagMatch = providerFlags.every((condition) => {
7
- const flagValue = (provider === null || provider === void 0 ? void 0 : provider[condition.flag]) || false;
8
- return flagValue === condition.value;
9
- });
10
- return providerFlagMatch === true;
11
- });
12
- };
13
-
14
- export { ProviderLookup };
@@ -1,73 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tslib = require('tslib');
6
- var walletSdk = require('@coinbase/wallet-sdk');
7
- var utils$1 = require('ethers/lib/utils');
8
- var utils = require('@dynamic-labs/utils');
9
- var constants = require('../../constants.cjs');
10
-
11
- const jsonRpcUrl = `https://mainnet.infura.io/v3/${constants.infuraId}`;
12
- const chainId = 1;
13
- const getCoinbaseProvider = ({ opts: { appLogoUrl, appName = '', evmNetworks = [] } = {}, handlers, }) => {
14
- var _a, _b;
15
- const coinbaseWalletSDK = new walletSdk.CoinbaseWalletSDK({
16
- appLogoUrl,
17
- appName,
18
- eventListener: {
19
- onEvent: (eventType) => {
20
- if (eventType === 'walletlink_sdk.disconnected') {
21
- handlers === null || handlers === void 0 ? void 0 : handlers.onDisconnect();
22
- }
23
- },
24
- },
25
- headlessMode: true,
26
- reloadOnDisconnect: false,
27
- });
28
- const network = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.find((network) => network.chainId === chainId);
29
- const rpcUrl = ((_a = network === null || network === void 0 ? void 0 : network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = network === null || network === void 0 ? void 0 : network.rpcUrls) === null || _b === void 0 ? void 0 : _b[0]) || jsonRpcUrl;
30
- return coinbaseWalletSDK.makeWeb3Provider(rpcUrl, chainId);
31
- };
32
- const killCoinbaseSession = () => {
33
- const provider = getCoinbaseProvider({
34
- opts: { appLogoUrl: '', appName: '' },
35
- });
36
- if (provider.connected) {
37
- provider.close();
38
- }
39
- };
40
- const fetchPublicAddress = (coinbaseProviderOpts, opts) => tslib.__awaiter(void 0, void 0, void 0, function* () {
41
- var _a;
42
- const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
43
- const { qrUrl } = provider;
44
- if (!qrUrl) {
45
- throw new utils.DynamicError('no qr url available');
46
- }
47
- (_a = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _a === void 0 ? void 0 : _a.call(opts, qrUrl);
48
- const [address] = yield provider.request({
49
- method: 'eth_requestAccounts',
50
- });
51
- return address;
52
- });
53
- const signMessage = (coinbaseProviderOpts, messageToSign) => tslib.__awaiter(void 0, void 0, void 0, function* () {
54
- const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
55
- const [address] = yield provider.request({
56
- method: 'eth_requestAccounts',
57
- });
58
- try {
59
- return yield provider.request({
60
- method: 'personal_sign',
61
- params: [utils$1.hexlify(utils$1.toUtf8Bytes(messageToSign)), address.toLowerCase()],
62
- });
63
- }
64
- catch (err) {
65
- yield provider.close();
66
- return undefined;
67
- }
68
- });
69
-
70
- exports.fetchPublicAddress = fetchPublicAddress;
71
- exports.getCoinbaseProvider = getCoinbaseProvider;
72
- exports.killCoinbaseSession = killCoinbaseSession;
73
- exports.signMessage = signMessage;
@@ -1,6 +0,0 @@
1
- import { FetchPublicAddressOpts } from '@dynamic-labs/wallet-connector-core';
2
- import { GetCoinbaseProvider, GetCoinbaseProviderOpts } from './types';
3
- export declare const getCoinbaseProvider: GetCoinbaseProvider;
4
- export declare const killCoinbaseSession: () => void;
5
- export declare const fetchPublicAddress: (coinbaseProviderOpts: GetCoinbaseProviderOpts, opts?: FetchPublicAddressOpts) => Promise<string | undefined>;
6
- export declare const signMessage: (coinbaseProviderOpts: GetCoinbaseProviderOpts, messageToSign: string) => Promise<string | undefined>;
@@ -1,66 +0,0 @@
1
- import { __awaiter } from 'tslib';
2
- import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk';
3
- import { hexlify, toUtf8Bytes } from 'ethers/lib/utils.js';
4
- import { DynamicError } from '@dynamic-labs/utils';
5
- import { infuraId } from '../../constants.js';
6
-
7
- const jsonRpcUrl = `https://mainnet.infura.io/v3/${infuraId}`;
8
- const chainId = 1;
9
- const getCoinbaseProvider = ({ opts: { appLogoUrl, appName = '', evmNetworks = [] } = {}, handlers, }) => {
10
- var _a, _b;
11
- const coinbaseWalletSDK = new CoinbaseWalletSDK({
12
- appLogoUrl,
13
- appName,
14
- eventListener: {
15
- onEvent: (eventType) => {
16
- if (eventType === 'walletlink_sdk.disconnected') {
17
- handlers === null || handlers === void 0 ? void 0 : handlers.onDisconnect();
18
- }
19
- },
20
- },
21
- headlessMode: true,
22
- reloadOnDisconnect: false,
23
- });
24
- const network = evmNetworks === null || evmNetworks === void 0 ? void 0 : evmNetworks.find((network) => network.chainId === chainId);
25
- const rpcUrl = ((_a = network === null || network === void 0 ? void 0 : network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = network === null || network === void 0 ? void 0 : network.rpcUrls) === null || _b === void 0 ? void 0 : _b[0]) || jsonRpcUrl;
26
- return coinbaseWalletSDK.makeWeb3Provider(rpcUrl, chainId);
27
- };
28
- const killCoinbaseSession = () => {
29
- const provider = getCoinbaseProvider({
30
- opts: { appLogoUrl: '', appName: '' },
31
- });
32
- if (provider.connected) {
33
- provider.close();
34
- }
35
- };
36
- const fetchPublicAddress = (coinbaseProviderOpts, opts) => __awaiter(void 0, void 0, void 0, function* () {
37
- var _a;
38
- const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
39
- const { qrUrl } = provider;
40
- if (!qrUrl) {
41
- throw new DynamicError('no qr url available');
42
- }
43
- (_a = opts === null || opts === void 0 ? void 0 : opts.onDisplayUri) === null || _a === void 0 ? void 0 : _a.call(opts, qrUrl);
44
- const [address] = yield provider.request({
45
- method: 'eth_requestAccounts',
46
- });
47
- return address;
48
- });
49
- const signMessage = (coinbaseProviderOpts, messageToSign) => __awaiter(void 0, void 0, void 0, function* () {
50
- const provider = getCoinbaseProvider({ opts: coinbaseProviderOpts });
51
- const [address] = yield provider.request({
52
- method: 'eth_requestAccounts',
53
- });
54
- try {
55
- return yield provider.request({
56
- method: 'personal_sign',
57
- params: [hexlify(toUtf8Bytes(messageToSign)), address.toLowerCase()],
58
- });
59
- }
60
- catch (err) {
61
- yield provider.close();
62
- return undefined;
63
- }
64
- });
65
-
66
- export { fetchPublicAddress, getCoinbaseProvider, killCoinbaseSession, signMessage };